oui-spec 0.2.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +94 -122
- package/dist/{chunk-CVUUSPF4.js → chunk-BMCL2K74.js} +2 -2
- package/dist/chunk-BMCL2K74.js.map +1 -0
- package/dist/{chunk-MTMEW6MM.cjs → chunk-DCVVTP3V.cjs} +72 -23
- package/dist/chunk-DCVVTP3V.cjs.map +1 -0
- package/dist/chunk-DGMKSJTY.cjs +573 -0
- package/dist/chunk-DGMKSJTY.cjs.map +1 -0
- package/dist/chunk-F3SKRAGU.cjs +98 -0
- package/dist/chunk-F3SKRAGU.cjs.map +1 -0
- package/dist/{chunk-YDMGV72W.js → chunk-F3WKIRAU.js} +72 -23
- package/dist/chunk-F3WKIRAU.js.map +1 -0
- package/dist/chunk-GXTNZ44I.js +569 -0
- package/dist/chunk-GXTNZ44I.js.map +1 -0
- package/dist/chunk-IIZ6HL2L.js +89 -0
- package/dist/chunk-IIZ6HL2L.js.map +1 -0
- package/dist/chunk-NYCJZQSP.js +92 -0
- package/dist/chunk-NYCJZQSP.js.map +1 -0
- package/dist/chunk-ROGKEMLL.cjs +91 -0
- package/dist/chunk-ROGKEMLL.cjs.map +1 -0
- package/dist/{chunk-3DCIL4FV.cjs → chunk-ZKM4XWAB.cjs} +2 -2
- package/dist/chunk-ZKM4XWAB.cjs.map +1 -0
- package/dist/core/index.cjs +10 -6
- package/dist/core/index.d.cts +15 -8
- package/dist/core/index.d.ts +15 -8
- package/dist/core/index.js +3 -3
- package/dist/index.cjs +28 -12
- package/dist/index.d.cts +5 -4
- package/dist/index.d.ts +5 -4
- package/dist/index.js +5 -5
- package/dist/react/index.cjs +15 -3
- package/dist/react/index.d.cts +33 -50
- package/dist/react/index.d.ts +33 -50
- package/dist/react/index.js +1 -1
- package/dist/spec/index.cjs +2 -2
- package/dist/spec/index.d.cts +35 -7
- package/dist/spec/index.d.ts +35 -7
- package/dist/spec/index.js +1 -1
- package/dist/{define-surface-D6XPtoqu.d.cts → surface-runtime-BzIKgL_I.d.cts} +102 -2
- package/dist/{define-surface-DXBop-uB.d.ts → surface-runtime-DeByfbKg.d.ts} +102 -2
- package/dist/transport/index.cjs +4 -4
- package/dist/transport/index.d.cts +2 -2
- package/dist/transport/index.d.ts +2 -2
- package/dist/transport/index.js +2 -2
- package/dist/{websocket-CrI0yRNo.d.cts → websocket-YfWILdZ4.d.cts} +36 -18
- package/dist/{websocket-CiWvkaz_.d.ts → websocket-c5tIUWY5.d.ts} +36 -18
- package/package.json +5 -1
- package/spec/OUI-SPEC-v0.1.md +229 -155
- package/dist/chunk-2ON5IEXB.cjs +0 -167
- package/dist/chunk-2ON5IEXB.cjs.map +0 -1
- package/dist/chunk-3DCIL4FV.cjs.map +0 -1
- package/dist/chunk-5TQ6AVQH.cjs +0 -108
- package/dist/chunk-5TQ6AVQH.cjs.map +0 -1
- package/dist/chunk-CVUUSPF4.js.map +0 -1
- package/dist/chunk-HK7OXB2W.cjs +0 -157
- package/dist/chunk-HK7OXB2W.cjs.map +0 -1
- package/dist/chunk-ILUTAHUJ.js +0 -154
- package/dist/chunk-ILUTAHUJ.js.map +0 -1
- package/dist/chunk-MTMEW6MM.cjs.map +0 -1
- package/dist/chunk-O6EI77LD.js +0 -106
- package/dist/chunk-O6EI77LD.js.map +0 -1
- package/dist/chunk-UIGRLZOX.js +0 -164
- package/dist/chunk-UIGRLZOX.js.map +0 -1
- package/dist/chunk-YDMGV72W.js.map +0 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { JSONSchema, OUIActionPolling, OUIActivation, OUISurface } from './spec/index.js';
|
|
1
|
+
import { JSONSchema, OUIActionPolling, OUIActivation, OUISurface, OUISurfaceSnapshot, OUIActionRequest, OUIActionResult } from './spec/index.js';
|
|
2
|
+
import { S as SocketLike, d as OUITransportConfig } from './websocket-c5tIUWY5.js';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Nominal branding for values OUI must construct itself.
|
|
@@ -148,4 +149,103 @@ interface DefinedSurface<TContext = unknown> extends SurfaceDefinition<TContext>
|
|
|
148
149
|
getPollingConfig(actionId: string): OUIActionPolling | undefined;
|
|
149
150
|
}
|
|
150
151
|
|
|
151
|
-
|
|
152
|
+
/**
|
|
153
|
+
* The client-side surface runtime.
|
|
154
|
+
*
|
|
155
|
+
* Holds the surfaces a client has mounted, answers every action request with a
|
|
156
|
+
* result, and produces the snapshot an agent runtime works from.
|
|
157
|
+
*
|
|
158
|
+
* WHY THIS EXISTS
|
|
159
|
+
*
|
|
160
|
+
* The first integration kept no client-side record of what was mounted. Each
|
|
161
|
+
* surface hook registered itself with a server-side registry and listened for
|
|
162
|
+
* dispatches on its own. Three things followed:
|
|
163
|
+
*
|
|
164
|
+
* - The registry was the only record of what the client could do, and it lost
|
|
165
|
+
* entries: a dead socket's cleanup removed a live tab's registration, and the
|
|
166
|
+
* browser never registered again. The agent then had no UI tools at all.
|
|
167
|
+
* - Nothing answered a dispatch. The agent was told an action succeeded before
|
|
168
|
+
* the client had run it, and never saw the page an action led to.
|
|
169
|
+
* - Every hook listened independently, through two paths, so one dispatch ran
|
|
170
|
+
* twice and nothing de-duplicated it.
|
|
171
|
+
*
|
|
172
|
+
* Here the client is the record. `snapshot()` is what the client can do right
|
|
173
|
+
* now, and every request is run once, waited on until the UI settles, and
|
|
174
|
+
* answered with its result and the snapshot after it.
|
|
175
|
+
*/
|
|
176
|
+
|
|
177
|
+
interface SettleOptions {
|
|
178
|
+
/**
|
|
179
|
+
* The UI counts as settled once nothing has mounted, unmounted or changed an
|
|
180
|
+
* observation for this long, and no hold is open. Default 250 ms.
|
|
181
|
+
*/
|
|
182
|
+
quietMs?: number;
|
|
183
|
+
/** Give up waiting after this long and answer with `settled: false`. Default 5000 ms. */
|
|
184
|
+
timeoutMs?: number;
|
|
185
|
+
}
|
|
186
|
+
interface SurfaceRuntimeOptions {
|
|
187
|
+
/** The socket to answer requests on. Can be set or replaced later with `attach`. */
|
|
188
|
+
socket?: SocketLike | null;
|
|
189
|
+
/** Wire configuration for the transport the runtime builds on the socket. */
|
|
190
|
+
transport?: OUITransportConfig;
|
|
191
|
+
/**
|
|
192
|
+
* Also announce registrations and observations over the transport, for agent
|
|
193
|
+
* runtimes that keep a server-side registry. Default true.
|
|
194
|
+
*
|
|
195
|
+
* An agent runtime that takes the client's snapshot instead (sent with each
|
|
196
|
+
* turn, and returned on every result) has no use for them: set false.
|
|
197
|
+
*/
|
|
198
|
+
announce?: boolean;
|
|
199
|
+
settle?: SettleOptions;
|
|
200
|
+
/** How many answered request ids to remember, for de-duplication. Default 500. */
|
|
201
|
+
dedupeWindow?: number;
|
|
202
|
+
/**
|
|
203
|
+
* Decides whether a request that arrived on the socket may run at all. A
|
|
204
|
+
* refused request is neither run nor answered, and is logged.
|
|
205
|
+
*
|
|
206
|
+
* The server should be the only sender of action requests, but a client can
|
|
207
|
+
* also check that a request is one it expects: for example, only while its
|
|
208
|
+
* agent has a turn in progress. Requests passed to `execute` directly are
|
|
209
|
+
* not checked; they come from the application itself.
|
|
210
|
+
*/
|
|
211
|
+
accept?: (request: OUIActionRequest) => boolean;
|
|
212
|
+
}
|
|
213
|
+
interface MountedSurface {
|
|
214
|
+
readonly surfaceId: string;
|
|
215
|
+
/** Record an observation value. A no-op once unmounted. */
|
|
216
|
+
pushObservation(observationId: string, value: unknown): void;
|
|
217
|
+
/** Remove this mount. Other mounts of the same surface id are unaffected. */
|
|
218
|
+
unmount(): void;
|
|
219
|
+
}
|
|
220
|
+
interface SurfaceRuntime {
|
|
221
|
+
/**
|
|
222
|
+
* Mount a surface. `getContext` is read when an action runs, so handlers see
|
|
223
|
+
* the latest state rather than the state at mount time.
|
|
224
|
+
*
|
|
225
|
+
* Mounting the same surface id twice is allowed (React StrictMode does it on
|
|
226
|
+
* every mount); the most recent mount serves its actions.
|
|
227
|
+
*/
|
|
228
|
+
mount<TContext>(surface: DefinedSurface<TContext>, getContext: () => TContext): MountedSurface;
|
|
229
|
+
/** Answer requests arriving on this socket (null detaches). */
|
|
230
|
+
attach(socket: SocketLike | null): void;
|
|
231
|
+
/** What the client can do right now. */
|
|
232
|
+
snapshot(): OUISurfaceSnapshot;
|
|
233
|
+
/**
|
|
234
|
+
* Run a request once and resolve with its result. A request id seen before
|
|
235
|
+
* resolves with the first result instead of running again.
|
|
236
|
+
*/
|
|
237
|
+
execute(request: OUIActionRequest): Promise<OUIActionResult>;
|
|
238
|
+
/**
|
|
239
|
+
* Keep the UI unsettled until the returned function is called. For work an
|
|
240
|
+
* action starts that mounting and unmounting cannot show, such as a route's
|
|
241
|
+
* code still loading or a page fetching the data it will display.
|
|
242
|
+
*/
|
|
243
|
+
hold(): () => void;
|
|
244
|
+
/** Called whenever the snapshot changes. */
|
|
245
|
+
subscribe(listener: () => void): () => void;
|
|
246
|
+
/** Stop polling, detach from the socket and forget every mount. */
|
|
247
|
+
dispose(): void;
|
|
248
|
+
}
|
|
249
|
+
declare function createSurfaceRuntime(options?: SurfaceRuntimeOptions): SurfaceRuntime;
|
|
250
|
+
|
|
251
|
+
export { type ActionDefinition as A, type DefinedSurface as D, type MountedSurface as M, type OUIBranded as O, type SettleOptions as S, type ActionHandlerResult as a, type ActionPollingConfig as b, type ObservationDefinition as c, type SurfaceDefinition as d, type SurfaceRuntime as e, type SurfaceRuntimeOptions as f, createSurfaceRuntime as g, defineSurface as h };
|
package/dist/transport/index.cjs
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkROGKEMLL_cjs = require('../chunk-ROGKEMLL.cjs');
|
|
4
|
+
var chunkDCVVTP3V_cjs = require('../chunk-DCVVTP3V.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
Object.defineProperty(exports, "createDirectTransportPair", {
|
|
9
9
|
enumerable: true,
|
|
10
|
-
get: function () { return
|
|
10
|
+
get: function () { return chunkROGKEMLL_cjs.createDirectTransportPair; }
|
|
11
11
|
});
|
|
12
12
|
Object.defineProperty(exports, "createWebSocketTransport", {
|
|
13
13
|
enumerable: true,
|
|
14
|
-
get: function () { return
|
|
14
|
+
get: function () { return chunkDCVVTP3V_cjs.createWebSocketTransport; }
|
|
15
15
|
});
|
|
16
16
|
//# sourceMappingURL=index.cjs.map
|
|
17
17
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { O as OUIActionHandler, a as OUIObservationHandler,
|
|
1
|
+
import { c as OUITransport } from '../websocket-YfWILdZ4.cjs';
|
|
2
|
+
export { O as OUIActionHandler, a as OUIObservationHandler, b as OUIResultHandler, d as OUITransportConfig, S as SocketLike, e as createWebSocketTransport } from '../websocket-YfWILdZ4.cjs';
|
|
3
3
|
import '../spec/index.cjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { O as OUIActionHandler, a as OUIObservationHandler,
|
|
1
|
+
import { c as OUITransport } from '../websocket-c5tIUWY5.js';
|
|
2
|
+
export { O as OUIActionHandler, a as OUIObservationHandler, b as OUIResultHandler, d as OUITransportConfig, S as SocketLike, e as createWebSocketTransport } from '../websocket-c5tIUWY5.js';
|
|
3
3
|
import '../spec/index.js';
|
|
4
4
|
|
|
5
5
|
/**
|
package/dist/transport/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { createDirectTransportPair } from '../chunk-
|
|
2
|
-
export { createWebSocketTransport } from '../chunk-
|
|
1
|
+
export { createDirectTransportPair } from '../chunk-IIZ6HL2L.js';
|
|
2
|
+
export { createWebSocketTransport } from '../chunk-F3WKIRAU.js';
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,20 +1,28 @@
|
|
|
1
|
-
import { OUIObservationUpdate, OUISurface } from './spec/index.cjs';
|
|
1
|
+
import { OUIActionRequest, OUIActionResult, OUIObservationUpdate, OUISurface } from './spec/index.cjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* OUI Transport — the wire protocol between agent runtime and surfaces.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
* -
|
|
8
|
-
* -
|
|
6
|
+
* - Dispatch (runtime → client): an `OUIActionRequest`, carrying a `requestId`.
|
|
7
|
+
* - Result (client → runtime): the `OUIActionResult` for that `requestId`.
|
|
8
|
+
* - Observations (client → runtime): state updates pushed as they happen.
|
|
9
|
+
* - Surface lifecycle (client → runtime): registration, for runtimes that keep
|
|
10
|
+
* a server-side registry. A runtime can instead take the client's snapshot.
|
|
9
11
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
+
* Every dispatch is answered by exactly one result. An earlier version of this
|
|
13
|
+
* transport had no correlation id and no result channel, so an agent could
|
|
14
|
+
* never learn whether its action ran, and was told it succeeded before the
|
|
15
|
+
* client had done anything.
|
|
12
16
|
*/
|
|
13
17
|
interface OUITransport {
|
|
14
|
-
/**
|
|
15
|
-
dispatch(
|
|
16
|
-
/** Receive
|
|
18
|
+
/** Send an action request to the client. */
|
|
19
|
+
dispatch(request: OUIActionRequest): void;
|
|
20
|
+
/** Receive action requests (client side). */
|
|
17
21
|
onAction(handler: OUIActionHandler): () => void;
|
|
22
|
+
/** Answer an action request (client side). */
|
|
23
|
+
sendResult(result: OUIActionResult): void;
|
|
24
|
+
/** Receive action results (runtime side). */
|
|
25
|
+
onResult(handler: OUIResultHandler): () => void;
|
|
18
26
|
/** Push an observation update from the surface to the agent runtime */
|
|
19
27
|
pushObservation(update: OUIObservationUpdate): void;
|
|
20
28
|
/** Receive observation updates (runtime/server side) */
|
|
@@ -29,11 +37,20 @@ interface OUITransport {
|
|
|
29
37
|
onSurfaceDeregister(handler: (surfaceId: string) => void): () => void;
|
|
30
38
|
readonly connected: boolean;
|
|
31
39
|
connect(): Promise<void>;
|
|
40
|
+
/** Disconnect the underlying socket. The integrator owns the socket: prefer `dispose`. */
|
|
32
41
|
disconnect(): void;
|
|
33
42
|
onConnectionChange(handler: (connected: boolean) => void): () => void;
|
|
43
|
+
/**
|
|
44
|
+
* Detach every listener this transport attached to its socket, and leave the
|
|
45
|
+
* socket connected. A socket outlives the transports built on it; without
|
|
46
|
+
* this, each one leaked its connection listeners onto the shared socket.
|
|
47
|
+
*/
|
|
48
|
+
dispose(): void;
|
|
34
49
|
}
|
|
35
|
-
/** Handler for incoming action
|
|
36
|
-
type OUIActionHandler = (
|
|
50
|
+
/** Handler for incoming action requests (client side) */
|
|
51
|
+
type OUIActionHandler = (request: OUIActionRequest) => void;
|
|
52
|
+
/** Handler for incoming action results (runtime side) */
|
|
53
|
+
type OUIResultHandler = (result: OUIActionResult) => void;
|
|
37
54
|
/** Handler for incoming observation updates (server side) */
|
|
38
55
|
type OUIObservationHandler = (update: OUIObservationUpdate) => void;
|
|
39
56
|
/**
|
|
@@ -44,7 +61,7 @@ interface OUITransportConfig {
|
|
|
44
61
|
namespace?: string;
|
|
45
62
|
/** Connection timeout in ms */
|
|
46
63
|
connectTimeoutMs?: number;
|
|
47
|
-
/** Whether to buffer
|
|
64
|
+
/** Whether to buffer outbound messages while disconnected */
|
|
48
65
|
bufferWhileDisconnected?: boolean;
|
|
49
66
|
/** Max buffer size (messages dropped after this) */
|
|
50
67
|
maxBufferSize?: number;
|
|
@@ -54,11 +71,12 @@ interface OUITransportConfig {
|
|
|
54
71
|
* WebSocket transport using Socket.IO.
|
|
55
72
|
* Maps OUI protocol events to socket events with a configurable namespace prefix.
|
|
56
73
|
*
|
|
57
|
-
* Events
|
|
58
|
-
* {ns}:dispatch
|
|
59
|
-
* {ns}:
|
|
60
|
-
* {ns}:
|
|
61
|
-
* {ns}:surface:
|
|
74
|
+
* Events:
|
|
75
|
+
* {ns}:dispatch — action request (runtime → client)
|
|
76
|
+
* {ns}:action:result — action result (client → runtime)
|
|
77
|
+
* {ns}:observation — observation (client → runtime)
|
|
78
|
+
* {ns}:surface:register — registration (client → runtime)
|
|
79
|
+
* {ns}:surface:deregister — deregistration (client → runtime)
|
|
62
80
|
*/
|
|
63
81
|
declare function createWebSocketTransport(socket: SocketLike, config?: OUITransportConfig): OUITransport;
|
|
64
82
|
/**
|
|
@@ -75,4 +93,4 @@ interface SocketLike {
|
|
|
75
93
|
disconnect?(): void;
|
|
76
94
|
}
|
|
77
95
|
|
|
78
|
-
export { type OUIActionHandler as O, type SocketLike as S, type OUIObservationHandler as a, type
|
|
96
|
+
export { type OUIActionHandler as O, type SocketLike as S, type OUIObservationHandler as a, type OUIResultHandler as b, type OUITransport as c, type OUITransportConfig as d, createWebSocketTransport as e };
|
|
@@ -1,20 +1,28 @@
|
|
|
1
|
-
import { OUIObservationUpdate, OUISurface } from './spec/index.js';
|
|
1
|
+
import { OUIActionRequest, OUIActionResult, OUIObservationUpdate, OUISurface } from './spec/index.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* OUI Transport — the wire protocol between agent runtime and surfaces.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
* -
|
|
8
|
-
* -
|
|
6
|
+
* - Dispatch (runtime → client): an `OUIActionRequest`, carrying a `requestId`.
|
|
7
|
+
* - Result (client → runtime): the `OUIActionResult` for that `requestId`.
|
|
8
|
+
* - Observations (client → runtime): state updates pushed as they happen.
|
|
9
|
+
* - Surface lifecycle (client → runtime): registration, for runtimes that keep
|
|
10
|
+
* a server-side registry. A runtime can instead take the client's snapshot.
|
|
9
11
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
+
* Every dispatch is answered by exactly one result. An earlier version of this
|
|
13
|
+
* transport had no correlation id and no result channel, so an agent could
|
|
14
|
+
* never learn whether its action ran, and was told it succeeded before the
|
|
15
|
+
* client had done anything.
|
|
12
16
|
*/
|
|
13
17
|
interface OUITransport {
|
|
14
|
-
/**
|
|
15
|
-
dispatch(
|
|
16
|
-
/** Receive
|
|
18
|
+
/** Send an action request to the client. */
|
|
19
|
+
dispatch(request: OUIActionRequest): void;
|
|
20
|
+
/** Receive action requests (client side). */
|
|
17
21
|
onAction(handler: OUIActionHandler): () => void;
|
|
22
|
+
/** Answer an action request (client side). */
|
|
23
|
+
sendResult(result: OUIActionResult): void;
|
|
24
|
+
/** Receive action results (runtime side). */
|
|
25
|
+
onResult(handler: OUIResultHandler): () => void;
|
|
18
26
|
/** Push an observation update from the surface to the agent runtime */
|
|
19
27
|
pushObservation(update: OUIObservationUpdate): void;
|
|
20
28
|
/** Receive observation updates (runtime/server side) */
|
|
@@ -29,11 +37,20 @@ interface OUITransport {
|
|
|
29
37
|
onSurfaceDeregister(handler: (surfaceId: string) => void): () => void;
|
|
30
38
|
readonly connected: boolean;
|
|
31
39
|
connect(): Promise<void>;
|
|
40
|
+
/** Disconnect the underlying socket. The integrator owns the socket: prefer `dispose`. */
|
|
32
41
|
disconnect(): void;
|
|
33
42
|
onConnectionChange(handler: (connected: boolean) => void): () => void;
|
|
43
|
+
/**
|
|
44
|
+
* Detach every listener this transport attached to its socket, and leave the
|
|
45
|
+
* socket connected. A socket outlives the transports built on it; without
|
|
46
|
+
* this, each one leaked its connection listeners onto the shared socket.
|
|
47
|
+
*/
|
|
48
|
+
dispose(): void;
|
|
34
49
|
}
|
|
35
|
-
/** Handler for incoming action
|
|
36
|
-
type OUIActionHandler = (
|
|
50
|
+
/** Handler for incoming action requests (client side) */
|
|
51
|
+
type OUIActionHandler = (request: OUIActionRequest) => void;
|
|
52
|
+
/** Handler for incoming action results (runtime side) */
|
|
53
|
+
type OUIResultHandler = (result: OUIActionResult) => void;
|
|
37
54
|
/** Handler for incoming observation updates (server side) */
|
|
38
55
|
type OUIObservationHandler = (update: OUIObservationUpdate) => void;
|
|
39
56
|
/**
|
|
@@ -44,7 +61,7 @@ interface OUITransportConfig {
|
|
|
44
61
|
namespace?: string;
|
|
45
62
|
/** Connection timeout in ms */
|
|
46
63
|
connectTimeoutMs?: number;
|
|
47
|
-
/** Whether to buffer
|
|
64
|
+
/** Whether to buffer outbound messages while disconnected */
|
|
48
65
|
bufferWhileDisconnected?: boolean;
|
|
49
66
|
/** Max buffer size (messages dropped after this) */
|
|
50
67
|
maxBufferSize?: number;
|
|
@@ -54,11 +71,12 @@ interface OUITransportConfig {
|
|
|
54
71
|
* WebSocket transport using Socket.IO.
|
|
55
72
|
* Maps OUI protocol events to socket events with a configurable namespace prefix.
|
|
56
73
|
*
|
|
57
|
-
* Events
|
|
58
|
-
* {ns}:dispatch
|
|
59
|
-
* {ns}:
|
|
60
|
-
* {ns}:
|
|
61
|
-
* {ns}:surface:
|
|
74
|
+
* Events:
|
|
75
|
+
* {ns}:dispatch — action request (runtime → client)
|
|
76
|
+
* {ns}:action:result — action result (client → runtime)
|
|
77
|
+
* {ns}:observation — observation (client → runtime)
|
|
78
|
+
* {ns}:surface:register — registration (client → runtime)
|
|
79
|
+
* {ns}:surface:deregister — deregistration (client → runtime)
|
|
62
80
|
*/
|
|
63
81
|
declare function createWebSocketTransport(socket: SocketLike, config?: OUITransportConfig): OUITransport;
|
|
64
82
|
/**
|
|
@@ -75,4 +93,4 @@ interface SocketLike {
|
|
|
75
93
|
disconnect?(): void;
|
|
76
94
|
}
|
|
77
95
|
|
|
78
|
-
export { type OUIActionHandler as O, type SocketLike as S, type OUIObservationHandler as a, type
|
|
96
|
+
export { type OUIActionHandler as O, type SocketLike as S, type OUIObservationHandler as a, type OUIResultHandler as b, type OUITransport as c, type OUITransportConfig as d, createWebSocketTransport as e };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oui-spec",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "OUI — The OpenUI Specification. A machine-readable contract for agent-controllable user interfaces.",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -86,14 +86,18 @@
|
|
|
86
86
|
}
|
|
87
87
|
},
|
|
88
88
|
"devDependencies": {
|
|
89
|
+
"@testing-library/react": "^16.3.3",
|
|
89
90
|
"@types/react": "^19.0.0",
|
|
91
|
+
"@types/react-dom": "^19.3.0",
|
|
90
92
|
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
|
91
93
|
"@typescript-eslint/parser": "^8.0.0",
|
|
92
94
|
"eslint": "^9.0.0",
|
|
93
95
|
"husky": "^9.1.7",
|
|
96
|
+
"jsdom": "^26.1.0",
|
|
94
97
|
"lint-staged": "^16.4.0",
|
|
95
98
|
"prettier": "^3.9.6",
|
|
96
99
|
"react": "^19.0.0",
|
|
100
|
+
"react-dom": "^19.3.0",
|
|
97
101
|
"tsup": "^8.4.0",
|
|
98
102
|
"typescript": "^5.8.0",
|
|
99
103
|
"vitest": "^3.0.0"
|