@kindgi/api 0.0.0-bootstrap.0 → 0.1.1
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/LICENSE +201 -0
- package/README.md +216 -1
- package/dist/adapter-binding.d.ts +177 -0
- package/dist/adapter-binding.d.ts.map +1 -0
- package/dist/adapter-binding.js +12 -0
- package/dist/adapter-binding.js.map +1 -0
- package/dist/agent-binding.d.ts +207 -0
- package/dist/agent-binding.d.ts.map +1 -0
- package/dist/agent-binding.js +4 -0
- package/dist/agent-binding.js.map +1 -0
- package/dist/app.d.ts +770 -0
- package/dist/app.d.ts.map +1 -0
- package/dist/app.js +397 -0
- package/dist/app.js.map +1 -0
- package/dist/capability-binding.d.ts +76 -0
- package/dist/capability-binding.d.ts.map +1 -0
- package/dist/capability-binding.js +4 -0
- package/dist/capability-binding.js.map +1 -0
- package/dist/cost-binding.d.ts +175 -0
- package/dist/cost-binding.d.ts.map +1 -0
- package/dist/cost-binding.js +13 -0
- package/dist/cost-binding.js.map +1 -0
- package/dist/deployment-binding.d.ts +201 -0
- package/dist/deployment-binding.d.ts.map +1 -0
- package/dist/deployment-binding.js +4 -0
- package/dist/deployment-binding.js.map +1 -0
- package/dist/env-binding.d.ts +132 -0
- package/dist/env-binding.d.ts.map +1 -0
- package/dist/env-binding.js +4 -0
- package/dist/env-binding.js.map +1 -0
- package/dist/errors.d.ts +37 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +268 -0
- package/dist/errors.js.map +1 -0
- package/dist/eval-run-binding.d.ts +196 -0
- package/dist/eval-run-binding.d.ts.map +1 -0
- package/dist/eval-run-binding.js +16 -0
- package/dist/eval-run-binding.js.map +1 -0
- package/dist/eval-run-dispatcher.d.ts +131 -0
- package/dist/eval-run-dispatcher.d.ts.map +1 -0
- package/dist/eval-run-dispatcher.js +368 -0
- package/dist/eval-run-dispatcher.js.map +1 -0
- package/dist/eval-suite-binding.d.ts +227 -0
- package/dist/eval-suite-binding.d.ts.map +1 -0
- package/dist/eval-suite-binding.js +24 -0
- package/dist/eval-suite-binding.js.map +1 -0
- package/dist/event-bus-binding.d.ts +107 -0
- package/dist/event-bus-binding.d.ts.map +1 -0
- package/dist/event-bus-binding.js +5 -0
- package/dist/event-bus-binding.js.map +1 -0
- package/dist/flow-binding.d.ts +194 -0
- package/dist/flow-binding.d.ts.map +1 -0
- package/dist/flow-binding.js +4 -0
- package/dist/flow-binding.js.map +1 -0
- package/dist/guardrail-binding.d.ts +138 -0
- package/dist/guardrail-binding.d.ts.map +1 -0
- package/dist/guardrail-binding.js +4 -0
- package/dist/guardrail-binding.js.map +1 -0
- package/dist/handler-binding.d.ts +126 -0
- package/dist/handler-binding.d.ts.map +1 -0
- package/dist/handler-binding.js +4 -0
- package/dist/handler-binding.js.map +1 -0
- package/dist/hitl-binding.d.ts +115 -0
- package/dist/hitl-binding.d.ts.map +1 -0
- package/dist/hitl-binding.js +4 -0
- package/dist/hitl-binding.js.map +1 -0
- package/dist/identity-directory-binding.d.ts +116 -0
- package/dist/identity-directory-binding.d.ts.map +1 -0
- package/dist/identity-directory-binding.js +4 -0
- package/dist/identity-directory-binding.js.map +1 -0
- package/dist/identity-provider-binding.d.ts +184 -0
- package/dist/identity-provider-binding.d.ts.map +1 -0
- package/dist/identity-provider-binding.js +4 -0
- package/dist/identity-provider-binding.js.map +1 -0
- package/dist/image-registry-binding.d.ts +165 -0
- package/dist/image-registry-binding.d.ts.map +1 -0
- package/dist/image-registry-binding.js +4 -0
- package/dist/image-registry-binding.js.map +1 -0
- package/dist/index.d.ts +72 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +26 -0
- package/dist/index.js.map +1 -0
- package/dist/key-management-binding.d.ts +101 -0
- package/dist/key-management-binding.d.ts.map +1 -0
- package/dist/key-management-binding.js +4 -0
- package/dist/key-management-binding.js.map +1 -0
- package/dist/mcp-endpoint-binding.d.ts +312 -0
- package/dist/mcp-endpoint-binding.d.ts.map +1 -0
- package/dist/mcp-endpoint-binding.js +12 -0
- package/dist/mcp-endpoint-binding.js.map +1 -0
- package/dist/memory-binding.d.ts +209 -0
- package/dist/memory-binding.d.ts.map +1 -0
- package/dist/memory-binding.js +4 -0
- package/dist/memory-binding.js.map +1 -0
- package/dist/middleware/auth.d.ts +168 -0
- package/dist/middleware/auth.d.ts.map +1 -0
- package/dist/middleware/auth.js +247 -0
- package/dist/middleware/auth.js.map +1 -0
- package/dist/middleware/authorize.d.ts +26 -0
- package/dist/middleware/authorize.d.ts.map +1 -0
- package/dist/middleware/authorize.js +65 -0
- package/dist/middleware/authorize.js.map +1 -0
- package/dist/middleware/error-mapper.d.ts +20 -0
- package/dist/middleware/error-mapper.d.ts.map +1 -0
- package/dist/middleware/error-mapper.js +34 -0
- package/dist/middleware/error-mapper.js.map +1 -0
- package/dist/middleware/idempotency.d.ts +43 -0
- package/dist/middleware/idempotency.d.ts.map +1 -0
- package/dist/middleware/idempotency.js +118 -0
- package/dist/middleware/idempotency.js.map +1 -0
- package/dist/middleware/principal.d.ts +4 -0
- package/dist/middleware/principal.d.ts.map +1 -0
- package/dist/middleware/principal.js +42 -0
- package/dist/middleware/principal.js.map +1 -0
- package/dist/middleware/public-run-routes.d.ts +16 -0
- package/dist/middleware/public-run-routes.d.ts.map +1 -0
- package/dist/middleware/public-run-routes.js +43 -0
- package/dist/middleware/public-run-routes.js.map +1 -0
- package/dist/middleware/request-id.d.ts +14 -0
- package/dist/middleware/request-id.d.ts.map +1 -0
- package/dist/middleware/request-id.js +24 -0
- package/dist/middleware/request-id.js.map +1 -0
- package/dist/middleware/sigv4-verify.d.ts +64 -0
- package/dist/middleware/sigv4-verify.d.ts.map +1 -0
- package/dist/middleware/sigv4-verify.js +286 -0
- package/dist/middleware/sigv4-verify.js.map +1 -0
- package/dist/middleware/sigv4.d.ts +25 -0
- package/dist/middleware/sigv4.d.ts.map +1 -0
- package/dist/middleware/sigv4.js +120 -0
- package/dist/middleware/sigv4.js.map +1 -0
- package/dist/openapi/generate.d.ts +15 -0
- package/dist/openapi/generate.d.ts.map +1 -0
- package/dist/openapi/generate.js +241 -0
- package/dist/openapi/generate.js.map +1 -0
- package/dist/openapi/operations.d.ts +70 -0
- package/dist/openapi/operations.d.ts.map +1 -0
- package/dist/openapi/operations.js +5050 -0
- package/dist/openapi/operations.js.map +1 -0
- package/dist/openapi/schemas.d.ts +590 -0
- package/dist/openapi/schemas.d.ts.map +1 -0
- package/dist/openapi/schemas.js +5820 -0
- package/dist/openapi/schemas.js.map +1 -0
- package/dist/provenance-binding.d.ts +116 -0
- package/dist/provenance-binding.d.ts.map +1 -0
- package/dist/provenance-binding.js +31 -0
- package/dist/provenance-binding.js.map +1 -0
- package/dist/provider-binding.d.ts +174 -0
- package/dist/provider-binding.d.ts.map +1 -0
- package/dist/provider-binding.js +4 -0
- package/dist/provider-binding.js.map +1 -0
- package/dist/public-run-token.d.ts +97 -0
- package/dist/public-run-token.d.ts.map +1 -0
- package/dist/public-run-token.js +167 -0
- package/dist/public-run-token.js.map +1 -0
- package/dist/retention-binding.d.ts +69 -0
- package/dist/retention-binding.d.ts.map +1 -0
- package/dist/retention-binding.js +4 -0
- package/dist/retention-binding.js.map +1 -0
- package/dist/reviewer-binding.d.ts +84 -0
- package/dist/reviewer-binding.d.ts.map +1 -0
- package/dist/reviewer-binding.js +4 -0
- package/dist/reviewer-binding.js.map +1 -0
- package/dist/rotation-status-store.d.ts +96 -0
- package/dist/rotation-status-store.d.ts.map +1 -0
- package/dist/rotation-status-store.js +106 -0
- package/dist/rotation-status-store.js.map +1 -0
- package/dist/routes/adapters.d.ts +29 -0
- package/dist/routes/adapters.d.ts.map +1 -0
- package/dist/routes/adapters.js +230 -0
- package/dist/routes/adapters.js.map +1 -0
- package/dist/routes/agents.d.ts +17 -0
- package/dist/routes/agents.d.ts.map +1 -0
- package/dist/routes/agents.js +342 -0
- package/dist/routes/agents.js.map +1 -0
- package/dist/routes/approvals.d.ts +37 -0
- package/dist/routes/approvals.d.ts.map +1 -0
- package/dist/routes/approvals.js +551 -0
- package/dist/routes/approvals.js.map +1 -0
- package/dist/routes/artifacts.d.ts +25 -0
- package/dist/routes/artifacts.d.ts.map +1 -0
- package/dist/routes/artifacts.js +265 -0
- package/dist/routes/artifacts.js.map +1 -0
- package/dist/routes/audit.d.ts +6 -0
- package/dist/routes/audit.d.ts.map +1 -0
- package/dist/routes/audit.js +162 -0
- package/dist/routes/audit.js.map +1 -0
- package/dist/routes/auth.d.ts +47 -0
- package/dist/routes/auth.d.ts.map +1 -0
- package/dist/routes/auth.js +630 -0
- package/dist/routes/auth.js.map +1 -0
- package/dist/routes/capabilities.d.ts +14 -0
- package/dist/routes/capabilities.d.ts.map +1 -0
- package/dist/routes/capabilities.js +62 -0
- package/dist/routes/capabilities.js.map +1 -0
- package/dist/routes/compliance.d.ts +37 -0
- package/dist/routes/compliance.d.ts.map +1 -0
- package/dist/routes/compliance.js +321 -0
- package/dist/routes/compliance.js.map +1 -0
- package/dist/routes/conversations.d.ts +13 -0
- package/dist/routes/conversations.d.ts.map +1 -0
- package/dist/routes/conversations.js +295 -0
- package/dist/routes/conversations.js.map +1 -0
- package/dist/routes/cost.d.ts +24 -0
- package/dist/routes/cost.d.ts.map +1 -0
- package/dist/routes/cost.js +243 -0
- package/dist/routes/cost.js.map +1 -0
- package/dist/routes/deployments.d.ts +122 -0
- package/dist/routes/deployments.d.ts.map +1 -0
- package/dist/routes/deployments.js +1036 -0
- package/dist/routes/deployments.js.map +1 -0
- package/dist/routes/env.d.ts +62 -0
- package/dist/routes/env.d.ts.map +1 -0
- package/dist/routes/env.js +311 -0
- package/dist/routes/env.js.map +1 -0
- package/dist/routes/eval-runs.d.ts +28 -0
- package/dist/routes/eval-runs.d.ts.map +1 -0
- package/dist/routes/eval-runs.js +479 -0
- package/dist/routes/eval-runs.js.map +1 -0
- package/dist/routes/eval-suites.d.ts +24 -0
- package/dist/routes/eval-suites.d.ts.map +1 -0
- package/dist/routes/eval-suites.js +381 -0
- package/dist/routes/eval-suites.js.map +1 -0
- package/dist/routes/event-triggers.d.ts +12 -0
- package/dist/routes/event-triggers.d.ts.map +1 -0
- package/dist/routes/event-triggers.js +218 -0
- package/dist/routes/event-triggers.js.map +1 -0
- package/dist/routes/flows.d.ts +23 -0
- package/dist/routes/flows.d.ts.map +1 -0
- package/dist/routes/flows.js +344 -0
- package/dist/routes/flows.js.map +1 -0
- package/dist/routes/guardrails.d.ts +33 -0
- package/dist/routes/guardrails.d.ts.map +1 -0
- package/dist/routes/guardrails.js +236 -0
- package/dist/routes/guardrails.js.map +1 -0
- package/dist/routes/identity.d.ts +39 -0
- package/dist/routes/identity.d.ts.map +1 -0
- package/dist/routes/identity.js +138 -0
- package/dist/routes/identity.js.map +1 -0
- package/dist/routes/mcp.d.ts +23 -0
- package/dist/routes/mcp.d.ts.map +1 -0
- package/dist/routes/mcp.js +727 -0
- package/dist/routes/mcp.js.map +1 -0
- package/dist/routes/memory.d.ts +16 -0
- package/dist/routes/memory.d.ts.map +1 -0
- package/dist/routes/memory.js +353 -0
- package/dist/routes/memory.js.map +1 -0
- package/dist/routes/observations.d.ts +19 -0
- package/dist/routes/observations.d.ts.map +1 -0
- package/dist/routes/observations.js +135 -0
- package/dist/routes/observations.js.map +1 -0
- package/dist/routes/orgs.d.ts +24 -0
- package/dist/routes/orgs.d.ts.map +1 -0
- package/dist/routes/orgs.js +208 -0
- package/dist/routes/orgs.js.map +1 -0
- package/dist/routes/pagination.d.ts +18 -0
- package/dist/routes/pagination.d.ts.map +1 -0
- package/dist/routes/pagination.js +35 -0
- package/dist/routes/pagination.js.map +1 -0
- package/dist/routes/policies.d.ts +23 -0
- package/dist/routes/policies.d.ts.map +1 -0
- package/dist/routes/policies.js +314 -0
- package/dist/routes/policies.js.map +1 -0
- package/dist/routes/projects.d.ts +45 -0
- package/dist/routes/projects.d.ts.map +1 -0
- package/dist/routes/projects.js +485 -0
- package/dist/routes/projects.js.map +1 -0
- package/dist/routes/proposals.d.ts +24 -0
- package/dist/routes/proposals.d.ts.map +1 -0
- package/dist/routes/proposals.js +581 -0
- package/dist/routes/proposals.js.map +1 -0
- package/dist/routes/provenance.d.ts +34 -0
- package/dist/routes/provenance.d.ts.map +1 -0
- package/dist/routes/provenance.js +274 -0
- package/dist/routes/provenance.js.map +1 -0
- package/dist/routes/providers.d.ts +32 -0
- package/dist/routes/providers.d.ts.map +1 -0
- package/dist/routes/providers.js +490 -0
- package/dist/routes/providers.js.map +1 -0
- package/dist/routes/public-run-tokens.d.ts +17 -0
- package/dist/routes/public-run-tokens.d.ts.map +1 -0
- package/dist/routes/public-run-tokens.js +69 -0
- package/dist/routes/public-run-tokens.js.map +1 -0
- package/dist/routes/retention.d.ts +19 -0
- package/dist/routes/retention.d.ts.map +1 -0
- package/dist/routes/retention.js +152 -0
- package/dist/routes/retention.js.map +1 -0
- package/dist/routes/reviewers.d.ts +5 -0
- package/dist/routes/reviewers.d.ts.map +1 -0
- package/dist/routes/reviewers.js +161 -0
- package/dist/routes/reviewers.js.map +1 -0
- package/dist/routes/runs.d.ts +34 -0
- package/dist/routes/runs.d.ts.map +1 -0
- package/dist/routes/runs.js +705 -0
- package/dist/routes/runs.js.map +1 -0
- package/dist/routes/s3.d.ts +31 -0
- package/dist/routes/s3.d.ts.map +1 -0
- package/dist/routes/s3.js +433 -0
- package/dist/routes/s3.js.map +1 -0
- package/dist/routes/schedules.d.ts +20 -0
- package/dist/routes/schedules.d.ts.map +1 -0
- package/dist/routes/schedules.js +234 -0
- package/dist/routes/schedules.js.map +1 -0
- package/dist/routes/scope-params.d.ts +57 -0
- package/dist/routes/scope-params.d.ts.map +1 -0
- package/dist/routes/scope-params.js +105 -0
- package/dist/routes/scope-params.js.map +1 -0
- package/dist/routes/secret-ref.d.ts +20 -0
- package/dist/routes/secret-ref.d.ts.map +1 -0
- package/dist/routes/secret-ref.js +42 -0
- package/dist/routes/secret-ref.js.map +1 -0
- package/dist/routes/secrets.d.ts +53 -0
- package/dist/routes/secrets.d.ts.map +1 -0
- package/dist/routes/secrets.js +715 -0
- package/dist/routes/secrets.js.map +1 -0
- package/dist/routes/signing-keys.d.ts +23 -0
- package/dist/routes/signing-keys.d.ts.map +1 -0
- package/dist/routes/signing-keys.js +212 -0
- package/dist/routes/signing-keys.js.map +1 -0
- package/dist/routes/sse.d.ts +58 -0
- package/dist/routes/sse.d.ts.map +1 -0
- package/dist/routes/sse.js +92 -0
- package/dist/routes/sse.js.map +1 -0
- package/dist/routes/teams.d.ts +30 -0
- package/dist/routes/teams.d.ts.map +1 -0
- package/dist/routes/teams.js +443 -0
- package/dist/routes/teams.js.map +1 -0
- package/dist/routes/tenant.d.ts +57 -0
- package/dist/routes/tenant.d.ts.map +1 -0
- package/dist/routes/tenant.js +352 -0
- package/dist/routes/tenant.js.map +1 -0
- package/dist/routes/tokens.d.ts +14 -0
- package/dist/routes/tokens.d.ts.map +1 -0
- package/dist/routes/tokens.js +231 -0
- package/dist/routes/tokens.js.map +1 -0
- package/dist/routes/tools.d.ts +33 -0
- package/dist/routes/tools.d.ts.map +1 -0
- package/dist/routes/tools.js +380 -0
- package/dist/routes/tools.js.map +1 -0
- package/dist/routes/webhook-endpoints.d.ts +10 -0
- package/dist/routes/webhook-endpoints.d.ts.map +1 -0
- package/dist/routes/webhook-endpoints.js +407 -0
- package/dist/routes/webhook-endpoints.js.map +1 -0
- package/dist/routes/webhooks.d.ts +21 -0
- package/dist/routes/webhooks.d.ts.map +1 -0
- package/dist/routes/webhooks.js +228 -0
- package/dist/routes/webhooks.js.map +1 -0
- package/dist/s3-credential-binding.d.ts +54 -0
- package/dist/s3-credential-binding.d.ts.map +1 -0
- package/dist/s3-credential-binding.js +4 -0
- package/dist/s3-credential-binding.js.map +1 -0
- package/dist/secrets-binding.d.ts +281 -0
- package/dist/secrets-binding.d.ts.map +1 -0
- package/dist/secrets-binding.js +10 -0
- package/dist/secrets-binding.js.map +1 -0
- package/dist/secrets-provider-binding.d.ts +164 -0
- package/dist/secrets-provider-binding.d.ts.map +1 -0
- package/dist/secrets-provider-binding.js +4 -0
- package/dist/secrets-provider-binding.js.map +1 -0
- package/dist/session-store-binding.d.ts +148 -0
- package/dist/session-store-binding.d.ts.map +1 -0
- package/dist/session-store-binding.js +4 -0
- package/dist/session-store-binding.js.map +1 -0
- package/dist/signing-key-binding.d.ts +210 -0
- package/dist/signing-key-binding.d.ts.map +1 -0
- package/dist/signing-key-binding.js +4 -0
- package/dist/signing-key-binding.js.map +1 -0
- package/dist/state-store-binding.d.ts +53 -0
- package/dist/state-store-binding.d.ts.map +1 -0
- package/dist/state-store-binding.js +38 -0
- package/dist/state-store-binding.js.map +1 -0
- package/dist/supervisor-binding.d.ts +526 -0
- package/dist/supervisor-binding.d.ts.map +1 -0
- package/dist/supervisor-binding.js +4 -0
- package/dist/supervisor-binding.js.map +1 -0
- package/dist/tenant-host-access.d.ts +41 -0
- package/dist/tenant-host-access.d.ts.map +1 -0
- package/dist/tenant-host-access.js +42 -0
- package/dist/tenant-host-access.js.map +1 -0
- package/dist/token-admin.d.ts +99 -0
- package/dist/token-admin.d.ts.map +1 -0
- package/dist/token-admin.js +4 -0
- package/dist/token-admin.js.map +1 -0
- package/dist/tool-binding.d.ts +247 -0
- package/dist/tool-binding.d.ts.map +1 -0
- package/dist/tool-binding.js +4 -0
- package/dist/tool-binding.js.map +1 -0
- package/dist/trigger-binding.d.ts +13 -0
- package/dist/trigger-binding.d.ts.map +1 -0
- package/dist/trigger-binding.js +4 -0
- package/dist/trigger-binding.js.map +1 -0
- package/dist/types.d.ts +71 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +4 -0
- package/dist/types.js.map +1 -0
- package/dist/webhook-endpoint-binding.d.ts +230 -0
- package/dist/webhook-endpoint-binding.d.ts.map +1 -0
- package/dist/webhook-endpoint-binding.js +12 -0
- package/dist/webhook-endpoint-binding.js.map +1 -0
- package/dist/xml.d.ts +79 -0
- package/dist/xml.d.ts.map +1 -0
- package/dist/xml.js +115 -0
- package/dist/xml.js.map +1 -0
- package/openapi.json +29649 -0
- package/package.json +76 -4
- package/scripts/emit-openapi.mjs +44 -0
- package/src/adapter-binding.ts +204 -0
- package/src/agent-binding.ts +231 -0
- package/src/app.ts +1286 -0
- package/src/capability-binding.ts +83 -0
- package/src/cost-binding.ts +213 -0
- package/src/deployment-binding.ts +225 -0
- package/src/env-binding.ts +140 -0
- package/src/errors.ts +295 -0
- package/src/eval-run-binding.ts +209 -0
- package/src/eval-run-dispatcher.ts +497 -0
- package/src/eval-suite-binding.ts +257 -0
- package/src/event-bus-binding.ts +127 -0
- package/src/flow-binding.ts +213 -0
- package/src/guardrail-binding.ts +151 -0
- package/src/handler-binding.ts +132 -0
- package/src/hitl-binding.ts +172 -0
- package/src/identity-directory-binding.ts +128 -0
- package/src/identity-provider-binding.ts +203 -0
- package/src/image-registry-binding.ts +193 -0
- package/src/index.ts +606 -0
- package/src/key-management-binding.ts +91 -0
- package/src/mcp-endpoint-binding.ts +311 -0
- package/src/memory-binding.ts +239 -0
- package/src/middleware/auth.ts +437 -0
- package/src/middleware/authorize.ts +125 -0
- package/src/middleware/error-mapper.ts +40 -0
- package/src/middleware/idempotency.ts +160 -0
- package/src/middleware/principal.ts +64 -0
- package/src/middleware/public-run-routes.ts +50 -0
- package/src/middleware/request-id.ts +28 -0
- package/src/middleware/sigv4-verify.ts +374 -0
- package/src/middleware/sigv4.ts +165 -0
- package/src/openapi/generate.ts +307 -0
- package/src/openapi/operations.ts +5444 -0
- package/src/openapi/schemas.ts +6363 -0
- package/src/provenance-binding.ts +169 -0
- package/src/provider-binding.ts +196 -0
- package/src/public-run-token.ts +263 -0
- package/src/retention-binding.ts +78 -0
- package/src/reviewer-binding.ts +99 -0
- package/src/rotation-status-store.ts +209 -0
- package/src/routes/adapters.ts +319 -0
- package/src/routes/agents.ts +424 -0
- package/src/routes/approvals.ts +759 -0
- package/src/routes/artifacts.ts +317 -0
- package/src/routes/audit.ts +219 -0
- package/src/routes/auth.ts +806 -0
- package/src/routes/capabilities.ts +79 -0
- package/src/routes/compliance.ts +482 -0
- package/src/routes/conversations.ts +369 -0
- package/src/routes/cost.ts +327 -0
- package/src/routes/deployments.ts +1493 -0
- package/src/routes/env.ts +429 -0
- package/src/routes/eval-runs.ts +631 -0
- package/src/routes/eval-suites.ts +490 -0
- package/src/routes/event-triggers.ts +283 -0
- package/src/routes/flows.ts +423 -0
- package/src/routes/guardrails.ts +320 -0
- package/src/routes/identity.ts +203 -0
- package/src/routes/mcp.ts +940 -0
- package/src/routes/memory.ts +430 -0
- package/src/routes/observations.ts +175 -0
- package/src/routes/orgs.ts +273 -0
- package/src/routes/pagination.ts +51 -0
- package/src/routes/policies.ts +413 -0
- package/src/routes/projects.ts +634 -0
- package/src/routes/proposals.ts +719 -0
- package/src/routes/provenance.ts +406 -0
- package/src/routes/providers.ts +624 -0
- package/src/routes/public-run-tokens.ts +104 -0
- package/src/routes/retention.ts +193 -0
- package/src/routes/reviewers.ts +209 -0
- package/src/routes/runs.ts +892 -0
- package/src/routes/s3.ts +519 -0
- package/src/routes/schedules.ts +300 -0
- package/src/routes/scope-params.ts +133 -0
- package/src/routes/secret-ref.ts +52 -0
- package/src/routes/secrets.ts +975 -0
- package/src/routes/signing-keys.ts +259 -0
- package/src/routes/sse.ts +148 -0
- package/src/routes/teams.ts +584 -0
- package/src/routes/tenant.ts +530 -0
- package/src/routes/tokens.ts +285 -0
- package/src/routes/tools.ts +491 -0
- package/src/routes/webhook-endpoints.ts +534 -0
- package/src/routes/webhooks.ts +296 -0
- package/src/s3-credential-binding.ts +58 -0
- package/src/secrets-binding.ts +308 -0
- package/src/secrets-provider-binding.ts +167 -0
- package/src/session-store-binding.ts +163 -0
- package/src/signing-key-binding.ts +235 -0
- package/src/state-store-binding.ts +84 -0
- package/src/supervisor-binding.ts +554 -0
- package/src/tenant-host-access.ts +62 -0
- package/src/token-admin.ts +104 -0
- package/src/tool-binding.ts +274 -0
- package/src/trigger-binding.ts +38 -0
- package/src/types.ts +74 -0
- package/src/webhook-endpoint-binding.ts +246 -0
- package/src/xml.ts +196 -0
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
// Copyright (C) 2026 Kindgi Inc.
|
|
3
|
+
|
|
4
|
+
import type { TupleEnqueueHook } from '@kindgi/authz';
|
|
5
|
+
import type { Guardrail } from '@kindgi/guardrails';
|
|
6
|
+
import type { Scope } from '@kindgi/platform';
|
|
7
|
+
import type { Cursor, GuardrailId, ProjectId, TenantId } from '@kindgi/types';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Caller-plugged surface for the guardrail catalog. Same shape as
|
|
11
|
+
* `AgentRegistryBinding` / `ToolRegistryBinding`: the API package does
|
|
12
|
+
* NOT own registry persistence.
|
|
13
|
+
*
|
|
14
|
+
* The surface is metadata-only: a `Guardrail` references a `check` id
|
|
15
|
+
* whose implementation lives server-side (a pure function in the
|
|
16
|
+
* runtime's `CheckRegistry`). The wire body is a full `Guardrail` shape
|
|
17
|
+
* (id + kind + check-id + action); the actual check implementation must
|
|
18
|
+
* already be registered with the runtime. Check code is not uploaded
|
|
19
|
+
* over this surface.
|
|
20
|
+
*
|
|
21
|
+
* Every method is tenant-scoped: callers pass `tenantId` explicitly so
|
|
22
|
+
* multi-tenant deployments can partition storage without exposing the
|
|
23
|
+
* scoping inside the API package.
|
|
24
|
+
*
|
|
25
|
+
* Cursors are opaque — the binding chooses its encoding. The API layer
|
|
26
|
+
* only validates that a cursor round-trips as a string; it never
|
|
27
|
+
* inspects the payload.
|
|
28
|
+
*/
|
|
29
|
+
export interface GuardrailRegistryBinding {
|
|
30
|
+
/**
|
|
31
|
+
* Cursor-paginated list of guardrails sorted by id ascending.
|
|
32
|
+
* Optional `nameFilter` is a prefix match on the guardrail id —
|
|
33
|
+
* guardrails often use dotted namespaces (`acme.no-fabricated-quotes`),
|
|
34
|
+
* so prefix matching is the natural filter shape.
|
|
35
|
+
*/
|
|
36
|
+
list(input: GuardrailListInput): Promise<GuardrailPage>;
|
|
37
|
+
/**
|
|
38
|
+
* The guardrail for the given id, or `null` if unknown. The route
|
|
39
|
+
* surfaces `null` as `404 guardrail-not-found`.
|
|
40
|
+
*/
|
|
41
|
+
get(input: GuardrailGetInput): Promise<Guardrail | null>;
|
|
42
|
+
/**
|
|
43
|
+
* Register a validated guardrail spec. The API route validates shape
|
|
44
|
+
* via `validateGuardrailSpec(...)` before calling — the binding
|
|
45
|
+
* receives a well-formed `Guardrail`. Bindings MAY reject with
|
|
46
|
+
* `already-registered` when the same id is re-registered; the route
|
|
47
|
+
* maps that to `409`.
|
|
48
|
+
*/
|
|
49
|
+
register(input: GuardrailRegisterInput): Promise<GuardrailRegisterOutcome>;
|
|
50
|
+
/**
|
|
51
|
+
* Remove a guardrail by id. Returns `{ unregistered: true }` on
|
|
52
|
+
* success; `{ unregistered: false }` when the id was unknown — the
|
|
53
|
+
* route flips the latter to `404`.
|
|
54
|
+
*/
|
|
55
|
+
unregister(input: GuardrailUnregisterInput): Promise<GuardrailUnregisterOutcome>;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface GuardrailListInput {
|
|
59
|
+
readonly tenantId: TenantId;
|
|
60
|
+
readonly limit: number;
|
|
61
|
+
readonly cursor?: Cursor;
|
|
62
|
+
/** Prefix match on `Guardrail.id`. Undefined = no filter. */
|
|
63
|
+
readonly nameFilter?: string;
|
|
64
|
+
/**
|
|
65
|
+
* Narrow the list to a specific scope. Absent = no scope narrow
|
|
66
|
+
* (return every row in the tenant the caller can see — admin/audit
|
|
67
|
+
* default).
|
|
68
|
+
*
|
|
69
|
+
* Content-scoped semantics (this binding):
|
|
70
|
+
* - `{ kind: 'project', projectId }` — rows in that project.
|
|
71
|
+
* - `{ kind: 'org', orgId }` — rows in every project belonging to
|
|
72
|
+
* that org.
|
|
73
|
+
* - `{ kind: 'tenant', tenantId }` — every row in the tenant.
|
|
74
|
+
*
|
|
75
|
+
* Content rows always belong to a project, so `inherit` has no
|
|
76
|
+
* effect here.
|
|
77
|
+
*/
|
|
78
|
+
readonly scope?: Scope;
|
|
79
|
+
/**
|
|
80
|
+
* `false` = literal-at-this-scope only (admin/audit view).
|
|
81
|
+
* `true` (default) = inheritance walk (user-facing view).
|
|
82
|
+
* No-op for content-scoped bindings (rows only exist at
|
|
83
|
+
* project-level — there is no upward hierarchy to walk). Kept for
|
|
84
|
+
* uniformity: scope-aware bindings share one filter shape.
|
|
85
|
+
*/
|
|
86
|
+
readonly inherit?: boolean;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export interface GuardrailGetInput {
|
|
90
|
+
readonly tenantId: TenantId;
|
|
91
|
+
readonly guardrailId: GuardrailId;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export interface GuardrailRegisterInput {
|
|
95
|
+
readonly tenantId: TenantId;
|
|
96
|
+
/**
|
|
97
|
+
* Project the guardrail is registered into. REQUIRED. Callers that
|
|
98
|
+
* don't naturally know a projectId
|
|
99
|
+
* (deployment route) resolve the tenant's Default via
|
|
100
|
+
* `projectBinding.getDefault(tenantId)` at THEIR layer and thread
|
|
101
|
+
* the resolved id here — the storage adapter never silently falls
|
|
102
|
+
* back to Default.
|
|
103
|
+
*/
|
|
104
|
+
readonly projectId: ProjectId;
|
|
105
|
+
readonly guardrail: Guardrail;
|
|
106
|
+
/**
|
|
107
|
+
* REQUIRED. Called inside the binding's write tx after row insert,
|
|
108
|
+
* receiving the business `guardrailId`. Returns tuples for the tx.
|
|
109
|
+
* See `AgentPublishInput.enqueueTuples` for the design rationale.
|
|
110
|
+
*/
|
|
111
|
+
readonly enqueueTuples: TupleEnqueueHook;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export interface GuardrailUnregisterInput {
|
|
115
|
+
readonly tenantId: TenantId;
|
|
116
|
+
readonly guardrailId: GuardrailId;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export interface GuardrailPage {
|
|
120
|
+
readonly data: readonly Guardrail[];
|
|
121
|
+
readonly nextCursor?: Cursor;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export type GuardrailRegisterOutcome =
|
|
125
|
+
| {
|
|
126
|
+
readonly kind: 'ok';
|
|
127
|
+
readonly guardrailId: GuardrailId;
|
|
128
|
+
}
|
|
129
|
+
| {
|
|
130
|
+
readonly kind: 'already-registered';
|
|
131
|
+
readonly guardrailId: GuardrailId;
|
|
132
|
+
}
|
|
133
|
+
| {
|
|
134
|
+
/**
|
|
135
|
+
* The caller-supplied `projectId` does not resolve to a real
|
|
136
|
+
* project row in this tenant. Distinct from
|
|
137
|
+
* `already-registered` so the route + deployment guardrails-loop
|
|
138
|
+
* can surface a clean `400 bad-input` (per their own error
|
|
139
|
+
* contracts) rather than the misleading `already-registered`
|
|
140
|
+
* fallback. Database-backed implementations typically detect this
|
|
141
|
+
* from the foreign-key violation; in-memory implementations check
|
|
142
|
+
* the project id explicitly at register time.
|
|
143
|
+
*/
|
|
144
|
+
readonly kind: 'project-not-found';
|
|
145
|
+
readonly guardrailId: GuardrailId;
|
|
146
|
+
readonly projectId: ProjectId;
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
export type GuardrailUnregisterOutcome = {
|
|
150
|
+
readonly unregistered: boolean;
|
|
151
|
+
};
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
// Copyright (C) 2026 Kindgi Inc.
|
|
3
|
+
|
|
4
|
+
import type { AgentId } from '@kindgi/agents';
|
|
5
|
+
import type { FlowId, ProjectId, RunId, Semver, TenantId } from '@kindgi/types';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Callback the platform HTTP surface hands off to when it receives
|
|
9
|
+
* `POST /v1/runs`. The API package intentionally does NOT depend on
|
|
10
|
+
* `AgentRegistry`, `ProviderRegistry`, `ToolRegistry`, or the wiring
|
|
11
|
+
* that assembles an `InvokeAgentBindings` — the caller wires those and
|
|
12
|
+
* exposes them through this thin binding.
|
|
13
|
+
*
|
|
14
|
+
* Why: keeps `@kindgi/api` narrow (Hono + routing + error mapping)
|
|
15
|
+
* while letting deployments — a local dev server, a hosted platform, a
|
|
16
|
+
* self-hosted install — assemble the runtime dependencies however they
|
|
17
|
+
* need to. Same pattern as `TokenResolver` for auth.
|
|
18
|
+
*
|
|
19
|
+
* Both methods block until the run reaches a terminal or suspended
|
|
20
|
+
* state — unless the input's `wait` is `false`, in which case they
|
|
21
|
+
* return the `runId` as soon as the run exists. The API layer only
|
|
22
|
+
* needs the `runId` to re-read the row and respond.
|
|
23
|
+
*
|
|
24
|
+
* Domain errors are returned as `RunHandlerFailure`; the route layer
|
|
25
|
+
* maps `code` to the HTTP status via `ERROR_CODE_TO_STATUS`.
|
|
26
|
+
*/
|
|
27
|
+
export interface RunHandlerBinding {
|
|
28
|
+
/**
|
|
29
|
+
* Called when the request body has `{ agent: AgentId, ... }`. The
|
|
30
|
+
* binding is expected to look up the agent, build the invocation
|
|
31
|
+
* bindings, and call `invokeAgent` from `@kindgi/agents` (or an
|
|
32
|
+
* equivalent). Return the underlying `RunId` on success.
|
|
33
|
+
*/
|
|
34
|
+
invokeAgent(input: InvokeAgentBindingInput): Promise<RunHandlerOutcome>;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Called when the request body has `{ flow: FlowId, ... }`. The
|
|
38
|
+
* binding is expected to resolve the flow to its `Flow` value +
|
|
39
|
+
* `HandlerRegistry` and start it with `RunBinding.runGraph`
|
|
40
|
+
* (`@kindgi/runtime`).
|
|
41
|
+
*/
|
|
42
|
+
invokeFlow(input: InvokeFlowBindingInput): Promise<RunHandlerOutcome>;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Resume a suspended run — invoked after a waitpoint resolves (e.g. a
|
|
46
|
+
* reviewer's decision writes `wait.resumed`; a timeout writes
|
|
47
|
+
* `wait.cancelled`). The binding reconstructs the same flow + handler
|
|
48
|
+
* context the run started with and calls `RunBinding.resumeRun`,
|
|
49
|
+
* blocking until the run reaches its next terminal state (or the next
|
|
50
|
+
* suspension). Same runId, same conversation, same provenance record —
|
|
51
|
+
* park-and-resume preserves audit-trail continuity across HITL cycles.
|
|
52
|
+
*
|
|
53
|
+
* Returns the same shape as `invokeAgent` / `invokeFlow`: the runId
|
|
54
|
+
* on success; a `RunHandlerFailure` when the resume path errors before
|
|
55
|
+
* the run is picked up.
|
|
56
|
+
*/
|
|
57
|
+
resumeRun(input: ResumeRunBindingInput): Promise<RunHandlerOutcome>;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export interface ResumeRunBindingInput {
|
|
61
|
+
readonly tenantId: TenantId;
|
|
62
|
+
readonly runId: RunId;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface InvokeAgentBindingInput {
|
|
66
|
+
readonly tenantId: TenantId;
|
|
67
|
+
/**
|
|
68
|
+
* Content-scope anchor. Omit → the binding
|
|
69
|
+
* resolves the tenant's Default via `projectBinding.getDefault(...)`
|
|
70
|
+
* at its own caller layer. Route callers who supply a project id in
|
|
71
|
+
* the body thread it through here.
|
|
72
|
+
*/
|
|
73
|
+
readonly projectId?: ProjectId;
|
|
74
|
+
readonly agentId: AgentId;
|
|
75
|
+
/** Omit → binding chooses the latest registered version. */
|
|
76
|
+
readonly agentVersion?: Semver;
|
|
77
|
+
/**
|
|
78
|
+
* Opaque payload forwarded from the request body's `input` field.
|
|
79
|
+
* The binding is responsible for coercing this into whatever shape
|
|
80
|
+
* `invokeAgent` expects (typically `{ userMessage, conversationId?, parameters?, participantId? }`).
|
|
81
|
+
* Coercion failures should surface as `code: 'bad-input'`.
|
|
82
|
+
*/
|
|
83
|
+
readonly input: unknown;
|
|
84
|
+
readonly dryRun?: boolean;
|
|
85
|
+
/**
|
|
86
|
+
* `false` → return the run id as soon as the run exists and finish it
|
|
87
|
+
* in the background (the route answers `202`; callers poll
|
|
88
|
+
* `GET /v1/runs/:runId`). Absent or `true` → return once the run
|
|
89
|
+
* reaches a terminal or suspended state. A binding that
|
|
90
|
+
* can't run in the background may treat `false` like `true`.
|
|
91
|
+
*/
|
|
92
|
+
readonly wait?: boolean;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export interface InvokeFlowBindingInput {
|
|
96
|
+
readonly tenantId: TenantId;
|
|
97
|
+
readonly projectId?: ProjectId;
|
|
98
|
+
readonly flowId: FlowId;
|
|
99
|
+
readonly flowVersion?: Semver;
|
|
100
|
+
readonly input: unknown;
|
|
101
|
+
readonly dryRun?: boolean;
|
|
102
|
+
/**
|
|
103
|
+
* `false` → return the run id as soon as the run exists and finish it
|
|
104
|
+
* in the background (the route answers `202`; callers poll
|
|
105
|
+
* `GET /v1/runs/:runId`). Absent or `true` → return once the run
|
|
106
|
+
* reaches a terminal or suspended state. A binding that
|
|
107
|
+
* can't run in the background may treat `false` like `true`.
|
|
108
|
+
*/
|
|
109
|
+
readonly wait?: boolean;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export type RunHandlerOutcome =
|
|
113
|
+
| { readonly kind: 'ok'; readonly runId: RunId }
|
|
114
|
+
| { readonly kind: 'err'; readonly error: RunHandlerFailure };
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Domain error surfaced by the binding. `code` should be a value the
|
|
118
|
+
* error mapper knows how to translate (e.g. `agent-not-found`,
|
|
119
|
+
* `bad-input`, `unresolved-tool`, `guardrail-violation`). Unknown
|
|
120
|
+
* codes fall through to 500.
|
|
121
|
+
*/
|
|
122
|
+
export interface RunHandlerFailure {
|
|
123
|
+
readonly code: string;
|
|
124
|
+
readonly message: string;
|
|
125
|
+
/**
|
|
126
|
+
* The domain error's structured fields — sent as the wire error's
|
|
127
|
+
* `details`, which clients hydrate into typed errors. A binding
|
|
128
|
+
* forwards them as-is: for `guardrail-violation`, `violations` and
|
|
129
|
+
* `evaluationErrors` from `@kindgi/agents`' `GuardrailViolationError`.
|
|
130
|
+
*/
|
|
131
|
+
readonly details?: Readonly<Record<string, unknown>>;
|
|
132
|
+
}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
// Copyright (C) 2026 Kindgi Inc.
|
|
3
|
+
|
|
4
|
+
//
|
|
5
|
+
// HITL binding surface — types + `HitlBinding` interface consumed by
|
|
6
|
+
// the approvals routes. Deployments plug in an implementation (the
|
|
7
|
+
// Kindgi runtime provides one); @kindgi/api never touches HITL storage
|
|
8
|
+
// directly.
|
|
9
|
+
//
|
|
10
|
+
|
|
11
|
+
import type { ReviewerRole } from '@kindgi/authz';
|
|
12
|
+
import type {
|
|
13
|
+
ApprovalId,
|
|
14
|
+
Cursor,
|
|
15
|
+
ProjectId,
|
|
16
|
+
ProvenanceId,
|
|
17
|
+
Result,
|
|
18
|
+
ReviewerId,
|
|
19
|
+
RunId,
|
|
20
|
+
TenantId,
|
|
21
|
+
Timestamp,
|
|
22
|
+
} from '@kindgi/types';
|
|
23
|
+
|
|
24
|
+
// ---------- domain type surface ----------
|
|
25
|
+
|
|
26
|
+
export type ApprovalStatus =
|
|
27
|
+
| 'pending'
|
|
28
|
+
| 'assigned'
|
|
29
|
+
| 'in_review'
|
|
30
|
+
| 'approved'
|
|
31
|
+
| 'rejected'
|
|
32
|
+
| 'escalated'
|
|
33
|
+
| 'expired'
|
|
34
|
+
| 'withdrawn';
|
|
35
|
+
|
|
36
|
+
export type ReviewDecisionKind = 'approve' | 'reject' | 'escalate' | 'withdraw';
|
|
37
|
+
|
|
38
|
+
export interface Approval {
|
|
39
|
+
readonly id: ApprovalId;
|
|
40
|
+
readonly tenantId: TenantId;
|
|
41
|
+
readonly projectId?: ProjectId;
|
|
42
|
+
readonly subjectKind: string;
|
|
43
|
+
readonly subjectRef: Readonly<Record<string, unknown>>;
|
|
44
|
+
readonly requiredRole: ReviewerRole;
|
|
45
|
+
readonly status: ApprovalStatus;
|
|
46
|
+
readonly assignedTo?: ReviewerId;
|
|
47
|
+
readonly batchKey?: string;
|
|
48
|
+
readonly title?: string;
|
|
49
|
+
readonly description?: string;
|
|
50
|
+
readonly context?: Readonly<Record<string, unknown>>;
|
|
51
|
+
readonly provenanceRef?: {
|
|
52
|
+
readonly runId: RunId;
|
|
53
|
+
readonly provenanceId?: ProvenanceId;
|
|
54
|
+
};
|
|
55
|
+
readonly waitTokenId?: string;
|
|
56
|
+
readonly createdAt: Timestamp;
|
|
57
|
+
readonly updatedAt: Timestamp;
|
|
58
|
+
readonly decidedAt?: Timestamp;
|
|
59
|
+
readonly expiresAt?: Timestamp;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export interface ReviewDecision {
|
|
63
|
+
readonly id: string;
|
|
64
|
+
readonly tenantId: TenantId;
|
|
65
|
+
readonly approvalId: ApprovalId;
|
|
66
|
+
readonly reviewerId: ReviewerId;
|
|
67
|
+
readonly decision: ReviewDecisionKind;
|
|
68
|
+
readonly rationale?: string;
|
|
69
|
+
readonly evidence?: Readonly<Record<string, unknown>>;
|
|
70
|
+
readonly reviewerRoleAtDecision: ReviewerRole;
|
|
71
|
+
readonly decidedAt: Timestamp;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// ---------- method inputs / outputs ----------
|
|
75
|
+
|
|
76
|
+
export interface ListApprovalsBindingInput {
|
|
77
|
+
readonly tenantId: TenantId;
|
|
78
|
+
readonly limit: number;
|
|
79
|
+
readonly status?: ApprovalStatus;
|
|
80
|
+
readonly requiredRole?: ReviewerRole;
|
|
81
|
+
readonly since?: Timestamp;
|
|
82
|
+
readonly cursor?: Cursor;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export interface ListApprovalsBindingResult {
|
|
86
|
+
readonly approvals: readonly Approval[];
|
|
87
|
+
readonly nextCursor?: Cursor;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export interface SubmitReviewBindingInput {
|
|
91
|
+
readonly tenantId: TenantId;
|
|
92
|
+
readonly approvalId: ApprovalId;
|
|
93
|
+
readonly reviewerId: ReviewerId;
|
|
94
|
+
readonly decision: ReviewDecisionKind;
|
|
95
|
+
readonly rationale?: string;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Two shapes: `terminal` — reviewer's decision terminated the approval;
|
|
100
|
+
* `escalated` — a new higher-tier approval was opened. Consumers narrow
|
|
101
|
+
* `nextApproval` via the discriminant.
|
|
102
|
+
*/
|
|
103
|
+
export type SubmitReviewBindingResult =
|
|
104
|
+
| { readonly kind: 'terminal'; readonly approval: Approval; readonly decision: ReviewDecision }
|
|
105
|
+
| {
|
|
106
|
+
readonly kind: 'escalated';
|
|
107
|
+
readonly approval: Approval;
|
|
108
|
+
readonly decision: ReviewDecision;
|
|
109
|
+
readonly nextApproval: Approval;
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* A single review-decision row hydrated for the audit-bundle route.
|
|
114
|
+
* `null` = the approval terminated without a recorded decision (e.g.
|
|
115
|
+
* status `expired`).
|
|
116
|
+
*/
|
|
117
|
+
export interface ReviewDecisionRecord {
|
|
118
|
+
readonly decision: ReviewDecisionKind;
|
|
119
|
+
readonly reviewerId: ReviewerId;
|
|
120
|
+
readonly reviewerRoleAtDecision: ReviewerRole;
|
|
121
|
+
readonly decidedAt: Timestamp;
|
|
122
|
+
readonly rationale?: string;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// ---------- error shape ----------
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Structural error surface returned by `HitlBinding` methods.
|
|
129
|
+
* Implementations emit these codes (`approval-not-found`,
|
|
130
|
+
* `reviewer-not-found`, `reviewer-deactivated`, `insufficient-role`,
|
|
131
|
+
* `approval-terminal`, `approval-already-decided`, `invalid-transition`,
|
|
132
|
+
* `persistence-error`) — the routes pass them through to `statusFor()` /
|
|
133
|
+
* `toWireError()`, which key off the string.
|
|
134
|
+
*/
|
|
135
|
+
export interface HitlBindingError {
|
|
136
|
+
readonly code: string;
|
|
137
|
+
readonly message: string;
|
|
138
|
+
readonly [key: string]: unknown;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
// ---------- binding ----------
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Approvals data-access binding. Every method takes typed inputs and
|
|
145
|
+
* returns `Promise<Result<T, HitlBindingError>>`. The implementation
|
|
146
|
+
* owns its storage, so callers never touch it directly; the Kindgi
|
|
147
|
+
* runtime provides one.
|
|
148
|
+
*/
|
|
149
|
+
export interface HitlBinding {
|
|
150
|
+
getApproval(
|
|
151
|
+
tenantId: TenantId,
|
|
152
|
+
approvalId: ApprovalId,
|
|
153
|
+
): Promise<Result<Approval, HitlBindingError>>;
|
|
154
|
+
|
|
155
|
+
listApprovals(
|
|
156
|
+
input: ListApprovalsBindingInput,
|
|
157
|
+
): Promise<Result<ListApprovalsBindingResult, HitlBindingError>>;
|
|
158
|
+
|
|
159
|
+
submitReview(
|
|
160
|
+
input: SubmitReviewBindingInput,
|
|
161
|
+
): Promise<Result<SubmitReviewBindingResult, HitlBindingError>>;
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Hydrate the recorded decision row for an approval — used by the
|
|
165
|
+
* audit-bundle route. Returns `null` when the approval terminated
|
|
166
|
+
* without a recorded decision (status `expired`).
|
|
167
|
+
*/
|
|
168
|
+
loadReviewDecision(
|
|
169
|
+
tenantId: TenantId,
|
|
170
|
+
approvalId: ApprovalId,
|
|
171
|
+
): Promise<Result<ReviewDecisionRecord | null, HitlBindingError>>;
|
|
172
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
// Copyright (C) 2026 Kindgi Inc.
|
|
3
|
+
|
|
4
|
+
import type { Cursor, TenantId, Timestamp, UserId } from '@kindgi/types';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Caller-plugged surface for the tenant-scoped identity directory —
|
|
8
|
+
* part of the admin control plane. Closes the "who is my
|
|
9
|
+
* user" gap the session-auth flow leaves open: the session store
|
|
10
|
+
* (`SessionStoreBinding`) knows about the sessions a user has, and the
|
|
11
|
+
* identity provider (`IdentityProviderBinding`) knows how to
|
|
12
|
+
* authenticate them, but neither answers the "list every user in this
|
|
13
|
+
* tenant" / "show me a user's profile" / "revoke all a user's active
|
|
14
|
+
* sessions" question this binding covers.
|
|
15
|
+
*
|
|
16
|
+
* Registry-only over HTTP — the framework does NOT own user
|
|
17
|
+
* persistence. Deployments plug in an LDAP / SCIM / IdP-mirror /
|
|
18
|
+
* bespoke store behind this binding.
|
|
19
|
+
*
|
|
20
|
+
* Same caller-plugged pattern as every other admin-plane binding
|
|
21
|
+
* (`PolicyRegistryBinding`, `ProviderRegistryBinding`, ...).
|
|
22
|
+
*
|
|
23
|
+
* The directory is flat. Groups / roles / RBAC / invitations /
|
|
24
|
+
* audit history / LDAP+SCIM sync / impersonation are not part of this
|
|
25
|
+
* binding.
|
|
26
|
+
*/
|
|
27
|
+
export interface IdentityDirectoryBinding {
|
|
28
|
+
/**
|
|
29
|
+
* Look up a specific user by id. Returns `null` when unknown —
|
|
30
|
+
* the route surfaces `null` as `404 identity-user-not-found`.
|
|
31
|
+
*/
|
|
32
|
+
getUser(input: IdentityGetUserInput): Promise<UserRecord | null>;
|
|
33
|
+
/**
|
|
34
|
+
* Cursor-paginated list of users in the tenant. Optional `query`
|
|
35
|
+
* is a prefix match on `displayName` — the natural filter shape
|
|
36
|
+
* for a "search users" surface. Sort order is binding-defined (e.g.
|
|
37
|
+
* ascending by `userId`).
|
|
38
|
+
*/
|
|
39
|
+
listUsers(input: IdentityListUsersInput): Promise<UserCollectionPage>;
|
|
40
|
+
/**
|
|
41
|
+
* List the active (non-revoked, non-expired) sessions for a user.
|
|
42
|
+
* Implementations may return the full list; `nextCursor` is optional
|
|
43
|
+
* on the response, so an implementation can paginate without a wire
|
|
44
|
+
* change.
|
|
45
|
+
*
|
|
46
|
+
* When the user id is unknown, an empty list is returned rather
|
|
47
|
+
* than a not-found. Callers who need the distinction should call
|
|
48
|
+
* `getUser` first.
|
|
49
|
+
*/
|
|
50
|
+
listSessions(input: IdentityListSessionsInput): Promise<SessionSummaryPage>;
|
|
51
|
+
/**
|
|
52
|
+
* Admin op: revoke every active session for a user. Returns the
|
|
53
|
+
* count of sessions revoked (0 when the user was already fully
|
|
54
|
+
* signed out — idempotent). Under the hood, deployments typically
|
|
55
|
+
* delegate to `SessionStoreBinding.revokeAllForUser`.
|
|
56
|
+
*/
|
|
57
|
+
revokeAllSessions(input: IdentityRevokeSessionsInput): Promise<RevokeSessionsResult>;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export interface IdentityGetUserInput {
|
|
61
|
+
readonly tenantId: TenantId;
|
|
62
|
+
readonly userId: UserId;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface IdentityListUsersInput {
|
|
66
|
+
readonly tenantId: TenantId;
|
|
67
|
+
readonly limit: number;
|
|
68
|
+
readonly cursor?: Cursor;
|
|
69
|
+
/** Prefix match on `UserRecord.displayName`. Undefined = no filter. */
|
|
70
|
+
readonly query?: string;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export interface IdentityListSessionsInput {
|
|
74
|
+
readonly tenantId: TenantId;
|
|
75
|
+
readonly userId: UserId;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export interface IdentityRevokeSessionsInput {
|
|
79
|
+
readonly tenantId: TenantId;
|
|
80
|
+
readonly userId: UserId;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* The tenant-scoped user record on the wire. `primaryEmail` may be
|
|
85
|
+
* redacted by the binding based on tenant policy — the routes treat
|
|
86
|
+
* the field as opaque and return whatever the binding hands back.
|
|
87
|
+
* `metadata` is free-form JSON (e.g. IdP claims, provisioning source,
|
|
88
|
+
* roles).
|
|
89
|
+
*/
|
|
90
|
+
export interface UserRecord {
|
|
91
|
+
readonly userId: UserId;
|
|
92
|
+
readonly tenantId: TenantId;
|
|
93
|
+
readonly primaryEmail?: string;
|
|
94
|
+
readonly displayName?: string;
|
|
95
|
+
readonly createdAt: Timestamp;
|
|
96
|
+
readonly lastActiveAt?: Timestamp;
|
|
97
|
+
readonly metadata?: Readonly<Record<string, unknown>>;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export interface UserCollectionPage {
|
|
101
|
+
readonly data: readonly UserRecord[];
|
|
102
|
+
readonly nextCursor?: Cursor;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Wire-safe subset of `Session` (from `session-store-binding.ts`).
|
|
107
|
+
* Excludes the opaque provider `accessToken` / `refreshToken` — those
|
|
108
|
+
* never cross the wire, even to admins.
|
|
109
|
+
*/
|
|
110
|
+
export interface SessionSummary {
|
|
111
|
+
readonly sessionId: string;
|
|
112
|
+
readonly userId: UserId;
|
|
113
|
+
readonly providerId: string;
|
|
114
|
+
readonly createdAt: Timestamp;
|
|
115
|
+
readonly expiresAt: Timestamp;
|
|
116
|
+
readonly scopes: readonly string[];
|
|
117
|
+
readonly revokedAt?: Timestamp;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export interface SessionSummaryPage {
|
|
121
|
+
readonly data: readonly SessionSummary[];
|
|
122
|
+
readonly nextCursor?: Cursor;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export interface RevokeSessionsResult {
|
|
126
|
+
readonly userId: UserId;
|
|
127
|
+
readonly revokedCount: number;
|
|
128
|
+
}
|