@ouispec/agent-worker 0.1.1 → 0.2.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.
Files changed (64) hide show
  1. package/dist/approvals/continuation.d.ts +14 -1
  2. package/dist/approvals/continuation.d.ts.map +1 -1
  3. package/dist/approvals/continuation.js +12 -2
  4. package/dist/approvals/continuation.js.map +1 -1
  5. package/dist/index.d.ts +6 -3
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +5 -2
  8. package/dist/index.js.map +1 -1
  9. package/dist/orchestrator.d.ts.map +1 -1
  10. package/dist/orchestrator.js +383 -128
  11. package/dist/orchestrator.js.map +1 -1
  12. package/dist/prompt/clock.d.ts +34 -0
  13. package/dist/prompt/clock.d.ts.map +1 -0
  14. package/dist/prompt/clock.js +63 -0
  15. package/dist/prompt/clock.js.map +1 -0
  16. package/dist/prompt/rules/ui-control.d.ts +3 -3
  17. package/dist/prompt/rules/ui-control.d.ts.map +1 -1
  18. package/dist/prompt/rules/ui-control.js +45 -22
  19. package/dist/prompt/rules/ui-control.js.map +1 -1
  20. package/dist/runtime/turn-runner.d.ts.map +1 -1
  21. package/dist/runtime/turn-runner.js +3 -1
  22. package/dist/runtime/turn-runner.js.map +1 -1
  23. package/dist/runtime/types.d.ts +5 -3
  24. package/dist/runtime/types.d.ts.map +1 -1
  25. package/dist/tools/builtin-tools.js +11 -4
  26. package/dist/tools/builtin-tools.js.map +1 -1
  27. package/dist/tools/types.d.ts +17 -0
  28. package/dist/tools/types.d.ts.map +1 -1
  29. package/dist/tools/types.js.map +1 -1
  30. package/dist/turn-ledger.d.ts +30 -0
  31. package/dist/turn-ledger.d.ts.map +1 -0
  32. package/dist/turn-ledger.js +45 -0
  33. package/dist/turn-ledger.js.map +1 -0
  34. package/dist/types.d.ts +9 -2
  35. package/dist/types.d.ts.map +1 -1
  36. package/dist/ui/answer-image.d.ts +32 -0
  37. package/dist/ui/answer-image.d.ts.map +1 -0
  38. package/dist/ui/answer-image.js +50 -0
  39. package/dist/ui/answer-image.js.map +1 -0
  40. package/dist/ui/observations.d.ts +29 -5
  41. package/dist/ui/observations.d.ts.map +1 -1
  42. package/dist/ui/observations.js +122 -46
  43. package/dist/ui/observations.js.map +1 -1
  44. package/dist/ui/outline.d.ts +49 -0
  45. package/dist/ui/outline.d.ts.map +1 -0
  46. package/dist/ui/outline.js +229 -0
  47. package/dist/ui/outline.js.map +1 -0
  48. package/dist/ui/page-index.d.ts +74 -0
  49. package/dist/ui/page-index.d.ts.map +1 -0
  50. package/dist/ui/page-index.js +137 -0
  51. package/dist/ui/page-index.js.map +1 -0
  52. package/dist/ui/snapshot.d.ts +24 -12
  53. package/dist/ui/snapshot.d.ts.map +1 -1
  54. package/dist/ui/snapshot.js +34 -39
  55. package/dist/ui/snapshot.js.map +1 -1
  56. package/dist/ui/ui-sequence.d.ts +9 -9
  57. package/dist/ui/ui-sequence.d.ts.map +1 -1
  58. package/dist/ui/ui-sequence.js +2 -2
  59. package/dist/ui/ui-sequence.js.map +1 -1
  60. package/dist/ui/ui-tools.d.ts +64 -14
  61. package/dist/ui/ui-tools.d.ts.map +1 -1
  62. package/dist/ui/ui-tools.js +466 -92
  63. package/dist/ui/ui-tools.js.map +1 -1
  64. package/package.json +6 -6
@@ -6,16 +6,32 @@
6
6
  * The worker builds the turn's UI tools from it and from nothing else, so the
7
7
  * tools always describe the client that sent the turn.
8
8
  */
9
- import type { OUISurface, OUISurfaceSnapshot } from 'oui-spec/spec';
9
+ import type { OUIFit, OUIObservationSnapshot } from 'oui-spec/spec';
10
+ import { pageFingerprint, type HeldDefinitions, type PageSurface } from './page-index.js';
10
11
  /** The context key a UI client uses for its snapshot. */
11
12
  export declare const CLIENT_SNAPSHOT_KEY = "oui";
13
+ /** The client's page as the turn carried it. */
14
+ export interface ClientPage {
15
+ /** What the page offers, in index (ADR-0245 §2.1), whichever form the client sent. */
16
+ page: PageSurface[];
17
+ observations: OUIObservationSnapshot;
18
+ /** The client's hash of what it sent, which the worker sends back as `knownSurfaces`. */
19
+ surfacesHash?: string;
20
+ /** What the client shortened so its snapshot fits (oui-spec §7.3.9). */
21
+ fit?: OUIFit;
22
+ /** The definitions a client that sent them came with: describing those actions needs no request. */
23
+ held: HeldDefinitions;
24
+ }
12
25
  /**
13
- * Read and validate the snapshot from a turn's context. Returns null when the
14
- * turn carries none (a client with no UI), and throws when it carries one that
15
- * is malformed: a broken snapshot is a client bug that must not quietly turn
16
- * into "this client has no UI".
26
+ * Read and validate the client's page from a turn's context. Returns null when
27
+ * the turn carries none (a client with no UI), and throws when it carries one
28
+ * that is malformed: a broken snapshot is a client bug that must not quietly
29
+ * turn into "this client has no UI".
30
+ *
31
+ * A client sends its surfaces as `index` (oui-spec §7.3.8) or, before 0.7 or
32
+ * when made to, as `surfaces` with every definition. Both give the same page.
17
33
  */
18
- export declare function readClientSnapshot(context: Record<string, unknown> | null | undefined): OUISurfaceSnapshot | null;
34
+ export declare function readClientPage(context: Record<string, unknown> | null | undefined): ClientPage | null;
19
35
  /** The turn's context without the snapshot. */
20
36
  export declare function withoutClientSnapshot(context: Record<string, unknown> | null | undefined): Record<string, unknown> | null | undefined;
21
37
  /**
@@ -24,10 +40,6 @@ export declare function withoutClientSnapshot(context: Record<string, unknown> |
24
40
  * host's prompt). This is the context the host's prompt renders as prose.
25
41
  */
26
42
  export declare function withoutClientUI(context: Record<string, unknown> | null | undefined): Record<string, unknown> | null | undefined;
27
- /**
28
- * A stable fingerprint of what the client can do: its surface ids and each
29
- * surface's action ids. Two snapshots with the same fingerprint give the
30
- * model the same tools.
31
- */
32
- export declare function capabilityFingerprint(surfaces: readonly OUISurface[]): string;
43
+ /** A stable fingerprint of what the page offers: two pages with the same one give the model the same index. */
44
+ export declare const capabilityFingerprint: typeof pageFingerprint;
33
45
  //# sourceMappingURL=snapshot.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"snapshot.d.ts","sourceRoot":"","sources":["../../src/ui/snapshot.ts"],"names":[],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AC,EAAE,MAAM,CAAC;IACtB,wEAAwE;IACxE,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,oGAAoG;IACpG,IAAI,EAAE,eAAe,CAAC;CACvB;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,GAAG,SAAS,GAAG,UAAU,GAAG,IAAI,CAsCrG;AAED,+CAA+C;AAC/C,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,GAAG,SAAS,GAClD,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,GAAG,SAAS,CAE5C;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,GAAG,SAAS,GAClD,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,GAAG,SAAS,CAE5C;AAUD,+GAA+G;AAC/G,eAAO,MAAM,qBAAqB,wBAAkB,CAAC"}
@@ -1,35 +1,51 @@
1
1
  import { CLIENT_KNOWLEDGE_KEY } from './knowledge.js';
2
+ import { isFullSurface, isSurfaceIndex, pageFingerprint, pageFromIndex, pageFromSurfaces, } from './page-index.js';
2
3
  /** The context key a UI client uses for its snapshot. */
3
4
  export const CLIENT_SNAPSHOT_KEY = 'oui';
4
5
  /**
5
- * Read and validate the snapshot from a turn's context. Returns null when the
6
- * turn carries none (a client with no UI), and throws when it carries one that
7
- * is malformed: a broken snapshot is a client bug that must not quietly turn
8
- * into "this client has no UI".
6
+ * Read and validate the client's page from a turn's context. Returns null when
7
+ * the turn carries none (a client with no UI), and throws when it carries one
8
+ * that is malformed: a broken snapshot is a client bug that must not quietly
9
+ * turn into "this client has no UI".
10
+ *
11
+ * A client sends its surfaces as `index` (oui-spec §7.3.8) or, before 0.7 or
12
+ * when made to, as `surfaces` with every definition. Both give the same page.
9
13
  */
10
- export function readClientSnapshot(context) {
14
+ export function readClientPage(context) {
11
15
  const raw = context?.[CLIENT_SNAPSHOT_KEY];
12
16
  if (raw === undefined || raw === null)
13
17
  return null;
14
18
  if (typeof raw !== 'object') {
15
19
  throw new Error(`[agent-sdk] context.${CLIENT_SNAPSHOT_KEY} must be an object`);
16
20
  }
17
- const { surfaces, observations, surfacesHash } = raw;
18
- if (!Array.isArray(surfaces)) {
19
- throw new Error(`[agent-sdk] context.${CLIENT_SNAPSHOT_KEY}.surfaces must be an array`);
21
+ const { surfaces, index, observations, surfacesHash, fit } = raw;
22
+ const held = new Map();
23
+ let page;
24
+ if (Array.isArray(index)) {
25
+ for (const [i, s] of index.entries()) {
26
+ if (!isSurfaceIndex(s)) {
27
+ throw new Error(`[agent-sdk] context.${CLIENT_SNAPSHOT_KEY}.index[${i}] is not an OUI surface index (id, name, description, index[])`);
28
+ }
29
+ }
30
+ page = pageFromIndex(index);
20
31
  }
21
- for (const [i, s] of surfaces.entries()) {
22
- if (!isSurface(s)) {
23
- throw new Error(`[agent-sdk] context.${CLIENT_SNAPSHOT_KEY}.surfaces[${i}] is not an OUI surface manifest (id, name, description, actions[])`);
32
+ else if (Array.isArray(surfaces)) {
33
+ for (const [i, s] of surfaces.entries()) {
34
+ if (!isFullSurface(s)) {
35
+ throw new Error(`[agent-sdk] context.${CLIENT_SNAPSHOT_KEY}.surfaces[${i}] is not an OUI surface manifest (id, name, description, actions[])`);
36
+ }
24
37
  }
38
+ page = pageFromSurfaces(surfaces, held);
39
+ }
40
+ else {
41
+ throw new Error(`[agent-sdk] context.${CLIENT_SNAPSHOT_KEY} must carry its surfaces as index[] or surfaces[]`);
25
42
  }
26
43
  return {
27
- surfaces: surfaces,
28
- observations: observations && typeof observations === 'object'
29
- ? observations
30
- : {},
31
- // The hash the worker sends back as `knownSurfaces` (oui-spec 0.6), when the client sent one.
44
+ page,
45
+ observations: observations && typeof observations === 'object' ? observations : {},
32
46
  ...(typeof surfacesHash === 'string' && surfacesHash ? { surfacesHash } : {}),
47
+ ...(fit && typeof fit === 'object' ? { fit: fit } : {}),
48
+ held,
33
49
  };
34
50
  }
35
51
  /** The turn's context without the snapshot. */
@@ -49,27 +65,6 @@ function omitKeys(context, keys) {
49
65
  return context;
50
66
  return Object.fromEntries(Object.entries(context).filter(([k]) => !keys.includes(k)));
51
67
  }
52
- /**
53
- * A stable fingerprint of what the client can do: its surface ids and each
54
- * surface's action ids. Two snapshots with the same fingerprint give the
55
- * model the same tools.
56
- */
57
- export function capabilityFingerprint(surfaces) {
58
- return surfaces
59
- .map((s) => `${s.id}(${s.actions.map((a) => a.id).join(',')})`)
60
- .join('|');
61
- }
62
- function isSurface(value) {
63
- if (!value || typeof value !== 'object')
64
- return false;
65
- const s = value;
66
- return (typeof s.id === 'string' &&
67
- typeof s.name === 'string' &&
68
- typeof s.description === 'string' &&
69
- Array.isArray(s.actions) &&
70
- s.actions.every((a) => !!a &&
71
- typeof a === 'object' &&
72
- typeof a.id === 'string' &&
73
- typeof a.description === 'string'));
74
- }
68
+ /** A stable fingerprint of what the page offers: two pages with the same one give the model the same index. */
69
+ export const capabilityFingerprint = pageFingerprint;
75
70
  //# sourceMappingURL=snapshot.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"snapshot.js","sourceRoot":"","sources":["../../src/ui/snapshot.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAEtD,yDAAyD;AACzD,MAAM,CAAC,MAAM,mBAAmB,GAAG,KAAK,CAAC;AAEzC;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAC,OAAmD;IACpF,MAAM,GAAG,GAAG,OAAO,EAAE,CAAC,mBAAmB,CAAC,CAAC;IAC3C,IAAI,GAAG,KAAK,SAAS,IAAI,GAAG,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IACnD,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;QAC5B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AC;QAAE,OAAO,OAAO,CAAC;IAChE,OAAO,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACxF,CAAC;AAED,+GAA+G;AAC/G,MAAM,CAAC,MAAM,qBAAqB,GAAG,eAAe,CAAC"}
@@ -20,12 +20,12 @@
20
20
  * One sequence per turn, shared by every set of UI tools built during it (the
21
21
  * tools are rebuilt when the page changes). Host tools are not queued.
22
22
  *
23
- * The sequence also holds the page's surfaces, by their hash (oui-spec 0.6):
24
- * a request says which surfaces the worker holds (`knownSurfaces`), and the
25
- * tab's answer then carries surfaces only when they changed. An answer
26
- * without them is resolved here, from the hash it reports.
23
+ * The sequence also holds what the page offers, by the client's hash of it
24
+ * (oui-spec §7.3.4): a request says which the worker holds (`knownSurfaces`),
25
+ * and the tab's answer then carries it only when it changed. An answer without
26
+ * it is resolved here, from the hash it reports.
27
27
  */
28
- import type { OUISurface } from 'oui-spec/spec';
28
+ import type { PageSurface } from './page-index.js';
29
29
  /** One place in a turn's UI order, taken when the call arrived. */
30
30
  export interface UISlot {
31
31
  /**
@@ -48,7 +48,7 @@ export interface UISequence {
48
48
  /** Take the next place and run a UI action in it: `reserve().run(step)`. */
49
49
  run<T>(step: () => Promise<T>): Promise<T>;
50
50
  /** The surfaces on screen after the last answered action, or null before any has answered. */
51
- latestSurfaces(): readonly OUISurface[] | null;
51
+ latestSurfaces(): readonly PageSurface[] | null;
52
52
  /**
53
53
  * The hash of the surfaces the worker holds for the page — the snapshot's,
54
54
  * or the last answer's — sent as a request's `knownSurfaces`; null when the
@@ -61,15 +61,15 @@ export interface UISequence {
61
61
  * neither, or a hash the worker never held).
62
62
  */
63
63
  resolve(answer: {
64
- surfaces?: OUISurface[];
64
+ page?: PageSurface[];
65
65
  surfacesHash?: string;
66
- }): OUISurface[] | undefined;
66
+ }): PageSurface[] | undefined;
67
67
  /**
68
68
  * Record the surfaces an answer (or the turn's snapshot) reported, with
69
69
  * their hash. An answer whose surfaces cannot be resolved makes the page's
70
70
  * surfaces unknown: the next request names none, and the tab sends them.
71
71
  */
72
- record(surfaces: readonly OUISurface[] | undefined, hash?: string): void;
72
+ record(surfaces: readonly PageSurface[] | undefined, hash?: string): void;
73
73
  }
74
74
  export declare function createUISequence(): UISequence;
75
75
  //# sourceMappingURL=ui-sequence.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ui-sequence.d.ts","sourceRoot":"","sources":["../../src/ui/ui-sequence.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhD,mEAAmE;AACnE,MAAM,WAAW,MAAM;IACrB;;;;OAIG;IACH,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IAC3C;;;;;OAKG;IACH,OAAO,IAAI,IAAI,CAAC;CACjB;AAED,MAAM,WAAW,UAAU;IACzB,gGAAgG;IAChG,OAAO,IAAI,MAAM,CAAC;IAClB,4EAA4E;IAC5E,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IAC3C,8FAA8F;IAC9F,cAAc,IAAI,SAAS,UAAU,EAAE,GAAG,IAAI,CAAC;IAC/C;;;;OAIG;IACH,SAAS,IAAI,MAAM,GAAG,IAAI,CAAC;IAC3B;;;;OAIG;IACH,OAAO,CAAC,MAAM,EAAE;QAAE,QAAQ,CAAC,EAAE,UAAU,EAAE,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,UAAU,EAAE,GAAG,SAAS,CAAC;IAC9F;;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-46,8 +46,8 @@ export function createUISequence() {
46
46
  latestSurfaces: () => latest,
47
47
  knownHash: () => latestHash,
48
48
  resolve(answer) {
49
- if (answer.surfaces)
50
- return answer.surfaces;
49
+ if (answer.page)
50
+ return answer.page;
51
51
  return answer.surfacesHash ? held.get(answer.surfacesHash) : undefined;
52
52
  },
53
53
  record(surfaces, hash) {
@@ -1 +1 @@
1
- {"version":3,"file":"ui-sequence.js","sourceRoot":"","sources":["../../src/ui/ui-sequence.ts"],"names":[],"mappings":"AAyEA,8FAA8F;AAC9F,MAAM,iBAAiB,GAAG,CAAC,CAAC;AAE5B,MAAM,UAAU,gBAAgB;IAC9B,IAAI,IAAI,GAAkB,OAAO,CAAC,OAAO,EAAE,CAAC;IAC5C,IAAI,MAAM,GAAiC,IAAI,CAAC;IAChD,IAAI,UAAU,GAAkB,IAAI,CAAC;IACrC,iEAAiE;IACjE,MAAM,IAAI,GAAG,IAAI,GAAG,EAAwB,CAAC;IAC7C,MAAM,IAAI,GAAG,CAAC,IAAY,EAAE,QAAsB,EAAE,EAAE;QACpD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAClB,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QACzB,OAAO,IAAI,CAAC,IAAI,GAAG,iBAAiB;YAAE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC,KAAe,CAAC,CAAC;IACxF,CAAC,CAAC;IAEF,SAAS,OAAO;QACd,MAAM,MAAM,GAAG,IAAI,CAAC;QACpB,IAAI,MAAmB,CAAC;QACxB,MAAM,QAAQ,GAAG,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE;YAC7C,MAAM,GAAG,OAAO,CAAC;QACnB,CAAC,CAAC,CAAC;QACH,uEAAuE;QACvE,kDAAkD;QAClD,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,CAAC;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,CAAC;YACtC,CAAC;iBAAM,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;gBAChD,qEAAqE;gBACrE,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAE,CAAC;gBACzB,UAAU,GAAG,IAAI,CAAC;gBAClB,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAE,CAAC,CAAC;YAC9B,CAAC;iBAAM,CAAC;gBACN,uEAAuE;gBACvE,UAAU,GAAG,IAAI,CAAC;YACpB,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -1,22 +1,52 @@
1
- /**
2
- * UI tools: one tool per action of every surface the client has mounted.
3
- *
4
- * Calling one sends an OUI action request to the client that sent the turn
5
- * and waits for its answer (ADR-0209 D2). The model gets what really happened
6
- * — the action's result or error — and what the page offers afterwards.
7
- */
8
- import type { OUIActionResult, OUISurface } from 'oui-spec/spec';
1
+ import { type OUIActionResult, type OUIFit } from 'oui-spec/spec';
9
2
  import type { RegisteredTool } from '../tools/types.js';
10
3
  import type { UIActionChannel } from './channel.js';
4
+ import { type HeldDefinitions, type PageSurface } from './page-index.js';
11
5
  import { type UISequence } from './ui-sequence.js';
6
+ /** The tool that runs one action of the page. Built by the orchestrator, which unwraps it to the action's own tool. */
7
+ export declare const UI_ACT_TOOL: "ui_act";
8
+ /** The tool that says what actions take. */
9
+ export declare const UI_DESCRIBE_TOOL: "ui_describe";
10
+ /** The tool that reads part of the page's state. */
11
+ export declare const UI_READ_TOOL: "ui_read";
12
+ /**
13
+ * Whether the worker can see the page (ADR-0245 §2.5). It cannot after an
14
+ * answer that came without the page's state, or no answer at all; a read that
15
+ * succeeds restores it. While it cannot, nothing that changes the page runs:
16
+ * a change is refused, and after two refused in a row the turn's UI work is
17
+ * over, so the model says what it could not confirm instead of trying again.
18
+ */
19
+ export interface PageSight {
20
+ /** Why the page cannot be seen, or null when it can. */
21
+ blind(): string | null;
22
+ lost(why: string): void;
23
+ seen(): void;
24
+ /**
25
+ * Called for a call that would change the page: null when it may run, or
26
+ * why it may not. Each refusal is counted; the second in a row stops the
27
+ * turn's UI work for good.
28
+ */
29
+ refuseChange(): {
30
+ error: string;
31
+ stopped: boolean;
32
+ } | null;
33
+ /** How many changes were refused this turn. */
34
+ refusals(): number;
35
+ /** Whether the turn's UI work was stopped. */
36
+ stopped(): boolean;
37
+ }
38
+ /** After this many changes refused in a row, the turn changes nothing more in the page. */
39
+ export declare const BLIND_REFUSALS_BEFORE_STOP = 2;
40
+ export declare function createPageSight(): PageSight;
41
+ type UILog = (level: 'info' | 'warn', message: string, data: Record<string, unknown>) => void;
12
42
  export interface UIToolDependencies {
13
43
  channel: UIActionChannel;
14
44
  /** How long to wait for the client's answer. */
15
45
  resultTimeoutMs: number;
16
- /** The surfaces the model's current tools were built from. */
17
- currentSurfaces(): readonly OUISurface[];
18
- /** Called with every answer, before the model sees it. */
19
- onResult(result: OUIActionResult): void;
46
+ /** What the page offers now, as the turn knows it. */
47
+ currentPage(): readonly PageSurface[];
48
+ /** Called with every answer, and the page it stands for when that is known, before the model sees it. */
49
+ onResult(result: OUIActionResult, page: readonly PageSurface[] | undefined): void;
20
50
  /** Largest observation payload returned to the model, in characters. */
21
51
  maxObservationChars?: number;
22
52
  /**
@@ -31,6 +61,12 @@ export interface UIToolDependencies {
31
61
  * one is made for these tools when none is given.
32
62
  */
33
63
  sequence?: UISequence;
64
+ /** The definitions the turn already holds, added to as they are fetched. */
65
+ held?: HeldDefinitions;
66
+ /** Whether the page can be seen, shared by the turn. */
67
+ sight?: PageSight;
68
+ /** Where each answer's size is reported. */
69
+ log?: UILog;
34
70
  }
35
71
  export interface UIToolCollision {
36
72
  actionId: string;
@@ -51,9 +87,23 @@ export declare const MAX_RESEND_AFTER_MS = 8000;
51
87
  export declare const RECEIVED_RESEND_AFTER_MS = 10000;
52
88
  /** How long to wait for an async action's outcome when it declares no limit of its own. */
53
89
  export declare const DEFAULT_JOB_WAIT_MS: number;
54
- /** Build the UI tools for a set of surfaces. The first surface to declare an action id keeps it. */
55
- export declare function buildUITools(surfaces: readonly OUISurface[], deps: UIToolDependencies): {
90
+ /** The most actions one `ui_describe` call describes. */
91
+ export declare const MAX_DESCRIBED_ACTIONS = 8;
92
+ /**
93
+ * Build the UI tools for a page: one per action, which `ui_act` runs, and the
94
+ * two the model calls itself to learn what actions take and to read the page.
95
+ * The first surface to offer an action id keeps it.
96
+ */
97
+ export declare function buildUITools(page: readonly PageSurface[], deps: UIToolDependencies): {
56
98
  tools: RegisteredTool[];
57
99
  collisions: UIToolCollision[];
100
+ describe: RegisteredTool;
101
+ read: RegisteredTool;
58
102
  };
103
+ /** Thrown when an action's definition cannot be had: the model is told why. */
104
+ export declare class DefinitionUnavailable extends Error {
105
+ }
106
+ /** What of the page's state the client left out to fit its answer, and how to read each part (oui-spec §7.3.9). */
107
+ export declare function fitNotes(cuts: NonNullable<OUIFit['observations']>): string[];
108
+ export {};
59
109
  //# sourceMappingURL=ui-tools.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ui-tools.d.ts","sourceRoot":"","sources":["../../src/ui/ui-tools.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAA+B,eAAe,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC9F,OAAO,KAAK,EAAE,cAAc,EAA6C,MAAM,mBAAmB,CAAC;AACnG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAEpD,OAAO,EAAoB,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAErE,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,eAAe,CAAC;IACzB,gDAAgD;IAChD,eAAe,EAAE,MAAM,CAAC;IACxB,8DAA8D;IAC9D,eAAe,IAAI,SAAS,UAAU,EAAE,CAAC;IACzC,0DAA0D;IAC1D,QAAQ,CAAC,MAAM,EAAE,eAAe,GAAG,I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