@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,257 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
// Copyright (C) 2026 Kindgi Inc.
|
|
3
|
+
|
|
4
|
+
import type { TupleEnqueueHook } from '@kindgi/authz';
|
|
5
|
+
import type { Scope } from '@kindgi/platform';
|
|
6
|
+
import type { Cursor, ProjectId, TenantId } from '@kindgi/types';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Caller-plugged surface for the evaluation-harness suite catalog —
|
|
10
|
+
* part of the admin control plane. Registry-only: publish + read; run
|
|
11
|
+
* execution + per-kind grader dispatch are out of scope (see
|
|
12
|
+
* `EvalRunBinding`). Graders — an eval-judge adapter, the HITL bridge,
|
|
13
|
+
* a sandboxed handler — consume suite definitions from this store at
|
|
14
|
+
* their own boundary.
|
|
15
|
+
*
|
|
16
|
+
* Mirrors `PolicyRegistryBinding` 1:1 — same versioned-CRUD shape,
|
|
17
|
+
* same tenant-scoped inputs, same opaque cursors, same "unregister a
|
|
18
|
+
* specific version" semantics.
|
|
19
|
+
*
|
|
20
|
+
* The wire shape is intentionally kind-neutral: `evalKind` selects the
|
|
21
|
+
* shape of `spec`. The route validates the closed set of `kind` values
|
|
22
|
+
* and the required top-level fields; deeper `spec` shape is the runtime
|
|
23
|
+
* consumer's responsibility (each kind's grader knows its own contract).
|
|
24
|
+
*
|
|
25
|
+
* Cursors are opaque — the binding chooses its encoding (index-based,
|
|
26
|
+
* `id@version`, ISO timestamps). The API layer only validates that a
|
|
27
|
+
* cursor round-trips as a string; it never inspects the payload.
|
|
28
|
+
*/
|
|
29
|
+
export interface EvalSuiteRegistryBinding {
|
|
30
|
+
/**
|
|
31
|
+
* Cursor-paginated list of eval suites (latest version per id, sorted
|
|
32
|
+
* by suite id ascending). Optional filters:
|
|
33
|
+
* - `evalKind` narrows to suites of a single kind (exact match).
|
|
34
|
+
* - `nameFilter` is a prefix match on the suite id — dotted
|
|
35
|
+
* namespaces are the natural filter shape (`acme.accuracy`).
|
|
36
|
+
*/
|
|
37
|
+
list(input: EvalSuiteListInput): Promise<EvalSuitePage>;
|
|
38
|
+
/**
|
|
39
|
+
* Latest version of the given suite id, or `null` if unknown. The
|
|
40
|
+
* route surfaces `null` as `404 eval-suite-not-found`.
|
|
41
|
+
*/
|
|
42
|
+
get(input: EvalSuiteGetInput): Promise<EvalSuite | null>;
|
|
43
|
+
/**
|
|
44
|
+
* Specific `(suiteId, version)` lookup, or `null` if unknown.
|
|
45
|
+
* Returns tombstoned versions too (provenance paths).
|
|
46
|
+
*/
|
|
47
|
+
getVersion(input: EvalSuiteGetVersionInput): Promise<EvalSuite | null>;
|
|
48
|
+
/**
|
|
49
|
+
* Head-row existence probe. Lets GET distinguish 410 gone from
|
|
50
|
+
* 404 not-found.
|
|
51
|
+
*/
|
|
52
|
+
headExists(input: EvalSuiteGetInput): Promise<boolean>;
|
|
53
|
+
/**
|
|
54
|
+
* Cursor-paginated list of versions for a specific suite id. Sort
|
|
55
|
+
* order is binding-defined (for example ascending semver). Returns an empty page (no error) when the id
|
|
56
|
+
* is unknown — the route flips that to `404` via a prior `get`.
|
|
57
|
+
*/
|
|
58
|
+
listVersions(input: EvalSuiteListVersionsInput): Promise<EvalSuitePage>;
|
|
59
|
+
/**
|
|
60
|
+
* Publish a validated eval-suite definition. The API route validates
|
|
61
|
+
* the wire shape (id / tenantId / semver version / kind / spec object)
|
|
62
|
+
* before calling — the binding receives a well-formed `EvalSuite`.
|
|
63
|
+
* Bindings MAY reject with `already-registered` when the same
|
|
64
|
+
* `(suiteId, version)` is re-published; the route maps that to `409`.
|
|
65
|
+
*/
|
|
66
|
+
publish(input: EvalSuitePublishInput): Promise<EvalSuitePublishOutcome>;
|
|
67
|
+
/**
|
|
68
|
+
* Soft-tombstone a specific `(suiteId, version)`. When this leaves
|
|
69
|
+
* NO active versions, the suite has no latest version — derived
|
|
70
|
+
* "retired" state (GET returns 410 gone). Publish reactivates.
|
|
71
|
+
*/
|
|
72
|
+
unregister(input: EvalSuiteUnregisterInput): Promise<EvalSuiteUnregisterOutcome>;
|
|
73
|
+
/**
|
|
74
|
+
* Un-tombstone a specific `(suiteId, version)`. Recomputes the
|
|
75
|
+
* suite's latest version. Restores bytes verbatim (semver hygiene).
|
|
76
|
+
* Idempotent.
|
|
77
|
+
*/
|
|
78
|
+
reinstateVersion(
|
|
79
|
+
input: EvalSuiteReinstateVersionInput,
|
|
80
|
+
): Promise<EvalSuiteReinstateVersionOutcome>;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Closed set of eval kinds the framework knows about. Extended
|
|
85
|
+
* additively — new kinds require a spec + validator update in tandem so
|
|
86
|
+
* the registry never accepts a kind no runtime consumer honors.
|
|
87
|
+
*
|
|
88
|
+
* - `accuracy` — metric-based grading against ground truth (input →
|
|
89
|
+
* expectedOutput pairs; grader is an eval-judge adapter).
|
|
90
|
+
* - `pairwise` — A/B comparisons between two agent/flow versions.
|
|
91
|
+
* - `regression` — compare against a stored baseline run.
|
|
92
|
+
* - `human-review` — delegates rubric grading to HITL reviewers.
|
|
93
|
+
* - `benchmark` — reference to a standardized suite (name + version).
|
|
94
|
+
* - `custom` — caller-supplied evaluator handler.
|
|
95
|
+
*/
|
|
96
|
+
export const EVAL_KINDS = [
|
|
97
|
+
'accuracy',
|
|
98
|
+
'pairwise',
|
|
99
|
+
'regression',
|
|
100
|
+
'human-review',
|
|
101
|
+
'benchmark',
|
|
102
|
+
'custom',
|
|
103
|
+
] as const;
|
|
104
|
+
export type EvalKind = (typeof EVAL_KINDS)[number];
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Wire shape for a single evaluation suite. `spec` is a JSON object
|
|
108
|
+
* whose shape is dictated by `kind` — the registry treats it as opaque
|
|
109
|
+
* JSON so new kinds can extend the catalog without touching this file.
|
|
110
|
+
* Runtime consumers (the eval-judge adapter for `accuracy` / `pairwise`
|
|
111
|
+
* / `regression`, the HITL bridge for `human-review`, the sandbox
|
|
112
|
+
* handler for `custom`) deserialize `spec` against their own contract.
|
|
113
|
+
*
|
|
114
|
+
* Case data lives IN `spec` (not stored separately) — small enough at
|
|
115
|
+
* registry scale.
|
|
116
|
+
*/
|
|
117
|
+
export interface EvalSuite {
|
|
118
|
+
readonly id: string;
|
|
119
|
+
readonly tenantId: TenantId;
|
|
120
|
+
readonly version: string;
|
|
121
|
+
readonly kind: EvalKind;
|
|
122
|
+
readonly description?: string;
|
|
123
|
+
readonly spec: Readonly<Record<string, unknown>>;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export interface EvalSuiteListInput {
|
|
127
|
+
readonly tenantId: TenantId;
|
|
128
|
+
readonly limit: number;
|
|
129
|
+
readonly cursor?: Cursor;
|
|
130
|
+
/** Exact match on `EvalSuite.kind`. Undefined = no filter. */
|
|
131
|
+
readonly evalKind?: EvalKind;
|
|
132
|
+
/** Prefix match on `EvalSuite.id`. Undefined = no filter. */
|
|
133
|
+
readonly nameFilter?: string;
|
|
134
|
+
/**
|
|
135
|
+
* Narrow the list to a specific scope. Absent = no scope narrow
|
|
136
|
+
* (return every row in the tenant the caller can see — admin/audit
|
|
137
|
+
* default).
|
|
138
|
+
*
|
|
139
|
+
* Content-scoped semantics (this binding):
|
|
140
|
+
* - `{ kind: 'project', projectId }` — rows in that project.
|
|
141
|
+
* - `{ kind: 'org', orgId }` — rows in every project belonging to
|
|
142
|
+
* that org.
|
|
143
|
+
* - `{ kind: 'tenant', tenantId }` — every row in the tenant.
|
|
144
|
+
*
|
|
145
|
+
* Content rows always belong to a project, so `inherit` has no
|
|
146
|
+
* effect here.
|
|
147
|
+
*/
|
|
148
|
+
readonly scope?: Scope;
|
|
149
|
+
/**
|
|
150
|
+
* `false` = literal-at-this-scope only (admin/audit view).
|
|
151
|
+
* `true` (default) = inheritance walk (user-facing view).
|
|
152
|
+
* No-op for content-scoped bindings (rows only exist at
|
|
153
|
+
* project-level — there is no upward hierarchy to walk). Kept for
|
|
154
|
+
* uniformity: scope-aware bindings share one filter shape across the
|
|
155
|
+
* SDK and OpenAPI schemas.
|
|
156
|
+
*/
|
|
157
|
+
readonly inherit?: boolean;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export interface EvalSuiteGetInput {
|
|
161
|
+
readonly tenantId: TenantId;
|
|
162
|
+
readonly suiteId: string;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export interface EvalSuiteGetVersionInput {
|
|
166
|
+
readonly tenantId: TenantId;
|
|
167
|
+
readonly suiteId: string;
|
|
168
|
+
readonly version: string;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
export interface EvalSuiteListVersionsInput {
|
|
172
|
+
readonly tenantId: TenantId;
|
|
173
|
+
readonly suiteId: string;
|
|
174
|
+
readonly limit: number;
|
|
175
|
+
readonly cursor?: Cursor;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
export interface EvalSuitePublishInput {
|
|
179
|
+
readonly tenantId: TenantId;
|
|
180
|
+
/**
|
|
181
|
+
* Project the eval suite is published into. REQUIRED. Callers that
|
|
182
|
+
* don't naturally know a projectId
|
|
183
|
+
* resolve the tenant's Default via
|
|
184
|
+
* `projectBinding.getDefault(tenantId)` at THEIR layer and thread
|
|
185
|
+
* the resolved id here — the storage adapter never silently falls
|
|
186
|
+
* back to Default.
|
|
187
|
+
*/
|
|
188
|
+
readonly projectId: ProjectId;
|
|
189
|
+
readonly suite: EvalSuite;
|
|
190
|
+
/**
|
|
191
|
+
* REQUIRED. Called inside the binding's write tx after row insert,
|
|
192
|
+
* receiving the business `suiteId`. Returns tuples for the same tx.
|
|
193
|
+
* See `AgentPublishInput.enqueueTuples` for the design rationale.
|
|
194
|
+
*/
|
|
195
|
+
readonly enqueueTuples: TupleEnqueueHook;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
export interface EvalSuiteUnregisterInput {
|
|
199
|
+
readonly tenantId: TenantId;
|
|
200
|
+
readonly suiteId: string;
|
|
201
|
+
readonly version: string;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
export interface EvalSuiteReinstateVersionInput {
|
|
205
|
+
readonly tenantId: TenantId;
|
|
206
|
+
readonly suiteId: string;
|
|
207
|
+
readonly version: string;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
export interface EvalSuitePage {
|
|
211
|
+
readonly data: readonly EvalSuite[];
|
|
212
|
+
readonly nextCursor?: Cursor;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
export type EvalSuitePublishOutcome =
|
|
216
|
+
| {
|
|
217
|
+
readonly kind: 'ok';
|
|
218
|
+
readonly suiteId: string;
|
|
219
|
+
readonly version: string;
|
|
220
|
+
}
|
|
221
|
+
| {
|
|
222
|
+
readonly kind: 'already-registered';
|
|
223
|
+
readonly suiteId: string;
|
|
224
|
+
readonly version: string;
|
|
225
|
+
}
|
|
226
|
+
| {
|
|
227
|
+
/**
|
|
228
|
+
* The caller-supplied `projectId` does not resolve to a real
|
|
229
|
+
* project row in this tenant. Distinct from
|
|
230
|
+
* `already-registered` so the route + deployment loop can
|
|
231
|
+
* surface a clean `400 bad-input` (per the route's error
|
|
232
|
+
* contract) rather than the misleading `already-registered`
|
|
233
|
+
* fallback. Implementations detect a missing project at publish
|
|
234
|
+
* time (a SQL store typically from its foreign-key violation).
|
|
235
|
+
*/
|
|
236
|
+
readonly kind: 'project-not-found';
|
|
237
|
+
readonly suiteId: string;
|
|
238
|
+
readonly version: string;
|
|
239
|
+
readonly projectId: ProjectId;
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
export type EvalSuiteUnregisterOutcome = {
|
|
243
|
+
readonly unregistered: boolean;
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
export type EvalSuiteReinstateVersionOutcome =
|
|
247
|
+
| {
|
|
248
|
+
readonly kind: 'ok';
|
|
249
|
+
readonly suiteId: string;
|
|
250
|
+
readonly version: string;
|
|
251
|
+
readonly wasTombstoned: boolean;
|
|
252
|
+
}
|
|
253
|
+
| {
|
|
254
|
+
readonly kind: 'not-found';
|
|
255
|
+
readonly suiteId: string;
|
|
256
|
+
readonly version: string;
|
|
257
|
+
};
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
// Copyright (C) 2026 Kindgi Inc.
|
|
3
|
+
|
|
4
|
+
import type { Result, TenantId } from '@kindgi/types';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* `EventBusBinding` — caller-plugged pub/sub surface for push-based event
|
|
8
|
+
* delivery. When wired, `runsRouter`'s `GET /:runId/stream` uses it
|
|
9
|
+
* instead of polling the journal every 200 ms.
|
|
10
|
+
*
|
|
11
|
+
* The API package doesn't own event-bus persistence. Deployments plug in
|
|
12
|
+
* a binding via `CreateAppInput.eventBus` (the Kindgi runtime provides a
|
|
13
|
+
* Postgres-backed one). When absent, SSE endpoints fall back to journal
|
|
14
|
+
* polling — no regression for callers who don't wire the binding.
|
|
15
|
+
*
|
|
16
|
+
* ## Semantics
|
|
17
|
+
*
|
|
18
|
+
* - **Per-tenant, per-channel FIFO.** `seq` monotonically increases per
|
|
19
|
+
* `(tenantId, channel)` tuple. Subscribers may catch up from a specific
|
|
20
|
+
* `sinceSeq` after reconnect.
|
|
21
|
+
* - **Durable log.** Every publish is persisted before notification;
|
|
22
|
+
* subscribers can backfill from the log after connection loss. The
|
|
23
|
+
* notification is a fast-path signal; the log is the source of truth.
|
|
24
|
+
* - **Tenant isolation.** The binding keeps channels per tenant and
|
|
25
|
+
* filters log reads by tenant. A correctly-implemented binding never
|
|
26
|
+
* delivers another tenant's events.
|
|
27
|
+
*
|
|
28
|
+
* ## Wire shape
|
|
29
|
+
*
|
|
30
|
+
* `EventPayload` is what subscribers receive. `publish` accepts only
|
|
31
|
+
* `doc` — the binding assigns `v`, `seq`, `timestamp` and fills in
|
|
32
|
+
* `channel` + `tenantId` from its arguments. Callers never build the
|
|
33
|
+
* envelope directly.
|
|
34
|
+
*/
|
|
35
|
+
export interface EventBusBinding {
|
|
36
|
+
/**
|
|
37
|
+
* Publish `doc` to `(tenantId, channel)`. The binding assigns a
|
|
38
|
+
* monotonic `seq` per `(tenantId, channel)`, persists the event to its
|
|
39
|
+
* log, and notifies subscribers. Returns `{ kind: 'ok' }` after the
|
|
40
|
+
* event is durable. The notification only needs to identify the new
|
|
41
|
+
* entry — subscribers read large `doc` payloads from the log (a
|
|
42
|
+
* Postgres NOTIFY payload, for example, is limited to 8000 bytes).
|
|
43
|
+
*/
|
|
44
|
+
publish(tenantId: TenantId, channel: string, doc: unknown): Promise<Result<void, EventBusError>>;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Publish `docs` to `(tenantId, channel)` in order, as one write: the
|
|
48
|
+
* same as `publish` for each, with consecutive `seq`s and one
|
|
49
|
+
* notification. Optional — a publisher with a batch calls it when the
|
|
50
|
+
* binding has it.
|
|
51
|
+
*/
|
|
52
|
+
publishMany?(
|
|
53
|
+
tenantId: TenantId,
|
|
54
|
+
channel: string,
|
|
55
|
+
docs: readonly unknown[],
|
|
56
|
+
): Promise<Result<void, EventBusError>>;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Subscribe to `(tenantId, channel)`. `onEvent` is invoked for each
|
|
60
|
+
* published payload in `seq` order, starting from `options.sinceSeq`
|
|
61
|
+
* (default: current tail — new events only). Returns a `Subscription`
|
|
62
|
+
* whose `unsubscribe()` tears down the underlying listener.
|
|
63
|
+
*
|
|
64
|
+
* `signal.abort()` unsubscribes atomically. Callers usually pass an
|
|
65
|
+
* AbortController tied to the SSE stream's lifetime.
|
|
66
|
+
*
|
|
67
|
+
* On connection loss the binding reconnects transparently and
|
|
68
|
+
* backfills from `lastSeen + 1` — subscribers observe no gaps.
|
|
69
|
+
* A binding whose push channel is unavailable may fall back to
|
|
70
|
+
* polling its log without breaking the subscriber contract.
|
|
71
|
+
*/
|
|
72
|
+
subscribe(
|
|
73
|
+
tenantId: TenantId,
|
|
74
|
+
channel: string,
|
|
75
|
+
onEvent: (payload: EventPayload) => void,
|
|
76
|
+
signal: AbortSignal,
|
|
77
|
+
options?: SubscribeOptions,
|
|
78
|
+
): Promise<Result<Subscription, EventBusError>>;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** Options for `subscribe`. */
|
|
82
|
+
export interface SubscribeOptions {
|
|
83
|
+
/**
|
|
84
|
+
* Deliver rows with `seq > sinceSeq` before entering push mode.
|
|
85
|
+
* When omitted, the subscriber joins at the current tail (new
|
|
86
|
+
* events only) — appropriate for a fresh SSE connect with no
|
|
87
|
+
* `Last-Event-Id`. When present, must be a non-negative integer.
|
|
88
|
+
*/
|
|
89
|
+
readonly sinceSeq?: number;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/** Envelope subscribers receive on every push. */
|
|
93
|
+
export interface EventPayload {
|
|
94
|
+
readonly v: 1;
|
|
95
|
+
readonly channel: string;
|
|
96
|
+
readonly tenantId: TenantId;
|
|
97
|
+
/** Monotonic sequence per `(tenantId, channel)`. Starts at 1. */
|
|
98
|
+
readonly seq: number;
|
|
99
|
+
/** ISO-8601 timestamp assigned at persist time. */
|
|
100
|
+
readonly timestamp: string;
|
|
101
|
+
/** Caller-supplied doc — the runtime shape flowing through the bus. */
|
|
102
|
+
readonly doc: unknown;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Handle returned from `subscribe`. Callers must `unsubscribe()` to
|
|
107
|
+
* release the underlying listener. Equivalent to aborting
|
|
108
|
+
* the `signal` passed at subscribe time — either releases the same
|
|
109
|
+
* resources.
|
|
110
|
+
*/
|
|
111
|
+
export interface Subscription {
|
|
112
|
+
/**
|
|
113
|
+
* Tear down the subscription. Safe to call multiple times; idempotent
|
|
114
|
+
* after the first call.
|
|
115
|
+
*/
|
|
116
|
+
unsubscribe(): Promise<void>;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/** Non-transient errors from `publish` / `subscribe`. */
|
|
120
|
+
export interface EventBusError {
|
|
121
|
+
readonly code: 'publish-failed' | 'subscribe-failed' | 'bad-input' | 'not-supported';
|
|
122
|
+
readonly message: string;
|
|
123
|
+
readonly cause?: unknown;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/** Envelope version — bumped only when the payload shape changes. */
|
|
127
|
+
export const CURRENT_EVENT_BUS_ENVELOPE_VERSION = 1 as const;
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
// Copyright (C) 2026 Kindgi Inc.
|
|
3
|
+
|
|
4
|
+
import type { TupleEnqueueHook } from '@kindgi/authz';
|
|
5
|
+
import type { Flow } from '@kindgi/flow';
|
|
6
|
+
import type { Scope } from '@kindgi/platform';
|
|
7
|
+
import type { Cursor, FlowId, ProjectId, TenantId } from '@kindgi/types';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Caller-plugged surface for the flow catalog. Mirrors
|
|
11
|
+
* `AgentRegistryBinding` 1:1 — the API package does NOT own registry
|
|
12
|
+
* persistence. Deployments wire an in-memory `Map`-backed store — or a
|
|
13
|
+
* durable pack-backed store — through this binding.
|
|
14
|
+
*
|
|
15
|
+
* Publish is data-as-code: the route validates the wire body via
|
|
16
|
+
* `loadFlow(...)` from `@kindgi/flow` before calling; the binding
|
|
17
|
+
* receives a well-formed `Flow`. Handler-as-code uploads (a flow
|
|
18
|
+
* carrying inline node handlers) are not supported.
|
|
19
|
+
*
|
|
20
|
+
* Every method is tenant-scoped: callers pass `tenantId` explicitly so
|
|
21
|
+
* multi-tenant deployments can partition storage without exposing the
|
|
22
|
+
* scoping inside the API package.
|
|
23
|
+
*
|
|
24
|
+
* Cursors are opaque — the binding chooses its encoding (index-based,
|
|
25
|
+
* `id@version`, ISO timestamps). The API layer only validates that a
|
|
26
|
+
* cursor round-trips as a string; it never inspects the payload.
|
|
27
|
+
*/
|
|
28
|
+
export interface FlowRegistryBinding {
|
|
29
|
+
/**
|
|
30
|
+
* Cursor-paginated list of flows (latest version per id, sorted by
|
|
31
|
+
* flow id ascending). Optional `nameFilter` is a prefix match on the
|
|
32
|
+
* flow id — the runtime uses dotted namespaces (`ingest.contract-pdf`),
|
|
33
|
+
* so prefix matching is the natural filter shape.
|
|
34
|
+
*/
|
|
35
|
+
list(input: FlowListInput): Promise<FlowPage>;
|
|
36
|
+
/**
|
|
37
|
+
* Latest version of the given flow id, or `null` if unknown. The
|
|
38
|
+
* route surfaces `null` as `404 flow-not-found`.
|
|
39
|
+
*/
|
|
40
|
+
get(input: FlowGetInput): Promise<Flow | null>;
|
|
41
|
+
/**
|
|
42
|
+
* Specific `(flowId, version)` lookup, or `null` if unknown.
|
|
43
|
+
* Returns tombstoned versions too — provenance paths need to
|
|
44
|
+
* resolve historical run references.
|
|
45
|
+
*/
|
|
46
|
+
getVersion(input: FlowGetVersionInput): Promise<Flow | null>;
|
|
47
|
+
/**
|
|
48
|
+
* Head-row existence check. Lets `GET /v1/flows/{id}` distinguish
|
|
49
|
+
* `410 gone` (identity exists, no active version) from `404 not-
|
|
50
|
+
* found` (never registered).
|
|
51
|
+
*/
|
|
52
|
+
headExists(input: FlowGetInput): Promise<boolean>;
|
|
53
|
+
/**
|
|
54
|
+
* Cursor-paginated list of versions for a specific flow id. Sort
|
|
55
|
+
* order is binding-defined (for example ascending semver). Returns an empty page (no error) when the id
|
|
56
|
+
* is unknown — the route flips that to `404` via a prior `get`.
|
|
57
|
+
*/
|
|
58
|
+
listVersions(input: FlowListVersionsInput): Promise<FlowPage>;
|
|
59
|
+
/**
|
|
60
|
+
* Publish a validated flow definition. The API route validates
|
|
61
|
+
* shape via `loadFlow(...)` before calling — the binding receives a
|
|
62
|
+
* well-formed `Flow`. Bindings MAY reject with `already-registered`
|
|
63
|
+
* when the same `(flowId, version)` is re-published; the route maps
|
|
64
|
+
* that to `409`.
|
|
65
|
+
*/
|
|
66
|
+
publish(input: FlowPublishInput): Promise<FlowPublishOutcome>;
|
|
67
|
+
/**
|
|
68
|
+
* Soft-tombstone a specific `(flowId, version)`. When this leaves
|
|
69
|
+
* NO active versions, the flow has no latest version — it enters the
|
|
70
|
+
* derived "retired" state (GET returns 410 gone).
|
|
71
|
+
* Publish of a new version reactivates.
|
|
72
|
+
*/
|
|
73
|
+
unregister(input: FlowUnregisterInput): Promise<FlowUnregisterOutcome>;
|
|
74
|
+
/**
|
|
75
|
+
* Un-tombstone a specific `(flowId, version)`. Recomputes the flow's
|
|
76
|
+
* latest version. Restores manifest bytes verbatim (semver
|
|
77
|
+
* hygiene). Idempotent.
|
|
78
|
+
*/
|
|
79
|
+
reinstateVersion(input: FlowReinstateVersionInput): Promise<FlowReinstateVersionOutcome>;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export interface FlowListInput {
|
|
83
|
+
readonly tenantId: TenantId;
|
|
84
|
+
readonly limit: number;
|
|
85
|
+
readonly cursor?: Cursor;
|
|
86
|
+
/** Prefix match on `Flow.id`. Undefined = no filter. */
|
|
87
|
+
readonly nameFilter?: string;
|
|
88
|
+
/**
|
|
89
|
+
* Narrow the list to a specific scope. Absent = no scope narrow
|
|
90
|
+
* (return every row in the tenant the caller can see — admin/audit
|
|
91
|
+
* default).
|
|
92
|
+
*
|
|
93
|
+
* Content-scoped semantics (this binding):
|
|
94
|
+
* - `{ kind: 'project', projectId }` — rows in that project.
|
|
95
|
+
* - `{ kind: 'org', orgId }` — rows in every project belonging to
|
|
96
|
+
* that org.
|
|
97
|
+
* - `{ kind: 'tenant', tenantId }` — every row in the tenant.
|
|
98
|
+
*
|
|
99
|
+
* Content rows always belong to a project, so `inherit` has no
|
|
100
|
+
* effect here.
|
|
101
|
+
*/
|
|
102
|
+
readonly scope?: Scope;
|
|
103
|
+
/**
|
|
104
|
+
* `false` = literal-at-this-scope only (admin/audit view).
|
|
105
|
+
* `true` (default) = inheritance walk (user-facing view).
|
|
106
|
+
* No-op for content-scoped bindings (rows only exist at
|
|
107
|
+
* project-level — there is no upward hierarchy to walk). Kept for
|
|
108
|
+
* uniformity: scope-aware bindings share one filter shape across the
|
|
109
|
+
* SDK and OpenAPI schemas.
|
|
110
|
+
*/
|
|
111
|
+
readonly inherit?: boolean;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export interface FlowGetInput {
|
|
115
|
+
readonly tenantId: TenantId;
|
|
116
|
+
readonly flowId: FlowId;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export interface FlowGetVersionInput {
|
|
120
|
+
readonly tenantId: TenantId;
|
|
121
|
+
readonly flowId: FlowId;
|
|
122
|
+
readonly version: string;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export interface FlowListVersionsInput {
|
|
126
|
+
readonly tenantId: TenantId;
|
|
127
|
+
readonly flowId: FlowId;
|
|
128
|
+
readonly limit: number;
|
|
129
|
+
readonly cursor?: Cursor;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export interface FlowPublishInput {
|
|
133
|
+
readonly tenantId: TenantId;
|
|
134
|
+
/**
|
|
135
|
+
* Project the flow is published into. REQUIRED. Callers that
|
|
136
|
+
* don't naturally know a projectId
|
|
137
|
+
* (deployment route) resolve the tenant's Default via
|
|
138
|
+
* `projectBinding.getDefault(tenantId)` at THEIR layer and thread
|
|
139
|
+
* the resolved id here — the storage adapter never silently falls
|
|
140
|
+
* back to Default.
|
|
141
|
+
*/
|
|
142
|
+
readonly projectId: ProjectId;
|
|
143
|
+
readonly flow: Flow;
|
|
144
|
+
/**
|
|
145
|
+
* REQUIRED. Called inside the binding's write transaction after the
|
|
146
|
+
* head + version rows are inserted, receiving the FGA subject id
|
|
147
|
+
* (business `flowId`). Returns the `TupleIntent[]` to enqueue in
|
|
148
|
+
* the same tx — typically `tuplesForCreate({kind:'flow', ...})`.
|
|
149
|
+
* See `AgentPublishInput.enqueueTuples` for the design rationale.
|
|
150
|
+
*/
|
|
151
|
+
readonly enqueueTuples: TupleEnqueueHook;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export interface FlowUnregisterInput {
|
|
155
|
+
readonly tenantId: TenantId;
|
|
156
|
+
readonly flowId: FlowId;
|
|
157
|
+
readonly version: string;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export interface FlowReinstateVersionInput {
|
|
161
|
+
readonly tenantId: TenantId;
|
|
162
|
+
readonly flowId: FlowId;
|
|
163
|
+
readonly version: string;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
export interface FlowPage {
|
|
167
|
+
readonly data: readonly Flow[];
|
|
168
|
+
readonly nextCursor?: Cursor;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
export type FlowPublishOutcome =
|
|
172
|
+
| {
|
|
173
|
+
readonly kind: 'ok';
|
|
174
|
+
readonly flowId: FlowId;
|
|
175
|
+
readonly version: string;
|
|
176
|
+
}
|
|
177
|
+
| {
|
|
178
|
+
readonly kind: 'already-registered';
|
|
179
|
+
readonly flowId: FlowId;
|
|
180
|
+
readonly version: string;
|
|
181
|
+
}
|
|
182
|
+
| {
|
|
183
|
+
/**
|
|
184
|
+
* The caller-supplied `projectId` does not resolve to a real
|
|
185
|
+
* project row in this tenant. Distinct from
|
|
186
|
+
* `already-registered` so callers can surface a clean error (the
|
|
187
|
+
* flows route answers `400 bad-input`) rather than the
|
|
188
|
+
* misleading `already-registered` fallback. Implementations
|
|
189
|
+
* detect a missing project at publish time (a SQL store typically
|
|
190
|
+
* from its foreign-key violation).
|
|
191
|
+
*/
|
|
192
|
+
readonly kind: 'project-not-found';
|
|
193
|
+
readonly flowId: FlowId;
|
|
194
|
+
readonly version: string;
|
|
195
|
+
readonly projectId: ProjectId;
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
export type FlowUnregisterOutcome = {
|
|
199
|
+
readonly unregistered: boolean;
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
export type FlowReinstateVersionOutcome =
|
|
203
|
+
| {
|
|
204
|
+
readonly kind: 'ok';
|
|
205
|
+
readonly flowId: FlowId;
|
|
206
|
+
readonly version: string;
|
|
207
|
+
readonly wasTombstoned: boolean;
|
|
208
|
+
}
|
|
209
|
+
| {
|
|
210
|
+
readonly kind: 'not-found';
|
|
211
|
+
readonly flowId: FlowId;
|
|
212
|
+
readonly version: string;
|
|
213
|
+
};
|