oui-spec 0.8.0 → 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 +2 -1
  2. package/dist/{chunk-5UUJ3F7C.cjs → chunk-2FFUDX2L.cjs} +5 -3
  3. package/dist/chunk-2FFUDX2L.cjs.map +1 -0
  4. package/dist/{chunk-JRXQLNUL.js → chunk-JOWXACVF.js} +2 -2
  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-63T6SSPP.cjs → chunk-OJ6Y2WWS.cjs} +2 -2
  9. package/dist/chunk-OJ6Y2WWS.cjs.map +1 -0
  10. package/dist/{chunk-3MISAULT.js → chunk-UNQZXT7C.js} +16 -6
  11. package/dist/chunk-UNQZXT7C.js.map +1 -0
  12. package/dist/{chunk-DLO56KLG.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 +44 -40
  19. package/dist/index.d.cts +4 -4
  20. package/dist/index.d.ts +4 -4
  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 +34 -34
  25. package/dist/spec/index.d.cts +2 -2
  26. package/dist/spec/index.d.ts +2 -2
  27. package/dist/spec/index.js +1 -1
  28. package/dist/{surface-runtime-BsRS0EV1.d.ts → surface-runtime-B6NED8eV.d.ts} +15 -5
  29. package/dist/{surface-runtime-bXSSONF4.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-D4czecOw.d.ts → types-DLOa7CWj.d.cts} +9 -0
  35. package/dist/{types-D4czecOw.d.cts → types-DLOa7CWj.d.ts} +9 -0
  36. package/dist/{websocket-BcWDNt_V.d.ts → websocket-Bf7xMzs1.d.ts} +1 -1
  37. package/dist/{websocket-EzQq1mxO.d.cts → websocket-CoSpb5nB.d.cts} +1 -1
  38. package/package.json +1 -1
  39. package/spec/OUI-SPEC-v0.1.md +2 -0
  40. package/dist/chunk-3MISAULT.js.map +0 -1
  41. package/dist/chunk-5UUJ3F7C.cjs.map +0 -1
  42. package/dist/chunk-63T6SSPP.cjs.map +0 -1
  43. package/dist/chunk-DLO56KLG.cjs.map +0 -1
  44. package/dist/chunk-JRXQLNUL.js.map +0 -1
  45. package/dist/chunk-R3SGP2UY.js.map +0 -1
@@ -1,8 +1,8 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode } from 'react';
3
- import { e as OUIActionResult } from '../types-D4czecOw.cjs';
4
- import { f as SurfaceRuntime, e as SurfaceForm, D as DefinedSurface } from '../surface-runtime-bXSSONF4.cjs';
5
- import '../websocket-EzQq1mxO.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-D4czecOw.js';
4
- import { f as SurfaceRuntime, e as SurfaceForm, D as DefinedSurface } from '../surface-runtime-BsRS0EV1.js';
5
- import '../websocket-BcWDNt_V.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,140 +1,140 @@
1
1
  'use strict';
2
2
 
3
- var chunk63T6SSPP_cjs = require('../chunk-63T6SSPP.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 chunk63T6SSPP_cjs.ARGS_HASH_PATTERN; }
9
+ get: function () { return chunkOJ6Y2WWS_cjs.ARGS_HASH_PATTERN; }
10
10
  });
11
11
  Object.defineProperty(exports, "DEFINITION_HASH_HEX", {
12
12
  enumerable: true,
13
- get: function () { return chunk63T6SSPP_cjs.DEFINITION_HASH_HEX; }
13
+ get: function () { return chunkOJ6Y2WWS_cjs.DEFINITION_HASH_HEX; }
14
14
  });
15
15
  Object.defineProperty(exports, "FIT_LIST_STEPS", {
16
16
  enumerable: true,
17
- get: function () { return chunk63T6SSPP_cjs.FIT_LIST_STEPS; }
17
+ get: function () { return chunkOJ6Y2WWS_cjs.FIT_LIST_STEPS; }
18
18
  });
19
19
  Object.defineProperty(exports, "FIT_TEXT_CHARS", {
20
20
  enumerable: true,
21
- get: function () { return chunk63T6SSPP_cjs.FIT_TEXT_CHARS; }
21
+ get: function () { return chunkOJ6Y2WWS_cjs.FIT_TEXT_CHARS; }
22
22
  });
23
23
  Object.defineProperty(exports, "INDEX_DESCRIPTION_CHARS", {
24
24
  enumerable: true,
25
- get: function () { return chunk63T6SSPP_cjs.INDEX_DESCRIPTION_CHARS; }
25
+ get: function () { return chunkOJ6Y2WWS_cjs.INDEX_DESCRIPTION_CHARS; }
26
26
  });
27
27
  Object.defineProperty(exports, "INDEX_INPUT_CHARS", {
28
28
  enumerable: true,
29
- get: function () { return chunk63T6SSPP_cjs.INDEX_INPUT_CHARS; }
29
+ get: function () { return chunkOJ6Y2WWS_cjs.INDEX_INPUT_CHARS; }
30
30
  });
31
31
  Object.defineProperty(exports, "INDEX_INPUT_PROPERTIES", {
32
32
  enumerable: true,
33
- get: function () { return chunk63T6SSPP_cjs.INDEX_INPUT_PROPERTIES; }
33
+ get: function () { return chunkOJ6Y2WWS_cjs.INDEX_INPUT_PROPERTIES; }
34
34
  });
35
35
  Object.defineProperty(exports, "OUI_DESCRIBE_ACTION", {
36
36
  enumerable: true,
37
- get: function () { return chunk63T6SSPP_cjs.OUI_DESCRIBE_ACTION; }
37
+ get: function () { return chunkOJ6Y2WWS_cjs.OUI_DESCRIBE_ACTION; }
38
38
  });
39
39
  Object.defineProperty(exports, "OUI_EFFECT_ACCESS", {
40
40
  enumerable: true,
41
- get: function () { return chunk63T6SSPP_cjs.OUI_EFFECT_ACCESS; }
41
+ get: function () { return chunkOJ6Y2WWS_cjs.OUI_EFFECT_ACCESS; }
42
42
  });
43
43
  Object.defineProperty(exports, "OUI_EFFECT_KINDS", {
44
44
  enumerable: true,
45
- get: function () { return chunk63T6SSPP_cjs.OUI_EFFECT_KINDS; }
45
+ get: function () { return chunkOJ6Y2WWS_cjs.OUI_EFFECT_KINDS; }
46
46
  });
47
47
  Object.defineProperty(exports, "OUI_PROTOCOL_EVENTS", {
48
48
  enumerable: true,
49
- get: function () { return chunk63T6SSPP_cjs.OUI_PROTOCOL_EVENTS; }
49
+ get: function () { return chunkOJ6Y2WWS_cjs.OUI_PROTOCOL_EVENTS; }
50
50
  });
51
51
  Object.defineProperty(exports, "OUI_READ_ACTION", {
52
52
  enumerable: true,
53
- get: function () { return chunk63T6SSPP_cjs.OUI_READ_ACTION; }
53
+ get: function () { return chunkOJ6Y2WWS_cjs.OUI_READ_ACTION; }
54
54
  });
55
55
  Object.defineProperty(exports, "OUI_RUNTIME_SURFACE", {
56
56
  enumerable: true,
57
- get: function () { return chunk63T6SSPP_cjs.OUI_RUNTIME_SURFACE; }
57
+ get: function () { return chunkOJ6Y2WWS_cjs.OUI_RUNTIME_SURFACE; }
58
58
  });
59
59
  Object.defineProperty(exports, "argsHash", {
60
60
  enumerable: true,
61
- get: function () { return chunk63T6SSPP_cjs.argsHash; }
61
+ get: function () { return chunkOJ6Y2WWS_cjs.argsHash; }
62
62
  });
63
63
  Object.defineProperty(exports, "atPointer", {
64
64
  enumerable: true,
65
- get: function () { return chunk63T6SSPP_cjs.atPointer; }
65
+ get: function () { return chunkOJ6Y2WWS_cjs.atPointer; }
66
66
  });
67
67
  Object.defineProperty(exports, "canonicalJson", {
68
68
  enumerable: true,
69
- get: function () { return chunk63T6SSPP_cjs.canonicalJson; }
69
+ get: function () { return chunkOJ6Y2WWS_cjs.canonicalJson; }
70
70
  });
71
71
  Object.defineProperty(exports, "constantOf", {
72
72
  enumerable: true,
73
- get: function () { return chunk63T6SSPP_cjs.constantOf; }
73
+ get: function () { return chunkOJ6Y2WWS_cjs.constantOf; }
74
74
  });
75
75
  Object.defineProperty(exports, "definitionHash", {
76
76
  enumerable: true,
77
- get: function () { return chunk63T6SSPP_cjs.definitionHash; }
77
+ get: function () { return chunkOJ6Y2WWS_cjs.definitionHash; }
78
78
  });
79
79
  Object.defineProperty(exports, "discriminatorOf", {
80
80
  enumerable: true,
81
- get: function () { return chunk63T6SSPP_cjs.discriminatorOf; }
81
+ get: function () { return chunkOJ6Y2WWS_cjs.discriminatorOf; }
82
82
  });
83
83
  Object.defineProperty(exports, "effectAccess", {
84
84
  enumerable: true,
85
- get: function () { return chunk63T6SSPP_cjs.effectAccess; }
85
+ get: function () { return chunkOJ6Y2WWS_cjs.effectAccess; }
86
86
  });
87
87
  Object.defineProperty(exports, "firstSentence", {
88
88
  enumerable: true,
89
- get: function () { return chunk63T6SSPP_cjs.firstSentence; }
89
+ get: function () { return chunkOJ6Y2WWS_cjs.firstSentence; }
90
90
  });
91
91
  Object.defineProperty(exports, "fitObservations", {
92
92
  enumerable: true,
93
- get: function () { return chunk63T6SSPP_cjs.fitObservations; }
93
+ get: function () { return chunkOJ6Y2WWS_cjs.fitObservations; }
94
94
  });
95
95
  Object.defineProperty(exports, "indexEntry", {
96
96
  enumerable: true,
97
- get: function () { return chunk63T6SSPP_cjs.indexEntry; }
97
+ get: function () { return chunkOJ6Y2WWS_cjs.indexEntry; }
98
98
  });
99
99
  Object.defineProperty(exports, "jsonBytes", {
100
100
  enumerable: true,
101
- get: function () { return chunk63T6SSPP_cjs.jsonBytes; }
101
+ get: function () { return chunkOJ6Y2WWS_cjs.jsonBytes; }
102
102
  });
103
103
  Object.defineProperty(exports, "pointerStep", {
104
104
  enumerable: true,
105
- get: function () { return chunk63T6SSPP_cjs.pointerStep; }
105
+ get: function () { return chunkOJ6Y2WWS_cjs.pointerStep; }
106
106
  });
107
107
  Object.defineProperty(exports, "pointerSteps", {
108
108
  enumerable: true,
109
- get: function () { return chunk63T6SSPP_cjs.pointerSteps; }
109
+ get: function () { return chunkOJ6Y2WWS_cjs.pointerSteps; }
110
110
  });
111
111
  Object.defineProperty(exports, "requiresApproval", {
112
112
  enumerable: true,
113
- get: function () { return chunk63T6SSPP_cjs.requiresApproval; }
113
+ get: function () { return chunkOJ6Y2WWS_cjs.requiresApproval; }
114
114
  });
115
115
  Object.defineProperty(exports, "sortedJson", {
116
116
  enumerable: true,
117
- get: function () { return chunk63T6SSPP_cjs.sortedJson; }
117
+ get: function () { return chunkOJ6Y2WWS_cjs.sortedJson; }
118
118
  });
119
119
  Object.defineProperty(exports, "summarizeInput", {
120
120
  enumerable: true,
121
- get: function () { return chunk63T6SSPP_cjs.summarizeInput; }
121
+ get: function () { return chunkOJ6Y2WWS_cjs.summarizeInput; }
122
122
  });
123
123
  Object.defineProperty(exports, "surfaceIndex", {
124
124
  enumerable: true,
125
- get: function () { return chunk63T6SSPP_cjs.surfaceIndex; }
125
+ get: function () { return chunkOJ6Y2WWS_cjs.surfaceIndex; }
126
126
  });
127
127
  Object.defineProperty(exports, "surfacesHash", {
128
128
  enumerable: true,
129
- get: function () { return chunk63T6SSPP_cjs.surfacesHash; }
129
+ get: function () { return chunkOJ6Y2WWS_cjs.surfacesHash; }
130
130
  });
131
131
  Object.defineProperty(exports, "utf8Length", {
132
132
  enumerable: true,
133
- get: function () { return chunk63T6SSPP_cjs.utf8Length; }
133
+ get: function () { return chunkOJ6Y2WWS_cjs.utf8Length; }
134
134
  });
135
135
  Object.defineProperty(exports, "withoutTitleLeadIn", {
136
136
  enumerable: true,
137
- get: function () { return chunk63T6SSPP_cjs.withoutTitleLeadIn; }
137
+ get: function () { return chunkOJ6Y2WWS_cjs.withoutTitleLeadIn; }
138
138
  });
139
139
  //# sourceMappingURL=index.cjs.map
140
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-D4czecOw.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-D4czecOw.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
@@ -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-D4czecOw.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-D4czecOw.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
@@ -1,3 +1,3 @@
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-JRXQLNUL.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-D4czecOw.js';
2
- import { S as SocketLike, e as OUITransportConfig } from './websocket-BcWDNt_V.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-D4czecOw.cjs';
2
- import { S as SocketLike, e as OUITransportConfig } from './websocket-EzQq1mxO.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-EzQq1mxO.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-EzQq1mxO.cjs';
3
- import '../types-D4czecOw.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-BcWDNt_V.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-BcWDNt_V.js';
3
- import '../types-D4czecOw.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
@@ -311,6 +311,15 @@ interface OUIActionRequest {
311
311
  params: Record<string, unknown>;
312
312
  /** Timestamp of the request */
313
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;
314
323
  /**
315
324
  * The user's approval this request runs on, for an action that needs one.
316
325
  * The surface runtime runs such an action only when this matches a grant
@@ -311,6 +311,15 @@ interface OUIActionRequest {
311
311
  params: Record<string, unknown>;
312
312
  /** Timestamp of the request */
313
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;
314
323
  /**
315
324
  * The user's approval this request runs on, for an action that needs one.
316
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-D4czecOw.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-D4czecOw.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.8.0",
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