@sentropic/cluster-mesh 0.25.0 → 0.27.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/dist/comments/storage-schema.d.ts +1 -1
- package/dist/comments/transport-contracts.d.ts +1 -1
- package/dist/compile/contract/diagnostics.d.ts +9 -0
- package/dist/compile/contract/diagnostics.d.ts.map +1 -0
- package/dist/compile/contract/diagnostics.js +82 -0
- package/dist/compile/contract/diagnostics.js.map +1 -0
- package/dist/compile/contract/encoding.d.ts +12 -0
- package/dist/compile/contract/encoding.d.ts.map +1 -0
- package/dist/compile/contract/encoding.js +95 -0
- package/dist/compile/contract/encoding.js.map +1 -0
- package/dist/compile/contract/index.d.ts +9 -0
- package/dist/compile/contract/index.d.ts.map +1 -0
- package/dist/compile/contract/index.js +9 -0
- package/dist/compile/contract/index.js.map +1 -0
- package/dist/compile/contract/json.d.ts +3 -0
- package/dist/compile/contract/json.d.ts.map +1 -0
- package/dist/compile/contract/json.js +75 -0
- package/dist/compile/contract/json.js.map +1 -0
- package/dist/compile/contract/output.d.ts +5 -0
- package/dist/compile/contract/output.d.ts.map +1 -0
- package/dist/compile/contract/output.js +57 -0
- package/dist/compile/contract/output.js.map +1 -0
- package/dist/compile/contract/recipe.d.ts +5 -0
- package/dist/compile/contract/recipe.d.ts.map +1 -0
- package/dist/compile/contract/recipe.js +86 -0
- package/dist/compile/contract/recipe.js.map +1 -0
- package/dist/compile/contract/schema.d.ts +26 -0
- package/dist/compile/contract/schema.d.ts.map +1 -0
- package/dist/compile/contract/schema.js +92 -0
- package/dist/compile/contract/schema.js.map +1 -0
- package/dist/compile/contract/types.d.ts +166 -0
- package/dist/compile/contract/types.d.ts.map +1 -0
- package/dist/compile/contract/types.js +21 -0
- package/dist/compile/contract/types.js.map +1 -0
- package/dist/compile/contract/vectors.d.ts +38 -0
- package/dist/compile/contract/vectors.d.ts.map +1 -0
- package/dist/compile/contract/vectors.js +29 -0
- package/dist/compile/contract/vectors.js.map +1 -0
- package/dist/forge/contracts.d.ts +60 -0
- package/dist/forge/contracts.d.ts.map +1 -0
- package/dist/forge/contracts.js +19 -0
- package/dist/forge/contracts.js.map +1 -0
- package/dist/forge/custody.d.ts +7 -0
- package/dist/forge/custody.d.ts.map +1 -0
- package/dist/forge/custody.js +76 -0
- package/dist/forge/custody.js.map +1 -0
- package/dist/forge/enrollment.d.ts +151 -0
- package/dist/forge/enrollment.d.ts.map +1 -0
- package/dist/forge/enrollment.js +98 -0
- package/dist/forge/enrollment.js.map +1 -0
- package/dist/forge/github-api.d.ts +6 -0
- package/dist/forge/github-api.d.ts.map +1 -0
- package/dist/forge/github-api.js +131 -0
- package/dist/forge/github-api.js.map +1 -0
- package/dist/forge/hono.d.ts +14 -0
- package/dist/forge/hono.d.ts.map +1 -0
- package/dist/forge/hono.js +141 -0
- package/dist/forge/hono.js.map +1 -0
- package/dist/forge/lifecycle.d.ts +108 -0
- package/dist/forge/lifecycle.d.ts.map +1 -0
- package/dist/forge/lifecycle.js +160 -0
- package/dist/forge/lifecycle.js.map +1 -0
- package/dist/forge/records.d.ts +70 -0
- package/dist/forge/records.d.ts.map +1 -0
- package/dist/forge/records.js +2 -0
- package/dist/forge/records.js.map +1 -0
- package/dist/forge/rotation.d.ts +46 -0
- package/dist/forge/rotation.d.ts.map +1 -0
- package/dist/forge/rotation.js +62 -0
- package/dist/forge/rotation.js.map +1 -0
- package/dist/identity/auth-abort.d.ts +9 -0
- package/dist/identity/auth-abort.d.ts.map +1 -0
- package/dist/identity/auth-abort.js +59 -0
- package/dist/identity/auth-abort.js.map +1 -0
- package/dist/identity/auth-binding.d.ts +3 -0
- package/dist/identity/auth-binding.d.ts.map +1 -0
- package/dist/identity/auth-binding.js +87 -0
- package/dist/identity/auth-binding.js.map +1 -0
- package/dist/identity/auth-boundary.d.ts +11 -0
- package/dist/identity/auth-boundary.d.ts.map +1 -0
- package/dist/identity/auth-boundary.js +73 -0
- package/dist/identity/auth-boundary.js.map +1 -0
- package/dist/identity/auth-completion.d.ts +9 -0
- package/dist/identity/auth-completion.d.ts.map +1 -0
- package/dist/identity/auth-completion.js +24 -0
- package/dist/identity/auth-completion.js.map +1 -0
- package/dist/identity/auth-credentials.d.ts +5 -0
- package/dist/identity/auth-credentials.d.ts.map +1 -0
- package/dist/identity/auth-credentials.js +82 -0
- package/dist/identity/auth-credentials.js.map +1 -0
- package/dist/identity/auth-email.d.ts +8 -0
- package/dist/identity/auth-email.d.ts.map +1 -0
- package/dist/identity/auth-email.js +104 -0
- package/dist/identity/auth-email.js.map +1 -0
- package/dist/identity/auth-hono.d.ts +5 -0
- package/dist/identity/auth-hono.d.ts.map +1 -0
- package/dist/identity/auth-hono.js +10 -0
- package/dist/identity/auth-hono.js.map +1 -0
- package/dist/identity/auth-proofs.d.ts +11 -0
- package/dist/identity/auth-proofs.d.ts.map +1 -0
- package/dist/identity/auth-proofs.js +107 -0
- package/dist/identity/auth-proofs.js.map +1 -0
- package/dist/identity/auth-service-tenant.d.ts +4 -0
- package/dist/identity/auth-service-tenant.d.ts.map +1 -0
- package/dist/identity/auth-service-tenant.js +54 -0
- package/dist/identity/auth-service-tenant.js.map +1 -0
- package/dist/identity/auth-sessions.d.ts +8 -0
- package/dist/identity/auth-sessions.d.ts.map +1 -0
- package/dist/identity/auth-sessions.js +141 -0
- package/dist/identity/auth-sessions.js.map +1 -0
- package/dist/identity/auth-social.d.ts +4 -0
- package/dist/identity/auth-social.d.ts.map +1 -0
- package/dist/identity/auth-social.js +82 -0
- package/dist/identity/auth-social.js.map +1 -0
- package/dist/identity/auth-users.d.ts +9 -0
- package/dist/identity/auth-users.d.ts.map +1 -0
- package/dist/identity/auth-users.js +116 -0
- package/dist/identity/auth-users.js.map +1 -0
- package/dist/identity/auth-webauthn.d.ts +22 -0
- package/dist/identity/auth-webauthn.d.ts.map +1 -0
- package/dist/identity/auth-webauthn.js +108 -0
- package/dist/identity/auth-webauthn.js.map +1 -0
- package/dist/identity/cascade.d.ts +12 -0
- package/dist/identity/cascade.d.ts.map +1 -0
- package/dist/identity/cascade.js +19 -0
- package/dist/identity/cascade.js.map +1 -0
- package/dist/identity/connector-custody.d.ts +85 -0
- package/dist/identity/connector-custody.d.ts.map +1 -0
- package/dist/identity/connector-custody.js +288 -0
- package/dist/identity/connector-custody.js.map +1 -0
- package/dist/identity/conversation.d.ts +50 -0
- package/dist/identity/conversation.d.ts.map +1 -0
- package/dist/identity/conversation.js +102 -0
- package/dist/identity/conversation.js.map +1 -0
- package/dist/identity/custody-crypto.d.ts +37 -0
- package/dist/identity/custody-crypto.d.ts.map +1 -0
- package/dist/identity/custody-crypto.js +173 -0
- package/dist/identity/custody-crypto.js.map +1 -0
- package/dist/identity/decision.d.ts +28 -0
- package/dist/identity/decision.d.ts.map +1 -0
- package/dist/identity/decision.js +97 -0
- package/dist/identity/decision.js.map +1 -0
- package/dist/identity/index.d.ts +9 -0
- package/dist/identity/index.d.ts.map +1 -0
- package/dist/identity/index.js +13 -0
- package/dist/identity/index.js.map +1 -0
- package/dist/identity/ledger.d.ts +120 -0
- package/dist/identity/ledger.d.ts.map +1 -0
- package/dist/identity/ledger.js +226 -0
- package/dist/identity/ledger.js.map +1 -0
- package/dist/identity/postgres.d.ts +13 -0
- package/dist/identity/postgres.d.ts.map +1 -0
- package/dist/identity/postgres.js +207 -0
- package/dist/identity/postgres.js.map +1 -0
- package/dist/identity/sqlite.d.ts +14 -0
- package/dist/identity/sqlite.d.ts.map +1 -0
- package/dist/identity/sqlite.js +193 -0
- package/dist/identity/sqlite.js.map +1 -0
- package/dist/identity-contracts/accounts.d.ts.map +1 -1
- package/dist/identity-contracts/accounts.js +4 -3
- package/dist/identity-contracts/accounts.js.map +1 -1
- package/dist/identity-contracts/boundary-resolution.d.ts +31 -0
- package/dist/identity-contracts/boundary-resolution.d.ts.map +1 -0
- package/dist/identity-contracts/boundary-resolution.js +56 -0
- package/dist/identity-contracts/boundary-resolution.js.map +1 -0
- package/dist/identity-contracts/composition-descriptors.d.ts +17 -0
- package/dist/identity-contracts/composition-descriptors.d.ts.map +1 -0
- package/dist/identity-contracts/composition-descriptors.js +77 -0
- package/dist/identity-contracts/composition-descriptors.js.map +1 -0
- package/dist/identity-contracts/custody-auth.d.ts +122 -0
- package/dist/identity-contracts/custody-auth.d.ts.map +1 -0
- package/dist/identity-contracts/custody-auth.js +2 -0
- package/dist/identity-contracts/custody-auth.js.map +1 -0
- package/dist/identity-contracts/custody-descriptors.d.ts +18 -0
- package/dist/identity-contracts/custody-descriptors.d.ts.map +1 -0
- package/dist/identity-contracts/custody-descriptors.js +83 -0
- package/dist/identity-contracts/custody-descriptors.js.map +1 -0
- package/dist/identity-contracts/custody-errors.d.ts +21 -0
- package/dist/identity-contracts/custody-errors.d.ts.map +1 -0
- package/dist/identity-contracts/custody-errors.js +80 -0
- package/dist/identity-contracts/custody-errors.js.map +1 -0
- package/dist/identity-contracts/custody-operations.d.ts +79 -0
- package/dist/identity-contracts/custody-operations.d.ts.map +1 -0
- package/dist/identity-contracts/custody-operations.js +2 -0
- package/dist/identity-contracts/custody-operations.js.map +1 -0
- package/dist/identity-contracts/custody.d.ts +587 -0
- package/dist/identity-contracts/custody.d.ts.map +1 -0
- package/dist/identity-contracts/custody.js +7 -0
- package/dist/identity-contracts/custody.js.map +1 -0
- package/dist/identity-contracts/doubles.d.ts +11 -2
- package/dist/identity-contracts/doubles.d.ts.map +1 -1
- package/dist/identity-contracts/doubles.js +20 -0
- package/dist/identity-contracts/doubles.js.map +1 -1
- package/dist/identity-contracts/index.d.ts +10 -0
- package/dist/identity-contracts/index.d.ts.map +1 -1
- package/dist/identity-contracts/index.js +10 -0
- package/dist/identity-contracts/index.js.map +1 -1
- package/dist/identity-contracts/oauth-reads.d.ts +42 -0
- package/dist/identity-contracts/oauth-reads.d.ts.map +1 -0
- package/dist/identity-contracts/oauth-reads.js +38 -0
- package/dist/identity-contracts/oauth-reads.js.map +1 -0
- package/dist/identity-contracts/replica-sync.d.ts +89 -0
- package/dist/identity-contracts/replica-sync.d.ts.map +1 -0
- package/dist/identity-contracts/replica-sync.js +7 -0
- package/dist/identity-contracts/replica-sync.js.map +1 -0
- package/dist/identity-contracts/service-tenancy.d.ts +43 -0
- package/dist/identity-contracts/service-tenancy.d.ts.map +1 -0
- package/dist/identity-contracts/service-tenancy.js +75 -0
- package/dist/identity-contracts/service-tenancy.js.map +1 -0
- package/dist/identity-contracts/workspace-deletion.d.ts +56 -0
- package/dist/identity-contracts/workspace-deletion.d.ts.map +1 -0
- package/dist/identity-contracts/workspace-deletion.js +7 -0
- package/dist/identity-contracts/workspace-deletion.js.map +1 -0
- package/dist/identity-stores/index.d.ts +4 -0
- package/dist/identity-stores/index.d.ts.map +1 -0
- package/dist/identity-stores/index.js +7 -0
- package/dist/identity-stores/index.js.map +1 -0
- package/dist/identity-stores/tenancy-postgres.d.ts +23 -0
- package/dist/identity-stores/tenancy-postgres.d.ts.map +1 -0
- package/dist/identity-stores/tenancy-postgres.js +294 -0
- package/dist/identity-stores/tenancy-postgres.js.map +1 -0
- package/dist/identity-stores/tenancy-schema.d.ts +11 -0
- package/dist/identity-stores/tenancy-schema.d.ts.map +1 -0
- package/dist/identity-stores/tenancy-schema.js +74 -0
- package/dist/identity-stores/tenancy-schema.js.map +1 -0
- package/dist/identity-stores/tenancy-sqlite.d.ts +24 -0
- package/dist/identity-stores/tenancy-sqlite.d.ts.map +1 -0
- package/dist/identity-stores/tenancy-sqlite.js +288 -0
- package/dist/identity-stores/tenancy-sqlite.js.map +1 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +16 -0
- package/dist/index.js.map +1 -1
- package/dist/loaders/notifications/index.d.ts +5 -0
- package/dist/loaders/notifications/index.d.ts.map +1 -0
- package/dist/loaders/notifications/index.js +6 -0
- package/dist/loaders/notifications/index.js.map +1 -0
- package/dist/mcp/stateful-preflight.d.ts +1 -1
- package/dist/messaging/email-port.d.ts +49 -0
- package/dist/messaging/email-port.d.ts.map +1 -0
- package/dist/messaging/email-port.js +92 -0
- package/dist/messaging/email-port.js.map +1 -0
- package/dist/messaging/index.d.ts +1 -0
- package/dist/messaging/index.d.ts.map +1 -1
- package/dist/messaging/index.js +1 -0
- package/dist/messaging/index.js.map +1 -1
- package/dist/modules/catalog.d.ts +5 -4
- package/dist/modules/catalog.d.ts.map +1 -1
- package/dist/modules/catalog.js +10 -5
- package/dist/modules/catalog.js.map +1 -1
- package/dist/modules/contracts.d.ts +1 -1
- package/dist/modules/contracts.d.ts.map +1 -1
- package/dist/modules/contracts.js +1 -0
- package/dist/modules/contracts.js.map +1 -1
- package/dist/notifications/incident-policy.d.ts +6 -0
- package/dist/notifications/incident-policy.d.ts.map +1 -0
- package/dist/notifications/incident-policy.js +119 -0
- package/dist/notifications/incident-policy.js.map +1 -0
- package/dist/notifications/incident-schedule.d.ts +14 -0
- package/dist/notifications/incident-schedule.d.ts.map +1 -0
- package/dist/notifications/incident-schedule.js +36 -0
- package/dist/notifications/incident-schedule.js.map +1 -0
- package/dist/notifications/incident-state.d.ts +72 -0
- package/dist/notifications/incident-state.d.ts.map +1 -0
- package/dist/notifications/incident-state.js +72 -0
- package/dist/notifications/incident-state.js.map +1 -0
- package/dist/notifications/index.d.ts +9 -0
- package/dist/notifications/index.d.ts.map +1 -0
- package/dist/notifications/index.js +9 -0
- package/dist/notifications/index.js.map +1 -0
- package/dist/notifications/ops-job-failure-contract.d.ts +19 -0
- package/dist/notifications/ops-job-failure-contract.d.ts.map +1 -0
- package/dist/notifications/ops-job-failure-contract.js +183 -0
- package/dist/notifications/ops-job-failure-contract.js.map +1 -0
- package/dist/notifications/ops-job-failure-types.d.ts +81 -0
- package/dist/notifications/ops-job-failure-types.d.ts.map +1 -0
- package/dist/notifications/ops-job-failure-types.js +73 -0
- package/dist/notifications/ops-job-failure-types.js.map +1 -0
- package/dist/notifications/recipients-http.d.ts +66 -0
- package/dist/notifications/recipients-http.d.ts.map +1 -0
- package/dist/notifications/recipients-http.js +148 -0
- package/dist/notifications/recipients-http.js.map +1 -0
- package/dist/notifications/recipients.d.ts +50 -0
- package/dist/notifications/recipients.d.ts.map +1 -0
- package/dist/notifications/recipients.js +59 -0
- package/dist/notifications/recipients.js.map +1 -0
- package/dist/prompts/registry.d.ts +55 -0
- package/dist/prompts/registry.d.ts.map +1 -0
- package/dist/prompts/registry.js +76 -0
- package/dist/prompts/registry.js.map +1 -0
- package/dist/remote/assembly-contract.d.ts +96 -0
- package/dist/remote/assembly-contract.d.ts.map +1 -0
- package/dist/remote/assembly-contract.js +150 -0
- package/dist/remote/assembly-contract.js.map +1 -0
- package/dist/remote/contract-receipt.d.ts +36 -0
- package/dist/remote/contract-receipt.d.ts.map +1 -0
- package/dist/remote/contract-receipt.js +109 -0
- package/dist/remote/contract-receipt.js.map +1 -0
- package/dist/remote/credit-baseline.d.ts +60 -0
- package/dist/remote/credit-baseline.d.ts.map +1 -0
- package/dist/remote/credit-baseline.js +117 -0
- package/dist/remote/credit-baseline.js.map +1 -0
- package/dist/runtime/heavy-phase-queue.d.ts +101 -0
- package/dist/runtime/heavy-phase-queue.d.ts.map +1 -0
- package/dist/runtime/heavy-phase-queue.js +129 -0
- package/dist/runtime/heavy-phase-queue.js.map +1 -0
- package/dist/sessions/content-policy.d.ts +55 -0
- package/dist/sessions/content-policy.d.ts.map +1 -0
- package/dist/sessions/content-policy.js +133 -0
- package/dist/sessions/content-policy.js.map +1 -0
- package/dist/sessions/registry-admin.d.ts +19 -0
- package/dist/sessions/registry-admin.d.ts.map +1 -0
- package/dist/sessions/registry-admin.js +42 -0
- package/dist/sessions/registry-admin.js.map +1 -0
- package/dist/sessions/registry-freshness.d.ts +8 -0
- package/dist/sessions/registry-freshness.d.ts.map +1 -0
- package/dist/sessions/registry-freshness.js +108 -0
- package/dist/sessions/registry-freshness.js.map +1 -0
- package/dist/sessions/registry-ingest.d.ts +5 -0
- package/dist/sessions/registry-ingest.d.ts.map +1 -0
- package/dist/sessions/registry-ingest.js +113 -0
- package/dist/sessions/registry-ingest.js.map +1 -0
- package/dist/sessions/registry-publish.d.ts +18 -0
- package/dist/sessions/registry-publish.d.ts.map +1 -0
- package/dist/sessions/registry-publish.js +134 -0
- package/dist/sessions/registry-publish.js.map +1 -0
- package/dist/sessions/registry-store.d.ts +51 -0
- package/dist/sessions/registry-store.d.ts.map +1 -0
- package/dist/sessions/registry-store.js +134 -0
- package/dist/sessions/registry-store.js.map +1 -0
- package/dist/sessions/registry-types.d.ts +180 -0
- package/dist/sessions/registry-types.d.ts.map +1 -0
- package/dist/sessions/registry-types.js +32 -0
- package/dist/sessions/registry-types.js.map +1 -0
- package/dist/sessions/registry.d.ts +45 -0
- package/dist/sessions/registry.d.ts.map +1 -0
- package/dist/sessions/registry.js +74 -0
- package/dist/sessions/registry.js.map +1 -0
- package/dist/sessions/relay-bind.d.ts +38 -0
- package/dist/sessions/relay-bind.d.ts.map +1 -0
- package/dist/sessions/relay-bind.js +74 -0
- package/dist/sessions/relay-bind.js.map +1 -0
- package/dist/sessions/relay-brand.d.ts +2 -0
- package/dist/sessions/relay-brand.d.ts.map +1 -0
- package/dist/sessions/relay-brand.js +7 -0
- package/dist/sessions/relay-brand.js.map +1 -0
- package/dist/sessions/relay-capsule.d.ts +50 -0
- package/dist/sessions/relay-capsule.d.ts.map +1 -0
- package/dist/sessions/relay-capsule.js +72 -0
- package/dist/sessions/relay-capsule.js.map +1 -0
- package/dist/sessions/relay-chain-failure.d.ts +25 -0
- package/dist/sessions/relay-chain-failure.d.ts.map +1 -0
- package/dist/sessions/relay-chain-failure.js +23 -0
- package/dist/sessions/relay-chain-failure.js.map +1 -0
- package/dist/sessions/relay-chain.d.ts +74 -0
- package/dist/sessions/relay-chain.d.ts.map +1 -0
- package/dist/sessions/relay-chain.js +71 -0
- package/dist/sessions/relay-chain.js.map +1 -0
- package/dist/sessions/relay-composition.d.ts +8 -0
- package/dist/sessions/relay-composition.d.ts.map +1 -0
- package/dist/sessions/relay-composition.js +65 -0
- package/dist/sessions/relay-composition.js.map +1 -0
- package/dist/sessions/relay-credit.d.ts +40 -0
- package/dist/sessions/relay-credit.d.ts.map +1 -0
- package/dist/sessions/relay-credit.js +68 -0
- package/dist/sessions/relay-credit.js.map +1 -0
- package/dist/sessions/relay-engine.d.ts +19 -0
- package/dist/sessions/relay-engine.d.ts.map +1 -0
- package/dist/sessions/relay-engine.js +34 -0
- package/dist/sessions/relay-engine.js.map +1 -0
- package/dist/sessions/relay-frames.d.ts +28 -0
- package/dist/sessions/relay-frames.d.ts.map +1 -0
- package/dist/sessions/relay-frames.js +72 -0
- package/dist/sessions/relay-frames.js.map +1 -0
- package/dist/sessions/relay-lane-client.d.ts +7 -0
- package/dist/sessions/relay-lane-client.d.ts.map +1 -0
- package/dist/sessions/relay-lane-client.js +137 -0
- package/dist/sessions/relay-lane-client.js.map +1 -0
- package/dist/sessions/relay-lane-lease.d.ts +20 -0
- package/dist/sessions/relay-lane-lease.d.ts.map +1 -0
- package/dist/sessions/relay-lane-lease.js +74 -0
- package/dist/sessions/relay-lane-lease.js.map +1 -0
- package/dist/sessions/relay-lane-record.d.ts +28 -0
- package/dist/sessions/relay-lane-record.d.ts.map +1 -0
- package/dist/sessions/relay-lane-record.js +28 -0
- package/dist/sessions/relay-lane-record.js.map +1 -0
- package/dist/sessions/relay-lane-stream.d.ts +13 -0
- package/dist/sessions/relay-lane-stream.d.ts.map +1 -0
- package/dist/sessions/relay-lane-stream.js +148 -0
- package/dist/sessions/relay-lane-stream.js.map +1 -0
- package/dist/sessions/relay-routes.d.ts +368 -0
- package/dist/sessions/relay-routes.d.ts.map +1 -0
- package/dist/sessions/relay-routes.js +46 -0
- package/dist/sessions/relay-routes.js.map +1 -0
- package/dist/sessions/relay-skeleton.d.ts +4 -0
- package/dist/sessions/relay-skeleton.d.ts.map +1 -0
- package/dist/sessions/relay-skeleton.js +85 -0
- package/dist/sessions/relay-skeleton.js.map +1 -0
- package/dist/sessions/relay-types.d.ts +107 -0
- package/dist/sessions/relay-types.d.ts.map +1 -0
- package/dist/sessions/relay-types.js +2 -0
- package/dist/sessions/relay-types.js.map +1 -0
- package/dist/sessions/relay-validate.d.ts +8 -0
- package/dist/sessions/relay-validate.d.ts.map +1 -0
- package/dist/sessions/relay-validate.js +169 -0
- package/dist/sessions/relay-validate.js.map +1 -0
- package/dist/sessions/relay-wire.d.ts +8 -0
- package/dist/sessions/relay-wire.d.ts.map +1 -0
- package/dist/sessions/relay-wire.js +37 -0
- package/dist/sessions/relay-wire.js.map +1 -0
- package/dist/sessions/relay-wiring.d.ts +26 -0
- package/dist/sessions/relay-wiring.d.ts.map +1 -0
- package/dist/sessions/relay-wiring.js +13 -0
- package/dist/sessions/relay-wiring.js.map +1 -0
- package/dist/sessions/relay.d.ts +11 -0
- package/dist/sessions/relay.d.ts.map +1 -0
- package/dist/sessions/relay.js +71 -0
- package/dist/sessions/relay.js.map +1 -0
- package/dist/storage/artifact-blob.d.ts +50 -0
- package/dist/storage/artifact-blob.d.ts.map +1 -0
- package/dist/storage/artifact-blob.js +2 -0
- package/dist/storage/artifact-blob.js.map +1 -0
- package/dist/storage/descriptor.d.ts +1 -1
- package/dist/storage/errors.d.ts +1 -1
- package/dist/storage/identity/atomic-deletion.d.ts +4 -0
- package/dist/storage/identity/atomic-deletion.d.ts.map +1 -0
- package/dist/storage/identity/atomic-deletion.js +235 -0
- package/dist/storage/identity/atomic-deletion.js.map +1 -0
- package/dist/storage/identity/custody-composition.d.ts +9 -0
- package/dist/storage/identity/custody-composition.d.ts.map +1 -0
- package/dist/storage/identity/custody-composition.js +31 -0
- package/dist/storage/identity/custody-composition.js.map +1 -0
- package/dist/storage/identity/custody-delivery-record.d.ts +4 -0
- package/dist/storage/identity/custody-delivery-record.d.ts.map +1 -0
- package/dist/storage/identity/custody-delivery-record.js +11 -0
- package/dist/storage/identity/custody-delivery-record.js.map +1 -0
- package/dist/storage/identity/custody-host.d.ts +16 -0
- package/dist/storage/identity/custody-host.d.ts.map +1 -0
- package/dist/storage/identity/custody-host.js +5 -0
- package/dist/storage/identity/custody-host.js.map +1 -0
- package/dist/storage/identity/custody-import-deliveries.d.ts +6 -0
- package/dist/storage/identity/custody-import-deliveries.d.ts.map +1 -0
- package/dist/storage/identity/custody-import-deliveries.js +46 -0
- package/dist/storage/identity/custody-import-deliveries.js.map +1 -0
- package/dist/storage/identity/custody-import.d.ts +4 -0
- package/dist/storage/identity/custody-import.d.ts.map +1 -0
- package/dist/storage/identity/custody-import.js +364 -0
- package/dist/storage/identity/custody-import.js.map +1 -0
- package/dist/storage/identity/custody-journal-postgres.d.ts +125 -0
- package/dist/storage/identity/custody-journal-postgres.d.ts.map +1 -0
- package/dist/storage/identity/custody-journal-postgres.js +428 -0
- package/dist/storage/identity/custody-journal-postgres.js.map +1 -0
- package/dist/storage/identity/custody-journal-sqlite.d.ts +121 -0
- package/dist/storage/identity/custody-journal-sqlite.d.ts.map +1 -0
- package/dist/storage/identity/custody-journal-sqlite.js +345 -0
- package/dist/storage/identity/custody-journal-sqlite.js.map +1 -0
- package/dist/storage/identity/custody-lifecycle.d.ts +4 -0
- package/dist/storage/identity/custody-lifecycle.d.ts.map +1 -0
- package/dist/storage/identity/custody-lifecycle.js +42 -0
- package/dist/storage/identity/custody-lifecycle.js.map +1 -0
- package/dist/storage/identity/custody-postgres.d.ts +96 -0
- package/dist/storage/identity/custody-postgres.d.ts.map +1 -0
- package/dist/storage/identity/custody-postgres.js +726 -0
- package/dist/storage/identity/custody-postgres.js.map +1 -0
- package/dist/storage/identity/custody-records.d.ts +17 -0
- package/dist/storage/identity/custody-records.d.ts.map +1 -0
- package/dist/storage/identity/custody-records.js +260 -0
- package/dist/storage/identity/custody-records.js.map +1 -0
- package/dist/storage/identity/custody-shared.d.ts +28 -0
- package/dist/storage/identity/custody-shared.d.ts.map +1 -0
- package/dist/storage/identity/custody-shared.js +24 -0
- package/dist/storage/identity/custody-shared.js.map +1 -0
- package/dist/storage/identity/custody-sqlite.d.ts +93 -0
- package/dist/storage/identity/custody-sqlite.d.ts.map +1 -0
- package/dist/storage/identity/custody-sqlite.js +568 -0
- package/dist/storage/identity/custody-sqlite.js.map +1 -0
- package/dist/storage/identity/custody-tombstone-record.d.ts +3 -0
- package/dist/storage/identity/custody-tombstone-record.d.ts.map +1 -0
- package/dist/storage/identity/custody-tombstone-record.js +8 -0
- package/dist/storage/identity/custody-tombstone-record.js.map +1 -0
- package/dist/storage/identity/custody-transaction-guards.d.ts +16 -0
- package/dist/storage/identity/custody-transaction-guards.d.ts.map +1 -0
- package/dist/storage/identity/custody-transaction-guards.js +64 -0
- package/dist/storage/identity/custody-transaction-guards.js.map +1 -0
- package/dist/storage/identity/custody-transaction-ports.d.ts +9 -0
- package/dist/storage/identity/custody-transaction-ports.d.ts.map +1 -0
- package/dist/storage/identity/custody-transaction-ports.js +106 -0
- package/dist/storage/identity/custody-transaction-ports.js.map +1 -0
- package/dist/storage/identity/deletion-planes.d.ts +10 -0
- package/dist/storage/identity/deletion-planes.d.ts.map +1 -0
- package/dist/storage/identity/deletion-planes.js +54 -0
- package/dist/storage/identity/deletion-planes.js.map +1 -0
- package/dist/storage/identity/index.d.ts +18 -0
- package/dist/storage/identity/index.d.ts.map +1 -0
- package/dist/storage/identity/index.js +22 -0
- package/dist/storage/identity/index.js.map +1 -0
- package/dist/storage/identity/postgres.d.ts +16 -0
- package/dist/storage/identity/postgres.d.ts.map +1 -0
- package/dist/storage/identity/postgres.js +345 -0
- package/dist/storage/identity/postgres.js.map +1 -0
- package/dist/storage/identity/records.d.ts +12 -0
- package/dist/storage/identity/records.d.ts.map +1 -0
- package/dist/storage/identity/records.js +84 -0
- package/dist/storage/identity/records.js.map +1 -0
- package/dist/storage/identity/replica-sync.d.ts +4 -0
- package/dist/storage/identity/replica-sync.d.ts.map +1 -0
- package/dist/storage/identity/replica-sync.js +402 -0
- package/dist/storage/identity/replica-sync.js.map +1 -0
- package/dist/storage/identity/schema.d.ts +13 -0
- package/dist/storage/identity/schema.d.ts.map +1 -0
- package/dist/storage/identity/schema.js +418 -0
- package/dist/storage/identity/schema.js.map +1 -0
- package/dist/storage/identity/sqlite-schema.d.ts +4 -0
- package/dist/storage/identity/sqlite-schema.d.ts.map +1 -0
- package/dist/storage/identity/sqlite-schema.js +17 -0
- package/dist/storage/identity/sqlite-schema.js.map +1 -0
- package/dist/storage/identity/sqlite.d.ts +25 -0
- package/dist/storage/identity/sqlite.d.ts.map +1 -0
- package/dist/storage/identity/sqlite.js +233 -0
- package/dist/storage/identity/sqlite.js.map +1 -0
- package/dist/storage/identity/stores.d.ts +10 -0
- package/dist/storage/identity/stores.d.ts.map +1 -0
- package/dist/storage/identity/stores.js +5 -0
- package/dist/storage/identity/stores.js.map +1 -0
- package/dist/storage/identity/wiring.d.ts +20 -0
- package/dist/storage/identity/wiring.d.ts.map +1 -0
- package/dist/storage/identity/wiring.js +26 -0
- package/dist/storage/identity/wiring.js.map +1 -0
- package/dist/storage/identity/workspace-deletion.d.ts +3 -0
- package/dist/storage/identity/workspace-deletion.d.ts.map +1 -0
- package/dist/storage/identity/workspace-deletion.js +100 -0
- package/dist/storage/identity/workspace-deletion.js.map +1 -0
- package/dist/storage/index.d.ts +1 -0
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/postgres/journal.d.ts +1 -1
- package/dist/storage/postgres/profiles.d.ts +2 -2
- package/dist/storage/postgres/scope.d.ts +1 -1
- package/dist/storage/root-facade.d.ts +1 -1
- package/dist/storage/root-journal.d.ts +1 -1
- package/dist/storage/root-profiles.d.ts +1 -1
- package/package.json +56 -4
- package/ui/AdminUsersScreen.svelte +197 -0
- package/ui/AdminUsersScreen.svelte.d.ts +4 -0
- package/ui/LoginScreen.svelte +15 -0
- package/ui/LoginScreen.svelte.d.ts +4 -0
- package/ui/MembershipDecisionsScreen.svelte +76 -0
- package/ui/MembershipDecisionsScreen.svelte.d.ts +4 -0
- package/ui/RegistrationScreen.svelte +15 -0
- package/ui/RegistrationScreen.svelte.d.ts +4 -0
- package/ui/WorkspaceMembersScreen.svelte +86 -0
- package/ui/WorkspaceMembersScreen.svelte.d.ts +4 -0
- package/ui/auth-flow.ts +44 -0
- package/ui/management-ports.ts +36 -0
- package/ui/management-transport.ts +29 -0
- package/contracts/engram-memory-neutral-contract-v1.d.ts +0 -367
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { IdentityAuditPort } from '../identity-contracts/ports.js';
|
|
2
|
+
import { type IdentityClock } from '../identity-contracts/types.js';
|
|
3
|
+
export type ConversationSessionStatus = 'active' | 'revoked' | 'expired';
|
|
4
|
+
export interface ConversationSessionRecord {
|
|
5
|
+
readonly conversationSessionId: string;
|
|
6
|
+
readonly userId: string;
|
|
7
|
+
readonly workspaceId: string;
|
|
8
|
+
readonly status: ConversationSessionStatus;
|
|
9
|
+
readonly openedAt: string;
|
|
10
|
+
readonly expiresAt: string;
|
|
11
|
+
readonly revokedAt?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface ConversationSessionInput {
|
|
14
|
+
readonly conversationSessionId: string;
|
|
15
|
+
readonly userId: string;
|
|
16
|
+
readonly workspaceId: string;
|
|
17
|
+
}
|
|
18
|
+
export interface ConversationAuthorityStore {
|
|
19
|
+
saveSession(record: ConversationSessionRecord): Promise<void>;
|
|
20
|
+
findSession(conversationSessionId: string): Promise<ConversationSessionRecord | null>;
|
|
21
|
+
revokeSession(conversationSessionId: string, at: string): Promise<ConversationSessionRecord>;
|
|
22
|
+
listSessionsForUser(userId: string): Promise<readonly ConversationSessionRecord[]>;
|
|
23
|
+
}
|
|
24
|
+
export declare class ConversationSessionError extends Error {
|
|
25
|
+
readonly reason: 'not_found' | 'expired' | 'revoked';
|
|
26
|
+
readonly code: "conversation_session_invalid";
|
|
27
|
+
constructor(reason: 'not_found' | 'expired' | 'revoked');
|
|
28
|
+
}
|
|
29
|
+
export interface ConversationAuthorityDomain {
|
|
30
|
+
openSession(input: ConversationSessionInput, options: {
|
|
31
|
+
readonly now: string;
|
|
32
|
+
readonly ttlSeconds: number;
|
|
33
|
+
}): Promise<ConversationSessionRecord>;
|
|
34
|
+
validateSession(conversationSessionId: string, now: string): Promise<ConversationSessionRecord>;
|
|
35
|
+
revokeSession(conversationSessionId: string, actorId: string): Promise<ConversationSessionRecord>;
|
|
36
|
+
listSessionsForUser(userId: string): Promise<readonly ConversationSessionRecord[]>;
|
|
37
|
+
}
|
|
38
|
+
export declare function createConversationAuthority(input: {
|
|
39
|
+
readonly sessions: ConversationAuthorityStore;
|
|
40
|
+
readonly audit: IdentityAuditPort;
|
|
41
|
+
readonly clock?: IdentityClock;
|
|
42
|
+
}): ConversationAuthorityDomain;
|
|
43
|
+
export declare class InMemoryConversationAuthorityStore implements ConversationAuthorityStore {
|
|
44
|
+
readonly sessions: ConversationSessionRecord[];
|
|
45
|
+
saveSession(record: ConversationSessionRecord): Promise<void>;
|
|
46
|
+
findSession(conversationSessionId: string): Promise<ConversationSessionRecord | null>;
|
|
47
|
+
revokeSession(conversationSessionId: string, at: string): Promise<ConversationSessionRecord>;
|
|
48
|
+
listSessionsForUser(userId: string): Promise<readonly ConversationSessionRecord[]>;
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=conversation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../../src/identity/conversation.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAuB,KAAK,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAEzF,MAAM,MAAM,yBAAyB,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,CAAC;AAEzE,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,qBAAqB,EAAE,MAAM,CAAC;IACvC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,yBAAyB,CAAC;IAC3C,QAAQ,CAAC,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AO,EAAE,MAAM,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAAC;IAClG,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,yBAAyB,EAAE,CAAC,CAAC;CACpF;AAMD,wBAAgB,2BAA2B,CAAC,KAAK,EAAE;IACjD,QAAQ,CAAC,QAAQ,EAAE,0BAA0B,CAAC;IAC9C,QAAQ,CAAC,KAAK,EAAE,iBAAiB,CAAC;IAClC,QAAQ,CAAC,KAAK,CAAC,EAAE,aAAa,CAAC;CAChC,GAAG,2BAA2B,CA+C9B;AAED,qBAAa,kCAAmC,YAAW,0BAA0B;IACnF,QAAQ,CAAC,QAAQ,EAAE,yBAAyB,EAAE,CAAM;IAE9C,WAAW,CAAC,MAAM,EAAE,yBAAyB,GAAG,OAAO,CAAC,IAAI,CAAC;IAQ7D,WAAW,CAAC,qBAAqB,EAAE,MAAM,GAAG,OAAO,CAAC,yBAAyB,GAAG,IAAI,CAAC;IAMrF,aAAa,CAAC,qBAAqB,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,yBAAyB,CAAC;IAc5F,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,yBAAyB,EAAE,CAAC;CAGzF"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
// A2.3 identity slice: the conversation session authority (spec r2 §2.7).
|
|
2
|
+
// The verified conversation session is the session authority for
|
|
3
|
+
// `conversation_turn` inputs: bound to one (account, workspace), distinct
|
|
4
|
+
// from any LoginSession (F05) — login expiry or logout alone never stops a
|
|
5
|
+
// running turn, while conversation, account or membership revocation stops
|
|
6
|
+
// the next turn. The store lands with this lot (A2.3); the agent-plane and
|
|
7
|
+
// runtime stores stay unbound until M4 and keep refusing
|
|
8
|
+
// `session_authority_unavailable`.
|
|
9
|
+
import { systemIdentityClock } from '../identity-contracts/types.js';
|
|
10
|
+
export class ConversationSessionError extends Error {
|
|
11
|
+
reason;
|
|
12
|
+
code = 'conversation_session_invalid';
|
|
13
|
+
constructor(reason) {
|
|
14
|
+
super(`Conversation session is invalid: ${reason}`);
|
|
15
|
+
this.reason = reason;
|
|
16
|
+
this.name = 'ConversationSessionError';
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
function addSeconds(now, ttlSeconds) {
|
|
20
|
+
return new Date(Date.parse(now) + ttlSeconds * 1000).toISOString();
|
|
21
|
+
}
|
|
22
|
+
export function createConversationAuthority(input) {
|
|
23
|
+
const clock = input.clock ?? systemIdentityClock;
|
|
24
|
+
return {
|
|
25
|
+
async openSession(session, options) {
|
|
26
|
+
const record = {
|
|
27
|
+
conversationSessionId: session.conversationSessionId,
|
|
28
|
+
userId: session.userId,
|
|
29
|
+
workspaceId: session.workspaceId,
|
|
30
|
+
status: 'active',
|
|
31
|
+
openedAt: options.now,
|
|
32
|
+
expiresAt: addSeconds(options.now, options.ttlSeconds),
|
|
33
|
+
};
|
|
34
|
+
await input.sessions.saveSession(record);
|
|
35
|
+
await input.audit.append({
|
|
36
|
+
at: clock(),
|
|
37
|
+
kind: 'conversation.opened',
|
|
38
|
+
actorId: session.userId,
|
|
39
|
+
subjectId: session.conversationSessionId,
|
|
40
|
+
});
|
|
41
|
+
return record;
|
|
42
|
+
},
|
|
43
|
+
async validateSession(conversationSessionId, now) {
|
|
44
|
+
const session = await input.sessions.findSession(conversationSessionId);
|
|
45
|
+
if (!session)
|
|
46
|
+
throw new ConversationSessionError('not_found');
|
|
47
|
+
if (session.status === 'revoked')
|
|
48
|
+
throw new ConversationSessionError('revoked');
|
|
49
|
+
if (session.status === 'expired' || session.expiresAt <= now) {
|
|
50
|
+
throw new ConversationSessionError('expired');
|
|
51
|
+
}
|
|
52
|
+
return session;
|
|
53
|
+
},
|
|
54
|
+
async revokeSession(conversationSessionId, actorId) {
|
|
55
|
+
const session = await input.sessions.findSession(conversationSessionId);
|
|
56
|
+
if (!session)
|
|
57
|
+
throw new ConversationSessionError('not_found');
|
|
58
|
+
if (session.status === 'revoked')
|
|
59
|
+
return session;
|
|
60
|
+
const revoked = await input.sessions.revokeSession(conversationSessionId, clock());
|
|
61
|
+
await input.audit.append({
|
|
62
|
+
at: clock(),
|
|
63
|
+
kind: 'conversation.revoked',
|
|
64
|
+
actorId,
|
|
65
|
+
subjectId: conversationSessionId,
|
|
66
|
+
});
|
|
67
|
+
return revoked;
|
|
68
|
+
},
|
|
69
|
+
async listSessionsForUser(userId) {
|
|
70
|
+
return input.sessions.listSessionsForUser(userId);
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
export class InMemoryConversationAuthorityStore {
|
|
75
|
+
sessions = [];
|
|
76
|
+
async saveSession(record) {
|
|
77
|
+
const existing = this.sessions.findIndex((session) => session.conversationSessionId === record.conversationSessionId);
|
|
78
|
+
if (existing >= 0)
|
|
79
|
+
this.sessions[existing] = record;
|
|
80
|
+
else
|
|
81
|
+
this.sessions.push(record);
|
|
82
|
+
}
|
|
83
|
+
async findSession(conversationSessionId) {
|
|
84
|
+
return (this.sessions.find((session) => session.conversationSessionId === conversationSessionId) ?? null);
|
|
85
|
+
}
|
|
86
|
+
async revokeSession(conversationSessionId, at) {
|
|
87
|
+
const existing = this.sessions.find((session) => session.conversationSessionId === conversationSessionId);
|
|
88
|
+
if (!existing)
|
|
89
|
+
throw new ConversationSessionError('not_found');
|
|
90
|
+
const updated = {
|
|
91
|
+
...existing,
|
|
92
|
+
status: 'revoked',
|
|
93
|
+
revokedAt: at,
|
|
94
|
+
};
|
|
95
|
+
this.sessions[this.sessions.indexOf(existing)] = updated;
|
|
96
|
+
return updated;
|
|
97
|
+
}
|
|
98
|
+
async listSessionsForUser(userId) {
|
|
99
|
+
return this.sessions.filter((session) => session.userId === userId);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
//# sourceMappingURL=conversation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversation.js","sourceRoot":"","sources":["../../src/identity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AO,CAAC;QACzD,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,KAAK,CAAC,mBAAmB,CAAC,MAAc;QACtC,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,KAAK,MAAM,CAAC,CAAC;IACtE,CAAC;CACF"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { IdentityDigestPortV1, IdentityEmailTicketTokenPortV1, IdentitySha256HexV1 } from '../identity-contracts/custody.js';
|
|
2
|
+
export declare const isSha256HexV1: (value: string) => boolean;
|
|
3
|
+
export declare const isCanonicalBase64UrlV1: (value: string) => boolean;
|
|
4
|
+
/** Overwrites every byte of an owned mutable buffer. Strings are immutable
|
|
5
|
+
* and are never passed here; callers keep binary material in Uint8Array. */
|
|
6
|
+
export declare const zeroizeV1: (buffer: Uint8Array) => void;
|
|
7
|
+
export declare const hashUtf8Borrowed: (value: Uint8Array) => Promise<IdentitySha256HexV1>;
|
|
8
|
+
/** Exact email-code keyed preimage: HMAC-SHA256(keyRef,
|
|
9
|
+
* UTF8(JSON.stringify(["cm-email-code","1",canonicalEmail,code]))). */
|
|
10
|
+
export declare const emailCodePreimageV1: (canonicalEmail: string, code: string) => Uint8Array;
|
|
11
|
+
export interface StaticDigestKeyRing {
|
|
12
|
+
readonly keys: Readonly<Record<string, Uint8Array>>;
|
|
13
|
+
}
|
|
14
|
+
/** Test/production adapter factory: keys stay with the custodian; the port
|
|
15
|
+
* borrows them per call and never exposes them. */
|
|
16
|
+
export declare const createNodeIdentityDigestPort: (keys?: Readonly<Record<string, Uint8Array>>) => IdentityDigestPortV1;
|
|
17
|
+
/** Asserts canonical binding form; rejects anything the adapters must not
|
|
18
|
+
* silently normalize. */
|
|
19
|
+
export declare const assertCanonicalEmailV1: (email: string) => string;
|
|
20
|
+
export interface IssuedTokenMaterial {
|
|
21
|
+
readonly token: string;
|
|
22
|
+
/** Owned mutable bytes; the caller must zeroize after hashing. */
|
|
23
|
+
readonly material: Uint8Array;
|
|
24
|
+
}
|
|
25
|
+
/** Issues a high-entropy `sit_` token; only its SHA-256 digest is stored. */
|
|
26
|
+
export declare const issueInvitationTokenV1: (byteLength?: number) => IssuedTokenMaterial;
|
|
27
|
+
export declare const hashPresentedTokenV1: (token: string) => IdentitySha256HexV1;
|
|
28
|
+
/** Issues opaque session material: the caller hashes both parts and stores
|
|
29
|
+
* only digests. The returned `material` buffers are caller-owned. */
|
|
30
|
+
export declare const issueSessionTokenMaterialV1: () => {
|
|
31
|
+
readonly session: IssuedTokenMaterial;
|
|
32
|
+
readonly refresh: IssuedTokenMaterial;
|
|
33
|
+
};
|
|
34
|
+
/** HS256 email-ticket continuation port. The source ticket has no issuer
|
|
35
|
+
* claim; neither verification nor import requires or fabricates one. */
|
|
36
|
+
export declare const createHs256EmailTicketPort: (secret: Uint8Array) => IdentityEmailTicketTokenPortV1;
|
|
37
|
+
//# sourceMappingURL=custody-crypto.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"custody-crypto.d.ts","sourceRoot":"","sources":["../../src/identity/custody-crypto.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EACV,oBAAoB,EAEpB,8BAA8B,EAC9B,mBAAmB,EACpB,MAAM,kCAAkC,CAAC;AAM1C,eAAO,MAAM,aAAa,UAAW,MAAM,KAAG,OAAiC,CAAC;AAEhF,eAAO,MAAM,sBAAsB,UAAW,MAAM,KAAG,OAQtD,CAAC;AAEF;4EAC4E;AAC5E,eAAO,MAAM,SAAS,WAAY,UAAU,KAAG,IAE9C,CAAC;AAoBF,eAAO,MAAM,gBAAgB,UAAiB,UAAU,KAAG,QAAQ,mBAAmB,CAC/C,CAAC;AAExC;uEACuE;AACvE,eAAO,MAAM,mBAAmB,mBAAoB,MAAM,QAAQ,MAAM,KAAG,UACQ,CAAC;AAEpF,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC;CACrD;AAED;mDACmD;AACnD,eAAO,MAAM,4BAA4B,UAAU,SAAS,OAAO,MAAM,EAAE,UAAU,CAAC,CAAC,KAAQ,oBAY7F,CAAC;AAEH;yBACyB;AACzB,eAAO,MAAM,sBAAsB,UAAW,MAAM,KAAG,MAKtD,CAAC;AAIF,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,kEAAkE;IAClE,QAAQ,CAAC,QAAQ,EAAE,UAAU,CAAC;CAC/B;AAED,6EAA6E;AAC7E,eAAO,MAAM,sBAAsB,2BAAsB,mBAIxD,CAAC;AAEF,eAAO,MAAM,oBAAoB,UAAW,MAAM,KAAG,mBAOpD,CAAC;AAEF;qEACqE;AACrE,eAAO,MAAM,2BAA2B,QAAO;IAAE,QAAQ,CAAC,OAAO,EAAE,mBAAmB,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,mBAAmB,CAAA;CAG3H,CAAC;AAuCH;wEACwE;AACxE,eAAO,MAAM,0BAA0B,WAAY,UAAU,KAAG,8BAkC/D,CAAC"}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
// A2.0b custody cryptography: caller-borrowed buffers, owned temporaries and
|
|
2
|
+
// fixed encodings. `IdentityDigestPortV1`, ticket and login ports borrow the
|
|
3
|
+
// caller's Uint8Array inputs: they copy what they need, dispose their own
|
|
4
|
+
// temporaries in `finally`, and never retain or zero the caller's buffer.
|
|
5
|
+
// The caller owns disposal after the awaited operation.
|
|
6
|
+
import { createHash, createHmac, randomBytes, timingSafeEqual } from 'node:crypto';
|
|
7
|
+
import { IdentityCustodyErrorV1 } from '../identity-contracts/custody-errors.js';
|
|
8
|
+
import { canonicalBindingEmailV1 } from '../identity-contracts/custody.js';
|
|
9
|
+
const SHA256_HEX = /^[0-9a-f]{64}$/;
|
|
10
|
+
const BASE64URL = /^[A-Za-z0-9_-]+$/;
|
|
11
|
+
export const isSha256HexV1 = (value) => SHA256_HEX.test(value);
|
|
12
|
+
export const isCanonicalBase64UrlV1 = (value) => {
|
|
13
|
+
if (value.length === 0 || !BASE64URL.test(value))
|
|
14
|
+
return false;
|
|
15
|
+
try {
|
|
16
|
+
const decoded = Buffer.from(value, 'base64url');
|
|
17
|
+
return decoded.toString('base64url') === value;
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
/** Overwrites every byte of an owned mutable buffer. Strings are immutable
|
|
24
|
+
* and are never passed here; callers keep binary material in Uint8Array. */
|
|
25
|
+
export const zeroizeV1 = (buffer) => {
|
|
26
|
+
buffer.fill(0);
|
|
27
|
+
};
|
|
28
|
+
const copyBorrowed = (value) => Uint8Array.from(value);
|
|
29
|
+
const sha256HexOfOwned = (owned) => {
|
|
30
|
+
try {
|
|
31
|
+
return createHash('sha256').update(owned).digest('hex');
|
|
32
|
+
}
|
|
33
|
+
finally {
|
|
34
|
+
zeroizeV1(owned);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
const hmacHexOfOwned = (key, owned) => {
|
|
38
|
+
try {
|
|
39
|
+
return createHmac('sha256', Buffer.from(key)).update(owned).digest('hex');
|
|
40
|
+
}
|
|
41
|
+
finally {
|
|
42
|
+
zeroizeV1(owned);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
export const hashUtf8Borrowed = async (value) => sha256HexOfOwned(copyBorrowed(value));
|
|
46
|
+
/** Exact email-code keyed preimage: HMAC-SHA256(keyRef,
|
|
47
|
+
* UTF8(JSON.stringify(["cm-email-code","1",canonicalEmail,code]))). */
|
|
48
|
+
export const emailCodePreimageV1 = (canonicalEmail, code) => Buffer.from(JSON.stringify(['cm-email-code', '1', canonicalEmail, code]), 'utf8');
|
|
49
|
+
/** Test/production adapter factory: keys stay with the custodian; the port
|
|
50
|
+
* borrows them per call and never exposes them. */
|
|
51
|
+
export const createNodeIdentityDigestPort = (keys = {}) => ({
|
|
52
|
+
sha256: async (value) => hashUtf8Borrowed(value),
|
|
53
|
+
hmacSha256: async (keyRef, value) => {
|
|
54
|
+
const key = keys[keyRef];
|
|
55
|
+
if (!key)
|
|
56
|
+
throw new IdentityCustodyErrorV1('identity_material_missing');
|
|
57
|
+
return hmacHexOfOwned(copyBorrowed(key), copyBorrowed(value));
|
|
58
|
+
},
|
|
59
|
+
equal: (left, right) => {
|
|
60
|
+
if (left.byteLength !== right.byteLength)
|
|
61
|
+
return false;
|
|
62
|
+
if (left.byteLength === 0)
|
|
63
|
+
return true;
|
|
64
|
+
return timingSafeEqual(Buffer.from(left), Buffer.from(right));
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
/** Asserts canonical binding form; rejects anything the adapters must not
|
|
68
|
+
* silently normalize. */
|
|
69
|
+
export const assertCanonicalEmailV1 = (email) => {
|
|
70
|
+
if (email !== canonicalBindingEmailV1(email) || email.length === 0 || !email.includes('@')) {
|
|
71
|
+
throw new IdentityCustodyErrorV1('identity_material_invalid');
|
|
72
|
+
}
|
|
73
|
+
return email;
|
|
74
|
+
};
|
|
75
|
+
const INVITATION_PREFIX = 'sit_';
|
|
76
|
+
/** Issues a high-entropy `sit_` token; only its SHA-256 digest is stored. */
|
|
77
|
+
export const issueInvitationTokenV1 = (byteLength = 32) => {
|
|
78
|
+
const material = randomBytes(byteLength);
|
|
79
|
+
const token = `${INVITATION_PREFIX}${material.toString('base64url')}`;
|
|
80
|
+
return { token, material: new Uint8Array(material.buffer, material.byteOffset, material.byteLength) };
|
|
81
|
+
};
|
|
82
|
+
export const hashPresentedTokenV1 = (token) => {
|
|
83
|
+
const owned = Buffer.from(token, 'utf8');
|
|
84
|
+
try {
|
|
85
|
+
return createHash('sha256').update(owned).digest('hex');
|
|
86
|
+
}
|
|
87
|
+
finally {
|
|
88
|
+
zeroizeV1(owned);
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
/** Issues opaque session material: the caller hashes both parts and stores
|
|
92
|
+
* only digests. The returned `material` buffers are caller-owned. */
|
|
93
|
+
export const issueSessionTokenMaterialV1 = () => ({
|
|
94
|
+
session: issueInvitationTokenV1(32),
|
|
95
|
+
refresh: issueInvitationTokenV1(32),
|
|
96
|
+
});
|
|
97
|
+
const base64UrlJson = (value) => Buffer.from(JSON.stringify(value), 'utf8').toString('base64url');
|
|
98
|
+
const signHs256 = (secret, parts) => {
|
|
99
|
+
const owned = Buffer.from(parts, 'utf8');
|
|
100
|
+
try {
|
|
101
|
+
const signature = createHmac('sha256', Buffer.from(secret)).update(owned).digest();
|
|
102
|
+
return `${parts}.${signature.toString('base64url')}`;
|
|
103
|
+
}
|
|
104
|
+
finally {
|
|
105
|
+
zeroizeV1(owned);
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
const verifyHs256 = (secret, token) => {
|
|
109
|
+
const text = Buffer.from(token).toString('utf8');
|
|
110
|
+
const dot = text.lastIndexOf('.');
|
|
111
|
+
if (dot < 0)
|
|
112
|
+
throw new IdentityCustodyErrorV1('identity_material_invalid');
|
|
113
|
+
const parts = text.slice(0, dot);
|
|
114
|
+
const owned = Buffer.from(parts, 'utf8');
|
|
115
|
+
try {
|
|
116
|
+
const expected = createHmac('sha256', Buffer.from(secret)).update(owned).digest();
|
|
117
|
+
const presented = Buffer.from(text.slice(dot + 1), 'base64url');
|
|
118
|
+
if (presented.byteLength !== expected.byteLength || !timingSafeEqual(presented, expected)) {
|
|
119
|
+
throw new IdentityCustodyErrorV1('identity_material_invalid');
|
|
120
|
+
}
|
|
121
|
+
const segments = parts.split('.');
|
|
122
|
+
if (segments.length !== 2)
|
|
123
|
+
throw new IdentityCustodyErrorV1('identity_material_invalid');
|
|
124
|
+
const header = JSON.parse(Buffer.from(segments[0], 'base64url').toString('utf8'));
|
|
125
|
+
if (header?.alg !== 'HS256')
|
|
126
|
+
throw new IdentityCustodyErrorV1('identity_material_invalid');
|
|
127
|
+
return { header, payload: JSON.parse(Buffer.from(segments[1], 'base64url').toString('utf8')) };
|
|
128
|
+
}
|
|
129
|
+
catch {
|
|
130
|
+
throw new IdentityCustodyErrorV1('identity_material_invalid');
|
|
131
|
+
}
|
|
132
|
+
finally {
|
|
133
|
+
zeroizeV1(owned);
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
/** HS256 email-ticket continuation port. The source ticket has no issuer
|
|
137
|
+
* claim; neither verification nor import requires or fabricates one. */
|
|
138
|
+
export const createHs256EmailTicketPort = (secret) => {
|
|
139
|
+
const checkClaims = (payload) => {
|
|
140
|
+
if (typeof payload !== 'object' || payload === null)
|
|
141
|
+
throw new IdentityCustodyErrorV1('identity_material_invalid');
|
|
142
|
+
const claims = payload;
|
|
143
|
+
if (typeof claims.codeId !== 'string' || claims.codeId.length === 0 ||
|
|
144
|
+
typeof claims.email !== 'string' ||
|
|
145
|
+
typeof claims.iat !== 'number' || !Number.isSafeInteger(claims.iat) || claims.iat < 0 ||
|
|
146
|
+
typeof claims.exp !== 'number' || !Number.isSafeInteger(claims.exp) || claims.exp <= claims.iat ||
|
|
147
|
+
claims.exp > 8640000000000) {
|
|
148
|
+
throw new IdentityCustodyErrorV1('identity_material_invalid');
|
|
149
|
+
}
|
|
150
|
+
return {
|
|
151
|
+
codeProofId: claims.codeId,
|
|
152
|
+
email: assertCanonicalEmailV1(claims.email),
|
|
153
|
+
issuedAt: new Date(claims.iat * 1000).toISOString(),
|
|
154
|
+
expiresAt: new Date(claims.exp * 1000).toISOString(),
|
|
155
|
+
};
|
|
156
|
+
};
|
|
157
|
+
return {
|
|
158
|
+
sign: async (claims) => {
|
|
159
|
+
const payload = { email: claims.email, codeId: claims.codeProofId, iat: Date.parse(claims.issuedAt) / 1000, exp: Date.parse(claims.expiresAt) / 1000 };
|
|
160
|
+
checkClaims(payload);
|
|
161
|
+
return signHs256(secret, `${base64UrlJson({ alg: 'HS256', typ: 'JWT' })}.${base64UrlJson(payload)}`);
|
|
162
|
+
},
|
|
163
|
+
verify: async (token, now) => {
|
|
164
|
+
const { payload } = verifyHs256(secret, token);
|
|
165
|
+
const claims = checkClaims(payload);
|
|
166
|
+
if (!(claims.expiresAt > now))
|
|
167
|
+
throw new IdentityCustodyErrorV1('identity_material_invalid');
|
|
168
|
+
return claims;
|
|
169
|
+
},
|
|
170
|
+
verifyForImport: async (token) => checkClaims(verifyHs256(secret, token).payload),
|
|
171
|
+
};
|
|
172
|
+
};
|
|
173
|
+
//# sourceMappingURL=custody-crypto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"custody-crypto.js","sourceRoot":"","sources":["../../src/identity/custody-crypto.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,6EAA6E;AAC7E,0EAA0E;AAC1E,0EAA0E;AAC1E,wDAAwD;AAExD,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnF,OAAO,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAC;AAOjF,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAE3E,MAAM,UAAU,GAAG,gBAAgB,CAAC;AACpC,MAAM,SAAS,GAAG,kBAAkB,CAAC;AAErC,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,KAAa,EAAW,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAEhF,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,KAAa,EAAW,EAAE;IAC/D,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IAC/D,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;QAChD,OAAO,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,KAAK,KAAK,CAAC;IACjD,CAAC;IAAC,MAAM,C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AM,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE;YAC3B,MAAM,EAAE,OAAO,EAAE,GAAG,WAAW,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;YAC/C,MAAM,MAAM,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC;YACpC,IAAI,CAAC,CAAC,MAAM,CAAC,SAAS,GAAG,GAAG,CAAC;gBAAE,MAAM,IAAI,sBAAsB,CAAC,2BAA2B,CAAC,CAAC;YAC7F,OAAO,MAAM,CAAC;QAChB,CAAC;QACD,eAAe,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,WAAW,CAAC,WAAW,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,OAAO,CAAC;KAClF,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { LoginSessionStore, TenantMembershipStore, TenantRegistryStore, UserAccountStore, WorkspaceDirectoryStore, WorkspaceMembershipStore } from '../identity-contracts/ports.js';
|
|
2
|
+
import type { FreshDecision, FreshDecisionInput } from '../identity-contracts/types.js';
|
|
3
|
+
import type { ConversationAuthorityStore } from './conversation.js';
|
|
4
|
+
/** Maps the allowed decision to this call's tool set; the producer owns the
|
|
5
|
+
empty-on-refusal rule so no consumer can serve a partial catalogue. */
|
|
6
|
+
export interface DecisionToolCatalog {
|
|
7
|
+
toolsForDecision(decision: Extract<FreshDecision, {
|
|
8
|
+
allow: true;
|
|
9
|
+
}>): readonly string[];
|
|
10
|
+
}
|
|
11
|
+
export interface FreshDecisionWithTools {
|
|
12
|
+
readonly decision: FreshDecision;
|
|
13
|
+
readonly allowedTools: readonly string[];
|
|
14
|
+
}
|
|
15
|
+
export interface FreshDecisionProducerWithTools {
|
|
16
|
+
decide(input: FreshDecisionInput, now: string): Promise<FreshDecisionWithTools>;
|
|
17
|
+
}
|
|
18
|
+
export declare function createFreshDecisionProducer(input: {
|
|
19
|
+
readonly accounts: UserAccountStore;
|
|
20
|
+
readonly sessions: LoginSessionStore;
|
|
21
|
+
readonly tenants: TenantRegistryStore;
|
|
22
|
+
readonly memberships: TenantMembershipStore;
|
|
23
|
+
readonly workspaces: WorkspaceDirectoryStore;
|
|
24
|
+
readonly workspaceMembers: WorkspaceMembershipStore;
|
|
25
|
+
readonly conversations: ConversationAuthorityStore;
|
|
26
|
+
readonly catalog: DecisionToolCatalog;
|
|
27
|
+
}): FreshDecisionProducerWithTools;
|
|
28
|
+
//# sourceMappingURL=decision.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decision.d.ts","sourceRoot":"","sources":["../../src/identity/decision.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EACV,iBAAiB,EACjB,qBAAqB,EACrB,mBAAmB,EACnB,gBAAgB,EAChB,uBAAuB,EACvB,wBAAwB,EACzB,MAAM,gCAAgC,CAAC;AACxC,OAAO,KAAK,EAEV,aAAa,EACb,kBAAkB,EAEnB,MAAM,gCAAgC,CAAC;AACxC,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAC;AAEpE;0EAC0E;AAC1E,MAAM,WAAW,mBAAmB;IAClC,gBAAgB,CAAC,QAAQ,EAAE,OAAO,CAAC,aAAa,EAAE;QAAE,KAAK,EAAE,IAAI,CAAA;KAAE,CAAC,GAAG,SAAS,MAAM,EAAE,CAAC;CACxF;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC;IACjC,QAAQ,CAAC,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;CAC1C;AAED,MAAM,WAAW,8BAA8B;IAC7C,MAAM,CAAC,KAAK,EAAE,kBAAkB,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAAC;CACjF;AAWD,wBAAgB,2BAA2B,CAAC,KAAK,EAAE;IACjD,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAC;IACpC,QAAQ,CAAC,QAAQ,EAAE,iBAAiB,CAAC;IACrC,QAAQ,CAAC,OAAO,EAAE,mBAAmB,CAAC;IACtC,QAAQ,CAAC,WAAW,EAAE,qBAAqB,CAAC;IAC5C,QAAQ,CAAC,UAAU,EAAE,uBAAuB,CAAC;IAC7C,QAAQ,CAAC,gBAAgB,EAAE,wBAAwB,CAAC;IACpD,QAAQ,CAAC,aAAa,EAAE,0BAA0B,CAAC;IACnD,QAAQ,CAAC,OAAO,EAAE,mBAAmB,CAAC;CACvC,GAAG,8BAA8B,CA8EjC"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
// A2.3 identity slice: the fresh per-request decision producer (spec r2
|
|
2
|
+
// §2.7, §4.1, F15) bound over the frozen A2.1/A2.2 store ports plus this
|
|
3
|
+
// lot's conversation authority store. The §2.7 `inputKind`/session-authority
|
|
4
|
+
// shape is frozen in the identity contracts: every verdict names the session
|
|
5
|
+
// authority evaluated for its input kind, and every refusal uses the frozen
|
|
6
|
+
// reason vocabulary. `first_party_http` delegates to the frozen
|
|
7
|
+
// `createFreshDecision` unchanged; `conversation_turn` binds the conversation
|
|
8
|
+
// authority store that lands with this lot; `agent_plane` and `runtime_pty`
|
|
9
|
+
// stay unbound until M4 and keep refusing `session_authority_unavailable`.
|
|
10
|
+
// A refusal yields an empty tool set — never a partial catalogue.
|
|
11
|
+
import { createFreshDecision } from '../identity-contracts/enforcement.js';
|
|
12
|
+
/** §2.7 session authority per input kind; same frozen mapping as the
|
|
13
|
+
contracts (the table is total and never recomputed per call). */
|
|
14
|
+
const SESSION_AUTHORITY_BY_INPUT_KIND = {
|
|
15
|
+
first_party_http: 'login_session',
|
|
16
|
+
conversation_turn: 'conversation_session',
|
|
17
|
+
agent_plane: 'agent_session',
|
|
18
|
+
runtime_pty: 'runtime_registration',
|
|
19
|
+
};
|
|
20
|
+
export function createFreshDecisionProducer(input) {
|
|
21
|
+
const delegated = createFreshDecision({
|
|
22
|
+
accounts: input.accounts,
|
|
23
|
+
sessions: input.sessions,
|
|
24
|
+
tenants: input.tenants,
|
|
25
|
+
memberships: input.memberships,
|
|
26
|
+
workspaces: input.workspaces,
|
|
27
|
+
workspaceMembers: input.workspaceMembers,
|
|
28
|
+
});
|
|
29
|
+
const refuse = (inputKind, reason) => ({
|
|
30
|
+
decision: { allow: false, sessionAuthority: SESSION_AUTHORITY_BY_INPUT_KIND[inputKind], reason },
|
|
31
|
+
allowedTools: [],
|
|
32
|
+
});
|
|
33
|
+
const decideConversationTurn = async (lookup, now) => {
|
|
34
|
+
const account = await input.accounts.findAccount(lookup.userId);
|
|
35
|
+
if (!account || account.accountStatus !== 'active') {
|
|
36
|
+
return refuse(lookup.inputKind, 'account_not_active');
|
|
37
|
+
}
|
|
38
|
+
const conversation = await input.conversations.findSession(lookup.conversationSessionId);
|
|
39
|
+
if (!conversation ||
|
|
40
|
+
conversation.userId !== lookup.userId ||
|
|
41
|
+
conversation.workspaceId !== lookup.workspaceId ||
|
|
42
|
+
conversation.status !== 'active' ||
|
|
43
|
+
conversation.expiresAt <= now) {
|
|
44
|
+
return refuse(lookup.inputKind, 'session_invalid');
|
|
45
|
+
}
|
|
46
|
+
const workspace = await input.workspaces.findWorkspace(lookup.workspaceId);
|
|
47
|
+
if (!workspace)
|
|
48
|
+
return refuse(lookup.inputKind, 'workspace_membership_missing');
|
|
49
|
+
const membership = await input.memberships.findApprovedMembership(lookup.userId, workspace.tenantId);
|
|
50
|
+
if (!membership)
|
|
51
|
+
return refuse(lookup.inputKind, 'membership_not_approved');
|
|
52
|
+
const tenant = await input.tenants.findTenant(workspace.tenantId);
|
|
53
|
+
if (!tenant || tenant.status !== 'active')
|
|
54
|
+
return refuse(lookup.inputKind, 'tenant_not_active');
|
|
55
|
+
const workspaceMember = await input.workspaceMembers.findWorkspaceMember(lookup.workspaceId, lookup.userId);
|
|
56
|
+
if (!workspaceMember)
|
|
57
|
+
return refuse(lookup.inputKind, 'workspace_membership_missing');
|
|
58
|
+
const decision = {
|
|
59
|
+
allow: true,
|
|
60
|
+
sessionAuthority: 'conversation_session',
|
|
61
|
+
tenantId: tenant.tenantId,
|
|
62
|
+
tid: tenant.slug,
|
|
63
|
+
tenantRole: membership.tenantRole,
|
|
64
|
+
workspaceRole: workspaceMember.role,
|
|
65
|
+
scopes: [
|
|
66
|
+
account.globalRole,
|
|
67
|
+
`tenant:${membership.tenantRole}`,
|
|
68
|
+
`workspace:${workspaceMember.role}`,
|
|
69
|
+
],
|
|
70
|
+
};
|
|
71
|
+
return { decision, allowedTools: [...input.catalog.toolsForDecision(decision)] };
|
|
72
|
+
};
|
|
73
|
+
return {
|
|
74
|
+
async decide(lookup, now) {
|
|
75
|
+
let decision;
|
|
76
|
+
if (lookup.inputKind === 'first_party_http') {
|
|
77
|
+
decision = await delegated.decide(lookup, now);
|
|
78
|
+
}
|
|
79
|
+
else if (lookup.inputKind === 'conversation_turn') {
|
|
80
|
+
return decideConversationTurn(lookup, now);
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
// Unbound kinds fail closed until their authority stores land (M4).
|
|
84
|
+
decision = {
|
|
85
|
+
allow: false,
|
|
86
|
+
sessionAuthority: SESSION_AUTHORITY_BY_INPUT_KIND[lookup.inputKind],
|
|
87
|
+
reason: 'session_authority_unavailable',
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
return {
|
|
91
|
+
decision,
|
|
92
|
+
allowedTools: decision.allow ? [...input.catalog.toolsForDecision(decision)] : [],
|
|
93
|
+
};
|
|
94
|
+
},
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=decision.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decision.js","sourceRoot":"","sources":["../../src/identity/decision.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,yEAAyE;AACzE,6EAA6E;AAC7E,6EAA6E;AAC7E,4EAA4E;AAC5E,gEAAgE;AAChE,8EAA8E;AAC9E,4EAA4E;AAC5E,2EAA2E;AAC3E,kEAAkE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
|
4
|
+
export * from './cascade.js';
|
|
5
|
+
export * from './postgres.js';
|
|
6
|
+
export * from './sqlite.js';
|
|
7
|
+
export * from './custody-crypto.js';
|
|
8
|
+
export * from './connector-custody.js';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/identity/index.ts"],"names":[],"mappings":"AAKA,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// A2.3 identity slice: public barrel — the conversation authority store, the
|
|
2
|
+
// fresh per-request decision producer with tool sets, the F14 revocation
|
|
3
|
+
// composition and the durable audit/escalation ledger. The frozen contracts
|
|
4
|
+
// stay in `../identity-contracts`; this module set only composes them.
|
|
5
|
+
export * from './conversation.js';
|
|
6
|
+
export * from './ledger.js';
|
|
7
|
+
export * from './decision.js';
|
|
8
|
+
export * from './cascade.js';
|
|
9
|
+
export * from './postgres.js';
|
|
10
|
+
export * from './sqlite.js';
|
|
11
|
+
export * from './custody-crypto.js';
|
|
12
|
+
export * from './connector-custody.js';
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/identity/index.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,yEAAyE;AACzE,4EAA4E;AAC5E,uEAAuE;AAEvE,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC"}
|