# OneAgent site file guide for AI agents - spec 1.3

This guide is for an AI coding agent (or a developer) who writes the `oneagent.txt` of a website so that OneAgent can
search it. It targets OneAgent site-file spec 1.3 (cumulative: 1.1 + 1.2 + 1.3). Read it top to bottom once,
then work through part 12 until the verification says **Ready**.

- `<ONEAGENT>` below is the address of the OneAgent that served this guide (scheme and host, for example the
  address of the verify page you opened). Every OneAgent address in this guide is a path on that host.
- Text under a heading "Spec §N" is the normative specification (section N of the specification essentials); where it
  says "section N" it means that Spec §N. The JSON schemas in part 11 decide the exact shape.

## Contents

1. What OneAgent is and what the file is for
2. How to choose the kind
3. The file layout
4. Every manifest field
5. The facets endpoint contract
6. Spec 1.3 site signals
7. Writing mapping rules and grammar
8. Auth and secrets
9. Site-side checklist
10. Two complete example files
11. The ten bundled JSON schemas
12. Your loop: write, verify, fix, repeat
13. Final checklist before you hand the file over

## 1. What OneAgent is and what the file is for

- OneAgent is an AI assistant that searches partner websites for its users: deals, listings, products, articles.
- A site joins by publishing ONE text file, `oneagent.txt`, that describes how OneAgent may search it. The site does no AI.
- OneAgent's model turns a user's message into what the site understands: structured parameters for a JSON API, or one
  free-text query for the site's own search page.
- OneAgent calls the site, maps every answer onto its one item shape (CanonicalDeal) and shows the items in the site's
  own look (the file's `pageLayout`). Users open each item on the site itself.
- The file is the single source of truth: endpoints or search URL, how to map the answers, the site's vocabulary, the
  rules for writing queries, pacing and the card look. Nothing else has to change on the site.
- An administrator of OneAgent adds the site from this file, enters the site's key (never in the file), reviews and
  activates it. You check the file yourself first with the verify page or API (part 12).

## 2. How to choose the kind

Pick the kind by what the site already has; OneAgent adapts to the site, not the other way round.

- The site has JSON endpoints: `structuredApi`. Either a POST `narrow` endpoint that takes OneAgent's NarrowDealsRequest,
  OR (spec 1.2) the site's OWN parameters declared in `parameters` and placed by `requests` templates, OR only a
  JSON `list` of all items.
- The site has a search page (HTML) or a search URL that answers JSON, taking one free-text query: `querySearch`.
- When both exist, prefer `structuredApi`: ids and numbers filter more precisely than free text.

### Spec §3. Choosing the kind

| The site has | Kind | What OneAgent sends |
|---|---|---|
| JSON endpoints with a POST that filters by structured parameters (ids from vocabularies, numbers, dates) | `structuredApi` (1.1 narrow) | a NarrowDealsRequest object POSTed to `endpoints.narrow` |
| JSON endpoints that take the site's OWN parameters (a GET with query parameters or a POST body) | `structuredApi` with declared `parameters` + `requests` (1.2) | one object keyed by the site's own parameter names, placed by a request template |
| only a JSON list of all items | `structuredApi` with `endpoints.list` | nothing; OneAgent pages the list and filters itself |
| an existing search page (HTML) or a search URL that answers JSON, taking one free-text query | `querySearch` | one plain-text query line (and, in 1.2, declared extra URL parameters) |

## 3. The file layout

Write the file as short prose sections plus fenced json blocks. Use `{BASE_URL}` for every URL of the site, declare one
manifest, and declare the LOWEST `oneagentSpec` that covers the members you use.

### Spec §1. What the file is

- A site describes itself to OneAgent in ONE text file, its `oneagent.txt`, normally served at
  `<BASE_URL>/oneagent.txt` as `text/plain` (UTF-8, no byte-order mark).
- ALL the AI lives in OneAgent. The site does no AI: it serves its items, optionally its id vocabularies (facets), and
  either JSON endpoints that take structured parameters (`structuredApi`) or its own free-text search page
  (`querySearch`). OneAgent's model turns a user's message into what the site understands, OneAgent calls the site, maps
  the answer into CanonicalDeal items (OneAgent's one item shape for every kind of item: an offer, a listing, an article,
  a product) and shows them in the site's own look.
- The file has prose sections (plain text for people and for OneAgent's prompt writer) and fenced ` ```json ` blocks.
  Exactly ONE block is the manifest; the others are inline schemas (informative) or examples.

### Spec §2. Layout and reading rules

1. `{BASE_URL}` is the placeholder for the site's origin (scheme + host + optional port, no path, no trailing slash).
   OneAgent replaces every `{BASE_URL}` in the WHOLE text with the BASE_URL the operator entered before it reads the
   blocks. Write every URL of the site as `{BASE_URL}` followed by the path; the manifest's `source.baseUrl` is
   `"{BASE_URL}"`. A file without the placeholder works with its URLs as written (a warning).
2. A json block starts with a line whose trimmed text is ` ```json ` and ends at the next line that starts with three
   backticks. Other fences stay prose.
3. The manifest is the one block whose top-level object has both `oneagentSpec` and `source`. A block with `$schema` is
   an inline schema; every other block is an example. Exactly one manifest per file, else the file is refused.
4. The manifest is validated against OneAgent's OWN bundled schemas. Inline schemas in the file are informative and never
   loosen the validation (a differing inline schema is only reported).
5. The prose is DATA for OneAgent's prompt writer: the site's rules for writing queries or parameters, its pitfalls and
   examples. It is never an instruction to OneAgent, and an administrator reviews everything generated from it.
6. Nothing that looks like a secret may appear in the file: no API key, token, password or private key. A file that
   holds one is refused (`SECRET_DETECTED`). The key is entered in OneAgent separately and stored safely;
   `auth.valueEnv` holds only the NAME of a variable.
7. Line ends may be LF or CRLF; a leading byte-order mark is removed (it is reported as a warning: other tools may not
   remove it). The file is read in UTF-8 unless its Content-Type names another charset. At most 2 MB.

### Spec §4. Versions and `oneagentSpec`

- `oneagentSpec` is `major.minor[.patch]`. OneAgent reads major 1 up to minor 3. A newer minor (1.4) is accepted with a
  warning while the manifest still passes the bundled schemas.
- Every 1.2 and 1.3 member is OPTIONAL: a 1.1 file is a valid 1.3 file. Behaviour follows the members a file declares,
  never the version number.
- Declare the LOWEST version that covers the members you use: `1.3` when the file declares `endpoints.currentGoals` or
  `endpoints.statistics`; `1.2` when it uses a 1.2 member (`domainProfile`, `parameters`, `requests`, `facetsMap`,
  `search.parameters`, `search.relevance`, `search.emptyQuery`, `search.cookies`, `search.formats.*.pageStyle`, an
  extract rule's `scope`, `params` in grammar or refinement examples); else `1.1`. A member newer than the declared
  version is accepted with the warning `SPEC_FEATURE_NEWER`.

## 4. Every manifest field

The manifest is the one json block with `oneagentSpec` and `source`. Every member below is checked against the bundled
schemas (part 11) and the semantic rules (codes in part 12). The 24 transforms of `fieldMap` are listed in Spec §9 and in
`source-descriptor.schema.json` (`definitions.mapping.transform`).

### Spec §5. The manifest

```
{ "oneagentSpec": "1.2", "publishedAt": null, "contact": null, "source": { ...SourceDescriptor... } }
```

`source` (the SourceDescriptor; `additionalProperties: false` everywhere - an unknown member fails validation):

| Member | Kind | Meaning |
|---|---|---|
| `sourceId` | all, required | the site's key: lowercase letters, digits, `-`, `_` (at most 64; `add`, `new` and `files` are reserved) |
| `name` | all, required | the site's name as users know it (at most 200) |
| `kind` | all, required | `structuredApi` or `querySearch` |
| `domain` | all | what the items are: `deals`, `realEstate`, `news`, `products`, ... (copied to each item's `kind`) |
| `language` | all | the main language of the content and of queries (`hr`, `en`) |
| `baseUrl` | all | always `"{BASE_URL}"` |
| `specUrl` | all | where the file is published, normally `"{BASE_URL}/oneagent.txt"` |
| `auth` | all | `{type: open | apiKey | bearer | basic, in: header | query, name, valueEnv}` (section 11) |
| `endpoints` | see section 6 | `list`, `narrow`, `detail`, `facets` (structuredApi), `currentGoals`, `statistics` (1.3, any kind) |
| `capabilities` | structuredApi | `supportedParams`, `clientSideParams`, `facets`, `paramFacets`, `mappingRules` (section 6) |
| `fieldMap`, `listPath` | structuredApi | the mapping of a raw record onto CanonicalDeal (section 9) and the path of the item array |
| `parameters`, `requests`, `facetsMap` | structuredApi, 1.2 | declared parameters, request templates, vocabularies (section 7) |
| `domainProfile` | all, 1.2 | the site's own item fields (section 7.4) |
| `search` | querySearch | the search URL, formats, extract rules, grammar, refinement (section 8) |
| `politeness` | all | request pacing and the User-Agent (section 10) |
| `pageLayout` | all | the card look: `colors`, `typography`, `card` (required), `radius`, `shadow`, `tokens`, `components`, `assets`, `breakpoints` (page-layout.schema.json) |
| `$comment` | all | a note; ignored |

### Spec §6. structuredApi (1.1)

#### 6.1 Endpoints

Each endpoint is `{method, path, authRequired, requestSchemaRef, responseSchemaRef}`; `path` starts with a single `/` and
is relative to BASE_URL (no `://`, `#` or `/../`, no `{...}` except `{id}` in `detail`).

| Endpoint | Method | Contract |
|---|---|---|
| `narrow` | POST | body = a NarrowDealsRequest (narrow-request.schema.json); answer = a NarrowDealsResponse (narrow-response.schema.json): `{sourceId, deals: [...], usedLevel, usedLevelName, levels, rejected, warnings, error}` |
| `list` | GET | all live items, the item array at `listPath` (default `deals`, else a root array) |
| `detail` | GET | one item; the path holds `{id}` |
| `facets` | GET | the id vocabularies (6.2) |

A structuredApi site needs `narrow` or `list` (or, in 1.2, `requests.search` / `requests.list`). The site's filter is
deterministic: the same parameters always give the same items, and it runs no AI.

#### 6.3 Capabilities

- `supportedParams`: the NarrowDealsRequest parameters the site filters itself. `clientSideParams`: parameters OneAgent
  applies after fetching. A parameter is never in both.
- `paramFacets`: which vocabulary each id parameter uses (`{"categoryIds": "category", "locationIds": "location"}`); the
  vocabulary must be inline or loadable from the facets endpoint.
- `mappingRules`: plain-language rules for OneAgent's model when it turns a user's text into this site's parameters
  ("A city the user names goes to locationIds, a region to travelLocationIds."). Section 14 says how to write them.

### Spec §7. structuredApi additions of spec 1.2 ("we adapt, not them")

#### 7.1 Declared parameters (`parameters`)

```json
{ "name": "section", "type": "idList", "facet": "section", "maxItems": 3,
  "description": "Section ids; only when the user names a section." }
```

| Member | Rule |
|---|---|
| `name` | required: the site's own parameter name (server-side) or OneAgent's filter name (client-side); unique |
| `type` | required: `string`, `number`, `integer`, `boolean`, `date` (`yyyy-MM-dd`), `datetime`, `enum`, `idList`, `textList` |
| `description` | required, at most 2000: what the parameter means and when to use it (DATA for OneAgent's model; section 14) |
| `in` | `query` or `body`: where a value goes when no request template places it |
| `facet` | the vocabulary of an id parameter (a `facetsMap` key, a `capabilities.facets` key, or a vocabulary of the facets answer); only ids of that vocabulary are ever sent |
| `enum`, `labels` | the allowed values and their human labels (site language) |
| `min`, `max`, `maxItems`, `maxLength` | ranges and sizes by type |
| `examples`, `required`, `note` | example values; the site needs it in every request; a note for people |
| `clientSide`, `field`, `compare`, `whenMissing` | `clientSide: true` = never sent: OneAgent filters the fetched items on `field` (a CanonicalDeal path) with `compare` (`eq`, `ne`, `contains`, `gte`, `lte`, `gt`, `lt`, `in`); an item without the field is kept (`whenMissing: keep`, default) or dropped (`drop`) |

When a site declares `parameters` (even an empty list), OneAgent's model writes ONE JSON object keyed by these names and
OneAgent validates it against the declarations (types, ranges, enum values, the facet ids, maxItems; unknown keys are
dropped). The NarrowDealsRequest rules then do not apply.

#### 7.2 Request templates (`requests`)

```json
"requests": {
  "search": { "method": "GET", "path": "/api/v1/articles",
              "query": { "q": "{q}", "section": "{section}", "lang": "hr" }, "arrayStyle": "comma",
              "paging": { "style": "page", "param": "page", "base": 1, "sizeParam": "size", "size": 20, "maxPages": 3 },
              "listPath": "results", "totalPath": "totalResults" },
  "detail": { "method": "GET", "path": "/api/v1/articles/{id}" }
}
```

- Operations: `search`, `list`, `detail`, `facets` (no other). `method` GET or POST (`detail` and `facets` GET; a GET has
  no `body`). `path` is relative to BASE_URL; only `detail` holds `{id}`.
- `query`: the site's parameter name -> a placeholder `"{param}"` (a declared server-side parameter, left out when
  unset) or a constant. `body` (POST): a JSON template whose string values may be `"{param}"`; a whole-value placeholder
  keeps the parameter's JSON type. OneAgent encodes and serialises every value itself.
- Placeholders: a declared server-side parameter (never a client-side one) or a built-in one: `{page}`, `{pageSize}`,
  `{offset}`, `{cursor}`, and `{id}` in `detail`.
- `arrayStyle` for a list in the query: `repeat` `a=1&a=2` (default), `comma` `a=1,2`, `brackets` `a[]=1&a[]=2`.
- `paging`: `style` `page` (`param` from `base` 0 or 1), `offset` (`param` = the item offset, base 0), `cursor` (`param`
  + `nextCursorPath`) or `none`; `sizeParam` + `size`; `maxPages`.
- `listPath`, `totalPath`, `idPath`: dotted paths with `[n]` indexes into the answer / one item.
- A template never sets the credential's own parameter: auth is applied only as `auth` declares it. Only the file's own
  origin is ever called.

#### 7.3 Vocabularies (`facetsMap`)

```json
"facetsMap": { "section": { "endpoint": "/api/v1/sections", "listPath": "data.sections", "idPath": "sectionId",
                            "labelPath": "title", "parentPath": "parent.sectionId" } }
```

Each vocabulary has exactly ONE source: `endpoint` (a GET path), `request` (a template name) or `enum` (inline ids or
`{id, label, parentId}`, for example taken from the site's OpenAPI). `listPath` (absent = the answer is the list),
`idPath` (default `id`), `labelPath` (default `label`), `parentPath` and `extra` (name -> path) read the values.

#### 7.4 Item fields (`domainProfile`, any kind)

```json
"domainProfile": {
  "itemNoun": { "hr": "članak", "en": "article" },
  "fields": [ { "key": "publishedAt", "label": { "hr": "Objavljeno", "en": "Published" }, "type": "date",
                "source": "publishedAt", "roles": ["meta", "compare"], "better": "higher" } ],
  "minCoverage": 0.8
}
```

- `itemNoun` `{hr, en}`: what one item is called. `fields` (at most 40): `key` camelCase, unique; `label` `{hr, en}`;
  `type` `text`, `number`, `currency`, `percent`, `date`, `datetime`, `boolean`, `url`, `enum`; `unit`; `source` a
  CanonicalDeal path (`attributes.<key>` for the site's own values); `roles` from `card`, `badge`, `meta`, `compare`,
  `chartMetric` (numeric types only), `chartGroup`, `detail`; `better` `higher` / `lower` / `none` (ordered types only);
  `required` (the item should always have it).
- At most 12 `compare` fields and 20 card fields (`card`, `badge`, `meta`). `imagePaths`: dotted paths into the site's
  RAW record where the pictures are, main picture first. `minCoverage` 0-1 (default 0.8): the share of items of a page
  that must have `id`, `title` and every `required` field.

### Spec §8. querySearch

#### 8.1 The search spec (`search`)

| Member | Meaning |
|---|---|
| `queryParam` | required: the name of the free-text parameter (`q`) |
| `queryEncoding` | the charset the query value is percent-encoded in (`utf-8`, `iso-8859-2`) |
| `maxQueryLength` | 1-2000 |
| `preferredFormat` | required: the key of the format OneAgent uses (normally `html`) |
| `formats` | required: format key (`html`, `json`) -> a search format (8.2); the key equals its `responseFormat`; `xml` is not supported as the preferred format |
| `queryInfo` | optional parse-only format (shows how the site understood a query, returns no items) |
| `grammar` | how the site's search understands text: `summary`, `rules[]`, `modifiers` (name -> exact text to append), `pitfalls[]`, `examples[]` (`{user, query, note, params}`); at least one example (OneAgent's onboarding searches the first one) |
| `refinement` | `strategy: rewriteQuery`, `rules[]`, `examples[]` (`{current, user, query, note, params}`): follow-ups rewrite the current query and search again from page 1 |
| `parameters` (1.2) | extra URL parameters next to the query (`in` is always `query`) and client-side filters, as 7.1; a name never clashes with the query, page, page-size or a fixed parameter; no `facet` (declare `enum` values) |
| `relevance` (1.2) | `keyword` (default) or `semantic`: a vector search that never shows an empty state and orders by similarity |
| `emptyQuery` (1.2) | `none` (default) or `latest`: a request without the query parameter is the latest-items feed |
| `cookies` (1.2) | at most 20 `{name, value, path, reason}` sent to the site's own origin (no control characters, no `;` or `=` in a name, no `;` in an unquoted value, ASCII only) |

#### 8.2 A search format

`{method: GET, path, fixedParams, pageParam, pageBase (0 or 1), firstPageOmitsParam, pageSize, pageSizeParam, maxPages,
pageStyle (1.2: page or offset), responseFormat (html | json), responseEncoding, authRequired, listPath, totalPath,
recognizedWordsPath, extract, fieldMap, notes, aiAssist}`.

- The URL is `BASE_URL + path + fixedParams + queryParam=<query, percent-encoded in queryEncoding>` + the page
  parameter (converted to `pageBase`; left out on page 1 with `firstPageOmitsParam`). A querySearch format is always GET.
- `pageStyle: offset` (1.2): `pageParam` carries `(page - 1) x pageSize` from 0; it needs `pageParam`, `pageSize` and
  `pageBase` 0.
- `fixedParams` never contain the query, page or page-size parameter. `pageParam` needs `pageBase`; `pageSizeParam`
  needs `pageSize`.
- `json`: the items at `listPath` (required), the total at `totalPath`, the site's per-word feedback at
  `recognizedWordsPath`.
- `html`: the items come from the `extract` rules (8.3); a format without `extract` is valid only with
  `aiAssist.generateRules: true` (OneAgent then proposes the rules from a sample page, and an administrator approves them).
- `fieldMap` maps each raw record onto CanonicalDeal (section 9); it may not be empty on a search format. For html, the
  first segment of a `from` is a field of `extract.fields`.

#### 8.3 HTML extraction (`extract`)

1. The body is decoded with `responseEncoding` and parsed as HTML5 (lenient).
2. `item`: a CSS selector for one result; items matching or containing a `skip` selector are ignored.
3. `fields`: raw field name -> `{selector, attr, pattern, all, scope}`. No selector = the item itself; `attr` reads an
   attribute, else the whitespace-collapsed text; `pattern` keeps capture group 1; `all` returns every match as a list;
   `scope: nextSibling` (1.2) runs the selector inside the item's next element sibling.
4. `dedupeBy`: a field whose repeated value drops the item (also across pages).
5. Page-level rules: `total` (then read as a European number), `recognizedWords` / `unrecognizedWords` (how the site
   understood the query), `emptyState` (a selector present when nothing was found), `fallbackMarker` (present when the
   page shows results for a DIFFERENT, similar query - those items are never presented as matches), `nextPage`.
6. Paging stops at `maxPages`, at a page with fewer than `pageSize` items, when `nextPage` is absent, or when a page adds
   no new ids.

#### 8.4 AI-assisted rules (`aiAssist`, html formats only)

`{generateRules, runtimeFallback: never | repairRecipe, region, sampleItems (1-50), health: {minItemsWhenResults,
requiredFields, minCoverage}, hints[]}`. OneAgent's model never receives HTML: OneAgent builds a PageDigest (the
repeating blocks of the page, their fields with fill rates and short samples, the page texts and the pagination links)
and the model proposes extract rules + fieldMap from it (extraction-recipe.schema.json). OneAgent runs the proposal on the
same page and checks it; an administrator approves it. `health` says when rules are broken on a live page: not an empty
page AND (fewer than `minItemsWhenResults` items OR a share below `minCoverage` of items having every `requiredFields`
field). `hints` are site facts for that model (which block is an advert, which field is the price).

### Spec §9. Mapping onto CanonicalDeal (`fieldMap`)

A fieldMap is `{"<target path>": Mapping}`; an empty fieldMap of a structuredApi site means the site already answers in
CanonicalDeal. For each entry, in order:

1. value = `const` when present, else the raw value at `from` (a dotted path; `[n]` indexes; keys may contain `-`).
2. A non-empty string with `pattern` keeps capture group 1 of the first match (no match -> null). .NET regex syntax,
   one unnamed capture group (named groups are refused).
3. `transform` (one name or a list, applied left to right; `arg` is passed to each). Null or "" input gives null.
4. A null or "" value takes `default` when present.
5. A non-empty value is set at the target path (objects and arrays are created; `images[0]` creates the list).

The 24 transforms (the only valid names):

| Transform | Rule |
|---|---|
| `none` | value unchanged |
| `trim` | HTML entities decoded, whitespace collapsed, trimmed |
| `toNumber` | a number from a JSON number or an invariant string (`"3111.11"`) |
| `toInteger` | toNumber, then truncated |
| `parseEuropeanNumber` | `"140.000"` -> 140000, `"45,00"` -> 45, `"1.350.000 €"` -> 1350000 |
| `toBoolean` | `"0"`, `"false"`, `"no"`, `"ne"` -> false; other text -> true; booleans pass through |
| `toDate` | the first 10 characters of an ISO date or date-time |
| `parseEuropeanDate` | `"12.02.2026."` -> 2026-02-12; `"Danas"` -> today; `"Jučer"` -> yesterday |
| `stripHtml` | tags removed, entities decoded, whitespace collapsed |
| `kunaToEur` | HRK -> EUR at 7.5345, 2 decimals |
| `splitCsv` | `"a, b"` -> `["a","b"]` |
| `firstImage` | the first element of a list |
| `joinTerms` | a list -> a space-joined string |
| `priceHistoryLines` | every `"dd.mm.yyyy - 140.000 €"` pair -> `[{date, amount}]` |
| `absoluteUrl` | keeps http(s)://; `"//x"` -> `https://x`; `"/p"` -> BASE_URL/p; `"www.site.example/p"` -> https://...; else BASE_URL/value |
| `fixDoubleScheme` | `"http://https://x"` -> `"https://x"` |
| `urlDecode` | percent-decoding |
| `base64UrlJson` | base64url (padding optional) -> UTF-8 JSON -> the property named by `arg` |
| `lowercase`, `uppercase` | case |
| `titleCase` | `"ZAGREB"` -> `"Zagreb"` per space-separated word |
| `saleRentFlag` | 0 -> `"sale"`, 1 -> `"rent"` |
| `parseEuropeanDateTime` (1.2) | `"29.09.2026. 19:02"` -> `"2026-09-29T19:02:00+02:00"` in the IANA zone named by `arg` (default Europe/Zagreb); a date alone -> the ISO date |
| `truncate` (1.2) | cut at a word boundary to at most `arg` characters (a whole number >= 2), `…` appended when cut |

CanonicalDeal target paths (use only these; `attributes.<camelCaseName>` is free): `id`, `title`, `marketingTitle`,
`url`, `description`, `publishedAt`, `category.id`, `category.name`, `category.isStay`, `place.serviceCity`,
`place.county`, `place.region`, `place.address`, `place.district`, `place.latitude`, `place.longitude`,
`place.nationwide`, `price.from`, `price.full`, `price.discountPercent`, `price.currency`, `price.per`,
`price.perUnit`, `price.unit`, `price.onRequest`, `priceHistory`, `nights`, `persons.adults`, `persons.children`,
`persons.capacityText`, `persons.childPolicy`, `validity.from`, `validity.to`, `images`, `images[0]`, `tags`, `terms`,
`source.domain`, `source.name`, `source.sponsored`, `attributes.<camelCaseName>`. OneAgent sets `sourceId`, `kind`,
`raw`, `fetchedAt` and `match` itself: never map them. A non-empty fieldMap maps `id` and `title` (and should map `url`);
a target is never a prefix of another (`price` next to `price.from`). Items may also carry `mainImage` / `subImages`
(`{url, caption, mediaFileId, imageOrder}`) and a point (`place.latitude` / `place.longitude`); see deal.schema.json.

### Spec §10. Politeness and the User-Agent

- `politeness`: `minDelaySeconds` (0-3600), `maxRequestsPerMinute` (1-600), `maxRequestsPerDay` (null or at least 1),
  `cookieJar` (one session for all requests), `userAgent`, `forbiddenPaths` (each starts with `/`; OneAgent never requests
  them, and no declared path may start with one), `cacheSeconds` (null or 0-86400), `notes`. One outbound queue per site
  serves all users.
- EVERY request OneAgent sends carries a User-Agent that contains the word `OneAgent` (default `OneAgent/1.1`). A
  `politeness.userAgent` must contain it, be 1-200 printable ASCII characters and never imitate a browser. Allow-list the
  word `OneAgent` in the site's firewall or WAF.
- OneAgent backs off on HTTP 429 and 403 (at least 60 s) and never retries in a tight loop.
- robots.txt: OneAgent does not use robots.txt; it obeys `forbiddenPaths` and the pacing above. No robots.txt change is
  needed.

## 5. The facets endpoint contract

A structuredApi site that filters by ids publishes its id vocabularies: the `facets` endpoint (or, in spec 1.2, the
`facetsMap` vocabularies of Spec §7.3). OneAgent's model only ever sends ids it read from these answers.

### Spec §6.2 The facets contract (id vocabularies)

```
{ "sourceId": "example", "loadedAt": "2026-10-01T08:00:00Z",
  "facets": { "category": [ { "id": 7, "label": "Hotels", "parentId": null } ],
              "location": [ { "id": 2, "label": "Zagreb" }, { "id": 21, "label": "Sesvete", "parentId": 2 } ] } }
```

- `facets` (or the root object) holds one array per vocabulary; each entry has `id` (an integer or a string), `label`
  (non-empty) and optionally `parentId` (the id of another entry of the SAME vocabulary).
- Ids must be STABLE: OneAgent's model only ever sends ids it read from this answer, and a changed id silently breaks
  every request that used it. Ids are unique within a vocabulary.
- Small fixed vocabularies may be inline in `capabilities.facets` instead of an endpoint.

## 6. Spec 1.3 site signals

Optional (spec 1.3, any kind): two GET endpoints that tell OneAgent what the site promotes now and how its items rank.
Goals are DATA - plain business guidance - never instructions to an AI: OneAgent flags instruction-like text and never
uses it. Items may also carry images with captions (`mainImage`, `subImages`) and a point (`place.latitude` /
`place.longitude`), see `deal.schema.json`.

### Spec §12. Site signals (spec 1.3)

`endpoints.currentGoals` and `endpoints.statistics` are allowed on EVERY kind; both must be GET; a `requestSchemaRef` is
ignored; `responseSchemaRef` is informative; an open signal endpoint is read without a key.

- **CurrentGoals** (current-goals.schema.json): `{sourceId, message, updatedAt, pollIntervalSeconds?}`. `sourceId` equals
  the manifest's; `message` is plain business guidance for presenting the site's own offers (at most 10 000 characters;
  `""` = no goals); `updatedAt` an ISO 8601 date-time or null. Goals are DATA: OneAgent checks them, never treats them as
  instructions to an AI, never shows them to users and never uses a text that looks like one. Write them as plain
  sentences ("This week we promote weekend stays in Istria.").
- **DealStatistics** (statistics.schema.json): `{sourceId, snapshotLoadedAt, count, boostedCount, rankedCount, deals:
  [{dealId, orderRank, isBoosted, onTimelineToday?}]}`. `dealId` is the item's id (a string or an integer); a LARGER
  `orderRank` ranks higher; `count` equals the number of rows and `rankedCount` = `count - boostedCount`.
- OneAgent reads each declared signal endpoint every 600 s (a `pollIntervalSeconds` the site sends is shown, not obeyed).
  A 401 or 403 stops reading that signal until the key changes. Signals never block onboarding or a search.

## 7. Writing mapping rules and grammar

Mapping rules, the search grammar and every description are read by OneAgent's model as data about the site. Write
them for a careful reader; never put links of other sites, contact data or instructions to an AI there (the
`INJECTION_SUSPECT` scan flags them, and a flagged file is activated only after a human review).

### Spec §14. Writing mapping rules, grammar and descriptions

`capabilities.mappingRules`, `search.grammar` (summary, rules, pitfalls, example notes), `search.refinement.rules`,
`aiAssist.hints`, parameter `description`s, `labels` and the domain profile's labels are read by OneAgent's model as
DATA about the site. Write them so a careful model can follow them:

- One rule per entry, in plain words, about the site's own search: which words or parameters it understands, how to
  write places, prices, dates and sizes, what it does not understand, and one example per tricky case.
- Name the site's own vocabulary exactly as it appears in its answers; never invent ids or words.
- Never put there: links or host names of OTHER sites, e-mail addresses, phone numbers, instructions to an AI or an
  assistant ("ignore", "you are", "system:", "assistant:"), role markers, prompt-like tags (`<user_message>`), canary-like
  codes, or long base64 texts. OneAgent's `INJECTION_SUSPECT` scan flags such text in every free-text field and in the
  prose; hidden Unicode tag characters and bidi overrides anywhere in the file are an Error. A flagged file is activated
  only after a human review.
- Prose sections stay short: what the site is, how its API or search works, the rules above, a few worked examples.

## 8. Auth and secrets

NEVER put a key, token or password into the file: a file that holds one is refused (`SECRET_DETECTED`). The
administrator enters the key in OneAgent, which stores it safely and adds it only to the members marked
`authRequired`. `auth.valueEnv` is informative: the NAME of a variable, never a value.

### Spec §11. Auth and secrets

- `auth.type`: `open` (no credential), `apiKey` (`in` header or query, `name` the header or parameter name - required),
  `bearer` (`Authorization: Bearer ...`, or a named header / query parameter), `basic` (always a header).
- The credential is added ONLY to endpoints, templates, vocabularies and formats with `authRequired: true`; an
  `authRequired` member needs an `auth` other than `open`.
- `auth.valueEnv` is informative: the NAME of a variable (letters, digits, `_`), never a value. Never put a key, token or
  password into the file: OneAgent asks the operator for it and stores it safely.

## 9. Site-side checklist

- [ ] The file is served at `{BASE_URL}/oneagent.txt` (or the URL you give OneAgent) as `text/plain; charset=utf-8`,
      without a byte-order mark (BOM), at most 2 MB, with at most 3 redirects on the same host.
- [ ] Your firewall, WAF or bot protection lets requests through whose User-Agent contains `OneAgent`
      (default `OneAgent/1.1`); no challenge page, no 403 or 429 for it.
- [ ] No robots.txt change is needed: OneAgent does not use robots.txt (the verification only reports what it would
      block, as a note). OneAgent obeys the file's `politeness.forbiddenPaths` and pacing instead.
- [ ] Every declared endpoint answers JSON (or the search page its HTML) on the SAME host as the file.
- [ ] A keyed endpoint answers 401 or 403 WITHOUT the key, and the right data with it; the key is never echoed back.
- [ ] Facet ids are stable: they never change for the same value.
- [ ] If you publish `{BASE_URL}/api/oneagent/manifest`, it returns the same manifest as the file.

## 10. Two complete example files

Two complete, fictional example files (hosts under `example.com`). Copy their layout, not their content. Each passes
Parse, Schema and Semantics when checked with the BASE_URL named. The fence below is four backticks, because the
files contain three-backtick json blocks themselves.

### A structuredApi site with its own parameters (spec 1.2 declared parameters, request templates, facetsMap, a domain profile) and the spec 1.3 signal endpoints

Kind `structuredApi`, `oneagentSpec` 1.3, checked with BASE_URL `https://news.example.com`; file name `example-structuredapi.oneagent.txt`.

````text
================================================================================
EXAMPLE NEWS API  -  OneAgent site file (fictional example)     oneagentSpec 1.3
================================================================================
A fictional JSON news API, written as an example of a OneAgent site file. The
site keeps its OWN request parameters, field names and paging; OneAgent adapts
to them through this file (spec 1.2 declared parameters, request templates and
facetsMap). It also publishes its current goals and deal statistics (spec 1.3),
so the file declares oneagentSpec 1.3.

PLACEHOLDER  {BASE_URL}
  Every URL in this file starts with {BASE_URL}, for example
  https://news.example.com. OneAgent replaces it with the address the operator
  enters when adding the site.

THE API
  GET {BASE_URL}/api/v1/articles?q=&section=&from=&to=&kind=&lang=hr&page=&size=
      -> {"results":[{"articleId":..,"headline":..,"lead":..,"section":{"id":..,
          "name":..},"published":..,"author":..,"url":..,"words":..}],
          "totalResults":..}
      section takes a comma-separated list of section ids.
  GET {BASE_URL}/api/v1/articles/{id}   -> one article
  GET {BASE_URL}/api/v1/sections        -> {"data":{"sections":[{"sectionId":..,
          "title":..,"parent":{"sectionId":..},"slug":..}]}}
  GET {BASE_URL}/api/v1/oneagent/goals       -> CurrentGoals (needs the key)
  GET {BASE_URL}/api/v1/oneagent/statistics  -> DealStatistics (needs the key)

AUTH
  The articles and sections are open. The two signal endpoints need the site's
  key in the header named in the manifest. The key is never written in this
  file: the operator enters it in OneAgent.

TURNING A USER'S TEXT INTO PARAMETERS
  - q holds the topic words in Croatian, never a date or a section name.
  - A section the user names goes to section as its id from the sections list.
  - "danas", "jučer", "ovaj tjedan" become from and to dates.
  - "kolumne" or "komentari" means kind opinion; plain news is kind news.

MANIFEST

```json
{
  "oneagentSpec": "1.3",
  "source": {
    "sourceId": "examplenews",
    "name": "Example News",
    "kind": "structuredApi",
    "domain": "news",
    "language": "hr",
    "baseUrl": "{BASE_URL}",
    "specUrl": "{BASE_URL}/oneagent.txt",
    "auth": { "type": "apiKey", "in": "header", "name": "x-site-key", "valueEnv": "EXAMPLE_NEWS_SITE_KEY" },
    "endpoints": {
      "currentGoals": { "method": "GET", "path": "/api/v1/oneagent/goals", "authRequired": true },
      "statistics": { "method": "GET", "path": "/api/v1/oneagent/statistics", "authRequired": true }
    },
    "capabilities": {
      "mappingRules": [
        "q holds the topic words in Croatian with their diacritics; never put a date or a section name into q.",
        "A section the user names goes to section as its id; send at most three sections.",
        "Relative dates such as danas, jučer or ovaj tjedan become from and to dates.",
        "Opinion pieces (kolumna, komentar) are kind opinion; news reports are kind news."
      ]
    },
    "fieldMap": {
      "id": { "from": "articleId" },
      "title": { "from": "headline", "transform": "trim" },
      "url": { "from": "url", "transform": "absoluteUrl" },
      "description": { "from": "lead", "transform": ["stripHtml", "truncate"], "arg": "300" },
      "publishedAt": { "from": "published", "transform": "toDate" },
      "category.id": { "from": "section.id" },
      "category.name": { "from": "section.name" },
      "attributes.author": { "from": "author" },
      "attributes.words": { "from": "words", "transform": "toInteger" }
    },
    "listPath": "results",
    "parameters": [
      { "name": "q", "type": "string", "maxLength": 100, "description": "Words that appear in the article: the topic, in Croatian." },
      { "name": "section", "type": "idList", "facet": "section", "maxItems": 3, "description": "Section ids; only when the user names a section." },
      { "name": "from", "type": "date", "description": "Published on or after this date." },
      { "name": "to", "type": "date", "description": "Published on or before this date." },
      { "name": "kind", "type": "enum", "enum": ["news", "opinion"], "labels": { "news": "Vijest", "opinion": "Komentar" }, "description": "News reports or opinion pieces." },
      { "name": "minWords", "type": "integer", "clientSide": true, "field": "attributes.words", "compare": "gte", "min": 0, "description": "Only articles with at least this many words (long reads)." },
      { "name": "author", "type": "string", "clientSide": true, "field": "attributes.author", "description": "Only articles by this author (a name or part of it)." }
    ],
    "requests": {
      "search": {
        "method": "GET",
        "path": "/api/v1/articles",
        "query": { "q": "{q}", "section": "{section}", "from": "{from}", "to": "{to}", "kind": "{kind}", "lang": "hr" },
        "arrayStyle": "comma",
        "paging": { "style": "page", "param": "page", "base": 1, "sizeParam": "size", "size": 20, "maxPages": 3 },
        "listPath": "results",
        "totalPath": "totalResults"
      },
      "detail": { "method": "GET", "path": "/api/v1/articles/{id}" }
    },
    "facetsMap": {
      "section": {
        "endpoint": "/api/v1/sections",
        "listPath": "data.sections",
        "idPath": "sectionId",
        "labelPath": "title",
        "parentPath": "parent.sectionId",
        "extra": { "slug": "slug" }
      }
    },
    "domainProfile": {
      "itemNoun": { "hr": "članak", "en": "article" },
      "fields": [
        { "key": "publishedAt", "label": { "hr": "Objavljeno", "en": "Published" }, "type": "date", "source": "publishedAt", "roles": ["meta", "compare"], "better": "higher" },
        { "key": "section", "label": { "hr": "Rubrika", "en": "Section" }, "type": "text", "source": "category.name", "roles": ["badge", "chartGroup"] },
        { "key": "author", "label": { "hr": "Autor", "en": "Author" }, "type": "text", "source": "attributes.author", "roles": ["detail"] },
        { "key": "words", "label": { "hr": "Riječi", "en": "Words" }, "type": "number", "source": "attributes.words", "roles": ["chartMetric"] }
      ],
      "minCoverage": 0.8
    },
    "politeness": {
      "minDelaySeconds": 1,
      "maxRequestsPerMinute": 30,
      "maxRequestsPerDay": 5000,
      "userAgent": "OneAgent/1.1",
      "forbiddenPaths": ["/admin"],
      "cacheSeconds": 300
    },
    "pageLayout": {
      "colors": { "primary": "#1f4e79", "accent": "#c0392b", "surface": "#ffffff", "ink": "#1b1b1b", "muted": "#5f6b7a", "border": "#d9dee5", "onPrimary": "#ffffff" },
      "typography": { "fontFamily": "Georgia, serif", "baseSize": "15px", "titleWeight": 700 },
      "card": { "variant": "row", "image": { "position": "none" }, "elements": ["badges", "title", "description", "meta", "cta"], "cta": { "label": "Pročitaj", "colorToken": "primary", "textColorToken": "onPrimary" } }
    }
  }
}
```

EXAMPLES

search-request.example.json (a request in the site's own parameters)

```json
{ "q": "izbori", "section": [3], "from": "2026-09-01" }
```
````

### A querySearch site: its own HTML search page with extract rules, grammar and refinement (spec 1.1)

Kind `querySearch`, `oneagentSpec` 1.1, checked with BASE_URL `https://market.example.com`; file name `example-querysearch.oneagent.txt`.

````text
================================================================================
EXAMPLE MARKET  -  OneAgent site file (fictional example)       oneagentSpec 1.1
================================================================================
A fictional classified-ads site, written as an example of a OneAgent site file
for a site WITHOUT an API: OneAgent uses the site's own search page, sends one
free-text query and reads the ads from the HTML with the extract rules below.
The file uses no 1.2 or 1.3 member, so it declares oneagentSpec 1.1.

PLACEHOLDER  {BASE_URL}
  Every URL in this file starts with {BASE_URL}, for example
  https://market.example.com. OneAgent replaces it with the address the operator
  enters when adding the site.

THE SEARCH PAGE
  GET {BASE_URL}/search?q=WORDS&page=N   (HTML, UTF-8, 24 ads per page; page 1
  has no page parameter)
  - Each ad is one li.ad inside ol.ad-list; li.ad.promo-slot entries are
    adverts of the site, not ads.
  - p.result-count shows the number of ads found; div.no-results shows when
    nothing matched; div.similar-results shows ads for a SIMILAR search when
    nothing matched exactly - those are never matches.

HOW THE SEARCH UNDERSTANDS TEXT
  The search matches every word of the query against the ad title and text.
  It understands a price limit written as "do 300 eura" and a town name; it
  does not understand dates or sizes. Fewer, exact words find more ads.

MANIFEST

```json
{
  "oneagentSpec": "1.1",
  "source": {
    "sourceId": "examplemarket",
    "name": "Example Market",
    "kind": "querySearch",
    "domain": "products",
    "language": "hr",
    "baseUrl": "{BASE_URL}",
    "specUrl": "{BASE_URL}/oneagent.txt",
    "auth": { "type": "open" },
    "search": {
      "queryParam": "q",
      "queryEncoding": "utf-8",
      "maxQueryLength": 200,
      "preferredFormat": "html",
      "formats": {
        "html": {
          "method": "GET",
          "path": "/search",
          "pageParam": "page",
          "pageBase": 1,
          "firstPageOmitsParam": true,
          "pageSize": 24,
          "maxPages": 3,
          "responseFormat": "html",
          "responseEncoding": "utf-8",
          "extract": {
            "item": "ol.ad-list > li.ad",
            "skip": ["li.ad.promo-slot"],
            "fields": {
              "id": { "selector": null, "attr": "data-ad-id" },
              "title": { "selector": "h3.ad-title a" },
              "link": { "selector": "h3.ad-title a", "attr": "href" },
              "price": { "selector": "span.ad-price" },
              "town": { "selector": "span.ad-town" },
              "image": { "selector": "img.ad-photo", "attr": "src" },
              "posted": { "selector": "time.ad-date", "attr": "datetime" }
            },
            "total": { "selector": "p.result-count", "pattern": "([\\d.]+)" },
            "emptyState": "div.no-results",
            "fallbackMarker": "div.similar-results",
            "nextPage": "a.next-page",
            "dedupeBy": "id",
            "origin": "manual"
          },
          "fieldMap": {
            "id": { "from": "id" },
            "title": { "from": "title", "transform": "trim" },
            "url": { "from": "link", "transform": "absoluteUrl" },
            "price.from": { "from": "price", "transform": "parseEuropeanNumber" },
            "price.currency": { "const": "EUR" },
            "place.serviceCity": { "from": "town", "transform": "trim" },
            "images[0]": { "from": "image", "transform": "absoluteUrl" },
            "publishedAt": { "from": "posted", "transform": "toDate" }
          },
          "aiAssist": {
            "generateRules": true,
            "runtimeFallback": "repairRecipe",
            "sampleItems": 5,
            "health": { "minItemsWhenResults": 1, "requiredFields": ["id", "title", "link"], "minCoverage": 0.8 },
            "hints": [
              "Each ad is one li element with the class ad inside the ordered list ad-list.",
              "Entries with the class promo-slot are adverts of the site, not ads."
            ]
          }
        }
      },
      "grammar": {
        "summary": "One line of Croatian keywords: what the user wants, optionally a town and a price limit.",
        "rules": [
          "Write the item first, then the town, then the price limit.",
          "Write a price limit as do N eura with a whole number.",
          "Leave out words the search does not understand: dates, sizes and colours.",
          "Use the Croatian word with its diacritics, for example bicikl, perilica rublja, kauč."
        ],
        "pitfalls": [
          "Do not add words the user did not ask for; every extra word removes ads."
        ],
        "examples": [
          { "user": "Tražim rabljeni bicikl u Zagrebu do 300 eura", "query": "bicikl zagreb do 300 eura" },
          { "user": "perilica rublja Split", "query": "perilica rublja split" }
        ]
      },
      "refinement": {
        "strategy": "rewriteQuery",
        "rules": [
          "Keep the item and change only what the follow-up changes.",
          "A new town replaces the old town; a new price limit replaces the old one."
        ],
        "examples": [
          { "current": "bicikl zagreb do 300 eura", "user": "a može i do 500?", "query": "bicikl zagreb do 500 eura" }
        ]
      }
    },
    "politeness": {
      "minDelaySeconds": 2,
      "maxRequestsPerMinute": 20,
      "maxRequestsPerDay": 2000,
      "userAgent": "OneAgent/1.1",
      "forbiddenPaths": ["/account", "/admin"],
      "cacheSeconds": 600
    },
    "pageLayout": {
      "colors": { "primary": "#2e7d32", "accent": "#ff8f00", "surface": "#ffffff", "ink": "#212121", "muted": "#616161", "border": "#e0e0e0", "onPrimary": "#ffffff" },
      "typography": { "fontFamily": "Arial, sans-serif", "baseSize": "14px", "priceSize": "18px", "priceWeight": 700, "titleWeight": 600 },
      "card": { "variant": "card", "image": { "aspect": "4:3", "position": "top" }, "elements": ["image", "title", "place", "price", "cta"], "cta": { "label": "Pogledaj oglas", "colorToken": "primary", "textColorToken": "onPrimary" } }
    }
  }
}
```

EXAMPLES

A result page of {BASE_URL}/search?q=bicikl (shortened; one ad):

  ol.ad-list > li.ad[data-ad-id="51234"]
    h3.ad-title a[href="/ad/51234"]   "Gradski bicikl, malo korišten"
    span.ad-price                      "250 EUR"
    span.ad-town                       "Zagreb"
    time.ad-date[datetime="2026-10-01"]
````

## 11. The ten bundled JSON schemas

The 10 schemas OneAgent validates with (JSON Schema draft-07, cumulative 1.1 + 1.2 + 1.3). Each is also a
download: `<ONEAGENT>/oneagent-verify/schemas/<name>.schema.json` (the same bytes).

### oneagent.manifest.schema.json

Download: `<ONEAGENT>/oneagent-verify/schemas/oneagent.manifest.schema.json`

```json
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://requiredfiles.local/contracts/oneagent.manifest.schema.json",
  "title": "OneAgentManifest",
  "description": "The single file OneAgent needs to onboard a site. Point OneAgent at a URL that serves this (convention: <baseUrl>/.well-known/oneagent.json, or any URL the operator provides). OneAgent fetches it, validates against this schema, and then knows everything: how to fetch/narrow deals, whether auth is needed, how to map the site's raw JSON onto CanonicalDeal, and how to render it. Adding a site = giving OneAgent one URL. Any {BASE_URL} in the manifest is replaced by OneAgent with the base URL the operator entered.",
  "type": "object",
  "required": [
    "oneagentSpec",
    "source"
  ],
  "additionalProperties": false,
  "properties": {
    "oneagentSpec": {
      "type": "string",
      "description": "Version of the OneAgent contract this manifest conforms to (see oneagent.txt). OneAgent refuses a major version it does not understand.",
      "examples": [
        "1.1"
      ]
    },
    "publishedAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "contact": {
      "type": [
        "string",
        "null"
      ],
      "description": "Optional owner/contact for the source."
    },
    "source": {
      "description": "The full SourceDescriptor: endpoints, auth, capabilities, fieldMap and (inline) pageLayout.",
      "$ref": "source-descriptor.schema.json"
    }
  }
}
```

### source-descriptor.schema.json

Download: `<ONEAGENT>/oneagent-verify/schemas/source-descriptor.schema.json`

```json
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://requiredfiles.local/contracts/source-descriptor.schema.json",
  "title": "SourceDescriptor",
  "description": "THE dynamic piece. One descriptor per site. It says what KIND of site it is and how OneAgent talks to it: kind=structuredApi -> the site exposes JSON endpoints and a narrow endpoint that takes structured params (endpoints + capabilities + fieldMap); kind=querySearch -> the site has a free-text search URL (e.g. ?q=...) that returns JSON and/or HTML, OneAgent writes the query text and narrows by rewriting it (search). Plus auth, politeness and the page-layout tokens. Add a site = add a descriptor, no code change. Every {BASE_URL} is replaced by OneAgent with the base URL the operator entered. Spec 1.2 (addendum H) adds the optional domainProfile, parameters, requests, facetsMap, search parameters/relevance/emptyQuery/cookies, example params and extract scope; spec 1.3 adds endpoints.currentGoals and endpoints.statistics. One cumulative schema accepts every 1.x file.",
  "type": "object",
  "required": [
    "sourceId",
    "name",
    "kind"
  ],
  "additionalProperties": false,
  "properties": {
    "$comment": {
      "type": "string",
      "description": "Free-text note; ignored by consumers."
    },
    "sourceId": {
      "type": "string",
      "pattern": "^[a-z0-9_-]+$",
      "examples": [
        "crnojaje"
      ]
    },
    "name": {
      "type": "string"
    },
    "kind": {
      "type": "string",
      "enum": [
        "structuredApi",
        "querySearch"
      ],
      "description": "structuredApi: JSON API with a structured-params narrow endpoint (e.g. Crno Jaje). querySearch: free-text search URL; OneAgent builds the query string and re-searches to narrow (e.g. GoHome)."
    },
    "domain": {
      "type": "string",
      "examples": [
        "deals",
        "realEstate"
      ],
      "description": "What the items are. Copied to CanonicalDeal.kind so the UI can pick a card variant."
    },
    "language": {
      "type": "string",
      "default": "hr",
      "description": "Main language of the site's content and queries."
    },
    "baseUrl": {
      "type": "string",
      "description": "Root of the site's endpoints. In a published oneagent file this is the literal placeholder {BASE_URL}; OneAgent replaces it with the scheme+host the operator entered when adding the site (no trailing slash), so one file works for test, staging and production."
    },
    "specUrl": {
      "type": [
        "string",
        "null"
      ],
      "description": "Where the site publishes its OneAgent file, normally {BASE_URL}/oneagent.txt."
    },
    "auth": {
      "type": "object",
      "description": "How the app authenticates to THIS source's endpoints. `open` = no auth.",
      "additionalProperties": false,
      "required": [
        "type"
      ],
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "open",
            "apiKey",
            "bearer",
            "basic"
          ]
        },
        "in": {
          "type": "string",
          "enum": [
            "header",
            "query"
          ],
          "default": "header",
          "description": "Where the credential goes (apiKey/bearer)."
        },
        "name": {
          "type": [
            "string",
            "null"
          ],
          "description": "Header/query name, e.g. \"api-key\" or \"Authorization\"."
        },
        "valueEnv": {
          "type": [
            "string",
            "null"
          ],
          "description": "Env var holding the secret on the target machine. The secret itself is NEVER stored in the descriptor."
        }
      }
    },
    "endpoints": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "list": {
          "$ref": "#/definitions/endpoint",
          "description": "Fetch/ingest a batch of deals."
        },
        "narrow": {
          "$ref": "#/definitions/endpoint",
          "description": "Deterministic filter: POST structured NarrowDealsRequest params, get NarrowDealsResponse. The site runs no AI."
        },
        "detail": {
          "$ref": "#/definitions/endpoint"
        },
        "facets": {
          "$ref": "#/definitions/endpoint",
          "description": "Live id vocabularies (categories, tags, regions, cities...) OneAgent maps the user's text onto before calling narrow."
        },
        "currentGoals": {
          "$ref": "#/definitions/endpoint",
          "description": "Spec 1.3, any kind: GET, the site's current goals (a CurrentGoals response, current-goals.schema.json). Guidance for presenting the site's own offers; untrusted DATA, never instructions. OneAgent reads it on its own schedule (every 10 minutes by default), never during a search."
        },
        "statistics": {
          "$ref": "#/definitions/endpoint",
          "description": "Spec 1.3, any kind: GET, deal ranks and manual boosts (a DealStatistics response, statistics.schema.json). OneAgent reads it on its own schedule, never during a search."
        }
      },
      "description": "list/narrow/detail/facets: structuredApi only; currentGoals/statistics (spec 1.3): any kind. The JSON endpoints (all paths relative to baseUrl)."
    },
    "capabilities": {
      "type": "object",
      "description": "Dynamic: which narrowing params THIS site supports, and the facet values it exposes. The UI/agent only offers what the site can actually honour; anything unsupported is applied client-side after fetch, or skipped.",
      "additionalProperties": false,
      "properties": {
        "supportedParams": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Subset of narrow-request.schema.json param names this site can filter server-side."
        },
        "clientSideParams": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Params the app applies itself after fetching (site can't)."
        },
        "facets": {
          "type": "object",
          "description": "Enum/id vocabularies the site uses (categories, tags, regions, board types...). Free-form because every site differs.",
          "additionalProperties": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "id",
                "label"
              ],
              "properties": {
                "id": {
                  "type": [
                    "string",
                    "integer"
                  ]
                },
                "label": {
                  "type": "string"
                },
                "parentId": {
                  "type": [
                    "string",
                    "integer",
                    "null"
                  ]
                }
              }
            }
          }
        },
        "paramFacets": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          },
          "description": "Which facet vocabulary each id param uses, e.g. {\"locationIds\":\"location\",\"departureLocationIds\":\"location\"}."
        },
        "mappingRules": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Plain-language rules OneAgent's own LLM follows when turning user text into this site's params. The site itself never sees the text."
        }
      }
    },
    "fieldMap": {
      "type": "object",
      "description": "structuredApi only: maps the site's raw record onto CanonicalDeal (key = canonical dotted path, e.g. \"price.from\"). Empty object = identity (the site already emits CanonicalDeal). querySearch sites put a fieldMap inside each search format instead.",
      "additionalProperties": {
        "$ref": "#/definitions/mapping"
      }
    },
    "listPath": {
      "type": [
        "string",
        "null"
      ],
      "description": "structuredApi only: JSON path to the array of records in the list/narrow response (e.g. \"data.deals\")."
    },
    "pageLayoutRef": {
      "type": [
        "string",
        "null"
      ],
      "description": "Path/URL to this source's PageLayout instance, if kept separately."
    },
    "pageLayout": {
      "description": "This source's PageLayout, inline (preferred, so the manifest is self-contained). See page-layout.schema.json.",
      "$ref": "page-layout.schema.json"
    },
    "search": {
      "$ref": "#/definitions/searchSpec",
      "description": "querySearch only: the search URL (GET), how to page, parse and narrow. Narrowing = a new GET with a rewritten query - there is no request body and no request schema."
    },
    "politeness": {
      "$ref": "#/definitions/politeness"
    },
    "domainProfile": {
      "$ref": "#/definitions/domainProfile",
      "description": "Spec 1.2: the site's own item fields (what an item is, its labels, types, units, where each value is in the CanonicalDeal and how cards, comparisons and charts use it). Without a profile OneAgent uses its built-in profiles (deals, realEstate)."
    },
    "parameters": {
      "type": "array",
      "maxItems": 50,
      "items": {
        "$ref": "#/definitions/declaredParameter"
      },
      "description": "Spec 1.2, structuredApi: the site's OWN request parameters instead of NarrowDealsRequest. The query writer outputs one JSON object keyed by these names; OneAgent validates it against the declarations and builds the request from requests.search (else POSTs it to endpoints.narrow)."
    },
    "requests": {
      "$ref": "#/definitions/requestTemplates"
    },
    "facetsMap": {
      "type": "object",
      "additionalProperties": {
        "$ref": "#/definitions/facetVocabulary"
      },
      "description": "Spec 1.2, structuredApi: how to read each id vocabulary from the site's own responses (vocabulary key -> where and which paths), or inline enum values. Without it the 1.1 /facets shape is read."
    }
  },
  "definitions": {
    "endpoint": {
      "type": "object",
      "required": [
        "method",
        "path"
      ],
      "additionalProperties": false,
      "properties": {
        "method": {
          "type": "string",
          "enum": [
            "GET",
            "POST"
          ]
        },
        "path": {
          "type": "string",
          "description": "Relative to baseUrl."
        },
        "authRequired": {
          "type": "boolean",
          "default": false
        },
        "requestSchemaRef": {
          "type": [
            "string",
            "null"
          ]
        },
        "responseSchemaRef": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    },
    "mapping": {
      "description": "How one canonical field is produced from the raw record: take `from` (or `const`), apply `pattern` (regex, first capture group), then `transform` (with `arg`), else `default`.",
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "from": {
          "type": [
            "string",
            "null"
          ],
          "description": "Dotted path into the raw record (e.g. \"prices[0].amount\"). Target keys may use [n] too (e.g. \"images[0]\")."
        },
        "const": {
          "description": "Fixed value, when the site doesn't carry it."
        },
        "transform": {
          "description": "Named, safe transform (data, not code). parseEuropeanNumber: '140.000' -> 140000, '45,00' -> 45. parseEuropeanDate: '12.02.2026.' -> 2026-02-12 (also 'Danas'/'Jucer' relative to today). absoluteUrl: resolve against baseUrl, add https:// when the scheme is missing. fixDoubleScheme: 'http://https://x' -> 'https://x'. base64UrlJson: decode base64url (no padding) UTF-8 JSON and return property `arg`. saleRentFlag: 0 -> 'sale', 1 -> 'rent'. toBoolean: non-empty string / 1 / true -> true. A list of names runs them in order (e.g. [\"base64UrlJson\",\"absoluteUrl\"]). priceHistoryLines: 'dd.mm.yyyy - 140.000 €' lines (separated by <br> or newlines, HTML entities allowed) -> [{date:'yyyy-mm-dd', amount:140000}]. Spec 1.2: parseEuropeanDateTime: '29.09.2026. 19:02' -> '2026-09-29T19:02:00+02:00' (the wall-clock time in the IANA zone named by `arg`, default Sources:TimeZone; 'Danas 14:05' / 'Jučer 14:05' relative to today; a date without a time -> the ISO date). truncate: cut at a word boundary to at most `arg` characters (a whole number >= 2), '…' appended when cut (counted in the limit). Every transform maps null/empty string to null.",
          "anyOf": [
            {
              "type": [
                "string",
                "null"
              ],
              "enum": [
                "none",
                "trim",
                "toNumber",
                "toInteger",
                "parseEuropeanNumber",
                "toBoolean",
                "toDate",
                "parseEuropeanDate",
                "stripHtml",
                "kunaToEur",
                "splitCsv",
                "firstImage",
                "joinTerms",
                "priceHistoryLines",
                "absoluteUrl",
                "fixDoubleScheme",
                "urlDecode",
                "base64UrlJson",
                "lowercase",
                "uppercase",
                "titleCase",
                "saleRentFlag",
                "parseEuropeanDateTime",
                "truncate",
                null
              ]
            },
            {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "none",
                  "trim",
                  "toNumber",
                  "toInteger",
                  "parseEuropeanNumber",
                  "toBoolean",
                  "toDate",
                  "parseEuropeanDate",
                  "stripHtml",
                  "kunaToEur",
                  "splitCsv",
                  "firstImage",
                  "joinTerms",
                  "priceHistoryLines",
                  "absoluteUrl",
                  "fixDoubleScheme",
                  "urlDecode",
                  "base64UrlJson",
                  "lowercase",
                  "uppercase",
                  "titleCase",
                  "saleRentFlag",
                  "parseEuropeanDateTime",
                  "truncate"
                ]
              }
            }
          ]
        },
        "default": {
          "description": "Used when `from` resolves to null/missing."
        },
        "pattern": {
          "type": [
            "string",
            "null"
          ],
          "description": "Regex applied to the string value; the first capture group is kept."
        },
        "arg": {
          "type": [
            "string",
            "null"
          ],
          "description": "Argument for the transform (e.g. the JSON property for base64UrlJson)."
        }
      }
    },
    "extractRule": {
      "type": "object",
      "additionalProperties": false,
      "description": "One value pulled from HTML: CSS `selector` relative to the item (null = the item element itself), then attribute `attr` (null = text content, trimmed), then `pattern` (regex, first group). `all` = collect every match as a list. The result lands in the raw record under the field name and is normalised by the format's fieldMap.",
      "properties": {
        "selector": {
          "type": [
            "string",
            "null"
          ]
        },
        "attr": {
          "type": [
            "string",
            "null"
          ]
        },
        "pattern": {
          "type": [
            "string",
            "null"
          ]
        },
        "all": {
          "type": "boolean",
          "default": false
        },
        "note": {
          "type": "string"
        },
        "scope": {
          "type": "string",
          "enum": [
            "item",
            "nextSibling"
          ],
          "default": "item",
          "description": "Spec 1.2: where the selector runs. item (1.1 behaviour): inside the item element. nextSibling: inside the item's next ELEMENT sibling (selector null = that sibling itself); no sibling -> null."
        }
      }
    },
    "htmlExtract": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "item": {
          "type": "string",
          "description": "CSS selector for one result item."
        },
        "skip": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Items matching these selectors are ignored."
        },
        "fields": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/definitions/extractRule"
          },
          "description": "Raw record fields extracted per item (name -> rule)."
        },
        "total": {
          "$ref": "#/definitions/extractRule",
          "description": "Total result count (page-level, selector relative to the document)."
        },
        "emptyState": {
          "type": [
            "string",
            "null"
          ],
          "description": "Selector present when the query returned nothing."
        },
        "fallbackMarker": {
          "type": [
            "string",
            "null"
          ],
          "description": "Selector present when the page shows substitute results for a different query; treat items as a fallback, not a match."
        },
        "nextPage": {
          "type": [
            "string",
            "null"
          ],
          "description": "Selector of the next-page link; absent = last page."
        },
        "dedupeBy": {
          "type": "string",
          "default": "id",
          "description": "Raw field used to drop duplicates across pages."
        },
        "recognizedWords": {
          "$ref": "#/definitions/extractRule",
          "description": "Page-level: the query words the site recognised (e.g. shown in bold). Lets OneAgent see how its query was understood."
        },
        "unrecognizedWords": {
          "$ref": "#/definitions/extractRule",
          "description": "Page-level: words the site reports as not recognised / returning nothing."
        },
        "origin": {
          "type": "string",
          "enum": [
            "manual",
            "aiGenerated",
            "aiRepaired"
          ],
          "description": "Who wrote these rules. aiGenerated/aiRepaired rules were proposed by OneAgent's LLM from a sample page, validated on it, and approved by an Administrator."
        },
        "verifiedOn": {
          "type": [
            "string",
            "null"
          ],
          "description": "Where/when the rules were last proven, e.g. '2026-09-29 examples/samples/gohome'."
        }
      },
      "description": "Deterministic extraction rules (CSS selectors + regex) = the transformer adapter's program for this site. Written by hand in the site file, or by OneAgent's LLM as an ExtractionRecipe from a PageDigest (see aiAssist). OneAgent always runs these; the LLM never parses HTML itself."
    },
    "searchFormat": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "method",
        "path",
        "responseFormat"
      ],
      "properties": {
        "method": {
          "type": "string",
          "enum": [
            "GET",
            "POST"
          ]
        },
        "path": {
          "type": "string",
          "description": "Relative to baseUrl."
        },
        "fixedParams": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          },
          "description": "Query-string params always sent."
        },
        "pageParam": {
          "type": [
            "string",
            "null"
          ]
        },
        "pageBase": {
          "type": "integer",
          "enum": [
            0,
            1
          ],
          "description": "Number of the first page."
        },
        "firstPageOmitsParam": {
          "type": "boolean",
          "default": false
        },
        "pageSize": {
          "type": [
            "integer",
            "null"
          ]
        },
        "pageSizeParam": {
          "type": [
            "string",
            "null"
          ]
        },
        "maxPages": {
          "type": [
            "integer",
            "null"
          ],
          "description": "Pages the site will serve at most."
        },
        "pageStyle": {
          "type": "string",
          "enum": [
            "page",
            "offset"
          ],
          "default": "page",
          "description": "Spec 1.2 (addendum H.x): page (1.1 behaviour) = pageParam carries the page number counted from pageBase; offset = pageParam carries the item offset (page - 1) x pageSize, counted from 0 (pageBase must be 0; pageSize is required), and pageSizeParam the page size."
        },
        "responseFormat": {
          "type": "string",
          "enum": [
            "json",
            "html",
            "xml"
          ]
        },
        "responseEncoding": {
          "type": "string",
          "default": "utf-8"
        },
        "authRequired": {
          "type": "boolean",
          "default": false
        },
        "listPath": {
          "type": [
            "string",
            "null"
          ],
          "description": "json: path to the items array."
        },
        "totalPath": {
          "type": [
            "string",
            "null"
          ],
          "description": "json: path to the total count."
        },
        "recognizedWordsPath": {
          "type": [
            "string",
            "null"
          ],
          "description": "json: path to the site's own per-word parse feedback, if any."
        },
        "extract": {
          "$ref": "#/definitions/htmlExtract",
          "description": "html: extraction rules."
        },
        "fieldMap": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/definitions/mapping"
          },
          "description": "Raw record (json item or extracted html fields) -> CanonicalDeal."
        },
        "notes": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "aiAssist": {
          "$ref": "#/definitions/aiAssist",
          "description": "html formats: AI-assisted recipe writing/repair from a PageDigest (never raw HTML)."
        }
      }
    },
    "searchSpec": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "queryParam",
        "formats",
        "preferredFormat"
      ],
      "properties": {
        "queryParam": {
          "type": "string",
          "description": "Name of the free-text query parameter, e.g. \"q\"."
        },
        "queryEncoding": {
          "type": "string",
          "default": "utf-8",
          "description": "Charset used to percent-encode the query value (e.g. iso-8859-2)."
        },
        "maxQueryLength": {
          "type": [
            "integer",
            "null"
          ]
        },
        "preferredFormat": {
          "type": "string",
          "enum": [
            "json",
            "html",
            "xml"
          ]
        },
        "formats": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/definitions/searchFormat"
          },
          "description": "One entry per result format of the SAME search URL family (html/json/xml). Most querySearch sites have just one: a GET to the site's own results page returning HTML."
        },
        "queryInfo": {
          "$ref": "#/definitions/searchFormat",
          "description": "Optional parse-only endpoint: shows how the site understood a query, returns no items."
        },
        "grammar": {
          "type": "object",
          "additionalProperties": false,
          "description": "How the site's search understands text - what OneAgent's LLM must follow to write the query.",
          "properties": {
            "summary": {
              "type": "string"
            },
            "rules": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "modifiers": {
              "type": "object",
              "additionalProperties": {
                "type": "string"
              },
              "description": "Named words the site understands (sort, date, ...) -> the exact text to append."
            },
            "pitfalls": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "examples": {
              "type": "array",
              "items": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "user",
                  "query"
                ],
                "properties": {
                  "user": {
                    "type": "string"
                  },
                  "query": {
                    "type": "string"
                  },
                  "note": {
                    "type": "string"
                  },
                  "params": {
                    "$ref": "#/definitions/exampleParams"
                  }
                }
              }
            }
          }
        },
        "refinement": {
          "type": "object",
          "additionalProperties": false,
          "description": "How narrowing works: OneAgent keeps the current query and rewrites it, then searches again.",
          "properties": {
            "strategy": {
              "type": "string",
              "enum": [
                "rewriteQuery"
              ]
            },
            "rules": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "examples": {
              "type": "array",
              "items": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "current",
                  "user",
                  "query"
                ],
                "properties": {
                  "current": {
                    "type": "string"
                  },
                  "user": {
                    "type": "string"
                  },
                  "query": {
                    "type": "string"
                  },
                  "note": {
                    "type": "string"
                  },
                  "params": {
                    "$ref": "#/definitions/exampleParams"
                  }
                }
              }
            }
          }
        },
        "parameters": {
          "type": "array",
          "maxItems": 30,
          "items": {
            "$ref": "#/definitions/declaredParameter"
          },
          "description": "Spec 1.2: the site's extra search parameters next to the query line (in=query: name=value on the search URL, URL-encoded by code) and clientSide filters OneAgent applies to the fetched items. The query writer then returns {\"query\":\"<line>\",\"params\":{...}}."
        },
        "relevance": {
          "type": "string",
          "enum": [
            "keyword",
            "semantic"
          ],
          "default": "keyword",
          "description": "Spec 1.2: semantic = the search never returns an empty state for a query and orders by similarity (vector search): short topical queries, no word feedback, relevance judged per item."
        },
        "emptyQuery": {
          "type": "string",
          "enum": [
            "none",
            "latest"
          ],
          "default": "none",
          "description": "Spec 1.2: latest = a request without the query parameter is the site's latest-items feed, so an empty query is allowed. none (default): a query is required."
        },
        "cookies": {
          "type": "array",
          "maxItems": 20,
          "items": {
            "$ref": "#/definitions/siteCookie"
          },
          "description": "Spec 1.2 (addendum H.z): cookies OneAgent sends on every request to the site's own origin, merged with the cookie jar (a configured cookie wins over a jar cookie of the same name); never sent to another host. The administrator's per-site Cookies setting wins over the file. Only header-breaking input is refused; the whole Cookie header stays under 8 KB."
        }
      }
    },
    "politeness": {
      "type": "object",
      "additionalProperties": false,
      "description": "How hard OneAgent may hit the site. OneAgent must enforce these per source, globally (all users).",
      "properties": {
        "minDelaySeconds": {
          "type": "number"
        },
        "maxRequestsPerMinute": {
          "type": "integer"
        },
        "maxRequestsPerDay": {
          "type": [
            "integer",
            "null"
          ]
        },
        "cookieJar": {
          "type": "boolean",
          "description": "Keep one cookie jar (one session) for all requests."
        },
        "userAgent": {
          "type": "string",
          "pattern": "OneAgent",
          "default": "OneAgent/1.1",
          "description": "User-Agent for EVERY request to this site. MUST contain 'OneAgent' (site operators allow-list that word; GoHome: AlwaysAllowedUserAgentParts). Format: 'OneAgent/<version> (+<contact url or email>)'. Never a browser UA."
        },
        "respectRobotsTxt": {
          "type": "boolean",
          "default": true
        },
        "forbiddenPaths": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Never request these paths."
        },
        "cacheSeconds": {
          "type": [
            "integer",
            "null"
          ],
          "description": "Reuse an identical query's result for this long."
        },
        "notes": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "aiAssist": {
      "type": "object",
      "additionalProperties": false,
      "description": "How OneAgent's LLM helps read this format WITHOUT ever receiving the HTML: OneAgent's HTML transformer adapter turns a page into a PageDigest (page-digest.schema.json); the LLM answers with an ExtractionRecipe (extraction-recipe.schema.json); OneAgent runs the recipe itself, so items are always CanonicalDeal. The site does no AI - these are instructions for OneAgent.",
      "properties": {
        "generateRules": {
          "type": "boolean",
          "default": true,
          "description": "When extract is missing or unhealthy on the onboarding sample page: digest -> LLM -> ExtractionRecipe -> run + validate -> Administrator approves."
        },
        "runtimeFallback": {
          "type": "string",
          "enum": [
            "never",
            "repairRecipe"
          ],
          "default": "repairRecipe",
          "description": "repairRecipe: when the active rules fail the health check on a live page, build the digest of that page, let the LLM write a repaired recipe, run it; if it is healthy use its items for this request (marked 'rules repaired by AI') and store it as a proposal for approval. never: return the error."
        },
        "region": {
          "type": [
            "string",
            "null"
          ],
          "description": "Optional CSS selector that limits where the transformer looks for repeating item blocks (null = whole <body>)."
        },
        "sampleItems": {
          "type": "integer",
          "default": 5,
          "description": "Kept for the digest: blocks whose values are sampled (fill rates always use all blocks)."
        },
        "health": {
          "type": "object",
          "additionalProperties": false,
          "description": "When are the rules considered broken on a live page?",
          "properties": {
            "minItemsWhenResults": {
              "type": "integer",
              "default": 1,
              "description": "Items required when the page is not an emptyState page."
            },
            "requiredFields": {
              "type": "array",
              "items": {
                "type": "string"
              },
              "description": "Raw fields every item must have."
            },
            "minCoverage": {
              "type": "number",
              "default": 0.8,
              "description": "Share of items that must have every required field."
            }
          }
        },
        "hints": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Site-specific facts given to the LLM together with the digest."
        }
      }
    },
    "localizedText": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "hr",
        "en"
      ],
      "properties": {
        "hr": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
        },
        "en": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
        }
      },
      "description": "Spec 1.2: a label in Croatian and English. Site-written DATA: injection-scanned, never instructions."
    },
    "domainProfile": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "fields"
      ],
      "properties": {
        "$comment": {
          "type": "string",
          "description": "Free-text note; ignored by consumers."
        },
        "itemNoun": {
          "$ref": "#/definitions/localizedText"
        },
        "fields": {
          "type": "array",
          "maxItems": 40,
          "items": {
            "$ref": "#/definitions/profileField"
          }
        },
        "imagePaths": {
          "type": "array",
          "maxItems": 10,
          "items": {
            "type": "string"
          },
          "description": "Where the item's pictures are in the site's RAW record, main picture first (dotted paths; each value a URL, an object with url, or a list of either). Without it OneAgent reads its built-in shapes (images, mainImage + subImages, image, imageUrl, thumbnail, photos, gallery)."
        },
        "minCoverage": {
          "type": "number",
          "default": 0.8,
          "description": "JSON mapping health: the share of items of a page that must have the core fields (id, title) and every required profile field."
        }
      },
      "description": "Spec 1.2: the site's item fields. Drives card badges/meta lines, comparison rows, chart metrics and groups, item details and the field meanings in the prompts."
    },
    "profileField": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "key",
        "label",
        "type",
        "source",
        "roles"
      ],
      "properties": {
        "key": {
          "type": "string",
          "pattern": "^[a-z][A-Za-z0-9]*$",
          "maxLength": 64
        },
        "label": {
          "$ref": "#/definitions/localizedText"
        },
        "type": {
          "type": "string",
          "enum": [
            "text",
            "number",
            "currency",
            "percent",
            "date",
            "datetime",
            "boolean",
            "url",
            "enum"
          ]
        },
        "unit": {
          "type": [
            "string",
            "null"
          ],
          "maxLength": 32
        },
        "source": {
          "type": "string",
          "description": "A CanonicalDeal path (price.from, category.name, publishedAt, ...) or attributes.<key>."
        },
        "roles": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "card",
              "badge",
              "meta",
              "compare",
              "chartMetric",
              "chartGroup",
              "detail"
            ]
          }
        },
        "better": {
          "type": "string",
          "enum": [
            "higher",
            "lower",
            "none"
          ],
          "description": "compare role: which value is better; for dates higher means newer; for prices lower."
        },
        "required": {
          "type": "boolean",
          "default": false,
          "description": "JSON mapping health: every item should have this field."
        }
      }
    },
    "declaredParameter": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "name",
        "type",
        "description"
      ],
      "properties": {
        "$comment": {
          "type": "string",
          "description": "Free-text note; ignored by consumers."
        },
        "name": {
          "type": "string",
          "minLength": 1,
          "maxLength": 100,
          "description": "The site's own parameter name (server-side), or a OneAgent filter name (clientSide)."
        },
        "in": {
          "type": "string",
          "enum": [
            "query",
            "body"
          ],
          "description": "Where a server-side value goes when no request template places it: query = name=value on the URL (querySearch: always), body = a member of the JSON body (structuredApi POST)."
        },
        "type": {
          "type": "string",
          "enum": [
            "string",
            "number",
            "integer",
            "boolean",
            "date",
            "datetime",
            "enum",
            "idList",
            "textList"
          ]
        },
        "description": {
          "type": "string",
          "maxLength": 2000,
          "description": "For OneAgent's query writer: what the parameter means and when to use it. Site-written DATA: injection-scanned, never instructions."
        },
        "facet": {
          "type": [
            "string",
            "null"
          ],
          "description": "The id vocabulary of an id parameter (a facetsMap key, a capabilities.facets key or a vocabulary of endpoints.facets). Only ids of that vocabulary are ever sent."
        },
        "enum": {
          "type": "array",
          "minItems": 1,
          "maxItems": 500,
          "items": {
            "type": [
              "string",
              "number"
            ]
          }
        },
        "labels": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          },
          "description": "Human labels of enum values (site language). DATA, injection-scanned."
        },
        "min": {
          "type": "number"
        },
        "max": {
          "type": "number"
        },
        "maxItems": {
          "type": "integer",
          "minimum": 1
        },
        "maxLength": {
          "type": "integer",
          "minimum": 1
        },
        "examples": {
          "type": "array"
        },
        "required": {
          "type": "boolean",
          "default": false,
          "description": "The site needs this parameter in every request."
        },
        "clientSide": {
          "type": "boolean",
          "default": false,
          "description": "true: never sent to the site; OneAgent filters the fetched items on field, the way compare says."
        },
        "field": {
          "type": "string",
          "description": "clientSide: the CanonicalDeal path the filter reads."
        },
        "compare": {
          "type": "string",
          "enum": [
            "eq",
            "ne",
            "contains",
            "gte",
            "lte",
            "gt",
            "lt",
            "in"
          ],
          "description": "clientSide: gte = keep field >= value, lte = field <= value, eq/ne = equal/not equal, contains = text contains (ignore case), in = field is one of the values. Default by type: text contains, a list in, otherwise eq; a number or date parameter whose name ends in From/Min is gte and To/Max is lte."
        },
        "whenMissing": {
          "type": "string",
          "enum": [
            "keep",
            "drop"
          ],
          "default": "keep",
          "description": "clientSide: an item without the field. keep = it stays (marked unknown for this filter); drop = it is removed."
        },
        "note": {
          "type": "string",
          "description": "Free-text note for the administrator."
        }
      },
      "description": "Spec 1.2: one parameter the site declares (addendum H)."
    },
    "exampleParams": {
      "type": "object",
      "description": "Spec 1.2: the parameter object of a grammar/refinement example (keys = declared parameter names). Date values may be {today} / {yesterday}, resolved by OneAgent in the site's time zone."
    },
    "siteCookie": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "name",
        "value"
      ],
      "properties": {
        "name": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256,
          "description": "Any name; no control characters, ';' or '='."
        },
        "value": {
          "type": "string",
          "maxLength": 8192,
          "description": "Any value; no control characters, and no ';' unless the value is quoted."
        },
        "path": {
          "type": "string",
          "default": "/"
        },
        "reason": {
          "type": "string",
          "maxLength": 500,
          "description": "Why the site needs it (shown to the administrator)."
        }
      }
    },
    "requestPaging": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "style"
      ],
      "properties": {
        "style": {
          "type": "string",
          "enum": [
            "page",
            "offset",
            "cursor",
            "none"
          ]
        },
        "param": {
          "type": [
            "string",
            "null"
          ],
          "description": "The page number, offset or cursor parameter."
        },
        "sizeParam": {
          "type": [
            "string",
            "null"
          ],
          "description": "The page size parameter."
        },
        "size": {
          "type": [
            "integer",
            "null"
          ],
          "description": "The page size OneAgent asks for (sizeParam) or the site uses."
        },
        "base": {
          "type": "integer",
          "enum": [
            0,
            1
          ],
          "description": "page: the number of the first page; offset: always 0."
        },
        "nextCursorPath": {
          "type": [
            "string",
            "null"
          ],
          "description": "cursor: path to the next cursor in the response (absent or null = last page)."
        },
        "maxPages": {
          "type": [
            "integer",
            "null"
          ]
        }
      }
    },
    "requestTemplate": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "method",
        "path"
      ],
      "properties": {
        "$comment": {
          "type": "string",
          "description": "Free-text note; ignored by consumers."
        },
        "method": {
          "type": "string",
          "enum": [
            "GET",
            "POST"
          ]
        },
        "path": {
          "type": "string",
          "description": "Relative to baseUrl; only the detail template may hold {id}."
        },
        "query": {
          "type": "object",
          "additionalProperties": {
            "type": [
              "string",
              "number",
              "boolean"
            ]
          },
          "description": "The site's query parameter name -> a placeholder \"{param}\" (a declared parameter; omitted when unset) or a constant. Values are URL-encoded by code."
        },
        "body": {
          "description": "POST: a JSON template whose string values may be \"{param}\" placeholders (a whole-value placeholder keeps the parameter's JSON type; an unset one is left out). Serialised by code."
        },
        "arrayStyle": {
          "type": "string",
          "enum": [
            "repeat",
            "comma",
            "brackets"
          ],
          "default": "repeat",
          "description": "A list value in the query: repeat a=1&a=2, comma a=1,2, brackets a[]=1&a[]=2."
        },
        "paging": {
          "$ref": "#/definitions/requestPaging"
        },
        "listPath": {
          "type": [
            "string",
            "null"
          ],
          "description": "Path to the items array in the response."
        },
        "totalPath": {
          "type": [
            "string",
            "null"
          ],
          "description": "Path to the total count."
        },
        "idPath": {
          "type": [
            "string",
            "null"
          ],
          "description": "Path to an item's id inside one item."
        },
        "authRequired": {
          "type": "boolean",
          "default": false
        },
        "notes": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "description": "Spec 1.2: how OneAgent builds one request (values URL-encoded or JSON-serialised by code, never string-concatenated; only the file's own origin; auth only as declared in auth)."
    },
    "requestTemplates": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "search": {
          "$ref": "#/definitions/requestTemplate",
          "description": "A search with the declared parameters."
        },
        "list": {
          "$ref": "#/definitions/requestTemplate",
          "description": "All items, paged by OneAgent (a list-only site applies clientSide parameters itself)."
        },
        "detail": {
          "$ref": "#/definitions/requestTemplate",
          "description": "One item; the path holds {id}."
        },
        "facets": {
          "$ref": "#/definitions/requestTemplate",
          "description": "A vocabulary response (facetsMap request \"facets\")."
        }
      },
      "description": "Spec 1.2, structuredApi: request templates per operation. Sites without them use the 1.1 endpoints (narrow = POST of the request object)."
    },
    "facetVocabulary": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "$comment": {
          "type": "string",
          "description": "Free-text note; ignored by consumers."
        },
        "endpoint": {
          "type": "string",
          "description": "A GET path relative to baseUrl that returns the vocabulary."
        },
        "request": {
          "type": "string",
          "enum": [
            "search",
            "list",
            "detail",
            "facets"
          ],
          "description": "A request template that returns the vocabulary."
        },
        "authRequired": {
          "type": "boolean",
          "default": false
        },
        "listPath": {
          "type": [
            "string",
            "null"
          ],
          "description": "Path to the array of values in the response."
        },
        "idPath": {
          "type": [
            "string",
            "null"
          ],
          "default": "id"
        },
        "labelPath": {
          "type": [
            "string",
            "null"
          ],
          "default": "label"
        },
        "parentPath": {
          "type": [
            "string",
            "null"
          ]
        },
        "extra": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          },
          "description": "Extra fields kept with each value: name -> path."
        },
        "enum": {
          "type": "array",
          "maxItems": 2000,
          "items": {
            "anyOf": [
              {
                "type": [
                  "string",
                  "integer"
                ]
              },
              {
                "type": "object",
                "required": [
                  "id",
                  "label"
                ],
                "properties": {
                  "id": {
                    "type": [
                      "string",
                      "integer"
                    ]
                  },
                  "label": {
                    "type": "string"
                  },
                  "parentId": {
                    "type": [
                      "string",
                      "integer",
                      "null"
                    ]
                  }
                }
              }
            ]
          },
          "description": "Values declared inline (e.g. from the site's OpenAPI): ids, or {id, label, parentId}."
        }
      },
      "description": "Spec 1.2: one id vocabulary: exactly one of endpoint, request and enum."
    }
  },
  "allOf": [
    {
      "if": {
        "properties": {
          "kind": {
            "const": "structuredApi"
          }
        }
      },
      "then": {
        "required": [
          "endpoints",
          "fieldMap"
        ]
      }
    },
    {
      "if": {
        "properties": {
          "kind": {
            "const": "querySearch"
          }
        }
      },
      "then": {
        "required": [
          "search"
        ]
      }
    }
  ]
}
```

### deal.schema.json

Download: `<ONEAGENT>/oneagent-verify/schemas/deal.schema.json`

```json
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://requiredfiles.local/contracts/deal.schema.json",
  "title": "CanonicalDeal",
  "description": "The one shape every item is normalised into - a voucher deal, a property listing, any offer. Sites emit wildly different JSON/HTML; the SourceDescriptor maps each site's raw output onto THIS. Common fields are typed; domain-specific ones go into `attributes`; the untouched source record into `raw`.",
  "type": "object",
  "required": [
    "sourceId",
    "id",
    "title"
  ],
  "additionalProperties": false,
  "definitions": {
    "DealImage": {
      "type": [
        "object",
        "null"
      ],
      "description": "Spec 1.2 (CrnoJaje) / 1.3: one image with its caption and metadata. Null = no such image. Captions are plain text (cards use mainImage.caption as the image's alt text). OneAgent accepts http and https and adapts a deal before validation (a string URL becomes {url}; a non-integer mediaFileId/imageOrder or a non-string caption moves to raw.$unmapped; a caption over 500 characters is cut), so an image value never drops a deal.",
      "required": [
        "url"
      ],
      "additionalProperties": false,
      "properties": {
        "url": {
          "type": "string",
          "format": "uri",
          "pattern": "^https?://",
          "description": "Absolute http(s) image URL."
        },
        "caption": {
          "type": [
            "string",
            "null"
          ],
          "maxLength": 500,
          "description": "Plain text; null when not provided."
        },
        "mediaFileId": {
          "type": [
            "integer",
            "null"
          ],
          "description": "The site's media id, or null."
        },
        "imageOrder": {
          "type": [
            "integer",
            "null"
          ],
          "description": "The site's gallery order, or null."
        }
      }
    }
  },
  "properties": {
    "$comment": {
      "type": "string",
      "description": "Free-text note; ignored by consumers."
    },
    "sourceId": {
      "type": "string",
      "description": "Which SourceDescriptor produced this (e.g. \"crnojaje\")."
    },
    "kind": {
      "type": "string",
      "examples": [
        "deal",
        "realEstate"
      ],
      "description": "Item kind (from the descriptor's domain)."
    },
    "id": {
      "type": [
        "string",
        "integer"
      ],
      "description": "Deal id in the source system."
    },
    "title": {
      "type": "string"
    },
    "marketingTitle": {
      "type": [
        "string",
        "null"
      ]
    },
    "url": {
      "type": [
        "string",
        "null"
      ],
      "description": "Absolute link to the deal on the site. The live API returns a real URL; examples in oneagent files use {BASE_URL}."
    },
    "agentText": {
      "type": [
        "string",
        "null"
      ],
      "description": "Compact LLM-ready description (see DealCompactor). Optional; the agent can generate it if absent."
    },
    "description": {
      "type": [
        "string",
        "null"
      ],
      "description": "Plain-text description (may be truncated by the site)."
    },
    "publishedAt": {
      "type": [
        "string",
        "null"
      ],
      "description": "When the item was published/indexed (ISO date or date-time)."
    },
    "category": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": [
            "integer",
            "string",
            "null"
          ]
        },
        "name": {
          "type": [
            "string",
            "null"
          ]
        },
        "isStay": {
          "type": [
            "boolean",
            "null"
          ],
          "description": "Overnight stay vs. day service/product."
        }
      }
    },
    "place": {
      "type": "object",
      "description": "Where the SERVICE happens. `cities`/`isDeparture` cover travel deals whose listed cities are departure points, not the destination.",
      "additionalProperties": false,
      "properties": {
        "serviceCity": {
          "type": [
            "string",
            "null"
          ]
        },
        "county": {
          "type": [
            "string",
            "null"
          ]
        },
        "region": {
          "type": [
            "string",
            "null"
          ]
        },
        "address": {
          "type": [
            "string",
            "null"
          ]
        },
        "latitude": {
          "type": [
            "number",
            "null"
          ],
          "minimum": -90,
          "maximum": 90,
          "description": "Decimal degrees, -90..90; null when no usable point is known (never 0)."
        },
        "longitude": {
          "type": [
            "number",
            "null"
          ],
          "minimum": -180,
          "maximum": 180,
          "description": "Decimal degrees, -180..180, paired with latitude; null when no usable point is known (never 0)."
        },
        "pointSource": {
          "type": [
            "string",
            "null"
          ],
          "maxLength": 32,
          "description": "Origin of lat/lng: pin = the item's own exact pin; grad (legacy: srediste grada) = the service city's centre (approximate); null = no usable point, or (with coordinates) no origin given. Any other value is accepted and shown as approximate; OneAgent turns a non-string or longer value into \"unknown\"."
        },
        "cities": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "isDeparture": {
          "type": [
            "boolean",
            "null"
          ]
        },
        "nationwide": {
          "type": [
            "boolean",
            "null"
          ]
        },
        "district": {
          "type": [
            "string",
            "null"
          ],
          "description": "Neighbourhood / city part (kvart)."
        }
      }
    },
    "price": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "from": {
          "type": [
            "number",
            "null"
          ]
        },
        "full": {
          "type": [
            "number",
            "null"
          ]
        },
        "discountPercent": {
          "type": [
            "integer",
            "null"
          ]
        },
        "currency": {
          "type": "string",
          "default": "EUR"
        },
        "per": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "total",
            "person",
            "night",
            null
          ]
        },
        "perUnit": {
          "type": [
            "number",
            "null"
          ],
          "description": "Price per unit, e.g. EUR per m2."
        },
        "unit": {
          "type": [
            "string",
            "null"
          ],
          "examples": [
            "m2"
          ]
        },
        "onRequest": {
          "type": [
            "boolean",
            "null"
          ],
          "description": "Price not published (\"na upit\")."
        }
      }
    },
    "priceHistory": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "date": {
            "type": [
              "string",
              "null"
            ]
          },
          "amount": {
            "type": [
              "number",
              "null"
            ]
          }
        }
      }
    },
    "nights": {
      "type": [
        "integer",
        "null"
      ]
    },
    "persons": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "adults": {
          "type": [
            "integer",
            "null"
          ]
        },
        "children": {
          "type": [
            "integer",
            "null"
          ]
        },
        "capacityText": {
          "type": [
            "string",
            "null"
          ]
        },
        "childPolicy": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    },
    "validity": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "from": {
          "type": [
            "string",
            "null"
          ],
          "format": "date"
        },
        "to": {
          "type": [
            "string",
            "null"
          ],
          "format": "date"
        }
      }
    },
    "mainImage": {
      "$ref": "#/definitions/DealImage"
    },
    "subImages": {
      "type": "array",
      "maxItems": 50,
      "description": "The gallery with captions and metadata (spec 1.2 / 1.3); images[] stays the card list, main image first.",
      "items": {
        "$ref": "#/definitions/DealImage"
      }
    },
    "images": {
      "type": "array",
      "items": {
        "type": "string",
        "format": "uri"
      }
    },
    "tags": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "terms": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Short child/person/validity sentences."
    },
    "attributes": {
      "type": "object",
      "description": "Domain-specific typed facts, free-form: e.g. realEstate {areaM2, propertyType, saleRent, rooms}. Keys are camelCase; values are string/number/boolean."
    },
    "source": {
      "type": [
        "object",
        "null"
      ],
      "additionalProperties": false,
      "description": "For aggregators: where the item really comes from.",
      "properties": {
        "domain": {
          "type": [
            "string",
            "null"
          ]
        },
        "name": {
          "type": [
            "string",
            "null"
          ]
        },
        "sponsored": {
          "type": [
            "boolean",
            "null"
          ]
        }
      }
    },
    "options": {
      "type": "array",
      "description": "Buyable variants (UserIntentEntryMatch). Prices/board/capacity live here.",
      "items": {
        "type": "object",
        "required": [
          "id"
        ],
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": [
              "string",
              "integer"
            ]
          },
          "title": {
            "type": [
              "string",
              "null"
            ]
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "priceEur": {
            "type": [
              "number",
              "null"
            ]
          },
          "fullPriceEur": {
            "type": [
              "number",
              "null"
            ]
          },
          "discountPercent": {
            "type": [
              "integer",
              "null"
            ]
          },
          "nights": {
            "type": [
              "integer",
              "null"
            ]
          },
          "serviceType": {
            "type": [
              "string",
              "null"
            ],
            "description": "Board: room only / breakfast / half board / full board / all inclusive."
          },
          "roomName": {
            "type": [
              "string",
              "null"
            ]
          },
          "maxAdults": {
            "type": [
              "integer",
              "null"
            ]
          },
          "maxChildren": {
            "type": [
              "integer",
              "null"
            ]
          },
          "capacity": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      }
    },
    "raw": {
      "type": [
        "object",
        "null"
      ],
      "description": "The source's original record, verbatim. Never dropped, so a re-map is possible without re-fetching."
    },
    "fetchedAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "match": {
      "type": [
        "object",
        "null"
      ],
      "description": "Set ONLY in a narrow response: how this deal scored against the request (engine match metadata). Absent on a plain ingested deal.",
      "additionalProperties": false,
      "properties": {
        "matchLevel": {
          "type": [
            "integer",
            "null"
          ],
          "description": "Relaxation level the deal satisfied (1 = every criterion)."
        },
        "matchLevelName": {
          "type": [
            "string",
            "null"
          ]
        },
        "score": {
          "type": [
            "integer",
            "null"
          ]
        },
        "rank": {
          "type": [
            "integer",
            "null"
          ]
        },
        "locationCheck": {
          "type": [
            "string",
            "null"
          ],
          "maxLength": 32,
          "description": "The site's location verdict (e.g. match, vicinity, county, region, national, mismatch, unknown, near, nearby, far). Display only; OneAgent turns a non-string or longer value into \"unknown\"."
        },
        "distanceKm": {
          "type": [
            "number",
            "null"
          ]
        },
        "cityDistanceKm": {
          "type": [
            "number",
            "null"
          ]
        },
        "reasons": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "rejected": {
          "type": [
            "boolean",
            "null"
          ]
        }
      }
    }
  }
}
```

### narrow-request.schema.json

Download: `<ONEAGENT>/oneagent-verify/schemas/narrow-request.schema.json`

```json
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://requiredfiles.local/contracts/narrow-request.schema.json",
  "title": "NarrowDealsRequest",
  "description": "STRUCTURED params the source's 'narrow deals' endpoint accepts. The SOURCE runs no AI: OneAgent turns the user's free text into these params on its own side (its LLM + the source's capabilities.facets), then POSTs them; the source only filters deterministically. Every field is optional; a source honours only the params listed in SourceDescriptor.capabilities.supportedParams and OneAgent applies the rest itself. Ids are that source's own facet ids. additionalProperties is true so a source may accept extra, source-specific flags.",
  "type": "object",
  "additionalProperties": true,
  "properties": {
    "$comment": {
      "type": "string",
      "description": "Free-text note; ignored by consumers."
    },
    "language": {
      "type": [
        "string",
        "null"
      ],
      "default": "hr",
      "description": "Language of the labels/reasons in the reply."
    },
    "categoryIds": {
      "type": "array",
      "items": {
        "type": [
          "integer",
          "string"
        ]
      }
    },
    "tagIds": {
      "type": "array",
      "items": {
        "type": [
          "integer",
          "string"
        ]
      }
    },
    "serviceTypeIds": {
      "type": "array",
      "items": {
        "type": [
          "integer",
          "string"
        ]
      },
      "description": "Board: room only / breakfast / half board / full board / all inclusive."
    },
    "travelLocationIds": {
      "type": "array",
      "items": {
        "type": [
          "integer",
          "string"
        ]
      },
      "description": "Destination region."
    },
    "locationIds": {
      "type": "array",
      "items": {
        "type": [
          "integer",
          "string"
        ]
      },
      "description": "City where a local service happens."
    },
    "departureLocationIds": {
      "type": "array",
      "items": {
        "type": [
          "integer",
          "string"
        ]
      }
    },
    "zupanijaIds": {
      "type": "array",
      "items": {
        "type": [
          "integer",
          "string"
        ]
      },
      "description": "County."
    },
    "priceMin": {
      "type": [
        "number",
        "null"
      ]
    },
    "priceMax": {
      "type": [
        "number",
        "null"
      ]
    },
    "priceCurrency": {
      "type": "string",
      "default": "EUR"
    },
    "pricePer": {
      "type": [
        "string",
        "null"
      ],
      "enum": [
        "total",
        "person",
        "night",
        null
      ]
    },
    "nightsMin": {
      "type": [
        "integer",
        "null"
      ]
    },
    "nightsMax": {
      "type": [
        "integer",
        "null"
      ]
    },
    "adults": {
      "type": [
        "integer",
        "null"
      ]
    },
    "children": {
      "type": [
        "integer",
        "null"
      ]
    },
    "dateFrom": {
      "type": [
        "string",
        "null"
      ],
      "format": "date"
    },
    "dateTo": {
      "type": [
        "string",
        "null"
      ],
      "format": "date"
    },
    "nearPlace": {
      "type": [
        "boolean",
        "null"
      ],
      "description": "\"blizu X\": include towns around the requested city, not only the city itself."
    },
    "keywords": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Plain words matched against deal text (no semantic/AI matching on the source)."
    },
    "maxDeals": {
      "type": [
        "integer",
        "null"
      ],
      "minimum": 1,
      "default": 20,
      "description": "Max deals returned."
    },
    "useLocation": {
      "type": [
        "boolean",
        "null"
      ],
      "default": true,
      "description": "Apply the place/region rules (false = ignore location params)."
    },
    "onlyToday": {
      "type": [
        "boolean",
        "null"
      ],
      "default": false,
      "description": "Only deals on today's timeline."
    }
  }
}
```

### narrow-response.schema.json

Download: `<ONEAGENT>/oneagent-verify/schemas/narrow-response.schema.json`

```json
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://requiredfiles.local/contracts/narrow-response.schema.json",
  "title": "NarrowDealsResponse",
  "description": "What the source's 'narrow deals' endpoint returns. Deterministic (no AI on the source): the relaxation ladder that was walked, the matching deals in filter order with per-deal match annotations (score + plain reasons), and any hard-rejected ones. Any semantic re-ranking is OneAgent's job, on its side.",
  "type": "object",
  "required": [
    "sourceId",
    "deals"
  ],
  "additionalProperties": false,
  "properties": {
    "$comment": {
      "type": "string",
      "description": "Free-text note; ignored by consumers."
    },
    "sourceId": {
      "type": "string"
    },
    "usedLevel": {
      "type": [
        "integer",
        "null"
      ],
      "description": "Relaxation level actually used (1 = every criterion)."
    },
    "usedLevelName": {
      "type": [
        "string",
        "null"
      ]
    },
    "levels": {
      "type": "array",
      "description": "The relaxation ladder that was walked (all criteria -> widened -> region ...).",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "level": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "criteria": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "newDeals": {
            "type": "integer"
          },
          "cumulativeDeals": {
            "type": "integer"
          },
          "used": {
            "type": "boolean"
          }
        }
      }
    },
    "deals": {
      "type": "array",
      "description": "Matching CanonicalDeal objects, ordered by the source's deterministic match.score; each carries a `match` object.",
      "items": {
        "$ref": "deal.schema.json"
      }
    },
    "rejected": {
      "type": "array",
      "description": "Deals the engine hard-rejected (e.g. place mismatch), with the reason.",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": [
              "string",
              "integer"
            ]
          },
          "title": {
            "type": [
              "string",
              "null"
            ]
          },
          "reason": {
            "type": "string"
          }
        }
      }
    },
    "warnings": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "error": {
      "type": [
        "string",
        "null"
      ],
      "description": "Set when the source could not run the filter."
    }
  }
}
```

### page-layout.schema.json

Download: `<ONEAGENT>/oneagent-verify/schemas/page-layout.schema.json`

```json
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://requiredfiles.local/contracts/page-layout.schema.json",
  "title": "PageLayout",
  "description": "Design tokens + component recipes for rendering a source's deals. One instance per source (see examples/source.crnojaje.json -> pageLayout). Lets the dynamic app theme itself per site instead of hard-coding one look.",
  "type": "object",
  "required": [
    "colors",
    "typography",
    "card"
  ],
  "additionalProperties": false,
  "properties": {
    "$comment": {
      "type": "string",
      "description": "Free-text note; ignored by consumers."
    },
    "colors": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "primary": {
          "type": "string",
          "description": "Main brand/CTA colour."
        },
        "accent": {
          "type": "string"
        },
        "success": {
          "type": "string",
          "description": "Savings/positive badge."
        },
        "info": {
          "type": "string"
        },
        "shellBg": {
          "type": "string",
          "description": "Page frame background."
        },
        "surface": {
          "type": "string",
          "description": "Card background."
        },
        "ink": {
          "type": "string",
          "description": "Primary text."
        },
        "muted": {
          "type": "string"
        },
        "border": {
          "type": "string"
        },
        "onPrimary": {
          "type": "string",
          "description": "Text on primary."
        }
      }
    },
    "typography": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "fontFamily": {
          "type": "string"
        },
        "baseSize": {
          "type": "string"
        },
        "priceSize": {
          "type": "string"
        },
        "priceWeight": {
          "type": [
            "string",
            "integer"
          ]
        },
        "titleWeight": {
          "type": [
            "string",
            "integer"
          ]
        }
      }
    },
    "radius": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "card": {
          "type": "string"
        },
        "button": {
          "type": "string"
        },
        "pill": {
          "type": "string"
        }
      }
    },
    "shadow": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "card": {
          "type": "string"
        },
        "elevated": {
          "type": "string"
        }
      }
    },
    "card": {
      "type": "object",
      "description": "How one deal card is composed, top to bottom.",
      "additionalProperties": false,
      "properties": {
        "widthPx": {
          "type": "integer"
        },
        "image": {
          "type": "object",
          "properties": {
            "aspect": {
              "type": "string",
              "description": "e.g. \"16:7\"."
            },
            "position": {
              "type": "string",
              "enum": [
                "top",
                "left",
                "none"
              ]
            }
          }
        },
        "badges": {
          "type": "array",
          "description": "Overlay/inline badges and where their colour comes from.",
          "items": {
            "type": "object",
            "properties": {
              "role": {
                "type": "string",
                "enum": [
                  "discount",
                  "savings",
                  "info",
                  "new",
                  "soldCount",
                  "priceUp",
                  "priceDown",
                  "sponsored"
                ]
              },
              "colorToken": {
                "type": "string",
                "description": "Which colors.* token to use."
              },
              "textColorToken": {
                "type": "string"
              }
            }
          }
        },
        "elements": {
          "type": "array",
          "description": "Ordered content blocks inside the card.",
          "items": {
            "type": "string",
            "enum": [
              "image",
              "badges",
              "title",
              "place",
              "price",
              "fullPrice",
              "pricePerUnit",
              "description",
              "meta",
              "cta"
            ]
          }
        },
        "cta": {
          "type": "object",
          "properties": {
            "label": {
              "type": "string"
            },
            "colorToken": {
              "type": "string"
            },
            "textColorToken": {
              "type": "string"
            }
          }
        },
        "variant": {
          "type": "string",
          "enum": [
            "card",
            "row"
          ],
          "description": "card = boxed tile; row = flat list row with a divider."
        }
      }
    },
    "tokens": {
      "type": "object",
      "description": "Extra named design tokens beyond the fixed ones (link, priceColor, headerBg, inputBorder, paging...). Groups: colors, typography, radius, spacing, layout; values are CSS strings.",
      "additionalProperties": {
        "type": "object",
        "additionalProperties": {
          "type": [
            "string",
            "number"
          ]
        }
      }
    },
    "components": {
      "type": "object",
      "description": "How the site's page parts look (header, searchBar, filterBar, pagination, footer, ...): component name -> short description + CSS-like properties. Free-form.",
      "additionalProperties": {
        "type": "object"
      }
    },
    "assets": {
      "type": "object",
      "additionalProperties": {
        "type": "string"
      },
      "description": "Absolute or {BASE_URL}-relative asset URLs: logo, logoSmall, favicon."
    },
    "breakpoints": {
      "type": "object",
      "additionalProperties": {
        "type": "string"
      },
      "description": "Named media queries, e.g. mobile: (max-width:767px)."
    }
  }
}
```

### page-digest.schema.json

Download: `<ONEAGENT>/oneagent-verify/schemas/page-digest.schema.json`

```json
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://requiredfiles.local/contracts/page-digest.schema.json",
  "title": "PageDigest",
  "description": "Output of OneAgent's deterministic HTML TRANSFORMER ADAPTER (no AI): a compact, known-shape summary of one HTML page - the repeating item blocks it found, every field inside them as (CSS selector, source) with fill rate and a few sample values, page-level texts (counts, bold query words) and pagination links. This is the ONLY view of a page OneAgent's LLM ever gets (never the raw HTML). The LLM answers with an ExtractionRecipe that references these selectors. Reference implementation: tools/html_digest.py.",
  "type": "object",
  "required": ["digestVersion", "candidates", "pageTexts", "pagination"],
  "additionalProperties": false,
  "properties": {
    "$comment": { "type": "string" },
    "digestVersion": { "type": "string", "const": "1" },
    "url": { "type": ["string", "null"], "description": "The page URL ({BASE_URL}-relative in stored examples)." },
    "title": { "type": ["string", "null"], "description": "The page <title>." },
    "candidates": {
      "type": "array",
      "maxItems": 3,
      "description": "Repeating sibling blocks (same tag + classes, >= 3 siblings, enough text, >= 3 fields present in >= 80% of blocks), best first. Usually c1 is the result list.",
      "items": {
        "type": "object",
        "required": ["id", "itemSelector", "count", "fields"],
        "additionalProperties": false,
        "properties": {
          "id": { "type": "string", "pattern": "^c[0-9]+$" },
          "itemSelector": { "type": "string", "description": "CSS selector for one block: '<#id or anchor> > tag.classes-shared-by-all-blocks'." },
          "count": { "type": "integer", "minimum": 3 },
          "fields": {
            "type": "array",
            "maxItems": 40,
            "items": {
              "type": "object",
              "required": ["id", "selector", "source", "fillRate", "samples"],
              "additionalProperties": false,
              "properties": {
                "id": { "type": "string", "pattern": "^c[0-9]+\\.f[0-9]+$", "description": "Stable reference the recipe's fieldSources can point to." },
                "selector": { "type": ["string", "null"], "description": "Selector relative to the block (null = the block element itself); the shortest (<= 3 tokens) that returns this element as the first match." },
                "source": { "type": "string", "pattern": "^(text|@[a-z][a-z0-9-]*)$", "description": "text = the element's text; @attr = that attribute (href, src, data-src, srcset, content, datetime, data, title, alt, value)." },
                "fillRate": { "type": "number", "minimum": 0, "maximum": 1, "description": "Share of blocks that have this field." },
                "samples": { "type": "array", "maxItems": 3, "items": { "type": "string", "maxLength": 160 }, "description": "Up to 3 distinct values from the first blocks, whitespace-collapsed, cut at 160 chars." }
              }
            }
          }
        }
      }
    },
    "pageTexts": {
      "type": "array",
      "maxItems": 12,
      "description": "Short texts outside the item blocks that contain a digit (result counts, query echo, 'showing 1-42 of 373'), with their bold parts.",
      "items": {
        "type": "object",
        "required": ["selector", "text"],
        "additionalProperties": false,
        "properties": {
          "selector": { "type": "string" },
          "text": { "type": "string", "maxLength": 300 },
          "bold": { "type": "array", "items": { "type": "string" } }
        }
      }
    },
    "pagination": {
      "type": "array",
      "maxItems": 8,
      "items": {
        "type": "object",
        "required": ["text", "href"],
        "additionalProperties": false,
        "properties": { "text": { "type": "string" }, "href": { "type": "string" } }
      }
    },
    "stats": {
      "type": "object",
      "additionalProperties": false,
      "properties": { "htmlChars": { "type": "integer" }, "digestChars": { "type": "integer" } }
    }
  }
}
```

### extraction-recipe.schema.json

Download: `<ONEAGENT>/oneagent-verify/schemas/extraction-recipe.schema.json`

```json
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://requiredfiles.local/contracts/extraction-recipe.schema.json",
  "title": "ExtractionRecipe",
  "description": "What OneAgent's LLM must return after reading a PageDigest: deterministic extraction rules (CSS selectors + regex) and the fieldMap into CanonicalDeal. OneAgent's transformer adapter RUNS the recipe itself on the HTML, so the output is always CanonicalDeal[] (deal.schema.json) - a known, serialisable shape. A recipe is accepted only if, run on the page it was written for, it passes aiAssist.health and yields schema-valid CanonicalDeals; then an Administrator approves it (or it is used once as a runtime repair and stored as a proposal).",
  "type": "object",
  "required": ["recipeVersion", "format", "extract", "fieldMap"],
  "additionalProperties": false,
  "properties": {
    "$comment": { "type": "string" },
    "recipeVersion": { "type": "string", "const": "1" },
    "format": { "type": "string", "enum": ["html"] },
    "sourceId": { "type": ["string", "null"] },
    "writtenFor": { "type": ["string", "null"], "description": "URL of the page (digest) the recipe was written for." },
    "extract": { "$ref": "source-descriptor.schema.json#/definitions/htmlExtract" },
    "fieldMap": {
      "type": "object",
      "description": "Raw record field (the names in extract.fields) -> CanonicalDeal path. Same Mapping rules as a site file.",
      "additionalProperties": { "$ref": "source-descriptor.schema.json#/definitions/mapping" }
    },
    "fieldSources": {
      "type": "object",
      "description": "For review: raw field name -> the digest field id(s) it was built from, e.g. {\"title\": \"c1.f19\"}.",
      "additionalProperties": { "type": "string" }
    },
    "confidence": { "type": "integer", "minimum": 0, "maximum": 100 },
    "notes": { "type": "array", "items": { "type": "string" } }
  }
}
```

### current-goals.schema.json

Download: `<ONEAGENT>/oneagent-verify/schemas/current-goals.schema.json`

```json
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://requiredfiles.local/contracts/current-goals.schema.json",
  "title": "CurrentGoals",
  "description": "Spec 1.3: a site's current goals (endpoints.currentGoals, GET). Generic: any site, any poll advice. The message is untrusted site DATA, never instructions; OneAgent checks sourceId, times and poll advice in code (SignalResponseRules).",
  "type": "object",
  "required": [
    "sourceId",
    "message",
    "updatedAt"
  ],
  "additionalProperties": true,
  "properties": {
    "sourceId": {
      "type": "string",
      "pattern": "^[a-z0-9_-]{1,64}$",
      "description": "Must equal the manifest's sourceId (checked in code)."
    },
    "message": {
      "type": "string",
      "maxLength": 10000,
      "description": "The whole current goals text; \"\" = no goals. At most 10 000 UTF-16 code units."
    },
    "updatedAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "description": "UTC write time (an offset-less value is UTC); null until the first write since the site started."
    },
    "pollIntervalSeconds": {
      "description": "Advice only: OneAgent reads on its own schedule. Any value is accepted here; an integer 60-86400 is shown to the administrator."
    }
  }
}
```

### statistics.schema.json

Download: `<ONEAGENT>/oneagent-verify/schemas/statistics.schema.json`

```json
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://requiredfiles.local/contracts/statistics.schema.json",
  "title": "DealStatistics",
  "description": "Spec 1.3: a site's deal ranks and manual boosts (endpoints.statistics, GET). Generic: any site. Consistency (counts, duplicates, the boost flag) is checked in code as warnings (SignalResponseRules).",
  "type": "object",
  "required": [
    "sourceId",
    "snapshotLoadedAt",
    "count",
    "boostedCount",
    "rankedCount",
    "deals"
  ],
  "additionalProperties": true,
  "properties": {
    "sourceId": {
      "type": "string",
      "pattern": "^[a-z0-9_-]{1,64}$",
      "description": "Must equal the manifest's sourceId (checked in code)."
    },
    "snapshotLoadedAt": {
      "type": "string",
      "format": "date-time",
      "description": "When the site loaded these ranks (an offset-less value is UTC)."
    },
    "count": {
      "type": "integer",
      "minimum": 0
    },
    "boostedCount": {
      "type": "integer",
      "minimum": 0
    },
    "rankedCount": {
      "type": "integer",
      "minimum": 0
    },
    "deals": {
      "type": "array",
      "items": {
        "$ref": "#/definitions/dealRank"
      }
    }
  },
  "definitions": {
    "dealRank": {
      "type": "object",
      "required": [
        "dealId",
        "orderRank",
        "isBoosted"
      ],
      "additionalProperties": true,
      "properties": {
        "dealId": {
          "anyOf": [
            {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            },
            {
              "type": "integer",
              "minimum": 0
            }
          ],
          "description": "The deal's id as in its CanonicalDeal id (joined as text)."
        },
        "orderRank": {
          "type": "number",
          "description": "For every site: a LARGER value ranks higher (it is not a 1-based position)."
        },
        "isBoosted": {
          "type": "boolean",
          "description": "The site placed the deal manually."
        },
        "onTimelineToday": {
          "type": "boolean",
          "description": "Optional: the deal is on today's timeline."
        }
      }
    }
  }
}
```

## 12. Your loop: write, verify, fix, repeat

1. Write the file and publish it on the site's own origin (a staging host works): the verification FETCHES it like
   OneAgent does, from `https://your-site/oneagent.txt` or the `.txt` URL you give.
2. Verify it: `POST <ONEAGENT>/api/verify` with the JSON body `{"url": "https://your-site.example"}`, or paste the URL into
   the page `<ONEAGENT>/oneagent-verify`. When the manifest marks endpoints `authRequired`, add the key for this one
   check: `{"url": "...", "credential": {"value": "..."}}` (basic auth: `{"userName": "...", "password": "..."}`).
   The key is used for that verification only: never stored, logged or shown.
3. Read the report (the answer is JSON): `verdict` (`Ready`, `ReadyWithWarnings`, `NotReady`), `counts`, and `steps[]`
   (1 Fetch, 2 Parse, 3 Schema, 4 Semantics, 5 robots.txt report, 6 User-Agent acceptance, 7 Endpoints or Search,
   8 Sample cards), each with `status`, `summary` and `issues[]` (`code`, `severity`, `message`, `fix`, and where:
   `block`, `line`, `field`, `endpoint`). `requests[]` lists every request the check sent.
4. Fix every `Error` first (steps 7 and 8 run only when steps 1-4 have none), then every `Warning`. `Info` needs no
   change. Each issue's `fix` says what to do; the table below lists every code.
5. Publish the changed file and verify again. Repeat until the verdict is `Ready`.

Limits - pace yourself:

- 10 verifications per hour and 30 per day from one IP address; more answer HTTP 429 with a
  `Retry-After` header (seconds) and a ProblemDetails body. Wait that long; never retry in a loop.
- One verification of the same site per 2 minutes and 20 per day; a verification that
  comes too early is answered with a report whose issue says when to try again (nothing is sent to the site).
- One verification sends at most 12 requests to the site, about 1 s apart, each with a
  10 s timeout, and takes at most 60 s; only the file's own origin is contacted. Private and
  local addresses are refused.
- HTTP 404 from the API means the public verification is switched off on this OneAgent: ask the OneAgent team.

### Spec §15. The semantic rules (codes OneAgent reports)

Parse: `SECRET_DETECTED`, `NO_PLACEHOLDER`, `BLOCK_JSON_INVALID`, `UNCLOSED_BLOCK`, `MANIFEST_COUNT`, spec version codes
(`SPEC_VERSION_INVALID`, `SPEC_MAJOR_UNSUPPORTED`, `SPEC_NEWER_MINOR`, `SPEC_FEATURE_NEWER`), `SCHEMA` (the bundled
schemas), `INLINE_SCHEMA_DIFFERS` (Info). Semantics:

- S0xx (every site): S001 sourceId, S002 name, S003 kind, S004 baseUrl, S010-S013 auth, S020-S027 politeness and
  User-Agent, S030-S032 paths and placeholders, S040-S042 regexes (compile, one unnamed group), S050-S053 transforms and
  mappings, S060-S067 target paths (CanonicalDeal properties, `id` + `title` mapped, never `sourceId` or `raw`, search
  formats need a fieldMap, html `from` fields are extract fields).
- A0xx (structuredApi): A001 narrow or list, A002 methods (narrow POST, detail and facets GET), A003 supportedParams,
  A004 paramFacets resolve, A005 a parameter supported and client-side, A006 listPath.
- Q0xx (querySearch): Q001 formats, Q002 encodings, Q003 maxQueryLength, Q004 GET, Q005 extract, Q006 dedupeBy, Q007
  health, Q008 json paths, Q010 xml, Q011 paging, Q012 fixedParams, Q013-Q014 aiAssist, Q016 grammar examples, Q017
  politeness.
- P0xx (1.2 parameters), H0xx (1.2 domain profile), R0xx (1.2 templates, vocabularies, cookies), T001-T004 (1.3 signal
  endpoints) and `INJECTION_SUSPECT` (section 14).

Errors block a site; warnings and notes are shown to the administrator. Fix every Error, then every Warning.

### Every code and how to fix it

| Code | How to fix |
|---|---|
| `A001` | Declare endpoints.narrow (POST) or endpoints.list (GET), or a requests.search / requests.list template. |
| `A002` | Use POST for narrow and GET for detail and facets. |
| `A003` | List only NarrowDealsRequest parameters in supportedParams (the guide lists them), or declare your own with source.parameters. |
| `A004` | Name in paramFacets only vocabularies your facets endpoint, facetsMap or capabilities.facets provides. |
| `A005` | List a parameter either in supportedParams or in clientSideParams, not both. |
| `A006` | Write listPath as a dotted path with \[n\] indexes (for example data.deals). |
| `BASE_URL_INVALID` | Use the site's origin as BASE_URL: http(s)://host\[:port\], without a path, for example https://www.example.com. |
| `BASE_URL_SUGGESTED` | Use the BASE_URL the file names (or update the file's BASE_URL line), so OneAgent calls the right host. |
| `BLOCK_JSON_INVALID` | Make the block valid JSON: check the quotes, commas and brackets near the line named (a JSON validator shows the exact spot). |
| `H001` | Give every domainProfile field a unique key. |
| `H002` | Point every domainProfile field's source at a CanonicalDeal path (for example attributes.rooms). |
| `H003` | Use roles and better that fit the field's type (chartMetric and higher/lower only for numbers and dates). |
| `H004` | Keep at most 12 compare rows and 20 card fields in domainProfile. |
| `H005` | Set domainProfile.minCoverage between 0 and 1 and write imagePaths as dotted paths. |
| `INJECTION_SUSPECT` | Rewrite the text named as plain facts about your site and its data. Never address an AI, never write instructions, links to other hosts, contact data or hidden characters there. |
| `INLINE_SCHEMA_DIFFERS` | Nothing to do: OneAgent validates with its own bundled schema. Copy the published schema if you want them identical. |
| `INLINE_SCHEMA_UNKNOWN` | Nothing to do: inline schemas are documentation only. Use the published $id if the block is one of OneAgent's schemas. |
| `MANIFEST_COUNT` | Keep exactly ONE \`\`\`json block with both "oneagentSpec" and "source" (the manifest); give example blocks other shapes. |
| `NO_PLACEHOLDER` | Write every URL of your own site as {BASE_URL}/path, so the same file works on every environment (test, staging, live). |
| `P001` | Give every declared parameter a unique name that does not clash with the query, page or fixed parameters. |
| `P002` | Use only the members that fit the parameter's type (enum values, facet, maxItems, min/max with min below max). |
| `P003` | Name a vocabulary your facetsMap, capabilities.facets or facets endpoint provides; on a querySearch site use enum values instead. |
| `P004` | Use only declared server-side parameters and {page}, {pageSize}, {offset}, {cursor} (and {id} in detail) as placeholders. |
| `P005` | Do not place a clientSide parameter in a template: OneAgent applies it after fetching. |
| `P006` | Use only {id}, and only in the detail template's path. |
| `P007` | Give a clientSide parameter a field (a CanonicalDeal path) and a compare that fits its type. |
| `P008` | Place the parameter in a request template, or give it "in": "query" or "body". |
| `P009` | Declare a querySearch site's parameters in search.parameters (in: query) and a structuredApi site's in source.parameters. |
| `P010` | Use only declared parameters with valid values in the examples' params. |
| `Q001` | Key every search format by its responseFormat (html, json) and make preferredFormat one of the keys. |
| `Q002` | Use an encoding name .NET knows for queryEncoding and responseEncoding (utf-8, iso-8859-2, windows-1250 ...). |
| `Q003` | Leave maxQueryLength out or set it between 1 and 2000. |
| `Q004` | Use GET for search formats (OneAgent opens your search page as a browser link would). |
| `Q005` | Give the html format extract rules: an item selector and at least one field, with selectors that parse. |
| `Q006` | Set dedupeBy to one of your extract fields (usually the link). |
| `Q007` | Use extract fields in health.requiredFields, a minCoverage between 0 and 1 and a minItemsWhenResults of 0 or more. |
| `Q008` | Give a json format a listPath, and write every path as a dotted path with \[n\] indexes. |
| `Q010` | Use html or json as preferredFormat: OneAgent does not read xml. |
| `Q011` | Complete the paging members: pageParam with pageBase, pageSizeParam with pageSize, offset paging with pageSize and pageBase 0. |
| `Q012` | Remove the query, page and page-size parameters from fixedParams (OneAgent sets them). |
| `Q013` | Use aiAssist only on an html format, with sampleItems 1-50 and a known runtimeFallback. |
| `Q014` | Add health.requiredFields, so OneAgent can tell when the rules stop working. |
| `Q016` | Add at least one search.grammar.examples entry (a user request and the query OneAgent should send). |
| `Q017` | Add a politeness block (minDelaySeconds, maxRequestsPerMinute, userAgent) so OneAgent paces requests as you want. |
| `R001` | Keep template and facetsMap paths relative to BASE_URL and outside politeness.forbiddenPaths. |
| `R002` | Remove the body of a GET template, or use POST. |
| `R003` | Complete the paging block: a param for page/offset/cursor, nextCursorPath for cursor, size with sizeParam, values of 1 or more. |
| `R004` | Remove the key parameter from the template: OneAgent adds the credential exactly as auth declares it. |
| `R005` | Write listPath, totalPath, idPath and nextCursorPath as dotted paths with \[n\] indexes. |
| `R006` | Use requests, parameters and facetsMap only on a structuredApi site. |
| `R007` | Give each facetsMap vocabulary exactly one of endpoint, request (a declared template) or enum. |
| `R008` | Use GET for the detail and facets templates. |
| `R009` | Give each search.cookies entry a plain ASCII name and value without ; or line breaks, each name once. |
| `S001` | Use a sourceId of lowercase letters, digits, - and _ (at most 64), and not a reserved word (add, new, files). |
| `S002` | Give source.name your site's display name (1-200 characters). |
| `S003` | Set source.kind to "structuredApi" (JSON endpoints) or "querySearch" (a search page). |
| `S004` | Set source.baseUrl to "{BASE_URL}" (or your site's origin); OneAgent uses the BASE_URL it was given. |
| `S010` | Give auth.name the header or query parameter that carries the key (for example "api-key"), and use a known auth.type (apiKey, bearer, basic, open). |
| `S011` | Basic authentication goes in a header: set auth.in to "header". |
| `S012` | Use a plain header or parameter name for auth.name (letters, digits, - and _), and only a variable NAME in auth.valueEnv. |
| `S013` | Declare an auth block for endpoints marked authRequired, or set authRequired false where no key is needed. |
| `S020` | Set politeness.minDelaySeconds between 0 and 3600. |
| `S021` | Set politeness.maxRequestsPerMinute between 1 and 600. |
| `S022` | Leave politeness.maxRequestsPerDay out (no limit) or set it to 1 or more. |
| `S023` | Leave politeness.cacheSeconds out or set it between 0 and 86400. |
| `S024` | Set politeness.userAgent to a one-line value that contains OneAgent (for example "OneAgent/1.1"). |
| `S025` | Start every politeness.forbiddenPaths entry with /. |
| `S026` | Move the endpoint out of the forbidden path, or remove that prefix from politeness.forbiddenPaths. |
| `S027` | Remove browser or bot words (Mozilla, Chrome, bot ...) from politeness.userAgent; OneAgent always identifies itself honestly. |
| `S030` | Write paths relative to BASE_URL with one leading / and without ://, # or /../ (for example /api/oneagent/deals). |
| `S031` | Put {id} into the detail path (for example /api/oneagent/deals/{id}). |
| `S032` | Use no placeholder in a path except {id} in the detail path. |
| `S040` | Fix the regular expression so it compiles (escape special characters such as ( \[ . with a backslash). |
| `S041` | Wrap the part you want in parentheses: the first capture group is the value. |
| `S042` | Use an unnamed group (...) instead of a named one (?\<name\>...). |
| `S050` | Use one of the 24 transforms of the spec (the guide lists them) and check its spelling. |
| `S051` | Give base64UrlJson an arg (the member to read), or remove it if you want the whole object. |
| `S052` | Keep either const or from/pattern/transform in a mapping: const wins and the rest is ignored. |
| `S053` | Give the mapping a from (the source field), a const or a default. |
| `S060` | Write targets as dotted CanonicalDeal paths with \[n\] indexes (for example price.amount, images\[0\]). |
| `S061` | Start every target with a CanonicalDeal property (id, title, url, price, place, images ...; the guide lists them). |
| `S062` | Map either a whole object or its members, not both (price or price.amount). |
| `S063` | Map list positions without gaps: images\[0\] before images\[1\]. |
| `S064` | Map id and title (and url, so a user can open the offer). |
| `S065` | Remove targets sourceId and raw: OneAgent fills them itself. |
| `S066` | Give the search format a fieldMap from your extracted fields to CanonicalDeal. |
| `S067` | Map only fields your extract rules produce, or add the missing extract field. |
| `SCHEMA` | Change the manifest member at the path named so it matches the OneAgent schema (an unknown member: remove it or check its spelling). |
| `SECRET_DETECTED` | Remove the key, token or password from the file. Never put a credential in oneagent.txt: OneAgent asks for it separately and stores it safely. |
| `SPEC_FEATURE_NEWER` | Raise "oneagentSpec" to the version that introduced the member named (OneAgent accepts the file either way). |
| `SPEC_MAJOR_UNSUPPORTED` | Declare a 1.x spec version ("1.3" is the newest OneAgent reads). |
| `SPEC_NEWER_MINOR` | Declare "1.3" unless you need a newer feature; OneAgent reads files up to spec 1.3. |
| `SPEC_VERSION_INVALID` | Set "oneagentSpec" to a version such as "1.3" (major.minor). |
| `T001` | Serve currentGoals and statistics with GET. |
| `T002` | Remove requestSchemaRef from the signal endpoint: it takes no body. |
| `T003` | Nothing to do: OneAgent validates the answer with its own published contract. |
| `T004` | Nothing to do if the goals are public; set authRequired true if they need your key. |
| `UNCLOSED_BLOCK` | Close the \`\`\`json block with a line of three backticks (\`\`\`) right after its JSON. |
| `VERIFY_AUTH_OPEN` | Either protect the endpoint (answer 401/403 without a valid key) or set authRequired false in the file. |
| `VERIFY_AUTH_PROBE` | Answer 401 or 403 when the key is missing, so a client can tell a missing key from an error. |
| `VERIFY_BOM` | Remove the UTF-8 BOM - OneAgent strips it, other tools may not. Save the file as UTF-8 without BOM. |
| `VERIFY_DETAIL_NOT_FOUND` | Answer 404 for an id that does not exist (OneAgent then knows the item is gone). |
| `VERIFY_DISABLED` | The verification is switched off on this OneAgent; contact the OneAgent team. |
| `VERIFY_ENDPOINT_FAILED` | Make the endpoint answer 2xx for the request shown (check the path, the method and the parameters). |
| `VERIFY_ENDPOINT_INVALID` | Return JSON in the shape the file declares (the list at listPath, the contract named in the message). |
| `VERIFY_FACET_DUPLICATE_ID` | Keep every id unique within its vocabulary, and stable over time. |
| `VERIFY_FACET_ENTRY` | Give every facet entry an id (integer or string, as declared) and a non-empty label. |
| `VERIFY_FACET_INLINE_DIFFERS` | Nothing to do: the live values win. Update capabilities.facets if you keep a copy in the file. |
| `VERIFY_FACET_PARENT` | Make every parentId name an id of the same vocabulary (or leave it null). |
| `VERIFY_FACET_VOCABULARY_MISSING` | Serve the vocabulary named in your facets (or remove it from paramFacets / the parameter's facet). |
| `VERIFY_FETCH_CHARSET` | Save the file as UTF-8 and send charset=utf-8 in the Content-Type. |
| `VERIFY_FETCH_CONTENT_TYPE` | Serve oneagent.txt as text/plain; charset=utf-8 (a single-page app often answers every path with its HTML instead). |
| `VERIFY_FETCH_HTTP` | Serve oneagent.txt at the URL with HTTP 200 (check the path, the web server rules and that the file is deployed). |
| `VERIFY_FETCH_REDIRECT` | Serve the file on the same host: redirects may only add or drop www. or go from http to https, at most 3 hops. |
| `VERIFY_FETCH_TOO_LARGE` | Keep oneagent.txt under 2 MB: shorten the prose and the example blocks. |
| `VERIFY_HOST_DENIED` | This site is verified by the OneAgent team; contact us. |
| `VERIFY_HOST_LIMIT` | Wait a little and verify again (one verification per site every few minutes, a few per day). |
| `VERIFY_INPUT` | Enter your site's URL (https://www.example.com) or the URL of its oneagent.txt. |
| `VERIFY_ITEM_INVALID` | Fix the field named (or its fieldMap entry): after mapping, every item must match deal.schema.json. |
| `VERIFY_KEY_ECHO` | Never send the request's key back in an answer: remove it from the response body. |
| `VERIFY_KEY_MISSING` | Enter the key in the credential field to check this endpoint too. |
| `VERIFY_KEY_REFUSED` | Check the key and how auth declares it (type, header or query name); the site answered 401/403 with it. |
| `VERIFY_LIVE_NOT_RUN` | Fix the Errors of steps 1-4 first; then the live checks of your endpoints run. |
| `VERIFY_MANIFEST_ENDPOINT` | Serve the JSON manifest at the URL named (or remove the reference), returning the same manifest as oneagent.txt. |
| `VERIFY_MANIFEST_ENDPOINT_DIFFERS` | Return the same manifest from the manifest endpoint as in oneagent.txt (the members named are missing there). |
| `VERIFY_NARROW_RESPONSE` | Return the narrow answer as narrow-response.schema.json describes it (deals, usedLevel, levels ...). |
| `VERIFY_NO_ITEMS` | Make the example request return at least one item, so the mapping can be checked. |
| `VERIFY_OTHER_ORIGIN` | Keep every URL OneAgent calls on your BASE_URL's origin. |
| `VERIFY_PRIVATE_ADDRESS` | Publish the file on a public address: OneAgent never calls private, loopback or link-local addresses from here. |
| `VERIFY_RATE_LIMITED` | Allow a few requests a minute from the OneAgent User-Agent, or set politeness limits in the file that your server accepts. |
| `VERIFY_REDIRECTED` | Nothing to do; if the redirect is permanent, use the final address as BASE_URL. |
| `VERIFY_REQUEST_CAP` | Nothing to do: a verification sends at most a few requests. The checks not reached run when OneAgent onboards the site. |
| `VERIFY_REQUEST_REFUSED` | Fix the endpoint or template in the file so OneAgent can build a request on your BASE_URL. |
| `VERIFY_ROBOTS_BLOCKED` | robots.txt blocks OneAgent here. OneAgent does not use robots.txt, so nothing needs to change. |
| `VERIFY_ROBOTS_UNREADABLE` | Nothing needs to change: OneAgent does not use robots.txt. |
| `VERIFY_SEARCH_EMPTY` | Use a grammar example that finds results, so OneAgent can check the rules on real items. |
| `VERIFY_SEARCH_ENCODING` | Set queryEncoding to the encoding your search expects and responseEncoding to the page's charset. |
| `VERIFY_SEARCH_FAILED` | Make the search URL shown answer 200 with your result page (check path, queryParam and encodings). |
| `VERIFY_SEARCH_FALLBACK` | Nothing to do if the fallback marker is right; OneAgent never shows such items as matches. |
| `VERIFY_SEARCH_NO_EXAMPLE` | Add a search.grammar.examples entry with a query that finds results on your site. |
| `VERIFY_SEARCH_NO_RULES` | Add extract rules for the search page. OneAgent can propose rules for you (admin workbench). |
| `VERIFY_SEARCH_UNHEALTHY` | Update the extract rules (selectors) or the mapping so the required fields are found on the result page. |
| `VERIFY_SIGNAL_INVALID` | Return the answer as the published contract describes it (current-goals or statistics), with your own sourceId. |
| `VERIFY_SIGNAL_NOTE` | Check the values named (counts, ids, times); OneAgent still uses the answer. |
| `VERIFY_SITE_DATA` | Make the item's data agree with its title: the serviceType of its options (a breakfast offer is no half board) and its nights ("2 dana i 1 noćenje" is 1 night). OneAgent's answers follow the title meanwhile. |
| `VERIFY_SITE_LIMIT` | Nothing to do: the site's own request limits for today are used up; verify again later. |
| `VERIFY_SLOW` | Make the endpoint answer within 2 seconds (an index, a cache or a smaller page size usually helps). |
| `VERIFY_THEME_FALLBACK` | Fix the pageLayout value named (a colour, size or label OneAgent cannot use); OneAgent uses its default meanwhile. |
| `VERIFY_TIME_LIMIT` | Make your endpoints answer faster; the checks not reached run when OneAgent onboards the site. |
| `VERIFY_UNREACHABLE` | Make sure the site is reachable from the internet (DNS, firewall, TLS certificate) and answers within 10 seconds. |
| `VERIFY_USER_AGENT_BLOCKED` | Allow the OneAgent User-Agent in your server and WAF (a rule that skips challenges and bot protection for user agents containing OneAgent). |

## 13. Final checklist before you hand the file over

- [ ] `<ONEAGENT>/api/verify` (or the verify page) says **Ready** - or **Ready with warnings** and every warning is
      understood and explained to the human.
- [ ] Exactly one manifest; `oneagentSpec` is the lowest version that covers the members used; every URL of the site
      is written as `{BASE_URL}/...`.
- [ ] No key, token or password anywhere in the file; `auth` names only the type, location and header or parameter.
- [ ] `fieldMap` maps at least `id` and `title` (and `url`); the first items map and validate against `deal.schema.json`.
- [ ] Mapping rules, grammar and descriptions are plain rules about this site only: no links of other sites, no contact
      data, no instructions to an AI.
- [ ] The site-side checklist of part 9 is done (text/plain, no BOM, the OneAgent User-Agent allowed, keyed endpoints
      refuse requests without the key).
- [ ] The human who owns the site has read the file and knows the key OneAgent will ask for. Send the file's URL to
      the OneAgent team: nothing is submitted automatically.
