@kindgi/api 0.1.4 → 0.1.5
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.
- package/dist/agent-binding.d.ts +13 -0
- package/dist/agent-binding.d.ts.map +1 -1
- package/dist/agent-pins.d.ts.map +1 -1
- package/dist/agent-pins.js +18 -2
- package/dist/agent-pins.js.map +1 -1
- package/dist/app.d.ts +110 -17
- package/dist/app.d.ts.map +1 -1
- package/dist/app.js +163 -35
- package/dist/app.js.map +1 -1
- package/dist/block-publish.d.ts +56 -0
- package/dist/block-publish.d.ts.map +1 -0
- package/dist/block-publish.js +132 -0
- package/dist/block-publish.js.map +1 -0
- package/dist/caller.d.ts +24 -0
- package/dist/caller.d.ts.map +1 -0
- package/dist/caller.js +47 -0
- package/dist/caller.js.map +1 -0
- package/dist/capability-binding.d.ts +11 -0
- package/dist/capability-binding.d.ts.map +1 -1
- package/dist/cost-binding.d.ts +19 -0
- package/dist/cost-binding.d.ts.map +1 -1
- package/dist/cost-binding.js.map +1 -1
- package/dist/derive-agent-version.d.ts +7 -0
- package/dist/derive-agent-version.d.ts.map +1 -1
- package/dist/derive-agent-version.js +4 -0
- package/dist/derive-agent-version.js.map +1 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +75 -7
- package/dist/errors.js.map +1 -1
- package/dist/eval-case-binding.d.ts +16 -4
- package/dist/eval-case-binding.d.ts.map +1 -1
- package/dist/eval-run-binding.d.ts +31 -0
- package/dist/eval-run-binding.d.ts.map +1 -1
- package/dist/eval-run-dispatcher.d.ts +7 -0
- package/dist/eval-run-dispatcher.d.ts.map +1 -1
- package/dist/eval-run-dispatcher.js.map +1 -1
- package/dist/eval-sample.d.ts +11 -0
- package/dist/eval-sample.d.ts.map +1 -0
- package/dist/eval-sample.js +34 -0
- package/dist/eval-sample.js.map +1 -0
- package/dist/eval-suite-binding.d.ts +13 -0
- package/dist/eval-suite-binding.d.ts.map +1 -1
- package/dist/eval-suite-binding.js.map +1 -1
- package/dist/flow-binding.d.ts +18 -0
- package/dist/flow-binding.d.ts.map +1 -1
- package/dist/flow-pins.d.ts.map +1 -1
- package/dist/flow-pins.js +18 -2
- package/dist/flow-pins.js.map +1 -1
- package/dist/gate.d.ts.map +1 -1
- package/dist/gate.js +25 -0
- package/dist/gate.js.map +1 -1
- package/dist/handler-binding.d.ts +32 -0
- package/dist/handler-binding.d.ts.map +1 -1
- package/dist/hitl-binding.d.ts +23 -0
- package/dist/hitl-binding.d.ts.map +1 -1
- package/dist/identity-directory-binding.d.ts +82 -4
- package/dist/identity-directory-binding.d.ts.map +1 -1
- package/dist/identity-provider-binding.d.ts +197 -17
- package/dist/identity-provider-binding.d.ts.map +1 -1
- package/dist/improvement-pass-binding.d.ts +196 -0
- package/dist/improvement-pass-binding.d.ts.map +1 -0
- package/dist/improvement-pass-binding.js +9 -0
- package/dist/improvement-pass-binding.js.map +1 -0
- package/dist/index.d.ts +35 -17
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -3
- package/dist/index.js.map +1 -1
- package/dist/judged-dispatcher.d.ts +25 -4
- package/dist/judged-dispatcher.d.ts.map +1 -1
- package/dist/judged-dispatcher.js +43 -6
- package/dist/judged-dispatcher.js.map +1 -1
- package/dist/judgment-binding.d.ts +25 -1
- package/dist/judgment-binding.d.ts.map +1 -1
- package/dist/mcp-endpoint-binding.d.ts +7 -0
- package/dist/mcp-endpoint-binding.d.ts.map +1 -1
- package/dist/memory-binding.d.ts +124 -17
- package/dist/memory-binding.d.ts.map +1 -1
- package/dist/memory-erasure-binding.d.ts +145 -0
- package/dist/memory-erasure-binding.d.ts.map +1 -0
- package/dist/memory-erasure-binding.js +4 -0
- package/dist/memory-erasure-binding.js.map +1 -0
- package/dist/middleware/auth.d.ts +66 -13
- package/dist/middleware/auth.d.ts.map +1 -1
- package/dist/middleware/auth.js +150 -50
- package/dist/middleware/auth.js.map +1 -1
- package/dist/middleware/authorize.d.ts +9 -0
- package/dist/middleware/authorize.d.ts.map +1 -1
- package/dist/middleware/authorize.js +122 -4
- package/dist/middleware/authorize.js.map +1 -1
- package/dist/middleware/error-mapper.d.ts +5 -0
- package/dist/middleware/error-mapper.d.ts.map +1 -1
- package/dist/middleware/error-mapper.js +14 -1
- package/dist/middleware/error-mapper.js.map +1 -1
- package/dist/middleware/idempotency.d.ts +70 -5
- package/dist/middleware/idempotency.d.ts.map +1 -1
- package/dist/middleware/idempotency.js +174 -41
- package/dist/middleware/idempotency.js.map +1 -1
- package/dist/middleware/key-project.d.ts +17 -0
- package/dist/middleware/key-project.d.ts.map +1 -0
- package/dist/middleware/key-project.js +75 -0
- package/dist/middleware/key-project.js.map +1 -0
- package/dist/middleware/principal.d.ts.map +1 -1
- package/dist/middleware/principal.js +9 -5
- package/dist/middleware/principal.js.map +1 -1
- package/dist/middleware/project-ref.d.ts.map +1 -1
- package/dist/middleware/project-ref.js +3 -0
- package/dist/middleware/project-ref.js.map +1 -1
- package/dist/openapi/generate.d.ts.map +1 -1
- package/dist/openapi/generate.js +5 -2
- package/dist/openapi/generate.js.map +1 -1
- package/dist/openapi/operations.d.ts.map +1 -1
- package/dist/openapi/operations.js +919 -140
- package/dist/openapi/operations.js.map +1 -1
- package/dist/openapi/schemas.d.ts +90 -13
- package/dist/openapi/schemas.d.ts.map +1 -1
- package/dist/openapi/schemas.js +2081 -359
- package/dist/openapi/schemas.js.map +1 -1
- package/dist/person-grants-binding.d.ts +77 -0
- package/dist/person-grants-binding.d.ts.map +1 -0
- package/dist/person-grants-binding.js +4 -0
- package/dist/person-grants-binding.js.map +1 -0
- package/dist/proposal-service.d.ts +121 -0
- package/dist/proposal-service.d.ts.map +1 -0
- package/dist/proposal-service.js +447 -0
- package/dist/proposal-service.js.map +1 -0
- package/dist/proposal-status.d.ts +60 -0
- package/dist/proposal-status.d.ts.map +1 -0
- package/dist/proposal-status.js +109 -0
- package/dist/proposal-status.js.map +1 -0
- package/dist/provider-binding.d.ts +10 -0
- package/dist/provider-binding.d.ts.map +1 -1
- package/dist/publish-refused.d.ts +28 -3
- package/dist/publish-refused.d.ts.map +1 -1
- package/dist/publish-refused.js +24 -3
- package/dist/publish-refused.js.map +1 -1
- package/dist/routes/adapters.d.ts +2 -1
- package/dist/routes/adapters.d.ts.map +1 -1
- package/dist/routes/adapters.js +3 -1
- package/dist/routes/adapters.js.map +1 -1
- package/dist/routes/agent-releases.d.ts +55 -3
- package/dist/routes/agent-releases.d.ts.map +1 -1
- package/dist/routes/agent-releases.js +85 -55
- package/dist/routes/agent-releases.js.map +1 -1
- package/dist/routes/agents.d.ts +12 -1
- package/dist/routes/agents.d.ts.map +1 -1
- package/dist/routes/agents.js +100 -2
- package/dist/routes/agents.js.map +1 -1
- package/dist/routes/approvals.d.ts +15 -3
- package/dist/routes/approvals.d.ts.map +1 -1
- package/dist/routes/approvals.js +133 -122
- package/dist/routes/approvals.js.map +1 -1
- package/dist/routes/artifacts.d.ts +25 -3
- package/dist/routes/artifacts.d.ts.map +1 -1
- package/dist/routes/artifacts.js +116 -7
- package/dist/routes/artifacts.js.map +1 -1
- package/dist/routes/auth.d.ts +25 -1
- package/dist/routes/auth.d.ts.map +1 -1
- package/dist/routes/auth.js +655 -281
- package/dist/routes/auth.js.map +1 -1
- package/dist/routes/blocks.d.ts.map +1 -1
- package/dist/routes/blocks.js +2 -42
- package/dist/routes/blocks.js.map +1 -1
- package/dist/routes/capabilities.d.ts +2 -1
- package/dist/routes/capabilities.d.ts.map +1 -1
- package/dist/routes/capabilities.js +6 -1
- package/dist/routes/capabilities.js.map +1 -1
- package/dist/routes/compliance.d.ts +9 -10
- package/dist/routes/compliance.d.ts.map +1 -1
- package/dist/routes/compliance.js +42 -61
- package/dist/routes/compliance.js.map +1 -1
- package/dist/routes/conversations.d.ts +8 -1
- package/dist/routes/conversations.d.ts.map +1 -1
- package/dist/routes/conversations.js +87 -8
- package/dist/routes/conversations.js.map +1 -1
- package/dist/routes/cost.d.ts +12 -1
- package/dist/routes/cost.d.ts.map +1 -1
- package/dist/routes/cost.js +74 -3
- package/dist/routes/cost.js.map +1 -1
- package/dist/routes/denied.d.ts +11 -0
- package/dist/routes/denied.d.ts.map +1 -0
- package/dist/routes/denied.js +17 -0
- package/dist/routes/denied.js.map +1 -0
- package/dist/routes/deployments.d.ts +10 -1
- package/dist/routes/deployments.d.ts.map +1 -1
- package/dist/routes/deployments.js +171 -13
- package/dist/routes/deployments.js.map +1 -1
- package/dist/routes/eval-comparison.d.ts.map +1 -1
- package/dist/routes/eval-comparison.js +69 -1
- package/dist/routes/eval-comparison.js.map +1 -1
- package/dist/routes/eval-overrides.d.ts +18 -0
- package/dist/routes/eval-overrides.d.ts.map +1 -0
- package/dist/routes/eval-overrides.js +81 -0
- package/dist/routes/eval-overrides.js.map +1 -0
- package/dist/routes/eval-runs.d.ts +10 -1
- package/dist/routes/eval-runs.d.ts.map +1 -1
- package/dist/routes/eval-runs.js +66 -7
- package/dist/routes/eval-runs.js.map +1 -1
- package/dist/routes/eval-suites.d.ts.map +1 -1
- package/dist/routes/eval-suites.js +28 -2
- package/dist/routes/eval-suites.js.map +1 -1
- package/dist/routes/event-triggers.d.ts +5 -1
- package/dist/routes/event-triggers.d.ts.map +1 -1
- package/dist/routes/event-triggers.js +26 -3
- package/dist/routes/event-triggers.js.map +1 -1
- package/dist/routes/export-signing-keys.d.ts +12 -0
- package/dist/routes/export-signing-keys.d.ts.map +1 -0
- package/dist/routes/export-signing-keys.js +24 -0
- package/dist/routes/export-signing-keys.js.map +1 -0
- package/dist/routes/flows.d.ts.map +1 -1
- package/dist/routes/flows.js +9 -1
- package/dist/routes/flows.js.map +1 -1
- package/dist/routes/gate-policies.d.ts +4 -1
- package/dist/routes/gate-policies.d.ts.map +1 -1
- package/dist/routes/gate-policies.js +29 -5
- package/dist/routes/gate-policies.js.map +1 -1
- package/dist/routes/guardrails.d.ts +16 -14
- package/dist/routes/guardrails.d.ts.map +1 -1
- package/dist/routes/guardrails.js +39 -3
- package/dist/routes/guardrails.js.map +1 -1
- package/dist/routes/identity.d.ts +20 -4
- package/dist/routes/identity.d.ts.map +1 -1
- package/dist/routes/identity.js +246 -6
- package/dist/routes/identity.js.map +1 -1
- package/dist/routes/improvement-passes.d.ts +52 -0
- package/dist/routes/improvement-passes.d.ts.map +1 -0
- package/dist/routes/improvement-passes.js +449 -0
- package/dist/routes/improvement-passes.js.map +1 -0
- package/dist/routes/judged-suites.d.ts +50 -0
- package/dist/routes/judged-suites.d.ts.map +1 -1
- package/dist/routes/judged-suites.js +66 -27
- package/dist/routes/judged-suites.js.map +1 -1
- package/dist/routes/judgment-context.d.ts +18 -2
- package/dist/routes/judgment-context.d.ts.map +1 -1
- package/dist/routes/judgment-context.js +63 -5
- package/dist/routes/judgment-context.js.map +1 -1
- package/dist/routes/judgment-flow-context.d.ts.map +1 -1
- package/dist/routes/judgment-flow-context.js +14 -2
- package/dist/routes/judgment-flow-context.js.map +1 -1
- package/dist/routes/judgments.d.ts.map +1 -1
- package/dist/routes/judgments.js +8 -1
- package/dist/routes/judgments.js.map +1 -1
- package/dist/routes/mcp.d.ts.map +1 -1
- package/dist/routes/mcp.js +26 -1
- package/dist/routes/mcp.js.map +1 -1
- package/dist/routes/memory-access.d.ts +43 -0
- package/dist/routes/memory-access.d.ts.map +1 -0
- package/dist/routes/memory-access.js +114 -0
- package/dist/routes/memory-access.js.map +1 -0
- package/dist/routes/memory-erasures.d.ts +25 -0
- package/dist/routes/memory-erasures.d.ts.map +1 -0
- package/dist/routes/memory-erasures.js +214 -0
- package/dist/routes/memory-erasures.js.map +1 -0
- package/dist/routes/memory-parse.d.ts +38 -0
- package/dist/routes/memory-parse.d.ts.map +1 -0
- package/dist/routes/memory-parse.js +199 -0
- package/dist/routes/memory-parse.js.map +1 -0
- package/dist/routes/memory.d.ts +9 -4
- package/dist/routes/memory.d.ts.map +1 -1
- package/dist/routes/memory.js +226 -234
- package/dist/routes/memory.js.map +1 -1
- package/dist/routes/observations.d.ts +4 -1
- package/dist/routes/observations.d.ts.map +1 -1
- package/dist/routes/observations.js +8 -2
- package/dist/routes/observations.js.map +1 -1
- package/dist/routes/pagination.d.ts +7 -0
- package/dist/routes/pagination.d.ts.map +1 -1
- package/dist/routes/pagination.js +10 -0
- package/dist/routes/pagination.js.map +1 -1
- package/dist/routes/policies.d.ts +2 -1
- package/dist/routes/policies.d.ts.map +1 -1
- package/dist/routes/policies.js +3 -1
- package/dist/routes/policies.js.map +1 -1
- package/dist/routes/project-mismatch.d.ts +22 -0
- package/dist/routes/project-mismatch.d.ts.map +1 -0
- package/dist/routes/project-mismatch.js +34 -0
- package/dist/routes/project-mismatch.js.map +1 -0
- package/dist/routes/projects.d.ts +15 -4
- package/dist/routes/projects.d.ts.map +1 -1
- package/dist/routes/projects.js +100 -9
- package/dist/routes/projects.js.map +1 -1
- package/dist/routes/proposals.d.ts +25 -17
- package/dist/routes/proposals.d.ts.map +1 -1
- package/dist/routes/proposals.js +340 -507
- package/dist/routes/proposals.js.map +1 -1
- package/dist/routes/provenance.d.ts +17 -3
- package/dist/routes/provenance.d.ts.map +1 -1
- package/dist/routes/provenance.js +79 -103
- package/dist/routes/provenance.js.map +1 -1
- package/dist/routes/providers.d.ts +17 -1
- package/dist/routes/providers.d.ts.map +1 -1
- package/dist/routes/providers.js +110 -3
- package/dist/routes/providers.js.map +1 -1
- package/dist/routes/public-run-tokens.d.ts.map +1 -1
- package/dist/routes/public-run-tokens.js +3 -0
- package/dist/routes/public-run-tokens.js.map +1 -1
- package/dist/routes/readable-projects.d.ts +26 -0
- package/dist/routes/readable-projects.d.ts.map +1 -0
- package/dist/routes/readable-projects.js +39 -0
- package/dist/routes/readable-projects.js.map +1 -0
- package/dist/routes/runs.d.ts +10 -0
- package/dist/routes/runs.d.ts.map +1 -1
- package/dist/routes/runs.js +92 -42
- package/dist/routes/runs.js.map +1 -1
- package/dist/routes/schedules.d.ts +21 -13
- package/dist/routes/schedules.d.ts.map +1 -1
- package/dist/routes/schedules.js +416 -55
- package/dist/routes/schedules.js.map +1 -1
- package/dist/routes/segments.d.ts +2 -0
- package/dist/routes/segments.d.ts.map +1 -1
- package/dist/routes/segments.js +5 -0
- package/dist/routes/segments.js.map +1 -1
- package/dist/routes/service-accounts.d.ts +17 -0
- package/dist/routes/service-accounts.d.ts.map +1 -0
- package/dist/routes/service-accounts.js +212 -0
- package/dist/routes/service-accounts.js.map +1 -0
- package/dist/routes/sign-in-options.d.ts +50 -0
- package/dist/routes/sign-in-options.d.ts.map +1 -0
- package/dist/routes/sign-in-options.js +98 -0
- package/dist/routes/sign-in-options.js.map +1 -0
- package/dist/routes/signing-keys.d.ts +2 -1
- package/dist/routes/signing-keys.d.ts.map +1 -1
- package/dist/routes/signing-keys.js +3 -1
- package/dist/routes/signing-keys.js.map +1 -1
- package/dist/routes/tenant-access.d.ts +13 -0
- package/dist/routes/tenant-access.d.ts.map +1 -0
- package/dist/routes/tenant-access.js +26 -0
- package/dist/routes/tenant-access.js.map +1 -0
- package/dist/routes/tenant.d.ts.map +1 -1
- package/dist/routes/tenant.js +4 -0
- package/dist/routes/tenant.js.map +1 -1
- package/dist/routes/token-sign-in.d.ts +36 -0
- package/dist/routes/token-sign-in.d.ts.map +1 -0
- package/dist/routes/token-sign-in.js +101 -0
- package/dist/routes/token-sign-in.js.map +1 -0
- package/dist/routes/tokens.d.ts +15 -5
- package/dist/routes/tokens.d.ts.map +1 -1
- package/dist/routes/tokens.js +162 -43
- package/dist/routes/tokens.js.map +1 -1
- package/dist/routes/tools.d.ts.map +1 -1
- package/dist/routes/tools.js +9 -1
- package/dist/routes/tools.js.map +1 -1
- package/dist/routes/trigger-access.d.ts +29 -0
- package/dist/routes/trigger-access.d.ts.map +1 -0
- package/dist/routes/trigger-access.js +33 -0
- package/dist/routes/trigger-access.js.map +1 -0
- package/dist/routes/webhook-endpoints.d.ts +2 -1
- package/dist/routes/webhook-endpoints.d.ts.map +1 -1
- package/dist/routes/webhook-endpoints.js +11 -3
- package/dist/routes/webhook-endpoints.js.map +1 -1
- package/dist/routes/webhooks.d.ts +5 -1
- package/dist/routes/webhooks.d.ts.map +1 -1
- package/dist/routes/webhooks.js +25 -2
- package/dist/routes/webhooks.js.map +1 -1
- package/dist/run-failure.d.ts +21 -0
- package/dist/run-failure.d.ts.map +1 -0
- package/dist/run-failure.js +29 -0
- package/dist/run-failure.js.map +1 -0
- package/dist/service-account-binding.d.ts +108 -0
- package/dist/service-account-binding.d.ts.map +1 -0
- package/dist/service-account-binding.js +4 -0
- package/dist/service-account-binding.js.map +1 -0
- package/dist/session-store-binding.d.ts +61 -13
- package/dist/session-store-binding.d.ts.map +1 -1
- package/dist/signed-export.d.ts +89 -0
- package/dist/signed-export.d.ts.map +1 -0
- package/dist/signed-export.js +149 -0
- package/dist/signed-export.js.map +1 -0
- package/dist/supervisor-binding.d.ts +186 -413
- package/dist/supervisor-binding.d.ts.map +1 -1
- package/dist/testing/app-bindings.d.ts +33 -0
- package/dist/testing/app-bindings.d.ts.map +1 -0
- package/dist/testing/app-bindings.js +112 -0
- package/dist/testing/app-bindings.js.map +1 -0
- package/dist/testing/index.d.ts +11 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +13 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/testing/stub-binding.d.ts +34 -0
- package/dist/testing/stub-binding.d.ts.map +1 -0
- package/dist/testing/stub-binding.js +42 -0
- package/dist/testing/stub-binding.js.map +1 -0
- package/dist/testing/trigger-registry.d.ts +21 -0
- package/dist/testing/trigger-registry.d.ts.map +1 -0
- package/dist/testing/trigger-registry.js +206 -0
- package/dist/testing/trigger-registry.js.map +1 -0
- package/dist/token-admin.d.ts +46 -8
- package/dist/token-admin.d.ts.map +1 -1
- package/dist/token-admin.js.map +1 -1
- package/dist/tool-binding.d.ts +13 -0
- package/dist/tool-binding.d.ts.map +1 -1
- package/dist/trigger-binding.d.ts +2 -2
- package/dist/trigger-binding.d.ts.map +1 -1
- package/dist/trigger-binding.js +1 -1
- package/dist/trigger-binding.js.map +1 -1
- package/dist/types.d.ts +16 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/webhook-endpoint-binding.d.ts +19 -3
- package/dist/webhook-endpoint-binding.d.ts.map +1 -1
- package/dist/webhook-endpoint-binding.js +1 -1
- package/dist/webhook-endpoint-binding.js.map +1 -1
- package/openapi.json +15387 -8789
- package/package.json +26 -22
- package/src/agent-binding.ts +14 -0
- package/src/agent-pins.ts +18 -2
- package/src/app.ts +366 -80
- package/src/block-publish.ts +181 -0
- package/src/caller.ts +62 -0
- package/src/capability-binding.ts +12 -0
- package/src/cost-binding.ts +19 -0
- package/src/derive-agent-version.ts +9 -1
- package/src/errors.ts +75 -7
- package/src/eval-case-binding.ts +17 -1
- package/src/eval-run-binding.ts +31 -0
- package/src/eval-run-dispatcher.ts +7 -0
- package/src/eval-sample.ts +42 -0
- package/src/eval-suite-binding.ts +14 -0
- package/src/flow-binding.ts +19 -0
- package/src/flow-pins.ts +18 -2
- package/src/gate.ts +26 -0
- package/src/handler-binding.ts +36 -1
- package/src/hitl-binding.ts +24 -0
- package/src/identity-directory-binding.ts +85 -4
- package/src/identity-provider-binding.ts +216 -21
- package/src/improvement-pass-binding.ts +193 -0
- package/src/index.ts +153 -31
- package/src/judged-dispatcher.ts +78 -11
- package/src/judgment-binding.ts +25 -1
- package/src/mcp-endpoint-binding.ts +7 -0
- package/src/memory-binding.ts +121 -17
- package/src/memory-erasure-binding.ts +156 -0
- package/src/middleware/auth.ts +228 -62
- package/src/middleware/authorize.ts +155 -3
- package/src/middleware/error-mapper.ts +15 -1
- package/src/middleware/idempotency.ts +230 -43
- package/src/middleware/key-project.ts +86 -0
- package/src/middleware/principal.ts +9 -5
- package/src/middleware/project-ref.ts +3 -0
- package/src/openapi/generate.ts +11 -2
- package/src/openapi/operations.ts +1060 -143
- package/src/openapi/schemas.ts +2387 -469
- package/src/person-grants-binding.ts +76 -0
- package/src/proposal-service.ts +640 -0
- package/src/proposal-status.ts +176 -0
- package/src/provider-binding.ts +10 -0
- package/src/publish-refused.ts +56 -9
- package/src/routes/adapters.ts +4 -0
- package/src/routes/agent-releases.ts +121 -69
- package/src/routes/agents.ts +128 -1
- package/src/routes/approvals.ts +164 -154
- package/src/routes/artifacts.ts +181 -11
- package/src/routes/auth.ts +804 -336
- package/src/routes/blocks.ts +2 -53
- package/src/routes/capabilities.ts +10 -1
- package/src/routes/compliance.ts +60 -99
- package/src/routes/conversations.ts +101 -7
- package/src/routes/cost.ts +110 -4
- package/src/routes/denied.ts +28 -0
- package/src/routes/deployments.ts +210 -17
- package/src/routes/eval-comparison.ts +81 -2
- package/src/routes/eval-overrides.ts +108 -0
- package/src/routes/eval-runs.ts +89 -6
- package/src/routes/eval-suites.ts +32 -2
- package/src/routes/event-triggers.ts +27 -3
- package/src/routes/export-signing-keys.ts +31 -0
- package/src/routes/flows.ts +12 -1
- package/src/routes/gate-policies.ts +37 -6
- package/src/routes/guardrails.ts +61 -2
- package/src/routes/identity.ts +328 -10
- package/src/routes/improvement-passes.ts +541 -0
- package/src/routes/judged-suites.ts +113 -43
- package/src/routes/judgment-context.ts +76 -5
- package/src/routes/judgment-flow-context.ts +16 -2
- package/src/routes/judgments.ts +17 -3
- package/src/routes/mcp.ts +29 -1
- package/src/routes/memory-access.ts +160 -0
- package/src/routes/memory-erasures.ts +240 -0
- package/src/routes/memory-parse.ts +250 -0
- package/src/routes/memory.ts +244 -286
- package/src/routes/observations.ts +15 -2
- package/src/routes/pagination.ts +12 -0
- package/src/routes/policies.ts +7 -1
- package/src/routes/project-mismatch.ts +56 -0
- package/src/routes/projects.ts +107 -13
- package/src/routes/proposals.ts +370 -611
- package/src/routes/provenance.ts +99 -133
- package/src/routes/providers.ts +142 -3
- package/src/routes/public-run-tokens.ts +3 -0
- package/src/routes/readable-projects.ts +66 -0
- package/src/routes/runs.ts +119 -39
- package/src/routes/schedules.ts +472 -60
- package/src/routes/segments.ts +11 -0
- package/src/routes/service-accounts.ts +262 -0
- package/src/routes/sign-in-options.ts +168 -0
- package/src/routes/signing-keys.ts +7 -1
- package/src/routes/tenant-access.ts +37 -0
- package/src/routes/tenant.ts +6 -0
- package/src/routes/token-sign-in.ts +161 -0
- package/src/routes/tokens.ts +172 -46
- package/src/routes/tools.ts +12 -1
- package/src/routes/trigger-access.ts +72 -0
- package/src/routes/webhook-endpoints.ts +15 -3
- package/src/routes/webhooks.ts +26 -2
- package/src/run-failure.ts +42 -0
- package/src/service-account-binding.ts +113 -0
- package/src/session-store-binding.ts +65 -13
- package/src/signed-export.ts +250 -0
- package/src/supervisor-binding.ts +169 -409
- package/src/testing/app-bindings.ts +142 -0
- package/src/testing/index.ts +21 -0
- package/src/testing/stub-binding.ts +53 -0
- package/src/testing/trigger-registry.ts +259 -0
- package/src/token-admin.ts +40 -8
- package/src/tool-binding.ts +14 -0
- package/src/trigger-binding.ts +8 -1
- package/src/types.ts +16 -0
- package/src/webhook-endpoint-binding.ts +18 -3
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
// Copyright (C) 2026 Kindgi Inc.
|
|
3
|
+
|
|
4
|
+
import { type BlockDefinition, settingsSchemaIssues, validateBlock } from '@kindgi/agents';
|
|
5
|
+
import { latestVersion, nextVersion } from '@kindgi/tools';
|
|
6
|
+
import type { Cursor, ProjectId, TenantId } from '@kindgi/types';
|
|
7
|
+
|
|
8
|
+
import type { BlockRecord, BlockRegistryBinding } from './block-binding.js';
|
|
9
|
+
|
|
10
|
+
/** One thing wrong with a block version, as `validation-failed` lists them. */
|
|
11
|
+
export interface BlockPublishIssue {
|
|
12
|
+
readonly path: string;
|
|
13
|
+
readonly message: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* A new version against the block's latest: the same kind, and a
|
|
18
|
+
* settings version without a schema of its own satisfies the schema it
|
|
19
|
+
* keeps (`carriedSchema`).
|
|
20
|
+
*/
|
|
21
|
+
export function continuityIssues(
|
|
22
|
+
latest: BlockRecord | null,
|
|
23
|
+
block: BlockDefinition,
|
|
24
|
+
): BlockPublishIssue[] {
|
|
25
|
+
if (latest === null) return [];
|
|
26
|
+
if (latest.kind !== block.kind) {
|
|
27
|
+
return [
|
|
28
|
+
{
|
|
29
|
+
path: '/kind',
|
|
30
|
+
message: `block "${block.id}" is a ${latest.kind} block; a version can't change its kind`,
|
|
31
|
+
},
|
|
32
|
+
];
|
|
33
|
+
}
|
|
34
|
+
const carried = carriedSchema(latest, block);
|
|
35
|
+
if (block.kind !== 'settings' || carried === undefined) return [];
|
|
36
|
+
return settingsSchemaIssues(block.content.values, carried).map((i) => ({
|
|
37
|
+
...i,
|
|
38
|
+
message: `${i.message} (the schema of version ${latest.version})`,
|
|
39
|
+
}));
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* The schema a settings version that gives none keeps: the latest
|
|
44
|
+
* version's. A version that gives a schema replaces it (`{}` drops the
|
|
45
|
+
* check on purpose).
|
|
46
|
+
*/
|
|
47
|
+
function carriedSchema(
|
|
48
|
+
latest: BlockRecord | null,
|
|
49
|
+
block: BlockDefinition,
|
|
50
|
+
): Readonly<Record<string, unknown>> | undefined {
|
|
51
|
+
if (latest?.kind !== 'settings' || block.kind !== 'settings') return undefined;
|
|
52
|
+
return block.content.schema === undefined ? latest.content.schema : undefined;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** The version as stored: with the schema it keeps, if any. */
|
|
56
|
+
export function withCarriedSchema(
|
|
57
|
+
latest: BlockRecord | null,
|
|
58
|
+
block: BlockDefinition,
|
|
59
|
+
): BlockDefinition {
|
|
60
|
+
const schema = carriedSchema(latest, block);
|
|
61
|
+
if (schema === undefined || block.kind !== 'settings') return block;
|
|
62
|
+
return { ...block, content: { ...block.content, schema } };
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/** New content for a block: settings values, or a prompt template. */
|
|
66
|
+
export type BlockEdit =
|
|
67
|
+
| { readonly kind: 'settings'; readonly values: Readonly<Record<string, unknown>> }
|
|
68
|
+
| { readonly kind: 'prompt'; readonly template: string };
|
|
69
|
+
|
|
70
|
+
export interface PublishBlockEditInput {
|
|
71
|
+
readonly blocks: BlockRegistryBinding;
|
|
72
|
+
readonly tenantId: TenantId;
|
|
73
|
+
/** The version the edit starts from: its schema or parameters and description carry over. */
|
|
74
|
+
readonly from: BlockRecord;
|
|
75
|
+
readonly edit: BlockEdit;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export type PublishBlockEditOutcome =
|
|
79
|
+
| { readonly kind: 'ok'; readonly version: string }
|
|
80
|
+
| { readonly kind: 'invalid'; readonly issues: readonly BlockPublishIssue[] };
|
|
81
|
+
|
|
82
|
+
/** How many numbers after the highest a publish tries before it gives up. */
|
|
83
|
+
const MAX_TRIES = 100;
|
|
84
|
+
|
|
85
|
+
/** The block version an edit would publish, numbered `version`; issues when it isn't valid. */
|
|
86
|
+
export async function blockEditDefinition(
|
|
87
|
+
input: PublishBlockEditInput,
|
|
88
|
+
version: string,
|
|
89
|
+
): Promise<
|
|
90
|
+
| { readonly kind: 'ok'; readonly block: BlockDefinition; readonly latest: BlockRecord | null }
|
|
91
|
+
| { readonly kind: 'invalid'; readonly issues: readonly BlockPublishIssue[] }
|
|
92
|
+
> {
|
|
93
|
+
const { from, edit } = input;
|
|
94
|
+
if (from.kind !== edit.kind) {
|
|
95
|
+
return {
|
|
96
|
+
kind: 'invalid',
|
|
97
|
+
issues: [
|
|
98
|
+
{ path: '/kind', message: `block "${from.id}" is a ${from.kind} block, not ${edit.kind}` },
|
|
99
|
+
],
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
const content =
|
|
103
|
+
from.kind === 'settings' && edit.kind === 'settings'
|
|
104
|
+
? {
|
|
105
|
+
values: edit.values,
|
|
106
|
+
...(from.content.schema !== undefined && { schema: from.content.schema }),
|
|
107
|
+
}
|
|
108
|
+
: from.kind === 'prompt' && edit.kind === 'prompt'
|
|
109
|
+
? {
|
|
110
|
+
template: edit.template,
|
|
111
|
+
...(from.content.parameters !== undefined && { parameters: from.content.parameters }),
|
|
112
|
+
}
|
|
113
|
+
: undefined;
|
|
114
|
+
const validated = validateBlock({
|
|
115
|
+
id: from.id,
|
|
116
|
+
version,
|
|
117
|
+
kind: from.kind,
|
|
118
|
+
...(from.description !== undefined && { description: from.description }),
|
|
119
|
+
content,
|
|
120
|
+
});
|
|
121
|
+
if (validated.kind === 'err') return { kind: 'invalid', issues: validated.error.issues };
|
|
122
|
+
const latest = await input.blocks.get({ tenantId: input.tenantId, blockId: from.id });
|
|
123
|
+
const continuity = continuityIssues(latest, validated.value);
|
|
124
|
+
if (continuity.length > 0) return { kind: 'invalid', issues: continuity };
|
|
125
|
+
return { kind: 'ok', block: validated.value, latest };
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Publish an edit of a block as its next free version (the first patch
|
|
130
|
+
* after its highest, unregistered versions included, since versions
|
|
131
|
+
* never change), into the block's own project. The edit is checked as
|
|
132
|
+
* `POST /v1/blocks` checks a version: it must be a valid block of the
|
|
133
|
+
* same kind, and settings values must satisfy the schema they keep.
|
|
134
|
+
*/
|
|
135
|
+
export async function publishBlockEdit(
|
|
136
|
+
input: PublishBlockEditInput,
|
|
137
|
+
): Promise<PublishBlockEditOutcome> {
|
|
138
|
+
const { blocks, tenantId, from } = input;
|
|
139
|
+
const versions = await allVersions(blocks, tenantId, from.id);
|
|
140
|
+
const highest = latestVersion(versions) ?? from.version;
|
|
141
|
+
let candidate = nextVersion(highest);
|
|
142
|
+
for (let tries = 0; candidate !== undefined && tries < MAX_TRIES; tries++) {
|
|
143
|
+
const checked = await blockEditDefinition(input, candidate);
|
|
144
|
+
if (checked.kind === 'invalid') return checked;
|
|
145
|
+
const outcome = await blocks.publish({
|
|
146
|
+
tenantId,
|
|
147
|
+
projectId: from.projectId,
|
|
148
|
+
block: withCarriedSchema(checked.latest, checked.block),
|
|
149
|
+
});
|
|
150
|
+
if (outcome.kind === 'ok') return { kind: 'ok', version: outcome.version };
|
|
151
|
+
if (outcome.kind !== 'already-registered') {
|
|
152
|
+
throw new Error(
|
|
153
|
+
`block "${from.id}": publishing into its own project ${from.projectId as ProjectId} failed (${outcome.kind})`,
|
|
154
|
+
);
|
|
155
|
+
}
|
|
156
|
+
candidate = nextVersion(candidate);
|
|
157
|
+
}
|
|
158
|
+
throw new Error(`block "${from.id}": no free version after ${highest}`);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/** Every version number a block holds, unregistered ones included. */
|
|
162
|
+
async function allVersions(
|
|
163
|
+
blocks: BlockRegistryBinding,
|
|
164
|
+
tenantId: TenantId,
|
|
165
|
+
blockId: string,
|
|
166
|
+
): Promise<string[]> {
|
|
167
|
+
const out: string[] = [];
|
|
168
|
+
let cursor: Cursor | undefined;
|
|
169
|
+
do {
|
|
170
|
+
const page = await blocks.listVersions({
|
|
171
|
+
tenantId,
|
|
172
|
+
blockId,
|
|
173
|
+
limit: 100,
|
|
174
|
+
includeTombstoned: true,
|
|
175
|
+
...(cursor !== undefined && { cursor }),
|
|
176
|
+
});
|
|
177
|
+
out.push(...page.data.map((b) => b.version));
|
|
178
|
+
cursor = page.nextCursor;
|
|
179
|
+
} while (cursor !== undefined);
|
|
180
|
+
return out;
|
|
181
|
+
}
|
package/src/caller.ts
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
// Copyright (C) 2026 Kindgi Inc.
|
|
3
|
+
|
|
4
|
+
import type { Context } from 'hono';
|
|
5
|
+
|
|
6
|
+
import { ref } from '@kindgi/authz';
|
|
7
|
+
|
|
8
|
+
import type { Authorizer } from './middleware/authorize.js';
|
|
9
|
+
import type { TokenPrincipal } from './token-admin.js';
|
|
10
|
+
import type { AppEnv } from './types.js';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Whom the request acts for, as an API key names it: the person when the
|
|
14
|
+
* token names one; otherwise the service account an API key acts for,
|
|
15
|
+
* else the key itself (a key store built before principals).
|
|
16
|
+
*/
|
|
17
|
+
export function callerPrincipal(c: Context<AppEnv>): TokenPrincipal | undefined {
|
|
18
|
+
const userId = c.get('userId');
|
|
19
|
+
if (userId !== undefined) return { kind: 'user', userId: userId as unknown as string };
|
|
20
|
+
const serviceAccountId = c.get('serviceAccountId') ?? (c.get('tokenId') as string | undefined);
|
|
21
|
+
if (serviceAccountId !== undefined) return { kind: 'service-account', serviceAccountId };
|
|
22
|
+
return undefined;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Whether the caller is a tenant admin: `admin` on the tenant when
|
|
27
|
+
* authorization is on, otherwise the `tenant-admin` scope. Never through
|
|
28
|
+
* a `member` key or a key limited to a project (see the authorizer).
|
|
29
|
+
*/
|
|
30
|
+
export async function isTenantAdmin(
|
|
31
|
+
c: Context<AppEnv>,
|
|
32
|
+
authorizer: Authorizer | undefined,
|
|
33
|
+
): Promise<boolean> {
|
|
34
|
+
if (authorizer !== undefined) {
|
|
35
|
+
const tenantId = c.get('tenantId') as unknown as string;
|
|
36
|
+
return authorizer.can(c, 'admin', ref('tenant', tenantId));
|
|
37
|
+
}
|
|
38
|
+
return (
|
|
39
|
+
(c.get('scopes') ?? []).includes('tenant-admin') &&
|
|
40
|
+
c.get('tokenRole') !== 'member' &&
|
|
41
|
+
c.get('tokenProjectId') === undefined
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** A principal on the wire: `{kind: 'user' | 'service-account', id}`. */
|
|
46
|
+
export function principalToWire(p: TokenPrincipal): {
|
|
47
|
+
kind: 'user' | 'service-account';
|
|
48
|
+
id: string;
|
|
49
|
+
} {
|
|
50
|
+
return p.kind === 'user'
|
|
51
|
+
? { kind: 'user', id: p.userId }
|
|
52
|
+
: { kind: 'service-account', id: p.serviceAccountId };
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** The caller as a principal reference: `user:<id>` or `service_account:<id>`. */
|
|
56
|
+
export function callerRef(c: Context<AppEnv>): string | undefined {
|
|
57
|
+
const caller = callerPrincipal(c);
|
|
58
|
+
if (caller === undefined) return undefined;
|
|
59
|
+
return caller.kind === 'user'
|
|
60
|
+
? `user:${caller.userId}`
|
|
61
|
+
: `service_account:${caller.serviceAccountId}`;
|
|
62
|
+
}
|
|
@@ -62,6 +62,18 @@ export interface CapabilityDescriptor {
|
|
|
62
62
|
* layer — the SDK surfaces it for tooling / doc generation.
|
|
63
63
|
*/
|
|
64
64
|
readonly paramsSchema?: Readonly<Record<string, unknown>>;
|
|
65
|
+
/**
|
|
66
|
+
* The tenant's registered providers with a model that has the feature,
|
|
67
|
+
* and those models. Absent when the binding doesn't read the provider
|
|
68
|
+
* registry; `[]` when no provider of the tenant has one.
|
|
69
|
+
*/
|
|
70
|
+
readonly providers?: readonly CapabilityProvider[];
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** One provider with a model that has a feature, and those models. */
|
|
74
|
+
export interface CapabilityProvider {
|
|
75
|
+
readonly providerId: string;
|
|
76
|
+
readonly models: readonly string[];
|
|
65
77
|
}
|
|
66
78
|
|
|
67
79
|
export interface CapabilityListInput {
|
package/src/cost-binding.ts
CHANGED
|
@@ -50,6 +50,14 @@ export interface CostBinding {
|
|
|
50
50
|
* every group is capped by the route.
|
|
51
51
|
*/
|
|
52
52
|
aggregate(input: CostAggregateInput): Promise<CostAggregateResult>;
|
|
53
|
+
/**
|
|
54
|
+
* `true` when `aggregate` honours `CostAggregateInput.readableProjectIds`,
|
|
55
|
+
* counting only those projects' records. Without it, the route answers
|
|
56
|
+
* an aggregate across projects (no scope, or an org) only for a caller
|
|
57
|
+
* who may read every project in it, and refuses anyone else rather than
|
|
58
|
+
* count projects they can't read.
|
|
59
|
+
*/
|
|
60
|
+
readonly aggregatesReadableProjects?: boolean;
|
|
53
61
|
}
|
|
54
62
|
|
|
55
63
|
// A binding throws when its store fails: the route answers 500. It never
|
|
@@ -198,6 +206,17 @@ export interface CostAggregateInput {
|
|
|
198
206
|
* shape uniformity.
|
|
199
207
|
*/
|
|
200
208
|
readonly inherit?: boolean;
|
|
209
|
+
/**
|
|
210
|
+
* Count only records in these projects, and records with no project
|
|
211
|
+
* (the tenant's own, which `/v1/cost/records` shows to anyone who may
|
|
212
|
+
* read the tenant), within `scope`. An org scope covers only the org's
|
|
213
|
+
* projects: a record with no project never counts there, and nor does a
|
|
214
|
+
* listed project outside the org. The route sets it when the caller
|
|
215
|
+
* may not read every project (`read` on each listed one); absent, every
|
|
216
|
+
* record in `scope` counts. Empty: no project's records count. A binding
|
|
217
|
+
* that applies it says so with `CostBinding.aggregatesReadableProjects`.
|
|
218
|
+
*/
|
|
219
|
+
readonly readableProjectIds?: readonly string[];
|
|
201
220
|
/**
|
|
202
221
|
* The most groups the caller wants (`?limit=`, 1..`COST_AGGREGATE_MAX_LIMIT`,
|
|
203
222
|
* default `COST_AGGREGATE_DEFAULT_LIMIT`): the most expensive ones. A
|
|
@@ -36,6 +36,8 @@ export interface DeriveAgentVersionInput {
|
|
|
36
36
|
readonly label?: string;
|
|
37
37
|
/** Who derived it (`user:<id>`). */
|
|
38
38
|
readonly by?: string;
|
|
39
|
+
/** The improvement proposal it's derived for, recorded in `derivedFrom`. */
|
|
40
|
+
readonly proposalId?: string;
|
|
39
41
|
/** The project, when the store doesn't record one on the version. */
|
|
40
42
|
readonly projectId?: ProjectId;
|
|
41
43
|
/** The authorization tuples for the new version, in the project it lands in. */
|
|
@@ -55,7 +57,9 @@ export type DeriveAgentVersionOutcome =
|
|
|
55
57
|
| { readonly kind: 'unpinned' }
|
|
56
58
|
| { readonly kind: 'invalid'; readonly issues: readonly SwapIssue[] }
|
|
57
59
|
| { readonly kind: 'no-project' }
|
|
58
|
-
| { readonly kind: 'project-not-found'; readonly projectId: ProjectId }
|
|
60
|
+
| { readonly kind: 'project-not-found'; readonly projectId: ProjectId }
|
|
61
|
+
/** The agent belongs to another project than the one given (`projectId`): nothing is written. */
|
|
62
|
+
| { readonly kind: 'project-mismatch'; readonly projectId: ProjectId };
|
|
59
63
|
|
|
60
64
|
/** How many numbers after the highest a derive tries before it gives up. */
|
|
61
65
|
const MAX_TRIES = 100;
|
|
@@ -108,6 +112,7 @@ export async function deriveAgentVersion(
|
|
|
108
112
|
reason: 'edited',
|
|
109
113
|
...(input.label !== undefined && { label: input.label }),
|
|
110
114
|
...(input.by !== undefined && { by: input.by }),
|
|
115
|
+
...(input.proposalId !== undefined && { proposalId: input.proposalId }),
|
|
111
116
|
},
|
|
112
117
|
});
|
|
113
118
|
}
|
|
@@ -139,6 +144,9 @@ async function publishNextFree(
|
|
|
139
144
|
});
|
|
140
145
|
if (outcome.kind === 'ok') return { kind: 'ok', agent };
|
|
141
146
|
if (outcome.kind === 'project-not-found') return { kind: 'project-not-found', projectId };
|
|
147
|
+
if (outcome.kind === 'project-mismatch') {
|
|
148
|
+
return { kind: 'project-mismatch', projectId: outcome.projectId };
|
|
149
|
+
}
|
|
142
150
|
candidate = nextVersion(candidate);
|
|
143
151
|
}
|
|
144
152
|
throw new Error(`agent "${agentId as unknown as string}": no free version after ${highest}`);
|
package/src/errors.ts
CHANGED
|
@@ -48,6 +48,17 @@ export const ERROR_CODE_TO_STATUS: Readonly<Record<string, number>> = {
|
|
|
48
48
|
// A deployment refuses tenant configuration that reaches its host
|
|
49
49
|
// (KINDGI_TENANT_HOST_ACCESS): a stdio MCP endpoint.
|
|
50
50
|
'host-access-denied': 403,
|
|
51
|
+
// A request signed in by the session cookie, from an origin the
|
|
52
|
+
// deployment doesn't allow (or with no Origin): cross-site request
|
|
53
|
+
// forgery protection for browser sessions.
|
|
54
|
+
'csrf-origin-mismatch': 403,
|
|
55
|
+
// `POST /v1/auth/token-sign-in` on a deployment that doesn't allow
|
|
56
|
+
// signing in to the console with an API token.
|
|
57
|
+
'token-sign-in-off': 403,
|
|
58
|
+
// `POST /v1/auth/token-sign-in` with a key that can't open a console
|
|
59
|
+
// session: a service account's, or a narrowed one (a `member` role or one
|
|
60
|
+
// project), which a session would widen to the person's full grants.
|
|
61
|
+
'token-sign-in-not-allowed': 403,
|
|
51
62
|
// 404
|
|
52
63
|
'not-found': 404,
|
|
53
64
|
'run-not-found': 404,
|
|
@@ -59,23 +70,35 @@ export const ERROR_CODE_TO_STATUS: Readonly<Record<string, number>> = {
|
|
|
59
70
|
'flow-not-found': 404,
|
|
60
71
|
// 409 — conflict
|
|
61
72
|
'already-terminal': 409,
|
|
73
|
+
'fact-changed': 409,
|
|
74
|
+
'legal-hold': 409,
|
|
75
|
+
'erasure-in-progress': 409,
|
|
62
76
|
'run-already-terminal': 409,
|
|
63
77
|
'run-lease-lost': 409,
|
|
64
78
|
'idempotency-key-body-mismatch': 409,
|
|
79
|
+
'idempotency-key-in-flight': 409,
|
|
80
|
+
'idempotency-key-replay-withheld': 409,
|
|
65
81
|
'hitl-required': 409,
|
|
66
82
|
'duplicate-node-id': 409,
|
|
67
83
|
'duplicate-edge-id': 409,
|
|
68
84
|
'agent-version-mismatch': 409,
|
|
69
85
|
'agent-already-registered': 409,
|
|
86
|
+
'agent-project-mismatch': 409,
|
|
70
87
|
'registry-read-only': 409,
|
|
71
88
|
'agent-gone': 410,
|
|
89
|
+
'run-erased': 410,
|
|
72
90
|
'flow-gone': 410,
|
|
73
91
|
'policy-gone': 410,
|
|
74
92
|
'eval-suite-gone': 410,
|
|
75
93
|
'tool-gone': 410,
|
|
76
94
|
'tool-already-registered': 409,
|
|
95
|
+
'tool-project-mismatch': 409,
|
|
77
96
|
'guardrail-already-registered': 409,
|
|
97
|
+
// A deploy's guardrail id is live in another project: a deploy never takes it.
|
|
98
|
+
'guardrail-project-mismatch': 409,
|
|
99
|
+
'guardrail-config-invalid': 422,
|
|
78
100
|
'flow-already-registered': 409,
|
|
101
|
+
'flow-project-mismatch': 409,
|
|
79
102
|
'conversation-closed': 409,
|
|
80
103
|
'invalid-agent': 400,
|
|
81
104
|
'invalid-tool-definition': 400,
|
|
@@ -105,6 +128,8 @@ export const ERROR_CODE_TO_STATUS: Readonly<Record<string, number>> = {
|
|
|
105
128
|
// belongs to an approval (decided through the approvals routes, which
|
|
106
129
|
// check the reviewer and record the decision) or to the runtime itself.
|
|
107
130
|
'run-resume-not-supported': 422,
|
|
131
|
+
/** Memory was asked to search by meaning, and no embedding model is configured. */
|
|
132
|
+
'semantic-unavailable': 422,
|
|
108
133
|
// 429 — rate limit. No route in this package emits it; a rate limiter
|
|
109
134
|
// in front of the routes can.
|
|
110
135
|
'rate-limit-exceeded': 429,
|
|
@@ -137,16 +162,16 @@ export const ERROR_CODE_TO_STATUS: Readonly<Record<string, number>> = {
|
|
|
137
162
|
'signing-key-revoked': 409,
|
|
138
163
|
'signing-key-algorithm-unsupported': 400,
|
|
139
164
|
'signing-key-store-error': 500,
|
|
140
|
-
//
|
|
165
|
+
// Improvement proposals.
|
|
141
166
|
'proposal-not-found': 404,
|
|
142
167
|
'proposal-invalid-state-transition': 409,
|
|
143
|
-
|
|
144
|
-
'
|
|
145
|
-
|
|
146
|
-
'
|
|
147
|
-
'
|
|
168
|
+
// Evaluating would make a version that serves every unpinned scope.
|
|
169
|
+
'proposal-needs-pin': 409,
|
|
170
|
+
// Improvement passes.
|
|
171
|
+
'improve-unsupported': 501,
|
|
172
|
+
'improvement-pass-not-found': 404,
|
|
173
|
+
'improvement-pass-finished': 409,
|
|
148
174
|
'version-already-exists': 409,
|
|
149
|
-
'invalid-new-version': 400,
|
|
150
175
|
'supervisor-header-missing': 400,
|
|
151
176
|
// Artifacts.
|
|
152
177
|
'blob-not-found': 404,
|
|
@@ -158,6 +183,7 @@ export const ERROR_CODE_TO_STATUS: Readonly<Record<string, number>> = {
|
|
|
158
183
|
'provider-not-found': 404,
|
|
159
184
|
'provider-already-registered': 409,
|
|
160
185
|
'invalid-provider': 400,
|
|
186
|
+
'provider-config-invalid': 422,
|
|
161
187
|
// Admin plane — cost readback.
|
|
162
188
|
'cost-record-not-found': 404,
|
|
163
189
|
// Admin plane — adapters.
|
|
@@ -173,6 +199,7 @@ export const ERROR_CODE_TO_STATUS: Readonly<Record<string, number>> = {
|
|
|
173
199
|
'block-project-mismatch': 409,
|
|
174
200
|
'eval-suite-not-found': 404,
|
|
175
201
|
'eval-suite-already-registered': 409,
|
|
202
|
+
'eval-suite-project-mismatch': 409,
|
|
176
203
|
// Admin plane — eval-run dispatch.
|
|
177
204
|
'eval-run-not-found': 404,
|
|
178
205
|
// Judgments (yes/no on a run's output items) and judge classes.
|
|
@@ -200,12 +227,41 @@ export const ERROR_CODE_TO_STATUS: Readonly<Record<string, number>> = {
|
|
|
200
227
|
'gate-policy-scope-unpinned': 409,
|
|
201
228
|
'gate-policy-needs-pin': 409,
|
|
202
229
|
'gate-policy-descendant-unpinned': 409,
|
|
230
|
+
// API keys: whom a key acts for, and what it may do.
|
|
231
|
+
/** Mint: the person or service account named doesn't exist. */
|
|
232
|
+
'principal-not-found': 404,
|
|
233
|
+
/** Mint: an `admin` key for a principal that isn't a tenant admin. */
|
|
234
|
+
'role-exceeds-principal': 403,
|
|
235
|
+
/** A key limited to one project, on a request that names another. */
|
|
236
|
+
'key-project-mismatch': 403,
|
|
237
|
+
'service-account-not-found': 404,
|
|
238
|
+
/** An active service account of the tenant already has the name. */
|
|
239
|
+
'service-account-name-taken': 409,
|
|
240
|
+
/** A grant for an unregistered service account. */
|
|
241
|
+
'service-account-unregistered': 409,
|
|
242
|
+
/** Adding a person with an email another person of the tenant has. */
|
|
243
|
+
'identity-user-email-taken': 409,
|
|
244
|
+
/** Removing tenant admin from the only person who holds it: the tenant would have none. */
|
|
245
|
+
'last-tenant-admin': 409,
|
|
246
|
+
/** Removing tenant admin from the seed user, whom the runtime re-grants it at every boot. */
|
|
247
|
+
'seed-user-admin': 409,
|
|
248
|
+
/** Unregistering yourself, or the deployment's seed user (`details.reason`). */
|
|
249
|
+
'identity-user-unregister-refused': 409,
|
|
250
|
+
/** A grant or a key for a person who was unregistered. */
|
|
251
|
+
'identity-user-unregistered': 409,
|
|
252
|
+
/** A person's grants on a runtime without an authorization store. */
|
|
253
|
+
'person-grants-unsupported': 501,
|
|
203
254
|
/** Unregister: the version is live in a scope; move that pin first. */
|
|
204
255
|
'agent-version-live': 409,
|
|
256
|
+
/** An artifact upload over the runtime's cap (`KINDGI_ARTIFACT_MAX_BYTES`). */
|
|
257
|
+
'artifact-too-large': 413,
|
|
205
258
|
'run-not-finished': 409,
|
|
206
259
|
'item-not-found': 400,
|
|
207
260
|
// The judgment binding can't list judged runs, so no test sets from judgments.
|
|
208
261
|
'test-sets-not-supported': 501,
|
|
262
|
+
'memory-operation-unsupported': 501,
|
|
263
|
+
// The conversation binding can't unregister (a runtime built before it).
|
|
264
|
+
'conversation-unregister-unsupported': 501,
|
|
209
265
|
// Authorization is enforced, but a membership change can't be kept in step with it.
|
|
210
266
|
'authz-membership-unsupported': 501,
|
|
211
267
|
'eval-run-already-terminal': 409,
|
|
@@ -231,12 +287,22 @@ export const ERROR_CODE_TO_STATUS: Readonly<Record<string, number>> = {
|
|
|
231
287
|
'session-inactive': 401,
|
|
232
288
|
'identity-provider-not-found': 404,
|
|
233
289
|
'identity-provider-already-registered': 409,
|
|
290
|
+
// The deployment couldn't use a provider's configuration (its issuer's
|
|
291
|
+
// discovery failed, its SAML metadata didn't parse, a host it may not
|
|
292
|
+
// reach): 422 with what went wrong.
|
|
293
|
+
'identity-provider-invalid': 422,
|
|
234
294
|
'oauth-state-invalid': 400,
|
|
235
295
|
'oauth-code-exchange-failed': 422,
|
|
236
296
|
'oauth-refresh-failed': 422,
|
|
237
297
|
'oauth-refresh-not-supported': 422,
|
|
238
298
|
'invalid-provider-config': 400,
|
|
239
299
|
'auth-not-session-token': 400,
|
|
300
|
+
// `POST /v1/auth/refresh` with a browser session (cookie): refused, so a
|
|
301
|
+
// fresh session token never reaches page scripts.
|
|
302
|
+
'cookie-session-not-refreshable': 400,
|
|
303
|
+
// `POST /v1/auth/token-sign-in` signed in by a session (a cookie or a
|
|
304
|
+
// session token) rather than an API token: there's nothing to exchange.
|
|
305
|
+
'token-sign-in-needs-an-api-token': 400,
|
|
240
306
|
// OAuth redirect URIs + refresh.
|
|
241
307
|
'redirect-uri-not-allowed': 400,
|
|
242
308
|
'redirect-uri-mismatch': 400,
|
|
@@ -302,6 +368,8 @@ export const ERROR_CODE_TO_STATUS: Readonly<Record<string, number>> = {
|
|
|
302
368
|
'trigger-register-failed': 500,
|
|
303
369
|
'trigger-update-failed': 500,
|
|
304
370
|
'trigger-lifecycle-failed': 500,
|
|
371
|
+
/** The deployment's trigger registry can't do this yet (fire history, run-now, a new owner). */
|
|
372
|
+
'trigger-operation-unsupported': 501,
|
|
305
373
|
'webhook-signature-invalid': 401,
|
|
306
374
|
'webhook-inactive': 410,
|
|
307
375
|
'webhook-secret-missing': 500,
|
package/src/eval-case-binding.ts
CHANGED
|
@@ -39,7 +39,17 @@ export interface JudgedItemSummary extends JudgedItem {
|
|
|
39
39
|
*/
|
|
40
40
|
readonly restricted?: { readonly yesWeight: number; readonly totalWeight: number };
|
|
41
41
|
/** The reasons given, newest first. */
|
|
42
|
-
readonly reasons: readonly
|
|
42
|
+
readonly reasons: readonly JudgedReason[];
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** One judgment's reason, and whose judgment it was. */
|
|
46
|
+
export interface JudgedReason {
|
|
47
|
+
readonly verdict: 'yes' | 'no';
|
|
48
|
+
readonly reason: string;
|
|
49
|
+
/** The judgment's class, when it had one. */
|
|
50
|
+
readonly judgeClassId?: string;
|
|
51
|
+
/** Set when the judgment was recorded while its class was restricted (`Judgment.restricted`). */
|
|
52
|
+
readonly restricted?: true;
|
|
43
53
|
}
|
|
44
54
|
|
|
45
55
|
/** One case of a `judged` suite: a copy of a judged run and what people said about it. */
|
|
@@ -54,6 +64,12 @@ export interface JudgedEvalCase {
|
|
|
54
64
|
/** The output that was judged. */
|
|
55
65
|
readonly output: unknown;
|
|
56
66
|
readonly items: readonly JudgedItemSummary[];
|
|
67
|
+
/**
|
|
68
|
+
* An erasure cleared this case (a person's words were erased): its
|
|
69
|
+
* `input`, `output` and `context` are gone and its items empty. Eval
|
|
70
|
+
* runs leave it out and count it (`erased`).
|
|
71
|
+
*/
|
|
72
|
+
readonly erased?: true;
|
|
57
73
|
}
|
|
58
74
|
|
|
59
75
|
export interface EvalCasePutInput {
|
package/src/eval-run-binding.ts
CHANGED
|
@@ -173,6 +173,37 @@ export interface EvalComparison {
|
|
|
173
173
|
readonly versions?: FlowVersionOverrides;
|
|
174
174
|
/** Which judgments count (absent: `as-recorded`). */
|
|
175
175
|
readonly classWeights?: EvalClassWeights;
|
|
176
|
+
/**
|
|
177
|
+
* For an agent candidate: block content its replays run instead of the
|
|
178
|
+
* version's pinned content (settings values, a prompt template: an
|
|
179
|
+
* improvement pass's search). A comparison with overrides can't gate a
|
|
180
|
+
* promotion: it didn't run a published version.
|
|
181
|
+
*/
|
|
182
|
+
readonly overrides?: EvalOverrides;
|
|
183
|
+
/** Only part of the test set's cases (absent: all of them). */
|
|
184
|
+
readonly sample?: EvalSample;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/** Block content that replaces a version's pinned content: settings values and prompt templates, by block id. */
|
|
188
|
+
export interface EvalOverrides {
|
|
189
|
+
readonly settings?: Readonly<Record<string, Readonly<Record<string, unknown>>>>;
|
|
190
|
+
readonly prompts?: Readonly<Record<string, { readonly template: string }>>;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Part of a test set: its cases split once into a hold-out part (about
|
|
195
|
+
* `holdOutShare` of them) and a search part (the rest), stratified by
|
|
196
|
+
* judgment (the cases with a "no" and the others split on their own), in
|
|
197
|
+
* the order of a hash of each case id and `seed`. The same seed splits
|
|
198
|
+
* the same test set the same way, so an improvement pass searches on one
|
|
199
|
+
* part and proves its candidate on the other. A promotion gate refuses a
|
|
200
|
+
* comparison on the search part.
|
|
201
|
+
*/
|
|
202
|
+
export interface EvalSample {
|
|
203
|
+
readonly part: 'search' | 'hold-out';
|
|
204
|
+
readonly seed: string;
|
|
205
|
+
/** 0.1 to 0.9. */
|
|
206
|
+
readonly holdOutShare: number;
|
|
176
207
|
}
|
|
177
208
|
|
|
178
209
|
export interface EvalRunStartInput {
|
|
@@ -89,6 +89,13 @@ export interface EvalRunSubjectInvokeOutcome {
|
|
|
89
89
|
readonly arguments: unknown;
|
|
90
90
|
readonly reason?: string;
|
|
91
91
|
};
|
|
92
|
+
/**
|
|
93
|
+
* The past run was erased after the case was read (a person's words
|
|
94
|
+
* were removed): nothing was replayed. Not an error: the dispatcher
|
|
95
|
+
* leaves the case out and counts it, like a case erased before. A
|
|
96
|
+
* runtime that predates erasure never sets it.
|
|
97
|
+
*/
|
|
98
|
+
readonly erased?: true;
|
|
92
99
|
}
|
|
93
100
|
|
|
94
101
|
/**
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
// Copyright (C) 2026 Kindgi Inc.
|
|
3
|
+
|
|
4
|
+
import { createHash } from 'node:crypto';
|
|
5
|
+
|
|
6
|
+
import type { JudgedEvalCase } from './eval-case-binding.js';
|
|
7
|
+
import type { EvalSample } from './eval-run-binding.js';
|
|
8
|
+
|
|
9
|
+
/** Where a case falls in `[0, 1)` for a seed: the same for the same seed and case, always. */
|
|
10
|
+
function position(seed: string, caseId: string): number {
|
|
11
|
+
const hex = createHash('sha256').update(`${seed}:${caseId}`, 'utf8').digest('hex').slice(0, 8);
|
|
12
|
+
return Number.parseInt(hex, 16) / 0x1_0000_0000;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/** A case's stratum: whether anyone judged one of its items "no". */
|
|
16
|
+
function stratum(c: JudgedEvalCase): 'no' | 'yes' {
|
|
17
|
+
return c.items.some((item) => item.yesWeight < item.totalWeight) ? 'no' : 'yes';
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* The cases of a sample's part. The split is stratified by judgment: the
|
|
22
|
+
* cases with a "no" and the cases without are each split on their own,
|
|
23
|
+
* about `holdOutShare` of each into the hold-out part, in the order of a
|
|
24
|
+
* hash of the case id and `seed` (a stratum of two or more cases puts at
|
|
25
|
+
* least one in each part). The same seed and test set split the same way.
|
|
26
|
+
*/
|
|
27
|
+
export function sampleCases(
|
|
28
|
+
cases: readonly JudgedEvalCase[],
|
|
29
|
+
sample: EvalSample,
|
|
30
|
+
): JudgedEvalCase[] {
|
|
31
|
+
const holdOut = new Set<string>();
|
|
32
|
+
for (const s of ['no', 'yes'] as const) {
|
|
33
|
+
const ordered = cases
|
|
34
|
+
.filter((c) => stratum(c) === s)
|
|
35
|
+
.map((c) => ({ id: c.caseId, at: position(sample.seed, c.caseId) }))
|
|
36
|
+
.sort((a, b) => a.at - b.at || a.id.localeCompare(b.id));
|
|
37
|
+
const n = ordered.length;
|
|
38
|
+
const count = n < 2 ? 0 : Math.min(n - 1, Math.max(1, Math.round(n * sample.holdOutShare)));
|
|
39
|
+
for (const c of ordered.slice(0, count)) holdOut.add(c.id);
|
|
40
|
+
}
|
|
41
|
+
return cases.filter((c) => holdOut.has(c.caseId) === (sample.part === 'hold-out'));
|
|
42
|
+
}
|
|
@@ -62,6 +62,8 @@ export interface EvalSuiteRegistryBinding {
|
|
|
62
62
|
* before calling — the binding receives a well-formed `EvalSuite`.
|
|
63
63
|
* Bindings MAY reject with `already-registered` when the same
|
|
64
64
|
* `(suiteId, version)` is re-published; the route maps that to `409`.
|
|
65
|
+
* A version of an eval suite whose versions live in another project is
|
|
66
|
+
* `project-mismatch` (suites never move between projects; `409 eval-suite-project-mismatch`).
|
|
65
67
|
*/
|
|
66
68
|
publish(input: EvalSuitePublishInput): Promise<EvalSuitePublishOutcome>;
|
|
67
69
|
/**
|
|
@@ -239,6 +241,18 @@ export type EvalSuitePublishOutcome =
|
|
|
239
241
|
readonly suiteId: string;
|
|
240
242
|
readonly version: string;
|
|
241
243
|
readonly projectId: ProjectId;
|
|
244
|
+
}
|
|
245
|
+
| {
|
|
246
|
+
/**
|
|
247
|
+
* The eval suite's versions live in another project: an eval suite belongs to
|
|
248
|
+
* the project its first version was published into, and never
|
|
249
|
+
* moves. Nothing is written (the route answers `409 eval-suite-project-mismatch`).
|
|
250
|
+
*/
|
|
251
|
+
readonly kind: 'project-mismatch';
|
|
252
|
+
readonly suiteId: string;
|
|
253
|
+
readonly version: string;
|
|
254
|
+
/** The project the eval suite belongs to. */
|
|
255
|
+
readonly projectId: ProjectId;
|
|
242
256
|
};
|
|
243
257
|
|
|
244
258
|
export type EvalSuiteUnregisterOutcome = {
|