oui-spec 0.7.1 → 0.10.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 (45) hide show
  1. package/README.md +3 -2
  2. package/dist/{chunk-5UUJ3F7C.cjs → chunk-2FFUDX2L.cjs} +5 -3
  3. package/dist/chunk-2FFUDX2L.cjs.map +1 -0
  4. package/dist/{chunk-RZUYWZFK.js → chunk-JOWXACVF.js} +26 -7
  5. package/dist/chunk-JOWXACVF.js.map +1 -0
  6. package/dist/{chunk-R3SGP2UY.js → chunk-NXDPC3KW.js} +5 -3
  7. package/dist/chunk-NXDPC3KW.js.map +1 -0
  8. package/dist/{chunk-2CPOHQGI.cjs → chunk-OJ6Y2WWS.cjs} +27 -6
  9. package/dist/chunk-OJ6Y2WWS.cjs.map +1 -0
  10. package/dist/{chunk-NKKWL7RK.js → chunk-UNQZXT7C.js} +16 -6
  11. package/dist/chunk-UNQZXT7C.js.map +1 -0
  12. package/dist/{chunk-MLWLZZV7.cjs → chunk-Z464LS7K.cjs} +41 -30
  13. package/dist/chunk-Z464LS7K.cjs.map +1 -0
  14. package/dist/core/index.cjs +11 -7
  15. package/dist/core/index.d.cts +24 -6
  16. package/dist/core/index.d.ts +24 -6
  17. package/dist/core/index.js +3 -3
  18. package/dist/index.cjs +50 -38
  19. package/dist/index.d.cts +5 -5
  20. package/dist/index.d.ts +5 -5
  21. package/dist/index.js +3 -3
  22. package/dist/react/index.d.cts +3 -3
  23. package/dist/react/index.d.ts +3 -3
  24. package/dist/spec/index.cjs +40 -32
  25. package/dist/spec/index.d.cts +29 -4
  26. package/dist/spec/index.d.ts +29 -4
  27. package/dist/spec/index.js +1 -1
  28. package/dist/{surface-runtime-BPEtT3LZ.d.ts → surface-runtime-B6NED8eV.d.ts} +15 -5
  29. package/dist/{surface-runtime-CexHqUn-.d.cts → surface-runtime-DCPEz_JF.d.cts} +15 -5
  30. package/dist/transport/index.cjs +2 -2
  31. package/dist/transport/index.d.cts +3 -3
  32. package/dist/transport/index.d.ts +3 -3
  33. package/dist/transport/index.js +1 -1
  34. package/dist/{types-CnlVRPFL.d.cts → types-DLOa7CWj.d.cts} +14 -3
  35. package/dist/{types-CnlVRPFL.d.ts → types-DLOa7CWj.d.ts} +14 -3
  36. package/dist/{websocket-DKL9qoO-.d.ts → websocket-Bf7xMzs1.d.ts} +1 -1
  37. package/dist/{websocket-HnzPlfk6.d.cts → websocket-CoSpb5nB.d.cts} +1 -1
  38. package/package.json +1 -1
  39. package/spec/OUI-SPEC-v0.1.md +9 -3
  40. package/dist/chunk-2CPOHQGI.cjs.map +0 -1
  41. package/dist/chunk-5UUJ3F7C.cjs.map +0 -1
  42. package/dist/chunk-MLWLZZV7.cjs.map +0 -1
  43. package/dist/chunk-NKKWL7RK.js.map +0 -1
  44. package/dist/chunk-R3SGP2UY.js.map +0 -1
  45. package/dist/chunk-RZUYWZFK.js.map +0 -1
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
- export { createOUI, createSurfaceRuntime, defineSurface } from './chunk-NKKWL7RK.js';
2
- export { ARGS_HASH_PATTERN, FIT_LIST_STEPS, FIT_TEXT_CHARS, INDEX_DESCRIPTION_CHARS, INDEX_INPUT_CHARS, INDEX_INPUT_PROPERTIES, OUI_DESCRIBE_ACTION, OUI_EFFECT_ACCESS, OUI_EFFECT_KINDS, OUI_PROTOCOL_EVENTS, OUI_READ_ACTION, OUI_RUNTIME_SURFACE, argsHash, atPointer, canonicalJson, constantOf, definitionHash, discriminatorOf, effectAccess, firstSentence, fitObservations, indexEntry, jsonBytes, pointerStep, pointerSteps, requiresApproval, sortedJson, summarizeInput, surfaceIndex, surfacesHash, utf8Length } from './chunk-RZUYWZFK.js';
1
+ export { acceptCurrentTurn, createOUI, createSurfaceRuntime, defineSurface } from './chunk-UNQZXT7C.js';
2
+ export { ARGS_HASH_PATTERN, DEFINITION_HASH_HEX, FIT_LIST_STEPS, FIT_TEXT_CHARS, INDEX_DESCRIPTION_CHARS, INDEX_INPUT_CHARS, INDEX_INPUT_PROPERTIES, OUI_DESCRIBE_ACTION, OUI_EFFECT_ACCESS, OUI_EFFECT_KINDS, OUI_PROTOCOL_EVENTS, OUI_READ_ACTION, OUI_RUNTIME_SURFACE, argsHash, atPointer, canonicalJson, constantOf, definitionHash, discriminatorOf, effectAccess, firstSentence, fitObservations, indexEntry, jsonBytes, pointerStep, pointerSteps, requiresApproval, sortedJson, summarizeInput, surfaceIndex, surfacesHash, utf8Length, withoutTitleLeadIn } from './chunk-JOWXACVF.js';
3
3
  export { SurfaceRuntimeProvider, useObservation, useSurface, useSurfaceHold, useSurfaceRuntime } from './chunk-UOTAHGIV.js';
4
4
  export { createDirectTransportPair } from './chunk-IIZ6HL2L.js';
5
- export { createWebSocketTransport } from './chunk-R3SGP2UY.js';
5
+ export { createWebSocketTransport } from './chunk-NXDPC3KW.js';
6
6
  //# sourceMappingURL=index.js.map
7
7
  //# sourceMappingURL=index.js.map
@@ -1,8 +1,8 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode } from 'react';
3
- import { e as OUIActionResult } from '../types-CnlVRPFL.cjs';
4
- import { f as SurfaceRuntime, e as SurfaceForm, D as DefinedSurface } from '../surface-runtime-CexHqUn-.cjs';
5
- import '../websocket-HnzPlfk6.cjs';
3
+ import { e as OUIActionResult } from '../types-DLOa7CWj.cjs';
4
+ import { f as SurfaceRuntime, e as SurfaceForm, D as DefinedSurface } from '../surface-runtime-DCPEz_JF.cjs';
5
+ import '../websocket-CoSpb5nB.cjs';
6
6
 
7
7
  interface SurfaceRuntimeProviderProps {
8
8
  /** A runtime in either form (§7.3.8). */
@@ -1,8 +1,8 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode } from 'react';
3
- import { e as OUIActionResult } from '../types-CnlVRPFL.js';
4
- import { f as SurfaceRuntime, e as SurfaceForm, D as DefinedSurface } from '../surface-runtime-BPEtT3LZ.js';
5
- import '../websocket-DKL9qoO-.js';
3
+ import { e as OUIActionResult } from '../types-DLOa7CWj.js';
4
+ import { f as SurfaceRuntime, e as SurfaceForm, D as DefinedSurface } from '../surface-runtime-B6NED8eV.js';
5
+ import '../websocket-Bf7xMzs1.js';
6
6
 
7
7
  interface SurfaceRuntimeProviderProps {
8
8
  /** A runtime in either form (§7.3.8). */
@@ -1,132 +1,140 @@
1
1
  'use strict';
2
2
 
3
- var chunk2CPOHQGI_cjs = require('../chunk-2CPOHQGI.cjs');
3
+ var chunkOJ6Y2WWS_cjs = require('../chunk-OJ6Y2WWS.cjs');
4
4
 
5
5
 
6
6
 
7
7
  Object.defineProperty(exports, "ARGS_HASH_PATTERN", {
8
8
  enumerable: true,
9
- get: function () { return chunk2CPOHQGI_cjs.ARGS_HASH_PATTERN; }
9
+ get: function () { return chunkOJ6Y2WWS_cjs.ARGS_HASH_PATTERN; }
10
+ });
11
+ Object.defineProperty(exports, "DEFINITION_HASH_HEX", {
12
+ enumerable: true,
13
+ get: function () { return chunkOJ6Y2WWS_cjs.DEFINITION_HASH_HEX; }
10
14
  });
11
15
  Object.defineProperty(exports, "FIT_LIST_STEPS", {
12
16
  enumerable: true,
13
- get: function () { return chunk2CPOHQGI_cjs.FIT_LIST_STEPS; }
17
+ get: function () { return chunkOJ6Y2WWS_cjs.FIT_LIST_STEPS; }
14
18
  });
15
19
  Object.defineProperty(exports, "FIT_TEXT_CHARS", {
16
20
  enumerable: true,
17
- get: function () { return chunk2CPOHQGI_cjs.FIT_TEXT_CHARS; }
21
+ get: function () { return chunkOJ6Y2WWS_cjs.FIT_TEXT_CHARS; }
18
22
  });
19
23
  Object.defineProperty(exports, "INDEX_DESCRIPTION_CHARS", {
20
24
  enumerable: true,
21
- get: function () { return chunk2CPOHQGI_cjs.INDEX_DESCRIPTION_CHARS; }
25
+ get: function () { return chunkOJ6Y2WWS_cjs.INDEX_DESCRIPTION_CHARS; }
22
26
  });
23
27
  Object.defineProperty(exports, "INDEX_INPUT_CHARS", {
24
28
  enumerable: true,
25
- get: function () { return chunk2CPOHQGI_cjs.INDEX_INPUT_CHARS; }
29
+ get: function () { return chunkOJ6Y2WWS_cjs.INDEX_INPUT_CHARS; }
26
30
  });
27
31
  Object.defineProperty(exports, "INDEX_INPUT_PROPERTIES", {
28
32
  enumerable: true,
29
- get: function () { return chunk2CPOHQGI_cjs.INDEX_INPUT_PROPERTIES; }
33
+ get: function () { return chunkOJ6Y2WWS_cjs.INDEX_INPUT_PROPERTIES; }
30
34
  });
31
35
  Object.defineProperty(exports, "OUI_DESCRIBE_ACTION", {
32
36
  enumerable: true,
33
- get: function () { return chunk2CPOHQGI_cjs.OUI_DESCRIBE_ACTION; }
37
+ get: function () { return chunkOJ6Y2WWS_cjs.OUI_DESCRIBE_ACTION; }
34
38
  });
35
39
  Object.defineProperty(exports, "OUI_EFFECT_ACCESS", {
36
40
  enumerable: true,
37
- get: function () { return chunk2CPOHQGI_cjs.OUI_EFFECT_ACCESS; }
41
+ get: function () { return chunkOJ6Y2WWS_cjs.OUI_EFFECT_ACCESS; }
38
42
  });
39
43
  Object.defineProperty(exports, "OUI_EFFECT_KINDS", {
40
44
  enumerable: true,
41
- get: function () { return chunk2CPOHQGI_cjs.OUI_EFFECT_KINDS; }
45
+ get: function () { return chunkOJ6Y2WWS_cjs.OUI_EFFECT_KINDS; }
42
46
  });
43
47
  Object.defineProperty(exports, "OUI_PROTOCOL_EVENTS", {
44
48
  enumerable: true,
45
- get: function () { return chunk2CPOHQGI_cjs.OUI_PROTOCOL_EVENTS; }
49
+ get: function () { return chunkOJ6Y2WWS_cjs.OUI_PROTOCOL_EVENTS; }
46
50
  });
47
51
  Object.defineProperty(exports, "OUI_READ_ACTION", {
48
52
  enumerable: true,
49
- get: function () { return chunk2CPOHQGI_cjs.OUI_READ_ACTION; }
53
+ get: function () { return chunkOJ6Y2WWS_cjs.OUI_READ_ACTION; }
50
54
  });
51
55
  Object.defineProperty(exports, "OUI_RUNTIME_SURFACE", {
52
56
  enumerable: true,
53
- get: function () { return chunk2CPOHQGI_cjs.OUI_RUNTIME_SURFACE; }
57
+ get: function () { return chunkOJ6Y2WWS_cjs.OUI_RUNTIME_SURFACE; }
54
58
  });
55
59
  Object.defineProperty(exports, "argsHash", {
56
60
  enumerable: true,
57
- get: function () { return chunk2CPOHQGI_cjs.argsHash; }
61
+ get: function () { return chunkOJ6Y2WWS_cjs.argsHash; }
58
62
  });
59
63
  Object.defineProperty(exports, "atPointer", {
60
64
  enumerable: true,
61
- get: function () { return chunk2CPOHQGI_cjs.atPointer; }
65
+ get: function () { return chunkOJ6Y2WWS_cjs.atPointer; }
62
66
  });
63
67
  Object.defineProperty(exports, "canonicalJson", {
64
68
  enumerable: true,
65
- get: function () { return chunk2CPOHQGI_cjs.canonicalJson; }
69
+ get: function () { return chunkOJ6Y2WWS_cjs.canonicalJson; }
66
70
  });
67
71
  Object.defineProperty(exports, "constantOf", {
68
72
  enumerable: true,
69
- get: function () { return chunk2CPOHQGI_cjs.constantOf; }
73
+ get: function () { return chunkOJ6Y2WWS_cjs.constantOf; }
70
74
  });
71
75
  Object.defineProperty(exports, "definitionHash", {
72
76
  enumerable: true,
73
- get: function () { return chunk2CPOHQGI_cjs.definitionHash; }
77
+ get: function () { return chunkOJ6Y2WWS_cjs.definitionHash; }
74
78
  });
75
79
  Object.defineProperty(exports, "discriminatorOf", {
76
80
  enumerable: true,
77
- get: function () { return chunk2CPOHQGI_cjs.discriminatorOf; }
81
+ get: function () { return chunkOJ6Y2WWS_cjs.discriminatorOf; }
78
82
  });
79
83
  Object.defineProperty(exports, "effectAccess", {
80
84
  enumerable: true,
81
- get: function () { return chunk2CPOHQGI_cjs.effectAccess; }
85
+ get: function () { return chunkOJ6Y2WWS_cjs.effectAccess; }
82
86
  });
83
87
  Object.defineProperty(exports, "firstSentence", {
84
88
  enumerable: true,
85
- get: function () { return chunk2CPOHQGI_cjs.firstSentence; }
89
+ get: function () { return chunkOJ6Y2WWS_cjs.firstSentence; }
86
90
  });
87
91
  Object.defineProperty(exports, "fitObservations", {
88
92
  enumerable: true,
89
- get: function () { return chunk2CPOHQGI_cjs.fitObservations; }
93
+ get: function () { return chunkOJ6Y2WWS_cjs.fitObservations; }
90
94
  });
91
95
  Object.defineProperty(exports, "indexEntry", {
92
96
  enumerable: true,
93
- get: function () { return chunk2CPOHQGI_cjs.indexEntry; }
97
+ get: function () { return chunkOJ6Y2WWS_cjs.indexEntry; }
94
98
  });
95
99
  Object.defineProperty(exports, "jsonBytes", {
96
100
  enumerable: true,
97
- get: function () { return chunk2CPOHQGI_cjs.jsonBytes; }
101
+ get: function () { return chunkOJ6Y2WWS_cjs.jsonBytes; }
98
102
  });
99
103
  Object.defineProperty(exports, "pointerStep", {
100
104
  enumerable: true,
101
- get: function () { return chunk2CPOHQGI_cjs.pointerStep; }
105
+ get: function () { return chunkOJ6Y2WWS_cjs.pointerStep; }
102
106
  });
103
107
  Object.defineProperty(exports, "pointerSteps", {
104
108
  enumerable: true,
105
- get: function () { return chunk2CPOHQGI_cjs.pointerSteps; }
109
+ get: function () { return chunkOJ6Y2WWS_cjs.pointerSteps; }
106
110
  });
107
111
  Object.defineProperty(exports, "requiresApproval", {
108
112
  enumerable: true,
109
- get: function () { return chunk2CPOHQGI_cjs.requiresApproval; }
113
+ get: function () { return chunkOJ6Y2WWS_cjs.requiresApproval; }
110
114
  });
111
115
  Object.defineProperty(exports, "sortedJson", {
112
116
  enumerable: true,
113
- get: function () { return chunk2CPOHQGI_cjs.sortedJson; }
117
+ get: function () { return chunkOJ6Y2WWS_cjs.sortedJson; }
114
118
  });
115
119
  Object.defineProperty(exports, "summarizeInput", {
116
120
  enumerable: true,
117
- get: function () { return chunk2CPOHQGI_cjs.summarizeInput; }
121
+ get: function () { return chunkOJ6Y2WWS_cjs.summarizeInput; }
118
122
  });
119
123
  Object.defineProperty(exports, "surfaceIndex", {
120
124
  enumerable: true,
121
- get: function () { return chunk2CPOHQGI_cjs.surfaceIndex; }
125
+ get: function () { return chunkOJ6Y2WWS_cjs.surfaceIndex; }
122
126
  });
123
127
  Object.defineProperty(exports, "surfacesHash", {
124
128
  enumerable: true,
125
- get: function () { return chunk2CPOHQGI_cjs.surfacesHash; }
129
+ get: function () { return chunkOJ6Y2WWS_cjs.surfacesHash; }
126
130
  });
127
131
  Object.defineProperty(exports, "utf8Length", {
128
132
  enumerable: true,
129
- get: function () { return chunk2CPOHQGI_cjs.utf8Length; }
133
+ get: function () { return chunkOJ6Y2WWS_cjs.utf8Length; }
134
+ });
135
+ Object.defineProperty(exports, "withoutTitleLeadIn", {
136
+ enumerable: true,
137
+ get: function () { return chunkOJ6Y2WWS_cjs.withoutTitleLeadIn; }
130
138
  });
131
139
  //# sourceMappingURL=index.cjs.map
132
140
  //# sourceMappingURL=index.cjs.map
@@ -1,5 +1,5 @@
1
- import { r as OUISurface, t as OUISurfaceIndex, J as JSONSchema, O as OUIAction, b as OUIActionIndexEntry, n as OUIObservationSnapshot, k as OUIFitCut } from '../types-CnlVRPFL.cjs';
2
- export { A as ARGS_HASH_PATTERN, a as OUIActionApproval, c as OUIActionPolling, d as OUIActionRequest, e as OUIActionResult, f as OUIActivation, g as OUIApprovalGrant, h as OUIClientSnapshot, i as OUIEffectKind, j as OUIFit, l as OUIIndexSnapshot, m as OUIObservation, o as OUIObservationUpdate, p as OUIProtocolEvent, q as OUIResultDelivery, s as OUISurfaceDeregistration, u as OUISurfaceRegistration, v as OUISurfaceSnapshot, w as OUI_EFFECT_ACCESS, x as OUI_EFFECT_KINDS, y as OUI_PROTOCOL_EVENTS, z as argsHash, B as canonicalJson, C as effectAccess, D as requiresApproval } from '../types-CnlVRPFL.cjs';
1
+ import { r as OUISurface, t as OUISurfaceIndex, J as JSONSchema, O as OUIAction, b as OUIActionIndexEntry, n as OUIObservationSnapshot, k as OUIFitCut } from '../types-DLOa7CWj.cjs';
2
+ export { A as ARGS_HASH_PATTERN, a as OUIActionApproval, c as OUIActionPolling, d as OUIActionRequest, e as OUIActionResult, f as OUIActivation, g as OUIApprovalGrant, h as OUIClientSnapshot, i as OUIEffectKind, j as OUIFit, l as OUIIndexSnapshot, m as OUIObservation, o as OUIObservationUpdate, p as OUIProtocolEvent, q as OUIResultDelivery, s as OUISurfaceDeregistration, u as OUISurfaceRegistration, v as OUISurfaceSnapshot, w as OUI_EFFECT_ACCESS, x as OUI_EFFECT_KINDS, y as OUI_PROTOCOL_EVENTS, z as argsHash, B as canonicalJson, C as effectAccess, D as requiresApproval } from '../types-DLOa7CWj.cjs';
3
3
 
4
4
  /**
5
5
  * The identity of a set of surfaces, for an answer that need not repeat them
@@ -66,7 +66,32 @@ declare function constantOf(schema: JSONSchema | undefined): string | number | b
66
66
  * - "one of N shapes by <property>" for a union.
67
67
  */
68
68
  declare function summarizeInput(schema: JSONSchema | undefined): string;
69
- /** The hash of an action's definition, as an index entry's `definitionHash` carries it. */
69
+ /**
70
+ * A description without the opening that only repeats the action's title.
71
+ *
72
+ * An entry carries the title beside the description, and descriptions are
73
+ * commonly written to stand alone: `Add artboard: Adds an artboard…`, or, for
74
+ * a control, `Press "Save": Saves the project`. In an index that names the
75
+ * title twice for every action, and an index is hundreds of actions. So an
76
+ * opening of the title followed by ": ", or of a short lead-in, the title in
77
+ * double quotes and ": ", is left out: what the entry keeps is what the title
78
+ * does not already say. A description that does not open that way is kept as
79
+ * it is, and one that is only its title is kept too.
80
+ */
81
+ declare function withoutTitleLeadIn(description: string, title: string | undefined): string;
82
+ /** The hex digits an entry's `definitionHash` has: 32 bits. */
83
+ declare const DEFINITION_HASH_HEX = 8;
84
+ /**
85
+ * The hash of an action's definition, as an index entry's `definitionHash`
86
+ * carries it: the first 32 bits of the 64-bit FNV-1a of its sorted-key JSON.
87
+ *
88
+ * It answers one question, for one action: has this action's definition
89
+ * changed since it was fetched? It is only ever compared with the same
90
+ * action's earlier hash, so 32 bits are enough (a change goes unseen once in
91
+ * 2^32, and costs one stale definition until the next change), and an index of
92
+ * hundreds of actions carries half the digits. The hash of a whole page
93
+ * (`surfacesHash`) is compared across everything on it, and stays 64 bits.
94
+ */
70
95
  declare function definitionHash(action: OUIAction): string;
71
96
  /** An action's index entry (§7.3.8). */
72
97
  declare function indexEntry(action: OUIAction): OUIActionIndexEntry;
@@ -96,4 +121,4 @@ declare function fitObservations(observations: OUIObservationSnapshot, budget: n
96
121
  cuts: OUIFitCut[];
97
122
  };
98
123
 
99
- export { FIT_LIST_STEPS, FIT_TEXT_CHARS, INDEX_DESCRIPTION_CHARS, INDEX_INPUT_CHARS, INDEX_INPUT_PROPERTIES, JSONSchema, OUIAction, OUIActionIndexEntry, OUIFitCut, OUIObservationSnapshot, OUISurface, OUISurfaceIndex, OUI_DESCRIBE_ACTION, OUI_READ_ACTION, OUI_RUNTIME_SURFACE, atPointer, constantOf, definitionHash, discriminatorOf, firstSentence, fitObservations, indexEntry, jsonBytes, pointerStep, pointerSteps, sortedJson, summarizeInput, surfaceIndex, surfacesHash, utf8Length };
124
+ export { DEFINITION_HASH_HEX, FIT_LIST_STEPS, FIT_TEXT_CHARS, INDEX_DESCRIPTION_CHARS, INDEX_INPUT_CHARS, INDEX_INPUT_PROPERTIES, JSONSchema, OUIAction, OUIActionIndexEntry, OUIFitCut, OUIObservationSnapshot, OUISurface, OUISurfaceIndex, OUI_DESCRIBE_ACTION, OUI_READ_ACTION, OUI_RUNTIME_SURFACE, atPointer, constantOf, definitionHash, discriminatorOf, firstSentence, fitObservations, indexEntry, jsonBytes, pointerStep, pointerSteps, sortedJson, summarizeInput, surfaceIndex, surfacesHash, utf8Length, withoutTitleLeadIn };
@@ -1,5 +1,5 @@
1
- import { r as OUISurface, t as OUISurfaceIndex, J as JSONSchema, O as OUIAction, b as OUIActionIndexEntry, n as OUIObservationSnapshot, k as OUIFitCut } from '../types-CnlVRPFL.js';
2
- export { A as ARGS_HASH_PATTERN, a as OUIActionApproval, c as OUIActionPolling, d as OUIActionRequest, e as OUIActionResult, f as OUIActivation, g as OUIApprovalGrant, h as OUIClientSnapshot, i as OUIEffectKind, j as OUIFit, l as OUIIndexSnapshot, m as OUIObservation, o as OUIObservationUpdate, p as OUIProtocolEvent, q as OUIResultDelivery, s as OUISurfaceDeregistration, u as OUISurfaceRegistration, v as OUISurfaceSnapshot, w as OUI_EFFECT_ACCESS, x as OUI_EFFECT_KINDS, y as OUI_PROTOCOL_EVENTS, z as argsHash, B as canonicalJson, C as effectAccess, D as requiresApproval } from '../types-CnlVRPFL.js';
1
+ import { r as OUISurface, t as OUISurfaceIndex, J as JSONSchema, O as OUIAction, b as OUIActionIndexEntry, n as OUIObservationSnapshot, k as OUIFitCut } from '../types-DLOa7CWj.js';
2
+ export { A as ARGS_HASH_PATTERN, a as OUIActionApproval, c as OUIActionPolling, d as OUIActionRequest, e as OUIActionResult, f as OUIActivation, g as OUIApprovalGrant, h as OUIClientSnapshot, i as OUIEffectKind, j as OUIFit, l as OUIIndexSnapshot, m as OUIObservation, o as OUIObservationUpdate, p as OUIProtocolEvent, q as OUIResultDelivery, s as OUISurfaceDeregistration, u as OUISurfaceRegistration, v as OUISurfaceSnapshot, w as OUI_EFFECT_ACCESS, x as OUI_EFFECT_KINDS, y as OUI_PROTOCOL_EVENTS, z as argsHash, B as canonicalJson, C as effectAccess, D as requiresApproval } from '../types-DLOa7CWj.js';
3
3
 
4
4
  /**
5
5
  * The identity of a set of surfaces, for an answer that need not repeat them
@@ -66,7 +66,32 @@ declare function constantOf(schema: JSONSchema | undefined): string | number | b
66
66
  * - "one of N shapes by <property>" for a union.
67
67
  */
68
68
  declare function summarizeInput(schema: JSONSchema | undefined): string;
69
- /** The hash of an action's definition, as an index entry's `definitionHash` carries it. */
69
+ /**
70
+ * A description without the opening that only repeats the action's title.
71
+ *
72
+ * An entry carries the title beside the description, and descriptions are
73
+ * commonly written to stand alone: `Add artboard: Adds an artboard…`, or, for
74
+ * a control, `Press "Save": Saves the project`. In an index that names the
75
+ * title twice for every action, and an index is hundreds of actions. So an
76
+ * opening of the title followed by ": ", or of a short lead-in, the title in
77
+ * double quotes and ": ", is left out: what the entry keeps is what the title
78
+ * does not already say. A description that does not open that way is kept as
79
+ * it is, and one that is only its title is kept too.
80
+ */
81
+ declare function withoutTitleLeadIn(description: string, title: string | undefined): string;
82
+ /** The hex digits an entry's `definitionHash` has: 32 bits. */
83
+ declare const DEFINITION_HASH_HEX = 8;
84
+ /**
85
+ * The hash of an action's definition, as an index entry's `definitionHash`
86
+ * carries it: the first 32 bits of the 64-bit FNV-1a of its sorted-key JSON.
87
+ *
88
+ * It answers one question, for one action: has this action's definition
89
+ * changed since it was fetched? It is only ever compared with the same
90
+ * action's earlier hash, so 32 bits are enough (a change goes unseen once in
91
+ * 2^32, and costs one stale definition until the next change), and an index of
92
+ * hundreds of actions carries half the digits. The hash of a whole page
93
+ * (`surfacesHash`) is compared across everything on it, and stays 64 bits.
94
+ */
70
95
  declare function definitionHash(action: OUIAction): string;
71
96
  /** An action's index entry (§7.3.8). */
72
97
  declare function indexEntry(action: OUIAction): OUIActionIndexEntry;
@@ -96,4 +121,4 @@ declare function fitObservations(observations: OUIObservationSnapshot, budget: n
96
121
  cuts: OUIFitCut[];
97
122
  };
98
123
 
99
- export { FIT_LIST_STEPS, FIT_TEXT_CHARS, INDEX_DESCRIPTION_CHARS, INDEX_INPUT_CHARS, INDEX_INPUT_PROPERTIES, JSONSchema, OUIAction, OUIActionIndexEntry, OUIFitCut, OUIObservationSnapshot, OUISurface, OUISurfaceIndex, OUI_DESCRIBE_ACTION, OUI_READ_ACTION, OUI_RUNTIME_SURFACE, atPointer, constantOf, definitionHash, discriminatorOf, firstSentence, fitObservations, indexEntry, jsonBytes, pointerStep, pointerSteps, sortedJson, summarizeInput, surfaceIndex, surfacesHash, utf8Length };
124
+ export { DEFINITION_HASH_HEX, FIT_LIST_STEPS, FIT_TEXT_CHARS, INDEX_DESCRIPTION_CHARS, INDEX_INPUT_CHARS, INDEX_INPUT_PROPERTIES, JSONSchema, OUIAction, OUIActionIndexEntry, OUIFitCut, OUIObservationSnapshot, OUISurface, OUISurfaceIndex, OUI_DESCRIBE_ACTION, OUI_READ_ACTION, OUI_RUNTIME_SURFACE, atPointer, constantOf, definitionHash, discriminatorOf, firstSentence, fitObservations, indexEntry, jsonBytes, pointerStep, pointerSteps, sortedJson, summarizeInput, surfaceIndex, surfacesHash, utf8Length, withoutTitleLeadIn };
@@ -1,3 +1,3 @@
1
- export { ARGS_HASH_PATTERN, FIT_LIST_STEPS, FIT_TEXT_CHARS, INDEX_DESCRIPTION_CHARS, INDEX_INPUT_CHARS, INDEX_INPUT_PROPERTIES, OUI_DESCRIBE_ACTION, OUI_EFFECT_ACCESS, OUI_EFFECT_KINDS, OUI_PROTOCOL_EVENTS, OUI_READ_ACTION, OUI_RUNTIME_SURFACE, argsHash, atPointer, canonicalJson, constantOf, definitionHash, discriminatorOf, effectAccess, firstSentence, fitObservations, indexEntry, jsonBytes, pointerStep, pointerSteps, requiresApproval, sortedJson, summarizeInput, surfaceIndex, surfacesHash, utf8Length } from '../chunk-RZUYWZFK.js';
1
+ export { ARGS_HASH_PATTERN, DEFINITION_HASH_HEX, FIT_LIST_STEPS, FIT_TEXT_CHARS, INDEX_DESCRIPTION_CHARS, INDEX_INPUT_CHARS, INDEX_INPUT_PROPERTIES, OUI_DESCRIBE_ACTION, OUI_EFFECT_ACCESS, OUI_EFFECT_KINDS, OUI_PROTOCOL_EVENTS, OUI_READ_ACTION, OUI_RUNTIME_SURFACE, argsHash, atPointer, canonicalJson, constantOf, definitionHash, discriminatorOf, effectAccess, firstSentence, fitObservations, indexEntry, jsonBytes, pointerStep, pointerSteps, requiresApproval, sortedJson, summarizeInput, surfaceIndex, surfacesHash, utf8Length, withoutTitleLeadIn } from '../chunk-JOWXACVF.js';
2
2
  //# sourceMappingURL=index.js.map
3
3
  //# sourceMappingURL=index.js.map
@@ -1,5 +1,5 @@
1
- import { i as OUIEffectKind, J as JSONSchema, c as OUIActionPolling, f as OUIActivation, r as OUISurface, l as OUIIndexSnapshot, v as OUISurfaceSnapshot, d as OUIActionRequest, e as OUIActionResult, g as OUIApprovalGrant } from './types-CnlVRPFL.js';
2
- import { S as SocketLike, e as OUITransportConfig } from './websocket-DKL9qoO-.js';
1
+ import { i as OUIEffectKind, J as JSONSchema, c as OUIActionPolling, f as OUIActivation, r as OUISurface, l as OUIIndexSnapshot, v as OUISurfaceSnapshot, d as OUIActionRequest, e as OUIActionResult, g as OUIApprovalGrant } from './types-DLOa7CWj.js';
2
+ import { S as SocketLike, e as OUITransportConfig } from './websocket-Bf7xMzs1.js';
3
3
 
4
4
  /**
5
5
  * Nominal branding for values OUI must construct itself.
@@ -47,10 +47,18 @@ interface ActionPollingConfig<TContext = unknown> extends OUIActionPolling {
47
47
  * Called on each poll interval. Receives the dispatch result from the handler
48
48
  * plus the current context. Return { done: true, data } to stop polling,
49
49
  * or { done: false, data } to continue.
50
+ *
51
+ * Work that ended in failure returns { done: true, data, error }: the final
52
+ * result is then a failure (§7.3.3) carrying `error`, with `data` kept, so
53
+ * the agent never records failed work as a success.
50
54
  */
51
55
  resolve?: (dispatchResult: unknown, context: TContext) => Promise<{
52
56
  done: boolean;
53
57
  data: unknown;
58
+ error?: {
59
+ code: string;
60
+ message: string;
61
+ };
54
62
  }>;
55
63
  }
56
64
  /**
@@ -206,11 +214,13 @@ interface SurfaceRuntimeOptions {
206
214
  dedupeWindow?: number;
207
215
  /**
208
216
  * Decides whether a request that arrived on the socket may run at all. A
209
- * refused request is neither run nor answered, and is logged.
217
+ * refused request is not run: its sender gets a receipt saying it was
218
+ * received and not accepted, and the refusal is logged.
210
219
  *
211
220
  * The server should be the only sender of action requests, but a client can
212
- * also check that a request is one it expects: for example, only while its
213
- * agent has a turn in progress. Requests passed to `execute` directly are
221
+ * also check that a request is one it expects: for example, only for the
222
+ * turn its agent is running now (the request's `turnId`), so a request sent
223
+ * late by a stopped turn does not run. Requests passed to `execute` directly are
214
224
  * not checked; they come from the application itself.
215
225
  */
216
226
  accept?: (request: OUIActionRequest) => boolean;
@@ -1,5 +1,5 @@
1
- import { i as OUIEffectKind, J as JSONSchema, c as OUIActionPolling, f as OUIActivation, r as OUISurface, l as OUIIndexSnapshot, v as OUISurfaceSnapshot, d as OUIActionRequest, e as OUIActionResult, g as OUIApprovalGrant } from './types-CnlVRPFL.cjs';
2
- import { S as SocketLike, e as OUITransportConfig } from './websocket-HnzPlfk6.cjs';
1
+ import { i as OUIEffectKind, J as JSONSchema, c as OUIActionPolling, f as OUIActivation, r as OUISurface, l as OUIIndexSnapshot, v as OUISurfaceSnapshot, d as OUIActionRequest, e as OUIActionResult, g as OUIApprovalGrant } from './types-DLOa7CWj.cjs';
2
+ import { S as SocketLike, e as OUITransportConfig } from './websocket-CoSpb5nB.cjs';
3
3
 
4
4
  /**
5
5
  * Nominal branding for values OUI must construct itself.
@@ -47,10 +47,18 @@ interface ActionPollingConfig<TContext = unknown> extends OUIActionPolling {
47
47
  * Called on each poll interval. Receives the dispatch result from the handler
48
48
  * plus the current context. Return { done: true, data } to stop polling,
49
49
  * or { done: false, data } to continue.
50
+ *
51
+ * Work that ended in failure returns { done: true, data, error }: the final
52
+ * result is then a failure (§7.3.3) carrying `error`, with `data` kept, so
53
+ * the agent never records failed work as a success.
50
54
  */
51
55
  resolve?: (dispatchResult: unknown, context: TContext) => Promise<{
52
56
  done: boolean;
53
57
  data: unknown;
58
+ error?: {
59
+ code: string;
60
+ message: string;
61
+ };
54
62
  }>;
55
63
  }
56
64
  /**
@@ -206,11 +214,13 @@ interface SurfaceRuntimeOptions {
206
214
  dedupeWindow?: number;
207
215
  /**
208
216
  * Decides whether a request that arrived on the socket may run at all. A
209
- * refused request is neither run nor answered, and is logged.
217
+ * refused request is not run: its sender gets a receipt saying it was
218
+ * received and not accepted, and the refusal is logged.
210
219
  *
211
220
  * The server should be the only sender of action requests, but a client can
212
- * also check that a request is one it expects: for example, only while its
213
- * agent has a turn in progress. Requests passed to `execute` directly are
221
+ * also check that a request is one it expects: for example, only for the
222
+ * turn its agent is running now (the request's `turnId`), so a request sent
223
+ * late by a stopped turn does not run. Requests passed to `execute` directly are
214
224
  * not checked; they come from the application itself.
215
225
  */
216
226
  accept?: (request: OUIActionRequest) => boolean;
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var chunkROGKEMLL_cjs = require('../chunk-ROGKEMLL.cjs');
4
- var chunk5UUJ3F7C_cjs = require('../chunk-5UUJ3F7C.cjs');
4
+ var chunk2FFUDX2L_cjs = require('../chunk-2FFUDX2L.cjs');
5
5
 
6
6
 
7
7
 
@@ -11,7 +11,7 @@ Object.defineProperty(exports, "createDirectTransportPair", {
11
11
  });
12
12
  Object.defineProperty(exports, "createWebSocketTransport", {
13
13
  enumerable: true,
14
- get: function () { return chunk5UUJ3F7C_cjs.createWebSocketTransport; }
14
+ get: function () { return chunk2FFUDX2L_cjs.createWebSocketTransport; }
15
15
  });
16
16
  //# sourceMappingURL=index.cjs.map
17
17
  //# sourceMappingURL=index.cjs.map
@@ -1,6 +1,6 @@
1
- import { d as OUITransport } from '../websocket-HnzPlfk6.cjs';
2
- export { O as OUIAcknowledgment, a as OUIActionHandler, b as OUIObservationHandler, c as OUIResultHandler, e as OUITransportConfig, S as SocketLike, f as createWebSocketTransport } from '../websocket-HnzPlfk6.cjs';
3
- import '../types-CnlVRPFL.cjs';
1
+ import { d as OUITransport } from '../websocket-CoSpb5nB.cjs';
2
+ export { O as OUIAcknowledgment, a as OUIActionHandler, b as OUIObservationHandler, c as OUIResultHandler, e as OUITransportConfig, S as SocketLike, f as createWebSocketTransport } from '../websocket-CoSpb5nB.cjs';
3
+ import '../types-DLOa7CWj.cjs';
4
4
 
5
5
  /**
6
6
  * Direct transport — for same-process communication.
@@ -1,6 +1,6 @@
1
- import { d as OUITransport } from '../websocket-DKL9qoO-.js';
2
- export { O as OUIAcknowledgment, a as OUIActionHandler, b as OUIObservationHandler, c as OUIResultHandler, e as OUITransportConfig, S as SocketLike, f as createWebSocketTransport } from '../websocket-DKL9qoO-.js';
3
- import '../types-CnlVRPFL.js';
1
+ import { d as OUITransport } from '../websocket-Bf7xMzs1.js';
2
+ export { O as OUIAcknowledgment, a as OUIActionHandler, b as OUIObservationHandler, c as OUIResultHandler, e as OUITransportConfig, S as SocketLike, f as createWebSocketTransport } from '../websocket-Bf7xMzs1.js';
3
+ import '../types-DLOa7CWj.js';
4
4
 
5
5
  /**
6
6
  * Direct transport — for same-process communication.
@@ -1,4 +1,4 @@
1
1
  export { createDirectTransportPair } from '../chunk-IIZ6HL2L.js';
2
- export { createWebSocketTransport } from '../chunk-R3SGP2UY.js';
2
+ export { createWebSocketTransport } from '../chunk-NXDPC3KW.js';
3
3
  //# sourceMappingURL=index.js.map
4
4
  //# sourceMappingURL=index.js.map
@@ -254,10 +254,12 @@ interface OUIActionIndexEntry {
254
254
  maxDurationMs?: number;
255
255
  /** What it takes, in one line (`summarizeInput`): "none", "value: number 0–100", "clipId, start?, +4 more". */
256
256
  input: string;
257
- /** A hash of the full definition: a fetched definition is good until this changes. */
257
+ /**
258
+ * A hash of the full definition: a fetched definition is good until this
259
+ * changes. Opaque to a reader, which only compares it with the same action's
260
+ * earlier one: 8 hex digits since 0.8, 16 before.
261
+ */
258
262
  definitionHash: string;
259
- /** The full definition's size in bytes of JSON, so a reader knows to ask for it in outline. */
260
- definitionBytes: number;
261
263
  }
262
264
  /** A surface as a snapshot and an answer carry it in index form: its actions as index entries. */
263
265
  interface OUISurfaceIndex {
@@ -309,6 +311,15 @@ interface OUIActionRequest {
309
311
  params: Record<string, unknown>;
310
312
  /** Timestamp of the request */
311
313
  timestamp: number;
314
+ /**
315
+ * The turn of the agent's work this request belongs to. A client that runs
316
+ * one turn at a time accepts a request only for its current turn (`accept`),
317
+ * so a request sent late by a turn the person has stopped or superseded does
318
+ * not run under their newer instruction. Optional: an agent runtime that
319
+ * does not know of turns sends none, and a client then applies whatever rule
320
+ * it had without it.
321
+ */
322
+ turnId?: string;
312
323
  /**
313
324
  * The user's approval this request runs on, for an action that needs one.
314
325
  * The surface runtime runs such an action only when this matches a grant
@@ -254,10 +254,12 @@ interface OUIActionIndexEntry {
254
254
  maxDurationMs?: number;
255
255
  /** What it takes, in one line (`summarizeInput`): "none", "value: number 0–100", "clipId, start?, +4 more". */
256
256
  input: string;
257
- /** A hash of the full definition: a fetched definition is good until this changes. */
257
+ /**
258
+ * A hash of the full definition: a fetched definition is good until this
259
+ * changes. Opaque to a reader, which only compares it with the same action's
260
+ * earlier one: 8 hex digits since 0.8, 16 before.
261
+ */
258
262
  definitionHash: string;
259
- /** The full definition's size in bytes of JSON, so a reader knows to ask for it in outline. */
260
- definitionBytes: number;
261
263
  }
262
264
  /** A surface as a snapshot and an answer carry it in index form: its actions as index entries. */
263
265
  interface OUISurfaceIndex {
@@ -309,6 +311,15 @@ interface OUIActionRequest {
309
311
  params: Record<string, unknown>;
310
312
  /** Timestamp of the request */
311
313
  timestamp: number;
314
+ /**
315
+ * The turn of the agent's work this request belongs to. A client that runs
316
+ * one turn at a time accepts a request only for its current turn (`accept`),
317
+ * so a request sent late by a turn the person has stopped or superseded does
318
+ * not run under their newer instruction. Optional: an agent runtime that
319
+ * does not know of turns sends none, and a client then applies whatever rule
320
+ * it had without it.
321
+ */
322
+ turnId?: string;
312
323
  /**
313
324
  * The user's approval this request runs on, for an action that needs one.
314
325
  * The surface runtime runs such an action only when this matches a grant
@@ -1,4 +1,4 @@
1
- import { d as OUIActionRequest, e as OUIActionResult, o as OUIObservationUpdate, r as OUISurface } from './types-CnlVRPFL.js';
1
+ import { d as OUIActionRequest, e as OUIActionResult, o as OUIObservationUpdate, r as OUISurface } from './types-DLOa7CWj.js';
2
2
 
3
3
  /**
4
4
  * OUI Transport — the wire protocol between agent runtime and surfaces.
@@ -1,4 +1,4 @@
1
- import { d as OUIActionRequest, e as OUIActionResult, o as OUIObservationUpdate, r as OUISurface } from './types-CnlVRPFL.cjs';
1
+ import { d as OUIActionRequest, e as OUIActionResult, o as OUIObservationUpdate, r as OUISurface } from './types-DLOa7CWj.cjs';
2
2
 
3
3
  /**
4
4
  * OUI Transport — the wire protocol between agent runtime and surfaces.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oui-spec",
3
- "version": "0.7.1",
3
+ "version": "0.10.0",
4
4
  "description": "OUI — The OpenUI Specification. A machine-readable contract for agent-controllable user interfaces.",
5
5
  "keywords": [
6
6
  "oui",
@@ -608,6 +608,7 @@ When the agent invokes an action, the runtime sends an `action:request`:
608
608
  - `params` MUST conform to the action's declared `input` schema
609
609
  - The agent runtime SHOULD validate `params` before sending; the surface MUST validate upon receipt
610
610
  - `knownSurfaces` (OPTIONAL) is the `surfacesHash` of the client's surfaces that the agent runtime already holds, from the client's snapshot (§7.3.5) or an earlier result. A runtime that holds the client's surfaces SHOULD send it (§7.3.4).
611
+ - `turnId` (OPTIONAL) names the turn of the agent's work the request belongs to. An agent runtime whose work is divided into turns that a person can stop SHOULD send it. A client MAY refuse a request whose `turnId` is not its current turn; a refused request is not run, and its receipt (§7.3.7) says it was received and not accepted. A client MUST NOT refuse a request only because it carries no `turnId`.
611
612
 
612
613
  #### 7.3.2 Action Result (Success)
613
614
 
@@ -655,6 +656,7 @@ When the agent invokes an action, the runtime sends an `action:request`:
655
656
  - If `success` is `false`, the `error` field MUST be present
656
657
  - If `success` is `true`, the `error` field MUST NOT be present
657
658
  - An async action's acknowledgment result MUST set `interim: true`; its final result MUST set `interim: false`
659
+ - An async action whose work failed MUST send its final result as a failure (`success: false`, with `error`); it MAY keep the work's own report in `data`
658
660
 
659
661
  #### 7.3.4 The Client's State After an Action
660
662
 
@@ -770,15 +772,14 @@ interface OUISurfaceIndex {
770
772
  interface OUIActionIndexEntry {
771
773
  id: string;
772
774
  title?: string;
773
- description: string; // the first sentence, at most 160 characters
775
+ description: string; // the first sentence, at most 160 characters, without an opening that only repeats the title (`Title: …`, `Press "Title": …`)
774
776
  effect?: OUIEffectKind;
775
777
  confirm?: boolean;
776
778
  async?: boolean;
777
779
  estimatedDuration?: string;
778
780
  maxDurationMs?: number; // an async action's polling limit
779
781
  input: string; // what it takes, in one line, at most 120 characters
780
- definitionHash: string; // 64-bit FNV-1a of the definition's sorted-key JSON, 16 hex digits
781
- definitionBytes: number; // the definition's size as JSON
782
+ definitionHash: string; // the first 32 bits of the 64-bit FNV-1a of the definition's sorted-key JSON, 8 hex digits
782
783
  }
783
784
  ```
784
785
 
@@ -794,6 +795,11 @@ interface OUIActionIndexEntry {
794
795
  same index.
795
796
  - An agent runtime fetches an action's definition when it needs it (§7.3.10),
796
797
  and MAY keep it until the entry's `definitionHash` changes.
798
+ - `definitionHash` is opaque to an agent runtime: it compares an action's hash
799
+ only with that action's earlier one, as strings, and MUST accept a hash of any
800
+ length (an entry made before 0.8 carries 16 hex digits and a `definitionBytes`
801
+ field, which a runtime ignores). `surfacesHash` stays 64 bits: it is compared
802
+ across the whole page.
797
803
 
798
804
  #### 7.3.9 Fitting a Frame
799
805