@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
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
2
2
|
// Copyright (C) 2026 Kindgi Inc.
|
|
3
3
|
|
|
4
|
-
import type { Scope } from '@kindgi/platform';
|
|
5
4
|
import type {
|
|
6
5
|
AgentId,
|
|
7
|
-
ApprovalId,
|
|
8
6
|
Cursor,
|
|
9
7
|
FixProposalId,
|
|
8
|
+
LiveScope,
|
|
10
9
|
ObservationId,
|
|
10
|
+
ProjectId,
|
|
11
11
|
ProvenanceId,
|
|
12
12
|
RunId,
|
|
13
13
|
Semver,
|
|
@@ -17,103 +17,45 @@ import type {
|
|
|
17
17
|
} from '@kindgi/types';
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
|
-
* Caller-plugged
|
|
21
|
-
*
|
|
22
|
-
* `AgentRegistryBinding` / `MemoryBinding
|
|
23
|
-
*
|
|
24
|
-
* or eval invocation. A binding implementation composes:
|
|
20
|
+
* Caller-plugged store behind improvement proposals (`/v1/proposals`)
|
|
21
|
+
* and the supervisor's observation readback (`/v1/observations`). Same
|
|
22
|
+
* shape as `AgentRegistryBinding` / `MemoryBinding`: the API package
|
|
23
|
+
* doesn't own the storage.
|
|
25
24
|
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* Every proposal method is tenant-scoped AND supervisor-scoped: callers
|
|
37
|
-
* pass both `tenantId` and `supervisorId`. `supervisorId` comes from the
|
|
38
|
-
* `X-Supervisor-Id` request header — tenant flows from the token,
|
|
39
|
-
* supervisor is a per-request scope the caller supplies.
|
|
40
|
-
*
|
|
41
|
-
* State transitions are enforced by the supervisor runtime
|
|
42
|
-
* (`invalid-transition` domain error). The route layer surfaces those
|
|
43
|
-
* as `409 conflict` with error code
|
|
44
|
-
* `proposal-invalid-state-transition` — out-of-order lifecycle calls
|
|
45
|
-
* are caller/state conflicts.
|
|
25
|
+
* A proposal is a change to one data block an agent version pins (new
|
|
26
|
+
* settings values, or a new prompt template), for one live scope. The
|
|
27
|
+
* API package runs its lifecycle from bindings that exist already:
|
|
28
|
+
* evaluating publishes the block version and derives the agent version
|
|
29
|
+
* (both serve nowhere until promoted) and starts a comparison eval run;
|
|
30
|
+
* requesting runs the scope's gated promotion. This binding only keeps
|
|
31
|
+
* the rows: what was proposed, then each step's outcome, recorded with
|
|
32
|
+
* a compare-and-set on `revision`. A proposal's status is never stored:
|
|
33
|
+
* the route derives it from the eval run and the promotion
|
|
34
|
+
* (`proposalStatus`).
|
|
46
35
|
*
|
|
47
36
|
* `queryObservations` is the supervisor readback for `/v1/observations`
|
|
48
37
|
* — a straight paginated list over the observation stream. Tenant-scoped
|
|
49
|
-
* only; `supervisorId` is an optional filter
|
|
38
|
+
* only; `supervisorId` is an optional filter.
|
|
50
39
|
*/
|
|
51
40
|
export interface SupervisorBinding {
|
|
52
41
|
/**
|
|
53
|
-
* Cursor-paginated
|
|
54
|
-
*
|
|
55
|
-
* - `status` — single `FixProposalStatus` value.
|
|
56
|
-
* - `agentId` — exact match on target agent id.
|
|
57
|
-
* - `tier` — `'prompt' | 'retrieval' | 'tool-config'`.
|
|
58
|
-
*
|
|
59
|
-
* Sort order is binding-defined (for example `createdAt desc, id desc`).
|
|
60
|
-
*/
|
|
61
|
-
listProposals(input: SupervisorListProposalsInput): Promise<SupervisorProposalPage>;
|
|
62
|
-
/**
|
|
63
|
-
* Get a proposal by id, or `null` when unknown. The route surfaces
|
|
64
|
-
* `null` as `404 proposal-not-found`. The binding MUST also return
|
|
65
|
-
* `null` when the proposal exists but is not owned by the caller's
|
|
66
|
-
* supervisor id — cross-supervisor reads leak tier boundaries the
|
|
67
|
-
* same way cross-tenant reads leak resource existence (avoid via
|
|
68
|
-
* `null → 404` per `docs/API-ROUTE-CONVENTIONS.md` §2.4).
|
|
69
|
-
*/
|
|
70
|
-
getProposal(input: SupervisorGetProposalInput): Promise<FixProposal | null>;
|
|
71
|
-
/**
|
|
72
|
-
* Draft a new proposal in `draft` state. The dedup fingerprint is
|
|
73
|
-
* computed from `(tier, agentId, agentVersion, canonical(change))`;
|
|
74
|
-
* duplicate proposals short-circuit to the existing non-terminal row —
|
|
75
|
-
* discriminated on `SupervisorDraftOutcome.kind`.
|
|
76
|
-
*/
|
|
77
|
-
draftProposal(input: SupervisorDraftProposalInput): Promise<SupervisorDraftOutcome>;
|
|
78
|
-
/**
|
|
79
|
-
* Trigger a dry-run for a proposal. A dry-run needs a dataset, judges,
|
|
80
|
-
* eval bindings and an agent-invocation closure — all of which the
|
|
81
|
-
* binding assembles from `input.datasetId` / `input.datasetVersion`
|
|
82
|
-
* and its own runtime wiring. Returns the updated proposal (`dry-run-passed` or
|
|
83
|
-
* `dry-run-failed`) or a discriminated error outcome so the route
|
|
84
|
-
* can map `invalid-transition` → `409` without touching the runtime
|
|
85
|
-
* error union directly.
|
|
86
|
-
*/
|
|
87
|
-
dryRunProposal(input: SupervisorDryRunProposalInput): Promise<SupervisorDryRunOutcome>;
|
|
88
|
-
/**
|
|
89
|
-
* Submit an approved dry-run proposal for HITL review. The binding
|
|
90
|
-
* forwards the resolved `Supervisor` (for ground-layer enforcement +
|
|
91
|
-
* meta-fix detection) and enqueues the approval. Returns the updated proposal (in
|
|
92
|
-
* `proposed-for-review` state) plus the created approval id so the
|
|
93
|
-
* route can surface it in the response body (the SDK correlates
|
|
94
|
-
* proposal → approval via that id).
|
|
42
|
+
* Cursor-paginated proposals in the tenant, newest first
|
|
43
|
+
* (`createdAt desc, id desc`). Filters are optional.
|
|
95
44
|
*/
|
|
96
|
-
|
|
45
|
+
listProposals(input: ListProposalsInput): Promise<StoredProposalPage>;
|
|
46
|
+
/** One proposal, or `null` when the tenant has none with that id. */
|
|
47
|
+
getProposal(input: GetProposalInput): Promise<StoredProposal | null>;
|
|
97
48
|
/**
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
* (`proposalId`, `appliedVersion`, `appliedAt`) rather than the
|
|
101
|
-
* full runtime result — the route body stays lean; callers who
|
|
102
|
-
* need the full `Agent` snapshot can `GET /v1/agents/:agentId`.
|
|
49
|
+
* Store a new proposal at revision 1. One with the same `fingerprint`
|
|
50
|
+
* that isn't withdrawn yet answers `dedup` with that row instead.
|
|
103
51
|
*/
|
|
104
|
-
|
|
52
|
+
createProposal(input: CreateProposalInput): Promise<CreateProposalOutcome>;
|
|
105
53
|
/**
|
|
106
|
-
*
|
|
107
|
-
*
|
|
54
|
+
* Record a step on a proposal if it's still at `expectRevision`; the
|
|
55
|
+
* row's revision goes up by one. `conflict` when another call recorded
|
|
56
|
+
* a step first: the caller reads it again.
|
|
108
57
|
*/
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* Withdraw a non-terminal proposal. Legal from any of
|
|
112
|
-
* `draft | dry-running | dry-run-passed | dry-run-failed |
|
|
113
|
-
* proposed-for-review`. Terminal states surface as
|
|
114
|
-
* `invalid-transition` (which the route maps to 409).
|
|
115
|
-
*/
|
|
116
|
-
withdrawProposal(input: SupervisorWithdrawProposalInput): Promise<SupervisorWithdrawOutcome>;
|
|
58
|
+
recordProposal(input: RecordProposalInput): Promise<RecordProposalOutcome>;
|
|
117
59
|
/**
|
|
118
60
|
* Cursor-paginated observation readback for `/v1/observations`.
|
|
119
61
|
* Tenant-scoped; supervisor/agent/conversation/time-window filters
|
|
@@ -127,105 +69,173 @@ export interface SupervisorBinding {
|
|
|
127
69
|
): Promise<SupervisorQueryObservationsOutcome>;
|
|
128
70
|
}
|
|
129
71
|
|
|
130
|
-
// ============
|
|
72
|
+
// ============ proposals ============
|
|
131
73
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
74
|
+
/** What a proposal changes: a data block the agent version pins. */
|
|
75
|
+
export type ProposalTier = 'settings-block' | 'prompt-block';
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* The change: one block, from the version the agent version pins, to new
|
|
79
|
+
* content. Settings proposals give new `values` (the schema carries
|
|
80
|
+
* over); prompt proposals give a new `template` (the parameters carry
|
|
81
|
+
* over).
|
|
82
|
+
*/
|
|
83
|
+
export type ProposedChange =
|
|
84
|
+
| {
|
|
85
|
+
readonly tier: 'settings-block';
|
|
86
|
+
readonly change: {
|
|
87
|
+
readonly blockId: string;
|
|
88
|
+
readonly fromVersion: string;
|
|
89
|
+
readonly content: { readonly values: Readonly<Record<string, unknown>> };
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
| {
|
|
93
|
+
readonly tier: 'prompt-block';
|
|
94
|
+
readonly change: {
|
|
95
|
+
readonly blockId: string;
|
|
96
|
+
readonly fromVersion: string;
|
|
97
|
+
readonly content: { readonly template: string };
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
/** Who wrote a proposal: a person, or one of the runtime's drafters. */
|
|
102
|
+
export type ProposalDrafter =
|
|
103
|
+
| { readonly kind: 'person'; readonly by: string }
|
|
104
|
+
| {
|
|
105
|
+
readonly kind: 'settings-optimizer' | 'prompt-drafter';
|
|
106
|
+
readonly version: string;
|
|
107
|
+
readonly model?: { readonly providerId: string; readonly model: string };
|
|
108
|
+
/** The improvement pass that drafted it. */
|
|
109
|
+
readonly passId?: string;
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
/** What a proposal rests on. */
|
|
113
|
+
export interface ProposalEvidence {
|
|
114
|
+
/** The judgments that motivated it. */
|
|
115
|
+
readonly judgmentIds?: readonly string[];
|
|
165
116
|
}
|
|
166
117
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
readonly
|
|
118
|
+
/** The versions evaluating a proposal published: inert until a promotion makes them live. */
|
|
119
|
+
export interface ProposalCandidate {
|
|
120
|
+
/** The derived agent version (`derivedFrom.proposalId` names this proposal). */
|
|
121
|
+
readonly agentVersion: string;
|
|
122
|
+
/** The block version published from the proposal's content. */
|
|
123
|
+
readonly blockVersion: string;
|
|
124
|
+
readonly pinsDigest: string;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/** The metric that says whether a candidate is better. */
|
|
128
|
+
export type ProposalObjective = 'weightedYesShare' | 'weightedPrecisionAtK';
|
|
129
|
+
|
|
130
|
+
/** The comparison a proposal was evaluated with. */
|
|
131
|
+
export interface ProposalEvaluationRef {
|
|
132
|
+
readonly evalRunId: string;
|
|
133
|
+
readonly suiteId: string;
|
|
134
|
+
readonly objective: ProposalObjective;
|
|
135
|
+
readonly startedAt: Timestamp;
|
|
171
136
|
}
|
|
172
137
|
|
|
173
|
-
|
|
138
|
+
/** A proposal as the binding stores it (no status: that's derived). */
|
|
139
|
+
export interface StoredProposal {
|
|
140
|
+
readonly id: FixProposalId;
|
|
174
141
|
readonly tenantId: TenantId;
|
|
175
|
-
|
|
142
|
+
/** The agent version's project, when known. */
|
|
143
|
+
readonly projectId?: ProjectId;
|
|
176
144
|
readonly agentId: AgentId;
|
|
177
|
-
|
|
178
|
-
readonly
|
|
145
|
+
/** The agent version the change applies to. */
|
|
146
|
+
readonly fromVersion: string;
|
|
147
|
+
/** The live scope it's for. */
|
|
148
|
+
readonly scope: LiveScope;
|
|
149
|
+
readonly tier: ProposalTier;
|
|
179
150
|
readonly change: ProposedChange['change'];
|
|
180
|
-
readonly patternRefs: readonly PatternRef[];
|
|
181
151
|
readonly hypothesis: string;
|
|
182
|
-
readonly
|
|
152
|
+
readonly evidence?: ProposalEvidence;
|
|
153
|
+
readonly drafter: ProposalDrafter;
|
|
154
|
+
/** Dedup key: the same change for the same scope is one proposal. */
|
|
155
|
+
readonly fingerprint: string;
|
|
156
|
+
/** Goes up by one with each recorded step. */
|
|
157
|
+
readonly revision: number;
|
|
158
|
+
readonly candidate?: ProposalCandidate;
|
|
159
|
+
readonly evaluation?: ProposalEvaluationRef;
|
|
160
|
+
/** The promotion its request made (the latest, after a re-request). */
|
|
161
|
+
readonly promotionId?: string;
|
|
162
|
+
readonly rolledBack?: {
|
|
163
|
+
readonly at: Timestamp;
|
|
164
|
+
/** The rollback's own promotion row. */
|
|
165
|
+
readonly promotionId: string;
|
|
166
|
+
readonly by: string;
|
|
167
|
+
readonly reason?: string;
|
|
168
|
+
};
|
|
169
|
+
readonly withdrawn?: { readonly at: Timestamp; readonly by: string; readonly reason: string };
|
|
170
|
+
readonly createdAt: Timestamp;
|
|
171
|
+
readonly updatedAt: Timestamp;
|
|
183
172
|
}
|
|
184
173
|
|
|
185
|
-
export interface
|
|
174
|
+
export interface ListProposalsInput {
|
|
186
175
|
readonly tenantId: TenantId;
|
|
187
|
-
readonly
|
|
188
|
-
readonly
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
* own registry.
|
|
194
|
-
*/
|
|
195
|
-
readonly datasetId: string;
|
|
196
|
-
readonly datasetVersion: string;
|
|
197
|
-
readonly criterion: PassCriterion;
|
|
176
|
+
readonly limit: number;
|
|
177
|
+
readonly cursor?: Cursor;
|
|
178
|
+
readonly agentId?: AgentId;
|
|
179
|
+
readonly tier?: ProposalTier;
|
|
180
|
+
/** Only proposals for exactly this live scope. */
|
|
181
|
+
readonly liveScope?: LiveScope;
|
|
198
182
|
}
|
|
199
183
|
|
|
200
|
-
export interface
|
|
184
|
+
export interface GetProposalInput {
|
|
201
185
|
readonly tenantId: TenantId;
|
|
202
|
-
readonly supervisorId: SupervisorId;
|
|
203
186
|
readonly proposalId: FixProposalId;
|
|
204
|
-
readonly requiredRole?: 'standard' | 'senior' | 'admin';
|
|
205
|
-
readonly expiresAt?: Timestamp;
|
|
206
187
|
}
|
|
207
188
|
|
|
208
|
-
export interface
|
|
189
|
+
export interface CreateProposalInput {
|
|
209
190
|
readonly tenantId: TenantId;
|
|
210
|
-
|
|
211
|
-
readonly
|
|
212
|
-
readonly
|
|
191
|
+
/** The agent version's project, when the agent store records one: what a scoped list narrows by. */
|
|
192
|
+
readonly projectId?: ProjectId;
|
|
193
|
+
readonly agentId: AgentId;
|
|
194
|
+
readonly fromVersion: string;
|
|
195
|
+
readonly scope: LiveScope;
|
|
196
|
+
readonly tier: ProposalTier;
|
|
197
|
+
readonly change: ProposedChange['change'];
|
|
198
|
+
readonly hypothesis: string;
|
|
199
|
+
readonly evidence?: ProposalEvidence;
|
|
200
|
+
readonly drafter: ProposalDrafter;
|
|
201
|
+
readonly fingerprint: string;
|
|
213
202
|
}
|
|
214
203
|
|
|
215
|
-
export
|
|
204
|
+
export type CreateProposalOutcome =
|
|
205
|
+
| { readonly kind: 'ok'; readonly proposal: StoredProposal }
|
|
206
|
+
| { readonly kind: 'dedup'; readonly proposal: StoredProposal };
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* One step's outcome, recorded on the proposal. An `evaluation` replaces
|
|
210
|
+
* the one before and clears `promotionId`: a new comparison starts the
|
|
211
|
+
* request over. A `candidate` is recorded once.
|
|
212
|
+
*/
|
|
213
|
+
export type ProposalStep =
|
|
214
|
+
| { readonly kind: 'candidate'; readonly candidate: ProposalCandidate }
|
|
215
|
+
| { readonly kind: 'evaluation'; readonly evaluation: ProposalEvaluationRef }
|
|
216
|
+
| { readonly kind: 'promotion'; readonly promotionId: string }
|
|
217
|
+
| { readonly kind: 'rolled-back'; readonly rolledBack: NonNullable<StoredProposal['rolledBack']> }
|
|
218
|
+
| { readonly kind: 'withdrawn'; readonly withdrawn: NonNullable<StoredProposal['withdrawn']> };
|
|
219
|
+
|
|
220
|
+
export interface RecordProposalInput {
|
|
216
221
|
readonly tenantId: TenantId;
|
|
217
|
-
readonly supervisorId: SupervisorId;
|
|
218
222
|
readonly proposalId: FixProposalId;
|
|
219
|
-
readonly
|
|
223
|
+
readonly expectRevision: number;
|
|
224
|
+
readonly step: ProposalStep;
|
|
220
225
|
}
|
|
221
226
|
|
|
222
|
-
export
|
|
223
|
-
readonly
|
|
224
|
-
readonly
|
|
225
|
-
readonly
|
|
226
|
-
|
|
227
|
+
export type RecordProposalOutcome =
|
|
228
|
+
| { readonly kind: 'ok'; readonly proposal: StoredProposal }
|
|
229
|
+
| { readonly kind: 'not-found' }
|
|
230
|
+
| { readonly kind: 'conflict'; readonly proposal: StoredProposal };
|
|
231
|
+
|
|
232
|
+
export interface StoredProposalPage {
|
|
233
|
+
readonly data: readonly StoredProposal[];
|
|
234
|
+
readonly nextCursor?: Cursor;
|
|
227
235
|
}
|
|
228
236
|
|
|
237
|
+
// ============ observations ============
|
|
238
|
+
|
|
229
239
|
/**
|
|
230
240
|
* Observation readback filter. Tenant-scoped; every other filter is
|
|
231
241
|
* optional. `since` / `until` bound `observedAt`; `cursor` is an opaque
|
|
@@ -245,120 +255,6 @@ export interface SupervisorQueryObservationsInput {
|
|
|
245
255
|
readonly until?: Timestamp;
|
|
246
256
|
}
|
|
247
257
|
|
|
248
|
-
// ============ outputs ============
|
|
249
|
-
|
|
250
|
-
export interface SupervisorProposalPage {
|
|
251
|
-
readonly data: readonly FixProposal[];
|
|
252
|
-
readonly nextCursor?: Cursor;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
/**
|
|
256
|
-
* Result of a draft attempt. Deduplication is by
|
|
257
|
-
* `(supervisorId, fingerprint)`:
|
|
258
|
-
*
|
|
259
|
-
* - `ok` — a new draft row was inserted.
|
|
260
|
-
* - `dedup` — an existing non-terminal proposal has the same
|
|
261
|
-
* fingerprint; caller can treat it as their own
|
|
262
|
-
* draft. `proposal` is the pre-existing row.
|
|
263
|
-
*/
|
|
264
|
-
export type SupervisorDraftOutcome =
|
|
265
|
-
| { readonly kind: 'ok'; readonly proposal: FixProposal }
|
|
266
|
-
| { readonly kind: 'dedup'; readonly proposal: FixProposal };
|
|
267
|
-
|
|
268
|
-
/**
|
|
269
|
-
* Result of a dry-run attempt. `ok` carries the updated proposal
|
|
270
|
-
* (either `dry-run-passed` or `dry-run-failed` — both are legitimate
|
|
271
|
-
* outcomes; `failed` means "the criterion was not met," not "the
|
|
272
|
-
* request errored"). Failure outcomes surface as discriminated errors
|
|
273
|
-
* the route layer maps to specific HTTP statuses.
|
|
274
|
-
*/
|
|
275
|
-
export type SupervisorDryRunOutcome =
|
|
276
|
-
| { readonly kind: 'ok'; readonly proposal: FixProposal; readonly passed: boolean }
|
|
277
|
-
| { readonly kind: 'not-found'; readonly proposalId: FixProposalId }
|
|
278
|
-
| {
|
|
279
|
-
readonly kind: 'invalid-transition';
|
|
280
|
-
readonly proposalId: FixProposalId;
|
|
281
|
-
readonly from: FixProposalStatus;
|
|
282
|
-
readonly to: FixProposalStatus;
|
|
283
|
-
}
|
|
284
|
-
| {
|
|
285
|
-
/**
|
|
286
|
-
* Wire back `apply-change-failed` (change couldn't be applied
|
|
287
|
-
* against the current baseline), `baseline-mismatch` (proposal
|
|
288
|
-
* targets a stale version), or any other runtime failure. The
|
|
289
|
-
* route maps the code through `statusFor`: the two named codes are
|
|
290
|
-
* `422 unprocessable` (the request was well-formed but the domain
|
|
291
|
-
* state prevents dry-running); unknown codes are `500`.
|
|
292
|
-
*/
|
|
293
|
-
readonly kind: 'runtime-error';
|
|
294
|
-
readonly code: string;
|
|
295
|
-
readonly message: string;
|
|
296
|
-
};
|
|
297
|
-
|
|
298
|
-
export type SupervisorSubmitReviewOutcome =
|
|
299
|
-
| {
|
|
300
|
-
readonly kind: 'ok';
|
|
301
|
-
readonly proposal: FixProposal;
|
|
302
|
-
readonly approvalId: ApprovalId;
|
|
303
|
-
readonly metaFix: boolean;
|
|
304
|
-
}
|
|
305
|
-
| { readonly kind: 'not-found'; readonly proposalId: FixProposalId }
|
|
306
|
-
| {
|
|
307
|
-
readonly kind: 'invalid-transition';
|
|
308
|
-
readonly proposalId: FixProposalId;
|
|
309
|
-
readonly from: FixProposalStatus;
|
|
310
|
-
readonly to: FixProposalStatus;
|
|
311
|
-
}
|
|
312
|
-
| {
|
|
313
|
-
readonly kind: 'ground-layer-violation';
|
|
314
|
-
readonly proposalId: FixProposalId;
|
|
315
|
-
readonly guardrailId: string;
|
|
316
|
-
readonly reason: string;
|
|
317
|
-
}
|
|
318
|
-
| { readonly kind: 'runtime-error'; readonly code: string; readonly message: string };
|
|
319
|
-
|
|
320
|
-
export type SupervisorApplyOutcome =
|
|
321
|
-
| {
|
|
322
|
-
readonly kind: 'ok';
|
|
323
|
-
readonly proposalId: FixProposalId;
|
|
324
|
-
readonly appliedVersion: string;
|
|
325
|
-
readonly appliedAt: Timestamp;
|
|
326
|
-
}
|
|
327
|
-
| { readonly kind: 'not-found'; readonly proposalId: FixProposalId }
|
|
328
|
-
| {
|
|
329
|
-
readonly kind: 'invalid-transition';
|
|
330
|
-
readonly proposalId: FixProposalId;
|
|
331
|
-
readonly from: FixProposalStatus;
|
|
332
|
-
readonly to: FixProposalStatus;
|
|
333
|
-
}
|
|
334
|
-
| { readonly kind: 'runtime-error'; readonly code: string; readonly message: string };
|
|
335
|
-
|
|
336
|
-
export type SupervisorRollbackOutcome =
|
|
337
|
-
| {
|
|
338
|
-
readonly kind: 'ok';
|
|
339
|
-
readonly proposalId: FixProposalId;
|
|
340
|
-
readonly rolledBackAt: Timestamp;
|
|
341
|
-
}
|
|
342
|
-
| { readonly kind: 'not-found'; readonly proposalId: FixProposalId }
|
|
343
|
-
| {
|
|
344
|
-
readonly kind: 'invalid-transition';
|
|
345
|
-
readonly proposalId: FixProposalId;
|
|
346
|
-
readonly from: FixProposalStatus;
|
|
347
|
-
readonly to: FixProposalStatus;
|
|
348
|
-
}
|
|
349
|
-
| { readonly kind: 'runtime-error'; readonly code: string; readonly message: string };
|
|
350
|
-
|
|
351
|
-
export type SupervisorWithdrawOutcome =
|
|
352
|
-
| { readonly kind: 'ok'; readonly proposal: FixProposal }
|
|
353
|
-
| { readonly kind: 'not-found'; readonly proposalId: FixProposalId }
|
|
354
|
-
| {
|
|
355
|
-
readonly kind: 'invalid-transition';
|
|
356
|
-
readonly proposalId: FixProposalId;
|
|
357
|
-
readonly from: FixProposalStatus;
|
|
358
|
-
readonly to: FixProposalStatus;
|
|
359
|
-
}
|
|
360
|
-
| { readonly kind: 'runtime-error'; readonly code: string; readonly message: string };
|
|
361
|
-
|
|
362
258
|
export interface SupervisorObservationPage {
|
|
363
259
|
readonly data: readonly Observation[];
|
|
364
260
|
readonly nextCursor?: Cursor;
|
|
@@ -368,142 +264,6 @@ export type SupervisorQueryObservationsOutcome =
|
|
|
368
264
|
| { readonly kind: 'ok'; readonly page: SupervisorObservationPage }
|
|
369
265
|
| { readonly kind: 'runtime-error'; readonly code: string; readonly message: string };
|
|
370
266
|
|
|
371
|
-
// ============ wire types ============
|
|
372
|
-
//
|
|
373
|
-
// Every field the wire surfaces is declared here, so @kindgi/api does
|
|
374
|
-
// not depend on the supervisor runtime's own types. A binding
|
|
375
|
-
// implementation maps its types into these shapes.
|
|
376
|
-
|
|
377
|
-
/**
|
|
378
|
-
* Lifecycle of a fix proposal.
|
|
379
|
-
*
|
|
380
|
-
* `draft` — initial state after `POST /v1/proposals`.
|
|
381
|
-
* `dry-running` — transient state while a dry-run executes.
|
|
382
|
-
* `dry-run-passed` / `dry-run-failed` — dry-run terminated with a
|
|
383
|
-
* criterion result. `failed` is a legitimate domain outcome, not an
|
|
384
|
-
* error.
|
|
385
|
-
* `proposed-for-review` — submitted for HITL. `reviewApprovalId` is set.
|
|
386
|
-
* `approved` / `rejected` — HITL terminal states.
|
|
387
|
-
* `applied` — the change materialized. `appliedVersion` + `appliedAt` set.
|
|
388
|
-
* `rolled-back` — a prior `applied` proposal was undone.
|
|
389
|
-
* `withdrawn` — the caller withdrew the proposal before terminal review.
|
|
390
|
-
*/
|
|
391
|
-
export type FixProposalStatus =
|
|
392
|
-
| 'draft'
|
|
393
|
-
| 'dry-running'
|
|
394
|
-
| 'dry-run-passed'
|
|
395
|
-
| 'dry-run-failed'
|
|
396
|
-
| 'proposed-for-review'
|
|
397
|
-
| 'approved'
|
|
398
|
-
| 'rejected'
|
|
399
|
-
| 'applied'
|
|
400
|
-
| 'rolled-back'
|
|
401
|
-
| 'withdrawn';
|
|
402
|
-
|
|
403
|
-
/** The aggregated fingerprint kind for a failure pattern. */
|
|
404
|
-
export type PatternKind =
|
|
405
|
-
| 'guardrail-violation'
|
|
406
|
-
| 'tool-error'
|
|
407
|
-
| 'budget-exceeded'
|
|
408
|
-
| 'model-error'
|
|
409
|
-
| 'aborted';
|
|
410
|
-
|
|
411
|
-
/**
|
|
412
|
-
* A change to an agent's prompt (the `instructions` string). Three
|
|
413
|
-
* kinds cover the common shapes. Extensible via the `kind` discriminant.
|
|
414
|
-
*/
|
|
415
|
-
export type PromptChange =
|
|
416
|
-
| { readonly kind: 'append'; readonly text: string }
|
|
417
|
-
| { readonly kind: 'replace-section'; readonly section: string; readonly newText: string }
|
|
418
|
-
| { readonly kind: 'replace'; readonly beforeText: string; readonly afterText: string };
|
|
419
|
-
|
|
420
|
-
/**
|
|
421
|
-
* A retrieval intent — mirror of `Agent.retrieval[]` shape.
|
|
422
|
-
*/
|
|
423
|
-
export interface RetrievalIntentShape {
|
|
424
|
-
readonly types: readonly string[];
|
|
425
|
-
readonly scope: 'same-conversation' | 'same-project' | 'tenant';
|
|
426
|
-
readonly limit?: number;
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
export type RetrievalChange =
|
|
430
|
-
| { readonly kind: 'add-intent'; readonly intent: RetrievalIntentShape }
|
|
431
|
-
| { readonly kind: 'remove-intent'; readonly index: number }
|
|
432
|
-
| {
|
|
433
|
-
readonly kind: 'replace-intent';
|
|
434
|
-
readonly index: number;
|
|
435
|
-
readonly intent: RetrievalIntentShape;
|
|
436
|
-
}
|
|
437
|
-
| { readonly kind: 'update-limit'; readonly index: number; readonly limit: number };
|
|
438
|
-
|
|
439
|
-
export type ToolConfigChange =
|
|
440
|
-
| {
|
|
441
|
-
readonly kind: 'add-tool';
|
|
442
|
-
readonly toolId: string;
|
|
443
|
-
readonly toolVersion: string;
|
|
444
|
-
}
|
|
445
|
-
| { readonly kind: 'remove-tool'; readonly toolId: string }
|
|
446
|
-
| {
|
|
447
|
-
readonly kind: 'set-tools';
|
|
448
|
-
readonly tools: readonly { readonly id: string; readonly version: string }[];
|
|
449
|
-
};
|
|
450
|
-
|
|
451
|
-
/**
|
|
452
|
-
* The change payload — polymorphic over tier.
|
|
453
|
-
*/
|
|
454
|
-
export type ProposedChange =
|
|
455
|
-
| { readonly tier: 'prompt'; readonly change: PromptChange }
|
|
456
|
-
| { readonly tier: 'retrieval'; readonly change: RetrievalChange }
|
|
457
|
-
| { readonly tier: 'tool-config'; readonly change: ToolConfigChange };
|
|
458
|
-
|
|
459
|
-
/**
|
|
460
|
-
* A reference to a failure pattern that motivated a proposal.
|
|
461
|
-
*/
|
|
462
|
-
export interface PatternRef {
|
|
463
|
-
readonly kind: PatternKind;
|
|
464
|
-
readonly key: string;
|
|
465
|
-
readonly count: number;
|
|
466
|
-
readonly firstSeenAt: Timestamp;
|
|
467
|
-
readonly lastSeenAt: Timestamp;
|
|
468
|
-
readonly sampleConversations: readonly RunId[];
|
|
469
|
-
}
|
|
470
|
-
|
|
471
|
-
/**
|
|
472
|
-
* A fix proposal drafted by the supervisor. Every field is declared here
|
|
473
|
-
* so the API package does not depend on the supervisor runtime's types.
|
|
474
|
-
*/
|
|
475
|
-
export interface FixProposal {
|
|
476
|
-
readonly id: FixProposalId;
|
|
477
|
-
readonly tenantId: TenantId;
|
|
478
|
-
readonly supervisorId: SupervisorId;
|
|
479
|
-
readonly agentId: AgentId;
|
|
480
|
-
readonly agentVersion: string;
|
|
481
|
-
readonly tier: ProposedChange['tier'];
|
|
482
|
-
readonly change: ProposedChange['change'];
|
|
483
|
-
readonly patternRefs: readonly PatternRef[];
|
|
484
|
-
readonly hypothesis: string;
|
|
485
|
-
readonly proposerRuleId: string;
|
|
486
|
-
readonly status: FixProposalStatus;
|
|
487
|
-
readonly fingerprint: string;
|
|
488
|
-
readonly resolutionReason?: string;
|
|
489
|
-
readonly reviewApprovalId?: ApprovalId;
|
|
490
|
-
readonly appliedVersion?: string;
|
|
491
|
-
readonly appliedAt?: Timestamp;
|
|
492
|
-
readonly rolledBackAt?: Timestamp;
|
|
493
|
-
readonly createdAt: Timestamp;
|
|
494
|
-
readonly updatedAt: Timestamp;
|
|
495
|
-
readonly resolvedAt?: Timestamp;
|
|
496
|
-
}
|
|
497
|
-
|
|
498
|
-
/** Dry-run pass criterion. */
|
|
499
|
-
export type PassCriterion =
|
|
500
|
-
| { readonly kind: 'min-pass-rate'; readonly minPassRate: number }
|
|
501
|
-
| {
|
|
502
|
-
readonly kind: 'strict-improvement';
|
|
503
|
-
readonly baselinePassRate: number;
|
|
504
|
-
readonly minDelta: number;
|
|
505
|
-
};
|
|
506
|
-
|
|
507
267
|
/**
|
|
508
268
|
* Classified outcome of an observed turn. The observations route
|
|
509
269
|
* validates the query param against this union.
|