@kindgi/api 0.0.0-bootstrap.0 → 0.1.0
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 +396 -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 +264 -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 +13 -0
- package/dist/middleware/error-mapper.d.ts.map +1 -0
- package/dist/middleware/error-mapper.js +32 -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 +5051 -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 +773 -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 +29659 -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 +1285 -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 +291 -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 +37 -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 +5445 -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 +981 -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,429 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
// Copyright (C) 2026 Kindgi Inc.
|
|
3
|
+
|
|
4
|
+
import { Hono } from 'hono';
|
|
5
|
+
|
|
6
|
+
import { tuplesForCreate } from '@kindgi/authz';
|
|
7
|
+
import type { Scope } from '@kindgi/platform';
|
|
8
|
+
import type { Cursor, EnvName, TenantId } from '@kindgi/types';
|
|
9
|
+
import { makeEnvName } from '@kindgi/types';
|
|
10
|
+
|
|
11
|
+
import type { EnvBinding, EnvRecord, EnvSetOutcome } from '../env-binding.js';
|
|
12
|
+
import { statusFor, toWireError } from '../errors.js';
|
|
13
|
+
import type { Authorizer } from '../middleware/authorize.js';
|
|
14
|
+
import type { AppEnv } from '../types.js';
|
|
15
|
+
import { clampLimit } from './pagination.js';
|
|
16
|
+
import { parseScopeParams, queryScopeResourceRef } from './scope-params.js';
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* `/v1/env/*` — HTTP surface for `EnvBinding`. Four endpoints, one
|
|
20
|
+
* binding, one uniform scope + envName + name key shape.
|
|
21
|
+
*
|
|
22
|
+
* Wire rules:
|
|
23
|
+
* - `envName` required on every request; missing → 400 `env-name-required`.
|
|
24
|
+
* - `scopeKind` required on every request; missing → 400 `scope-kind-required`.
|
|
25
|
+
* - `scopeId` cross-field validation (tenant forbids, org+project require).
|
|
26
|
+
* - Body-vs-query mismatch on writes → 400 `env-name-mismatch` /
|
|
27
|
+
* `scope-mismatch`.
|
|
28
|
+
* - `PUT /v1/env/:name` accepts `Idempotency-Key` (middleware handles).
|
|
29
|
+
*
|
|
30
|
+
* Env is non-sensitive by definition — `value` returns on every
|
|
31
|
+
* read path. Capability gate: `env:write` for PUT + DELETE; unset →
|
|
32
|
+
* 403 `permission-denied` (fail-closed).
|
|
33
|
+
*/
|
|
34
|
+
export function envRouter(envBinding: EnvBinding, authorizer?: Authorizer): Hono<AppEnv> {
|
|
35
|
+
const r = new Hono<AppEnv>();
|
|
36
|
+
|
|
37
|
+
// Authorization PEP — scope-anchored. Env reads are STRICT (scope admins
|
|
38
|
+
// or explicit `reader` grants), as for secrets. Every route takes its
|
|
39
|
+
// scope from `?scopeKind` + `?scopeId`, the same parameters the handlers
|
|
40
|
+
// act on.
|
|
41
|
+
if (authorizer !== undefined) {
|
|
42
|
+
const scopeFromQuery = (c: import('hono').Context<AppEnv>) =>
|
|
43
|
+
queryScopeResourceRef((n) => c.req.query(n), { tenantId: c.get('tenantId') as TenantId });
|
|
44
|
+
r.use('/', async (c, next) => {
|
|
45
|
+
if (c.req.method !== 'GET') return next();
|
|
46
|
+
const mw = authorizer.authorize('admin', scopeFromQuery);
|
|
47
|
+
return mw(c, next);
|
|
48
|
+
});
|
|
49
|
+
// `/:name/*` also matches `/:name`: one check per request.
|
|
50
|
+
r.use('/:name/*', async (c, next) => {
|
|
51
|
+
const mw = authorizer.authorize('admin', scopeFromQuery);
|
|
52
|
+
return mw(c, next);
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// ------------------------------ GET / ------------------------------
|
|
57
|
+
r.get('/', async (c) => {
|
|
58
|
+
const requestId = c.get('requestId');
|
|
59
|
+
const tenantId = c.get('tenantId') as TenantId;
|
|
60
|
+
|
|
61
|
+
const envNameResult = requireEnvName(c.req.query('envName'));
|
|
62
|
+
if (envNameResult.kind === 'err') {
|
|
63
|
+
c.status(statusFor(envNameResult.code) as never);
|
|
64
|
+
return c.json(
|
|
65
|
+
toWireError({ code: envNameResult.code, message: envNameResult.message }, requestId),
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const scopeResult = requireScope(c.req.query(), tenantId);
|
|
70
|
+
if (scopeResult.kind === 'err') {
|
|
71
|
+
c.status(statusFor(scopeResult.code) as never);
|
|
72
|
+
return c.json(
|
|
73
|
+
toWireError({ code: scopeResult.code, message: scopeResult.message }, requestId),
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const limit = clampLimit(c.req.query('limit'));
|
|
78
|
+
const cursorRaw = c.req.query('cursor');
|
|
79
|
+
const namePrefix = c.req.query('namePrefix');
|
|
80
|
+
|
|
81
|
+
const page = await envBinding.list({
|
|
82
|
+
scope: scopeResult.scope,
|
|
83
|
+
envName: envNameResult.envName,
|
|
84
|
+
limit,
|
|
85
|
+
...(cursorRaw !== undefined && cursorRaw.length > 0 && { cursor: cursorRaw as Cursor }),
|
|
86
|
+
...(namePrefix !== undefined && namePrefix.length > 0 && { namePrefix }),
|
|
87
|
+
});
|
|
88
|
+
return c.json({
|
|
89
|
+
data: page.data.map(serializeEnvRecord),
|
|
90
|
+
...(page.nextCursor !== undefined && { nextCursor: page.nextCursor as unknown as string }),
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
// ------------------------ GET /:name ------------------------------
|
|
95
|
+
r.get('/:name', async (c) => {
|
|
96
|
+
const requestId = c.get('requestId');
|
|
97
|
+
const tenantId = c.get('tenantId') as TenantId;
|
|
98
|
+
const name = c.req.param('name');
|
|
99
|
+
|
|
100
|
+
const envNameResult = requireEnvName(c.req.query('envName'));
|
|
101
|
+
if (envNameResult.kind === 'err') {
|
|
102
|
+
c.status(statusFor(envNameResult.code) as never);
|
|
103
|
+
return c.json(
|
|
104
|
+
toWireError({ code: envNameResult.code, message: envNameResult.message }, requestId),
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const scopeResult = requireScope(c.req.query(), tenantId);
|
|
109
|
+
if (scopeResult.kind === 'err') {
|
|
110
|
+
c.status(statusFor(scopeResult.code) as never);
|
|
111
|
+
return c.json(
|
|
112
|
+
toWireError({ code: scopeResult.code, message: scopeResult.message }, requestId),
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
const rec = await envBinding.get({
|
|
117
|
+
scope: scopeResult.scope,
|
|
118
|
+
envName: envNameResult.envName,
|
|
119
|
+
name,
|
|
120
|
+
});
|
|
121
|
+
if (rec === null) {
|
|
122
|
+
c.status(statusFor('env-not-found') as never);
|
|
123
|
+
return c.json(
|
|
124
|
+
toWireError({ code: 'env-not-found', message: `No env entry "${name}".`, name }, requestId),
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
return c.json(serializeEnvRecord(rec));
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
// ------------------------- PUT /:name -----------------------------
|
|
131
|
+
r.put('/:name', async (c) => {
|
|
132
|
+
const requestId = c.get('requestId');
|
|
133
|
+
const tenantId = c.get('tenantId') as TenantId;
|
|
134
|
+
const name = c.req.param('name');
|
|
135
|
+
|
|
136
|
+
if (!hasCapability(c, 'env:write')) {
|
|
137
|
+
c.status(statusFor('permission-denied') as never);
|
|
138
|
+
return c.json(
|
|
139
|
+
toWireError(
|
|
140
|
+
{
|
|
141
|
+
code: 'permission-denied',
|
|
142
|
+
message: 'Bearer token is missing the `env:write` capability required for this route.',
|
|
143
|
+
},
|
|
144
|
+
requestId,
|
|
145
|
+
),
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
let body: unknown;
|
|
150
|
+
try {
|
|
151
|
+
body = await c.req.json();
|
|
152
|
+
} catch {
|
|
153
|
+
c.status(statusFor('bad-input') as never);
|
|
154
|
+
return c.json(
|
|
155
|
+
toWireError({ code: 'bad-input', message: 'Request body must be valid JSON' }, requestId),
|
|
156
|
+
);
|
|
157
|
+
}
|
|
158
|
+
if (body === null || typeof body !== 'object') {
|
|
159
|
+
c.status(statusFor('bad-input') as never);
|
|
160
|
+
return c.json(
|
|
161
|
+
toWireError({ code: 'bad-input', message: 'Request body must be an object' }, requestId),
|
|
162
|
+
);
|
|
163
|
+
}
|
|
164
|
+
const b = body as Record<string, unknown>;
|
|
165
|
+
|
|
166
|
+
const envNameResult = requireEnvName(c.req.query('envName'));
|
|
167
|
+
if (envNameResult.kind === 'err') {
|
|
168
|
+
c.status(statusFor(envNameResult.code) as never);
|
|
169
|
+
return c.json(
|
|
170
|
+
toWireError({ code: envNameResult.code, message: envNameResult.message }, requestId),
|
|
171
|
+
);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
const scopeResult = requireScope(c.req.query(), tenantId);
|
|
175
|
+
if (scopeResult.kind === 'err') {
|
|
176
|
+
c.status(statusFor(scopeResult.code) as never);
|
|
177
|
+
return c.json(
|
|
178
|
+
toWireError({ code: scopeResult.code, message: scopeResult.message }, requestId),
|
|
179
|
+
);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
// Body-vs-query cross-field validation.
|
|
183
|
+
if (b.envName !== undefined && b.envName !== envNameResult.envName) {
|
|
184
|
+
c.status(statusFor('env-name-mismatch') as never);
|
|
185
|
+
return c.json(
|
|
186
|
+
toWireError(
|
|
187
|
+
{
|
|
188
|
+
code: 'env-name-mismatch',
|
|
189
|
+
message: `Body \`envName\` "${String(b.envName)}" does not match query envName "${envNameResult.envName as unknown as string}".`,
|
|
190
|
+
},
|
|
191
|
+
requestId,
|
|
192
|
+
),
|
|
193
|
+
);
|
|
194
|
+
}
|
|
195
|
+
if (b.scope !== undefined && !scopesEqual(b.scope, scopeResult.scope)) {
|
|
196
|
+
c.status(statusFor('scope-mismatch') as never);
|
|
197
|
+
return c.json(
|
|
198
|
+
toWireError(
|
|
199
|
+
{
|
|
200
|
+
code: 'scope-mismatch',
|
|
201
|
+
message: 'Body `scope` does not match query scopeKind/scopeId.',
|
|
202
|
+
},
|
|
203
|
+
requestId,
|
|
204
|
+
),
|
|
205
|
+
);
|
|
206
|
+
}
|
|
207
|
+
if (b.name !== undefined && b.name !== name) {
|
|
208
|
+
c.status(statusFor('bad-input') as never);
|
|
209
|
+
return c.json(
|
|
210
|
+
toWireError(
|
|
211
|
+
{
|
|
212
|
+
code: 'bad-input',
|
|
213
|
+
message: 'Body `name` does not match path `:name`.',
|
|
214
|
+
},
|
|
215
|
+
requestId,
|
|
216
|
+
),
|
|
217
|
+
);
|
|
218
|
+
}
|
|
219
|
+
if (typeof b.value !== 'string') {
|
|
220
|
+
c.status(statusFor('bad-input') as never);
|
|
221
|
+
return c.json(
|
|
222
|
+
toWireError(
|
|
223
|
+
{ code: 'bad-input', message: '`value` is required and must be a string' },
|
|
224
|
+
requestId,
|
|
225
|
+
),
|
|
226
|
+
);
|
|
227
|
+
}
|
|
228
|
+
if (b.ifRevision !== undefined && typeof b.ifRevision !== 'number') {
|
|
229
|
+
c.status(statusFor('bad-input') as never);
|
|
230
|
+
return c.json(
|
|
231
|
+
toWireError(
|
|
232
|
+
{ code: 'bad-input', message: '`ifRevision` must be a number when present' },
|
|
233
|
+
requestId,
|
|
234
|
+
),
|
|
235
|
+
);
|
|
236
|
+
}
|
|
237
|
+
if (
|
|
238
|
+
b.tags !== undefined &&
|
|
239
|
+
(b.tags === null || typeof b.tags !== 'object' || Array.isArray(b.tags))
|
|
240
|
+
) {
|
|
241
|
+
c.status(statusFor('bad-input') as never);
|
|
242
|
+
return c.json(
|
|
243
|
+
toWireError(
|
|
244
|
+
{ code: 'bad-input', message: '`tags` must be a string map when present' },
|
|
245
|
+
requestId,
|
|
246
|
+
),
|
|
247
|
+
);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
const setScope = scopeResult.scope;
|
|
251
|
+
const outcome: EnvSetOutcome = await envBinding.set({
|
|
252
|
+
scope: setScope,
|
|
253
|
+
envName: envNameResult.envName,
|
|
254
|
+
name,
|
|
255
|
+
value: b.value,
|
|
256
|
+
...(b.tags !== undefined && { tags: b.tags as Readonly<Record<string, string>> }),
|
|
257
|
+
...(b.ifRevision !== undefined && { ifRevision: b.ifRevision as number }),
|
|
258
|
+
enqueueTuples: (envRowId) =>
|
|
259
|
+
tuplesForCreate({ kind: 'env', id: envRowId, tenantId, scope: setScope }),
|
|
260
|
+
});
|
|
261
|
+
|
|
262
|
+
if (outcome.kind === 'ok') {
|
|
263
|
+
return c.json(serializeEnvRecord(outcome.record));
|
|
264
|
+
}
|
|
265
|
+
if (outcome.kind === 'revision-conflict') {
|
|
266
|
+
c.status(statusFor('env-write-conflict') as never);
|
|
267
|
+
return c.json(
|
|
268
|
+
toWireError(
|
|
269
|
+
{
|
|
270
|
+
code: 'env-write-conflict',
|
|
271
|
+
message: `Stored revision is ${outcome.currentRevision}; retry with the current value.`,
|
|
272
|
+
currentRevision: outcome.currentRevision,
|
|
273
|
+
},
|
|
274
|
+
requestId,
|
|
275
|
+
),
|
|
276
|
+
);
|
|
277
|
+
}
|
|
278
|
+
c.status(statusFor(outcome.code) as never);
|
|
279
|
+
return c.json(toWireError({ code: outcome.code, message: outcome.message }, requestId));
|
|
280
|
+
});
|
|
281
|
+
|
|
282
|
+
// ---------------------- DELETE /:name -----------------------------
|
|
283
|
+
r.delete('/:name', async (c) => {
|
|
284
|
+
const requestId = c.get('requestId');
|
|
285
|
+
const tenantId = c.get('tenantId') as TenantId;
|
|
286
|
+
const name = c.req.param('name');
|
|
287
|
+
|
|
288
|
+
if (!hasCapability(c, 'env:write')) {
|
|
289
|
+
c.status(statusFor('permission-denied') as never);
|
|
290
|
+
return c.json(
|
|
291
|
+
toWireError(
|
|
292
|
+
{
|
|
293
|
+
code: 'permission-denied',
|
|
294
|
+
message: 'Bearer token is missing the `env:write` capability required for this route.',
|
|
295
|
+
},
|
|
296
|
+
requestId,
|
|
297
|
+
),
|
|
298
|
+
);
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
const envNameResult = requireEnvName(c.req.query('envName'));
|
|
302
|
+
if (envNameResult.kind === 'err') {
|
|
303
|
+
c.status(statusFor(envNameResult.code) as never);
|
|
304
|
+
return c.json(
|
|
305
|
+
toWireError({ code: envNameResult.code, message: envNameResult.message }, requestId),
|
|
306
|
+
);
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
const scopeResult = requireScope(c.req.query(), tenantId);
|
|
310
|
+
if (scopeResult.kind === 'err') {
|
|
311
|
+
c.status(statusFor(scopeResult.code) as never);
|
|
312
|
+
return c.json(
|
|
313
|
+
toWireError({ code: scopeResult.code, message: scopeResult.message }, requestId),
|
|
314
|
+
);
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
const outcome = await envBinding.delete({
|
|
318
|
+
scope: scopeResult.scope,
|
|
319
|
+
envName: envNameResult.envName,
|
|
320
|
+
name,
|
|
321
|
+
});
|
|
322
|
+
return c.json({ deleted: outcome.deleted });
|
|
323
|
+
});
|
|
324
|
+
|
|
325
|
+
return r;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
// -------------------- shared helpers (also used by secrets router) --------------------
|
|
329
|
+
|
|
330
|
+
type EnvNameResult =
|
|
331
|
+
| { readonly kind: 'ok'; readonly envName: EnvName }
|
|
332
|
+
| { readonly kind: 'err'; readonly code: string; readonly message: string };
|
|
333
|
+
|
|
334
|
+
export function requireEnvName(raw: string | undefined): EnvNameResult {
|
|
335
|
+
if (raw === undefined || raw.length === 0) {
|
|
336
|
+
return {
|
|
337
|
+
kind: 'err',
|
|
338
|
+
code: 'env-name-required',
|
|
339
|
+
message: '`envName` query parameter is required',
|
|
340
|
+
};
|
|
341
|
+
}
|
|
342
|
+
const validated = makeEnvName(raw);
|
|
343
|
+
if (validated === null) {
|
|
344
|
+
return {
|
|
345
|
+
kind: 'err',
|
|
346
|
+
code: 'env-name-required',
|
|
347
|
+
message: '`envName` must match RFC-1035-like grammar [a-z][a-z0-9-]{0,62}.',
|
|
348
|
+
};
|
|
349
|
+
}
|
|
350
|
+
return { kind: 'ok', envName: validated };
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
type ScopeResult =
|
|
354
|
+
| { readonly kind: 'ok'; readonly scope: Scope }
|
|
355
|
+
| { readonly kind: 'err'; readonly code: string; readonly message: string };
|
|
356
|
+
|
|
357
|
+
/**
|
|
358
|
+
* Env + Secrets routes require an explicit scope (Tenant / Org /
|
|
359
|
+
* Project) on every request — the base `parseScopeParams` treats scope
|
|
360
|
+
* as optional (for content-scoped bindings that filter). Missing
|
|
361
|
+
* `scopeKind` here is a hard error.
|
|
362
|
+
*/
|
|
363
|
+
export function requireScope(
|
|
364
|
+
query: Record<string, string> | ((name: string) => string | undefined),
|
|
365
|
+
tenantId: TenantId,
|
|
366
|
+
): ScopeResult {
|
|
367
|
+
const parsed = parseScopeParams(query, { tenantId });
|
|
368
|
+
if (parsed.kind === 'err') {
|
|
369
|
+
// Distinguish the "orphan scopeId" and "wrong scopeKind" cases
|
|
370
|
+
// (both surface as `scope-invalid` in parseScopeParams). Env +
|
|
371
|
+
// Secrets routes prefer the tighter `scope-kind-required` /
|
|
372
|
+
// `scope-mismatch` codes. Fall back to `scope-invalid` for
|
|
373
|
+
// everything else.
|
|
374
|
+
return { kind: 'err', code: 'scope-invalid', message: parsed.message };
|
|
375
|
+
}
|
|
376
|
+
if (parsed.scope === undefined) {
|
|
377
|
+
return {
|
|
378
|
+
kind: 'err',
|
|
379
|
+
code: 'scope-kind-required',
|
|
380
|
+
message: '`scopeKind` query parameter is required.',
|
|
381
|
+
};
|
|
382
|
+
}
|
|
383
|
+
return { kind: 'ok', scope: parsed.scope };
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
/**
|
|
387
|
+
* Structural equality — scope kinds + ids MUST match. `tenantId` on
|
|
388
|
+
* `a` (the body scope) is tolerated when absent: the SDK strips it
|
|
389
|
+
* because the server derives tenantId authoritatively from the bearer
|
|
390
|
+
* (mirrors the body-scope tenant check in `routes/secrets.ts`). When present, it
|
|
391
|
+
* must still match `b.tenantId` — defense-in-depth against a body that
|
|
392
|
+
* explicitly disagrees with the session.
|
|
393
|
+
*/
|
|
394
|
+
export function scopesEqual(a: unknown, b: Scope): boolean {
|
|
395
|
+
if (a === null || typeof a !== 'object') return false;
|
|
396
|
+
const ao = a as Record<string, unknown>;
|
|
397
|
+
if (ao.kind !== b.kind) return false;
|
|
398
|
+
if (ao.tenantId !== undefined && ao.tenantId !== (b.tenantId as unknown as string)) return false;
|
|
399
|
+
if (b.kind === 'org') {
|
|
400
|
+
return ao.orgId === (b.orgId as unknown as string);
|
|
401
|
+
}
|
|
402
|
+
if (b.kind === 'project') {
|
|
403
|
+
return ao.projectId === (b.projectId as unknown as string);
|
|
404
|
+
}
|
|
405
|
+
return true;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
/** Capability presence check — fail-closed if `capabilities` is absent. */
|
|
409
|
+
export function hasCapability(
|
|
410
|
+
c: { get: (k: 'capabilities') => readonly string[] | undefined },
|
|
411
|
+
cap: string,
|
|
412
|
+
): boolean {
|
|
413
|
+
const caps = c.get('capabilities');
|
|
414
|
+
if (caps === undefined) return false;
|
|
415
|
+
return caps.includes(cap);
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
function serializeEnvRecord(rec: EnvRecord): Record<string, unknown> {
|
|
419
|
+
return {
|
|
420
|
+
scope: rec.scope as unknown as Record<string, unknown>,
|
|
421
|
+
envName: rec.envName as unknown as string,
|
|
422
|
+
name: rec.name,
|
|
423
|
+
value: rec.value,
|
|
424
|
+
revision: rec.revision,
|
|
425
|
+
createdAt: rec.createdAt,
|
|
426
|
+
updatedAt: rec.updatedAt,
|
|
427
|
+
...(rec.tags !== undefined && { tags: rec.tags }),
|
|
428
|
+
};
|
|
429
|
+
}
|