@ouispec/agent-events 0.1.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 (56) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +36 -0
  3. package/dist/catalog.d.ts +110 -0
  4. package/dist/catalog.d.ts.map +1 -0
  5. package/dist/catalog.js +289 -0
  6. package/dist/catalog.js.map +1 -0
  7. package/dist/cli.d.ts +3 -0
  8. package/dist/cli.d.ts.map +1 -0
  9. package/dist/cli.js +78 -0
  10. package/dist/cli.js.map +1 -0
  11. package/dist/codegen.d.ts +28 -0
  12. package/dist/codegen.d.ts.map +1 -0
  13. package/dist/codegen.js +99 -0
  14. package/dist/codegen.js.map +1 -0
  15. package/dist/event-declarations.v1.schema.json +316 -0
  16. package/dist/index.d.ts +27 -0
  17. package/dist/index.d.ts.map +1 -0
  18. package/dist/index.js +8 -0
  19. package/dist/index.js.map +1 -0
  20. package/dist/json-schema-lite.d.ts +15 -0
  21. package/dist/json-schema-lite.d.ts.map +1 -0
  22. package/dist/json-schema-lite.js +144 -0
  23. package/dist/json-schema-lite.js.map +1 -0
  24. package/dist/oui-wire.d.ts +8 -0
  25. package/dist/oui-wire.d.ts.map +1 -0
  26. package/dist/oui-wire.js +33 -0
  27. package/dist/oui-wire.js.map +1 -0
  28. package/dist/payload-shape.d.ts +21 -0
  29. package/dist/payload-shape.d.ts.map +1 -0
  30. package/dist/payload-shape.js +47 -0
  31. package/dist/payload-shape.js.map +1 -0
  32. package/dist/platform.d.ts +20 -0
  33. package/dist/platform.d.ts.map +1 -0
  34. package/dist/platform.js +109 -0
  35. package/dist/platform.js.map +1 -0
  36. package/dist/rooms.d.ts +21 -0
  37. package/dist/rooms.d.ts.map +1 -0
  38. package/dist/rooms.js +47 -0
  39. package/dist/rooms.js.map +1 -0
  40. package/dist/schema.d.ts +9 -0
  41. package/dist/schema.d.ts.map +1 -0
  42. package/dist/schema.js +26 -0
  43. package/dist/schema.js.map +1 -0
  44. package/dist/settlement.d.ts +43 -0
  45. package/dist/settlement.d.ts.map +1 -0
  46. package/dist/settlement.js +2 -0
  47. package/dist/settlement.js.map +1 -0
  48. package/dist/types.d.ts +23 -0
  49. package/dist/types.d.ts.map +1 -0
  50. package/dist/types.js +14 -0
  51. package/dist/types.js.map +1 -0
  52. package/dist/validate.d.ts +8 -0
  53. package/dist/validate.d.ts.map +1 -0
  54. package/dist/validate.js +38 -0
  55. package/dist/validate.js.map +1 -0
  56. package/package.json +65 -0
@@ -0,0 +1,99 @@
1
+ /**
2
+ * @ouispec/agent-events/codegen — the TypeScript a product's code
3
+ * uses, generated from its declaration document: a type per payload, the
4
+ * name → payload map, the names, room constructors and patterns, the job
5
+ * kinds, and the document itself.
6
+ *
7
+ * The document is the authority and the types follow it, never the other way
8
+ * round: an event added to the document is a type on the next generation, and
9
+ * a name the document lacks does not type-check.
10
+ */
11
+ import { doc, literal, propertyKey, renderNamed as renderSchemaNamed, } from '@ouispec/contract/codegen';
12
+ import { createEventCatalog, defaultTypeName } from './catalog.js';
13
+ import { defName } from './payload-shape.js';
14
+ import { mapRoomPattern, roomPatternsRegExp, roomPlaceholders } from './rooms.js';
15
+ export const DEFAULT_TYPESCRIPT_NAMES = {
16
+ eventMap: 'EventMap',
17
+ eventName: 'EventName',
18
+ eventPayload: 'EventPayload',
19
+ eventNames: 'EVENT_NAMES',
20
+ isEventName: 'isEventName',
21
+ rooms: 'Room',
22
+ roomPatterns: 'ROOM_PATTERNS',
23
+ roomRegex: 'ROOM_REGEX',
24
+ isValidRoom: 'isValidRoom',
25
+ jobKinds: 'JOB_KINDS',
26
+ declarations: 'EVENT_DECLARATIONS',
27
+ };
28
+ const key = propertyKey;
29
+ /** How a payload's `$ref` names its type: the `$defs` entry it points to. */
30
+ function refName(ref) {
31
+ const name = defName(ref);
32
+ if (!name)
33
+ throw new Error(`[agent-sdk-events] codegen: $ref '${ref}' does not name an entry of $defs`);
34
+ return name;
35
+ }
36
+ /** Payload types are the product's to use as it likes: arrays render mutable, as `Array<T>`. */
37
+ const PAYLOAD_RENDERING = { refName, arrays: 'Array', maps: 'index', indexSignature: 'unknown' };
38
+ const renderNamed = (name, schema, description) => renderSchemaNamed(name, schema, description, PAYLOAD_RENDERING);
39
+ /** Render the TypeScript for one declaration document. Throws when the document is invalid. */
40
+ export function renderTypeScript(document, options) {
41
+ const catalog = createEventCatalog(document);
42
+ const n = { ...DEFAULT_TYPESCRIPT_NAMES, ...options.names };
43
+ const typesFrom = options.typesFrom ?? '@ouispec/agent-events';
44
+ const events = Object.keys(document.events).map((name) => catalog.get(name));
45
+ const rooms = Object.entries(document.rooms);
46
+ let out = `// GENERATED FILE — DO NOT EDIT.\n//\n${options.source
47
+ .split('\n')
48
+ .map((l) => `// ${l}`.trimEnd())
49
+ .join('\n')}\n\nimport type { EventDeclarationDocument } from '${typesFrom}';\n`;
50
+ out += '\n// ─── Shared payload shapes ($defs) ───────────────────────────────────────────\n\n';
51
+ for (const [name, schema] of Object.entries(document.$defs ?? {}))
52
+ out += `${renderNamed(name, schema, undefined)}\n`;
53
+ out += '// ─── Payloads ────────────────────────────────────────────────────────────────\n\n';
54
+ for (const event of events) {
55
+ out += `${renderNamed(event.typeName, event.payload, `\`${event.name}\` (${event.role}). ${event.description}`)}\n`;
56
+ }
57
+ out += '// ─── Events ──────────────────────────────────────────────────────────────────\n\n';
58
+ out += `/** Every event ${document.product} declares, mapped to its payload. */\n`;
59
+ out += `export interface ${n.eventMap} {\n${events.map((e) => ` '${e.name}': ${e.typeName};`).join('\n')}\n}\n\n`;
60
+ out += `export type ${n.eventName} = keyof ${n.eventMap};\n\n`;
61
+ out += `export type ${n.eventPayload}<E extends ${n.eventName}> = ${n.eventMap}[E];\n\n`;
62
+ out += `/** Every declared name, in declaration order. */\n`;
63
+ out += `export const ${n.eventNames} = [\n${events.map((e) => ` '${e.name}',`).join('\n')}\n] as const satisfies readonly ${n.eventName}[];\n\n`;
64
+ out += `export function ${n.isEventName}(value: string): value is ${n.eventName} {\n return (${n.eventNames} as readonly string[]).includes(value);\n}\n`;
65
+ out += '\n// ─── Rooms ───────────────────────────────────────────────────────────────────\n\n';
66
+ out += `/** Every declared room, as its pattern. */\n`;
67
+ out += `export const ${n.roomPatterns} = {\n${rooms.map(([name, r]) => ` ${key(name)}: '${r.pattern}',`).join('\n')}\n} as const;\n\n`;
68
+ out += `/** A constructor for every declared room. */\n`;
69
+ out += `export const ${n.rooms} = {\n`;
70
+ for (const [name, room] of rooms) {
71
+ const params = roomPlaceholders(room.pattern);
72
+ const body = params.length
73
+ ? `\`${mapRoomPattern(room.pattern, (t) => t.replace(/[`$\\]/g, '\\$&'), (p) => `\${${p}}`)}\``
74
+ : `'${room.pattern}'`;
75
+ out += `${doc(room.description, ' ')} ${key(name)}: (${params.map((p) => `${p}: string`).join(', ')}) => ${body},\n`;
76
+ }
77
+ out += `} as const;\n\n`;
78
+ out += `/** Exactly the declared rooms. */\n`;
79
+ out += `export const ${n.roomRegex} = /${roomPatternsRegExp(rooms.map(([, r]) => r.pattern)).source.replace(/\//g, '\\/')}/;\n\n`;
80
+ out += `export function ${n.isValidRoom}(room: string): boolean {\n return ${n.roomRegex}.test(room);\n}\n`;
81
+ out += '\n// ─── Jobs ────────────────────────────────────────────────────────────────────\n\n';
82
+ out += `/** Every kind of job the events settle: its completion, its failure and the field its id is in. */\n`;
83
+ out += `export const ${n.jobKinds} = {\n`;
84
+ for (const kind of catalog.jobKinds()) {
85
+ out += ` ${key(kind.kind)}: {\n`;
86
+ out += ` completion: '${kind.completion.name}',\n`;
87
+ out += ` failure: ${kind.failure ? `'${kind.failure.name}'` : 'null'},\n`;
88
+ out += ` correlation: '${kind.correlation}',\n`;
89
+ out += ` description: ${literal(kind.completion.description)},\n`;
90
+ out += ` },\n`;
91
+ }
92
+ out += `} as const;\n`;
93
+ out += '\n// ─── The document ────────────────────────────────────────────────────────────\n\n';
94
+ out += `/** The declaration document these types were generated from. */\n`;
95
+ out += `export const ${n.declarations}: EventDeclarationDocument = ${JSON.stringify(document, null, 2)};\n`;
96
+ return out;
97
+ }
98
+ export { defaultTypeName };
99
+ //# sourceMappingURL=codegen.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codegen.js","sourceRoot":"","sources":["../src/codegen.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EACL,GAAG,EACH,OAAO,EACP,WAAW,EACX,WAAW,IAAI,iBAAiB,GAEjC,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAiBlF,MAAM,CAAC,MAAM,wBAAwB,GAAoB;IACvD,QAAQ,EAAE,UAAU;IACpB,SAAS,EAAE,WAAW;IACtB,YAAY,EAAE,cAAc;IAC5B,UAAU,EAAE,aAAa;IACzB,WAAW,EAAE,aAAa;IAC1B,KAAK,EAAE,MAAM;IACb,YAAY,EAAE,eAAe;IAC7B,SAAS,EAAE,YAAY;IACvB,WAAW,EAAE,aAAa;IAC1B,QAAQ,EAAE,WAAW;IACrB,YAAY,EAAE,oBAAoB;CACnC,CAAC;AAWF,MAAM,GAAG,GAAG,WAAW,CAAC;AAExB,6EAA6E;AAC7E,SAAS,OAAO,CAAC,GAAW;IAC1B,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;IAC1B,IAAI,CAAC,IAAI;QAAE,MAAM,IAAI,KAAK,CAAC,qCAAqC,GAAG,mCAAmC,CAAC,CAAC;IACxG,OAAO,IAAI,CAAC;AACd,CAAC;AAED,gGAAgG;AAChG,MAAM,iBAAiB,GAAkB,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,CAAC;AAEhH,MAAM,W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uC,CAAC,CAAC,SAAS,mBAAmB,CAAC;IAE7G,GAAG,IAAI,wFAAwF,CAAC;IAChG,GAAG,IAAI,uGAAuG,CAAC;IAC/G,GAAG,IAAI,gBAAgB,CAAC,CAAC,QAAQ,QAAQ,CAAC;IAC1C,KAAK,MAAM,IAAI,IAAI,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC;QACtC,GAAG,IAAI,KAAK,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC;QAClC,GAAG,IAAI,oBAAoB,IAAI,CAAC,UAAU,CAAC,IAAI,MAAM,CAAC;QACtD,GAAG,IAAI,gBAAgB,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC;QAC7E,GAAG,IAAI,qBAAqB,IAAI,CAAC,WAAW,MAAM,CAAC;QACnD,GAAG,IAAI,oBAAoB,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,KAAK,CAAC;QACrE,GAAG,IAAI,QAAQ,CAAC;IAClB,CAAC;IACD,GAAG,IAAI,eAAe,CAAC;IAEvB,GAAG,IAAI,wFAAwF,CAAC;IAChG,GAAG,IAAI,oEAAoE,CAAC;IAC5E,GAAG,IAAI,gBAAgB,CAAC,CAAC,YAAY,gCAAgC,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC;IAC5G,OAAO,GAAG,CAAC;AACb,CAAC;AAED,OAAO,EAAE,eAAe,EAAE,CAAC"}
@@ -0,0 +1,316 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://schemas.closurestudio.ai/agent-sdk/event-declarations/v1.json",
4
+ "title": "Event declarations",
5
+ "description": "Every event a product emits over realtime: its payload schema, the rooms it is published to, its correlation fields and its role in a job (ADR-0227 §2.4).",
6
+ "type": "object",
7
+ "required": [
8
+ "version",
9
+ "product",
10
+ "rooms",
11
+ "events"
12
+ ],
13
+ "additionalProperties": false,
14
+ "properties": {
15
+ "$schema": {
16
+ "type": "string"
17
+ },
18
+ "version": {
19
+ "description": "The version of this document's format.",
20
+ "const": 1
21
+ },
22
+ "product": {
23
+ "description": "Who declares these events.",
24
+ "type": "string",
25
+ "minLength": 1
26
+ },
27
+ "description": {
28
+ "type": "string"
29
+ },
30
+ "$defs": {
31
+ "description": "Payload shapes the events share, referenced as `#/$defs/<Name>`.",
32
+ "type": "object",
33
+ "propertyNames": {
34
+ "pattern": "^[A-Z][A-Za-z0-9]*$"
35
+ },
36
+ "additionalProperties": {
37
+ "$ref": "#/$defs/EventPayloadSchema"
38
+ }
39
+ },
40
+ "rooms": {
41
+ "description": "Every room these events go to, by name.",
42
+ "type": "object",
43
+ "propertyNames": {
44
+ "pattern": "^[a-z][A-Za-z0-9]*$"
45
+ },
46
+ "additionalProperties": {
47
+ "$ref": "#/$defs/RoomDeclaration"
48
+ }
49
+ },
50
+ "events": {
51
+ "description": "Every event, by its name on the wire.",
52
+ "type": "object",
53
+ "propertyNames": {
54
+ "pattern": "^[a-z][a-z0-9_-]*(:[a-z][a-z0-9_-]*)*$"
55
+ },
56
+ "additionalProperties": {
57
+ "$ref": "#/$defs/EventDeclaration"
58
+ }
59
+ }
60
+ },
61
+ "$defs": {
62
+ "JsonType": {
63
+ "description": "The JSON Schema types a payload may use.",
64
+ "enum": [
65
+ "object",
66
+ "array",
67
+ "string",
68
+ "number",
69
+ "integer",
70
+ "boolean",
71
+ "null"
72
+ ]
73
+ },
74
+ "EventPayloadSchema": {
75
+ "description": "A JSON Schema (draft 2020-12). A payload may use any keyword; the platform reads `$ref` (to the document's `$defs`), `allOf`, `type`, `properties` and `required` to find the fields it correlates and reports on, and validates the rest with a full validator.",
76
+ "type": "object",
77
+ "properties": {
78
+ "$ref": {
79
+ "type": "string"
80
+ },
81
+ "type": {
82
+ "description": "A JSON Schema type name, or a list of them.",
83
+ "$comment": "ts: JsonType | readonly JsonType[]"
84
+ },
85
+ "description": {
86
+ "type": "string"
87
+ },
88
+ "properties": {
89
+ "type": "object",
90
+ "additionalProperties": {
91
+ "$ref": "#/$defs/EventPayloadSchema"
92
+ }
93
+ },
94
+ "required": {
95
+ "type": "array",
96
+ "items": {
97
+ "type": "string"
98
+ }
99
+ },
100
+ "additionalProperties": {
101
+ "description": "`false`, or the schema every other property follows.",
102
+ "$comment": "ts: boolean | EventPayloadSchema"
103
+ },
104
+ "items": {
105
+ "$ref": "#/$defs/EventPayloadSchema"
106
+ },
107
+ "enum": {
108
+ "type": "array"
109
+ },
110
+ "const": {},
111
+ "allOf": {
112
+ "type": "array",
113
+ "items": {
114
+ "$ref": "#/$defs/EventPayloadSchema"
115
+ }
116
+ },
117
+ "anyOf": {
118
+ "type": "array",
119
+ "items": {
120
+ "$ref": "#/$defs/EventPayloadSchema"
121
+ }
122
+ },
123
+ "oneOf": {
124
+ "type": "array",
125
+ "items": {
126
+ "$ref": "#/$defs/EventPayloadSchema"
127
+ }
128
+ }
129
+ },
130
+ "additionalProperties": true
131
+ },
132
+ "RoomDeclaration": {
133
+ "type": "object",
134
+ "required": [
135
+ "pattern"
136
+ ],
137
+ "additionalProperties": false,
138
+ "properties": {
139
+ "pattern": {
140
+ "description": "The room's name with `{placeholder}`s for its ids, e.g. `generation:{jobId}`. An id is letters, digits, `_` and `-`.",
141
+ "type": "string",
142
+ "pattern": "^([a-z0-9_:-]|\\{[a-zA-Z][a-zA-Z0-9]*\\})+$"
143
+ },
144
+ "description": {
145
+ "type": "string"
146
+ }
147
+ }
148
+ },
149
+ "EventRole": {
150
+ "description": "What an event is for, as the platform acts on it:\n- `completion`: a job of kind `completes` produced its result. A wait on the job ends well.\n- `failure`: a job of kind `completes` ended without a result. A wait on the job ends with its reason.\n- `progress`: a job is still running. Nothing waits on it: resolving a wait on progress reports a running job as done.\n- `notice`: anything else a client is told.",
151
+ "enum": [
152
+ "completion",
153
+ "failure",
154
+ "progress",
155
+ "notice"
156
+ ]
157
+ },
158
+ "FailureReason": {
159
+ "description": "Where a settling event says why a job failed.",
160
+ "type": "object",
161
+ "required": [
162
+ "field",
163
+ "fallback"
164
+ ],
165
+ "additionalProperties": false,
166
+ "properties": {
167
+ "field": {
168
+ "description": "The payload field carrying the reason.",
169
+ "type": "string",
170
+ "pattern": "^[A-Za-z_][A-Za-z0-9_]*$"
171
+ },
172
+ "fallback": {
173
+ "description": "What the reason is when the field is absent.",
174
+ "type": "string",
175
+ "minLength": 1
176
+ }
177
+ }
178
+ },
179
+ "EventDeclaration": {
180
+ "type": "object",
181
+ "required": [
182
+ "description",
183
+ "payload",
184
+ "rooms",
185
+ "correlation",
186
+ "role"
187
+ ],
188
+ "additionalProperties": false,
189
+ "properties": {
190
+ "description": {
191
+ "type": "string",
192
+ "minLength": 1
193
+ },
194
+ "payload": {
195
+ "description": "The payload's JSON Schema: an object. `$ref`s point into the document's `$defs`. Every correlation, result and reason field is one of its properties.",
196
+ "$ref": "#/$defs/EventPayloadSchema"
197
+ },
198
+ "typeName": {
199
+ "description": "The name generated code gives the payload type. Default: the event name in PascalCase (`generation:completed` → `GenerationCompleted`).",
200
+ "type": "string",
201
+ "pattern": "^[A-Z][A-Za-z0-9]*$"
202
+ },
203
+ "rooms": {
204
+ "description": "The rooms the event is published to: names from the document's `rooms`, or `turn` for the room of the agent turn it belongs to (the host names that room in each turn).",
205
+ "type": "array",
206
+ "items": {
207
+ "type": "string",
208
+ "minLength": 1
209
+ },
210
+ "minItems": 1,
211
+ "uniqueItems": true
212
+ },
213
+ "correlation": {
214
+ "description": "The payload fields that say which job, or which resource, the event is about (e.g. `jobId`). A completion or failure has exactly one.",
215
+ "type": "array",
216
+ "items": {
217
+ "type": "string",
218
+ "pattern": "^[A-Za-z_][A-Za-z0-9_]*$"
219
+ },
220
+ "uniqueItems": true
221
+ },
222
+ "role": {
223
+ "$ref": "#/$defs/EventRole"
224
+ },
225
+ "completes": {
226
+ "description": "For a completion or failure: the kind of job it settles.",
227
+ "type": "string",
228
+ "pattern": "^[a-z][A-Za-z0-9]*$"
229
+ },
230
+ "result": {
231
+ "description": "For a completion: the payload fields that are the job's result, as a follower reports them.",
232
+ "type": "array",
233
+ "items": {
234
+ "type": "string",
235
+ "pattern": "^[A-Za-z_][A-Za-z0-9_]*$"
236
+ },
237
+ "uniqueItems": true
238
+ },
239
+ "reason": {
240
+ "description": "For a failure: where its reason is.",
241
+ "$ref": "#/$defs/FailureReason"
242
+ }
243
+ },
244
+ "allOf": [
245
+ {
246
+ "if": {
247
+ "properties": {
248
+ "role": {
249
+ "enum": [
250
+ "completion",
251
+ "failure"
252
+ ]
253
+ }
254
+ }
255
+ },
256
+ "then": {
257
+ "required": [
258
+ "completes"
259
+ ],
260
+ "properties": {
261
+ "correlation": {
262
+ "type": "array",
263
+ "minItems": 1,
264
+ "maxItems": 1
265
+ }
266
+ }
267
+ },
268
+ "else": {
269
+ "not": {
270
+ "required": [
271
+ "completes"
272
+ ]
273
+ }
274
+ }
275
+ },
276
+ {
277
+ "if": {
278
+ "properties": {
279
+ "role": {
280
+ "const": "completion"
281
+ }
282
+ }
283
+ },
284
+ "else": {
285
+ "not": {
286
+ "required": [
287
+ "result"
288
+ ]
289
+ }
290
+ }
291
+ },
292
+ {
293
+ "if": {
294
+ "properties": {
295
+ "role": {
296
+ "const": "failure"
297
+ }
298
+ }
299
+ },
300
+ "then": {
301
+ "required": [
302
+ "reason"
303
+ ]
304
+ },
305
+ "else": {
306
+ "not": {
307
+ "required": [
308
+ "reason"
309
+ ]
310
+ }
311
+ }
312
+ }
313
+ ]
314
+ }
315
+ }
316
+ }
@@ -0,0 +1,27 @@
1
+ /**
2
+ * @ouispec/agent-events — event contracts the product declares
3
+ * (ADR-0227 §2.4).
4
+ *
5
+ * The product supplies a declaration document: each event's payload schema,
6
+ * the rooms it goes to, its correlation fields and its role in a job. The
7
+ * platform follows it:
8
+ * - the realtime server emits and relays declared events only;
9
+ * - the worker's async tools wait on a declared completion or failure;
10
+ * - the UI's job tracker is built from it;
11
+ * - a name it does not hold fails the build.
12
+ *
13
+ * Browser-safe. Payload validation is `./validate`; TypeScript generation is
14
+ * `./codegen` and the `agent-sdk-events` CLI.
15
+ */
16
+ export type { EventDeclarationDocument, EventDeclaration, EventRole, FailureReason, RoomDeclaration, JsonSchema, JsonType, } from './types.js';
17
+ export { EVENT_DECLARATIONS_VERSION, TURN_ROOM } from './types.js';
18
+ export { EVENT_DECLARATIONS_SCHEMA, EVENT_DECLARATIONS_SCHEMA_ID, EVENT_NAME_PATTERN } from './schema.js';
19
+ export { createEventCatalog, validateEventDeclarations, defaultTypeName, EventDeclarationError, UndeclaredEventError, AsyncBindingError, } from './catalog.js';
20
+ export type { EventCatalog, DeclaredEvent, DeclaredRoom, JobKind, AsyncBinding, AsyncBindingSpec } from './catalog.js';
21
+ export type { Settlement, SettlementOutcome, SettlementRequest, EventWaiter } from './settlement.js';
22
+ export { roomPlaceholders, roomPatternsRegExp, formatRoom, ROOM_ID_CHARS } from './rooms.js';
23
+ export { payloadShape } from './payload-shape.js';
24
+ export { PLATFORM_EVENTS, AGENT_TURN_EVENTS } from './platform.js';
25
+ export { OUI_WIRE } from './oui-wire.js';
26
+ export type { OuiWire } from './oui-wire.js';
27
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,YAAY,EACV,wBAAwB,EACxB,gBAAgB,EAChB,SAAS,EACT,aAAa,EACb,eAAe,EACf,UAAU,EACV,QAAQ,GACT,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,0BAA0B,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACnE,OAAO,EAAE,yBAAyB,EAAE,4BAA4B,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAC1G,OAAO,EACL,kBAAkB,EAClB,yBAAyB,EACzB,eAAe,EACf,qBAAqB,EACrB,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,cAAc,CAAC;AACtB,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACvH,YAAY,EAAE,UAAU,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACrG,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC7F,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,YAAY,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,8 @@
1
+ export { EVENT_DECLARATIONS_VERSION, TURN_ROOM } from './types.js';
2
+ export { EVENT_DECLARATIONS_SCHEMA, EVENT_DECLARATIONS_SCHEMA_ID, EVENT_NAME_PATTERN } from './schema.js';
3
+ export { createEventCatalog, validateEventDeclarations, defaultTypeName, EventDeclarationError, UndeclaredEventError, AsyncBindingError, } from './catalog.js';
4
+ export { roomPlaceholders, roomPatternsRegExp, formatRoom, ROOM_ID_CHARS } from './rooms.js';
5
+ export { payloadShape } from './payload-shape.js';
6
+ export { PLATFORM_EVENTS, AGENT_TURN_EVENTS } from './platform.js';
7
+ export { OUI_WIRE } from './oui-wire.js';
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAwBA,OAAO,EAAE,0BAA0B,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACnE,OAAO,EAAE,yBAAyB,EAAE,4BAA4B,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAC1G,OAAO,EACL,kBAAkB,EAClB,yBAAyB,EACzB,eAAe,EACf,qBAAqB,EACrB,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,cAAc,CAAC;AAGtB,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC7F,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * A validator for the keywords the declaration document's own schema uses,
3
+ * so the catalog checks documents against the published schema itself, in a
4
+ * browser too, without shipping a general JSON Schema validator.
5
+ *
6
+ * It refuses a schema that uses any other keyword rather than ignoring it: a
7
+ * keyword this file skipped would be a rule the published schema states and
8
+ * the catalog never checked. Payload schemas, which may use any keyword, are
9
+ * validated by the full validator in `./validate`.
10
+ */
11
+ type Schema = Readonly<Record<string, unknown>>;
12
+ /** Every way `value` breaks `schema`, each with its JSON path. Empty when it conforms. */
13
+ export declare function validateLite(root: Schema, value: unknown): string[];
14
+ export {};
15
+ //# sourceMappingURL=json-schema-lite.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json-schema-lite.d.ts","sourceRoot":"","sources":["../src/json-schema-lite.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,KAAK,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AA2ChD,0FAA0F;AAC1F,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,MAAM,EAAE,CA8EnE"}
@@ -0,0 +1,144 @@
1
+ /**
2
+ * A validator for the keywords the declaration document's own schema uses,
3
+ * so the catalog checks documents against the published schema itself, in a
4
+ * browser too, without shipping a general JSON Schema validator.
5
+ *
6
+ * It refuses a schema that uses any other keyword rather than ignoring it: a
7
+ * keyword this file skipped would be a rule the published schema states and
8
+ * the catalog never checked. Payload schemas, which may use any keyword, are
9
+ * validated by the full validator in `./validate`.
10
+ */
11
+ const ANNOTATIONS = new Set(['$schema', '$id', 'title', 'description', '$defs', '$comment']);
12
+ const KEYWORDS = new Set([
13
+ 'type',
14
+ 'required',
15
+ 'properties',
16
+ 'additionalProperties',
17
+ 'propertyNames',
18
+ 'const',
19
+ 'enum',
20
+ 'pattern',
21
+ 'minLength',
22
+ 'items',
23
+ 'minItems',
24
+ 'maxItems',
25
+ 'uniqueItems',
26
+ '$ref',
27
+ 'allOf',
28
+ 'if',
29
+ 'then',
30
+ 'else',
31
+ 'not',
32
+ ]);
33
+ function typeOf(value) {
34
+ if (value === null)
35
+ return 'null';
36
+ if (Array.isArray(value))
37
+ return 'array';
38
+ if (typeof value === 'number')
39
+ return Number.isInteger(value) ? 'integer' : 'number';
40
+ return typeof value;
41
+ }
42
+ function matchesType(value, type) {
43
+ const actual = typeOf(value);
44
+ return actual === type || (type === 'number' && actual === 'integer');
45
+ }
46
+ const same = (a, b) => JSON.stringify(a) === JSON.stringify(b);
47
+ function at(path, key) {
48
+ return typeof key === 'number' ? `${path}[${key}]` : `${path}/${key}`;
49
+ }
50
+ /** Every way `value` breaks `schema`, each with its JSON path. Empty when it conforms. */
51
+ export function validateLite(root, value) {
52
+ const errors = [];
53
+ function resolve(ref) {
54
+ const match = /^#\/\$defs\/([^/]+)$/.exec(ref);
55
+ const defs = root.$defs;
56
+ const target = match ? defs?.[match[1]] : undefined;
57
+ if (!target)
58
+ throw new Error(`[agent-sdk-events] schema $ref ${ref} does not resolve`);
59
+ return target;
60
+ }
61
+ function check(schema, v, path, out) {
62
+ for (const key of Object.keys(schema)) {
63
+ if (!KEYWORDS.has(key) && !ANNOTATIONS.has(key)) {
64
+ throw new Error(`[agent-sdk-events] the declaration schema uses '${key}', which json-schema-lite does not check`);
65
+ }
66
+ }
67
+ if (typeof schema.$ref === 'string')
68
+ check(resolve(schema.$ref), v, path, out);
69
+ if (typeof schema.type === 'string' && !matchesType(v, schema.type)) {
70
+ out.push(`${path}: must be ${schema.type === 'object' ? 'an object' : `a ${schema.type}`}`);
71
+ return;
72
+ }
73
+ if ('const' in schema && !same(v, schema.const))
74
+ out.push(`${path}: must be ${JSON.stringify(schema.const)}`);
75
+ if (Array.isArray(schema.enum) && !schema.enum.some((e) => same(e, v))) {
76
+ out.push(`${path}: must be one of ${schema.enum.map((e) => JSON.stringify(e)).join(', ')}`);
77
+ }
78
+ if (typeof v === 'string') {
79
+ if (typeof schema.minLength === 'number' && v.length < schema.minLength)
80
+ out.push(`${path}: must not be empty`);
81
+ if (typeof schema.pattern === 'string' && !new RegExp(schema.pattern).test(v)) {
82
+ out.push(`${path}: '${v}' does not match ${schema.pattern}`);
83
+ }
84
+ }
85
+ if (Array.isArray(v)) {
86
+ if (typeof schema.minItems === 'number' && v.length < schema.minItems)
87
+ out.push(`${path}: needs at least ${schema.minItems} item(s)`);
88
+ if (typeof schema.maxItems === 'number' && v.length > schema.maxItems)
89
+ out.push(`${path}: allows at most ${schema.maxItems} item(s)`);
90
+ if (schema.uniqueItems === true && new Set(v.map((x) => JSON.stringify(x))).size !== v.length)
91
+ out.push(`${path}: items must be unique`);
92
+ if (schema.items)
93
+ v.forEach((item, i) => check(schema.items, item, at(path, i), out));
94
+ }
95
+ if (v && typeof v === 'object' && !Array.isArray(v)) {
96
+ const obj = v;
97
+ for (const key of schema.required ?? []) {
98
+ if (!(key in obj))
99
+ out.push(`${path}: '${key}' is required`);
100
+ }
101
+ const properties = schema.properties ?? {};
102
+ for (const [key, child] of Object.entries(obj)) {
103
+ if (schema.propertyNames) {
104
+ const nameErrors = [];
105
+ check(schema.propertyNames, key, at(path, key), nameErrors);
106
+ if (nameErrors.length > 0)
107
+ out.push(`${at(path, key)}: the name '${key}' is not allowed (${schema.propertyNames.pattern})`);
108
+ }
109
+ if (key in properties)
110
+ check(properties[key], child, at(path, key), out);
111
+ else if (schema.additionalProperties === false)
112
+ out.push(`${path}: '${key}' is not an allowed property`);
113
+ else if (schema.additionalProperties && typeof schema.additionalProperties === 'object') {
114
+ check(schema.additionalProperties, child, at(path, key), out);
115
+ }
116
+ }
117
+ }
118
+ for (const sub of schema.allOf ?? [])
119
+ check(sub, v, path, out);
120
+ if (schema.if) {
121
+ const probe = [];
122
+ check(schema.if, v, path, probe);
123
+ const branch = probe.length === 0 ? schema.then : schema.else;
124
+ if (branch)
125
+ check(branch, v, path, out);
126
+ }
127
+ if (schema.not) {
128
+ const probe = [];
129
+ check(schema.not, v, path, probe);
130
+ if (probe.length === 0)
131
+ out.push(`${path}: ${describeNot(schema.not)}`);
132
+ }
133
+ }
134
+ check(root, value, '', errors);
135
+ return errors;
136
+ }
137
+ /** `not: { required: [x] }` is how the schema forbids a field; say so plainly. */
138
+ function describeNot(not) {
139
+ const required = not.required;
140
+ if (required?.length === 1 && Object.keys(not).length === 1)
141
+ return `'${required[0]}' is not allowed here`;
142
+ return `must not match ${JSON.stringify(not)}`;
143
+ }
144
+ //# sourceMappingURL=json-schema-lite.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json-schema-lite.js","sourceRoot":"","sources":["../src/json-schema-lite.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC,CAAC,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC;AAC7F,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC;IACvB,MAAM;IACN,UAAU;IACV,YAAY;IACZ,sBAAsB;IACtB,eAAe;IACf,OAAO;IACP,MAAM;IACN,SAAS;IACT,WAAW;IACX,OAAO;IACP,UAAU;IACV,UAAU;IACV,aAAa;IACb,MAAM;IACN,OAAO;IACP,IAAI;IACJ,MAAM;IACN,MAAM;IACN,KAA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,CAAC,MAAgB,EAAE,CAAC,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC;QACpD,CAAC;QACD,IAAI,MAAM,CAAC,GAAG,EAAE,CAAC;YACf,MAAM,KAAK,GAAa,EAAE,CAAC;YAC3B,KAAK,CAAC,MAAM,CAAC,GAAa,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;YAC5C,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;gBAAE,GAAG,CAAC,IAAI,CAAC,GAAG,IAAI,KAAK,WAAW,CAAC,MAAM,CAAC,GAAa,CAAC,EAAE,CAAC,CAAC;QACpF,CAAC;IACH,CAAC;IAED,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,CAAC,CAAC;IAC/B,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,kFAAkF;AAClF,SAAS,WAAW,CAAC,GAAW;IAC9B,MAAM,QAAQ,GAAG,GAAG,CAAC,QAAgC,CAAC;IACtD,IAAI,QAAQ,EAAE,MAAM,KAAK,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,QAAQ,CAAC,CAAC,CAAC,uBAAuB,CAAC;IAC3G,OAAO,kBAAkB,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC;AACjD,CAAC"}
@@ -0,0 +1,8 @@
1
+ export interface OuiWire {
2
+ /** What the agent side emits to deliver a UI action request. */
3
+ dispatch: string;
4
+ /** What a tab emits to answer one. */
5
+ result: string;
6
+ }
7
+ export declare const OUI_WIRE: OuiWire;
8
+ //# sourceMappingURL=oui-wire.d.ts.map