@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,271 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "cases": [
4
+ {
5
+ "name": "nested required",
6
+ "kind": "invalid_arguments",
7
+ "schema": {
8
+ "type": "object",
9
+ "required": ["profile"],
10
+ "properties": {
11
+ "profile": {
12
+ "type": "object",
13
+ "required": ["email"],
14
+ "properties": { "email": { "type": "string" } }
15
+ }
16
+ }
17
+ },
18
+ "arguments": { "profile": {} },
19
+ "expectedPath": "/profile",
20
+ "expectedCode": "INVALID_TOOL_ARGUMENTS",
21
+ "retryable": false,
22
+ "outcome": "not_started"
23
+ },
24
+ {
25
+ "name": "nested additional property",
26
+ "kind": "invalid_arguments",
27
+ "schema": {
28
+ "type": "object",
29
+ "required": ["profile"],
30
+ "properties": {
31
+ "profile": {
32
+ "type": "object",
33
+ "additionalProperties": false,
34
+ "properties": { "name": { "type": "string" } }
35
+ }
36
+ }
37
+ },
38
+ "arguments": { "profile": { "extra": true } },
39
+ "expectedPath": "/profile",
40
+ "expectedCode": "INVALID_TOOL_ARGUMENTS",
41
+ "retryable": false,
42
+ "outcome": "not_started"
43
+ },
44
+ {
45
+ "name": "top-level additional property",
46
+ "kind": "invalid_arguments",
47
+ "schema": {
48
+ "type": "object",
49
+ "additionalProperties": false,
50
+ "properties": { "name": { "type": "string" } }
51
+ },
52
+ "arguments": { "name": "kaji", "extra": true },
53
+ "expectedPath": "/",
54
+ "expectedCode": "INVALID_TOOL_ARGUMENTS",
55
+ "retryable": false,
56
+ "outcome": "not_started"
57
+ },
58
+ {
59
+ "name": "const",
60
+ "kind": "invalid_arguments",
61
+ "schema": {
62
+ "type": "object",
63
+ "properties": { "mode": { "const": "strict" } }
64
+ },
65
+ "arguments": { "mode": "relaxed" },
66
+ "expectedPath": "/mode",
67
+ "expectedCode": "INVALID_TOOL_ARGUMENTS",
68
+ "retryable": false,
69
+ "outcome": "not_started"
70
+ },
71
+ {
72
+ "name": "enum",
73
+ "kind": "invalid_arguments",
74
+ "schema": {
75
+ "type": "object",
76
+ "properties": { "mode": { "enum": ["safe", "strict"] } }
77
+ },
78
+ "arguments": { "mode": "other" },
79
+ "expectedPath": "/mode",
80
+ "expectedCode": "INVALID_TOOL_ARGUMENTS",
81
+ "retryable": false,
82
+ "outcome": "not_started"
83
+ },
84
+ {
85
+ "name": "number minimum",
86
+ "kind": "invalid_arguments",
87
+ "schema": {
88
+ "type": "object",
89
+ "properties": { "count": { "type": "integer", "minimum": 1, "maximum": 5 } }
90
+ },
91
+ "arguments": { "count": 0 },
92
+ "expectedPath": "/count",
93
+ "expectedCode": "INVALID_TOOL_ARGUMENTS",
94
+ "retryable": false,
95
+ "outcome": "not_started"
96
+ },
97
+ {
98
+ "name": "number maximum",
99
+ "kind": "invalid_arguments",
100
+ "schema": {
101
+ "type": "object",
102
+ "properties": { "count": { "type": "integer", "minimum": 1, "maximum": 5 } }
103
+ },
104
+ "arguments": { "count": 6 },
105
+ "expectedPath": "/count",
106
+ "expectedCode": "INVALID_TOOL_ARGUMENTS",
107
+ "retryable": false,
108
+ "outcome": "not_started"
109
+ },
110
+ {
111
+ "name": "string minimum length",
112
+ "kind": "invalid_arguments",
113
+ "schema": {
114
+ "type": "object",
115
+ "properties": { "slug": { "type": "string", "minLength": 3, "maxLength": 8 } }
116
+ },
117
+ "arguments": { "slug": "ab" },
118
+ "expectedPath": "/slug",
119
+ "expectedCode": "INVALID_TOOL_ARGUMENTS",
120
+ "retryable": false,
121
+ "outcome": "not_started"
122
+ },
123
+ {
124
+ "name": "string maximum length",
125
+ "kind": "invalid_arguments",
126
+ "schema": {
127
+ "type": "object",
128
+ "properties": { "slug": { "type": "string", "minLength": 3, "maxLength": 8 } }
129
+ },
130
+ "arguments": { "slug": "too-long-slug" },
131
+ "expectedPath": "/slug",
132
+ "expectedCode": "INVALID_TOOL_ARGUMENTS",
133
+ "retryable": false,
134
+ "outcome": "not_started"
135
+ },
136
+ {
137
+ "name": "string pattern",
138
+ "kind": "invalid_arguments",
139
+ "schema": {
140
+ "type": "object",
141
+ "properties": { "slug": { "type": "string", "pattern": "^[a-z]+$" } }
142
+ },
143
+ "arguments": { "slug": "NOT-valid" },
144
+ "expectedPath": "/slug",
145
+ "expectedCode": "INVALID_TOOL_ARGUMENTS",
146
+ "retryable": false,
147
+ "outcome": "not_started"
148
+ },
149
+ {
150
+ "name": "array minimum items",
151
+ "kind": "invalid_arguments",
152
+ "schema": {
153
+ "type": "object",
154
+ "properties": { "ids": { "type": "array", "minItems": 1, "maxItems": 2 } }
155
+ },
156
+ "arguments": { "ids": [] },
157
+ "expectedPath": "/ids",
158
+ "expectedCode": "INVALID_TOOL_ARGUMENTS",
159
+ "retryable": false,
160
+ "outcome": "not_started"
161
+ },
162
+ {
163
+ "name": "array maximum items",
164
+ "kind": "invalid_arguments",
165
+ "schema": {
166
+ "type": "object",
167
+ "properties": { "ids": { "type": "array", "minItems": 1, "maxItems": 2 } }
168
+ },
169
+ "arguments": { "ids": [1, 2, 3] },
170
+ "expectedPath": "/ids",
171
+ "expectedCode": "INVALID_TOOL_ARGUMENTS",
172
+ "retryable": false,
173
+ "outcome": "not_started"
174
+ },
175
+ {
176
+ "name": "array item",
177
+ "kind": "invalid_arguments",
178
+ "schema": {
179
+ "type": "object",
180
+ "properties": { "ids": { "type": "array", "items": { "type": "integer" } } }
181
+ },
182
+ "arguments": { "ids": [1, "two"] },
183
+ "expectedPath": "/ids/1",
184
+ "expectedCode": "INVALID_TOOL_ARGUMENTS",
185
+ "retryable": false,
186
+ "outcome": "not_started"
187
+ },
188
+ {
189
+ "name": "email format",
190
+ "kind": "invalid_arguments",
191
+ "schema": {
192
+ "type": "object",
193
+ "properties": { "email": { "type": "string", "format": "email" } }
194
+ },
195
+ "arguments": { "email": "not-an-email" },
196
+ "expectedPath": "/email",
197
+ "expectedCode": "INVALID_TOOL_ARGUMENTS",
198
+ "retryable": false,
199
+ "outcome": "not_started"
200
+ },
201
+ {
202
+ "name": "uri format",
203
+ "kind": "invalid_arguments",
204
+ "schema": {
205
+ "type": "object",
206
+ "properties": { "url": { "type": "string", "format": "uri" } }
207
+ },
208
+ "arguments": { "url": "not a uri" },
209
+ "expectedPath": "/url",
210
+ "expectedCode": "INVALID_TOOL_ARGUMENTS",
211
+ "retryable": false,
212
+ "outcome": "not_started"
213
+ },
214
+ {
215
+ "name": "union branches",
216
+ "kind": "invalid_arguments",
217
+ "schema": {
218
+ "type": "object",
219
+ "properties": {
220
+ "target": {
221
+ "oneOf": [
222
+ { "type": "string", "minLength": 1 },
223
+ { "type": "integer", "minimum": 1 }
224
+ ]
225
+ }
226
+ }
227
+ },
228
+ "arguments": { "target": false },
229
+ "expectedPath": "/target",
230
+ "expectedCode": "INVALID_TOOL_ARGUMENTS",
231
+ "retryable": false,
232
+ "outcome": "not_started"
233
+ },
234
+ {
235
+ "name": "local reference",
236
+ "kind": "invalid_arguments",
237
+ "schema": {
238
+ "$defs": { "positive": { "type": "integer", "minimum": 1 } },
239
+ "type": "object",
240
+ "properties": { "value": { "$ref": "#/$defs/positive" } }
241
+ },
242
+ "arguments": { "value": 0 },
243
+ "expectedPath": "/value",
244
+ "expectedCode": "INVALID_TOOL_ARGUMENTS",
245
+ "retryable": false,
246
+ "outcome": "not_started"
247
+ },
248
+ {
249
+ "name": "invalid type declaration",
250
+ "kind": "invalid_schema",
251
+ "schema": { "type": "not-a-json-schema-type" },
252
+ "arguments": {},
253
+ "expectedPath": "/type",
254
+ "expectedCode": "INVALID_TOOL_SCHEMA",
255
+ "expectedMessage": "Tool schema failed schema validation at /type",
256
+ "retryable": false,
257
+ "outcome": "not_started"
258
+ },
259
+ {
260
+ "name": "invalid required declaration",
261
+ "kind": "invalid_schema",
262
+ "schema": { "type": "object", "required": "name" },
263
+ "arguments": {},
264
+ "expectedPath": "/required",
265
+ "expectedCode": "INVALID_TOOL_SCHEMA",
266
+ "expectedMessage": "Tool schema failed schema validation at /required",
267
+ "retryable": false,
268
+ "outcome": "not_started"
269
+ }
270
+ ]
271
+ }
@@ -0,0 +1,78 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "cases": [
4
+ {
5
+ "name": "nested object, format, and bounded array",
6
+ "schema": {
7
+ "type": "object",
8
+ "required": ["profile", "tags"],
9
+ "additionalProperties": false,
10
+ "properties": {
11
+ "profile": {
12
+ "type": "object",
13
+ "required": ["email", "role"],
14
+ "additionalProperties": false,
15
+ "properties": {
16
+ "email": { "type": "string", "format": "email" },
17
+ "role": { "enum": ["admin", "member"] }
18
+ }
19
+ },
20
+ "tags": {
21
+ "type": "array",
22
+ "minItems": 1,
23
+ "maxItems": 3,
24
+ "items": { "type": "string", "minLength": 2, "maxLength": 8 }
25
+ }
26
+ }
27
+ },
28
+ "arguments": {
29
+ "profile": { "email": "user@example.com", "role": "member" },
30
+ "tags": ["beta"]
31
+ }
32
+ },
33
+ {
34
+ "name": "const and number bounds",
35
+ "schema": {
36
+ "type": "object",
37
+ "required": ["mode", "count"],
38
+ "properties": {
39
+ "mode": { "const": "strict" },
40
+ "count": { "type": "integer", "minimum": 1, "maximum": 5 }
41
+ }
42
+ },
43
+ "arguments": { "mode": "strict", "count": 3 }
44
+ },
45
+ {
46
+ "name": "union branch",
47
+ "schema": {
48
+ "type": "object",
49
+ "required": ["target"],
50
+ "properties": {
51
+ "target": {
52
+ "oneOf": [
53
+ { "type": "string", "minLength": 1 },
54
+ { "type": "integer", "minimum": 1 }
55
+ ]
56
+ }
57
+ }
58
+ },
59
+ "arguments": { "target": 2 }
60
+ },
61
+ {
62
+ "name": "local reference",
63
+ "schema": {
64
+ "$defs": {
65
+ "target": {
66
+ "type": "object",
67
+ "required": ["url"],
68
+ "properties": { "url": { "type": "string", "format": "uri" } }
69
+ }
70
+ },
71
+ "type": "object",
72
+ "required": ["target"],
73
+ "properties": { "target": { "$ref": "#/$defs/target" } }
74
+ },
75
+ "arguments": { "target": { "url": "https://example.com/resource" } }
76
+ }
77
+ ]
78
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://kaji.dev/contracts/tools/tool-schema-v1.schema.json",
4
+ "title": "Kaji tool specification",
5
+ "type": "object",
6
+ "required": ["name", "description", "parameters", "risk"],
7
+ "additionalProperties": false,
8
+ "properties": {
9
+ "name": { "type": "string", "pattern": "^[A-Za-z_][A-Za-z0-9_.-]*$" },
10
+ "description": { "type": "string", "minLength": 1 },
11
+ "parameters": { "type": "object" },
12
+ "risk": {
13
+ "enum": ["read", "write", "external_effect", "destructive", "admin"]
14
+ },
15
+ "parallel_safe": { "type": "boolean", "default": false },
16
+ "timeout_ms": { "type": "integer", "minimum": 1 }
17
+ }
18
+ }