@irogane/kaji 0.2.0-beta.11

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 (136) hide show
  1. package/LICENSE +105 -0
  2. package/README.md +598 -0
  3. package/contracts/README.md +14 -0
  4. package/contracts/beta-core-v1.json +52 -0
  5. package/contracts/cli/init-cases-v1.json +27 -0
  6. package/contracts/errors/error-codes.json +48 -0
  7. package/contracts/errors/integration-recovery-v1.json +127 -0
  8. package/contracts/errors/provider-normalization.json +111 -0
  9. package/contracts/events/conformance-invalid.json +20 -0
  10. package/contracts/events/conformance.json +511 -0
  11. package/contracts/events/new-kaji-event-v1.schema.json +1021 -0
  12. package/contracts/events/stored-kaji-event-v1.schema.json +1025 -0
  13. package/contracts/feature-tiers-v1.json +488 -0
  14. package/contracts/integrations/abi-index-v1.json +8 -0
  15. package/contracts/integrations/conformance-invalid.json +443 -0
  16. package/contracts/integrations/conformance-valid.json +121 -0
  17. package/contracts/integrations/copy-provenance-v1.schema.json +61 -0
  18. package/contracts/integrations/echo-tool-abi-v1.json +37 -0
  19. package/contracts/integrations/github-api-conformance-v1.json +644 -0
  20. package/contracts/integrations/github-tool-abi-typescript-v1.json +369 -0
  21. package/contracts/integrations/github-tool-abi-v1.json +146 -0
  22. package/contracts/integrations/gmail-api-conformance-v1.json +750 -0
  23. package/contracts/integrations/gmail-tool-abi-v1.json +62 -0
  24. package/contracts/integrations/index.schema.json +37 -0
  25. package/contracts/integrations/manifest.schema.json +119 -0
  26. package/contracts/parity/expected-normalized.json +4906 -0
  27. package/contracts/parity/scenarios.json +100 -0
  28. package/contracts/parity/scenarios.schema.json +214 -0
  29. package/contracts/providers/cost-conformance.json +112 -0
  30. package/contracts/release/github-proof-v1.schema.json +138 -0
  31. package/contracts/release/gmail-proof-v1.schema.json +138 -0
  32. package/contracts/release/kaji-ts-consumer-handoff-v1.schema.json +1289 -0
  33. package/contracts/release/publisher-identity-receipt-v1.schema.json +319 -0
  34. package/contracts/release/typescript-onboarding-evidence-v1.schema.json +740 -0
  35. package/contracts/tools/conformance-invalid.json +271 -0
  36. package/contracts/tools/conformance-valid.json +78 -0
  37. package/contracts/tools/tool-schema-v1.schema.json +18 -0
  38. package/dist/anthropic.cjs +1231 -0
  39. package/dist/anthropic.cjs.map +1 -0
  40. package/dist/anthropic.d.cts +26 -0
  41. package/dist/anthropic.d.ts +26 -0
  42. package/dist/anthropic.js +270 -0
  43. package/dist/anthropic.js.map +1 -0
  44. package/dist/auth.cjs +1507 -0
  45. package/dist/auth.cjs.map +1 -0
  46. package/dist/auth.d.cts +129 -0
  47. package/dist/auth.d.ts +129 -0
  48. package/dist/auth.js +1039 -0
  49. package/dist/auth.js.map +1 -0
  50. package/dist/base-B9FRMcP8.d.cts +140 -0
  51. package/dist/base-nHQd1VtS.d.ts +140 -0
  52. package/dist/chunk-AAM33KAO.js +4367 -0
  53. package/dist/chunk-AAM33KAO.js.map +1 -0
  54. package/dist/chunk-KAJ6BM64.js +153 -0
  55. package/dist/chunk-KAJ6BM64.js.map +1 -0
  56. package/dist/chunk-KCAXIOZS.js +308 -0
  57. package/dist/chunk-KCAXIOZS.js.map +1 -0
  58. package/dist/chunk-LSJ4AVO2.js +243 -0
  59. package/dist/chunk-LSJ4AVO2.js.map +1 -0
  60. package/dist/chunk-TM7ZGOJX.js +716 -0
  61. package/dist/chunk-TM7ZGOJX.js.map +1 -0
  62. package/dist/cli/bin.d.ts +2 -0
  63. package/dist/cli/bin.js +13 -0
  64. package/dist/cli/bin.js.map +1 -0
  65. package/dist/cli/chunk-2RCWPRVY.js +6277 -0
  66. package/dist/cli/chunk-2RCWPRVY.js.map +1 -0
  67. package/dist/cli/chunk-SEBX54TR.js +681 -0
  68. package/dist/cli/chunk-SEBX54TR.js.map +1 -0
  69. package/dist/cli/index.d.ts +232 -0
  70. package/dist/cli/index.js +11 -0
  71. package/dist/cli/index.js.map +1 -0
  72. package/dist/cli/init-worker.d.ts +2 -0
  73. package/dist/cli/init-worker.js +18 -0
  74. package/dist/cli/init-worker.js.map +1 -0
  75. package/dist/cli/integration-copy-worker.js +48 -0
  76. package/dist/cli/integration-copy-worker.js.map +1 -0
  77. package/dist/cli/package-entry-cjs.cjs +21 -0
  78. package/dist/cli/package-entry-cjs.cjs.map +1 -0
  79. package/dist/cli/package-entry-cjs.d.cts +2 -0
  80. package/dist/cli/package-entry.d.ts +2 -0
  81. package/dist/cli/package-entry.js +13 -0
  82. package/dist/cli/package-entry.js.map +1 -0
  83. package/dist/context-BaFHrQHv.d.cts +21 -0
  84. package/dist/context-BaFHrQHv.d.ts +21 -0
  85. package/dist/context-C-YPY-GS.d.cts +1538 -0
  86. package/dist/context-C-YPY-GS.d.ts +1538 -0
  87. package/dist/index.cjs +12346 -0
  88. package/dist/index.cjs.map +1 -0
  89. package/dist/index.d.cts +1560 -0
  90. package/dist/index.d.ts +1560 -0
  91. package/dist/index.js +7852 -0
  92. package/dist/index.js.map +1 -0
  93. package/dist/integrations/github.cjs +2092 -0
  94. package/dist/integrations/github.cjs.map +1 -0
  95. package/dist/integrations/github.d.cts +21 -0
  96. package/dist/integrations/github.d.ts +21 -0
  97. package/dist/integrations/github.js +2088 -0
  98. package/dist/integrations/github.js.map +1 -0
  99. package/dist/integrations.cjs +3370 -0
  100. package/dist/integrations.cjs.map +1 -0
  101. package/dist/integrations.d.cts +202 -0
  102. package/dist/integrations.d.ts +202 -0
  103. package/dist/integrations.js +2650 -0
  104. package/dist/integrations.js.map +1 -0
  105. package/dist/observability-Cj--OkME.d.cts +96 -0
  106. package/dist/observability-Cj--OkME.d.ts +96 -0
  107. package/dist/openai.cjs +1235 -0
  108. package/dist/openai.cjs.map +1 -0
  109. package/dist/openai.d.cts +32 -0
  110. package/dist/openai.d.ts +32 -0
  111. package/dist/openai.js +272 -0
  112. package/dist/openai.js.map +1 -0
  113. package/dist/testing.cjs +554 -0
  114. package/dist/testing.cjs.map +1 -0
  115. package/dist/testing.d.cts +43 -0
  116. package/dist/testing.d.ts +43 -0
  117. package/dist/testing.js +118 -0
  118. package/dist/testing.js.map +1 -0
  119. package/package.json +188 -0
  120. package/registry/echo/index.ts +53 -0
  121. package/registry/echo/manifest.json +53 -0
  122. package/registry/github/LICENSE +105 -0
  123. package/registry/github/client.ts +1727 -0
  124. package/registry/github/index.ts +263 -0
  125. package/registry/github/manifest.json +227 -0
  126. package/registry/github/owner-fixtures.json +10 -0
  127. package/registry/github/tests/github.test.ts +32 -0
  128. package/registry/gmail/LICENSE +105 -0
  129. package/registry/gmail/client.ts +548 -0
  130. package/registry/gmail/index.ts +165 -0
  131. package/registry/gmail/manifest.json +102 -0
  132. package/registry/gmail/owner-fixtures.json +10 -0
  133. package/registry/gmail/tests/gmail.test.ts +32 -0
  134. package/registry/index.json +21 -0
  135. package/registry/index.schema.json +37 -0
  136. package/registry/schema.json +119 -0
@@ -0,0 +1,1025 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://kaji.dev/contracts/events/stored-kaji-event-v1.schema.json",
4
+ "title": "Stored Kaji event",
5
+ "x-maxSerializedBytes": 1048576,
6
+ "$defs": {
7
+ "nonEmptyId": {
8
+ "type": "string",
9
+ "minLength": 1
10
+ },
11
+ "integrationRecoveryFields": {
12
+ "oneOf": [
13
+ { "properties": { "error_code": { "const": "INTEGRATION_AUTH_REQUIRED" }, "reason_code": { "const": "github_token_missing" }, "recovery_code": { "const": "CONFIGURE_GITHUB_TOKEN" }, "doc_url": { "const": "https://kaji.dev/docs/integrations/recovery-v1#github-token" } }, "required": ["error_code", "reason_code", "recovery_code", "doc_url"] },
14
+ { "properties": { "error_code": { "const": "INTEGRATION_AUTH_REQUIRED" }, "reason_code": { "const": "gmail_grant_missing" }, "recovery_code": { "const": "CONNECT_GMAIL" }, "doc_url": { "const": "https://kaji.dev/docs/integrations/recovery-v1#gmail-grant" } }, "required": ["error_code", "reason_code", "recovery_code", "doc_url"] },
15
+ { "properties": { "error_code": { "const": "INTEGRATION_AUTH_ERROR" }, "reason_code": { "const": "keychain_missing" }, "recovery_code": { "const": "RESTORE_KEYCHAIN" }, "doc_url": { "const": "https://kaji.dev/docs/integrations/recovery-v1#keychain-missing" } }, "required": ["error_code", "reason_code", "recovery_code", "doc_url"] },
16
+ { "properties": { "error_code": { "const": "INTEGRATION_AUTH_ERROR" }, "reason_code": { "const": "keychain_locked" }, "recovery_code": { "const": "UNLOCK_KEYCHAIN" }, "doc_url": { "const": "https://kaji.dev/docs/integrations/recovery-v1#keychain-locked" } }, "required": ["error_code", "reason_code", "recovery_code", "doc_url"] },
17
+ { "properties": { "error_code": { "const": "INTEGRATION_AUTH_ERROR" }, "reason_code": { "const": "keychain_corrupt" }, "recovery_code": { "const": "RESET_GMAIL_GRANT" }, "doc_url": { "const": "https://kaji.dev/docs/integrations/recovery-v1#keychain-corrupt" } }, "required": ["error_code", "reason_code", "recovery_code", "doc_url"] },
18
+ { "properties": { "error_code": { "const": "INTEGRATION_AUTH_ERROR" }, "reason_code": { "const": "keychain_unsupported" }, "recovery_code": { "const": "USE_SUPPORTED_KEYCHAIN" }, "doc_url": { "const": "https://kaji.dev/docs/integrations/recovery-v1#keychain-unsupported" } }, "required": ["error_code", "reason_code", "recovery_code", "doc_url"] },
19
+ { "properties": { "error_code": { "const": "INTEGRATION_AUTH_REQUIRED" }, "reason_code": { "const": "gmail_scope_drift" }, "recovery_code": { "const": "RECONNECT_GMAIL" }, "doc_url": { "const": "https://kaji.dev/docs/integrations/recovery-v1#gmail-scope-drift" } }, "required": ["error_code", "reason_code", "recovery_code", "doc_url"] },
20
+ { "properties": { "error_code": { "const": "INTEGRATION_POLICY_REJECTED" }, "reason_code": { "const": "policy_rejected" }, "recovery_code": { "const": "REVIEW_INTEGRATION_POLICY" }, "doc_url": { "const": "https://kaji.dev/docs/integrations/recovery-v1#policy-rejected" } }, "required": ["error_code", "reason_code", "recovery_code", "doc_url"] },
21
+ { "properties": { "error_code": { "const": "INTEGRATION_API_ERROR" }, "reason_code": { "const": "api_rejected" }, "recovery_code": { "const": "REVIEW_PROVIDER_REJECTION" }, "doc_url": { "const": "https://kaji.dev/docs/integrations/recovery-v1#api-rejected" } }, "required": ["error_code", "reason_code", "recovery_code", "doc_url"] },
22
+ { "properties": { "error_code": { "const": "INTEGRATION_API_ERROR" }, "reason_code": { "const": "transient_read_failed" }, "recovery_code": { "const": "RETRY_INTEGRATION_READ" }, "doc_url": { "const": "https://kaji.dev/docs/integrations/recovery-v1#transient-read" } }, "required": ["error_code", "reason_code", "recovery_code", "doc_url"] },
23
+ { "properties": { "error_code": { "const": "INTEGRATION_RATE_LIMITED" }, "reason_code": { "const": "rate_limited" }, "recovery_code": { "const": "RETRY_AFTER_RATE_LIMIT" }, "doc_url": { "const": "https://kaji.dev/docs/integrations/recovery-v1#rate-limited" } }, "required": ["error_code", "reason_code", "recovery_code", "doc_url"] },
24
+ { "properties": { "error_code": { "const": "INTEGRATION_REDIRECT_REJECTED" }, "reason_code": { "const": "redirect_rejected" }, "recovery_code": { "const": "REJECT_PROVIDER_REDIRECT" }, "doc_url": { "const": "https://kaji.dev/docs/integrations/recovery-v1#redirect-rejected" } }, "required": ["error_code", "reason_code", "recovery_code", "doc_url"] },
25
+ { "properties": { "error_code": { "const": "INTEGRATION_RESPONSE_LIMIT" }, "reason_code": { "const": "response_limit_exceeded" }, "recovery_code": { "const": "REDUCE_INTEGRATION_RESPONSE" }, "doc_url": { "const": "https://kaji.dev/docs/integrations/recovery-v1#response-limit" } }, "required": ["error_code", "reason_code", "recovery_code", "doc_url"] },
26
+ { "properties": { "error_code": { "const": "TOOL_EXECUTION_FAILED" }, "reason_code": { "const": "github_mutation_unknown" }, "recovery_code": { "const": "RECONCILE_GITHUB_MUTATION" }, "doc_url": { "const": "https://kaji.dev/docs/integrations/recovery-v1#github-mutation-unknown" } }, "required": ["error_code", "reason_code", "recovery_code", "doc_url"] },
27
+ { "properties": { "error_code": { "const": "TOOL_EXECUTION_FAILED" }, "reason_code": { "const": "gmail_mutation_unknown" }, "recovery_code": { "const": "RECONCILE_GMAIL_MUTATION" }, "doc_url": { "const": "https://kaji.dev/docs/integrations/recovery-v1#gmail-mutation-unknown" } }, "required": ["error_code", "reason_code", "recovery_code", "doc_url"] }
28
+ ]
29
+ },
30
+ "safeInteger": {
31
+ "type": "integer",
32
+ "minimum": -9007199254740991,
33
+ "maximum": 9007199254740991
34
+ },
35
+ "positiveInteger": {
36
+ "allOf": [
37
+ {
38
+ "$ref": "#/$defs/safeInteger"
39
+ },
40
+ {
41
+ "minimum": 1
42
+ }
43
+ ]
44
+ },
45
+ "nonNegativeInteger": {
46
+ "allOf": [
47
+ {
48
+ "$ref": "#/$defs/safeInteger"
49
+ },
50
+ {
51
+ "minimum": 0
52
+ }
53
+ ]
54
+ },
55
+ "jsonNumber": {
56
+ "oneOf": [
57
+ {
58
+ "$ref": "#/$defs/safeInteger"
59
+ },
60
+ {
61
+ "type": "number",
62
+ "not": {
63
+ "type": "integer"
64
+ }
65
+ }
66
+ ]
67
+ },
68
+ "nonNegativeNumber": {
69
+ "allOf": [
70
+ {
71
+ "$ref": "#/$defs/jsonNumber"
72
+ },
73
+ {
74
+ "minimum": 0
75
+ }
76
+ ]
77
+ },
78
+ "jsonValue": {
79
+ "oneOf": [
80
+ {
81
+ "type": "null"
82
+ },
83
+ {
84
+ "type": "boolean"
85
+ },
86
+ {
87
+ "$ref": "#/$defs/jsonNumber"
88
+ },
89
+ {
90
+ "type": "string"
91
+ },
92
+ {
93
+ "type": "array",
94
+ "items": {
95
+ "$ref": "#/$defs/jsonValue"
96
+ }
97
+ },
98
+ {
99
+ "type": "object",
100
+ "additionalProperties": {
101
+ "$ref": "#/$defs/jsonValue"
102
+ }
103
+ }
104
+ ]
105
+ },
106
+ "jsonObject": {
107
+ "type": "object",
108
+ "additionalProperties": {
109
+ "$ref": "#/$defs/jsonValue"
110
+ }
111
+ },
112
+ "tokenUsage": {
113
+ "type": "object",
114
+ "properties": {
115
+ "input": {
116
+ "$ref": "#/$defs/nonNegativeInteger"
117
+ },
118
+ "output": {
119
+ "$ref": "#/$defs/nonNegativeInteger"
120
+ }
121
+ },
122
+ "required": [
123
+ "input",
124
+ "output"
125
+ ],
126
+ "additionalProperties": false
127
+ },
128
+ "base": {
129
+ "type": "object",
130
+ "properties": {
131
+ "id": {
132
+ "$ref": "#/$defs/nonEmptyId"
133
+ },
134
+ "version": {
135
+ "const": "1.0"
136
+ },
137
+ "timestamp": {
138
+ "$ref": "#/$defs/jsonNumber"
139
+ },
140
+ "session_id": {
141
+ "$ref": "#/$defs/nonEmptyId"
142
+ },
143
+ "turn_id": {
144
+ "$ref": "#/$defs/nonEmptyId"
145
+ },
146
+ "metadata": {
147
+ "$ref": "#/$defs/jsonObject"
148
+ },
149
+ "sequence": {
150
+ "$ref": "#/$defs/positiveInteger"
151
+ }
152
+ },
153
+ "required": [
154
+ "id",
155
+ "version",
156
+ "timestamp",
157
+ "session_id",
158
+ "sequence"
159
+ ]
160
+ },
161
+ "sessionCreated": {
162
+ "allOf": [
163
+ {
164
+ "$ref": "#/$defs/base"
165
+ },
166
+ {
167
+ "type": "object",
168
+ "properties": {
169
+ "type": {
170
+ "const": "session.created"
171
+ }
172
+ },
173
+ "required": [
174
+ "type"
175
+ ]
176
+ }
177
+ ],
178
+ "unevaluatedProperties": false
179
+ },
180
+ "sessionClosed": {
181
+ "allOf": [
182
+ {
183
+ "$ref": "#/$defs/base"
184
+ },
185
+ {
186
+ "type": "object",
187
+ "properties": {
188
+ "type": {
189
+ "const": "session.closed"
190
+ },
191
+ "reason": {
192
+ "type": [
193
+ "string",
194
+ "null"
195
+ ]
196
+ }
197
+ },
198
+ "required": [
199
+ "type"
200
+ ]
201
+ }
202
+ ],
203
+ "unevaluatedProperties": false
204
+ },
205
+ "userMessage": {
206
+ "allOf": [
207
+ {
208
+ "$ref": "#/$defs/base"
209
+ },
210
+ {
211
+ "type": "object",
212
+ "properties": {
213
+ "type": {
214
+ "const": "user.message"
215
+ },
216
+ "content": {
217
+ "type": "string"
218
+ }
219
+ },
220
+ "required": [
221
+ "type",
222
+ "content"
223
+ ]
224
+ }
225
+ ],
226
+ "unevaluatedProperties": false
227
+ },
228
+ "userAudioChunk": {
229
+ "allOf": [
230
+ {
231
+ "$ref": "#/$defs/base"
232
+ },
233
+ {
234
+ "type": "object",
235
+ "properties": {
236
+ "type": {
237
+ "const": "user.audio.chunk"
238
+ },
239
+ "chunk_size_bytes": {
240
+ "$ref": "#/$defs/safeInteger"
241
+ }
242
+ },
243
+ "required": [
244
+ "type",
245
+ "chunk_size_bytes"
246
+ ]
247
+ }
248
+ ],
249
+ "unevaluatedProperties": false
250
+ },
251
+ "transcriptPartial": {
252
+ "allOf": [
253
+ {
254
+ "$ref": "#/$defs/base"
255
+ },
256
+ {
257
+ "type": "object",
258
+ "properties": {
259
+ "type": {
260
+ "const": "transcript.partial"
261
+ },
262
+ "text": {
263
+ "type": "string"
264
+ }
265
+ },
266
+ "required": [
267
+ "type",
268
+ "text"
269
+ ]
270
+ }
271
+ ],
272
+ "unevaluatedProperties": false
273
+ },
274
+ "transcriptFinal": {
275
+ "allOf": [
276
+ {
277
+ "$ref": "#/$defs/base"
278
+ },
279
+ {
280
+ "type": "object",
281
+ "properties": {
282
+ "type": {
283
+ "const": "transcript.final"
284
+ },
285
+ "text": {
286
+ "type": "string"
287
+ }
288
+ },
289
+ "required": [
290
+ "type",
291
+ "text"
292
+ ]
293
+ }
294
+ ],
295
+ "unevaluatedProperties": false
296
+ },
297
+ "memoryRetrievalStarted": {
298
+ "allOf": [
299
+ {
300
+ "$ref": "#/$defs/base"
301
+ },
302
+ {
303
+ "type": "object",
304
+ "properties": {
305
+ "type": {
306
+ "const": "memory.retrieval.started"
307
+ },
308
+ "query": {
309
+ "type": "string"
310
+ }
311
+ },
312
+ "required": [
313
+ "type",
314
+ "query"
315
+ ]
316
+ }
317
+ ],
318
+ "unevaluatedProperties": false
319
+ },
320
+ "memoryRetrievalCompleted": {
321
+ "allOf": [
322
+ {
323
+ "$ref": "#/$defs/base"
324
+ },
325
+ {
326
+ "type": "object",
327
+ "properties": {
328
+ "type": {
329
+ "const": "memory.retrieval.completed"
330
+ },
331
+ "query": {
332
+ "type": "string"
333
+ },
334
+ "documents": {
335
+ "type": "array",
336
+ "items": {
337
+ "$ref": "#/$defs/jsonObject"
338
+ }
339
+ }
340
+ },
341
+ "required": [
342
+ "type",
343
+ "query",
344
+ "documents"
345
+ ]
346
+ }
347
+ ],
348
+ "unevaluatedProperties": false
349
+ },
350
+ "agentReasoningStarted": {
351
+ "allOf": [
352
+ {
353
+ "$ref": "#/$defs/base"
354
+ },
355
+ {
356
+ "type": "object",
357
+ "properties": {
358
+ "type": {
359
+ "const": "agent.reasoning.started"
360
+ }
361
+ },
362
+ "required": [
363
+ "type"
364
+ ]
365
+ }
366
+ ],
367
+ "unevaluatedProperties": false
368
+ },
369
+ "agentMessageDelta": {
370
+ "allOf": [
371
+ {
372
+ "$ref": "#/$defs/base"
373
+ },
374
+ {
375
+ "type": "object",
376
+ "properties": {
377
+ "type": {
378
+ "const": "agent.message.delta"
379
+ },
380
+ "delta": {
381
+ "type": "string"
382
+ }
383
+ },
384
+ "required": [
385
+ "type",
386
+ "delta"
387
+ ]
388
+ }
389
+ ],
390
+ "unevaluatedProperties": false
391
+ },
392
+ "agentMessageCompleted": {
393
+ "allOf": [
394
+ {
395
+ "$ref": "#/$defs/base"
396
+ },
397
+ {
398
+ "type": "object",
399
+ "properties": {
400
+ "type": {
401
+ "const": "agent.message.completed"
402
+ },
403
+ "content": {
404
+ "type": "string"
405
+ },
406
+ "tokens": {
407
+ "oneOf": [
408
+ { "$ref": "#/$defs/tokenUsage" },
409
+ { "type": "null" }
410
+ ]
411
+ },
412
+ "cost_usd": {
413
+ "oneOf": [
414
+ { "$ref": "#/$defs/nonNegativeNumber" },
415
+ { "type": "null" }
416
+ ]
417
+ }
418
+ },
419
+ "required": [
420
+ "type",
421
+ "content"
422
+ ]
423
+ }
424
+ ],
425
+ "unevaluatedProperties": false
426
+ },
427
+ "agentTurnExhausted": {
428
+ "allOf": [
429
+ {
430
+ "$ref": "#/$defs/base"
431
+ },
432
+ {
433
+ "type": "object",
434
+ "properties": {
435
+ "type": {
436
+ "const": "agent.turn.exhausted"
437
+ },
438
+ "max_iterations": {
439
+ "$ref": "#/$defs/nonNegativeInteger"
440
+ },
441
+ "pending_tool_calls": {
442
+ "type": "array",
443
+ "items": {
444
+ "$ref": "#/$defs/jsonObject"
445
+ }
446
+ },
447
+ "reason": {
448
+ "type": [
449
+ "string",
450
+ "null"
451
+ ]
452
+ }
453
+ },
454
+ "required": [
455
+ "type",
456
+ "max_iterations",
457
+ "pending_tool_calls"
458
+ ]
459
+ }
460
+ ],
461
+ "unevaluatedProperties": false
462
+ },
463
+ "agentTurnFailed": {
464
+ "allOf": [
465
+ {
466
+ "$ref": "#/$defs/base"
467
+ },
468
+ {
469
+ "type": "object",
470
+ "properties": {
471
+ "type": {
472
+ "const": "agent.turn.failed"
473
+ },
474
+ "turn_id": {
475
+ "$ref": "#/$defs/nonEmptyId"
476
+ },
477
+ "error": {
478
+ "type": "string",
479
+ "minLength": 1,
480
+ "maxLength": 200
481
+ },
482
+ "error_code": {
483
+ "type": "string"
484
+ },
485
+ "phase": {
486
+ "enum": [
487
+ "queue",
488
+ "provider_open",
489
+ "provider_stream",
490
+ "approval",
491
+ "tool"
492
+ ]
493
+ },
494
+ "retryable": {
495
+ "type": "boolean"
496
+ },
497
+ "outcome": {
498
+ "enum": [
499
+ "not_started",
500
+ "failed",
501
+ "unknown"
502
+ ]
503
+ }
504
+ },
505
+ "required": [
506
+ "type",
507
+ "turn_id",
508
+ "error"
509
+ ]
510
+ }
511
+ ],
512
+ "unevaluatedProperties": false
513
+ },
514
+ "toolCallRequested": {
515
+ "allOf": [
516
+ {
517
+ "$ref": "#/$defs/base"
518
+ },
519
+ {
520
+ "type": "object",
521
+ "properties": {
522
+ "type": {
523
+ "const": "tool.call.requested"
524
+ },
525
+ "turn_id": {
526
+ "$ref": "#/$defs/nonEmptyId"
527
+ },
528
+ "tool_name": {
529
+ "$ref": "#/$defs/nonEmptyId"
530
+ },
531
+ "tool_args": {
532
+ "$ref": "#/$defs/jsonObject",
533
+ "x-maxSerializedBytes": 65536
534
+ },
535
+ "tool_call_id": {
536
+ "$ref": "#/$defs/nonEmptyId"
537
+ }
538
+ },
539
+ "required": [
540
+ "type",
541
+ "turn_id",
542
+ "tool_name",
543
+ "tool_args",
544
+ "tool_call_id"
545
+ ]
546
+ }
547
+ ],
548
+ "unevaluatedProperties": false
549
+ },
550
+ "toolCallStarted": {
551
+ "allOf": [
552
+ {
553
+ "$ref": "#/$defs/base"
554
+ },
555
+ {
556
+ "type": "object",
557
+ "properties": {
558
+ "type": {
559
+ "const": "tool.call.started"
560
+ },
561
+ "turn_id": {
562
+ "$ref": "#/$defs/nonEmptyId"
563
+ },
564
+ "tool_name": {
565
+ "$ref": "#/$defs/nonEmptyId"
566
+ },
567
+ "tool_call_id": {
568
+ "$ref": "#/$defs/nonEmptyId"
569
+ }
570
+ },
571
+ "required": [
572
+ "type",
573
+ "turn_id",
574
+ "tool_name",
575
+ "tool_call_id"
576
+ ]
577
+ }
578
+ ],
579
+ "unevaluatedProperties": false
580
+ },
581
+ "toolCallCompleted": {
582
+ "allOf": [
583
+ {
584
+ "$ref": "#/$defs/base"
585
+ },
586
+ {
587
+ "type": "object",
588
+ "properties": {
589
+ "type": {
590
+ "const": "tool.call.completed"
591
+ },
592
+ "turn_id": {
593
+ "$ref": "#/$defs/nonEmptyId"
594
+ },
595
+ "tool_name": {
596
+ "$ref": "#/$defs/nonEmptyId"
597
+ },
598
+ "tool_call_id": {
599
+ "$ref": "#/$defs/nonEmptyId"
600
+ },
601
+ "result": {
602
+ "$ref": "#/$defs/jsonValue",
603
+ "x-maxSerializedBytes": 65536
604
+ },
605
+ "tokens": {
606
+ "oneOf": [
607
+ { "$ref": "#/$defs/tokenUsage" },
608
+ { "type": "null" }
609
+ ]
610
+ },
611
+ "cost_usd": {
612
+ "oneOf": [
613
+ { "$ref": "#/$defs/nonNegativeNumber" },
614
+ { "type": "null" }
615
+ ]
616
+ }
617
+ },
618
+ "required": [
619
+ "type",
620
+ "turn_id",
621
+ "tool_name",
622
+ "tool_call_id",
623
+ "result"
624
+ ]
625
+ }
626
+ ],
627
+ "unevaluatedProperties": false
628
+ },
629
+ "toolCallFailed": {
630
+ "allOf": [
631
+ {
632
+ "$ref": "#/$defs/base"
633
+ },
634
+ {
635
+ "type": "object",
636
+ "properties": {
637
+ "type": {
638
+ "const": "tool.call.failed"
639
+ },
640
+ "turn_id": {
641
+ "$ref": "#/$defs/nonEmptyId"
642
+ },
643
+ "tool_name": {
644
+ "$ref": "#/$defs/nonEmptyId"
645
+ },
646
+ "tool_call_id": {
647
+ "$ref": "#/$defs/nonEmptyId"
648
+ },
649
+ "error": {
650
+ "type": "string",
651
+ "minLength": 1,
652
+ "maxLength": 200
653
+ },
654
+ "error_code": {
655
+ "type": "string"
656
+ },
657
+ "error_path": {
658
+ "type": "string"
659
+ },
660
+ "retryable": {
661
+ "type": "boolean"
662
+ },
663
+ "outcome": {
664
+ "enum": [
665
+ "not_started",
666
+ "failed",
667
+ "unknown"
668
+ ]
669
+ },
670
+ "reason_code": {
671
+ "type": "string"
672
+ },
673
+ "recovery_code": {
674
+ "type": "string"
675
+ },
676
+ "doc_url": {
677
+ "type": "string"
678
+ }
679
+ },
680
+ "required": [
681
+ "type",
682
+ "turn_id",
683
+ "tool_name",
684
+ "tool_call_id",
685
+ "error"
686
+ ]
687
+ },
688
+ {
689
+ "if": {
690
+ "anyOf": [
691
+ { "required": ["reason_code"] },
692
+ { "required": ["recovery_code"] },
693
+ { "required": ["doc_url"] }
694
+ ]
695
+ },
696
+ "then": {
697
+ "$ref": "#/$defs/integrationRecoveryFields"
698
+ }
699
+ }
700
+ ],
701
+ "unevaluatedProperties": false
702
+ },
703
+ "toolApprovalRequested": {
704
+ "allOf": [
705
+ {
706
+ "$ref": "#/$defs/base"
707
+ },
708
+ {
709
+ "type": "object",
710
+ "properties": {
711
+ "type": {
712
+ "const": "tool.approval.requested"
713
+ },
714
+ "turn_id": {
715
+ "$ref": "#/$defs/nonEmptyId"
716
+ },
717
+ "tool_name": {
718
+ "$ref": "#/$defs/nonEmptyId"
719
+ },
720
+ "tool_call_id": {
721
+ "$ref": "#/$defs/nonEmptyId"
722
+ },
723
+ "tool_args": {
724
+ "$ref": "#/$defs/jsonObject",
725
+ "x-maxSerializedBytes": 65536
726
+ },
727
+ "risk": {
728
+ "enum": [
729
+ "read",
730
+ "write",
731
+ "external_effect",
732
+ "destructive",
733
+ "admin"
734
+ ]
735
+ }
736
+ },
737
+ "required": [
738
+ "type",
739
+ "turn_id",
740
+ "tool_name",
741
+ "tool_call_id",
742
+ "tool_args",
743
+ "risk"
744
+ ]
745
+ }
746
+ ],
747
+ "unevaluatedProperties": false
748
+ },
749
+ "toolApprovalApproved": {
750
+ "allOf": [
751
+ {
752
+ "$ref": "#/$defs/base"
753
+ },
754
+ {
755
+ "type": "object",
756
+ "properties": {
757
+ "type": {
758
+ "const": "tool.approval.approved"
759
+ },
760
+ "turn_id": {
761
+ "$ref": "#/$defs/nonEmptyId"
762
+ },
763
+ "tool_name": {
764
+ "$ref": "#/$defs/nonEmptyId"
765
+ },
766
+ "tool_call_id": {
767
+ "$ref": "#/$defs/nonEmptyId"
768
+ }
769
+ },
770
+ "required": [
771
+ "type",
772
+ "turn_id",
773
+ "tool_name",
774
+ "tool_call_id"
775
+ ]
776
+ }
777
+ ],
778
+ "unevaluatedProperties": false
779
+ },
780
+ "toolApprovalRejected": {
781
+ "allOf": [
782
+ {
783
+ "$ref": "#/$defs/base"
784
+ },
785
+ {
786
+ "type": "object",
787
+ "properties": {
788
+ "type": {
789
+ "const": "tool.approval.rejected"
790
+ },
791
+ "turn_id": {
792
+ "$ref": "#/$defs/nonEmptyId"
793
+ },
794
+ "tool_name": {
795
+ "$ref": "#/$defs/nonEmptyId"
796
+ },
797
+ "tool_call_id": {
798
+ "$ref": "#/$defs/nonEmptyId"
799
+ },
800
+ "error_code": {
801
+ "enum": [
802
+ "APPROVAL_REJECTED",
803
+ "APPROVAL_TIMEOUT",
804
+ "TURN_TIMEOUT",
805
+ "TOOL_CANCELLED",
806
+ "APPROVAL_UNAVAILABLE"
807
+ ]
808
+ },
809
+ "reason": {
810
+ "type": "string",
811
+ "minLength": 1,
812
+ "maxLength": 200,
813
+ "pattern": "\\S"
814
+ }
815
+ },
816
+ "required": [
817
+ "type",
818
+ "turn_id",
819
+ "tool_name",
820
+ "tool_call_id",
821
+ "error_code",
822
+ "reason"
823
+ ]
824
+ }
825
+ ],
826
+ "unevaluatedProperties": false
827
+ },
828
+ "workflowStarted": {
829
+ "allOf": [
830
+ {
831
+ "$ref": "#/$defs/base"
832
+ },
833
+ {
834
+ "type": "object",
835
+ "properties": {
836
+ "type": {
837
+ "const": "workflow.started"
838
+ },
839
+ "workflow_name": {
840
+ "type": "string"
841
+ }
842
+ },
843
+ "required": [
844
+ "type",
845
+ "workflow_name"
846
+ ]
847
+ }
848
+ ],
849
+ "unevaluatedProperties": false
850
+ },
851
+ "workflowCompleted": {
852
+ "allOf": [
853
+ {
854
+ "$ref": "#/$defs/base"
855
+ },
856
+ {
857
+ "type": "object",
858
+ "properties": {
859
+ "type": {
860
+ "const": "workflow.completed"
861
+ },
862
+ "workflow_name": {
863
+ "type": "string"
864
+ },
865
+ "result": {
866
+ "$ref": "#/$defs/jsonValue"
867
+ }
868
+ },
869
+ "required": [
870
+ "type",
871
+ "workflow_name",
872
+ "result"
873
+ ]
874
+ }
875
+ ],
876
+ "unevaluatedProperties": false
877
+ },
878
+ "workflowFailed": {
879
+ "allOf": [
880
+ {
881
+ "$ref": "#/$defs/base"
882
+ },
883
+ {
884
+ "type": "object",
885
+ "properties": {
886
+ "type": {
887
+ "const": "workflow.failed"
888
+ },
889
+ "workflow_name": {
890
+ "type": "string"
891
+ },
892
+ "error": {
893
+ "type": "string"
894
+ }
895
+ },
896
+ "required": [
897
+ "type",
898
+ "workflow_name",
899
+ "error"
900
+ ]
901
+ }
902
+ ],
903
+ "unevaluatedProperties": false
904
+ },
905
+ "cancellationRequested": {
906
+ "allOf": [
907
+ {
908
+ "$ref": "#/$defs/base"
909
+ },
910
+ {
911
+ "type": "object",
912
+ "properties": {
913
+ "type": {
914
+ "const": "cancellation.requested"
915
+ },
916
+ "reason": {
917
+ "type": "string"
918
+ }
919
+ },
920
+ "required": [
921
+ "type",
922
+ "reason"
923
+ ]
924
+ }
925
+ ],
926
+ "unevaluatedProperties": false
927
+ },
928
+ "cancellationCompleted": {
929
+ "allOf": [
930
+ {
931
+ "$ref": "#/$defs/base"
932
+ },
933
+ {
934
+ "type": "object",
935
+ "properties": {
936
+ "type": {
937
+ "const": "cancellation.completed"
938
+ }
939
+ },
940
+ "required": [
941
+ "type"
942
+ ]
943
+ }
944
+ ],
945
+ "unevaluatedProperties": false
946
+ }
947
+ },
948
+ "oneOf": [
949
+ {
950
+ "$ref": "#/$defs/sessionCreated"
951
+ },
952
+ {
953
+ "$ref": "#/$defs/sessionClosed"
954
+ },
955
+ {
956
+ "$ref": "#/$defs/userMessage"
957
+ },
958
+ {
959
+ "$ref": "#/$defs/userAudioChunk"
960
+ },
961
+ {
962
+ "$ref": "#/$defs/transcriptPartial"
963
+ },
964
+ {
965
+ "$ref": "#/$defs/transcriptFinal"
966
+ },
967
+ {
968
+ "$ref": "#/$defs/memoryRetrievalStarted"
969
+ },
970
+ {
971
+ "$ref": "#/$defs/memoryRetrievalCompleted"
972
+ },
973
+ {
974
+ "$ref": "#/$defs/agentReasoningStarted"
975
+ },
976
+ {
977
+ "$ref": "#/$defs/agentMessageDelta"
978
+ },
979
+ {
980
+ "$ref": "#/$defs/agentMessageCompleted"
981
+ },
982
+ {
983
+ "$ref": "#/$defs/agentTurnExhausted"
984
+ },
985
+ {
986
+ "$ref": "#/$defs/agentTurnFailed"
987
+ },
988
+ {
989
+ "$ref": "#/$defs/toolCallRequested"
990
+ },
991
+ {
992
+ "$ref": "#/$defs/toolCallStarted"
993
+ },
994
+ {
995
+ "$ref": "#/$defs/toolCallCompleted"
996
+ },
997
+ {
998
+ "$ref": "#/$defs/toolCallFailed"
999
+ },
1000
+ {
1001
+ "$ref": "#/$defs/toolApprovalRequested"
1002
+ },
1003
+ {
1004
+ "$ref": "#/$defs/toolApprovalApproved"
1005
+ },
1006
+ {
1007
+ "$ref": "#/$defs/toolApprovalRejected"
1008
+ },
1009
+ {
1010
+ "$ref": "#/$defs/workflowStarted"
1011
+ },
1012
+ {
1013
+ "$ref": "#/$defs/workflowCompleted"
1014
+ },
1015
+ {
1016
+ "$ref": "#/$defs/workflowFailed"
1017
+ },
1018
+ {
1019
+ "$ref": "#/$defs/cancellationRequested"
1020
+ },
1021
+ {
1022
+ "$ref": "#/$defs/cancellationCompleted"
1023
+ }
1024
+ ]
1025
+ }