@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
package/src/judged-dispatcher.ts
CHANGED
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
*
|
|
11
11
|
* Per case: the replay runs, the items kept, dropped and new (new ones
|
|
12
12
|
* for experts to judge), the tool calls and what happened to each, and
|
|
13
|
-
* whether the replay diverged (a read
|
|
14
|
-
*
|
|
13
|
+
* whether the replay diverged (a read ran live under `reads: 'recorded'`,
|
|
14
|
+
* other than a recomputed one). The summary (`JudgedComparisonSummary`) is what a
|
|
15
15
|
* promotion gate reads.
|
|
16
16
|
*/
|
|
17
17
|
|
|
@@ -21,13 +21,20 @@ import type { RunId } from '@kindgi/types';
|
|
|
21
21
|
|
|
22
22
|
import type { AgentRegistryBinding } from './agent-binding.js';
|
|
23
23
|
import type { EvalCaseStoreBinding, JudgedEvalCase } from './eval-case-binding.js';
|
|
24
|
-
import type {
|
|
24
|
+
import type {
|
|
25
|
+
AgentRef,
|
|
26
|
+
EvalClassWeights,
|
|
27
|
+
EvalComparison,
|
|
28
|
+
EvalSample,
|
|
29
|
+
FlowRef,
|
|
30
|
+
} from './eval-run-binding.js';
|
|
25
31
|
import type {
|
|
26
32
|
DispatchContext,
|
|
27
33
|
DispatchResult,
|
|
28
34
|
EvalRunDispatcher,
|
|
29
35
|
EvalRunSubjectInvokeOutcome,
|
|
30
36
|
} from './eval-run-dispatcher.js';
|
|
37
|
+
import { sampleCases } from './eval-sample.js';
|
|
31
38
|
import {
|
|
32
39
|
type ItemChanges,
|
|
33
40
|
type OutputScore,
|
|
@@ -92,6 +99,15 @@ export type ComparisonCandidate =
|
|
|
92
99
|
* without an agent registry.
|
|
93
100
|
*/
|
|
94
101
|
readonly pinsDigest?: string;
|
|
102
|
+
/**
|
|
103
|
+
* The blocks whose content the replays replaced
|
|
104
|
+
* (`comparison.overrides`): it ran no published version, so it
|
|
105
|
+
* can't gate a promotion.
|
|
106
|
+
*/
|
|
107
|
+
readonly overrides?: {
|
|
108
|
+
readonly settings?: readonly string[];
|
|
109
|
+
readonly prompts?: readonly string[];
|
|
110
|
+
};
|
|
95
111
|
}
|
|
96
112
|
| {
|
|
97
113
|
readonly kind: 'flow';
|
|
@@ -112,7 +128,11 @@ export interface JudgedComparisonSummary {
|
|
|
112
128
|
/** Where the test set's judgments came from. */
|
|
113
129
|
readonly scope: { readonly projectId?: string };
|
|
114
130
|
readonly cases: number;
|
|
115
|
-
/**
|
|
131
|
+
/**
|
|
132
|
+
* Cases where a read ran live under `reads: 'recorded'`: one with no
|
|
133
|
+
* recording, or one re-run because the candidate pins other settings
|
|
134
|
+
* that reads from somewhere. A recomputed call (reads from nowhere) isn't.
|
|
135
|
+
*/
|
|
116
136
|
readonly diverged: number;
|
|
117
137
|
/** Tool calls refused across the cases (what the candidate would have done). */
|
|
118
138
|
readonly refusedWrites: number;
|
|
@@ -123,6 +143,11 @@ export interface JudgedComparisonSummary {
|
|
|
123
143
|
* refused): no output to score, so they're left out of the metrics.
|
|
124
144
|
*/
|
|
125
145
|
readonly stopped: number;
|
|
146
|
+
/**
|
|
147
|
+
* Cases an erasure cleared (a person's words were erased): left out of
|
|
148
|
+
* the run and the metrics. Absent: none.
|
|
149
|
+
*/
|
|
150
|
+
readonly erased?: number;
|
|
126
151
|
readonly reads: EvalComparison['reads'];
|
|
127
152
|
/**
|
|
128
153
|
* Which judgments counted: `restricted-only` weighs a judgment not
|
|
@@ -130,6 +155,8 @@ export interface JudgedComparisonSummary {
|
|
|
130
155
|
* from a summary recorded before T200: `as-recorded`.
|
|
131
156
|
*/
|
|
132
157
|
readonly classWeights?: EvalClassWeights;
|
|
158
|
+
/** The part of the test set it ran (absent: every case). */
|
|
159
|
+
readonly sample?: EvalSample;
|
|
133
160
|
/** The models that answered the candidate's replays, and how many replays each. */
|
|
134
161
|
readonly sampling: {
|
|
135
162
|
readonly models: readonly {
|
|
@@ -176,6 +203,9 @@ export interface JudgedDispatcherOptions {
|
|
|
176
203
|
/** Cases read per page. */
|
|
177
204
|
const CASE_PAGE = 100;
|
|
178
205
|
|
|
206
|
+
export const OVERRIDES_NEED_AN_AGENT =
|
|
207
|
+
"`overrides` replaces an agent version's block content: it needs `agentRef`.";
|
|
208
|
+
|
|
179
209
|
export const VERSIONS_NEED_A_FLOW =
|
|
180
210
|
'`versions` runs a flow with some of its agents or tools at other versions: it needs `flowRef`.';
|
|
181
211
|
|
|
@@ -200,6 +230,9 @@ function validateComparison(
|
|
|
200
230
|
if (c.versions !== undefined && 'agentId' in target) {
|
|
201
231
|
return { kind: 'err', message: VERSIONS_NEED_A_FLOW };
|
|
202
232
|
}
|
|
233
|
+
if (c.overrides !== undefined && !('agentId' in target)) {
|
|
234
|
+
return { kind: 'err', message: OVERRIDES_NEED_AN_AGENT };
|
|
235
|
+
}
|
|
203
236
|
if (c.baseline !== 'recorded') {
|
|
204
237
|
return { kind: 'err', message: "Only `baseline: 'recorded'` runs today." };
|
|
205
238
|
}
|
|
@@ -212,22 +245,41 @@ export function createJudgedDispatcher(options: JudgedDispatcherOptions): EvalRu
|
|
|
212
245
|
validate: validateComparison,
|
|
213
246
|
async dispatch(ctx): Promise<DispatchResult> {
|
|
214
247
|
const comparison = ctx.comparison ?? DEFAULT_COMPARISON;
|
|
215
|
-
const
|
|
248
|
+
const listed = await allCases(options.cases, ctx);
|
|
249
|
+
// An erased case has nothing left to replay: left out, and counted.
|
|
250
|
+
// A sample is drawn from the rest.
|
|
251
|
+
const replayable = listed.filter((c) => c.erased !== true);
|
|
252
|
+
const erased = listed.length - replayable.length;
|
|
253
|
+
const stored =
|
|
254
|
+
comparison.sample === undefined ? replayable : sampleCases(replayable, comparison.sample);
|
|
216
255
|
const all =
|
|
217
256
|
comparison.classWeights === 'restricted-only' ? stored.map(restrictedOnly) : stored;
|
|
218
257
|
if (ctx.dryRun) {
|
|
219
|
-
return {
|
|
258
|
+
return {
|
|
259
|
+
result: { dryRun: true, cases: all.length, ...(erased > 0 && { erased }), comparison },
|
|
260
|
+
};
|
|
220
261
|
}
|
|
221
262
|
const results: JudgedCaseResult[] = [];
|
|
222
263
|
const models = new Map<string, { providerId: string; model: string; runs: number }>();
|
|
264
|
+
// Erased after they were listed: the replay was refused (`run-erased`).
|
|
265
|
+
const erasedLate = new Set<string>();
|
|
223
266
|
for (const judgedCase of all) {
|
|
224
267
|
if (ctx.abortSignal.aborted) break;
|
|
225
268
|
const result = await runCase(ctx, comparison, judgedCase, models);
|
|
269
|
+
if (result === 'erased') {
|
|
270
|
+
erasedLate.add(judgedCase.caseId);
|
|
271
|
+
continue;
|
|
272
|
+
}
|
|
226
273
|
results.push(result);
|
|
227
274
|
ctx.onProgress(result as unknown as Readonly<Record<string, unknown>>);
|
|
228
275
|
}
|
|
229
276
|
const pinsDigest = await candidatePins(options.agents, ctx);
|
|
230
|
-
const
|
|
277
|
+
const ran = all.filter((c) => !erasedLate.has(c.caseId));
|
|
278
|
+
const erasedAll = erased + erasedLate.size;
|
|
279
|
+
const summary = {
|
|
280
|
+
...summarize(ctx, comparison, ran, results, [...models.values()], pinsDigest),
|
|
281
|
+
...(erasedAll > 0 && { erased: erasedAll }),
|
|
282
|
+
};
|
|
231
283
|
return {
|
|
232
284
|
result: { summary, perCase: results },
|
|
233
285
|
...(ctx.abortSignal.aborted && { error: 'cancelled' }),
|
|
@@ -299,7 +351,11 @@ class CaseTally {
|
|
|
299
351
|
this.candidate.push(scoreItems(matched, comparison.k));
|
|
300
352
|
const tools = outcome.replay?.tools ?? [];
|
|
301
353
|
this.refusedWrites = Math.max(this.refusedWrites, refusedCount(outcome));
|
|
302
|
-
|
|
354
|
+
// A recomputed call read nothing new: only a live read diverges.
|
|
355
|
+
if (
|
|
356
|
+
comparison.reads === 'recorded' &&
|
|
357
|
+
tools.some((t) => t.source === 'live' && t.recomputed !== true)
|
|
358
|
+
) {
|
|
303
359
|
this.diverged = true;
|
|
304
360
|
}
|
|
305
361
|
if (outcome.replay?.approval === 'skipped') this.approvalSkipped = true;
|
|
@@ -331,7 +387,7 @@ async function runCase(
|
|
|
331
387
|
comparison: EvalComparison,
|
|
332
388
|
judgedCase: JudgedEvalCase,
|
|
333
389
|
models: Map<string, { providerId: string; model: string; runs: number }>,
|
|
334
|
-
): Promise<JudgedCaseResult> {
|
|
390
|
+
): Promise<JudgedCaseResult | 'erased'> {
|
|
335
391
|
// An agent turn's items are its answer and typed result; a flow run's, its whole output.
|
|
336
392
|
const agentTurn = judgedCase.subject.kind === 'agent';
|
|
337
393
|
const baseline = scoreItems(
|
|
@@ -341,6 +397,8 @@ async function runCase(
|
|
|
341
397
|
const tally = new CaseTally(judgedCase, comparison, agentTurn);
|
|
342
398
|
for (let rep = 0; rep < comparison.repetitions; rep++) {
|
|
343
399
|
const outcome = await invokeCase(ctx, judgedCase);
|
|
400
|
+
// Its past run was erased meanwhile: nothing left to replay.
|
|
401
|
+
if (outcome.erased === true) return 'erased';
|
|
344
402
|
if (tally.add(outcome) === 'ran') countModel(models, outcome);
|
|
345
403
|
}
|
|
346
404
|
return tally.result(baseline);
|
|
@@ -505,7 +563,7 @@ function summarize(
|
|
|
505
563
|
: 'failed',
|
|
506
564
|
completedAt: new Date().toISOString(),
|
|
507
565
|
suite: { id: ctx.suite.id, version: ctx.suite.version },
|
|
508
|
-
candidate: candidateOf(ctx.target, ctx.comparison
|
|
566
|
+
candidate: candidateOf(ctx.target, ctx.comparison, pinsDigest),
|
|
509
567
|
baseline: {
|
|
510
568
|
kind: 'recorded',
|
|
511
569
|
versions: [...versions.values()].map(
|
|
@@ -523,6 +581,7 @@ function summarize(
|
|
|
523
581
|
stopped,
|
|
524
582
|
reads: comparison.reads,
|
|
525
583
|
classWeights: comparison.classWeights ?? 'as-recorded',
|
|
584
|
+
...(comparison.sample !== undefined && { sample: comparison.sample }),
|
|
526
585
|
sampling: { models },
|
|
527
586
|
repetitions: comparison.repetitions,
|
|
528
587
|
metrics: {
|
|
@@ -579,15 +638,23 @@ async function candidatePins(
|
|
|
579
638
|
|
|
580
639
|
function candidateOf(
|
|
581
640
|
target: AgentRef | FlowRef,
|
|
582
|
-
|
|
641
|
+
comparison: EvalComparison | undefined,
|
|
583
642
|
pinsDigest?: string,
|
|
584
643
|
): ComparisonCandidate {
|
|
644
|
+
const versions = comparison?.versions;
|
|
645
|
+
const settings = Object.keys(comparison?.overrides?.settings ?? {}).sort();
|
|
646
|
+
const prompts = Object.keys(comparison?.overrides?.prompts ?? {}).sort();
|
|
647
|
+
const overrides = {
|
|
648
|
+
...(settings.length > 0 && { settings }),
|
|
649
|
+
...(prompts.length > 0 && { prompts }),
|
|
650
|
+
};
|
|
585
651
|
return 'agentId' in target
|
|
586
652
|
? {
|
|
587
653
|
kind: 'agent',
|
|
588
654
|
agentId: target.agentId as unknown as string,
|
|
589
655
|
version: target.version ?? '',
|
|
590
656
|
...(pinsDigest !== undefined && { pinsDigest }),
|
|
657
|
+
...(Object.keys(overrides).length > 0 && { overrides }),
|
|
591
658
|
}
|
|
592
659
|
: {
|
|
593
660
|
kind: 'flow',
|
package/src/judgment-binding.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright (C) 2026 Kindgi Inc.
|
|
3
3
|
|
|
4
4
|
import { REVIEWER_ROLE_RANK, type ReviewerRole } from '@kindgi/authz';
|
|
5
|
-
import type { Cursor, ListScope, ProjectId, TenantId } from '@kindgi/types';
|
|
5
|
+
import type { Cursor, ListScope, ProjectId, ScopeSegment, TenantId } from '@kindgi/types';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Caller-plugged surface for judgments: a person says yes or no, with an
|
|
@@ -272,6 +272,8 @@ export interface JudgedRunContext {
|
|
|
272
272
|
readonly historyTruncated?: boolean;
|
|
273
273
|
/** What the turn's retrievals returned. */
|
|
274
274
|
readonly retrieved?: unknown;
|
|
275
|
+
/** Messages of earlier conversations the turn recalled. A replay of the turn reuses them. */
|
|
276
|
+
readonly recalled?: unknown;
|
|
275
277
|
/**
|
|
276
278
|
* The reviewer's decision at the turn's session approval gate, when the
|
|
277
279
|
* turn waited on one. A replay of the turn follows it.
|
|
@@ -279,6 +281,13 @@ export interface JudgedRunContext {
|
|
|
279
281
|
readonly sessionApproval?: { readonly approved: boolean; readonly rationale?: string };
|
|
280
282
|
/** For a flow run: what it did (see `JudgedFlowContext`). */
|
|
281
283
|
readonly flow?: JudgedFlowContext;
|
|
284
|
+
/**
|
|
285
|
+
* The env values each tool's calls were sent (`needsSpec.env`), by tool
|
|
286
|
+
* id: its first call's, as the run recorded them. A replay sends them to
|
|
287
|
+
* a read-only tool it runs live, so the tool reads the config the run
|
|
288
|
+
* saw, not today's. Absent for a run from before env was recorded.
|
|
289
|
+
*/
|
|
290
|
+
readonly toolEnv?: Readonly<Record<string, Readonly<Record<string, string>>>>;
|
|
282
291
|
}
|
|
283
292
|
|
|
284
293
|
/** One tool call a judged run made, and its result. */
|
|
@@ -303,6 +312,8 @@ export interface JudgedFlowStep {
|
|
|
303
312
|
readonly agentVersion: string;
|
|
304
313
|
/** What the turn's retrievals returned. */
|
|
305
314
|
readonly retrieved?: unknown;
|
|
315
|
+
/** Messages of earlier conversations the turn recalled. */
|
|
316
|
+
readonly recalled?: unknown;
|
|
306
317
|
}
|
|
307
318
|
|
|
308
319
|
/**
|
|
@@ -325,6 +336,11 @@ export interface JudgedRunCopy {
|
|
|
325
336
|
readonly output: unknown;
|
|
326
337
|
/** Absent for runs judged before context was captured, and for flow runs. */
|
|
327
338
|
readonly context?: JudgedRunContext;
|
|
339
|
+
/**
|
|
340
|
+
* The segment path the run was started with (empty: none). Absent for
|
|
341
|
+
* runs judged before it was captured: such a run belongs to no segment.
|
|
342
|
+
*/
|
|
343
|
+
readonly segments?: readonly ScopeSegment[];
|
|
328
344
|
readonly capturedAt: string;
|
|
329
345
|
}
|
|
330
346
|
|
|
@@ -345,6 +361,8 @@ export interface JudgmentRecordInput {
|
|
|
345
361
|
readonly input: unknown;
|
|
346
362
|
readonly output: unknown;
|
|
347
363
|
readonly context?: JudgedRunContext;
|
|
364
|
+
/** The segment path the run was started with (empty: none). */
|
|
365
|
+
readonly segments?: readonly ScopeSegment[];
|
|
348
366
|
};
|
|
349
367
|
readonly item: JudgedItem;
|
|
350
368
|
/** The item's value at `item.pointer`, resolved by the route from the run's output. */
|
|
@@ -393,6 +411,12 @@ export interface JudgedRunListInput {
|
|
|
393
411
|
readonly since?: string;
|
|
394
412
|
/** Runs first judged before this time (ISO 8601). */
|
|
395
413
|
readonly until?: string;
|
|
414
|
+
/**
|
|
415
|
+
* Runs started in this segment path or below it (their captured
|
|
416
|
+
* `segments` start with it). A run judged before segments were captured
|
|
417
|
+
* is in none.
|
|
418
|
+
*/
|
|
419
|
+
readonly segments?: readonly ScopeSegment[];
|
|
396
420
|
readonly cursor?: Cursor;
|
|
397
421
|
readonly limit: number;
|
|
398
422
|
}
|
|
@@ -126,6 +126,13 @@ export interface MCPEndpoint {
|
|
|
126
126
|
readonly instructions?: string;
|
|
127
127
|
/** Optional caller-defined metadata bag. */
|
|
128
128
|
readonly metadata?: Readonly<Record<string, unknown>>;
|
|
129
|
+
/**
|
|
130
|
+
* Whether the runtime sends the W3C `traceparent` of the run calling a
|
|
131
|
+
* tool to this endpoint (as a request header; ids only, never content),
|
|
132
|
+
* so the server's logs can be matched to the run. Opt-in: absent or
|
|
133
|
+
* `false` sends none. HTTP transports only (`stdio` has no headers).
|
|
134
|
+
*/
|
|
135
|
+
readonly sendTraceparent?: boolean;
|
|
129
136
|
}
|
|
130
137
|
|
|
131
138
|
export interface MCPEndpointListInput {
|
package/src/memory-binding.ts
CHANGED
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
2
2
|
// Copyright (C) 2026 Kindgi Inc.
|
|
3
3
|
|
|
4
|
-
import type {
|
|
4
|
+
import type {
|
|
5
|
+
Fact,
|
|
6
|
+
FactAttribution,
|
|
7
|
+
FactSubject,
|
|
8
|
+
MemoryReaders,
|
|
9
|
+
MemoryScope,
|
|
10
|
+
Retention,
|
|
11
|
+
} from '@kindgi/memory';
|
|
5
12
|
import type { Scope as PlatformScope } from '@kindgi/platform';
|
|
6
|
-
import type { Cursor, FactId, TenantId } from '@kindgi/types';
|
|
13
|
+
import type { Cursor, FactId, TenantId, Timestamp } from '@kindgi/types';
|
|
7
14
|
|
|
8
15
|
/**
|
|
9
16
|
* Caller-plugged surface for the memory resource. Same shape as
|
|
@@ -21,12 +28,36 @@ import type { Cursor, FactId, TenantId } from '@kindgi/types';
|
|
|
21
28
|
* ISO timestamp, `id@version`, whatever). The API layer only validates
|
|
22
29
|
* that a cursor round-trips as a string; it never inspects the payload.
|
|
23
30
|
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
31
|
+
* A fact keeps its id across revisions. `supersedeFact` writes the next
|
|
32
|
+
* revision and closes the current one; `deleteFact` tombstones the fact
|
|
33
|
+
* (the retention sweep removes it later); `verifyFact` writes a revision
|
|
34
|
+
* marked verified. Reads see each fact's current revision unless they
|
|
35
|
+
* ask for history (`asOf`, `listRevisions`).
|
|
36
|
+
*
|
|
37
|
+
* Every read and write names what the caller may see (`readers`), worked
|
|
38
|
+
* out by the route from the principal: the binding applies it inside its
|
|
39
|
+
* query, before any limit, and treats what it can't see as not found.
|
|
28
40
|
*/
|
|
29
41
|
export interface MemoryBinding {
|
|
42
|
+
/**
|
|
43
|
+
* Whether this memory can search by meaning (an embedding model is
|
|
44
|
+
* configured). Absent: unknown. When `false`, publishing an agent whose
|
|
45
|
+
* retrieval searches by meaning warns, and a semantic retrieval answers
|
|
46
|
+
* `422 semantic-unavailable`.
|
|
47
|
+
*/
|
|
48
|
+
readonly semanticSearch?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Whether agent turns can store what an agent remembers (an agent's
|
|
51
|
+
* `memory.remember`). Absent: unknown. When `false`, publishing an agent
|
|
52
|
+
* that remembers warns `remember-unavailable`.
|
|
53
|
+
*/
|
|
54
|
+
readonly agentRemember?: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Whether agent turns can recall earlier conversations (an intent with
|
|
57
|
+
* `source: 'conversations'`). Absent: unknown. When `false`, publishing
|
|
58
|
+
* such an agent warns `recall-unavailable`.
|
|
59
|
+
*/
|
|
60
|
+
readonly conversationRecall?: boolean;
|
|
30
61
|
/**
|
|
31
62
|
* Cursor-paginated list of facts under the tenant. Filters:
|
|
32
63
|
* - `type` — exact fact-type match.
|
|
@@ -37,10 +68,9 @@ export interface MemoryBinding {
|
|
|
37
68
|
*/
|
|
38
69
|
listFacts(input: MemoryListFactsInput): Promise<MemoryFactPage>;
|
|
39
70
|
/**
|
|
40
|
-
* The fact with the given id, or
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
* The route surfaces `null` as `404 fact-not-found`.
|
|
71
|
+
* The fact with the given id: its current revision, or the one at
|
|
72
|
+
* `version`, or the one current at `asOf`; `null` when there's none
|
|
73
|
+
* the caller may see. The route surfaces `null` as `404 fact-not-found`.
|
|
44
74
|
*/
|
|
45
75
|
getFact(input: MemoryGetFactInput): Promise<Fact | null>;
|
|
46
76
|
/**
|
|
@@ -54,13 +84,29 @@ export interface MemoryBinding {
|
|
|
54
84
|
*/
|
|
55
85
|
writeFact(input: MemoryWriteFactInput): Promise<MemoryWriteFactOutcome>;
|
|
56
86
|
/**
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
* returns `{ superseded: false }` and the route flips that to `404`.
|
|
87
|
+
* Write the fact's next revision (new content, the same id) and close
|
|
88
|
+
* the current one, atomically. With `expectVersion`, only when that is
|
|
89
|
+
* still the current revision (`fact-changed` otherwise). Legal hold
|
|
90
|
+
* refuses it.
|
|
62
91
|
*/
|
|
63
92
|
supersedeFact(input: MemorySupersedeFactInput): Promise<MemorySupersedeFactOutcome>;
|
|
93
|
+
/**
|
|
94
|
+
* Tombstone the fact: its current revision is closed as `deleted`, and
|
|
95
|
+
* reads no longer see it (history still does, until the retention sweep
|
|
96
|
+
* removes it). Legal hold refuses it. Optional: without it, the route
|
|
97
|
+
* answers `501 memory-operation-unsupported`.
|
|
98
|
+
*/
|
|
99
|
+
deleteFact?(input: MemoryDeleteFactInput): Promise<MemoryFactChangeOutcome>;
|
|
100
|
+
/**
|
|
101
|
+
* Mark the fact verified: a revision with the same content and
|
|
102
|
+
* `trust: verified`, by the caller. Optional (`501` without it).
|
|
103
|
+
*/
|
|
104
|
+
verifyFact?(input: MemoryVerifyFactInput): Promise<MemoryFactChangeOutcome>;
|
|
105
|
+
/**
|
|
106
|
+
* Every revision of the fact, newest first; `null` when there's none
|
|
107
|
+
* the caller may see. Optional (`501` without it).
|
|
108
|
+
*/
|
|
109
|
+
listRevisions?(input: MemoryGetFactInput): Promise<readonly Fact[] | null>;
|
|
64
110
|
/**
|
|
65
111
|
* Cross-history retrieval. The `intent` mirrors the shape agents use
|
|
66
112
|
* for declarative retrieval (`packages/agents/src/retrieval.ts`):
|
|
@@ -83,6 +129,10 @@ export interface MemoryBinding {
|
|
|
83
129
|
|
|
84
130
|
export interface MemoryListFactsInput {
|
|
85
131
|
readonly tenantId: TenantId;
|
|
132
|
+
/** What the caller may see: applied in the query, before the limit. */
|
|
133
|
+
readonly readers: MemoryReaders;
|
|
134
|
+
/** Each fact's revision current at this time, instead of now. */
|
|
135
|
+
readonly asOf?: Timestamp;
|
|
86
136
|
readonly limit: number;
|
|
87
137
|
readonly cursor?: Cursor;
|
|
88
138
|
/** Exact match on `Fact.type`. Undefined = no type filter. */
|
|
@@ -133,6 +183,11 @@ export interface MemoryFactPage {
|
|
|
133
183
|
export interface MemoryGetFactInput {
|
|
134
184
|
readonly tenantId: TenantId;
|
|
135
185
|
readonly factId: FactId;
|
|
186
|
+
readonly readers: MemoryReaders;
|
|
187
|
+
/** A given revision. */
|
|
188
|
+
readonly version?: number;
|
|
189
|
+
/** The revision current at this time. */
|
|
190
|
+
readonly asOf?: Timestamp;
|
|
136
191
|
}
|
|
137
192
|
|
|
138
193
|
// -------------------- write --------------------
|
|
@@ -150,6 +205,12 @@ export interface MemoryWriteFactInput {
|
|
|
150
205
|
readonly content: unknown;
|
|
151
206
|
readonly retention?: Retention;
|
|
152
207
|
readonly contentHash?: string;
|
|
208
|
+
/** Who writes it: set by the route from the principal, never from the body. */
|
|
209
|
+
readonly attributedTo?: FactAttribution;
|
|
210
|
+
readonly subjects?: readonly FactSubject[];
|
|
211
|
+
readonly validFrom?: Timestamp;
|
|
212
|
+
readonly validUntil?: Timestamp;
|
|
213
|
+
readonly observedAt?: Timestamp;
|
|
153
214
|
}
|
|
154
215
|
|
|
155
216
|
export type MemoryWriteFactOutcome =
|
|
@@ -178,12 +239,53 @@ export type MemoryWriteFactOutcome =
|
|
|
178
239
|
export interface MemorySupersedeFactInput {
|
|
179
240
|
readonly tenantId: TenantId;
|
|
180
241
|
readonly factId: FactId;
|
|
242
|
+
readonly readers: MemoryReaders;
|
|
243
|
+
/**
|
|
244
|
+
* The next revision's content; the fact's type and scope stay, and the
|
|
245
|
+
* fields below keep the current revision's values when absent.
|
|
246
|
+
*/
|
|
247
|
+
readonly content: unknown;
|
|
248
|
+
readonly retention?: Retention;
|
|
249
|
+
readonly subjects?: readonly FactSubject[];
|
|
250
|
+
readonly validFrom?: Timestamp;
|
|
251
|
+
readonly validUntil?: Timestamp;
|
|
252
|
+
readonly observedAt?: Timestamp;
|
|
253
|
+
/** Only when this is still the current revision. */
|
|
254
|
+
readonly expectVersion?: number;
|
|
255
|
+
readonly attributedTo?: FactAttribution;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
export type MemorySupersedeFactOutcome = MemoryFactChangeOutcome;
|
|
259
|
+
|
|
260
|
+
export interface MemoryDeleteFactInput {
|
|
261
|
+
readonly tenantId: TenantId;
|
|
262
|
+
readonly factId: FactId;
|
|
263
|
+
readonly readers: MemoryReaders;
|
|
264
|
+
/** `user:<id>` or `service:<id>`. */
|
|
265
|
+
readonly by: string;
|
|
266
|
+
readonly expectVersion?: number;
|
|
181
267
|
}
|
|
182
268
|
|
|
183
|
-
export interface
|
|
184
|
-
readonly
|
|
269
|
+
export interface MemoryVerifyFactInput {
|
|
270
|
+
readonly tenantId: TenantId;
|
|
271
|
+
readonly factId: FactId;
|
|
272
|
+
readonly readers: MemoryReaders;
|
|
273
|
+
/** `user:<id>` or `service:<id>`. */
|
|
274
|
+
readonly by: string;
|
|
275
|
+
readonly expectVersion?: number;
|
|
185
276
|
}
|
|
186
277
|
|
|
278
|
+
/** What changing a fact (supersede, delete, verify) came to. */
|
|
279
|
+
export type MemoryFactChangeOutcome =
|
|
280
|
+
/** The fact's revision now current (for a delete: the tombstoned one). */
|
|
281
|
+
| { readonly kind: 'ok'; readonly fact: Fact }
|
|
282
|
+
| { readonly kind: 'not-found' }
|
|
283
|
+
/** `expectVersion` isn't the current revision any more. */
|
|
284
|
+
| { readonly kind: 'fact-changed'; readonly current: Fact }
|
|
285
|
+
/** The fact is under legal hold. */
|
|
286
|
+
| { readonly kind: 'legal-hold'; readonly message: string }
|
|
287
|
+
| { readonly kind: 'error'; readonly code: string; readonly message: string };
|
|
288
|
+
|
|
187
289
|
// -------------------- retrieve --------------------
|
|
188
290
|
|
|
189
291
|
/**
|
|
@@ -215,6 +317,8 @@ export interface MemoryRetrieveIntent {
|
|
|
215
317
|
export interface MemoryRetrieveInput {
|
|
216
318
|
readonly tenantId: TenantId;
|
|
217
319
|
readonly intent: MemoryRetrieveIntent;
|
|
320
|
+
/** What the caller may see: applied in the query, before any limit. */
|
|
321
|
+
readonly readers: MemoryReaders;
|
|
218
322
|
}
|
|
219
323
|
|
|
220
324
|
export interface MemoryRetrievalHit {
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
// Copyright (C) 2026 Kindgi Inc.
|
|
3
|
+
|
|
4
|
+
import type { TenantId } from '@kindgi/types';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Caller-plugged surface for erasing a person's words
|
|
8
|
+
* (`/v1/memory/erasures`). The API package validates, authorizes (a
|
|
9
|
+
* tenant admin only) and shapes the wire; the binding runs the erasure:
|
|
10
|
+
* memory facts, conversations, the runs that served them, and what they
|
|
11
|
+
* left in provenance, as the deployment's runtime knows its stores. An
|
|
12
|
+
* erasure runs in the background; `create` answers once it's recorded.
|
|
13
|
+
*
|
|
14
|
+
* A completed erasure keeps no identifier: what's left is its ledger row
|
|
15
|
+
* (the selector's kind, a keyed hash of it, who, when, how much), which
|
|
16
|
+
* an operator exports off-box and replays after restoring a backup.
|
|
17
|
+
*/
|
|
18
|
+
export interface MemoryErasureBinding {
|
|
19
|
+
create(input: {
|
|
20
|
+
readonly tenantId: TenantId;
|
|
21
|
+
readonly selector: MemoryErasureSelector;
|
|
22
|
+
/** `user:<id>` or `service:<id>`: who asked. */
|
|
23
|
+
readonly requestedBy: string;
|
|
24
|
+
}): Promise<CreateMemoryErasureOutcome>;
|
|
25
|
+
get(tenantId: TenantId, id: string): Promise<MemoryErasure | undefined>;
|
|
26
|
+
/** Newest first. `undefined` when the cursor isn't one this binding issued. */
|
|
27
|
+
list(
|
|
28
|
+
tenantId: TenantId,
|
|
29
|
+
page: { readonly limit: number; readonly cursor?: string },
|
|
30
|
+
): Promise<{ readonly data: readonly MemoryErasure[]; readonly nextCursor?: string } | undefined>;
|
|
31
|
+
/** The whole ledger, content-free, oldest first. */
|
|
32
|
+
exportLedger(tenantId: TenantId): Promise<readonly MemoryErasureLedgerEntry[]>;
|
|
33
|
+
/**
|
|
34
|
+
* Try an unfinished erasure again now; with `force`, stop waiting for a
|
|
35
|
+
* run in a flow that serves other people (it's cancelled). A finished
|
|
36
|
+
* one comes back as it is; `undefined` when there's no such erasure.
|
|
37
|
+
*/
|
|
38
|
+
resume(
|
|
39
|
+
tenantId: TenantId,
|
|
40
|
+
id: string,
|
|
41
|
+
options: { readonly force?: boolean },
|
|
42
|
+
): Promise<MemoryErasure | undefined>;
|
|
43
|
+
/** After a backup restore: restore the ledger and run its erasures again. */
|
|
44
|
+
replay(
|
|
45
|
+
tenantId: TenantId,
|
|
46
|
+
entries: readonly MemoryErasureLedgerEntry[],
|
|
47
|
+
): Promise<ReplayMemoryErasuresResult>;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Whose words to erase: one fact, a person (an app's end user
|
|
52
|
+
* `participant`, or an `external` subject facts name), or one
|
|
53
|
+
* conversation. Erasing a Kindgi user isn't offered.
|
|
54
|
+
*/
|
|
55
|
+
export type MemoryErasureSelector =
|
|
56
|
+
| { readonly factId: string }
|
|
57
|
+
| {
|
|
58
|
+
readonly subject: {
|
|
59
|
+
readonly kind: 'participant' | 'external';
|
|
60
|
+
readonly id: string;
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
| { readonly conversationId: string };
|
|
64
|
+
|
|
65
|
+
export type MemoryErasureSelectorKind = 'fact' | 'participant' | 'external' | 'conversation';
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* `waiting-on-run`: a turn of the person's sits in a flow that serves
|
|
69
|
+
* other people; the erasure waits for it (`waitingOn`) until its
|
|
70
|
+
* deadline, then cancels it. `resume` with `force` stops the wait.
|
|
71
|
+
*/
|
|
72
|
+
export type MemoryErasureStatus = 'pending' | 'running' | 'waiting-on-run' | 'completed' | 'failed';
|
|
73
|
+
|
|
74
|
+
export interface MemoryErasure {
|
|
75
|
+
readonly id: string;
|
|
76
|
+
readonly selectorKind: MemoryErasureSelectorKind;
|
|
77
|
+
/** Only while it runs: a completed or failed erasure keeps no identifier. */
|
|
78
|
+
readonly selector?: MemoryErasureSelector;
|
|
79
|
+
readonly status: MemoryErasureStatus;
|
|
80
|
+
/**
|
|
81
|
+
* Where a running erasure is: `seed`, `expand`, `settle` (the person's
|
|
82
|
+
* unfinished runs end, or it waits for them, before anything is
|
|
83
|
+
* cleared), `erase`, then `done`.
|
|
84
|
+
*/
|
|
85
|
+
readonly phase: 'seed' | 'expand' | 'settle' | 'erase' | 'done';
|
|
86
|
+
readonly requestedBy: string;
|
|
87
|
+
/** A replay after a backup restore can find this person again (a keyed hash was kept). */
|
|
88
|
+
readonly matchable: boolean;
|
|
89
|
+
/** What each store cleared or deleted, by store. */
|
|
90
|
+
readonly counts: Readonly<Record<string, number>>;
|
|
91
|
+
/** Failed attempts so far. */
|
|
92
|
+
readonly attempts: number;
|
|
93
|
+
/** The last failure's code, or why it's waiting (`not-yet:<reason>`). Never content. */
|
|
94
|
+
readonly lastError?: string;
|
|
95
|
+
/** The run it waits (or waited) for, and until when; kept as the record of the wait. */
|
|
96
|
+
readonly waitingOn?: { readonly runId: string; readonly until?: string };
|
|
97
|
+
/** A tenant admin said not to wait. */
|
|
98
|
+
readonly forced?: true;
|
|
99
|
+
/**
|
|
100
|
+
* Runs of the person's kept appearing, round after round: the erasure
|
|
101
|
+
* went on to erase after its last round rather than wait any longer.
|
|
102
|
+
*/
|
|
103
|
+
readonly settleRoundsCapped?: true;
|
|
104
|
+
readonly createdAt: string;
|
|
105
|
+
readonly startedAt?: string;
|
|
106
|
+
readonly completedAt?: string;
|
|
107
|
+
readonly replayedAt?: string;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/** One ledger row, as exported off-box and given back to a replay. Content-free. */
|
|
111
|
+
export interface MemoryErasureLedgerEntry {
|
|
112
|
+
readonly id: string;
|
|
113
|
+
readonly selectorKind: MemoryErasureSelectorKind;
|
|
114
|
+
/** HMAC-SHA256 (hex) of the selector under the tenant's ledger key; absent without one. */
|
|
115
|
+
readonly selectorHmac?: string;
|
|
116
|
+
/** Which ledger key made `selectorHmac`. */
|
|
117
|
+
readonly keyId?: string;
|
|
118
|
+
readonly requestedBy: string;
|
|
119
|
+
readonly status: MemoryErasureStatus;
|
|
120
|
+
readonly createdAt: string;
|
|
121
|
+
readonly completedAt?: string;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export interface MemoryErasureWarning {
|
|
125
|
+
/** `erasure-unmatchable`: no ledger key, so a replay after a restore can't find this person. */
|
|
126
|
+
readonly code: 'erasure-unmatchable';
|
|
127
|
+
readonly message: string;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export type CreateMemoryErasureOutcome =
|
|
131
|
+
| {
|
|
132
|
+
readonly kind: 'created';
|
|
133
|
+
readonly erasure: MemoryErasure;
|
|
134
|
+
readonly warnings: readonly MemoryErasureWarning[];
|
|
135
|
+
}
|
|
136
|
+
| {
|
|
137
|
+
readonly kind: 'refused';
|
|
138
|
+
/** Legal hold on a fact it reaches: nothing started. */
|
|
139
|
+
readonly refusal: {
|
|
140
|
+
readonly code: 'legal-hold';
|
|
141
|
+
readonly message: string;
|
|
142
|
+
readonly factIds?: readonly string[];
|
|
143
|
+
};
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
export interface ReplayMemoryErasuresResult {
|
|
147
|
+
/** Matched to an id in the tenant again: run again. */
|
|
148
|
+
readonly replayed: readonly string[];
|
|
149
|
+
/** Put back in the ledger; nothing in the tenant matches (nothing to erase). */
|
|
150
|
+
readonly restored: readonly string[];
|
|
151
|
+
/** No keyed hash, or a key this deployment doesn't hold. */
|
|
152
|
+
readonly unmatched: readonly {
|
|
153
|
+
readonly id: string;
|
|
154
|
+
readonly reason: 'no-keyed-hash' | 'unknown-key';
|
|
155
|
+
}[];
|
|
156
|
+
}
|