@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,115 @@
|
|
|
1
|
+
import type { ReviewerRole } from '@kindgi/authz';
|
|
2
|
+
import type { ApprovalId, Cursor, ProjectId, ProvenanceId, Result, ReviewerId, RunId, TenantId, Timestamp } from '@kindgi/types';
|
|
3
|
+
export type ApprovalStatus = 'pending' | 'assigned' | 'in_review' | 'approved' | 'rejected' | 'escalated' | 'expired' | 'withdrawn';
|
|
4
|
+
export type ReviewDecisionKind = 'approve' | 'reject' | 'escalate' | 'withdraw';
|
|
5
|
+
export interface Approval {
|
|
6
|
+
readonly id: ApprovalId;
|
|
7
|
+
readonly tenantId: TenantId;
|
|
8
|
+
readonly projectId?: ProjectId;
|
|
9
|
+
readonly subjectKind: string;
|
|
10
|
+
readonly subjectRef: Readonly<Record<string, unknown>>;
|
|
11
|
+
readonly requiredRole: ReviewerRole;
|
|
12
|
+
readonly status: ApprovalStatus;
|
|
13
|
+
readonly assignedTo?: ReviewerId;
|
|
14
|
+
readonly batchKey?: string;
|
|
15
|
+
readonly title?: string;
|
|
16
|
+
readonly description?: string;
|
|
17
|
+
readonly context?: Readonly<Record<string, unknown>>;
|
|
18
|
+
readonly provenanceRef?: {
|
|
19
|
+
readonly runId: RunId;
|
|
20
|
+
readonly provenanceId?: ProvenanceId;
|
|
21
|
+
};
|
|
22
|
+
readonly waitTokenId?: string;
|
|
23
|
+
readonly createdAt: Timestamp;
|
|
24
|
+
readonly updatedAt: Timestamp;
|
|
25
|
+
readonly decidedAt?: Timestamp;
|
|
26
|
+
readonly expiresAt?: Timestamp;
|
|
27
|
+
}
|
|
28
|
+
export interface ReviewDecision {
|
|
29
|
+
readonly id: string;
|
|
30
|
+
readonly tenantId: TenantId;
|
|
31
|
+
readonly approvalId: ApprovalId;
|
|
32
|
+
readonly reviewerId: ReviewerId;
|
|
33
|
+
readonly decision: ReviewDecisionKind;
|
|
34
|
+
readonly rationale?: string;
|
|
35
|
+
readonly evidence?: Readonly<Record<string, unknown>>;
|
|
36
|
+
readonly reviewerRoleAtDecision: ReviewerRole;
|
|
37
|
+
readonly decidedAt: Timestamp;
|
|
38
|
+
}
|
|
39
|
+
export interface ListApprovalsBindingInput {
|
|
40
|
+
readonly tenantId: TenantId;
|
|
41
|
+
readonly limit: number;
|
|
42
|
+
readonly status?: ApprovalStatus;
|
|
43
|
+
readonly requiredRole?: ReviewerRole;
|
|
44
|
+
readonly since?: Timestamp;
|
|
45
|
+
readonly cursor?: Cursor;
|
|
46
|
+
}
|
|
47
|
+
export interface ListApprovalsBindingResult {
|
|
48
|
+
readonly approvals: readonly Approval[];
|
|
49
|
+
readonly nextCursor?: Cursor;
|
|
50
|
+
}
|
|
51
|
+
export interface SubmitReviewBindingInput {
|
|
52
|
+
readonly tenantId: TenantId;
|
|
53
|
+
readonly approvalId: ApprovalId;
|
|
54
|
+
readonly reviewerId: ReviewerId;
|
|
55
|
+
readonly decision: ReviewDecisionKind;
|
|
56
|
+
readonly rationale?: string;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Two shapes: `terminal` — reviewer's decision terminated the approval;
|
|
60
|
+
* `escalated` — a new higher-tier approval was opened. Consumers narrow
|
|
61
|
+
* `nextApproval` via the discriminant.
|
|
62
|
+
*/
|
|
63
|
+
export type SubmitReviewBindingResult = {
|
|
64
|
+
readonly kind: 'terminal';
|
|
65
|
+
readonly approval: Approval;
|
|
66
|
+
readonly decision: ReviewDecision;
|
|
67
|
+
} | {
|
|
68
|
+
readonly kind: 'escalated';
|
|
69
|
+
readonly approval: Approval;
|
|
70
|
+
readonly decision: ReviewDecision;
|
|
71
|
+
readonly nextApproval: Approval;
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* A single review-decision row hydrated for the audit-bundle route.
|
|
75
|
+
* `null` = the approval terminated without a recorded decision (e.g.
|
|
76
|
+
* status `expired`).
|
|
77
|
+
*/
|
|
78
|
+
export interface ReviewDecisionRecord {
|
|
79
|
+
readonly decision: ReviewDecisionKind;
|
|
80
|
+
readonly reviewerId: ReviewerId;
|
|
81
|
+
readonly reviewerRoleAtDecision: ReviewerRole;
|
|
82
|
+
readonly decidedAt: Timestamp;
|
|
83
|
+
readonly rationale?: string;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Structural error surface returned by `HitlBinding` methods.
|
|
87
|
+
* Implementations emit these codes (`approval-not-found`,
|
|
88
|
+
* `reviewer-not-found`, `reviewer-deactivated`, `insufficient-role`,
|
|
89
|
+
* `approval-terminal`, `approval-already-decided`, `invalid-transition`,
|
|
90
|
+
* `persistence-error`) — the routes pass them through to `statusFor()` /
|
|
91
|
+
* `toWireError()`, which key off the string.
|
|
92
|
+
*/
|
|
93
|
+
export interface HitlBindingError {
|
|
94
|
+
readonly code: string;
|
|
95
|
+
readonly message: string;
|
|
96
|
+
readonly [key: string]: unknown;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Approvals data-access binding. Every method takes typed inputs and
|
|
100
|
+
* returns `Promise<Result<T, HitlBindingError>>`. The implementation
|
|
101
|
+
* owns its storage, so callers never touch it directly; the Kindgi
|
|
102
|
+
* runtime provides one.
|
|
103
|
+
*/
|
|
104
|
+
export interface HitlBinding {
|
|
105
|
+
getApproval(tenantId: TenantId, approvalId: ApprovalId): Promise<Result<Approval, HitlBindingError>>;
|
|
106
|
+
listApprovals(input: ListApprovalsBindingInput): Promise<Result<ListApprovalsBindingResult, HitlBindingError>>;
|
|
107
|
+
submitReview(input: SubmitReviewBindingInput): Promise<Result<SubmitReviewBindingResult, HitlBindingError>>;
|
|
108
|
+
/**
|
|
109
|
+
* Hydrate the recorded decision row for an approval — used by the
|
|
110
|
+
* audit-bundle route. Returns `null` when the approval terminated
|
|
111
|
+
* without a recorded decision (status `expired`).
|
|
112
|
+
*/
|
|
113
|
+
loadReviewDecision(tenantId: TenantId, approvalId: ApprovalId): Promise<Result<ReviewDecisionRecord | null, HitlBindingError>>;
|
|
114
|
+
}
|
|
115
|
+
//# s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;AACH,MAAM,WAAW,WAAW;IAC1B,WAAW,CACT,QAAQ,EAAE,QAAQ,EAClB,UAAU,EAAE,UAAU,GACrB,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAC,CAAC;IAE/C,aAAa,CACX,KAAK,EAAE,yBAAyB,GAC/B,OAAO,CAAC,MAAM,CAAC,0BAA0B,EAAE,gBAAgB,CAAC,CAAC,CAAC;IAEjE,YAAY,CACV,KAAK,EAAE,wBAAwB,GAC9B,OAAO,CAAC,MAAM,CAAC,yBAAyB,EAAE,gBAAgB,CAAC,CAAC,CAAC;IAEhE;;;;OAIG;IACH,kBAAkB,CAChB,QAAQ,EAAE,QAAQ,EAClB,UAAU,EAAE,UAAU,GACrB,OAAO,CAAC,MAAM,CAAC,oBAAoB,GAAG,IAAI,EAAE,gBAAgB,CAAC,CAAC,CAAC;CACnE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hitl-binding.js","sourceRoot":"","sources":["../src/hitl-binding.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,iCAAiC"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import type { Cursor, TenantId, Timestamp, UserId } from '@kindgi/types';
|
|
2
|
+
/**
|
|
3
|
+
* Caller-plugged surface for the tenant-scoped identity directory —
|
|
4
|
+
* part of the admin control plane. Closes the "who is my
|
|
5
|
+
* user" gap the session-auth flow leaves open: the session store
|
|
6
|
+
* (`SessionStoreBinding`) knows about the sessions a user has, and the
|
|
7
|
+
* identity provider (`IdentityProviderBinding`) knows how to
|
|
8
|
+
* authenticate them, but neither answers the "list every user in this
|
|
9
|
+
* tenant" / "show me a user's profile" / "revoke all a user's active
|
|
10
|
+
* sessions" question this binding covers.
|
|
11
|
+
*
|
|
12
|
+
* Registry-only over HTTP — the framework does NOT own user
|
|
13
|
+
* persistence. Deployments plug in an LDAP / SCIM / IdP-mirror /
|
|
14
|
+
* bespoke store behind this binding.
|
|
15
|
+
*
|
|
16
|
+
* Same caller-plugged pattern as every other admin-plane binding
|
|
17
|
+
* (`PolicyRegistryBinding`, `ProviderRegistryBinding`, ...).
|
|
18
|
+
*
|
|
19
|
+
* The directory is flat. Groups / roles / RBAC / invitations /
|
|
20
|
+
* audit history / LDAP+SCIM sync / impersonation are not part of this
|
|
21
|
+
* binding.
|
|
22
|
+
*/
|
|
23
|
+
export interface IdentityDirectoryBinding {
|
|
24
|
+
/**
|
|
25
|
+
* Look up a specific user by id. Returns `null` when unknown —
|
|
26
|
+
* the route surfaces `null` as `404 identity-user-not-found`.
|
|
27
|
+
*/
|
|
28
|
+
getUser(input: IdentityGetUserInput): Promise<UserRecord | null>;
|
|
29
|
+
/**
|
|
30
|
+
* Cursor-paginated list of users in the tenant. Optional `query`
|
|
31
|
+
* is a prefix match on `displayName` — the natural filter shape
|
|
32
|
+
* for a "search users" surface. Sort order is binding-defined (e.g.
|
|
33
|
+
* ascending by `userId`).
|
|
34
|
+
*/
|
|
35
|
+
listUsers(input: IdentityListUsersInput): Promise<UserCollectionPage>;
|
|
36
|
+
/**
|
|
37
|
+
* List the active (non-revoked, non-expired) sessions for a user.
|
|
38
|
+
* Implementations may return the full list; `nextCursor` is optional
|
|
39
|
+
* on the response, so an implementation can paginate without a wire
|
|
40
|
+
* change.
|
|
41
|
+
*
|
|
42
|
+
* When the user id is unknown, an empty list is returned rather
|
|
43
|
+
* than a not-found. Callers who need the distinction should call
|
|
44
|
+
* `getUser` first.
|
|
45
|
+
*/
|
|
46
|
+
listSessions(input: IdentityListSessionsInput): Promise<SessionSummaryPage>;
|
|
47
|
+
/**
|
|
48
|
+
* Admin op: revoke every active session for a user. Returns the
|
|
49
|
+
* count of sessions revoked (0 when the user was already fully
|
|
50
|
+
* signed out — idempotent). Under the hood, deployments typically
|
|
51
|
+
* delegate to `SessionStoreBinding.revokeAllForUser`.
|
|
52
|
+
*/
|
|
53
|
+
revokeAllSessions(input: IdentityRevokeSessionsInput): Promise<RevokeSessionsResult>;
|
|
54
|
+
}
|
|
55
|
+
export interface IdentityGetUserInput {
|
|
56
|
+
readonly tenantId: TenantId;
|
|
57
|
+
readonly userId: UserId;
|
|
58
|
+
}
|
|
59
|
+
export interface IdentityListUsersInput {
|
|
60
|
+
readonly tenantId: TenantId;
|
|
61
|
+
readonly limit: number;
|
|
62
|
+
readonly cursor?: Cursor;
|
|
63
|
+
/** Prefix match on `UserRecord.displayName`. Undefined = no filter. */
|
|
64
|
+
readonly query?: string;
|
|
65
|
+
}
|
|
66
|
+
export interface IdentityListSessionsInput {
|
|
67
|
+
readonly tenantId: TenantId;
|
|
68
|
+
readonly userId: UserId;
|
|
69
|
+
}
|
|
70
|
+
export interface IdentityRevokeSessionsInput {
|
|
71
|
+
readonly tenantId: TenantId;
|
|
72
|
+
readonly userId: UserId;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* The tenant-scoped user record on the wire. `primaryEmail` may be
|
|
76
|
+
* redacted by the binding based on tenant policy — the routes treat
|
|
77
|
+
* the field as opaque and return whatever the binding hands back.
|
|
78
|
+
* `metadata` is free-form JSON (e.g. IdP claims, provisioning source,
|
|
79
|
+
* roles).
|
|
80
|
+
*/
|
|
81
|
+
export interface UserRecord {
|
|
82
|
+
readonly userId: UserId;
|
|
83
|
+
readonly tenantId: TenantId;
|
|
84
|
+
readonly primaryEmail?: string;
|
|
85
|
+
readonly displayName?: string;
|
|
86
|
+
readonly createdAt: Timestamp;
|
|
87
|
+
readonly lastActiveAt?: Timestamp;
|
|
88
|
+
readonly metadata?: Readonly<Record<string, unknown>>;
|
|
89
|
+
}
|
|
90
|
+
export interface UserCollectionPage {
|
|
91
|
+
readonly data: readonly UserRecord[];
|
|
92
|
+
readonly nextCursor?: Cursor;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Wire-safe subset of `Session` (from `session-store-binding.ts`).
|
|
96
|
+
* Excludes the opaque provider `accessToken` / `refreshToken` — those
|
|
97
|
+
* never cross the wire, even to admins.
|
|
98
|
+
*/
|
|
99
|
+
export interface SessionSummary {
|
|
100
|
+
readonly sessionId: string;
|
|
101
|
+
readonly userId: UserId;
|
|
102
|
+
readonly providerId: string;
|
|
103
|
+
readonly createdAt: Timestamp;
|
|
104
|
+
readonly expiresAt: Timestamp;
|
|
105
|
+
readonly scopes: readonly string[];
|
|
106
|
+
readonly revokedAt?: Timestamp;
|
|
107
|
+
}
|
|
108
|
+
export interface SessionSummaryPage {
|
|
109
|
+
readonly data: readonly SessionSummary[];
|
|
110
|
+
readonly nextCursor?: Cursor;
|
|
111
|
+
}
|
|
112
|
+
export interface RevokeSessionsResult {
|
|
113
|
+
readonly userId: UserId;
|
|
114
|
+
readonly revokedCount: number;
|
|
115
|
+
}
|
|
116
|
+
//# sourceMappingURL=identity-directory-binding.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identity-directory-binding.d.ts","sourceRoot":"","sources":["../src/identity-directory-binding.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEzE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,WAAW,wBAAwB;IACvC;;;OAGG;IACH,OAAO,CAAC,KAAK,EAAE,oBAAoB,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAAC;IACjE;;;;;OAKG;IACH,SAAS,CAAC,KAAK,EAAE,sBAAsB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;IACtE;;;;;;;;;OASG;IACH,YAAY,CAAC,KAAK,EAAE,yBAAyB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAC5E;;;;;OAKG;IACH,iBAAiB,CAAC,KAAK,EAAE,2BAA2B,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;CACtF;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B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AAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,CAAC;CAChC;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,IAAI,EAAE,SAAS,cAAc,EAAE,CAAC;IACzC,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;CAC/B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identity-directory-binding.js","sourceRoot":"","sources":["../src/identity-directory-binding.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,iCAAiC"}
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import type { TenantId } from '@kindgi/types';
|
|
2
|
+
/**
|
|
3
|
+
* Caller-plugged catalog of OAuth 2.0 / OIDC identity providers the
|
|
4
|
+
* deployment offers to its tenants. Same pattern as
|
|
5
|
+
* `ProviderRegistryBinding` (model providers) — the API package does
|
|
6
|
+
* NOT own provider persistence, and secrets never cross the wire.
|
|
7
|
+
*
|
|
8
|
+
* A `ProviderConfig` carries ONLY a `clientSecretRef` — an opaque
|
|
9
|
+
* pointer that the deployment resolves server-side (env-var lookup,
|
|
10
|
+
* secrets-manager path, KMS handle, etc.). The plaintext client secret
|
|
11
|
+
* is exchanged with the identity provider inside the deployment's
|
|
12
|
+
* boundary during the code→token exchange in `/v1/auth/callback` and
|
|
13
|
+
* never surfaces on any HTTP response.
|
|
14
|
+
*
|
|
15
|
+
* PKCE is mandatory (S256). Providers that don't support PKCE are
|
|
16
|
+
* rejected at boot; the framework does NOT emit `code_challenge_method`
|
|
17
|
+
* negotiation.
|
|
18
|
+
*/
|
|
19
|
+
export interface IdentityProviderBinding {
|
|
20
|
+
list(input: IdentityProviderListInput): Promise<IdentityProviderPage>;
|
|
21
|
+
get(input: IdentityProviderGetInput): Promise<ProviderConfig | null>;
|
|
22
|
+
register(input: IdentityProviderRegisterInput): Promise<IdentityProviderRegisterOutcome>;
|
|
23
|
+
unregister(input: IdentityProviderUnregisterInput): Promise<IdentityProviderUnregisterOutcome>;
|
|
24
|
+
}
|
|
25
|
+
export type IdentityProviderKind = 'oauth2' | 'oidc';
|
|
26
|
+
export interface ProviderConfig {
|
|
27
|
+
/** Stable string chosen by the deployment (e.g. `acme-sso`, `globex-oidc`). */
|
|
28
|
+
readonly providerId: string;
|
|
29
|
+
readonly kind: IdentityProviderKind;
|
|
30
|
+
readonly clientId: string;
|
|
31
|
+
/**
|
|
32
|
+
* Opaque pointer resolved server-side. Never a plaintext secret. The
|
|
33
|
+
* shape (env-var name / secrets-manager path / KMS handle) is a
|
|
34
|
+
* deployment convention, not a framework one.
|
|
35
|
+
*/
|
|
36
|
+
readonly clientSecretRef: string;
|
|
37
|
+
readonly authorizationEndpoint: string;
|
|
38
|
+
readonly tokenEndpoint: string;
|
|
39
|
+
readonly userinfoEndpoint?: string;
|
|
40
|
+
readonly scopes: readonly string[];
|
|
41
|
+
/**
|
|
42
|
+
* OAuth 2.1 BCP redirect-URI allowlist. When present and non-empty,
|
|
43
|
+
* `POST /v1/auth/login/:providerId` rejects any `redirectUri` (whether
|
|
44
|
+
* supplied in the body or resolved from `metadata.defaultRedirectUri`)
|
|
45
|
+
* that is not an exact match to a list entry — 400
|
|
46
|
+
* `redirect-uri-not-allowed`. `POST /v1/auth/callback/:providerId`
|
|
47
|
+
* cross-checks the state row's stored `redirect_uri` against the same
|
|
48
|
+
* list — 400 `redirect-uri-mismatch` if the allowlist was tightened
|
|
49
|
+
* between login and callback. Absent or empty → any redirect_uri is
|
|
50
|
+
* accepted (pass-through; deployments MUST populate
|
|
51
|
+
* this to reach OAuth 2.1 BCP compliance).
|
|
52
|
+
*
|
|
53
|
+
* Exact-string match, not prefix or regex — the OAuth 2.1 BCP
|
|
54
|
+
* mandates literal comparison to prevent redirect-URI injection.
|
|
55
|
+
*/
|
|
56
|
+
readonly allowedRedirectUris?: readonly string[];
|
|
57
|
+
/**
|
|
58
|
+
* Optional per-provider claim mapping. When present, the `ExchangeCodeFn`
|
|
59
|
+
* / `RefreshTokenFn` implementations translate provider claims into the
|
|
60
|
+
* Kindgi `Session` shape according to this spec. Absent → pass-
|
|
61
|
+
* through (provider `sub` → `userId`, `email` → `email`, `name` →
|
|
62
|
+
* `displayName`, scopes come from the token response). A deployment's
|
|
63
|
+
* own `ExchangeCodeFn` MAY honor this field the same way.
|
|
64
|
+
*/
|
|
65
|
+
readonly claimMapping?: ClaimMappingSpec;
|
|
66
|
+
readonly metadata?: Record<string, unknown>;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* How provider claims map into Kindgi's session shape. All fields
|
|
70
|
+
* are optional — the closer a provider's claim naming is to the OIDC
|
|
71
|
+
* defaults (`sub` / `email` / `name`), the fewer overrides the
|
|
72
|
+
* deployment needs. Field values are dot-path claim references
|
|
73
|
+
* relative to the provider's userinfo / id_token payload:
|
|
74
|
+
*
|
|
75
|
+
* - `"sub"` reads top-level `sub`.
|
|
76
|
+
* - `"profile.email"` reads `payload.profile.email` (dot-navigated).
|
|
77
|
+
* - `"https://acme.com/roles"` reads the raw claim under that URI-
|
|
78
|
+
* shaped key (namespaced custom claims — no dot navigation).
|
|
79
|
+
*
|
|
80
|
+
* The scopes case is a discriminated shape because scope claims in
|
|
81
|
+
* the wild come as either space-separated strings, comma-separated,
|
|
82
|
+
* or a JSON array — the `delimiter` field lets deployments say how to
|
|
83
|
+
* split. When omitted (or the resolved claim is already an array),
|
|
84
|
+
* splitting is skipped.
|
|
85
|
+
*/
|
|
86
|
+
export interface ClaimMappingSpec {
|
|
87
|
+
/** Provider claim path for the Kindgi `userId`. Default: `sub`. */
|
|
88
|
+
readonly userId?: string;
|
|
89
|
+
/** Provider claim path for the caller's email. Default: `email`. */
|
|
90
|
+
readonly email?: string;
|
|
91
|
+
/** Provider claim path for the caller's display name. Default: `name`. */
|
|
92
|
+
readonly displayName?: string;
|
|
93
|
+
/**
|
|
94
|
+
* Provider claim path + optional delimiter for the Kindgi OAuth
|
|
95
|
+
* scopes list. When absent, scopes come from the OAuth token
|
|
96
|
+
* response `scope` field, not from claims.
|
|
97
|
+
*/
|
|
98
|
+
readonly scopes?: ClaimMappingScopesSpec;
|
|
99
|
+
/**
|
|
100
|
+
* Extra claim paths to preserve verbatim on `Session.metadata`.
|
|
101
|
+
* Values are copied as-is. Absent → all claims flow through in
|
|
102
|
+
* `metadata`.
|
|
103
|
+
*/
|
|
104
|
+
readonly metadata?: readonly string[];
|
|
105
|
+
}
|
|
106
|
+
export interface ClaimMappingScopesSpec {
|
|
107
|
+
/** Claim path for the raw scopes value. */
|
|
108
|
+
readonly claim: string;
|
|
109
|
+
/**
|
|
110
|
+
* When the resolved claim is a string, split on this delimiter to
|
|
111
|
+
* produce the scopes array. When absent, split on any whitespace.
|
|
112
|
+
* Ignored when the resolved claim is already an array.
|
|
113
|
+
*/
|
|
114
|
+
readonly delimiter?: string;
|
|
115
|
+
}
|
|
116
|
+
export interface IdentityProviderListInput {
|
|
117
|
+
readonly tenantId: TenantId;
|
|
118
|
+
}
|
|
119
|
+
export interface IdentityProviderPage {
|
|
120
|
+
readonly data: readonly ProviderConfig[];
|
|
121
|
+
}
|
|
122
|
+
export interface IdentityProviderGetInput {
|
|
123
|
+
readonly tenantId: TenantId;
|
|
124
|
+
readonly providerId: string;
|
|
125
|
+
}
|
|
126
|
+
export interface IdentityProviderRegisterInput {
|
|
127
|
+
readonly tenantId: TenantId;
|
|
128
|
+
readonly config: ProviderConfig;
|
|
129
|
+
}
|
|
130
|
+
export type IdentityProviderRegisterOutcome = {
|
|
131
|
+
readonly kind: 'ok';
|
|
132
|
+
readonly providerId: string;
|
|
133
|
+
};
|
|
134
|
+
export interface IdentityProviderUnregisterInput {
|
|
135
|
+
readonly tenantId: TenantId;
|
|
136
|
+
readonly providerId: string;
|
|
137
|
+
}
|
|
138
|
+
export interface IdentityProviderUnregisterOutcome {
|
|
139
|
+
readonly unregistered: boolean;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Result of the OAuth code→session exchange the callback route delegates
|
|
143
|
+
* to the identity provider. Distinct from `SessionCreateInput` because
|
|
144
|
+
* the framework decides the `SessionId` (opaque), while the provider
|
|
145
|
+
* decides `userId` / `accessToken` / `scopes`.
|
|
146
|
+
*/
|
|
147
|
+
export interface ExchangeCodeInput {
|
|
148
|
+
readonly tenantId: TenantId;
|
|
149
|
+
readonly providerId: string;
|
|
150
|
+
readonly code: string;
|
|
151
|
+
readonly codeVerifier: string;
|
|
152
|
+
readonly redirectUri: string;
|
|
153
|
+
}
|
|
154
|
+
export interface ExchangeCodeOutcome {
|
|
155
|
+
readonly userId: string;
|
|
156
|
+
readonly accessToken: string;
|
|
157
|
+
readonly refreshToken?: string;
|
|
158
|
+
readonly expiresAt: Date;
|
|
159
|
+
readonly scopes: readonly string[];
|
|
160
|
+
readonly claims?: Record<string, unknown>;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Optional companion binding used by `POST /v1/auth/callback` and
|
|
164
|
+
* `POST /v1/auth/refresh`. Deployments that only implement provider
|
|
165
|
+
* registry CRUD (and want to run the exchange themselves) can inline
|
|
166
|
+
* this closure via `CreateAppInput.exchangeCode`. A typical
|
|
167
|
+
* implementation calls the provider `tokenEndpoint` with PKCE +
|
|
168
|
+
* client-secret client authentication.
|
|
169
|
+
*/
|
|
170
|
+
export type ExchangeCodeFn = (input: ExchangeCodeInput) => Promise<ExchangeCodeOutcome>;
|
|
171
|
+
/**
|
|
172
|
+
* Optional refresh-token exchange. When present, `POST /v1/auth/refresh`
|
|
173
|
+
* rotates the underlying provider tokens before minting a new session
|
|
174
|
+
* token. When absent, the refresh route simply revokes the old session
|
|
175
|
+
* and re-issues a session token with the same expiry (still useful for
|
|
176
|
+
* key rotation on the framework side even when the provider stays put).
|
|
177
|
+
*/
|
|
178
|
+
export interface RefreshTokenInput {
|
|
179
|
+
readonly tenantId: TenantId;
|
|
180
|
+
readonly providerId: string;
|
|
181
|
+
readonly refreshToken: string;
|
|
182
|
+
}
|
|
183
|
+
export type RefreshTokenFn = (input: RefreshTokenInput) => Promise<ExchangeCodeOutcome>;
|
|
184
|
+
//# sourceMappingURL=identity-provider-binding.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identity-provider-binding.d.ts","sourceRoot":"","sources":["../src/identity-provider-binding.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,WAAW,uBAAuB;IACtC,IAAI,CAAC,KAAK,EAAE,yBAAyB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;IACtE,GAAG,CAAC,KAAK,EAAE,wBAAwB,GAAG,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IACrE,QAAQ,CAAC,KAAK,EAAE,6BAA6B,GAAG,OAAO,CAAC,+BAA+B,CAAC,CAAC;IACzF,UAAU,CAAC,KAAK,EAAE,+BAA+B,GAAG,OAAO,CAAC,iCAAiC,CAAC,CAAC;CAChG;AAED,MAAM,MAAM,oBAAoB,GAAG,QAAQ,GAAG,MAAM,CAAC;AAErD,MAAM,WAAW,cAAc;IAC7B,+EAA+E;IAC/E,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,IAAI,EAAE,oBAAoB,CAAC;IACpC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B;;;;OAIG;IACH,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,qB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;;GAMG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;CAC/B;AAED,MAAM,MAAM,cAAc,GAAG,CAAC,KAAK,EAAE,iBAAiB,KAAK,OAAO,CAAC,mBAAmB,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identity-provider-binding.js","sourceRoot":"","sources":["../src/identity-provider-binding.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,iCAAiC"}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import type { Result, TenantId } from '@kindgi/types';
|
|
2
|
+
/**
|
|
3
|
+
* Caller-plugged surface for the OCI image registry — the "Docker
|
|
4
|
+
* Registry HTTP API v2 client" seam used by the deploy route's
|
|
5
|
+
* image-verifiability step. Mirrors the caller-plugged pattern of
|
|
6
|
+
* `BlobStorageBinding`: the API package does NOT own registry auth or
|
|
7
|
+
* connectivity. Deployments plug in an adapter that talks to whichever
|
|
8
|
+
* OCI registry they run — hosted or self-hosted — using the credentials
|
|
9
|
+
* they operate.
|
|
10
|
+
*
|
|
11
|
+
* Three ops per the OCI Distribution Spec:
|
|
12
|
+
* - `head` — read manifest metadata (digest, config, layer
|
|
13
|
+
* digests, size) without pulling bytes. Used at
|
|
14
|
+
* `POST /v1/deployments` to verify the pinned
|
|
15
|
+
* digest exists + matches what the deployer signed.
|
|
16
|
+
* - `extractFile` — pull the bytes of a single file inside the image
|
|
17
|
+
* (typically `/app/index.json`) without downloading
|
|
18
|
+
* every layer. Used by the deploy route to verify
|
|
19
|
+
* `indexHash` matches `sha256(image's index.json)`.
|
|
20
|
+
* - `push` — upload a locally-built image + tag. Used by an
|
|
21
|
+
* image build step; the API only reads.
|
|
22
|
+
*
|
|
23
|
+
* Each method is tenant-scoped so multi-tenant deployments can route
|
|
24
|
+
* different tenants at different registries (or the same registry with
|
|
25
|
+
* per-tenant credentials).
|
|
26
|
+
*
|
|
27
|
+
* ## Seam only
|
|
28
|
+
*
|
|
29
|
+
* No concrete implementation is bundled; the `POST /v1/deployments`
|
|
30
|
+
* route calls `head` + `extractFile` through this interface.
|
|
31
|
+
*/
|
|
32
|
+
export interface ImageRegistryBinding {
|
|
33
|
+
/**
|
|
34
|
+
* Read the OCI image manifest for a digest-pinned reference. Returns
|
|
35
|
+
* `image-not-found` when the registry has no manifest at the given
|
|
36
|
+
* digest; `image-registry-unreachable` on transport / auth failure.
|
|
37
|
+
*
|
|
38
|
+
* The route MUST verify that `descriptor.digest` matches the digest
|
|
39
|
+
* inside `input.imageRef` — the binding is not responsible for that
|
|
40
|
+
* cross-check (defense-in-depth against a compromised registry).
|
|
41
|
+
*/
|
|
42
|
+
head(input: ImageHeadInput): Promise<Result<ImageDescriptor, ImageRegistryError>>;
|
|
43
|
+
/**
|
|
44
|
+
* Fetch the bytes of a single file inside the image's layered
|
|
45
|
+
* filesystem. Implementations stream from the highest layer that
|
|
46
|
+
* contains the path — e.g. traverse layers top-down and return the
|
|
47
|
+
* first hit. `bytes` is streamed as a
|
|
48
|
+
* `Uint8Array` (small files only — `/app/index.json` is expected to
|
|
49
|
+
* be a few kilobytes to low megabytes).
|
|
50
|
+
*
|
|
51
|
+
* Returns `image-file-not-found` when no layer contains the path,
|
|
52
|
+
* `image-not-found` when the ref itself is unresolvable.
|
|
53
|
+
*/
|
|
54
|
+
extractFile(input: ImageExtractFileInput): Promise<Result<ImageFile, ImageRegistryError>>;
|
|
55
|
+
/**
|
|
56
|
+
* Push a locally-built image + tag. Used by the build service, not by
|
|
57
|
+
* the API — but the interface exposes it so the same binding
|
|
58
|
+
* satisfies both consumers (a single deployment operator can wire one
|
|
59
|
+
* adapter across the whole framework).
|
|
60
|
+
*
|
|
61
|
+
* `bytes` is an OCI image archive (`docker save`-compatible tarball
|
|
62
|
+
* or a streaming OCI layout). The binding walks it, uploads each
|
|
63
|
+
* blob + manifest, and tags the final digest. Returns the resolved
|
|
64
|
+
* digest-pinned reference for the caller to sign over.
|
|
65
|
+
*/
|
|
66
|
+
push(input: ImagePushInput): Promise<Result<ImagePushOutcome, ImageRegistryError>>;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Slice of the OCI manifest the API layer + build service need. Keeps
|
|
70
|
+
* the interface stable against future spec revisions — bindings extract
|
|
71
|
+
* the parts every consumer cares about and hide the rest.
|
|
72
|
+
*/
|
|
73
|
+
export interface ImageDescriptor {
|
|
74
|
+
/** `sha256:<hex>` — canonical image digest, matches `imageRef`. */
|
|
75
|
+
readonly digest: string;
|
|
76
|
+
/** OCI media type of the manifest (`application/vnd.oci.image.manifest.v1+json` etc.). */
|
|
77
|
+
readonly mediaType: string;
|
|
78
|
+
/** Total on-wire size in bytes across all layers + config. */
|
|
79
|
+
readonly size: number;
|
|
80
|
+
/** Layer descriptors, top-to-bottom (the order used at pull time). */
|
|
81
|
+
readonly layers: readonly ImageLayerDescriptor[];
|
|
82
|
+
/** Image config descriptor (histories, env, entrypoint, etc.). */
|
|
83
|
+
readonly config: ImageBlobDescriptor;
|
|
84
|
+
/** `platform` from the manifest (e.g. `linux/amd64`). */
|
|
85
|
+
readonly platform?: ImagePlatform;
|
|
86
|
+
}
|
|
87
|
+
export interface ImageLayerDescriptor {
|
|
88
|
+
readonly digest: string;
|
|
89
|
+
readonly mediaType: string;
|
|
90
|
+
readonly size: number;
|
|
91
|
+
}
|
|
92
|
+
export type ImageBlobDescriptor = ImageLayerDescriptor;
|
|
93
|
+
export interface ImagePlatform {
|
|
94
|
+
readonly os: string;
|
|
95
|
+
readonly architecture: string;
|
|
96
|
+
readonly variant?: string;
|
|
97
|
+
}
|
|
98
|
+
export interface ImageHeadInput {
|
|
99
|
+
readonly tenantId: TenantId;
|
|
100
|
+
/** Full digest-pinned reference: `<host>/<repo>@sha256:<hex>`. */
|
|
101
|
+
readonly imageRef: string;
|
|
102
|
+
}
|
|
103
|
+
export interface ImageExtractFileInput {
|
|
104
|
+
readonly tenantId: TenantId;
|
|
105
|
+
readonly imageRef: string;
|
|
106
|
+
/**
|
|
107
|
+
* Absolute path inside the image's layered filesystem. Convention:
|
|
108
|
+
* leading slash + POSIX separators (`/app/index.json`).
|
|
109
|
+
*/
|
|
110
|
+
readonly path: string;
|
|
111
|
+
}
|
|
112
|
+
export interface ImageFile {
|
|
113
|
+
readonly path: string;
|
|
114
|
+
readonly bytes: Uint8Array;
|
|
115
|
+
/** `sha256` hex, lowercase — computed over `bytes` by the binding. */
|
|
116
|
+
readonly sha256: string;
|
|
117
|
+
/** Layer digest the file was found in — useful for audit logs. */
|
|
118
|
+
readonly layerDigest: string;
|
|
119
|
+
}
|
|
120
|
+
export interface ImagePushInput {
|
|
121
|
+
readonly tenantId: TenantId;
|
|
122
|
+
/**
|
|
123
|
+
* Unresolved reference the pusher requests — usually
|
|
124
|
+
* `<host>/<repo>:<tag>`. The binding uploads the archive and returns
|
|
125
|
+
* the digest-pinned form on success.
|
|
126
|
+
*/
|
|
127
|
+
readonly imageRef: string;
|
|
128
|
+
/** OCI image archive bytes. */
|
|
129
|
+
readonly bytes: ReadableStream<Uint8Array> | Uint8Array;
|
|
130
|
+
/** Optional annotations the binding forwards to the registry. */
|
|
131
|
+
readonly annotations?: Readonly<Record<string, string>>;
|
|
132
|
+
}
|
|
133
|
+
export interface ImagePushOutcome {
|
|
134
|
+
/** Digest-pinned reference the caller signs against. */
|
|
135
|
+
readonly imageRef: string;
|
|
136
|
+
readonly digest: string;
|
|
137
|
+
readonly size: number;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Discriminated error union. The deploy route reports any of these as
|
|
141
|
+
* `400 image-unverifiable` ("we could not verify this image"), carrying
|
|
142
|
+
* the binding's `code` as `cause`.
|
|
143
|
+
*/
|
|
144
|
+
export type ImageRegistryError = {
|
|
145
|
+
readonly code: 'image-not-found';
|
|
146
|
+
readonly message: string;
|
|
147
|
+
readonly imageRef: string;
|
|
148
|
+
} | {
|
|
149
|
+
readonly code: 'image-file-not-found';
|
|
150
|
+
readonly message: string;
|
|
151
|
+
readonly imageRef: string;
|
|
152
|
+
readonly path: string;
|
|
153
|
+
} | {
|
|
154
|
+
readonly code: 'image-registry-unreachable';
|
|
155
|
+
readonly message: string;
|
|
156
|
+
readonly cause?: unknown;
|
|
157
|
+
} | {
|
|
158
|
+
readonly code: 'image-registry-unauthorized';
|
|
159
|
+
readonly message: string;
|
|
160
|
+
} | {
|
|
161
|
+
readonly code: 'image-push-failed';
|
|
162
|
+
readonly message: string;
|
|
163
|
+
readonly cause?: unknown;
|
|
164
|
+
};
|
|
165
|
+
//# sourceMappingURL=image-registry-binding.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image-registry-binding.d.ts","sourceRoot":"","sources":["../src/image-registry-binding.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,WAAW,oBAAoB;IACnC;;;;;;;;OAQG;IACH,IAAI,CAAC,KAAK,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAAC,CAAC,CAAC;IAClF;;;;;;;;;;OAUG;IACH,WAAW,CAAC,KAAK,EAAE,qBAAqB,GAAG,OAAO,CAAC,MAAM,CAAC,SAAS,EAAE,kBAAkB,CAAC,CAAC,CAAC;IAC1F;;;;;;;;;;OAUG;IACH,IAAI,CAAC,KAAK,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,gBAAgB,EAAE,kBAAkB,CAAC,CAAC,CAAC;CACpF;AAID;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,mEAAmE;IACnE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,0FAA0F;IAC1F,QAAQ,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