@irogane/kaji 0.2.0-beta.11 → 0.3.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 (137) hide show
  1. package/README.md +112 -551
  2. package/dist/index.d.mts +253 -0
  3. package/dist/index.mjs +440 -0
  4. package/package.json +28 -166
  5. package/contracts/README.md +0 -14
  6. package/contracts/beta-core-v1.json +0 -52
  7. package/contracts/cli/init-cases-v1.json +0 -27
  8. package/contracts/errors/error-codes.json +0 -48
  9. package/contracts/errors/integration-recovery-v1.json +0 -127
  10. package/contracts/errors/provider-normalization.json +0 -111
  11. package/contracts/events/conformance-invalid.json +0 -20
  12. package/contracts/events/conformance.json +0 -511
  13. package/contracts/events/new-kaji-event-v1.schema.json +0 -1021
  14. package/contracts/events/stored-kaji-event-v1.schema.json +0 -1025
  15. package/contracts/feature-tiers-v1.json +0 -488
  16. package/contracts/integrations/abi-index-v1.json +0 -8
  17. package/contracts/integrations/conformance-invalid.json +0 -443
  18. package/contracts/integrations/conformance-valid.json +0 -121
  19. package/contracts/integrations/copy-provenance-v1.schema.json +0 -61
  20. package/contracts/integrations/echo-tool-abi-v1.json +0 -37
  21. package/contracts/integrations/github-api-conformance-v1.json +0 -644
  22. package/contracts/integrations/github-tool-abi-typescript-v1.json +0 -369
  23. package/contracts/integrations/github-tool-abi-v1.json +0 -146
  24. package/contracts/integrations/gmail-api-conformance-v1.json +0 -750
  25. package/contracts/integrations/gmail-tool-abi-v1.json +0 -62
  26. package/contracts/integrations/index.schema.json +0 -37
  27. package/contracts/integrations/manifest.schema.json +0 -119
  28. package/contracts/parity/expected-normalized.json +0 -4906
  29. package/contracts/parity/scenarios.json +0 -100
  30. package/contracts/parity/scenarios.schema.json +0 -214
  31. package/contracts/providers/cost-conformance.json +0 -112
  32. package/contracts/release/github-proof-v1.schema.json +0 -138
  33. package/contracts/release/gmail-proof-v1.schema.json +0 -138
  34. package/contracts/release/kaji-ts-consumer-handoff-v1.schema.json +0 -1289
  35. package/contracts/release/publisher-identity-receipt-v1.schema.json +0 -319
  36. package/contracts/release/typescript-onboarding-evidence-v1.schema.json +0 -740
  37. package/contracts/tools/conformance-invalid.json +0 -271
  38. package/contracts/tools/conformance-valid.json +0 -78
  39. package/contracts/tools/tool-schema-v1.schema.json +0 -18
  40. package/dist/anthropic.cjs +0 -1231
  41. package/dist/anthropic.cjs.map +0 -1
  42. package/dist/anthropic.d.cts +0 -26
  43. package/dist/anthropic.d.ts +0 -26
  44. package/dist/anthropic.js +0 -270
  45. package/dist/anthropic.js.map +0 -1
  46. package/dist/auth.cjs +0 -1507
  47. package/dist/auth.cjs.map +0 -1
  48. package/dist/auth.d.cts +0 -129
  49. package/dist/auth.d.ts +0 -129
  50. package/dist/auth.js +0 -1039
  51. package/dist/auth.js.map +0 -1
  52. package/dist/base-B9FRMcP8.d.cts +0 -140
  53. package/dist/base-nHQd1VtS.d.ts +0 -140
  54. package/dist/chunk-AAM33KAO.js +0 -4367
  55. package/dist/chunk-AAM33KAO.js.map +0 -1
  56. package/dist/chunk-KAJ6BM64.js +0 -153
  57. package/dist/chunk-KAJ6BM64.js.map +0 -1
  58. package/dist/chunk-KCAXIOZS.js +0 -308
  59. package/dist/chunk-KCAXIOZS.js.map +0 -1
  60. package/dist/chunk-LSJ4AVO2.js +0 -243
  61. package/dist/chunk-LSJ4AVO2.js.map +0 -1
  62. package/dist/chunk-TM7ZGOJX.js +0 -716
  63. package/dist/chunk-TM7ZGOJX.js.map +0 -1
  64. package/dist/cli/bin.d.ts +0 -2
  65. package/dist/cli/bin.js +0 -13
  66. package/dist/cli/bin.js.map +0 -1
  67. package/dist/cli/chunk-2RCWPRVY.js +0 -6277
  68. package/dist/cli/chunk-2RCWPRVY.js.map +0 -1
  69. package/dist/cli/chunk-SEBX54TR.js +0 -681
  70. package/dist/cli/chunk-SEBX54TR.js.map +0 -1
  71. package/dist/cli/index.d.ts +0 -232
  72. package/dist/cli/index.js +0 -11
  73. package/dist/cli/index.js.map +0 -1
  74. package/dist/cli/init-worker.d.ts +0 -2
  75. package/dist/cli/init-worker.js +0 -18
  76. package/dist/cli/init-worker.js.map +0 -1
  77. package/dist/cli/integration-copy-worker.js +0 -48
  78. package/dist/cli/integration-copy-worker.js.map +0 -1
  79. package/dist/cli/package-entry-cjs.cjs +0 -21
  80. package/dist/cli/package-entry-cjs.cjs.map +0 -1
  81. package/dist/cli/package-entry-cjs.d.cts +0 -2
  82. package/dist/cli/package-entry.d.ts +0 -2
  83. package/dist/cli/package-entry.js +0 -13
  84. package/dist/cli/package-entry.js.map +0 -1
  85. package/dist/context-BaFHrQHv.d.cts +0 -21
  86. package/dist/context-BaFHrQHv.d.ts +0 -21
  87. package/dist/context-C-YPY-GS.d.cts +0 -1538
  88. package/dist/context-C-YPY-GS.d.ts +0 -1538
  89. package/dist/index.cjs +0 -12346
  90. package/dist/index.cjs.map +0 -1
  91. package/dist/index.d.cts +0 -1560
  92. package/dist/index.d.ts +0 -1560
  93. package/dist/index.js +0 -7852
  94. package/dist/index.js.map +0 -1
  95. package/dist/integrations/github.cjs +0 -2092
  96. package/dist/integrations/github.cjs.map +0 -1
  97. package/dist/integrations/github.d.cts +0 -21
  98. package/dist/integrations/github.d.ts +0 -21
  99. package/dist/integrations/github.js +0 -2088
  100. package/dist/integrations/github.js.map +0 -1
  101. package/dist/integrations.cjs +0 -3370
  102. package/dist/integrations.cjs.map +0 -1
  103. package/dist/integrations.d.cts +0 -202
  104. package/dist/integrations.d.ts +0 -202
  105. package/dist/integrations.js +0 -2650
  106. package/dist/integrations.js.map +0 -1
  107. package/dist/observability-Cj--OkME.d.cts +0 -96
  108. package/dist/observability-Cj--OkME.d.ts +0 -96
  109. package/dist/openai.cjs +0 -1235
  110. package/dist/openai.cjs.map +0 -1
  111. package/dist/openai.d.cts +0 -32
  112. package/dist/openai.d.ts +0 -32
  113. package/dist/openai.js +0 -272
  114. package/dist/openai.js.map +0 -1
  115. package/dist/testing.cjs +0 -554
  116. package/dist/testing.cjs.map +0 -1
  117. package/dist/testing.d.cts +0 -43
  118. package/dist/testing.d.ts +0 -43
  119. package/dist/testing.js +0 -118
  120. package/dist/testing.js.map +0 -1
  121. package/registry/echo/index.ts +0 -53
  122. package/registry/echo/manifest.json +0 -53
  123. package/registry/github/LICENSE +0 -105
  124. package/registry/github/client.ts +0 -1727
  125. package/registry/github/index.ts +0 -263
  126. package/registry/github/manifest.json +0 -227
  127. package/registry/github/owner-fixtures.json +0 -10
  128. package/registry/github/tests/github.test.ts +0 -32
  129. package/registry/gmail/LICENSE +0 -105
  130. package/registry/gmail/client.ts +0 -548
  131. package/registry/gmail/index.ts +0 -165
  132. package/registry/gmail/manifest.json +0 -102
  133. package/registry/gmail/owner-fixtures.json +0 -10
  134. package/registry/gmail/tests/gmail.test.ts +0 -32
  135. package/registry/index.json +0 -21
  136. package/registry/index.schema.json +0 -37
  137. package/registry/schema.json +0 -119
package/package.json CHANGED
@@ -1,188 +1,50 @@
1
1
  {
2
2
  "name": "@irogane/kaji",
3
- "version": "0.2.0-beta.11",
4
- "description": "Embeddable SDK for building agents in TypeScript: event-sourced runtime, tool registry, session replay. Infra-free core.",
5
- "homepage": "https://github.com/enkyuan/alloy/blob/main/docs/kaji/README.md",
3
+ "version": "0.3.0",
4
+ "description": "Execution primitives for safely running application actions requested by AI agents.",
5
+ "homepage": "https://kaji.build",
6
6
  "bugs": {
7
- "url": "https://github.com/enkyuan/alloy/issues"
7
+ "url": "https://github.com/enkyuan/kaji/issues"
8
8
  },
9
9
  "license": "FSL-1.1-ALv2",
10
10
  "repository": {
11
11
  "type": "git",
12
- "url": "git+https://github.com/enkyuan/alloy.git",
13
- "directory": "kaji/packages/ts"
14
- },
15
- "bin": {
16
- "kaji": "dist/cli/bin.js"
12
+ "url": "git+https://github.com/enkyuan/kaji.git",
13
+ "directory": "packages/ts"
17
14
  },
18
15
  "files": [
19
- "LICENSE",
20
- "contracts",
21
- "dist",
22
- "registry/index.json",
23
- "registry/index.schema.json",
24
- "registry/schema.json",
25
- "registry/echo/index.ts",
26
- "registry/echo/manifest.json",
27
- "registry/github/LICENSE",
28
- "registry/github/client.ts",
29
- "registry/github/index.ts",
30
- "registry/github/manifest.json",
31
- "registry/github/owner-fixtures.json",
32
- "registry/github/tests/github.test.ts",
33
- "registry/gmail/LICENSE",
34
- "registry/gmail/client.ts",
35
- "registry/gmail/index.ts",
36
- "registry/gmail/manifest.json",
37
- "registry/gmail/owner-fixtures.json",
38
- "registry/gmail/tests/gmail.test.ts"
16
+ "dist"
39
17
  ],
40
18
  "type": "module",
41
19
  "sideEffects": false,
42
- "main": "./dist/index.cjs",
43
- "module": "./dist/index.js",
44
- "types": "./dist/index.d.ts",
45
20
  "exports": {
46
21
  ".": {
47
- "import": {
48
- "types": "./dist/index.d.ts",
49
- "default": "./dist/index.js"
50
- },
51
- "require": {
52
- "types": "./dist/index.d.cts",
53
- "default": "./dist/index.cjs"
54
- }
55
- },
56
- "./testing": {
57
- "import": {
58
- "types": "./dist/testing.d.ts",
59
- "default": "./dist/testing.js"
60
- },
61
- "require": {
62
- "types": "./dist/testing.d.cts",
63
- "default": "./dist/testing.cjs"
64
- }
65
- },
66
- "./openai": {
67
- "import": {
68
- "types": "./dist/openai.d.ts",
69
- "default": "./dist/openai.js"
70
- },
71
- "require": {
72
- "types": "./dist/openai.d.cts",
73
- "default": "./dist/openai.cjs"
74
- }
75
- },
76
- "./anthropic": {
77
- "import": {
78
- "types": "./dist/anthropic.d.ts",
79
- "default": "./dist/anthropic.js"
80
- },
81
- "require": {
82
- "types": "./dist/anthropic.d.cts",
83
- "default": "./dist/anthropic.cjs"
84
- }
85
- },
86
- "./integrations": {
87
- "import": {
88
- "types": "./dist/integrations.d.ts",
89
- "default": "./dist/integrations.js"
90
- },
91
- "require": {
92
- "types": "./dist/integrations.d.cts",
93
- "default": "./dist/integrations.cjs"
94
- }
95
- },
96
- "./integrations/github": {
97
- "import": {
98
- "types": "./dist/integrations/github.d.ts",
99
- "default": "./dist/integrations/github.js"
100
- },
101
- "require": {
102
- "types": "./dist/integrations/github.d.cts",
103
- "default": "./dist/integrations/github.cjs"
104
- }
105
- },
106
- "./auth": {
107
- "import": {
108
- "types": "./dist/auth.d.ts",
109
- "default": "./dist/auth.js"
110
- },
111
- "require": {
112
- "types": "./dist/auth.d.cts",
113
- "default": "./dist/auth.cjs"
114
- }
115
- },
116
- "./cli": {
117
- "import": {
118
- "types": "./dist/cli/package-entry.d.ts",
119
- "default": "./dist/cli/package-entry.js"
120
- },
121
- "require": {
122
- "types": "./dist/cli/package-entry-cjs.d.cts",
123
- "default": "./dist/cli/package-entry-cjs.cjs"
124
- }
22
+ "types": "./dist/index.d.mts",
23
+ "import": "./dist/index.mjs"
125
24
  }
126
25
  },
26
+ "publishConfig": {
27
+ "access": "public",
28
+ "registry": "https://registry.npmjs.org/"
29
+ },
127
30
  "scripts": {
128
- "prebuild": "bun run validate:registry",
129
- "build": "tsup",
130
- "dev": "tsup --watch",
131
- "typecheck": "tsc --noEmit",
132
- "typecheck:registry": "tsc -p tsconfig.registry.json --noEmit",
133
- "lint": "oxlint src tests scripts registry",
134
- "format": "oxfmt --write \"**/*.ts\"",
135
- "format:check": "oxfmt --check \"**/*.ts\"",
136
- "lint:package": "bun run build && publint run . --strict && attw --pack --profile node16",
137
- "parity": "uv run --project ../py python ../../scripts/check_sdk_parity.py",
138
- "test": "PATH=\"${PATH#*:}:/usr/local/bin:/opt/homebrew/bin\" /bin/sh -c 'exec \"$(command -v node)\" ./node_modules/vitest/vitest.mjs run \"$@\"' --",
139
- "test:coverage": "PATH=\"${PATH#*:}:/usr/local/bin:/opt/homebrew/bin\" /bin/sh -c 'exec \"$(command -v node)\" ./node_modules/vitest/vitest.mjs run --coverage --coverage.include=\"src/**/*.ts\" --coverage.include=\"registry/**/*.ts\" --coverage.exclude=\"src/**/*.d.ts\" --coverage.exclude=\"registry/**/tests/**/*.test.ts\" --coverage.reporter=text --coverage.reporter=json-summary --coverage.thresholds.lines=80 --coverage.thresholds.functions=80 --coverage.thresholds.branches=80 --coverage.thresholds.statements=80 \"$@\"' --",
140
- "test:complexity": "PATH=\"${PATH#*:}:/usr/local/bin:/opt/homebrew/bin\" /bin/sh -c 'exec \"$(command -v node)\" ./node_modules/vitest/vitest.mjs run tests/runtime-complexity.test.ts tests/runtime-faults.test.ts \"$@\"' --",
141
- "benchmark:beta": "bun benchmarks/runtime-benchmark.ts",
142
- "soak:beta": "bun benchmarks/runtime-soak.ts",
143
- "test:quickstart": "PATH=\"${PATH#*:}:/usr/local/bin:/opt/homebrew/bin\" /bin/sh -c 'exec \"$(command -v node)\" ./node_modules/vitest/vitest.mjs run examples/minimal-agent/smoke.test.ts \"$@\"' --",
144
- "test:integration": "PATH=\"${PATH#*:}:/usr/local/bin:/opt/homebrew/bin\" /bin/sh -c 'exec \"$(command -v node)\" ./node_modules/vitest/vitest.mjs run --config vitest.integration.config.ts \"$@\"' --",
145
- "test:watch": "PATH=\"${PATH#*:}:/usr/local/bin:/opt/homebrew/bin\" /bin/sh -c 'exec \"$(command -v node)\" ./node_modules/vitest/vitest.mjs \"$@\"' --",
146
- "check:integrations": "bun run scripts/check_integration_sources.ts",
31
+ "build": "tsdown",
147
32
  "clean": "rm -rf dist",
148
- "package:smoke": "bun run build && bun scripts/smoke_package.mts",
149
- "validate:registry": "bun run scripts/validate_registry.ts"
150
- },
151
- "dependencies": {
152
- "ajv": "^8.20.0",
153
- "ajv-formats": "^3.0.1"
33
+ "typecheck": "tsc --noEmit",
34
+ "lint": "oxlint src tests scripts",
35
+ "format": "oxfmt --write package.json tsconfig.json tsdown.config.ts src tests scripts",
36
+ "format:check": "oxfmt --check package.json tsconfig.json tsdown.config.ts src tests scripts",
37
+ "test": "vitest run",
38
+ "package:check": "bun run build && publint && attw --pack . --profile esm-only",
39
+ "package:smoke": "bun run build && bun run scripts/smoke-package.ts"
154
40
  },
155
41
  "devDependencies": {
156
- "@anthropic-ai/sdk": "^0.104.1",
157
- "@arethetypeswrong/cli": "0.18.4",
158
- "@dotenvx/dotenvx": "2.9.0",
159
- "@types/bun": "^1.0.0",
160
- "@types/node": "^22.10.2",
161
- "@vitest/coverage-v8": "4.1.9",
162
- "openai": "^6.42.0",
163
- "oxfmt": "^0.54.0",
164
- "publint": "0.3.21",
165
- "tsup": "^8.3.5",
166
- "typescript": "^6.0.2",
167
- "typescript57": "npm:typescript@5.7.3",
168
- "vitest": "4.1.9",
169
- "zod": "^4.3.6"
170
- },
171
- "peerDependencies": {
172
- "@anthropic-ai/sdk": ">=0.30 <2",
173
- "openai": ">=4 <8",
174
- "zod": ">=4.3 <5"
175
- },
176
- "peerDependenciesMeta": {
177
- "openai": {
178
- "optional": true
179
- },
180
- "@anthropic-ai/sdk": {
181
- "optional": true
182
- }
183
- },
184
- "optionalDependencies": {},
185
- "engines": {
186
- "node": "22.x || 24.x"
42
+ "@arethetypeswrong/cli": "^0.18.2",
43
+ "oxfmt": "^0.68.0",
44
+ "oxlint": "^1.68.0",
45
+ "publint": "^0.3.12",
46
+ "tsdown": "^0.17.3",
47
+ "typescript": "^6.0.3",
48
+ "vitest": "^4.1.0"
187
49
  }
188
50
  }
@@ -1,14 +0,0 @@
1
- # Kaji beta contracts
2
-
3
- These files define the behavior shared by the Python and TypeScript SDK beta.
4
-
5
- - `beta-core-v1.json` pins public defaults and stability boundaries.
6
- - `feature-tiers-v1.json` is the machine-readable stable/experimental surface.
7
- - `events/` separates event drafts from sequenced stored events.
8
- - `tools/` contains the tool-spec schema and shared validation fixtures.
9
- - `errors/error-codes.json` is the normalized public failure vocabulary;
10
- `errors/provider-normalization.json` pins cross-SDK status classification.
11
-
12
- Canonical files live in `kaji/contracts`. Package copies are generated and
13
- checked by `kaji/scripts/sync_beta_contracts.py`; do not edit package copies
14
- directly.
@@ -1,52 +0,0 @@
1
- {
2
- "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "$id": "https://kaji.dev/contracts/beta-core-v1.json",
4
- "contractVersion": "1.0.0",
5
- "runtime": {
6
- "sameSessionTurns": "serialized",
7
- "crossSessionTurns": "concurrent",
8
- "maxToolIterations": 5,
9
- "contextWindowTurns": 32,
10
- "contextWindowCharacters": 100000,
11
- "turnTimeoutMs": 120000,
12
- "providerCancellationGraceMs": 5000,
13
- "providerTextMaxBytes": 262144,
14
- "providerToolArgumentsMaxBytes": 65536,
15
- "providerResponseMaxBytes": 524288,
16
- "providerToolCallsMax": 64
17
- },
18
- "tools": {
19
- "schemaDraft": "2020-12",
20
- "validateFormats": true,
21
- "maxConcurrency": 4,
22
- "timeoutMs": 30000,
23
- "approvalTimeoutMs": 300000,
24
- "riskRequired": true,
25
- "idempotencyKey": "session_id:tool_call_id",
26
- "idempotencyMaxEntries": 10000,
27
- "idempotencyCompletedTtlSeconds": 86400
28
- },
29
- "events": {
30
- "ordering": "store_sequence",
31
- "draftSchema": "new-kaji-event-v1.schema.json",
32
- "storedSchema": "stored-kaji-event-v1.schema.json",
33
- "warmProjection": "cursor_suffix",
34
- "subscriberQueueCapacity": 1024,
35
- "maxDurableToolArgumentBytes": 65536,
36
- "maxDurableToolResultBytes": 65536,
37
- "maxDurableEventBytes": 1048576,
38
- "inMemoryStoreMaxSessions": 1000,
39
- "inMemoryStoreMaxEventsPerSession": 10000,
40
- "inMemorySessionAdmission": "fail_closed_until_explicit_purge",
41
- "purgedSessionReuse": "fresh_sequence",
42
- "purgeClosesExistingSubscribers": true,
43
- "purgeFencesDirectStoreOperations": true,
44
- "postDeleteCleanup": "tombstone_until_converged",
45
- "splitDeliveryPurge": "unsupported",
46
- "overflow": "typed_error"
47
- },
48
- "integrations": {
49
- "stable": ["echo", "github", "gmail"],
50
- "experimentalRequiresOptIn": true
51
- }
52
- }
@@ -1,27 +0,0 @@
1
- {
2
- "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "schemaVersion": 1,
4
- "grammar": "kaji [--no-color] [--verbose] init [path] --provider mock|openai|anthropic --yes --force",
5
- "defaults": {
6
- "path": ".",
7
- "provider": "mock"
8
- },
9
- "exitCodes": {
10
- "successOrHelp": 0,
11
- "validationRuntimeOrConflict": 1,
12
- "usage": 2
13
- },
14
- "cases": [
15
- { "name": "defaults", "args": [], "exitCode": 0 },
16
- { "name": "explicit-path", "args": ["project"], "exitCode": 0 },
17
- { "name": "mock-provider", "args": ["--provider", "mock"], "exitCode": 0 },
18
- { "name": "openai-provider", "args": ["--provider", "openai"], "exitCode": 0 },
19
- { "name": "anthropic-provider", "args": ["--provider", "anthropic"], "exitCode": 0 },
20
- { "name": "yes", "args": ["--yes"], "exitCode": 0 },
21
- { "name": "force", "args": ["--force"], "setup": "existing-file", "exitCode": 0 },
22
- { "name": "unknown-provider", "args": ["--provider", "unknown"], "exitCode": 2 },
23
- { "name": "missing-provider-value", "args": ["--provider"], "exitCode": 2 },
24
- { "name": "unknown-option", "args": ["--unknown"], "exitCode": 2 },
25
- { "name": "existing-file-refusal", "args": [], "setup": "existing-file", "exitCode": 1 }
26
- ]
27
- }
@@ -1,48 +0,0 @@
1
- {
2
- "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "$id": "https://kaji.dev/contracts/errors/error-codes.json",
4
- "version": "1.0.0",
5
- "codes": [
6
- "INVALID_TOOL_SCHEMA",
7
- "INVALID_TOOL_ARGUMENTS",
8
- "INVALID_DURABLE_VALUE",
9
- "INVALID_TOOL_RESULT",
10
- "UNCLASSIFIED_TOOL_RISK",
11
- "MISSING_TOOL_IDENTITY",
12
- "TOOL_NOT_ALLOWED",
13
- "APPROVAL_UNAVAILABLE",
14
- "APPROVAL_REJECTED",
15
- "APPROVAL_TIMEOUT",
16
- "TOOL_CANCELLED",
17
- "TOOL_TIMEOUT",
18
- "TOOL_EXECUTION_FAILED",
19
- "TOOL_START_RECORD_FAILED",
20
- "EVENT_APPEND_FAILED",
21
- "EVENT_PUBLISH_FAILED",
22
- "EVENT_ID_CONFLICT",
23
- "EVENT_BUFFER_OVERFLOW",
24
- "EVENT_PAYLOAD_TOO_LARGE",
25
- "EVENT_SCHEMA_INCOMPATIBLE",
26
- "EVENT_STORE_CAPACITY_EXCEEDED",
27
- "IDEMPOTENCY_CAPACITY_EXCEEDED",
28
- "IDEMPOTENCY_CONFLICT",
29
- "PROVIDER_API_ERROR",
30
- "PROVIDER_AUTH_ERROR",
31
- "PROVIDER_CONFIG_ERROR",
32
- "PROVIDER_NETWORK_ERROR",
33
- "PROVIDER_RATE_LIMITED",
34
- "PROVIDER_OUTPUT_LIMIT",
35
- "PROVIDER_CANCELLATION_CONTRACT_VIOLATION",
36
- "TURN_TIMEOUT",
37
- "INTEGRATION_SCHEMA_INVALID",
38
- "INTEGRATION_ABI_MISMATCH",
39
- "INTEGRATION_EXPERIMENTAL",
40
- "INTEGRATION_API_ERROR",
41
- "INTEGRATION_AUTH_REQUIRED",
42
- "INTEGRATION_AUTH_ERROR",
43
- "INTEGRATION_RATE_LIMITED",
44
- "INTEGRATION_POLICY_REJECTED",
45
- "INTEGRATION_REDIRECT_REJECTED",
46
- "INTEGRATION_RESPONSE_LIMIT"
47
- ]
48
- }
@@ -1,127 +0,0 @@
1
- {
2
- "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "$id": "https://kaji.dev/contracts/errors/integration-recovery-v1.json",
4
- "version": "1.0.0",
5
- "entries": {
6
- "github_token_missing": {
7
- "errorCode": "INTEGRATION_AUTH_REQUIRED",
8
- "recoveryCode": "CONFIGURE_GITHUB_TOKEN",
9
- "docUrl": "https://kaji.dev/docs/integrations/recovery-v1#github-token",
10
- "problem": "GitHub authentication is required.",
11
- "cause": "The configured GitHub token is unavailable.",
12
- "fix": "Set the manifest-declared GitHub token environment variable and retry."
13
- },
14
- "gmail_grant_missing": {
15
- "errorCode": "INTEGRATION_AUTH_REQUIRED",
16
- "recoveryCode": "CONNECT_GMAIL",
17
- "docUrl": "https://kaji.dev/docs/integrations/recovery-v1#gmail-grant",
18
- "problem": "Gmail authorization is required.",
19
- "cause": "No Gmail grant exists for this principal.",
20
- "fix": "Use the package-qualified connect command for this runtime and principal, then retry."
21
- },
22
- "keychain_missing": {
23
- "errorCode": "INTEGRATION_AUTH_ERROR",
24
- "recoveryCode": "RESTORE_KEYCHAIN",
25
- "docUrl": "https://kaji.dev/docs/integrations/recovery-v1#keychain-missing",
26
- "problem": "The macOS Keychain is unavailable.",
27
- "cause": "The Keychain command could not be found.",
28
- "fix": "Restore `/usr/bin/security` on a supported macOS host and retry."
29
- },
30
- "keychain_locked": {
31
- "errorCode": "INTEGRATION_AUTH_ERROR",
32
- "recoveryCode": "UNLOCK_KEYCHAIN",
33
- "docUrl": "https://kaji.dev/docs/integrations/recovery-v1#keychain-locked",
34
- "problem": "The macOS Keychain is locked.",
35
- "cause": "The stored integration grant cannot be read while Keychain is locked.",
36
- "fix": "Unlock the login Keychain and retry."
37
- },
38
- "keychain_corrupt": {
39
- "errorCode": "INTEGRATION_AUTH_ERROR",
40
- "recoveryCode": "RESET_GMAIL_GRANT",
41
- "docUrl": "https://kaji.dev/docs/integrations/recovery-v1#keychain-corrupt",
42
- "problem": "The stored Gmail grant is invalid.",
43
- "cause": "The Keychain entry is corrupt or incomplete.",
44
- "fix": "Disconnect Gmail locally, then reconnect with the same principal."
45
- },
46
- "keychain_unsupported": {
47
- "errorCode": "INTEGRATION_AUTH_ERROR",
48
- "recoveryCode": "USE_SUPPORTED_KEYCHAIN",
49
- "docUrl": "https://kaji.dev/docs/integrations/recovery-v1#keychain-unsupported",
50
- "problem": "Secure Gmail grant storage is unsupported.",
51
- "cause": "This host cannot provide the required macOS Keychain boundary.",
52
- "fix": "Use a supported macOS host; do not fall back to plaintext storage."
53
- },
54
- "gmail_scope_drift": {
55
- "errorCode": "INTEGRATION_AUTH_REQUIRED",
56
- "recoveryCode": "RECONNECT_GMAIL",
57
- "docUrl": "https://kaji.dev/docs/integrations/recovery-v1#gmail-scope-drift",
58
- "problem": "The Gmail grant no longer has the required scopes.",
59
- "cause": "Stored and required OAuth scopes differ.",
60
- "fix": "Use the package-qualified connect command for this runtime and principal, then consent again."
61
- },
62
- "policy_rejected": {
63
- "errorCode": "INTEGRATION_POLICY_REJECTED",
64
- "recoveryCode": "REVIEW_INTEGRATION_POLICY",
65
- "docUrl": "https://kaji.dev/docs/integrations/recovery-v1#policy-rejected",
66
- "problem": "The integration request was rejected before dispatch.",
67
- "cause": "A fixed-origin, repository, recipient, or schema policy did not match.",
68
- "fix": "Review the integration allowlist and request shape before retrying."
69
- },
70
- "api_rejected": {
71
- "errorCode": "INTEGRATION_API_ERROR",
72
- "recoveryCode": "REVIEW_PROVIDER_REJECTION",
73
- "docUrl": "https://kaji.dev/docs/integrations/recovery-v1#api-rejected",
74
- "problem": "The provider rejected the integration request.",
75
- "cause": "The provider returned a confirmed non-retryable API rejection.",
76
- "fix": "Review the request against the provider response guidance before retrying manually."
77
- },
78
- "transient_read_failed": {
79
- "errorCode": "INTEGRATION_API_ERROR",
80
- "recoveryCode": "RETRY_INTEGRATION_READ",
81
- "docUrl": "https://kaji.dev/docs/integrations/recovery-v1#transient-read",
82
- "problem": "The integration read did not complete.",
83
- "cause": "The provider returned a transient failure before any external effect.",
84
- "fix": "Retry the idempotent read with bounded backoff."
85
- },
86
- "rate_limited": {
87
- "errorCode": "INTEGRATION_RATE_LIMITED",
88
- "recoveryCode": "RETRY_AFTER_RATE_LIMIT",
89
- "docUrl": "https://kaji.dev/docs/integrations/recovery-v1#rate-limited",
90
- "problem": "The provider rate limit was reached.",
91
- "cause": "The provider confirmed that this request was rate limited.",
92
- "fix": "Reduce parallelism and retry only after the bounded provider delay."
93
- },
94
- "redirect_rejected": {
95
- "errorCode": "INTEGRATION_REDIRECT_REJECTED",
96
- "recoveryCode": "REJECT_PROVIDER_REDIRECT",
97
- "docUrl": "https://kaji.dev/docs/integrations/recovery-v1#redirect-rejected",
98
- "problem": "The provider returned a redirect that Kaji will not follow.",
99
- "cause": "Fixed-origin integration requests reject every redirect.",
100
- "fix": "Verify the provider endpoint; do not retry an ambiguous mutation blindly."
101
- },
102
- "response_limit_exceeded": {
103
- "errorCode": "INTEGRATION_RESPONSE_LIMIT",
104
- "recoveryCode": "REDUCE_INTEGRATION_RESPONSE",
105
- "docUrl": "https://kaji.dev/docs/integrations/recovery-v1#response-limit",
106
- "problem": "The integration response exceeded a safety bound.",
107
- "cause": "Provider headers or body were malformed or too large.",
108
- "fix": "Narrow the read request; reconcile a mutation before any retry."
109
- },
110
- "github_mutation_unknown": {
111
- "errorCode": "TOOL_EXECUTION_FAILED",
112
- "recoveryCode": "RECONCILE_GITHUB_MUTATION",
113
- "docUrl": "https://kaji.dev/docs/integrations/recovery-v1#github-mutation-unknown",
114
- "problem": "The GitHub mutation outcome is unknown.",
115
- "cause": "The connection failed after dispatch without a confirmed provider result.",
116
- "fix": "Reconcile the GitHub issue or comment marker before any manual retry."
117
- },
118
- "gmail_mutation_unknown": {
119
- "errorCode": "TOOL_EXECUTION_FAILED",
120
- "recoveryCode": "RECONCILE_GMAIL_MUTATION",
121
- "docUrl": "https://kaji.dev/docs/integrations/recovery-v1#gmail-mutation-unknown",
122
- "problem": "The Gmail mutation outcome is unknown.",
123
- "cause": "The connection failed after dispatch without a confirmed provider result.",
124
- "fix": "Reconcile the Gmail draft key or sent message before any manual retry."
125
- }
126
- }
127
- }
@@ -1,111 +0,0 @@
1
- {
2
- "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "$id": "https://kaji.dev/contracts/errors/provider-normalization.json",
4
- "version": "1.0.0",
5
- "cases": [
6
- {
7
- "name": "config",
8
- "source": "config",
9
- "status": null,
10
- "expected": {
11
- "type": "config",
12
- "code": "PROVIDER_CONFIG_ERROR",
13
- "service": "fixture",
14
- "action": "configure",
15
- "status": null,
16
- "retryable": false
17
- }
18
- },
19
- {
20
- "name": "network",
21
- "source": "network",
22
- "status": null,
23
- "expected": {
24
- "type": "network",
25
- "code": "PROVIDER_NETWORK_ERROR",
26
- "service": "fixture",
27
- "action": "stream",
28
- "status": null,
29
- "retryable": true
30
- }
31
- },
32
- {
33
- "name": "api-without-status",
34
- "source": "api",
35
- "status": null,
36
- "expected": {
37
- "type": "api",
38
- "code": "PROVIDER_API_ERROR",
39
- "service": "fixture",
40
- "action": "request",
41
- "status": null,
42
- "retryable": false
43
- }
44
- },
45
- {
46
- "name": "api-400",
47
- "source": "api",
48
- "status": 400,
49
- "expected": {
50
- "type": "api",
51
- "code": "PROVIDER_API_ERROR",
52
- "service": "fixture",
53
- "action": "request",
54
- "status": 400,
55
- "retryable": false
56
- }
57
- },
58
- {
59
- "name": "api-401-is-auth",
60
- "source": "api",
61
- "status": 401,
62
- "expected": {
63
- "type": "auth",
64
- "code": "PROVIDER_AUTH_ERROR",
65
- "service": "fixture",
66
- "action": "request",
67
- "status": 401,
68
- "retryable": false
69
- }
70
- },
71
- {
72
- "name": "api-403-is-auth",
73
- "source": "api",
74
- "status": 403,
75
- "expected": {
76
- "type": "auth",
77
- "code": "PROVIDER_AUTH_ERROR",
78
- "service": "fixture",
79
- "action": "request",
80
- "status": 403,
81
- "retryable": false
82
- }
83
- },
84
- {
85
- "name": "api-429-is-rate-limited",
86
- "source": "api",
87
- "status": 429,
88
- "expected": {
89
- "type": "rate_limit",
90
- "code": "PROVIDER_RATE_LIMITED",
91
- "service": "fixture",
92
- "action": "request",
93
- "status": 429,
94
- "retryable": true
95
- }
96
- },
97
- {
98
- "name": "api-500-is-retryable",
99
- "source": "api",
100
- "status": 500,
101
- "expected": {
102
- "type": "api",
103
- "code": "PROVIDER_API_ERROR",
104
- "service": "fixture",
105
- "action": "request",
106
- "status": 500,
107
- "retryable": true
108
- }
109
- }
110
- ]
111
- }
@@ -1,20 +0,0 @@
1
- {
2
- "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "cases": [
4
- { "name": "missing-event-id", "kind": "new", "event": { "type": "session.created", "version": "1.0", "timestamp": 0, "session_id": "s" }, "path": "/id" },
5
- { "name": "missing-version", "kind": "new", "event": { "id": "e", "type": "session.created", "timestamp": 0, "session_id": "s" }, "path": "/version" },
6
- { "name": "missing-timestamp", "kind": "new", "event": { "id": "e", "type": "session.created", "version": "1.0", "session_id": "s" }, "path": "/timestamp" },
7
- { "name": "missing-session-id", "kind": "new", "event": { "id": "e", "type": "session.created", "version": "1.0", "timestamp": 0 }, "path": "/session_id" },
8
- { "name": "missing-event-type", "kind": "new", "event": { "id": "e", "version": "1.0", "timestamp": 0, "session_id": "s" }, "path": "/type" },
9
- { "name": "empty-event-id", "kind": "new", "event": { "id": "", "type": "session.created", "version": "1.0", "timestamp": 0, "session_id": "s" }, "path": "/id" },
10
- { "name": "empty-session-id", "kind": "new", "event": { "id": "e", "type": "session.created", "version": "1.0", "timestamp": 0, "session_id": "" }, "path": "/session_id" },
11
- { "name": "empty-present-turn-id", "kind": "new", "event": { "id": "e", "type": "agent.reasoning.started", "version": "1.0", "timestamp": 0, "session_id": "s", "turn_id": "" }, "path": "/turn_id" },
12
- { "name": "unknown-event-type", "kind": "new", "event": { "id": "e", "type": "unknown", "version": "1.0", "timestamp": 0, "session_id": "s" }, "path": "/type" },
13
- { "name": "extra-field", "kind": "new", "event": { "id": "e", "type": "session.created", "version": "1.0", "timestamp": 0, "session_id": "s", "extra": true }, "path": "/extra" },
14
- { "name": "draft-has-sequence", "kind": "new", "event": { "id": "e", "type": "session.created", "version": "1.0", "timestamp": 0, "session_id": "s", "sequence": 1 }, "path": "/sequence" },
15
- { "name": "stored-missing-sequence", "kind": "stored", "event": { "id": "e", "type": "session.created", "version": "1.0", "timestamp": 0, "session_id": "s" }, "path": "/sequence" },
16
- { "name": "unsafe-integral-number", "kind": "new", "event": { "id": "e", "type": "session.created", "version": "1.0", "timestamp": 0, "session_id": "s", "metadata": { "n": 9007199254740992 } }, "path": "/metadata/n" },
17
- { "name": "partial-integration-recovery", "kind": "new", "event": { "id": "e", "type": "tool.call.failed", "version": "1.0", "timestamp": 0, "session_id": "s", "turn_id": "t", "tool_name": "integration", "tool_call_id": "c", "error": "Tool execution failed", "reason_code": "policy_rejected" }, "path": "/reason_code" },
18
- { "name": "mismatched-integration-recovery", "kind": "new", "event": { "id": "e", "type": "tool.call.failed", "version": "1.0", "timestamp": 0, "session_id": "s", "turn_id": "t", "tool_name": "integration", "tool_call_id": "c", "error": "Tool execution failed", "reason_code": "policy_rejected", "recovery_code": "CONNECT_GMAIL", "doc_url": "https://kaji.dev/docs/integrations/recovery-v1#policy-rejected" }, "path": "/reason_code" }
19
- ]
20
- }