@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,1021 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://kaji.dev/contracts/events/new-kaji-event-v1.schema.json",
4
+ "title": "New 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
+ },
150
+ "required": [
151
+ "id",
152
+ "version",
153
+ "timestamp",
154
+ "session_id"
155
+ ]
156
+ },
157
+ "sessionCreated": {
158
+ "allOf": [
159
+ {
160
+ "$ref": "#/$defs/base"
161
+ },
162
+ {
163
+ "type": "object",
164
+ "properties": {
165
+ "type": {
166
+ "const": "session.created"
167
+ }
168
+ },
169
+ "required": [
170
+ "type"
171
+ ]
172
+ }
173
+ ],
174
+ "unevaluatedProperties": false
175
+ },
176
+ "sessionClosed": {
177
+ "allOf": [
178
+ {
179
+ "$ref": "#/$defs/base"
180
+ },
181
+ {
182
+ "type": "object",
183
+ "properties": {
184
+ "type": {
185
+ "const": "session.closed"
186
+ },
187
+ "reason": {
188
+ "type": [
189
+ "string",
190
+ "null"
191
+ ]
192
+ }
193
+ },
194
+ "required": [
195
+ "type"
196
+ ]
197
+ }
198
+ ],
199
+ "unevaluatedProperties": false
200
+ },
201
+ "userMessage": {
202
+ "allOf": [
203
+ {
204
+ "$ref": "#/$defs/base"
205
+ },
206
+ {
207
+ "type": "object",
208
+ "properties": {
209
+ "type": {
210
+ "const": "user.message"
211
+ },
212
+ "content": {
213
+ "type": "string"
214
+ }
215
+ },
216
+ "required": [
217
+ "type",
218
+ "content"
219
+ ]
220
+ }
221
+ ],
222
+ "unevaluatedProperties": false
223
+ },
224
+ "userAudioChunk": {
225
+ "allOf": [
226
+ {
227
+ "$ref": "#/$defs/base"
228
+ },
229
+ {
230
+ "type": "object",
231
+ "properties": {
232
+ "type": {
233
+ "const": "user.audio.chunk"
234
+ },
235
+ "chunk_size_bytes": {
236
+ "$ref": "#/$defs/safeInteger"
237
+ }
238
+ },
239
+ "required": [
240
+ "type",
241
+ "chunk_size_bytes"
242
+ ]
243
+ }
244
+ ],
245
+ "unevaluatedProperties": false
246
+ },
247
+ "transcriptPartial": {
248
+ "allOf": [
249
+ {
250
+ "$ref": "#/$defs/base"
251
+ },
252
+ {
253
+ "type": "object",
254
+ "properties": {
255
+ "type": {
256
+ "const": "transcript.partial"
257
+ },
258
+ "text": {
259
+ "type": "string"
260
+ }
261
+ },
262
+ "required": [
263
+ "type",
264
+ "text"
265
+ ]
266
+ }
267
+ ],
268
+ "unevaluatedProperties": false
269
+ },
270
+ "transcriptFinal": {
271
+ "allOf": [
272
+ {
273
+ "$ref": "#/$defs/base"
274
+ },
275
+ {
276
+ "type": "object",
277
+ "properties": {
278
+ "type": {
279
+ "const": "transcript.final"
280
+ },
281
+ "text": {
282
+ "type": "string"
283
+ }
284
+ },
285
+ "required": [
286
+ "type",
287
+ "text"
288
+ ]
289
+ }
290
+ ],
291
+ "unevaluatedProperties": false
292
+ },
293
+ "memoryRetrievalStarted": {
294
+ "allOf": [
295
+ {
296
+ "$ref": "#/$defs/base"
297
+ },
298
+ {
299
+ "type": "object",
300
+ "properties": {
301
+ "type": {
302
+ "const": "memory.retrieval.started"
303
+ },
304
+ "query": {
305
+ "type": "string"
306
+ }
307
+ },
308
+ "required": [
309
+ "type",
310
+ "query"
311
+ ]
312
+ }
313
+ ],
314
+ "unevaluatedProperties": false
315
+ },
316
+ "memoryRetrievalCompleted": {
317
+ "allOf": [
318
+ {
319
+ "$ref": "#/$defs/base"
320
+ },
321
+ {
322
+ "type": "object",
323
+ "properties": {
324
+ "type": {
325
+ "const": "memory.retrieval.completed"
326
+ },
327
+ "query": {
328
+ "type": "string"
329
+ },
330
+ "documents": {
331
+ "type": "array",
332
+ "items": {
333
+ "$ref": "#/$defs/jsonObject"
334
+ }
335
+ }
336
+ },
337
+ "required": [
338
+ "type",
339
+ "query",
340
+ "documents"
341
+ ]
342
+ }
343
+ ],
344
+ "unevaluatedProperties": false
345
+ },
346
+ "agentReasoningStarted": {
347
+ "allOf": [
348
+ {
349
+ "$ref": "#/$defs/base"
350
+ },
351
+ {
352
+ "type": "object",
353
+ "properties": {
354
+ "type": {
355
+ "const": "agent.reasoning.started"
356
+ }
357
+ },
358
+ "required": [
359
+ "type"
360
+ ]
361
+ }
362
+ ],
363
+ "unevaluatedProperties": false
364
+ },
365
+ "agentMessageDelta": {
366
+ "allOf": [
367
+ {
368
+ "$ref": "#/$defs/base"
369
+ },
370
+ {
371
+ "type": "object",
372
+ "properties": {
373
+ "type": {
374
+ "const": "agent.message.delta"
375
+ },
376
+ "delta": {
377
+ "type": "string"
378
+ }
379
+ },
380
+ "required": [
381
+ "type",
382
+ "delta"
383
+ ]
384
+ }
385
+ ],
386
+ "unevaluatedProperties": false
387
+ },
388
+ "agentMessageCompleted": {
389
+ "allOf": [
390
+ {
391
+ "$ref": "#/$defs/base"
392
+ },
393
+ {
394
+ "type": "object",
395
+ "properties": {
396
+ "type": {
397
+ "const": "agent.message.completed"
398
+ },
399
+ "content": {
400
+ "type": "string"
401
+ },
402
+ "tokens": {
403
+ "oneOf": [
404
+ { "$ref": "#/$defs/tokenUsage" },
405
+ { "type": "null" }
406
+ ]
407
+ },
408
+ "cost_usd": {
409
+ "oneOf": [
410
+ { "$ref": "#/$defs/nonNegativeNumber" },
411
+ { "type": "null" }
412
+ ]
413
+ }
414
+ },
415
+ "required": [
416
+ "type",
417
+ "content"
418
+ ]
419
+ }
420
+ ],
421
+ "unevaluatedProperties": false
422
+ },
423
+ "agentTurnExhausted": {
424
+ "allOf": [
425
+ {
426
+ "$ref": "#/$defs/base"
427
+ },
428
+ {
429
+ "type": "object",
430
+ "properties": {
431
+ "type": {
432
+ "const": "agent.turn.exhausted"
433
+ },
434
+ "max_iterations": {
435
+ "$ref": "#/$defs/nonNegativeInteger"
436
+ },
437
+ "pending_tool_calls": {
438
+ "type": "array",
439
+ "items": {
440
+ "$ref": "#/$defs/jsonObject"
441
+ }
442
+ },
443
+ "reason": {
444
+ "type": [
445
+ "string",
446
+ "null"
447
+ ]
448
+ }
449
+ },
450
+ "required": [
451
+ "type",
452
+ "max_iterations",
453
+ "pending_tool_calls"
454
+ ]
455
+ }
456
+ ],
457
+ "unevaluatedProperties": false
458
+ },
459
+ "agentTurnFailed": {
460
+ "allOf": [
461
+ {
462
+ "$ref": "#/$defs/base"
463
+ },
464
+ {
465
+ "type": "object",
466
+ "properties": {
467
+ "type": {
468
+ "const": "agent.turn.failed"
469
+ },
470
+ "turn_id": {
471
+ "$ref": "#/$defs/nonEmptyId"
472
+ },
473
+ "error": {
474
+ "type": "string",
475
+ "minLength": 1,
476
+ "maxLength": 200
477
+ },
478
+ "error_code": {
479
+ "type": "string"
480
+ },
481
+ "phase": {
482
+ "enum": [
483
+ "queue",
484
+ "provider_open",
485
+ "provider_stream",
486
+ "approval",
487
+ "tool"
488
+ ]
489
+ },
490
+ "retryable": {
491
+ "type": "boolean"
492
+ },
493
+ "outcome": {
494
+ "enum": [
495
+ "not_started",
496
+ "failed",
497
+ "unknown"
498
+ ]
499
+ }
500
+ },
501
+ "required": [
502
+ "type",
503
+ "turn_id",
504
+ "error"
505
+ ]
506
+ }
507
+ ],
508
+ "unevaluatedProperties": false
509
+ },
510
+ "toolCallRequested": {
511
+ "allOf": [
512
+ {
513
+ "$ref": "#/$defs/base"
514
+ },
515
+ {
516
+ "type": "object",
517
+ "properties": {
518
+ "type": {
519
+ "const": "tool.call.requested"
520
+ },
521
+ "turn_id": {
522
+ "$ref": "#/$defs/nonEmptyId"
523
+ },
524
+ "tool_name": {
525
+ "$ref": "#/$defs/nonEmptyId"
526
+ },
527
+ "tool_args": {
528
+ "$ref": "#/$defs/jsonObject",
529
+ "x-maxSerializedBytes": 65536
530
+ },
531
+ "tool_call_id": {
532
+ "$ref": "#/$defs/nonEmptyId"
533
+ }
534
+ },
535
+ "required": [
536
+ "type",
537
+ "turn_id",
538
+ "tool_name",
539
+ "tool_args",
540
+ "tool_call_id"
541
+ ]
542
+ }
543
+ ],
544
+ "unevaluatedProperties": false
545
+ },
546
+ "toolCallStarted": {
547
+ "allOf": [
548
+ {
549
+ "$ref": "#/$defs/base"
550
+ },
551
+ {
552
+ "type": "object",
553
+ "properties": {
554
+ "type": {
555
+ "const": "tool.call.started"
556
+ },
557
+ "turn_id": {
558
+ "$ref": "#/$defs/nonEmptyId"
559
+ },
560
+ "tool_name": {
561
+ "$ref": "#/$defs/nonEmptyId"
562
+ },
563
+ "tool_call_id": {
564
+ "$ref": "#/$defs/nonEmptyId"
565
+ }
566
+ },
567
+ "required": [
568
+ "type",
569
+ "turn_id",
570
+ "tool_name",
571
+ "tool_call_id"
572
+ ]
573
+ }
574
+ ],
575
+ "unevaluatedProperties": false
576
+ },
577
+ "toolCallCompleted": {
578
+ "allOf": [
579
+ {
580
+ "$ref": "#/$defs/base"
581
+ },
582
+ {
583
+ "type": "object",
584
+ "properties": {
585
+ "type": {
586
+ "const": "tool.call.completed"
587
+ },
588
+ "turn_id": {
589
+ "$ref": "#/$defs/nonEmptyId"
590
+ },
591
+ "tool_name": {
592
+ "$ref": "#/$defs/nonEmptyId"
593
+ },
594
+ "tool_call_id": {
595
+ "$ref": "#/$defs/nonEmptyId"
596
+ },
597
+ "result": {
598
+ "$ref": "#/$defs/jsonValue",
599
+ "x-maxSerializedBytes": 65536
600
+ },
601
+ "tokens": {
602
+ "oneOf": [
603
+ { "$ref": "#/$defs/tokenUsage" },
604
+ { "type": "null" }
605
+ ]
606
+ },
607
+ "cost_usd": {
608
+ "oneOf": [
609
+ { "$ref": "#/$defs/nonNegativeNumber" },
610
+ { "type": "null" }
611
+ ]
612
+ }
613
+ },
614
+ "required": [
615
+ "type",
616
+ "turn_id",
617
+ "tool_name",
618
+ "tool_call_id",
619
+ "result"
620
+ ]
621
+ }
622
+ ],
623
+ "unevaluatedProperties": false
624
+ },
625
+ "toolCallFailed": {
626
+ "allOf": [
627
+ {
628
+ "$ref": "#/$defs/base"
629
+ },
630
+ {
631
+ "type": "object",
632
+ "properties": {
633
+ "type": {
634
+ "const": "tool.call.failed"
635
+ },
636
+ "turn_id": {
637
+ "$ref": "#/$defs/nonEmptyId"
638
+ },
639
+ "tool_name": {
640
+ "$ref": "#/$defs/nonEmptyId"
641
+ },
642
+ "tool_call_id": {
643
+ "$ref": "#/$defs/nonEmptyId"
644
+ },
645
+ "error": {
646
+ "type": "string",
647
+ "minLength": 1,
648
+ "maxLength": 200
649
+ },
650
+ "error_code": {
651
+ "type": "string"
652
+ },
653
+ "error_path": {
654
+ "type": "string"
655
+ },
656
+ "retryable": {
657
+ "type": "boolean"
658
+ },
659
+ "outcome": {
660
+ "enum": [
661
+ "not_started",
662
+ "failed",
663
+ "unknown"
664
+ ]
665
+ },
666
+ "reason_code": {
667
+ "type": "string"
668
+ },
669
+ "recovery_code": {
670
+ "type": "string"
671
+ },
672
+ "doc_url": {
673
+ "type": "string"
674
+ }
675
+ },
676
+ "required": [
677
+ "type",
678
+ "turn_id",
679
+ "tool_name",
680
+ "tool_call_id",
681
+ "error"
682
+ ]
683
+ },
684
+ {
685
+ "if": {
686
+ "anyOf": [
687
+ { "required": ["reason_code"] },
688
+ { "required": ["recovery_code"] },
689
+ { "required": ["doc_url"] }
690
+ ]
691
+ },
692
+ "then": {
693
+ "$ref": "#/$defs/integrationRecoveryFields"
694
+ }
695
+ }
696
+ ],
697
+ "unevaluatedProperties": false
698
+ },
699
+ "toolApprovalRequested": {
700
+ "allOf": [
701
+ {
702
+ "$ref": "#/$defs/base"
703
+ },
704
+ {
705
+ "type": "object",
706
+ "properties": {
707
+ "type": {
708
+ "const": "tool.approval.requested"
709
+ },
710
+ "turn_id": {
711
+ "$ref": "#/$defs/nonEmptyId"
712
+ },
713
+ "tool_name": {
714
+ "$ref": "#/$defs/nonEmptyId"
715
+ },
716
+ "tool_call_id": {
717
+ "$ref": "#/$defs/nonEmptyId"
718
+ },
719
+ "tool_args": {
720
+ "$ref": "#/$defs/jsonObject",
721
+ "x-maxSerializedBytes": 65536
722
+ },
723
+ "risk": {
724
+ "enum": [
725
+ "read",
726
+ "write",
727
+ "external_effect",
728
+ "destructive",
729
+ "admin"
730
+ ]
731
+ }
732
+ },
733
+ "required": [
734
+ "type",
735
+ "turn_id",
736
+ "tool_name",
737
+ "tool_call_id",
738
+ "tool_args",
739
+ "risk"
740
+ ]
741
+ }
742
+ ],
743
+ "unevaluatedProperties": false
744
+ },
745
+ "toolApprovalApproved": {
746
+ "allOf": [
747
+ {
748
+ "$ref": "#/$defs/base"
749
+ },
750
+ {
751
+ "type": "object",
752
+ "properties": {
753
+ "type": {
754
+ "const": "tool.approval.approved"
755
+ },
756
+ "turn_id": {
757
+ "$ref": "#/$defs/nonEmptyId"
758
+ },
759
+ "tool_name": {
760
+ "$ref": "#/$defs/nonEmptyId"
761
+ },
762
+ "tool_call_id": {
763
+ "$ref": "#/$defs/nonEmptyId"
764
+ }
765
+ },
766
+ "required": [
767
+ "type",
768
+ "turn_id",
769
+ "tool_name",
770
+ "tool_call_id"
771
+ ]
772
+ }
773
+ ],
774
+ "unevaluatedProperties": false
775
+ },
776
+ "toolApprovalRejected": {
777
+ "allOf": [
778
+ {
779
+ "$ref": "#/$defs/base"
780
+ },
781
+ {
782
+ "type": "object",
783
+ "properties": {
784
+ "type": {
785
+ "const": "tool.approval.rejected"
786
+ },
787
+ "turn_id": {
788
+ "$ref": "#/$defs/nonEmptyId"
789
+ },
790
+ "tool_name": {
791
+ "$ref": "#/$defs/nonEmptyId"
792
+ },
793
+ "tool_call_id": {
794
+ "$ref": "#/$defs/nonEmptyId"
795
+ },
796
+ "error_code": {
797
+ "enum": [
798
+ "APPROVAL_REJECTED",
799
+ "APPROVAL_TIMEOUT",
800
+ "TURN_TIMEOUT",
801
+ "TOOL_CANCELLED",
802
+ "APPROVAL_UNAVAILABLE"
803
+ ]
804
+ },
805
+ "reason": {
806
+ "type": "string",
807
+ "minLength": 1,
808
+ "maxLength": 200,
809
+ "pattern": "\\S"
810
+ }
811
+ },
812
+ "required": [
813
+ "type",
814
+ "turn_id",
815
+ "tool_name",
816
+ "tool_call_id",
817
+ "error_code",
818
+ "reason"
819
+ ]
820
+ }
821
+ ],
822
+ "unevaluatedProperties": false
823
+ },
824
+ "workflowStarted": {
825
+ "allOf": [
826
+ {
827
+ "$ref": "#/$defs/base"
828
+ },
829
+ {
830
+ "type": "object",
831
+ "properties": {
832
+ "type": {
833
+ "const": "workflow.started"
834
+ },
835
+ "workflow_name": {
836
+ "type": "string"
837
+ }
838
+ },
839
+ "required": [
840
+ "type",
841
+ "workflow_name"
842
+ ]
843
+ }
844
+ ],
845
+ "unevaluatedProperties": false
846
+ },
847
+ "workflowCompleted": {
848
+ "allOf": [
849
+ {
850
+ "$ref": "#/$defs/base"
851
+ },
852
+ {
853
+ "type": "object",
854
+ "properties": {
855
+ "type": {
856
+ "const": "workflow.completed"
857
+ },
858
+ "workflow_name": {
859
+ "type": "string"
860
+ },
861
+ "result": {
862
+ "$ref": "#/$defs/jsonValue"
863
+ }
864
+ },
865
+ "required": [
866
+ "type",
867
+ "workflow_name",
868
+ "result"
869
+ ]
870
+ }
871
+ ],
872
+ "unevaluatedProperties": false
873
+ },
874
+ "workflowFailed": {
875
+ "allOf": [
876
+ {
877
+ "$ref": "#/$defs/base"
878
+ },
879
+ {
880
+ "type": "object",
881
+ "properties": {
882
+ "type": {
883
+ "const": "workflow.failed"
884
+ },
885
+ "workflow_name": {
886
+ "type": "string"
887
+ },
888
+ "error": {
889
+ "type": "string"
890
+ }
891
+ },
892
+ "required": [
893
+ "type",
894
+ "workflow_name",
895
+ "error"
896
+ ]
897
+ }
898
+ ],
899
+ "unevaluatedProperties": false
900
+ },
901
+ "cancellationRequested": {
902
+ "allOf": [
903
+ {
904
+ "$ref": "#/$defs/base"
905
+ },
906
+ {
907
+ "type": "object",
908
+ "properties": {
909
+ "type": {
910
+ "const": "cancellation.requested"
911
+ },
912
+ "reason": {
913
+ "type": "string"
914
+ }
915
+ },
916
+ "required": [
917
+ "type",
918
+ "reason"
919
+ ]
920
+ }
921
+ ],
922
+ "unevaluatedProperties": false
923
+ },
924
+ "cancellationCompleted": {
925
+ "allOf": [
926
+ {
927
+ "$ref": "#/$defs/base"
928
+ },
929
+ {
930
+ "type": "object",
931
+ "properties": {
932
+ "type": {
933
+ "const": "cancellation.completed"
934
+ }
935
+ },
936
+ "required": [
937
+ "type"
938
+ ]
939
+ }
940
+ ],
941
+ "unevaluatedProperties": false
942
+ }
943
+ },
944
+ "oneOf": [
945
+ {
946
+ "$ref": "#/$defs/sessionCreated"
947
+ },
948
+ {
949
+ "$ref": "#/$defs/sessionClosed"
950
+ },
951
+ {
952
+ "$ref": "#/$defs/userMessage"
953
+ },
954
+ {
955
+ "$ref": "#/$defs/userAudioChunk"
956
+ },
957
+ {
958
+ "$ref": "#/$defs/transcriptPartial"
959
+ },
960
+ {
961
+ "$ref": "#/$defs/transcriptFinal"
962
+ },
963
+ {
964
+ "$ref": "#/$defs/memoryRetrievalStarted"
965
+ },
966
+ {
967
+ "$ref": "#/$defs/memoryRetrievalCompleted"
968
+ },
969
+ {
970
+ "$ref": "#/$defs/agentReasoningStarted"
971
+ },
972
+ {
973
+ "$ref": "#/$defs/agentMessageDelta"
974
+ },
975
+ {
976
+ "$ref": "#/$defs/agentMessageCompleted"
977
+ },
978
+ {
979
+ "$ref": "#/$defs/agentTurnExhausted"
980
+ },
981
+ {
982
+ "$ref": "#/$defs/agentTurnFailed"
983
+ },
984
+ {
985
+ "$ref": "#/$defs/toolCallRequested"
986
+ },
987
+ {
988
+ "$ref": "#/$defs/toolCallStarted"
989
+ },
990
+ {
991
+ "$ref": "#/$defs/toolCallCompleted"
992
+ },
993
+ {
994
+ "$ref": "#/$defs/toolCallFailed"
995
+ },
996
+ {
997
+ "$ref": "#/$defs/toolApprovalRequested"
998
+ },
999
+ {
1000
+ "$ref": "#/$defs/toolApprovalApproved"
1001
+ },
1002
+ {
1003
+ "$ref": "#/$defs/toolApprovalRejected"
1004
+ },
1005
+ {
1006
+ "$ref": "#/$defs/workflowStarted"
1007
+ },
1008
+ {
1009
+ "$ref": "#/$defs/workflowCompleted"
1010
+ },
1011
+ {
1012
+ "$ref": "#/$defs/workflowFailed"
1013
+ },
1014
+ {
1015
+ "$ref": "#/$defs/cancellationRequested"
1016
+ },
1017
+ {
1018
+ "$ref": "#/$defs/cancellationCompleted"
1019
+ }
1020
+ ]
1021
+ }