@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,100 @@
1
+ {
2
+ "$schema": "./scenarios.schema.json",
3
+ "version": "1.0.0",
4
+ "normalization": {
5
+ "stripKeys": ["timestamp", "duration_ms"],
6
+ "replaceKeys": { "request_id": "<request>", "trace_id": "<trace>" },
7
+ "preserveKeys": ["id", "sequence", "turn_id", "tool_call_id", "error_code"]
8
+ },
9
+ "controlSets": {
10
+ "default": {
11
+ "wallSeconds": 1700000000,
12
+ "monotonic": 1000,
13
+ "ids": {
14
+ "event": [
15
+ "event-01", "event-02", "event-03", "event-04", "event-05", "event-06", "event-07", "event-08",
16
+ "event-09", "event-10", "event-11", "event-12", "event-13", "event-14", "event-15", "event-16",
17
+ "event-17", "event-18", "event-19", "event-20", "event-21", "event-22", "event-23", "event-24",
18
+ "event-25", "event-26", "event-27", "event-28", "event-29", "event-30", "event-31", "event-32"
19
+ ],
20
+ "session": ["session-generated-1", "session-generated-2", "session-generated-3", "session-generated-4"],
21
+ "turn": ["turn-1", "turn-2", "turn-3", "turn-4", "turn-5", "turn-6", "turn-7", "turn-8"],
22
+ "request": ["request-1", "request-2", "request-3", "request-4", "request-5", "request-6", "request-7", "request-8"],
23
+ "trace": ["trace-1", "trace-2", "trace-3", "trace-4", "trace-5", "trace-6", "trace-7", "trace-8"],
24
+ "tool_call": ["call-generated-1", "call-generated-2", "call-generated-3", "call-generated-4"]
25
+ }
26
+ }
27
+ },
28
+ "scenarios": [
29
+ { "id": "text-one-turn", "kind": "runtime", "fixture": "text-one-turn", "controls": "default", "input": { "session_id": "session-text", "prompts": ["hello"] }, "schedule": [] },
30
+ { "id": "text-multi-turn", "kind": "runtime", "fixture": "text-multi-turn", "controls": "default", "input": { "session_id": "session-multi", "prompts": ["first", "second"] }, "schedule": [] },
31
+ { "id": "one-tool", "kind": "runtime", "fixture": "one-tool", "controls": "default", "input": { "session_id": "session-tool", "prompts": ["use echo"] }, "schedule": [] },
32
+ { "id": "parallel-tools-reverse", "kind": "runtime", "fixture": "parallel-tools-reverse", "controls": "default", "input": { "session_id": "session-parallel", "prompts": ["run both"] }, "schedule": ["second", "first"] },
33
+ { "id": "sequential-tools", "kind": "runtime", "fixture": "sequential-tools", "controls": "default", "input": { "session_id": "session-sequential", "prompts": ["run both"] }, "schedule": ["first", "second"] },
34
+ { "id": "max-iteration-exhaustion", "kind": "runtime", "fixture": "max-iteration-exhaustion", "controls": "default", "input": { "session_id": "session-exhausted", "prompts": ["keep calling"] }, "schedule": [] },
35
+ { "id": "policy-deny", "kind": "runtime", "fixture": "policy-deny", "controls": "default", "input": { "session_id": "session-deny", "prompts": ["denied"] }, "schedule": [] },
36
+ { "id": "missing-risk", "kind": "runtime", "fixture": "missing-risk", "controls": "default", "input": { "session_id": "session-risk", "prompts": ["unclassified"] }, "schedule": [] },
37
+ { "id": "approval-reject", "kind": "runtime", "fixture": "approval-reject", "controls": "default", "input": { "session_id": "session-approval-reject", "prompts": ["write"] }, "schedule": [] },
38
+ { "id": "approval-timeout", "kind": "runtime", "fixture": "approval-timeout", "controls": "default", "input": { "session_id": "session-approval-timeout", "prompts": ["write"] }, "schedule": [] },
39
+ { "id": "approval-unavailable", "kind": "runtime", "fixture": "approval-unavailable", "controls": "default", "input": { "session_id": "session-approval-unavailable", "prompts": ["write"] }, "schedule": [] },
40
+ { "id": "approval-external-recorded", "kind": "runtime", "fixture": "approval-external-recorded", "controls": "default", "input": { "session_id": "session-approval-external", "prompts": ["write"] }, "schedule": [] },
41
+ { "id": "executor-error", "kind": "runtime", "fixture": "executor-error", "controls": "default", "input": { "session_id": "session-error", "prompts": ["fail"] }, "schedule": [] },
42
+ { "id": "queue-timeout", "kind": "runtime", "fixture": "queue-timeout", "controls": "default", "input": { "session_id": "session-queue-timeout", "prompts": ["timeout"] }, "schedule": [] },
43
+ { "id": "started-timeout", "kind": "runtime", "fixture": "started-timeout", "controls": "default", "input": { "session_id": "session-started-timeout", "prompts": ["timeout"] }, "schedule": [] },
44
+ { "id": "cancellation-before-start", "kind": "runtime", "fixture": "cancellation-before-start", "controls": "default", "input": { "session_id": "session-cancel-before", "prompts": ["cancel"] }, "schedule": [] },
45
+ { "id": "cancellation-after-start", "kind": "runtime", "fixture": "cancellation-after-start", "controls": "default", "input": { "session_id": "session-cancel-after", "prompts": ["cancel"] }, "schedule": [] },
46
+ { "id": "turn-queue-timeout", "kind": "runtime", "fixture": "turn-queue-timeout", "controls": "default", "input": { "session_id": "session-turn-queue-timeout", "prompts": ["timeout"] }, "schedule": [] },
47
+ { "id": "turn-provider-open-timeout", "kind": "runtime", "fixture": "turn-provider-open-timeout", "controls": "default", "input": { "session_id": "session-turn-provider-open-timeout", "prompts": ["timeout"] }, "schedule": [] },
48
+ { "id": "turn-provider-stream-timeout", "kind": "runtime", "fixture": "turn-provider-stream-timeout", "controls": "default", "input": { "session_id": "session-turn-provider-stream-timeout", "prompts": ["timeout"] }, "schedule": [] },
49
+ { "id": "turn-cancellation-deadline-tie", "kind": "runtime", "fixture": "turn-cancellation-deadline-tie", "controls": "default", "input": { "session_id": "session-turn-cancellation-deadline-tie", "prompts": ["cancel"] }, "schedule": [] },
50
+
51
+ { "id": "schema-valid-nested", "kind": "tool-schema", "fixtureFile": "conformance-valid.json", "fixture": "nested object, format, and bounded array" },
52
+ { "id": "schema-valid-const-bounds", "kind": "tool-schema", "fixtureFile": "conformance-valid.json", "fixture": "const and number bounds" },
53
+ { "id": "schema-valid-union", "kind": "tool-schema", "fixtureFile": "conformance-valid.json", "fixture": "union branch" },
54
+ { "id": "schema-valid-ref", "kind": "tool-schema", "fixtureFile": "conformance-valid.json", "fixture": "local reference" },
55
+ { "id": "schema-invalid-nested-required", "kind": "tool-schema", "fixtureFile": "conformance-invalid.json", "fixture": "nested required" },
56
+ { "id": "schema-invalid-nested-extra", "kind": "tool-schema", "fixtureFile": "conformance-invalid.json", "fixture": "nested additional property" },
57
+ { "id": "schema-invalid-top-extra", "kind": "tool-schema", "fixtureFile": "conformance-invalid.json", "fixture": "top-level additional property" },
58
+ { "id": "schema-invalid-const", "kind": "tool-schema", "fixtureFile": "conformance-invalid.json", "fixture": "const" },
59
+ { "id": "schema-invalid-enum", "kind": "tool-schema", "fixtureFile": "conformance-invalid.json", "fixture": "enum" },
60
+ { "id": "schema-invalid-number-min", "kind": "tool-schema", "fixtureFile": "conformance-invalid.json", "fixture": "number minimum" },
61
+ { "id": "schema-invalid-number-max", "kind": "tool-schema", "fixtureFile": "conformance-invalid.json", "fixture": "number maximum" },
62
+ { "id": "schema-invalid-string-min", "kind": "tool-schema", "fixtureFile": "conformance-invalid.json", "fixture": "string minimum length" },
63
+ { "id": "schema-invalid-string-max", "kind": "tool-schema", "fixtureFile": "conformance-invalid.json", "fixture": "string maximum length" },
64
+ { "id": "schema-invalid-pattern", "kind": "tool-schema", "fixtureFile": "conformance-invalid.json", "fixture": "string pattern" },
65
+ { "id": "schema-invalid-array-min", "kind": "tool-schema", "fixtureFile": "conformance-invalid.json", "fixture": "array minimum items" },
66
+ { "id": "schema-invalid-array-max", "kind": "tool-schema", "fixtureFile": "conformance-invalid.json", "fixture": "array maximum items" },
67
+ { "id": "schema-invalid-array-item", "kind": "tool-schema", "fixtureFile": "conformance-invalid.json", "fixture": "array item" },
68
+ { "id": "schema-invalid-email", "kind": "tool-schema", "fixtureFile": "conformance-invalid.json", "fixture": "email format" },
69
+ { "id": "schema-invalid-uri", "kind": "tool-schema", "fixtureFile": "conformance-invalid.json", "fixture": "uri format" },
70
+ { "id": "schema-invalid-union", "kind": "tool-schema", "fixtureFile": "conformance-invalid.json", "fixture": "union branches" },
71
+ { "id": "schema-invalid-ref", "kind": "tool-schema", "fixtureFile": "conformance-invalid.json", "fixture": "local reference" },
72
+ { "id": "schema-invalid-type-declaration", "kind": "tool-schema", "fixtureFile": "conformance-invalid.json", "fixture": "invalid type declaration" },
73
+ { "id": "schema-invalid-required-declaration", "kind": "tool-schema", "fixtureFile": "conformance-invalid.json", "fixture": "invalid required declaration" },
74
+
75
+ { "id": "replay-approval-and-failures", "kind": "replay", "fixture": "approvals-completed-failed", "controls": "default" },
76
+ { "id": "replay-json-boolean", "kind": "replay", "fixture": "json-boolean", "controls": "default" },
77
+ { "id": "replay-json-null", "kind": "replay", "fixture": "json-null", "controls": "default" },
78
+ { "id": "replay-json-number", "kind": "replay", "fixture": "json-number", "controls": "default" },
79
+ { "id": "replay-json-integral-float", "kind": "replay", "fixture": "json-integral-float", "controls": "default" },
80
+ { "id": "replay-json-negative-zero", "kind": "replay", "fixture": "json-negative-zero", "controls": "default" },
81
+ { "id": "replay-json-exponent-boundaries", "kind": "replay", "fixture": "json-exponent-boundaries", "controls": "default" },
82
+ { "id": "replay-json-numeric-keys", "kind": "replay", "fixture": "json-numeric-keys", "controls": "default" },
83
+ { "id": "replay-json-safe-integer-boundary", "kind": "replay", "fixture": "json-safe-integer-boundary", "controls": "default" },
84
+ { "id": "replay-json-unrepresentable-integer", "kind": "replay", "fixture": "json-unrepresentable-integer", "controls": "default" },
85
+ { "id": "replay-json-utf16-keys", "kind": "replay", "fixture": "json-utf16-keys", "controls": "default" },
86
+ { "id": "replay-json-string", "kind": "replay", "fixture": "json-string", "controls": "default" },
87
+ { "id": "replay-json-array", "kind": "replay", "fixture": "json-array", "controls": "default" },
88
+ { "id": "same-session-serialization", "kind": "concurrency", "fixture": "same-session-serialized", "controls": "default", "release": ["first", "second"] },
89
+ { "id": "cross-session-overlap", "kind": "concurrency", "fixture": "cross-session-overlap", "controls": "default", "release": ["left", "right"] },
90
+ { "id": "openai-non-stream", "kind": "provider-adapter", "provider": "openai", "mode": "non-stream", "fixture": "message-tool-result-usage-malformed-error" },
91
+ { "id": "openai-stream", "kind": "provider-adapter", "provider": "openai", "mode": "stream", "fixture": "message-tool-result-usage-malformed-error" },
92
+ { "id": "anthropic-non-stream", "kind": "provider-adapter", "provider": "anthropic", "mode": "non-stream", "fixture": "message-tool-result-usage-malformed-error" },
93
+ { "id": "anthropic-stream", "kind": "provider-adapter", "provider": "anthropic", "mode": "stream", "fixture": "message-tool-result-usage-malformed-error" },
94
+
95
+ { "id": "idempotency-permanent-failed", "kind": "idempotency", "fixture": "permanent-failed" },
96
+ { "id": "idempotency-transient-failed", "kind": "idempotency", "fixture": "transient-failed" },
97
+ { "id": "idempotency-unknown", "kind": "idempotency", "fixture": "unknown" },
98
+ { "id": "idempotency-completed", "kind": "idempotency", "fixture": "completed" }
99
+ ]
100
+ }
@@ -0,0 +1,214 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://kaji.dev/contracts/parity/scenarios.schema.json",
4
+ "type": "object",
5
+ "required": ["$schema", "version", "normalization", "controlSets", "scenarios"],
6
+ "properties": {
7
+ "$schema": { "const": "./scenarios.schema.json" },
8
+ "version": { "const": "1.0.0" },
9
+ "normalization": {
10
+ "type": "object",
11
+ "required": ["stripKeys", "replaceKeys", "preserveKeys"],
12
+ "properties": {
13
+ "stripKeys": { "type": "array", "uniqueItems": true, "items": { "type": "string" } },
14
+ "replaceKeys": {
15
+ "type": "object",
16
+ "additionalProperties": { "type": "string" }
17
+ },
18
+ "preserveKeys": { "type": "array", "uniqueItems": true, "items": { "type": "string" } }
19
+ },
20
+ "additionalProperties": false
21
+ },
22
+ "controlSets": {
23
+ "type": "object",
24
+ "minProperties": 1,
25
+ "additionalProperties": { "$ref": "#/$defs/controls" }
26
+ },
27
+ "scenarios": {
28
+ "type": "array",
29
+ "minItems": 1,
30
+ "items": {
31
+ "oneOf": [
32
+ { "$ref": "#/$defs/runtime" },
33
+ { "$ref": "#/$defs/toolSchema" },
34
+ { "$ref": "#/$defs/replay" },
35
+ { "$ref": "#/$defs/concurrency" },
36
+ { "$ref": "#/$defs/providerAdapter" },
37
+ { "$ref": "#/$defs/idempotency" }
38
+ ]
39
+ }
40
+ }
41
+ },
42
+ "additionalProperties": false,
43
+ "$defs": {
44
+ "idQueue": {
45
+ "type": "array",
46
+ "minItems": 1,
47
+ "items": { "type": "string", "minLength": 1 }
48
+ },
49
+ "controls": {
50
+ "type": "object",
51
+ "required": ["wallSeconds", "monotonic", "ids"],
52
+ "properties": {
53
+ "wallSeconds": { "type": "number" },
54
+ "monotonic": { "type": "number" },
55
+ "ids": {
56
+ "type": "object",
57
+ "required": ["event", "session", "turn", "request", "trace", "tool_call"],
58
+ "properties": {
59
+ "event": { "$ref": "#/$defs/idQueue" },
60
+ "session": { "$ref": "#/$defs/idQueue" },
61
+ "turn": { "$ref": "#/$defs/idQueue" },
62
+ "request": { "$ref": "#/$defs/idQueue" },
63
+ "trace": { "$ref": "#/$defs/idQueue" },
64
+ "tool_call": { "$ref": "#/$defs/idQueue" }
65
+ },
66
+ "additionalProperties": false
67
+ }
68
+ },
69
+ "additionalProperties": false
70
+ },
71
+ "base": {
72
+ "type": "object",
73
+ "required": ["id", "kind"],
74
+ "properties": {
75
+ "id": { "type": "string", "pattern": "^[a-z0-9][a-z0-9-]*$" },
76
+ "kind": { "type": "string" }
77
+ }
78
+ },
79
+ "runtime": {
80
+ "allOf": [
81
+ { "$ref": "#/$defs/base" },
82
+ {
83
+ "type": "object",
84
+ "required": ["kind", "fixture", "controls", "input", "schedule"],
85
+ "properties": {
86
+ "id": true,
87
+ "kind": { "const": "runtime" },
88
+ "fixture": {
89
+ "enum": [
90
+ "text-one-turn", "text-multi-turn", "one-tool",
91
+ "parallel-tools-reverse", "sequential-tools", "max-iteration-exhaustion",
92
+ "policy-deny", "missing-risk", "approval-reject", "approval-timeout",
93
+ "approval-unavailable", "approval-external-recorded", "executor-error",
94
+ "queue-timeout", "started-timeout", "cancellation-before-start",
95
+ "cancellation-after-start", "turn-queue-timeout",
96
+ "turn-provider-open-timeout", "turn-provider-stream-timeout",
97
+ "turn-cancellation-deadline-tie"
98
+ ]
99
+ },
100
+ "controls": { "type": "string", "minLength": 1 },
101
+ "input": {
102
+ "type": "object",
103
+ "required": ["session_id", "prompts"],
104
+ "properties": {
105
+ "session_id": { "type": "string", "minLength": 1 },
106
+ "prompts": { "type": "array", "minItems": 1, "items": { "type": "string" } }
107
+ },
108
+ "additionalProperties": false
109
+ },
110
+ "schedule": { "type": "array", "items": { "type": "string", "minLength": 1 } }
111
+ },
112
+ "additionalProperties": false
113
+ }
114
+ ]
115
+ },
116
+ "toolSchema": {
117
+ "allOf": [
118
+ { "$ref": "#/$defs/base" },
119
+ {
120
+ "type": "object",
121
+ "required": ["kind", "fixtureFile", "fixture"],
122
+ "properties": {
123
+ "id": true,
124
+ "kind": { "const": "tool-schema" },
125
+ "fixtureFile": { "enum": ["conformance-valid.json", "conformance-invalid.json"] },
126
+ "fixture": { "type": "string", "minLength": 1 }
127
+ },
128
+ "additionalProperties": false
129
+ }
130
+ ]
131
+ },
132
+ "replay": {
133
+ "allOf": [
134
+ { "$ref": "#/$defs/base" },
135
+ {
136
+ "type": "object",
137
+ "required": ["kind", "fixture", "controls"],
138
+ "properties": {
139
+ "id": true,
140
+ "kind": { "const": "replay" },
141
+ "fixture": {
142
+ "enum": [
143
+ "approvals-completed-failed",
144
+ "json-boolean",
145
+ "json-null",
146
+ "json-number",
147
+ "json-integral-float",
148
+ "json-negative-zero",
149
+ "json-exponent-boundaries",
150
+ "json-numeric-keys",
151
+ "json-safe-integer-boundary",
152
+ "json-unrepresentable-integer",
153
+ "json-utf16-keys",
154
+ "json-string",
155
+ "json-array"
156
+ ]
157
+ },
158
+ "controls": { "type": "string", "minLength": 1 }
159
+ },
160
+ "additionalProperties": false
161
+ }
162
+ ]
163
+ },
164
+ "concurrency": {
165
+ "allOf": [
166
+ { "$ref": "#/$defs/base" },
167
+ {
168
+ "type": "object",
169
+ "required": ["kind", "fixture", "controls", "release"],
170
+ "properties": {
171
+ "id": true,
172
+ "kind": { "const": "concurrency" },
173
+ "fixture": { "enum": ["same-session-serialized", "cross-session-overlap"] },
174
+ "controls": { "type": "string", "minLength": 1 },
175
+ "release": { "type": "array", "minItems": 1, "items": { "type": "string", "minLength": 1 } }
176
+ },
177
+ "additionalProperties": false
178
+ }
179
+ ]
180
+ },
181
+ "providerAdapter": {
182
+ "allOf": [
183
+ { "$ref": "#/$defs/base" },
184
+ {
185
+ "type": "object",
186
+ "required": ["kind", "provider", "mode", "fixture"],
187
+ "properties": {
188
+ "id": true,
189
+ "kind": { "const": "provider-adapter" },
190
+ "provider": { "enum": ["openai", "anthropic"] },
191
+ "mode": { "enum": ["non-stream", "stream"] },
192
+ "fixture": { "const": "message-tool-result-usage-malformed-error" }
193
+ },
194
+ "additionalProperties": false
195
+ }
196
+ ]
197
+ },
198
+ "idempotency": {
199
+ "allOf": [
200
+ { "$ref": "#/$defs/base" },
201
+ {
202
+ "type": "object",
203
+ "required": ["kind", "fixture"],
204
+ "properties": {
205
+ "id": true,
206
+ "kind": { "const": "idempotency" },
207
+ "fixture": { "enum": ["permanent-failed", "transient-failed", "unknown", "completed"] }
208
+ },
209
+ "additionalProperties": false
210
+ }
211
+ ]
212
+ }
213
+ }
214
+ }
@@ -0,0 +1,112 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "contractVersion": "1.0.0",
4
+ "arithmetic": {
5
+ "currency": "USD",
6
+ "tokensPerRateUnit": 1000000,
7
+ "fractionalDigits": 10,
8
+ "rounding": "half_even",
9
+ "tokenMaximum": 9007199254740991,
10
+ "conversion": "canonical_decimal_to_host_number",
11
+ "rateSyntax": {
12
+ "form": "canonical_non_negative_decimal_or_single_digit_scientific_ascii",
13
+ "maxSignificantDigits": 32,
14
+ "maxFractionalDigits": 32,
15
+ "maxAbsoluteExponent": 32
16
+ }
17
+ },
18
+ "cases": [
19
+ {
20
+ "name": "tie-even-down",
21
+ "rates": { "inputPer1M": "5e-5", "outputPer1M": "0" },
22
+ "inputTokens": 1,
23
+ "outputTokens": 0,
24
+ "expectedCanonicalUsd": "0"
25
+ },
26
+ {
27
+ "name": "tie-even-up",
28
+ "rates": { "inputPer1M": "5e-5", "outputPer1M": "0" },
29
+ "inputTokens": 3,
30
+ "outputTokens": 0,
31
+ "expectedCanonicalUsd": "0.0000000002"
32
+ },
33
+ {
34
+ "name": "carry-across-unit",
35
+ "rates": { "inputPer1M": "0.99999999995", "outputPer1M": "0" },
36
+ "inputTokens": 1000000,
37
+ "outputTokens": 0,
38
+ "expectedCanonicalUsd": "1"
39
+ },
40
+ {
41
+ "name": "sum-before-rounding",
42
+ "rates": { "inputPer1M": "0.00003", "outputPer1M": "0.00003" },
43
+ "inputTokens": 1,
44
+ "outputTokens": 1,
45
+ "expectedCanonicalUsd": "0.0000000001"
46
+ },
47
+ {
48
+ "name": "gemini-small",
49
+ "model": "gemini-3.5-flash",
50
+ "inputTokens": 7949,
51
+ "outputTokens": 3594,
52
+ "expectedCanonicalUsd": "0.0442695"
53
+ },
54
+ {
55
+ "name": "gemini-large",
56
+ "model": "gemini-3.5-flash",
57
+ "inputTokens": 7634695068019977,
58
+ "outputTokens": 4642980045805002,
59
+ "expectedCanonicalUsd": "53238863014.2749835"
60
+ },
61
+ {
62
+ "name": "maximum-safe-token-counts",
63
+ "model": "gemini-3.5-flash",
64
+ "inputTokens": 9007199254740991,
65
+ "outputTokens": 9007199254740991,
66
+ "expectedCanonicalUsd": "94575592174.7804055"
67
+ },
68
+ {
69
+ "name": "unknown-model",
70
+ "model": "unknown-model",
71
+ "inputTokens": 123,
72
+ "outputTokens": 456,
73
+ "expectedCanonicalUsd": "0"
74
+ }
75
+ ],
76
+ "invalidTokenCounts": [
77
+ { "name": "negative", "value": -1 },
78
+ { "name": "fractional", "value": 0.5 },
79
+ { "name": "boolean", "value": true },
80
+ { "name": "unsafe", "value": 9007199254740992 }
81
+ ],
82
+ "invalidRates": [
83
+ { "name": "negative-number", "kind": "number", "value": "-0.1" },
84
+ { "name": "negative-string", "kind": "string", "value": "-0.1" },
85
+ { "name": "nan-number", "kind": "number", "value": "NaN" },
86
+ { "name": "nan-string", "kind": "string", "value": "NaN" },
87
+ { "name": "infinity-number", "kind": "number", "value": "Infinity" },
88
+ { "name": "infinity-string", "kind": "string", "value": "Infinity" },
89
+ { "name": "empty", "kind": "string", "value": "" },
90
+ { "name": "leading-zero", "kind": "string", "value": "01" },
91
+ { "name": "bare-fraction", "kind": "string", "value": ".5" },
92
+ { "name": "trailing-point", "kind": "string", "value": "1." },
93
+ { "name": "trailing-fraction-zero", "kind": "string", "value": "1.0" },
94
+ { "name": "uppercase-exponent", "kind": "string", "value": "1E1" },
95
+ { "name": "positive-exponent-sign", "kind": "string", "value": "1e+1" },
96
+ { "name": "zero-exponent", "kind": "string", "value": "1e0" },
97
+ { "name": "leading-zero-exponent", "kind": "string", "value": "1e01" },
98
+ { "name": "wide-scientific-significand", "kind": "string", "value": "12e1" },
99
+ {
100
+ "name": "excessive-significant-digits",
101
+ "kind": "string",
102
+ "value": "1.23456789012345678901234567890123"
103
+ },
104
+ {
105
+ "name": "excessive-fractional-digits",
106
+ "kind": "string",
107
+ "value": "0.000000000000000000000000000000001"
108
+ },
109
+ { "name": "excessive-positive-exponent", "kind": "string", "value": "1e33" },
110
+ { "name": "excessive-negative-exponent", "kind": "string", "value": "1e-33" }
111
+ ]
112
+ }
@@ -0,0 +1,138 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://kaji.dev/contracts/release/github-proof-v1.schema.json",
4
+ "title": "Kaji exact-artifact GitHub proof",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "schemaVersion",
9
+ "commit",
10
+ "releaseManifestSha256",
11
+ "cells",
12
+ "approvalRejectedBeforeTransport",
13
+ "readPassed",
14
+ "approvedCommentPassed",
15
+ "controlReadbackPassed",
16
+ "ambiguousMutationRetried",
17
+ "cleanup",
18
+ "redacted"
19
+ ],
20
+ "properties": {
21
+ "schemaVersion": {
22
+ "const": "1.0.0"
23
+ },
24
+ "commit": {
25
+ "type": "string",
26
+ "pattern": "^[0-9a-f]{40}$"
27
+ },
28
+ "releaseManifestSha256": {
29
+ "$ref": "#/$defs/sha256"
30
+ },
31
+ "cells": {
32
+ "type": "array",
33
+ "minItems": 2,
34
+ "maxItems": 2,
35
+ "prefixItems": [
36
+ {
37
+ "$ref": "#/$defs/pythonCell"
38
+ },
39
+ {
40
+ "$ref": "#/$defs/typescriptCell"
41
+ }
42
+ ],
43
+ "items": false
44
+ },
45
+ "approvalRejectedBeforeTransport": {
46
+ "const": true
47
+ },
48
+ "readPassed": {
49
+ "const": true
50
+ },
51
+ "approvedCommentPassed": {
52
+ "const": true
53
+ },
54
+ "controlReadbackPassed": {
55
+ "const": true
56
+ },
57
+ "ambiguousMutationRetried": {
58
+ "const": false
59
+ },
60
+ "cleanup": {
61
+ "type": "object",
62
+ "additionalProperties": false,
63
+ "required": [
64
+ "required",
65
+ "conclusion"
66
+ ],
67
+ "properties": {
68
+ "required": {
69
+ "const": true
70
+ },
71
+ "conclusion": {
72
+ "const": "passed"
73
+ }
74
+ }
75
+ },
76
+ "redacted": {
77
+ "const": true
78
+ }
79
+ },
80
+ "$defs": {
81
+ "sha256": {
82
+ "type": "string",
83
+ "pattern": "^[0-9a-f]{64}$"
84
+ },
85
+ "cell": {
86
+ "type": "object",
87
+ "additionalProperties": false,
88
+ "required": [
89
+ "runtime",
90
+ "artifactSha256",
91
+ "packageProofSha256",
92
+ "conclusion"
93
+ ],
94
+ "properties": {
95
+ "runtime": {
96
+ "type": "string"
97
+ },
98
+ "artifactSha256": {
99
+ "$ref": "#/$defs/sha256"
100
+ },
101
+ "packageProofSha256": {
102
+ "$ref": "#/$defs/sha256"
103
+ },
104
+ "conclusion": {
105
+ "const": "passed"
106
+ }
107
+ }
108
+ },
109
+ "pythonCell": {
110
+ "allOf": [
111
+ {
112
+ "$ref": "#/$defs/cell"
113
+ },
114
+ {
115
+ "properties": {
116
+ "runtime": {
117
+ "const": "python"
118
+ }
119
+ }
120
+ }
121
+ ]
122
+ },
123
+ "typescriptCell": {
124
+ "allOf": [
125
+ {
126
+ "$ref": "#/$defs/cell"
127
+ },
128
+ {
129
+ "properties": {
130
+ "runtime": {
131
+ "const": "typescript"
132
+ }
133
+ }
134
+ }
135
+ ]
136
+ }
137
+ }
138
+ }