@ouispec/agent-worker 0.1.1 → 0.2.2

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 (68) 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 +406 -129
  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/input-validation.d.ts +6 -0
  28. package/dist/tools/input-validation.d.ts.map +1 -1
  29. package/dist/tools/input-validation.js +50 -1
  30. package/dist/tools/input-validation.js.map +1 -1
  31. package/dist/tools/types.d.ts +17 -0
  32. package/dist/tools/types.d.ts.map +1 -1
  33. package/dist/tools/types.js.map +1 -1
  34. package/dist/turn-ledger.d.ts +30 -0
  35. package/dist/turn-ledger.d.ts.map +1 -0
  36. package/dist/turn-ledger.js +45 -0
  37. package/dist/turn-ledger.js.map +1 -0
  38. package/dist/types.d.ts +9 -2
  39. package/dist/types.d.ts.map +1 -1
  40. package/dist/ui/answer-image.d.ts +32 -0
  41. package/dist/ui/answer-image.d.ts.map +1 -0
  42. package/dist/ui/answer-image.js +50 -0
  43. package/dist/ui/answer-image.js.map +1 -0
  44. package/dist/ui/observations.d.ts +29 -5
  45. package/dist/ui/observations.d.ts.map +1 -1
  46. package/dist/ui/observations.js +122 -46
  47. package/dist/ui/observations.js.map +1 -1
  48. package/dist/ui/outline.d.ts +63 -0
  49. package/dist/ui/outline.d.ts.map +1 -0
  50. package/dist/ui/outline.js +258 -0
  51. package/dist/ui/outline.js.map +1 -0
  52. package/dist/ui/page-index.d.ts +74 -0
  53. package/dist/ui/page-index.d.ts.map +1 -0
  54. package/dist/ui/page-index.js +137 -0
  55. package/dist/ui/page-index.js.map +1 -0
  56. package/dist/ui/snapshot.d.ts +24 -12
  57. package/dist/ui/snapshot.d.ts.map +1 -1
  58. package/dist/ui/snapshot.js +34 -39
  59. package/dist/ui/snapshot.js.map +1 -1
  60. package/dist/ui/ui-sequence.d.ts +9 -9
  61. package/dist/ui/ui-sequence.d.ts.map +1 -1
  62. package/dist/ui/ui-sequence.js +2 -2
  63. package/dist/ui/ui-sequence.js.map +1 -1
  64. package/dist/ui/ui-tools.d.ts +64 -14
  65. package/dist/ui/ui-tools.d.ts.map +1 -1
  66. package/dist/ui/ui-tools.js +473 -92
  67. package/dist/ui/ui-tools.js.map +1 -1
  68. package/package.json +6 -6
@@ -48,15 +48,31 @@ function withoutKeptWhole(observations) {
48
48
  Object.fromEntries(Object.entries(values ?? {}).filter(([id]) => id !== PROBLEMS_OBSERVATION_ID && !isJobStatus(id))),
49
49
  ]));
50
50
  }
51
- /** Rows past this in any list are summed up as "… and N more" at the first step of fitting an over-budget page state. */
51
+ /**
52
+ * The largest page state the model is given when the host sets none
53
+ * (`ui.maxObservationChars`): the user's message's, and each UI action's
54
+ * answer's. About 3,000 tokens: room for a document of a hundred rows as index
55
+ * rows with the few being worked on whole (ADR-0244 §2.1). It was 6,000, which
56
+ * a board of six artboards filled.
57
+ */
58
+ export const DEFAULT_PAGE_STATE_CHARS = 12_000;
59
+ /** Rows past this in any list are given as index rows at the first step of fitting an over-budget page state. */
52
60
  export const MAX_LIST_ROWS = 20;
53
61
  /**
54
62
  * A list this short is never shortened: it is a field's choices (the engines a
55
63
  * voice can speak with, a document's types), not a collection to browse.
56
64
  */
57
65
  export const WHOLE_LIST_ROWS = 5;
58
- /** How far long lists are shortened, step by step; 0 gives only how many rows there are. */
59
- const LIST_STEPS = [MAX_LIST_ROWS, 10, WHOLE_LIST_ROWS, 0];
66
+ const LIST_STEPS = [
67
+ { whole: MAX_LIST_ROWS, index: Infinity },
68
+ { whole: 10, index: Infinity },
69
+ { whole: WHOLE_LIST_ROWS, index: Infinity },
70
+ { whole: 0, index: Infinity },
71
+ { whole: 0, index: 100 },
72
+ { whole: 0, index: 40 },
73
+ { whole: 0, index: 12 },
74
+ { whole: 0, index: 0 },
75
+ ];
60
76
  /**
61
77
  * What a page state reports that is never shortened: its fields, what is
62
78
  * unavailable or busy, and a row's own schema (its options or range).
@@ -80,27 +96,64 @@ function surfaceRank(surfaceId, acting) {
80
96
  return 4;
81
97
  return 3;
82
98
  }
99
+ /** The observation schemas of a turn's surfaces, for fitting their page state. */
100
+ export function observationSchemas(surfaces) {
101
+ return Object.fromEntries(surfaces.map((s) => [s.id, Object.fromEntries((s.observations ?? []).map((o) => [o.id, o.schema]))]));
102
+ }
103
+ /** A page list's row (oui-bindings `PageStateRow`): addressed by its key, called by its title, chosen when its value is true. */
104
+ const PAGE_ROW = {
105
+ index: (row) => ({ key: row.key, title: row.title }),
106
+ chosen: (row) => row !== null && typeof row === 'object' && row.value === true,
107
+ rest: 'name a row by its title',
108
+ };
109
+ const isPageRow = (row) => row !== null &&
110
+ typeof row === 'object' &&
111
+ typeof row.key === 'string' &&
112
+ typeof row.title === 'string';
113
+ /** A declared list's rows: addressed and called by the properties it names, chosen when selected or just changed. */
114
+ function declaredShape(declaration, chosenRefs) {
115
+ const kept = [declaration.ref, declaration.title, ...(declaration.index ?? [])];
116
+ return {
117
+ index: (row) => Object.fromEntries(kept.filter((key) => row[key] !== undefined).map((key) => [key, row[key]])),
118
+ chosen: (row) => row !== null && typeof row === 'object' && chosenRefs.has(String(row[declaration.ref])),
119
+ rest: 'read them with this surface’s query tool, or one with its inspect tool',
120
+ };
121
+ }
83
122
  /** A row the person has chosen (a selected card, the variant in use): kept however short its list gets. */
84
- const isChosen = (row) => row !== null && typeof row === 'object' && row.value === true;
85
- /** A list shortened to `limit` rows plus the chosen ones and how many more; only a count at 0. */
86
- function shortenRows(rows, limit) {
87
- if (rows.length <= Math.max(limit, WHOLE_LIST_ROWS))
123
+ const isChosenValue = PAGE_ROW.chosen;
124
+ /**
125
+ * A list fitted to a step: the first `whole` rows and the chosen ones whole,
126
+ * up to `index` of the rest as index rows, and how many are left out with how
127
+ * to read them. A list whose rows cannot be indexed keeps only how many more
128
+ * there are.
129
+ */
130
+ function shortenRows(rows, step, shape) {
131
+ if (rows.length <= Math.max(step.whole, WHOLE_LIST_ROWS))
88
132
  return rows;
89
- if (limit === 0) {
90
- const chosen = rows.filter(isChosen);
91
- const count = `${rows.length - chosen.length}${chosen.length ? ' more' : ''} rows`;
92
- return [...chosen, `${count}, not listed to fit the page state; name a row by its title`];
133
+ const chosen = shape?.chosen ?? isChosenValue;
134
+ const whole = [];
135
+ const rest = [];
136
+ rows.forEach((row, i) => (i < step.whole || chosen(row) ? whole : rest).push(row));
137
+ if (!shape) {
138
+ if (step.whole === 0) {
139
+ const count = `${rest.length}${whole.length ? ' more' : ''} rows`;
140
+ return [...whole, `${count}, not listed to fit the page state; name a row by its title`];
141
+ }
142
+ return [...whole, `… and ${rest.length} more`];
93
143
  }
94
- const kept = rows.slice(0, limit);
95
- const chosen = rows.slice(limit).filter(isChosen);
96
- return [...kept, ...chosen, `… and ${rows.length - kept.length - chosen.length} more`];
144
+ const indexed = rest.slice(0, step.index).map((row) => shape.index(row));
145
+ const left = rest.length - indexed.length;
146
+ if (left === 0)
147
+ return [...whole, ...indexed];
148
+ const count = whole.length + indexed.length > 0 ? `… and ${left} more rows` : `${left} rows`;
149
+ return [...whole, ...indexed, `${count}, not listed to fit the page state; ${shape.rest}`];
97
150
  }
98
151
  /**
99
152
  * What the page shows (`shown`): facts that describe one row of a list (one per
100
153
  * card) are shortened like the list; the page's own facts, such as those of the
101
154
  * item open in a detail panel, are kept whole.
102
155
  */
103
- function shortenShown(shown, limit) {
156
+ function shortenShown(shown, step) {
104
157
  const perList = new Map();
105
158
  const own = [];
106
159
  for (const entry of shown) {
@@ -112,24 +165,37 @@ function shortenShown(shown, limit) {
112
165
  perList.set(id, [...(perList.get(id) ?? []), entry]);
113
166
  }
114
167
  }
115
- return [...own, ...[...perList.values()].flatMap((rows) => shortenRows(rows, limit))];
168
+ return [...own, ...[...perList.values()].flatMap((rows) => shortenRows(rows, { whole: step.whole, index: 0 }, null))];
169
+ }
170
+ /** How a list's rows are indexed: as its schema declares, as a page list's rows are, or not at all. */
171
+ function shapeOf(rows, schema, selected, ctx) {
172
+ const declaration = schema?.['x-rows'];
173
+ if (declaration)
174
+ return declaredShape(declaration, new Set([...selected, ...ctx.changed]));
175
+ return rows.length > 0 && rows.every(isPageRow) ? PAGE_ROW : null;
116
176
  }
117
177
  /**
118
- * The value with every long list shortened to `limit` (see shortenRows); fields,
178
+ * The value with every long list fitted to the step (see shortenRows); fields,
119
179
  * what is unavailable or busy, and the page's own facts are left whole.
120
180
  */
121
- function compactValue(value, limit) {
181
+ function compactValue(value, schema, ctx, selected = []) {
122
182
  if (Array.isArray(value)) {
123
- const rows = value.map((v) => compactValue(v, limit));
124
- return shortenRows(rows, limit);
183
+ const shape = shapeOf(value, schema, selected, ctx);
184
+ // A row kept whole has its own lists fitted; a row cut to its index does not need them.
185
+ const given = new Set(value);
186
+ return shortenRows(value, ctx.step, shape).map((row) => (given.has(row) ? compactValue(row, schema?.items, ctx) : row));
125
187
  }
126
188
  if (value !== null && typeof value === 'object') {
127
- return Object.fromEntries(Object.entries(value).map(([key, v]) => {
189
+ const object = value;
190
+ return Object.fromEntries(Object.entries(object).map(([key, v]) => {
128
191
  if (FIELD_KEYS.has(key))
129
192
  return [key, v];
130
193
  if (key === 'shown' && Array.isArray(v))
131
- return [key, shortenShown(v, limit)];
132
- return [key, compactValue(v, limit)];
194
+ return [key, shortenShown(v, ctx.step)];
195
+ const child = schema?.properties?.[key];
196
+ const selection = child?.['x-rows']?.selection;
197
+ const chosen = selection && Array.isArray(object[selection]) ? object[selection].map(String) : [];
198
+ return [key, compactValue(v, child, ctx, chosen)];
133
199
  }));
134
200
  }
135
201
  return value;
@@ -137,28 +203,35 @@ function compactValue(value, limit) {
137
203
  const size = (value) => JSON.stringify(value).length;
138
204
  /**
139
205
  * The page state over budget, fitted step by step, cutting the least important
140
- * first. The surfaces are ordered by rank. Then long lists are shortened (20
141
- * rows, 10, 5, then only a count), on every other surface a step before the
142
- * surface the action acted on. Lists of five rows or fewer, every field, what is
143
- * unavailable or busy, the page's own facts and chosen rows are never shortened,
144
- * so the item open in a detail panel stays whole beside a long list. Then whole
145
- * surfaces are left out, the shells first, never the acting one. Only if that
146
- * still does not fit is the rest cut.
206
+ * first. The surfaces are ordered by rank. Then long lists are shortened: 20
207
+ * rows kept whole, then 10, 5, then none, the rest cut to index rows (what
208
+ * each is addressed and called by); then the index itself, to 100 rows, 40, 12
209
+ * and none, saying how the rest are read. Every other surface is a step ahead of
210
+ * the surface the action acted on. Lists of five rows or fewer, every field,
211
+ * what is unavailable or busy, the page's own facts and chosen rows are never
212
+ * shortened, so the item open in a detail panel and the layer just changed
213
+ * stay whole beside a long list. Then whole surfaces are left out, the shells
214
+ * first, never the acting one. Only if that still does not fit is the rest cut.
147
215
  */
148
- function fitted(observations, maxChars, acting) {
216
+ function fitted(observations, maxChars, acting, options) {
149
217
  const base = Object.fromEntries(Object.entries(withoutKeptWhole(observations)).sort(([a], [b]) => surfaceRank(a, acting) - surfaceRank(b, acting)));
150
218
  const actingPresent = acting !== undefined && acting in base;
151
- // Each step is (others' limit, the acting surface's limit): the acting one lags a step behind.
219
+ const changed = new Set(options.changed ?? []);
220
+ // Each step is (others' step, the acting surface's step): the acting one lags a step behind.
152
221
  const steps = [];
153
- LIST_STEPS.forEach((limit, i) => {
222
+ LIST_STEPS.forEach((step, i) => {
154
223
  if (actingPresent && i > 0)
155
- steps.push([limit, LIST_STEPS[i - 1]]);
156
- steps.push([limit, limit]);
224
+ steps.push([step, LIST_STEPS[i - 1]]);
225
+ steps.push([step, step]);
157
226
  });
227
+ const fit = (surfaceId, value, step) => Object.fromEntries(Object.entries((value ?? {})).map(([observationId, v]) => [
228
+ observationId,
229
+ compactValue(v, options.schemas?.[surfaceId]?.[observationId], { step, changed }),
230
+ ]));
158
231
  let values = base;
159
232
  let listStep;
160
233
  for (const [others, own] of steps) {
161
- values = Object.fromEntries(Object.entries(base).map(([id, v]) => [id, compactValue(v, id === acting ? own : others)]));
234
+ values = Object.fromEntries(Object.entries(base).map(([id, v]) => [id, fit(id, v, id === acting ? own : others)]));
162
235
  listStep = others;
163
236
  if (size(values) <= maxChars)
164
237
  return { values, listStep, omitted: [], fits: true };
@@ -179,11 +252,14 @@ function fitted(observations, maxChars, acting) {
179
252
  }
180
253
  /** What fitting did, in words. */
181
254
  function fitSummary(fit, maxChars, whole, acted) {
182
- const lists = fit.listStep === undefined
255
+ const step = fit.listStep;
256
+ const lists = step === undefined
183
257
  ? ''
184
- : fit.listStep === 0
185
- ? `lists longer than ${WHOLE_LIST_ROWS} rows are given as a count`
186
- : `long lists are shortened, to as few as ${Math.max(fit.listStep, WHOLE_LIST_ROWS)} rows, with how many more`;
258
+ : step.whole > 0
259
+ ? `long lists keep their first ${Math.max(step.whole, WHOLE_LIST_ROWS)} rows whole and the rest as index rows (what each is addressed and called by)`
260
+ : step.index > 0
261
+ ? `rows of lists longer than ${WHOLE_LIST_ROWS} are given as index rows (what each is addressed and called by)${Number.isFinite(step.index) ? `, the first ${step.index} of them` : ''}`
262
+ : `lists longer than ${WHOLE_LIST_ROWS} rows are given as a count, with how to read them`;
187
263
  const parts = [
188
264
  lists,
189
265
  'fields, the page’s own facts and chosen rows are kept whole',
@@ -198,16 +274,16 @@ function fitSummary(fit, maxChars, whole, acted) {
198
274
  /**
199
275
  * The observations as the model receives them: whole when they fit. Over
200
276
  * budget, every surface's problems and job statuses are kept whole; the rest is
201
- * fitted (see fitted): long lists shortened first, the page it acted on first
202
- * and kept whole, and only if that still does not fit is the rest cut, saying so.
277
+ * fitted (see fitted): long lists cut to index rows first, the page it acted on
278
+ * first and kept whole, and only if that still does not fit is the rest cut, saying so.
203
279
  */
204
- export function boundObservations(observations, maxChars, actingSurfaceId) {
280
+ export function boundObservations(observations, maxChars, actingSurfaceId, options = {}) {
205
281
  const json = JSON.stringify(observations);
206
282
  if (json.length <= maxChars)
207
283
  return observations;
208
284
  const problems = surfaceProblems(observations);
209
285
  const jobs = jobStatuses(observations);
210
- const fit = fitted(observations, maxChars, actingSurfaceId);
286
+ const fit = fitted(observations, maxChars, actingSurfaceId, options);
211
287
  const whole = [problems ? 'every surface’s problems' : '', jobs ? 'every job’s status' : ''].filter(Boolean);
212
288
  return {
213
289
  truncated: true,
@@ -218,13 +294,13 @@ export function boundObservations(observations, maxChars, actingSurfaceId) {
218
294
  };
219
295
  }
220
296
  /** The same, as the text of a `<page_state>` block. */
221
- export function observationsText(observations, maxChars) {
297
+ export function observationsText(observations, maxChars, options = {}) {
222
298
  const json = JSON.stringify(observations);
223
299
  if (json.length <= maxChars)
224
300
  return json;
225
301
  const problems = surfaceProblems(observations);
226
302
  const jobs = jobStatuses(observations);
227
- const fit = fitted(observations, maxChars, undefined);
303
+ const fit = fitted(observations, maxChars, undefined, options);
228
304
  const rest = JSON.stringify(fit.values);
229
305
  const head = (problems ? `Problems (in full): ${JSON.stringify(problems)}\n` : '') +
230
306
  (jobs ? `Jobs (in full): ${JSON.stringify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,CAAC,CAAC,CAAC,uBAAuB,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;QACrE,CAAC,IAAI,CAAC,CAAC,CAAC,mBAAmB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IAC5D,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI;QACnB,CAAC,CAAC,iBAAiB,IAAI,CAAC,MAAM,gBAAgB,UAAU,CAAC,GAAG,EAAE,QAAQ,EAAE,EAAE,EAAE,KAAK,CAAC,GAAG;QACrF,CAAC,CAAC,qBAAqB,IAAI,CAAC,MAAM,cAAc,CAAC;IACnD,OAAO,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,QAAQ,CAAC,GAAG,IAAI,EAAE,CAAC;AAC7E,CAAC"}
@@ -0,0 +1,63 @@
1
+ /**
2
+ * A definition the model can read (ADR-0245 §2.3).
3
+ *
4
+ * An action's input schema can be a whole catalogue: an effect action's union
5
+ * of sixty effects is 94 KB. Handed over whole it would fill the model's
6
+ * context for one call, so a schema past a size is given in outline: each
7
+ * property on a line with its type, range and unit, a nested object closed
8
+ * with its property count, a union listed by what tells its members apart. The
9
+ * model then opens the part it needs by path.
10
+ *
11
+ * Computed from the schema alone, by rule: the same schema always outlines the
12
+ * same way, and no catalogue is reshaped to fit.
13
+ */
14
+ /** A schema's JSON up to this many characters is returned whole. */
15
+ export declare const WHOLE_SCHEMA_CHARS = 4000;
16
+ /**
17
+ * A part asked for by its path is returned whole up to this many characters.
18
+ * The model named the part because an outline abbreviated it: answering with
19
+ * another abbreviation leaves it nothing to open. A command list of 48 came
20
+ * back as its first 12 twice, and the command the task needed was never seen.
21
+ */
22
+ export declare const WHOLE_PART_CHARS = 12000;
23
+ type Schema = Record<string, unknown>;
24
+ /** The property every member of a union fixes to its own constant: what tells them apart. */
25
+ export declare function discriminatorOf(members: readonly Schema[]): string | null;
26
+ /**
27
+ * The schema `path` names inside `schema`, or why nothing is there.
28
+ *
29
+ * A path is steps joined by ".": a property name; `name=value` for the member
30
+ * of a union whose discriminator is that value; `#n` for a union's nth member
31
+ * (from 1) when nothing tells them apart; `[]` for a list's items.
32
+ */
33
+ export declare function schemaAt(schema: Schema, path: string): {
34
+ schema: Schema;
35
+ } | {
36
+ error: string;
37
+ };
38
+ export interface SchemaView {
39
+ /** The schema's JSON when it is small enough, else its outline. */
40
+ text: string;
41
+ /** Whether `text` is the whole schema. */
42
+ whole: boolean;
43
+ }
44
+ /**
45
+ * What an action takes, or the part of it `path` names.
46
+ *
47
+ * Whole when its JSON is small enough: `maxChars` for an action's whole input,
48
+ * and the larger `WHOLE_PART_CHARS` for a part asked for by its path, which
49
+ * the model named because an outline had cut it short. Otherwise in outline:
50
+ * what it is, then its rows — properties, a union's members, an enumeration's
51
+ * values — as many as the size holds from row `from`, saying how many there
52
+ * are and where the next begin. No row is dropped without the answer saying
53
+ * how to read it.
54
+ */
55
+ export declare function describeSchema(schema: Record<string, unknown> | undefined, options?: {
56
+ path?: string;
57
+ maxChars?: number;
58
+ from?: number;
59
+ }): SchemaView | {
60
+ error: string;
61
+ };
62
+ export {};
63
+ //# sourceMappingURL=outline.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"outline.d.ts","sourceRoot":"","sources":["../../src/ui/outline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,oEAAoE;AACpE,eAAO,MAAM,kBAAkB,OAAQ,CAAC;AACxC;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,QAAS,CAAC;AAQvC,KAAK,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAmBtC,6FAA6F;AAC7F,wBAAgB,eAAe,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,GAAG,IAAI,CAMzE;AAiED;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CA0C7F;AA8DD,MAAM,WAAW,UAAU;IACzB,mEAAmE;IACnE,IAAI,EAAE,MAAM,CAAC;IACb,0CAA0C;IAC1C,KAAK,EAAE,OAAO,CAAC;CAChB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EAC3C,OAAO,GAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAO,GAChE,UAAU,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAoBhC"}
@@ -0,0 +1,258 @@
1
+ /**
2
+ * A definition the model can read (ADR-0245 §2.3).
3
+ *
4
+ * An action's input schema can be a whole catalogue: an effect action's union
5
+ * of sixty effects is 94 KB. Handed over whole it would fill the model's
6
+ * context for one call, so a schema past a size is given in outline: each
7
+ * property on a line with its type, range and unit, a nested object closed
8
+ * with its property count, a union listed by what tells its members apart. The
9
+ * model then opens the part it needs by path.
10
+ *
11
+ * Computed from the schema alone, by rule: the same schema always outlines the
12
+ * same way, and no catalogue is reshaped to fit.
13
+ */
14
+ /** A schema's JSON up to this many characters is returned whole. */
15
+ export const WHOLE_SCHEMA_CHARS = 4_000;
16
+ /**
17
+ * A part asked for by its path is returned whole up to this many characters.
18
+ * The model named the part because an outline abbreviated it: answering with
19
+ * another abbreviation leaves it nothing to open. A command list of 48 came
20
+ * back as its first 12 twice, and the command the task needed was never seen.
21
+ */
22
+ export const WHOLE_PART_CHARS = 12_000;
23
+ /** The most rows one answer lists of an object's properties, a union's members or an enumeration's values. */
24
+ const OUTLINE_ROWS = 80;
25
+ /** An enumeration's line names this many values; a longer one is opened by its path. */
26
+ const ENUM_LINE_VALUES = 12;
27
+ /** The longest description kept on an outline line. */
28
+ const LINE_DESCRIPTION_CHARS = 110;
29
+ const isSchema = (value) => !!value && typeof value === 'object' && !Array.isArray(value);
30
+ const propertiesOf = (schema) => isSchema(schema.properties) ? schema.properties : {};
31
+ const unionOf = (schema) => {
32
+ const members = (schema.oneOf ?? schema.anyOf);
33
+ return Array.isArray(members) && members.length > 0 && members.every(isSchema) ? members : null;
34
+ };
35
+ /** The one value a schema allows, when it allows one. */
36
+ function constantOf(schema) {
37
+ if (!schema)
38
+ return undefined;
39
+ const c = schema.const;
40
+ if (typeof c === 'string' || typeof c === 'number' || typeof c === 'boolean')
41
+ return c;
42
+ const e = schema.enum;
43
+ return Array.isArray(e) && e.length === 1 ? e[0] : undefined;
44
+ }
45
+ /** The property every member of a union fixes to its own constant: what tells them apart. */
46
+ export function discriminatorOf(members) {
47
+ for (const name of Object.keys(propertiesOf(members[0] ?? {}))) {
48
+ const constants = members.map((m) => constantOf(propertiesOf(m)[name]));
49
+ if (constants.every((c) => c !== undefined) && new Set(constants).size === members.length)
50
+ return name;
51
+ }
52
+ return null;
53
+ }
54
+ function clip(text, max) {
55
+ const line = text.replace(/\s+/g, ' ').trim();
56
+ return line.length <= max ? line : `${line.slice(0, max - 1).trimEnd()}…`;
57
+ }
58
+ /** What a product's contract says of a value beside its type: its unit, its space, what it refers to. */
59
+ function annotations(schema) {
60
+ const notes = Object.keys(schema)
61
+ .filter((k) => k.startsWith('x-') && ['string', 'number', 'boolean'].includes(typeof schema[k]))
62
+ .sort()
63
+ .map((k) => `${k.slice(2)}: ${String(schema[k])}`);
64
+ return notes.length ? ` [${notes.join(', ')}]` : '';
65
+ }
66
+ /** A value's type in a few words. */
67
+ function typeLine(schema) {
68
+ const constant = constantOf(schema);
69
+ if (constant !== undefined && !Array.isArray(schema.enum))
70
+ return JSON.stringify(constant);
71
+ if (Array.isArray(schema.enum)) {
72
+ const values = schema.enum;
73
+ const shown = values.slice(0, ENUM_LINE_VALUES).map((v) => JSON.stringify(v)).join(' | ');
74
+ return values.length > ENUM_LINE_VALUES ? `${shown} | … (${values.length} values)` : shown;
75
+ }
76
+ const union = unionOf(schema);
77
+ if (union) {
78
+ const by = discriminatorOf(union);
79
+ return `one of ${union.length}${by ? ` by ${by}` : ''}`;
80
+ }
81
+ const type = Array.isArray(schema.type) ? schema.type.join('|') : (schema.type ?? '');
82
+ if (type === 'number' || type === 'integer') {
83
+ const { minimum: min, maximum: max } = schema;
84
+ const range = min !== undefined && max !== undefined ? ` ${min}–${max}` : min !== undefined ? ` ≥${min}` : max !== undefined ? ` ≤${max}` : '';
85
+ return `${type}${range}`;
86
+ }
87
+ if (type === 'string') {
88
+ const limits = [
89
+ schema.format ? `format ${String(schema.format)}` : '',
90
+ schema.maxLength !== undefined ? `≤${String(schema.maxLength)} chars` : '',
91
+ schema.pattern ? `pattern ${String(schema.pattern)}` : '',
92
+ ].filter(Boolean);
93
+ return limits.length ? `string (${limits.join(', ')})` : 'string';
94
+ }
95
+ if (type === 'array')
96
+ return isSchema(schema.items) ? `list of ${typeLine(schema.items)}` : 'list';
97
+ if (type === 'object' || isSchema(schema.properties)) {
98
+ const n = Object.keys(propertiesOf(schema)).length;
99
+ return n > 0 ? `object (${n} properties)` : 'object';
100
+ }
101
+ return type || 'any';
102
+ }
103
+ /** The values of an enumeration too long for its line. */
104
+ const longEnumOf = (schema) => Array.isArray(schema.enum) && schema.enum.length > ENUM_LINE_VALUES ? schema.enum : null;
105
+ /** Whether a property's schema holds more than its line shows. */
106
+ function opens(schema) {
107
+ if (unionOf(schema))
108
+ return true;
109
+ if (longEnumOf(schema))
110
+ return true;
111
+ if (Object.keys(propertiesOf(schema)).length > 0)
112
+ return true;
113
+ return isSchema(schema.items) && opens(schema.items);
114
+ }
115
+ /**
116
+ * The schema `path` names inside `schema`, or why nothing is there.
117
+ *
118
+ * A path is steps joined by ".": a property name; `name=value` for the member
119
+ * of a union whose discriminator is that value; `#n` for a union's nth member
120
+ * (from 1) when nothing tells them apart; `[]` for a list's items.
121
+ */
122
+ export function schemaAt(schema, path) {
123
+ let at = schema;
124
+ const walked = [];
125
+ for (const step of path.split('.').filter((s) => s.length > 0)) {
126
+ const here = walked.length ? `"${walked.join('.')}"` : 'the input';
127
+ const union = unionOf(at);
128
+ if (step === '[]') {
129
+ if (!isSchema(at.items))
130
+ return { error: `${here} is not a list, so it has no "[]"` };
131
+ at = at.items;
132
+ }
133
+ else if (/^#\d+$/.test(step)) {
134
+ const member = union?.[Number(step.slice(1)) - 1];
135
+ if (!member)
136
+ return { error: `${here} has no member ${step}${union ? `: it has ${union.length}` : ''}` };
137
+ at = member;
138
+ }
139
+ else if (step.includes('=')) {
140
+ const [name, ...rest] = step.split('=');
141
+ const value = rest.join('=');
142
+ const member = union?.find((m) => String(constantOf(propertiesOf(m)[name])) === value);
143
+ if (!member) {
144
+ const by = union ? discriminatorOf(union) : null;
145
+ const values = union && by ? union.map((m) => String(constantOf(propertiesOf(m)[by]))) : [];
146
+ return {
147
+ error: union
148
+ ? `${here} has no member with ${name} = "${value}"${by ? `. Its members are told apart by ${by}: ${clip(values.join(', '), 600)}` : ''}`
149
+ : `${here} is not a union, so "${step}" names nothing in it`,
150
+ };
151
+ }
152
+ at = member;
153
+ }
154
+ else {
155
+ const next = propertiesOf(at)[step];
156
+ if (!next) {
157
+ const names = Object.keys(propertiesOf(at));
158
+ return {
159
+ error: union
160
+ ? `${here} is a union: open one of its members first (${discriminatorOf(union) ?? '#n'}=…), then "${step}"`
161
+ : `${here} has no property "${step}"${names.length ? `. It has: ${clip(names.join(', '), 600)}` : ''}`,
162
+ };
163
+ }
164
+ at = next;
165
+ }
166
+ walked.push(step);
167
+ }
168
+ return { schema: at };
169
+ }
170
+ function join(path, step) {
171
+ return path ? `${path}.${step}` : step;
172
+ }
173
+ /** One property on a line: its name, whether it is required, its type, what the contract says of it, what it is. */
174
+ function propertyLine(name, schema, required, path) {
175
+ const description = typeof schema.description === 'string' ? ` — ${clip(schema.description, LINE_DESCRIPTION_CHARS)}` : '';
176
+ const more = opens(schema) ? ` (open: path "${join(path, name)}")` : '';
177
+ return `- ${name}${required ? ' (required)' : ''}: ${typeLine(schema)}${annotations(schema)}${description}${more}`;
178
+ }
179
+ /** A schema's outline in two parts: what it is, and its rows (properties, a union's members, or an enumeration's values), a line each. */
180
+ function outlineOf(schema, path) {
181
+ const longEnum = longEnumOf(schema);
182
+ const head = [
183
+ // An enumeration listed below is not also cut short on its head line.
184
+ (longEnum ? `one of ${longEnum.length} values` : typeLine(schema)) + annotations(schema),
185
+ typeof schema.description === 'string' ? clip(schema.description, longEnum ? 2_000 : 300) : '',
186
+ ]
187
+ .filter(Boolean)
188
+ .join(' — ');
189
+ const union = unionOf(schema);
190
+ if (union) {
191
+ const by = discriminatorOf(union);
192
+ return {
193
+ head: [
194
+ head,
195
+ by ? `Members, by ${by} (open one with path "${join(path, `${by}=<value>`)}"):` : `Members (open one with path "${join(path, '#<n>')}"):`,
196
+ ],
197
+ rows: union.map((member, i) => {
198
+ const label = by ? String(constantOf(propertiesOf(member)[by])) : `#${i + 1}`;
199
+ const title = typeof member.title === 'string' ? member.title : typeof member.description === 'string' ? member.description : '';
200
+ const fields = Object.keys(propertiesOf(member)).filter((n) => n !== by);
201
+ return `- ${label}${title ? ` — ${clip(title, LINE_DESCRIPTION_CHARS)}` : ''}${fields.length ? ` (${fields.length} more fields)` : ''}`;
202
+ }),
203
+ what: 'members',
204
+ };
205
+ }
206
+ const properties = propertiesOf(schema);
207
+ const names = Object.keys(properties);
208
+ if (names.length > 0) {
209
+ const required = new Set(Array.isArray(schema.required) ? schema.required : []);
210
+ const ordered = [...names.filter((n) => required.has(n)), ...names.filter((n) => !required.has(n))];
211
+ return {
212
+ head: [head, `Properties (${names.length}):`],
213
+ rows: ordered.map((name) => propertyLine(name, properties[name], required.has(name), path)),
214
+ what: 'properties',
215
+ };
216
+ }
217
+ if (longEnum) {
218
+ return { head: [head, 'Values:'], rows: longEnum.map((value) => `- ${JSON.stringify(value)}`), what: 'values' };
219
+ }
220
+ if (isSchema(schema.items) && opens(schema.items)) {
221
+ return { head: [head, `Each item (open with path "${join(path, '[]')}"): ${typeLine(schema.items)}`], rows: [], what: 'rows' };
222
+ }
223
+ return { head: [head], rows: [], what: 'rows' };
224
+ }
225
+ /**
226
+ * What an action takes, or the part of it `path` names.
227
+ *
228
+ * Whole when its JSON is small enough: `maxChars` for an action's whole input,
229
+ * and the larger `WHOLE_PART_CHARS` for a part asked for by its path, which
230
+ * the model named because an outline had cut it short. Otherwise in outline:
231
+ * what it is, then its rows — properties, a union's members, an enumeration's
232
+ * values — as many as the size holds from row `from`, saying how many there
233
+ * are and where the next begin. No row is dropped without the answer saying
234
+ * how to read it.
235
+ */
236
+ export function describeSchema(schema, options = {}) {
237
+ const path = options.path ?? '';
238
+ const maxChars = options.maxChars ?? WHOLE_SCHEMA_CHARS;
239
+ const found = schemaAt(schema ?? { type: 'object', properties: {} }, path);
240
+ if ('error' in found)
241
+ return found;
242
+ const from = Math.max(1, Math.floor(options.from ?? 1));
243
+ const json = JSON.stringify(found.schema);
244
+ if (from === 1 && json.length <= (path ? Math.max(maxChars, WHOLE_PART_CHARS) : maxChars))
245
+ return { text: json, whole: true };
246
+ const { head, rows, what } = outlineOf(found.schema, path);
247
+ if (from > Math.max(rows.length, 1)) {
248
+ return { error: `${path ? `"${path}"` : 'The input'} has ${rows.length} ${what}: there is none at ${from}` };
249
+ }
250
+ // The rows that fit from `from`: at least one, at most a page, within the size.
251
+ const paging = (to) => from === 1 && to === rows.length ? '' : `\n${what[0].toUpperCase()}${what.slice(1)} ${from}–${to} of ${rows.length}.${to < rows.length ? ` For the next, call again with from: ${to + 1}.` : ''}`;
252
+ let to = Math.min(rows.length, from - 1 + OUTLINE_ROWS);
253
+ const text = (end) => [...head, ...rows.slice(from - 1, end)].join('\n') + paging(end);
254
+ while (to > from && text(to).length > maxChars)
255
+ to--;
256
+ return { text: text(to), whole: false };
257
+ }
258
+ //# sourceMappingURL=outline.js.map