@ouispec/contract 0.6.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/INTEGRATOR-GUIDE.md +145 -7
- package/dist/generated/contract.d.ts +379 -11
- package/dist/generated/contract.d.ts.map +1 -1
- package/dist/generated/schemas.d.ts +20 -0
- package/dist/generated/schemas.d.ts.map +1 -1
- package/dist/generated/schemas.js +857 -6
- package/dist/generated/schemas.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/render-contract.d.ts.map +1 -1
- package/dist/render-contract.js +1 -0
- package/dist/render-contract.js.map +1 -1
- package/package.json +1 -1
- package/schemas/agent-evals.json +299 -1
- package/schemas/control-table.json +1 -1
- package/schemas/json-schema.json +13 -4
- package/schemas/oui-config.json +57 -1
- package/schemas/page-query.json +103 -0
package/INTEGRATOR-GUIDE.md
CHANGED
|
@@ -41,6 +41,7 @@ Every schema of the contract is versioned together by `MANIFEST_VERSION`, and th
|
|
|
41
41
|
| [`json-schema.json`](schemas/json-schema.json) | `JsonSchema` | `https://schemas.closurestudio.ai/oui/v1/json-schema.json` |
|
|
42
42
|
| [`action-effect.json`](schemas/action-effect.json) | `ActionEffect` | `https://schemas.closurestudio.ai/oui/v1/action-effect.json` |
|
|
43
43
|
| [`agent-binding.json`](schemas/agent-binding.json) | `AgentBinding` | `https://schemas.closurestudio.ai/oui/v1/agent-binding.json` |
|
|
44
|
+
| [`page-query.json`](schemas/page-query.json) | `PageQuery` | `https://schemas.closurestudio.ai/oui/v1/page-query.json` |
|
|
44
45
|
| [`control-kind-registration.json`](schemas/control-kind-registration.json) | `ControlKindRegistration` | `https://schemas.closurestudio.ai/oui/v1/control-kind-registration.json` |
|
|
45
46
|
| [`control-table.json`](schemas/control-table.json) | `ControlTableFile` | `https://schemas.closurestudio.ai/oui/v1/control-table.json` |
|
|
46
47
|
| [`tier2-mapping.json`](schemas/tier2-mapping.json) | `Tier2Mapping` | `https://schemas.closurestudio.ai/oui/v1/tier2-mapping.json` |
|
|
@@ -411,7 +412,7 @@ const catalog: RoomCatalog<LedgerContext> = {
|
|
|
411
412
|
};
|
|
412
413
|
```
|
|
413
414
|
|
|
414
|
-
- **`x-rows`** on the list in the observation's schema says how a row is addressed (`ref`), what a person calls it (`title`), and what an index row keeps. A list too long for the page state is cut to index rows, never to a count; the selected rows, and the rows an action just changed, stay whole.
|
|
415
|
+
- **`x-rows`** on the list in the observation's schema says how a row is addressed (`ref`), what a person calls it (`title`), and what an index row keeps, each a property of the row or a dotted path into it (`item.key`). A list too long for the page state is cut to index rows, never to a count; the selected rows, and the rows an action just changed, stay whole.
|
|
415
416
|
- **`roomReaders`** makes the room's `inspect` (everything about the rows named) and `query` (a list's rows, narrowed by an indexed property or by name, a page at a time). Both only read.
|
|
416
417
|
- **`x-ref`** on an input that takes a row (`{ type: 'string', ...refTo(POSITIONS) }`) names the list it addresses. The runtime then takes a row's exact name where its id is expected, when one row has it, and refuses an ambiguous one with the ids it could mean.
|
|
417
418
|
- **`changed`** on an action's result reports the rows it changed, added or removed, each as `inspect` would return it now (`changedRows(lists, ctx, refs)`), so the assistant checks an edit against what the room holds, not against what it meant to do.
|
|
@@ -422,9 +423,9 @@ The generator refuses a catalog whose observation lists things with an `id` and
|
|
|
422
423
|
>
|
|
423
424
|
> | Field | Type | Required | What it is |
|
|
424
425
|
> |---|---|---|---|
|
|
425
|
-
> | `ref` | string | yes | The property of a row that actions address it by (`id`). |
|
|
426
|
-
> | `title` | string | yes | The property of a row a person calls it by (`name`). |
|
|
427
|
-
> | `index` | string[] | | The other properties an index row keeps: the few that tell rows apart (a layer's kind, the artboard it is on). |
|
|
426
|
+
> | `ref` | string | yes | The property of a row that actions address it by (`id`), or a dotted path to it (`item.key`). |
|
|
427
|
+
> | `title` | string | yes | The property of a row a person calls it by (`name`), or a dotted path to it (`item.title`). |
|
|
428
|
+
> | `index` | string[] | | The other properties an index row keeps, each a property or a dotted path: the few that tell rows apart (a layer's kind, the artboard it is on, the display a fact row belongs to). |
|
|
428
429
|
> | `selection` | string | | The property beside the list, in the same object, that holds the refs of the rows the person has selected. |
|
|
429
430
|
|
|
430
431
|
> **Schema:** [`room-catalog-data.json#/$defs/RoomChangedRow`](schemas/room-catalog-data.json) · `https://schemas.closurestudio.ai/oui/v1/room-catalog-data.json#/$defs/RoomChangedRow` · TypeScript: `RoomChangedRow` from `@ouispec/contract`
|
|
@@ -471,6 +472,7 @@ Every input, value and observation schema, here and in tier 1, is written in the
|
|
|
471
472
|
> | `x-space` | string | | The frame a length, a point or a fraction is measured in, in the room's own words: `artboard` (from its top left), `canvas`, `layer` (the layer's own content), `artboard-fraction` (0–1 of the artboard's width and height). |
|
|
472
473
|
> | `x-rows` | RowList | | On an array of objects in an observation: the list is a collection the assistant addresses rows of (a document's layers, its artboards). |
|
|
473
474
|
> | `x-ref` | string[] | | On a string (or the items of an array of strings) in an action's input: the value addresses a row of one of the surface's `x-rows` lists, each named `<observation id>/<list property>`, or `<observation id>` when the observation itself is the list. |
|
|
475
|
+
> | `x-routes` | string[] | | On one alternative of the generated `app.navigate` action's `query`: the routes whose page takes that query (`/dashboard/service-lane`). |
|
|
474
476
|
> | `x-enum-omitted` | number | | How many allowed values a shortened `enum` leaves out. |
|
|
475
477
|
> | `x-oui-attachment` | { as: "file" \| "text", mediaTypes?: string[] } | | On a string with `format: oui-attachment`: what the action takes once the client resolves the attachment's id. |
|
|
476
478
|
|
|
@@ -491,12 +493,25 @@ The generator reads every setting from `oui.config.json` at the app's root; path
|
|
|
491
493
|
"apiSpec": "@acme/api-client/openapi.json",
|
|
492
494
|
"appCatalogs": [{ "module": "src/strategy/catalog.ts", "export": "strategyCanvasCatalog", "hosts": ["StrategyCanvas"] }],
|
|
493
495
|
"unbound": [],
|
|
496
|
+
"outside": [
|
|
497
|
+
{ "component": "SignInPage", "reason": "before sign-in" },
|
|
498
|
+
{ "route": "/share/:token", "reason": "a public share link, opened signed out" }
|
|
499
|
+
],
|
|
494
500
|
"out": "src/agent/generated"
|
|
495
501
|
}
|
|
496
502
|
```
|
|
497
503
|
|
|
498
504
|
`apiSpec` names the OpenAPI 3 document inside the installed API client package, never a sibling checkout, so the generator reads exactly the spec of the client version the app installs. Every `mutate` effect names one of its `operationId`s.
|
|
499
505
|
|
|
506
|
+
`outside` names the pages the assistant is never on: pages before sign-in, and public pages a link opens. Each names its page by component or by route, with the reason. An outside page has no surface, its controls are not enforced, the assistant is not offered it as a page to go to, and the knowledge says the assistant is not there. A page is outside only when nothing around it or in it is the assistant's, so the list cannot hide a page of the app:
|
|
507
|
+
|
|
508
|
+
- no `shell` entry frames any of its routes;
|
|
509
|
+
- every element its routes render around it, a layout route's or a `routeWrappers` component's at any level, holds nothing someone can use (no control, bound or not, no display, no room) and no person-only component, which is how the assistant's own UI is declared;
|
|
510
|
+
- the page does not render the app's frame itself;
|
|
511
|
+
- the page has no binding, display or room of its own, on no page the assistant is on. One a component shares with pages the assistant is on is that component's, offered there.
|
|
512
|
+
|
|
513
|
+
A page in the app's frame fails the first three, and a page that binds anything only for itself fails the last. `unbound` is for pages the assistant is on that are not bound yet; a page is never in both lists.
|
|
514
|
+
|
|
500
515
|
`mappings` lists the app's tier 2 mappings; each emits a bound module into `<out>/bound/` (see [Tier 2](#tier-2-a-design-system-you-do-not-own)).
|
|
501
516
|
|
|
502
517
|
> **Schema:** [`oui-config.json`](schemas/oui-config.json) · `https://schemas.closurestudio.ai/oui/v1/oui-config.json` · TypeScript: `OuiConfigFile` from `@ouispec/contract`
|
|
@@ -514,6 +529,7 @@ The generator reads every setting from `oui.config.json` at the app's root; path
|
|
|
514
529
|
> | `mappings` | string[] | | Tier 2 mappings (`tier2-mapping.json`), one per third-party design system the app does not own, by path. |
|
|
515
530
|
> | `apiSpec` | string \| null | yes | The API's OpenAPI 3 document, by module path, as the installed API client ships it (`@traidr/api-client/openapi.json`) — never a sibling checkout path, so the generator reads exactly the spec of the client version the app installs; or a path inside the app. |
|
|
516
531
|
> | `unbound` | string[] | | Page components whose interactive controls are not all bound yet. |
|
|
532
|
+
> | `outside` | OutsideEntry[] | | Pages the assistant is never on: pages before sign-in, and public pages a link opens (a share link, a confirmation link). |
|
|
517
533
|
> | `appCatalogs` | AppCatalogEntry[] | | Room catalogs the app itself declares (tier 3, a page's own editor), each loaded through the app's own Vite config so its modules resolve as the app build resolves them: the app needs `vite` among its own dependencies. |
|
|
518
534
|
> | `shell` | ShellEntry[] | | The app's frame: components mounted around the pages rather than by a route (a sidebar, a top bar, a phone tab bar, a toast host). |
|
|
519
535
|
|
|
@@ -535,6 +551,7 @@ Commit both files, and run `--check` in CI on every change. The build fails, nam
|
|
|
535
551
|
| `apiSpec` cannot be read, or a `mutate` names an unknown `operationId` |
|
|
536
552
|
| A room catalog breaks `room-catalog-data.json`, or a recipe names an entry the room does not have |
|
|
537
553
|
| A page listed in `unbound` is fully bound (the list may only get shorter) |
|
|
554
|
+
| A page listed in `outside` has the assistant around it or in it: a `shell` entry frames one of its routes, an element its routes render around it holds something someone can use or a person-only component, the page renders the frame itself, or it has a binding, display or room on no page the assistant is on |
|
|
538
555
|
| A binding's value is built by a call, so it cannot be read without running the app |
|
|
539
556
|
|
|
540
557
|
The two outputs are part of the contract too: the runtime offers the intersection of the manifest and what is mounted, and each turn carries the knowledge for the page the person is on.
|
|
@@ -621,10 +638,57 @@ A page's action definitions weigh what its whole catalogue weighs. On a studio p
|
|
|
621
638
|
- **Only the newest answer carries the page's state to the model.** Every earlier answer of the turn keeps what its action did (its result, the rows it changed, what the page offers since) and says where the state is, so a turn of many actions costs about what one does, plus what each did.
|
|
622
639
|
- **UI actions are not counted against a per-tool quota:** they run as the person, bounded by the turn's steps and deadline. What is refused is a loop: the same call with the same input, once it has changed nothing three times in a row. Undo five times is five undos.
|
|
623
640
|
- **Every answer is fitted to a byte budget before it is sent** (480 KB by default, 256 KB for a snapshot). The action's own result is kept whole. Long lists in the page's state are cut first, and the answer says where, so the assistant can read the rest with `ui_read` or a room's `query`.
|
|
641
|
+
- **What a page shows keeps an index too.** A page reports its displays' facts under `shown` in its state, and a display that describes one row of a list (a card each) carries the row as `item`. The page state declares `x-rows` on `shown` (`ref: item.key`, `title: item.title`, `index: [id]`), and the bindings report each display's rows together. Over budget, the page's own facts stay whole, and a long list of cards keeps its first rows whole and the rest as index rows (the display, the row's key and title), the rows an action just changed whole. When even the index does not fit, the list says how many rows are left out and the `ui_read` call (`path: /shown`, `offset`, `limit`) that returns exactly them, one display at a time.
|
|
624
642
|
- **The assistant never changes a page it cannot see.** After an answer that arrived without the page's state, or no answer, the worker runs only reads until one succeeds. After two refused changes in a row, the assistant stops and tells the person what it could not confirm.
|
|
625
643
|
|
|
626
644
|
Nothing here is written per feature: the index, the outlines and the fitting are computed from the declarations.
|
|
627
645
|
|
|
646
|
+
## Going to a page, already filtered
|
|
647
|
+
|
|
648
|
+
The generator gives every build one navigation surface, `app:navigation`, with one action, `app.navigate` (tool `app_navigate`): go to a page by its address, as following a link does. Its `path` lists every page's route with its title. `connectBindings({ navigation })` runs it with the app's router.
|
|
649
|
+
|
|
650
|
+
A list page that keeps its filters in its address (`/dashboard/service-lane?view=declined&period=this_month`) can be opened by the assistant exactly as the person asked, in one call, when the page declares the query it reads. The page declares it once, where it reads it:
|
|
651
|
+
|
|
652
|
+
```ts
|
|
653
|
+
import { defineQuery, readQuery, writeQuery } from '@ouispec/bindings';
|
|
654
|
+
|
|
655
|
+
export const LANE_QUERY = defineQuery({
|
|
656
|
+
view: { values: LANE_VIEWS, default: 'lane', description: 'The open lane, or closed repair orders with declined work' },
|
|
657
|
+
period: { values: DECLINED_PERIODS, default: 'this_month', description: 'The declined list’s period' },
|
|
658
|
+
advisor: { type: 'string', description: 'A service advisor, by name as the lane shows it' },
|
|
659
|
+
page: { type: 'integer', minimum: 1, default: 1, description: 'The page of the list' },
|
|
660
|
+
});
|
|
661
|
+
|
|
662
|
+
function ServiceLanePage() {
|
|
663
|
+
const [searchParams, setSearchParams] = useSearchParams();
|
|
664
|
+
const query = readQuery(LANE_QUERY, searchParams); // { view: 'lane' | 'declined', period, advisor?: string, page: number }
|
|
665
|
+
const setView = (view: string) => setSearchParams(writeQuery(LANE_QUERY, searchParams, { view, page: undefined }));
|
|
666
|
+
// …
|
|
667
|
+
}
|
|
668
|
+
```
|
|
669
|
+
|
|
670
|
+
- `values` is the option list the page's select or tabs already render: strings, or `{ value, label, description }`. Other kinds are `type: 'string'` (free text), `'integer'` or `'number'` (with `minimum`, `maximum`, `unit`), `'boolean'` (`1` on, `0` off) and `'date'` (`YYYY-MM-DD`). `multiple: true` takes several, comma-separated.
|
|
671
|
+
- `readQuery` reads the address as the declaration says: a value the page does not take falls back to its `default` (or is left out), so a hand-edited address never breaks the page. `writeQuery` writes changes back and leaves out a default or empty value, so the plain address stays plain.
|
|
672
|
+
- The generator finds `readQuery(<a defineQuery constant>, …)` in the page, in a component it renders, or in an app hook they call, and fails the build when the declaration is not a build-time constant or does not match the schema below, or when two declarations on one page give the same parameter different meanings.
|
|
673
|
+
|
|
674
|
+
What the build then offers:
|
|
675
|
+
|
|
676
|
+
- `app.navigate` takes `query` beside `path`: one alternative per page that declares one, each with `x-routes` naming its routes and a property per parameter (`enum` and meanings, range, default). `path` names the parameters beside each such page (`/dashboard/service-lane (Service lane; ?view, ?period, ?advisor, ?page)`), and the page's knowledge lists them.
|
|
677
|
+
- `params` fills a route's `:parameters` when `path` is written as its route (`{ "path": "/dashboard/inventory/:unitId", "params": { "unitId": "u 7" } }` goes to `/dashboard/inventory/u%207`).
|
|
678
|
+
- The runtime builds the address from the path, `params` and `query`, encoding each part. It refuses a path that is not one of the build's routes, one that could leave the app (`//host`, a backslash, a scheme, `.` or `..` segments), a query parameter a declaring page does not take, and a value it does not accept, naming what the page takes. A query in `path` itself (`?view=declined`) is read the same way. A page that declares no query takes its address as before.
|
|
679
|
+
- Going to the address the person is already on does nothing, and says so (`alreadyThere`).
|
|
680
|
+
|
|
681
|
+
> **Schema:** [`page-query.json`](schemas/page-query.json) · `https://schemas.closurestudio.ai/oui/v1/page-query.json` · TypeScript: `PageQuery` from `@ouispec/contract`
|
|
682
|
+
|
|
683
|
+
> **Schema:** [`page-query.json#/$defs/QueryChoice`](schemas/page-query.json) · `https://schemas.closurestudio.ai/oui/v1/page-query.json#/$defs/QueryChoice` · TypeScript: `QueryChoice` from `@ouispec/contract`
|
|
684
|
+
>
|
|
685
|
+
> | Field | Type | Required | What it is |
|
|
686
|
+
> |---|---|---|---|
|
|
687
|
+
> | `values` | QueryValue[] | yes | Every value the page takes, each a string or `{ value, label, description }`: the same option list its control renders. |
|
|
688
|
+
> | `description` | string | yes | |
|
|
689
|
+
> | `default` | string | | One of `values`: what the page shows when the address leaves it out. |
|
|
690
|
+
> | `multiple` | boolean | | It takes several of the values, comma-separated in the address (`?signals=a,b`). |
|
|
691
|
+
|
|
628
692
|
## Work that outlives the call: the job effect
|
|
629
693
|
|
|
630
694
|
A binding or room action whose work finishes later — a render, an export, an order that fills — declares `effect: { kind: 'job', estimatedDuration?, timeoutMs? }`, and its handler returns `{ ok: true, pending: { jobId } }`. The action is reported `started` at once, then settles on the job's outcome: `complete` when its completion arrives, `failed` when its failure does, and after `timeoutMs` (default five minutes) a `timeout` failure, never a late success. With no tracker, or no job id, it is `unverified`: started, but not confirmable from the page. Three rules make this hold, and the kit checks the first: every `run` returns its callback's result; a job is tracked at dispatch, not at the first poll; a disabled job control is still followed.
|
|
@@ -1010,6 +1074,10 @@ A person on the product's staff can take a live conversation from the agent, ans
|
|
|
1010
1074
|
| `refusal` | the reply declines (`true`: the usual phrasing; or a matcher) |
|
|
1011
1075
|
| `doesNotStore` | the matchers appear nowhere the turn stored: its text, its tool arguments, its tool results |
|
|
1012
1076
|
| `held` | the turn ran no model call, because a person held the conversation |
|
|
1077
|
+
| `calls` | each tool (`tool`), or each of the page's actions run through `ui_act` (`action`, by its id or its index name), was called exactly `times`, or `min` to `max` times (none given: at least once), counting only calls whose arguments or input hold `args` |
|
|
1078
|
+
| `usage` | the turn's model calls stayed within each bound: `modelCalls`, `firstCallInputTokens`, `callInputTokens` (every call), `inputTokens` and `outputTokens` (all of them), and `cachedShare` (the share of its input read from the prompt cache, 0 to 1), as the provider reported them |
|
|
1079
|
+
| `choices` | the turn offered choice buttons (`present_options`) with an option matching each of `options`, a question matching each of `question`, and a `count` of options within its bound (`false`: it offered none) |
|
|
1080
|
+
| `page` | the page is `at` that path after the turn (with a query string, those parameters too), each of `ran` ran on it with input holding `input`, and none of `notRan` did (`*`: nothing) |
|
|
1013
1081
|
|
|
1014
1082
|
```yaml
|
|
1015
1083
|
version: 1
|
|
@@ -1029,7 +1097,32 @@ scenarios:
|
|
|
1029
1097
|
mustNotSay: [{ pattern: "per month|/mo|APR", flags: i }]
|
|
1030
1098
|
```
|
|
1031
1099
|
|
|
1032
|
-
**Every tool is stubbed.** A stub is data in the suite or the scenario (`when`, a subset of the call's arguments; `result`), first match wins, the scenario's first; or a function in the configuration. A call to a tool with no stub fails the scenario: an eval never reaches your backend.
|
|
1100
|
+
**Every tool is stubbed.** A stub is data in the suite or the scenario (`when`, a subset of the call's arguments; `result`), first match wins, the scenario's first; or a function in the configuration. A call to a tool with no stub fails the scenario: an eval never reaches your backend. The SDK's own interaction tools (`present_options`, `confirm_action`, `request_user_decision`) reach no backend, so with no stub they run as they are, and the choices they offer are read from the turn.
|
|
1101
|
+
|
|
1102
|
+
**The person's page.** A suite, or a scenario in its place (`page: false` for none), declares the page its turns are sent from (`AgentEvalPage`). The harness runs it on a real oui-spec surface runtime in index form, sends every turn from wherever the page is, with its snapshot and its address (`oui`, `currentPath`, and `uiKnowledge` when the configuration gives your knowledge), and answers the agent's `ui_act`, `ui_describe` and `ui_read` from it, as the person's tab would. Its surfaces are either declared in the suite (`surfaces`: each one's `routes`, its observations as `state`, and its actions, each with the `result` it answers, the `state` it leaves and the address it goes to, by `cases` on its input), or are your own: give the configuration your generated manifest (`page: { manifest, knowledge }`) and name your controls by binding id (`controls`: each one's value, rows and what it does; `allControls` mounts the rest of a surface's, empty). They are registered with a real binding registry and connected with `connectBindings`, as your tab does, so the agent is offered exactly what your build declares. Going to a page (`app.navigate`) mounts what is at the new address; the next turn is sent from there.
|
|
1103
|
+
|
|
1104
|
+
```yaml
|
|
1105
|
+
page:
|
|
1106
|
+
at: /dashboard
|
|
1107
|
+
controls:
|
|
1108
|
+
service-lane.view: { value: open }
|
|
1109
|
+
service-lane.declined.advisor: {}
|
|
1110
|
+
scenarios:
|
|
1111
|
+
- id: declined-work-opens-the-lane
|
|
1112
|
+
title: Opens the service lane once, on its declined work, and pastes nothing
|
|
1113
|
+
turns:
|
|
1114
|
+
- user: Show me the declined work
|
|
1115
|
+
expect:
|
|
1116
|
+
page: { at: /dashboard/service-lane, ran: [{ action: service-lane.view, input: { value: declined } }] }
|
|
1117
|
+
calls: [{ action: app.navigate, times: 1 }, { tool: listRepairOrders, times: 0 }]
|
|
1118
|
+
usage: { firstCallInputTokens: { max: 20000 }, callInputTokens: { max: 40000 } }
|
|
1119
|
+
```
|
|
1120
|
+
|
|
1121
|
+
**Your conversation store.** By default the harness keeps the whole conversation. To run later turns on what your worker really reads (a window that cuts old tool results, a summary, a step context), give the configuration `history`: your store as `EvalHistory` (`append`, `getHistory`, `persistMessages`), or `createMemoryHistory({ window })` with your window over the whole conversation.
|
|
1122
|
+
|
|
1123
|
+
**Your agent's settings.** `agent` returns what your worker runs with, `modelProviderOptions`, `forcedToolChoice` and `uiActions` (its waits and how much of the page the model reads; the channel is the page's) included.
|
|
1124
|
+
|
|
1125
|
+
**The judge.** A rubric's verdict is asked for as structured output, which the provider gives its own way (a JSON schema, a forced tool, or instructions for a model that refuses one); an answer that is still no verdict is read as text, then asked for again (`judgeOptions: { retries, maxOutputTokens }`). A judge that never gives one is reported apart: the case is `unjudged`, not failed (`JUDGE` in the report, an `error` in JUnit, exit 3 when nothing failed).
|
|
1033
1126
|
|
|
1034
1127
|
**Channels.** Your configuration names them, and what each changes: `approvals` (the card, `ui`, or a conversation channel, `chat`, `sms`, `voice`, `phone`, where the readback is sent and the next message confirms it), `input` (what each customer message carries as `context.input`, so a voice channel marks it spoken), and `context`. The turn carries its channel, and the worker tells the model about approvals in that channel's terms. Every scenario runs on every channel of its suite unless it names fewer, so a change that breaks SMS and not web chat fails.
|
|
1035
1128
|
|
|
@@ -1058,9 +1151,9 @@ export default defineEvals({
|
|
|
1058
1151
|
});
|
|
1059
1152
|
```
|
|
1060
1153
|
|
|
1061
|
-
**Run it.** `agent-evals` (in CI: replays the recordings), `agent-evals --record` (runs the live model and writes them), `agent-evals --live` (runs it and writes nothing). `--channel` and `--scenario` narrow a run; `--json` and `--junit` write reports. It exits 1 when any case fails, listing each failed assertion with its turn, channel and the reply. In a test runner, `evalCases(config)` gives one case per scenario and channel, each throwing with every failure.
|
|
1154
|
+
**Run it.** `agent-evals` (in CI: replays the recordings), `agent-evals --record` (runs the live model and writes them), `agent-evals --live` (runs it and writes nothing). `--channel` and `--scenario` narrow a run; `--json` and `--junit` write reports. It exits 1 when any case fails, listing each failed assertion with its turn, channel and the reply, and 3 when none failed but a rubric could not be judged. In a test runner, `evalCases(config)` gives one case per scenario and channel, each throwing with every failure.
|
|
1062
1155
|
|
|
1063
|
-
**A recording knows what it was recorded against**: your system prompt, your tools' names, descriptions and schemas, the scenario's turns and the channel. Change any of them and its replay fails until you record it again, rather than passing on answers to a question no longer asked.
|
|
1156
|
+
**A recording knows what it was recorded against**: your system prompt, your tools' names, descriptions and schemas, the scenario's turns, its page and the channel. Change any of them and its replay fails until you record it again, rather than passing on answers to a question no longer asked.
|
|
1064
1157
|
|
|
1065
1158
|
The package ships an example: a fake dealer tool set, with scenarios for disclosure, price and no payments, an injected instruction, an SSN refused and not stored, a request for a person, a booking that runs only after its readback is confirmed, and a take-over and hand-back, on web chat, SMS and voice.
|
|
1066
1159
|
|
|
@@ -1074,6 +1167,7 @@ The package ships an example: a fake dealer tool set, with scenarios for disclos
|
|
|
1074
1167
|
> | `channels` | AgentEvalChannelList | | The channels every scenario runs on, as the eval configuration names them (`web_chat`, `sms`, `voice`). |
|
|
1075
1168
|
> | `context` | object | | What every turn of every scenario carries as its context, before the channel's and the scenario's own. |
|
|
1076
1169
|
> | `stubs` | AgentEvalStubs | | What each tool returns, for every scenario; a scenario's own stubs come first. |
|
|
1170
|
+
> | `page` | AgentEvalPage | | The person's page, scripted, for every scenario: what it offers at each address and what its actions do. |
|
|
1077
1171
|
> | `scenarios` | AgentEvalScenario[] | yes | |
|
|
1078
1172
|
|
|
1079
1173
|
> **Schema:** [`agent-evals.json#/$defs/AgentEvalExpectation`](schemas/agent-evals.json) · `https://schemas.closurestudio.ai/oui/v1/agent-evals.json#/$defs/AgentEvalExpectation` · TypeScript: `AgentEvalExpectation` from `@ouispec/contract`
|
|
@@ -1088,6 +1182,10 @@ The package ships an example: a fake dealer tool set, with scenarios for disclos
|
|
|
1088
1182
|
> | `refusal` | true \| AgentEvalTextMatcher | | The reply declines: `true` for the usual phrasing of a refusal (can't, cannot, unable, not able, won't, not allowed), or a matcher for the agent's own words. |
|
|
1089
1183
|
> | `doesNotStore` | AgentEvalTextMatcher[] | | None of these appears in anything the turn stored: its text, its tool calls' arguments, its tool results. |
|
|
1090
1184
|
> | `held` | boolean | | `true`: the turn ran no model call, because a person held the conversation. |
|
|
1185
|
+
> | `calls` | AgentEvalCallCount[] | | How many times each tool, or each of the page's actions, was called in the turn. |
|
|
1186
|
+
> | `usage` | AgentEvalUsage | | What the turn's model calls used, as the provider reported it. |
|
|
1187
|
+
> | `choices` | false \| AgentEvalChoicesExpectation | | The turn offered the person choice buttons (`present_options`) that match; `false`: it offered none. |
|
|
1188
|
+
> | `page` | AgentEvalPageExpectation | | What the page did in the turn, read from the page itself. |
|
|
1091
1189
|
|
|
1092
1190
|
> **Schema:** [`agent-evals.json#/$defs/AgentEvalStubCase`](schemas/agent-evals.json) · `https://schemas.closurestudio.ai/oui/v1/agent-evals.json#/$defs/AgentEvalStubCase` · TypeScript: `AgentEvalStubCase` from `@ouispec/contract`
|
|
1093
1191
|
>
|
|
@@ -1095,3 +1193,43 @@ The package ships an example: a fake dealer tool set, with scenarios for disclos
|
|
|
1095
1193
|
> |---|---|---|---|
|
|
1096
1194
|
> | `when` | object | | |
|
|
1097
1195
|
> | `result` | { success: boolean, data?: any, error?: string } | yes | |
|
|
1196
|
+
|
|
1197
|
+
> **Schema:** [`agent-evals.json#/$defs/AgentEvalPage`](schemas/agent-evals.json) · `https://schemas.closurestudio.ai/oui/v1/agent-evals.json#/$defs/AgentEvalPage` · TypeScript: `AgentEvalPage` from `@ouispec/contract`
|
|
1198
|
+
>
|
|
1199
|
+
> | Field | Type | Required | What it is |
|
|
1200
|
+
> |---|---|---|---|
|
|
1201
|
+
> | `at` | string | yes | The address the first turn is sent from. |
|
|
1202
|
+
> | `routes` | string[] | | The addresses going to a page accepts, as route patterns (`/leads/:id`), when the manifest declares no navigation surface of its own. |
|
|
1203
|
+
> | `navigation` | boolean | | Whether the page offers going to a page by its address (`app.navigate`), as a generated app does: the manifest's navigation surface, or one made from `routes`, run by the bindings as the product's tab runs it. |
|
|
1204
|
+
> | `surfaces` | AgentEvalPageSurface[] | | Surfaces declared here, each mounted while the page is at one of its routes. |
|
|
1205
|
+
> | `controls` | map of AgentEvalPageControl | | The product's own controls, by binding id in the configuration's manifest: each is mounted while the page is on its surface, with what it shows and what it does. |
|
|
1206
|
+
> | `allControls` | boolean | | Also mount every other control the manifest declares on a surface that is mounted, with no value, as an empty form shows them. |
|
|
1207
|
+
|
|
1208
|
+
> **Schema:** [`agent-evals.json#/$defs/AgentEvalPageAction`](schemas/agent-evals.json) · `https://schemas.closurestudio.ai/oui/v1/agent-evals.json#/$defs/AgentEvalPageAction` · TypeScript: `AgentEvalPageAction` from `@ouispec/contract`
|
|
1209
|
+
>
|
|
1210
|
+
> | Field | Type | Required | What it is |
|
|
1211
|
+
> |---|---|---|---|
|
|
1212
|
+
> | `id` | string | yes | As the page's index names it, and `ui_act` takes it. |
|
|
1213
|
+
> | `title` | string | | |
|
|
1214
|
+
> | `description` | string | yes | |
|
|
1215
|
+
> | `effect` | "view" \| "selection" \| "navigate" \| "open" \| "edit" \| "file" \| … | | What it changes (oui-spec's effect kinds). |
|
|
1216
|
+
> | `confirm` | boolean | | It asks the person to approve it first. |
|
|
1217
|
+
> | `input` | object | | What it takes, as a JSON Schema. |
|
|
1218
|
+
> | `result` | { success: boolean, data?: any, error?: string } | | What it answers. |
|
|
1219
|
+
> | `state` | object | | Its surface's observations once it has run, by observation id: each given replaces the one before. |
|
|
1220
|
+
> | `navigate` | string | | The address the page goes to once it has run. |
|
|
1221
|
+
> | `cases` | { when?: object, result?: { success: boolean, data?: any, error?: string }, state?: object, navigate?: string }[] | | What it does for a call whose input holds `when`, the first that matches; a call none matches gets the defaults beside them. |
|
|
1222
|
+
|
|
1223
|
+
> **Schema:** [`agent-evals.json#/$defs/AgentEvalPageControl`](schemas/agent-evals.json) · `https://schemas.closurestudio.ai/oui/v1/agent-evals.json#/$defs/AgentEvalPageControl` · TypeScript: `AgentEvalPageControl` from `@ouispec/contract`
|
|
1224
|
+
>
|
|
1225
|
+
> | Field | Type | Required | What it is |
|
|
1226
|
+
> |---|---|---|---|
|
|
1227
|
+
> | `value` | any | | What it shows when the page opens. |
|
|
1228
|
+
> | `title` | string | | What it is called on screen. |
|
|
1229
|
+
> | `valueSchema` | object | | Its live value schema (its options, its range), within the manifest's. |
|
|
1230
|
+
> | `disabled` | boolean | | It cannot be used: it is not offered. |
|
|
1231
|
+
> | `rows` | { key: string, title: string, description?: string, value?: any }[] | | For a list's control: one per row shown. |
|
|
1232
|
+
> | `routes` | string[] | | Where it is mounted, when not wherever its surface is. |
|
|
1233
|
+
> | `result` | { success: boolean, data?: any, error?: string } | | What it answers. |
|
|
1234
|
+
> | `navigate` | string | | The address the page goes to once it has run. |
|
|
1235
|
+
> | `cases` | { when?: object, result?: { success: boolean, data?: any, error?: string }, navigate?: string }[] | | What it does for a call whose input holds `when`, the first that matches; a call none matches gets the defaults beside them. |
|