@sentropic/cluster-mesh 0.24.0 → 0.26.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/README.md +5 -0
- 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/engram-memory/wire-adaptation.d.ts +1 -1
- package/dist/engram-memory/wire-adaptation.d.ts.map +1 -1
- package/dist/engram-memory/wire-adaptation.js +24 -8
- package/dist/engram-memory/wire-adaptation.js.map +1 -1
- 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/access.d.ts +54 -0
- package/dist/identity-contracts/access.d.ts.map +1 -0
- package/dist/identity-contracts/access.js +168 -0
- package/dist/identity-contracts/access.js.map +1 -0
- package/dist/identity-contracts/accounts.d.ts +44 -0
- package/dist/identity-contracts/accounts.d.ts.map +1 -0
- package/dist/identity-contracts/accounts.js +150 -0
- package/dist/identity-contracts/accounts.js.map +1 -0
- 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/descriptors.d.ts +12 -0
- package/dist/identity-contracts/descriptors.d.ts.map +1 -0
- package/dist/identity-contracts/descriptors.js +57 -0
- package/dist/identity-contracts/descriptors.js.map +1 -0
- package/dist/identity-contracts/doubles.d.ts +124 -0
- package/dist/identity-contracts/doubles.d.ts.map +1 -0
- package/dist/identity-contracts/doubles.js +360 -0
- package/dist/identity-contracts/doubles.js.map +1 -0
- package/dist/identity-contracts/enforcement.d.ts +27 -0
- package/dist/identity-contracts/enforcement.d.ts.map +1 -0
- package/dist/identity-contracts/enforcement.js +155 -0
- package/dist/identity-contracts/enforcement.js.map +1 -0
- package/dist/identity-contracts/errors.d.ts +71 -0
- package/dist/identity-contracts/errors.d.ts.map +1 -0
- package/dist/identity-contracts/errors.js +129 -0
- package/dist/identity-contracts/errors.js.map +1 -0
- package/dist/identity-contracts/index.d.ts +22 -0
- package/dist/identity-contracts/index.d.ts.map +1 -0
- package/dist/identity-contracts/index.js +23 -0
- package/dist/identity-contracts/index.js.map +1 -0
- 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/ports.d.ts +116 -0
- package/dist/identity-contracts/ports.d.ts.map +1 -0
- package/dist/identity-contracts/ports.js +7 -0
- package/dist/identity-contracts/ports.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/resolution.d.ts +56 -0
- package/dist/identity-contracts/resolution.d.ts.map +1 -0
- package/dist/identity-contracts/resolution.js +87 -0
- package/dist/identity-contracts/resolution.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/tenancy.d.ts +52 -0
- package/dist/identity-contracts/tenancy.d.ts.map +1 -0
- package/dist/identity-contracts/tenancy.js +171 -0
- package/dist/identity-contracts/tenancy.js.map +1 -0
- package/dist/identity-contracts/types.d.ts +253 -0
- package/dist/identity-contracts/types.d.ts.map +1 -0
- package/dist/identity-contracts/types.js +7 -0
- package/dist/identity-contracts/types.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-contracts/workspaces.d.ts +37 -0
- package/dist/identity-contracts/workspaces.d.ts.map +1 -0
- package/dist/identity-contracts/workspaces.js +118 -0
- package/dist/identity-contracts/workspaces.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 +15 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -1
- package/dist/integrations/mcp/memory-compose.d.ts +11 -0
- package/dist/integrations/mcp/memory-compose.d.ts.map +1 -0
- package/dist/integrations/mcp/memory-compose.js +79 -0
- package/dist/integrations/mcp/memory-compose.js.map +1 -0
- package/dist/integrations/mcp/memory-definition.d.ts +28 -0
- package/dist/integrations/mcp/memory-definition.d.ts.map +1 -0
- package/dist/integrations/mcp/memory-definition.js +2 -0
- package/dist/integrations/mcp/memory-definition.js.map +1 -0
- package/dist/integrations/mcp/memory-manifest.d.ts +4 -0
- package/dist/integrations/mcp/memory-manifest.d.ts.map +1 -0
- package/dist/integrations/mcp/memory-manifest.js +9 -0
- package/dist/integrations/mcp/memory-manifest.js.map +1 -0
- package/dist/integrations/mcp/memory-transport.d.ts +21 -0
- package/dist/integrations/mcp/memory-transport.d.ts.map +1 -0
- package/dist/integrations/mcp/memory-transport.js +47 -0
- package/dist/integrations/mcp/memory-transport.js.map +1 -0
- package/dist/integrations/mcp/memory.d.ts +19 -0
- package/dist/integrations/mcp/memory.d.ts.map +1 -0
- package/dist/integrations/mcp/memory.js +40 -0
- package/dist/integrations/mcp/memory.js.map +1 -0
- package/dist/loaders/mcp/index.d.ts +1 -0
- package/dist/loaders/mcp/index.d.ts.map +1 -1
- package/dist/loaders/mcp/index.js +1 -0
- package/dist/loaders/mcp/index.js.map +1 -1
- package/dist/loaders/mcp/memory.d.ts +6 -0
- package/dist/loaders/mcp/memory.d.ts.map +1 -0
- package/dist/loaders/mcp/memory.js +9 -0
- package/dist/loaders/mcp/memory.js.map +1 -0
- 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 +7 -4
- package/dist/modules/catalog.d.ts.map +1 -1
- package/dist/modules/catalog.js +24 -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 +3 -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/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/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/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/docs/memory-mcp-candidate.md +46 -0
- package/docs/memory-mcp.md +98 -0
- package/examples/memory-mcp-stdio.mjs +42 -0
- package/package.json +66 -5
- 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,402 @@
|
|
|
1
|
+
// A4 composition-gaps bundle (1.2.0), lot G5: preprod IdP replica sync on CM
|
|
2
|
+
// authority (design a4-cm-gaps-r2 §9). The source placement stays sole author
|
|
3
|
+
// for its subjects; the replica converges its copies and authors nothing for
|
|
4
|
+
// them. Ids, owners and counters are never rekeyed, merged or rewritten by
|
|
5
|
+
// sync. Whole batch is atomic: the first conflict throws and rolls back.
|
|
6
|
+
import { createHash } from 'node:crypto';
|
|
7
|
+
import { canonicalBindingEmailV1 } from '../../identity-contracts/custody.js';
|
|
8
|
+
import { IdentityCustodyErrorV1 } from '../../identity-contracts/custody-errors.js';
|
|
9
|
+
import { identityTransactionHost, requireIdentityRunOptions } from './custody-transaction-guards.js';
|
|
10
|
+
import { boundIdentitySql } from './custody-transaction-ports.js';
|
|
11
|
+
const ALL_ENTITIES = ['account', 'credential', 'oauth_consent'];
|
|
12
|
+
const zeroCounts = () => Object.fromEntries(ALL_ENTITIES.map((entity) => [entity, {
|
|
13
|
+
inserted: 0, updated: 0, unchanged: 0, revokedApplied: 0, revokedKept: 0,
|
|
14
|
+
}]));
|
|
15
|
+
const stableStringify = (value) => {
|
|
16
|
+
if (Array.isArray(value))
|
|
17
|
+
return `[${value.map(stableStringify).join(',')}]`;
|
|
18
|
+
if (typeof value === 'object' && value !== null) {
|
|
19
|
+
const entries = Object.entries(value)
|
|
20
|
+
.filter(([, field]) => field !== undefined)
|
|
21
|
+
.sort(([left], [right]) => (left < right ? -1 : left > right ? 1 : 0));
|
|
22
|
+
return `{${entries.map(([key, field]) => `${JSON.stringify(key)}:${stableStringify(field)}`).join(',')}}`;
|
|
23
|
+
}
|
|
24
|
+
return JSON.stringify(value) ?? 'null';
|
|
25
|
+
};
|
|
26
|
+
const sha256Hex = (value) => createHash('sha256').update(value, 'utf8').digest('hex');
|
|
27
|
+
const bytewise = (left, right) => Buffer.compare(Buffer.from(left, 'utf8'), Buffer.from(right, 'utf8'));
|
|
28
|
+
const ENTITY_RANK = { account: 0, credential: 1, oauth_consent: 2 };
|
|
29
|
+
const rowKey = (row) => row.entity === 'account' ? row.record.userId : row.entity === 'credential' ? row.record.proofId : row.record.consentId;
|
|
30
|
+
const canonicalSort = (rows) => [...rows].sort((left, right) => ENTITY_RANK[left.entity] - ENTITY_RANK[right.entity] || bytewise(rowKey(left), rowKey(right)));
|
|
31
|
+
const manifestDigestOf = (rows) => sha256Hex(stableStringify(rows));
|
|
32
|
+
const snapshotDigestOf = (batch) => sha256Hex(stableStringify({
|
|
33
|
+
contractVersion: batch.contractVersion,
|
|
34
|
+
syncId: batch.syncId,
|
|
35
|
+
sourcePlacement: batch.sourcePlacement,
|
|
36
|
+
sourceSnapshotRef: batch.sourceSnapshotRef,
|
|
37
|
+
exportedAt: batch.exportedAt,
|
|
38
|
+
rows: batch.rows,
|
|
39
|
+
}));
|
|
40
|
+
/** Both digests recomputed and compared before any write; mismatch ⇒ invalid. */
|
|
41
|
+
const digestsValid = (batch) => batch.contractVersion === '1.2.0'
|
|
42
|
+
&& typeof batch.syncId === 'string' && batch.syncId.length > 0
|
|
43
|
+
&& typeof batch.sourcePlacement === 'string' && batch.sourcePlacement.length > 0
|
|
44
|
+
&& typeof batch.sourceSnapshotRef === 'string' && batch.sourceSnapshotRef.length > 0
|
|
45
|
+
&& typeof batch.exportedAt === 'string' && batch.exportedAt.length > 0
|
|
46
|
+
&& Array.isArray(batch.rows)
|
|
47
|
+
&& manifestDigestOf(batch.rows) === batch.manifestDigest
|
|
48
|
+
&& snapshotDigestOf(batch) === batch.sourceSnapshotDigest;
|
|
49
|
+
const addIssue = (issues, entity, code, rowIndex, safeIdentity) => {
|
|
50
|
+
const existing = issues.find((issue) => issue.entity === entity && issue.code === code);
|
|
51
|
+
const reference = safeIdentity ? { rowIndex, safeIdentity } : { rowIndex };
|
|
52
|
+
if (existing) {
|
|
53
|
+
existing.references.push(reference);
|
|
54
|
+
existing.count += 1;
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
issues.push({ entity, code, count: 1, references: [reference] });
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
/** Structural validation shared by validate() and the in-transaction gate.
|
|
61
|
+
Issue references carry subject ids only — never emails or row ids. */
|
|
62
|
+
const structuralIssues = (batch) => {
|
|
63
|
+
const issues = [];
|
|
64
|
+
if (batch.contractVersion !== '1.2.0') {
|
|
65
|
+
addIssue(issues, 'account', 'identity_sync_invalid', -1);
|
|
66
|
+
return issues;
|
|
67
|
+
}
|
|
68
|
+
const seenKeys = new Set();
|
|
69
|
+
const seenEmails = new Map();
|
|
70
|
+
batch.rows.forEach((row, rowIndex) => {
|
|
71
|
+
const key = `${row.entity}:${rowKey(row)}`;
|
|
72
|
+
if (seenKeys.has(key))
|
|
73
|
+
addIssue(issues, row.entity, 'identity_sync_invalid', rowIndex);
|
|
74
|
+
else
|
|
75
|
+
seenKeys.add(key);
|
|
76
|
+
try {
|
|
77
|
+
switch (row.entity) {
|
|
78
|
+
case 'account': {
|
|
79
|
+
const { record, profile } = row;
|
|
80
|
+
if (!record.userId || !record.email.includes('@') || canonicalBindingEmailV1(record.email) !== record.email) {
|
|
81
|
+
throw new IdentityCustodyErrorV1('identity_sync_invalid');
|
|
82
|
+
}
|
|
83
|
+
if (profile.userId !== record.userId)
|
|
84
|
+
throw new IdentityCustodyErrorV1('identity_sync_invalid');
|
|
85
|
+
const prior = seenEmails.get(record.email);
|
|
86
|
+
if (prior !== undefined && prior !== rowIndex) {
|
|
87
|
+
addIssue(issues, 'account', 'identity_sync_conflict', rowIndex, [record.userId]);
|
|
88
|
+
}
|
|
89
|
+
else
|
|
90
|
+
seenEmails.set(record.email, rowIndex);
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
case 'credential': {
|
|
94
|
+
const { record } = row;
|
|
95
|
+
if (!record.proofId || !record.userId || !record.credentialId || !record.publicKeyCose || !record.rpId
|
|
96
|
+
|| !record.createdAt || !Number.isInteger(record.counter) || record.counter < 0) {
|
|
97
|
+
throw new IdentityCustodyErrorV1('identity_sync_invalid');
|
|
98
|
+
}
|
|
99
|
+
break;
|
|
100
|
+
}
|
|
101
|
+
case 'oauth_consent': {
|
|
102
|
+
const { record } = row;
|
|
103
|
+
if (!record.consentId || !record.tenantId || !record.userId || !record.clientId || !record.grantedAt) {
|
|
104
|
+
throw new IdentityCustodyErrorV1('identity_sync_invalid');
|
|
105
|
+
}
|
|
106
|
+
break;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
catch {
|
|
111
|
+
addIssue(issues, row.entity, 'identity_sync_invalid', rowIndex);
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
return issues;
|
|
115
|
+
};
|
|
116
|
+
// -- Locking (§9.1: operation key, then subject keys bytewise, then email keys) --
|
|
117
|
+
const lockKey = async (host, kind, id) => {
|
|
118
|
+
if (!id)
|
|
119
|
+
throw new IdentityCustodyErrorV1('identity_sync_invalid');
|
|
120
|
+
if (host.profile === 'postgres') {
|
|
121
|
+
await boundIdentitySql(host).query('SELECT pg_advisory_xact_lock(hashtextextended(?, 0))', [JSON.stringify([kind, id])]);
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
const lockBatch = async (host, batch) => {
|
|
125
|
+
await lockKey(host, 'operation', batch.syncId);
|
|
126
|
+
const subjects = new Set();
|
|
127
|
+
const emails = new Set();
|
|
128
|
+
for (const row of batch.rows) {
|
|
129
|
+
subjects.add(row.record.userId);
|
|
130
|
+
if (row.entity === 'account')
|
|
131
|
+
emails.add(row.record.email);
|
|
132
|
+
}
|
|
133
|
+
for (const userId of [...subjects].sort(bytewise))
|
|
134
|
+
await lockKey(host, 'subject', userId);
|
|
135
|
+
for (const email of [...emails].sort(bytewise))
|
|
136
|
+
await lockKey(host, 'email', email);
|
|
137
|
+
};
|
|
138
|
+
const fenceRetired = async (host, userId) => {
|
|
139
|
+
const sql = boundIdentitySql(host);
|
|
140
|
+
const [fence] = await sql.query(`SELECT retired_at FROM ${sql.table('identity_subject_fences')} WHERE user_id = ?`, [userId]);
|
|
141
|
+
return fence?.retired_at != null;
|
|
142
|
+
};
|
|
143
|
+
// rpId is not material: the same credential id and key bind one authenticator credential, and the
|
|
144
|
+
// source is its sole author, so a replica import stamp converges to the source RP ID (apply step).
|
|
145
|
+
const CREDENTIAL_MATERIAL_FIELDS = [
|
|
146
|
+
'userId', 'credentialId', 'publicKeyCose', 'uv', 'transports', 'deviceType', 'backedUp', 'createdAt',
|
|
147
|
+
];
|
|
148
|
+
const detectRow = async (host, tx, row, rowIndex, batchUserIds, issues) => {
|
|
149
|
+
switch (row.entity) {
|
|
150
|
+
case 'account': {
|
|
151
|
+
const { record } = row;
|
|
152
|
+
const existing = await host.journal.findAccountCore(record.userId);
|
|
153
|
+
if (!existing) {
|
|
154
|
+
if (await fenceRetired(host, record.userId)) {
|
|
155
|
+
addIssue(issues, 'account', 'identity_sync_conflict', rowIndex, [record.userId]);
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
const holder = await tx.stores.accounts.findAccountByEmail(record.email);
|
|
159
|
+
if (holder && holder.userId !== record.userId) {
|
|
160
|
+
addIssue(issues, 'account', 'identity_sync_conflict', rowIndex, [record.userId, holder.userId]);
|
|
161
|
+
}
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
if (existing.createdAt !== record.createdAt) {
|
|
165
|
+
addIssue(issues, 'account', 'identity_sync_conflict', rowIndex, [record.userId]);
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
if (existing.email !== record.email) {
|
|
169
|
+
const holder = await tx.stores.accounts.findAccountByEmail(record.email);
|
|
170
|
+
if (holder && holder.userId !== record.userId) {
|
|
171
|
+
addIssue(issues, 'account', 'identity_sync_conflict', rowIndex, [record.userId, holder.userId]);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
case 'credential': {
|
|
177
|
+
const { record } = row;
|
|
178
|
+
const byProof = await tx.custody.credentials.findById(record.proofId);
|
|
179
|
+
const byCredentialId = await tx.custody.credentials.findByCredentialId(record.credentialId);
|
|
180
|
+
if (byProof && byCredentialId && byProof.proofId === byCredentialId.proofId) {
|
|
181
|
+
for (const field of CREDENTIAL_MATERIAL_FIELDS) {
|
|
182
|
+
if (stableStringify(byProof[field]) !== stableStringify(record[field])) {
|
|
183
|
+
addIssue(issues, 'credential', 'identity_sync_conflict', rowIndex, [record.userId]);
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
if (byProof || byCredentialId) {
|
|
190
|
+
addIssue(issues, 'credential', 'identity_sync_conflict', rowIndex, [record.userId]);
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
if (!batchUserIds.has(record.userId) && !(await host.journal.findAccountCore(record.userId))) {
|
|
194
|
+
addIssue(issues, 'credential', 'identity_sync_conflict', rowIndex, [record.userId]);
|
|
195
|
+
}
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
case 'oauth_consent': {
|
|
199
|
+
const { record } = row;
|
|
200
|
+
const existing = await host.journal.findConsentCore(record.consentId);
|
|
201
|
+
if (!existing) {
|
|
202
|
+
if (!(await host.journal.findTenantCore(record.tenantId))) {
|
|
203
|
+
addIssue(issues, 'oauth_consent', 'identity_sync_conflict', rowIndex, [record.userId]);
|
|
204
|
+
}
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
if (existing.tenantId !== record.tenantId || existing.userId !== record.userId
|
|
208
|
+
|| existing.clientId !== record.clientId || existing.grantedAt !== record.grantedAt) {
|
|
209
|
+
addIssue(issues, 'oauth_consent', 'identity_sync_conflict', rowIndex, [record.userId]);
|
|
210
|
+
}
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
};
|
|
215
|
+
const applyAccount = async (host, tx, row) => {
|
|
216
|
+
const { record, profile } = row;
|
|
217
|
+
const existing = await host.journal.findAccountCore(record.userId);
|
|
218
|
+
if (!existing) {
|
|
219
|
+
await host.journal.insertAccountCore(record);
|
|
220
|
+
await host.journal.ensureLiveFence(record.userId, record.createdAt);
|
|
221
|
+
await tx.custody.profiles.put(profile);
|
|
222
|
+
return 'inserted';
|
|
223
|
+
}
|
|
224
|
+
let changed = false;
|
|
225
|
+
let current = existing;
|
|
226
|
+
if (current.email !== record.email) {
|
|
227
|
+
current = await tx.custody.subjects.updateEmail(record.userId, record.email, record.updatedAt);
|
|
228
|
+
changed = true;
|
|
229
|
+
}
|
|
230
|
+
if (current.globalRole !== record.globalRole) {
|
|
231
|
+
current = await tx.stores.accounts.setGlobalRole(record.userId, record.globalRole, record.updatedAt);
|
|
232
|
+
changed = true;
|
|
233
|
+
}
|
|
234
|
+
if (current.accountStatus !== record.accountStatus) {
|
|
235
|
+
current = await tx.stores.accounts.setAccountStatus(record.userId, record.accountStatus, record.updatedAt);
|
|
236
|
+
changed = true;
|
|
237
|
+
}
|
|
238
|
+
if (current.updatedAt !== record.updatedAt) {
|
|
239
|
+
const sql = boundIdentitySql(host);
|
|
240
|
+
await sql.query(`UPDATE ${sql.table('identity_user_accounts')} SET updated_at = ? WHERE user_id = ?`, [record.updatedAt, record.userId]);
|
|
241
|
+
changed = true;
|
|
242
|
+
}
|
|
243
|
+
const localProfile = await tx.custody.profiles.find(record.userId);
|
|
244
|
+
if (!localProfile || stableStringify(localProfile) !== stableStringify(profile)) {
|
|
245
|
+
await tx.custody.profiles.put(profile);
|
|
246
|
+
changed = true;
|
|
247
|
+
}
|
|
248
|
+
return changed ? 'updated' : 'unchanged';
|
|
249
|
+
};
|
|
250
|
+
const applyCredential = async (host, tx, row) => {
|
|
251
|
+
const { record } = row;
|
|
252
|
+
const existing = await tx.custody.credentials.findById(record.proofId);
|
|
253
|
+
if (!existing) {
|
|
254
|
+
await tx.custody.credentials.insert({ ...record, revision: 0, lastUsedAt: null, revokedAt: null });
|
|
255
|
+
if (record.revokedAt) {
|
|
256
|
+
await tx.custody.credentials.revoke(record.proofId, record.userId, record.revokedAt);
|
|
257
|
+
return 'revokedApplied';
|
|
258
|
+
}
|
|
259
|
+
return 'inserted';
|
|
260
|
+
}
|
|
261
|
+
if (record.revokedAt && !existing.revokedAt) {
|
|
262
|
+
await tx.custody.credentials.revoke(record.proofId, record.userId, record.revokedAt);
|
|
263
|
+
return 'revokedApplied';
|
|
264
|
+
}
|
|
265
|
+
if (existing.revokedAt && !record.revokedAt)
|
|
266
|
+
return 'revokedKept';
|
|
267
|
+
if (existing.revokedAt && record.revokedAt)
|
|
268
|
+
return 'unchanged';
|
|
269
|
+
let changed = false;
|
|
270
|
+
if (existing.rpId !== record.rpId) {
|
|
271
|
+
const sql = boundIdentitySql(host);
|
|
272
|
+
await sql.query(`UPDATE ${sql.table('identity_webauthn_credentials')} SET rp_id = ?, revision = revision + 1
|
|
273
|
+
WHERE proof_id = ? AND user_id = ? AND revoked_at IS NULL`, [record.rpId, record.proofId, record.userId]);
|
|
274
|
+
changed = true;
|
|
275
|
+
}
|
|
276
|
+
if (record.deviceName !== null && existing.deviceName !== record.deviceName) {
|
|
277
|
+
await tx.custody.credentials.rename(record.proofId, record.userId, record.deviceName);
|
|
278
|
+
changed = true;
|
|
279
|
+
}
|
|
280
|
+
return changed ? 'updated' : 'unchanged';
|
|
281
|
+
};
|
|
282
|
+
const applyConsent = async (host, tx, row) => {
|
|
283
|
+
const { record } = row;
|
|
284
|
+
const existing = await host.journal.findConsentCore(record.consentId);
|
|
285
|
+
if (!existing) {
|
|
286
|
+
await host.journal.insertConsentCore(record);
|
|
287
|
+
return 'inserted';
|
|
288
|
+
}
|
|
289
|
+
if (record.revokedAt && !existing.revokedAt) {
|
|
290
|
+
await tx.stores.oauth.revokeConsent(record.consentId, record.revokedAt);
|
|
291
|
+
return 'revokedApplied';
|
|
292
|
+
}
|
|
293
|
+
if (existing.revokedAt && !record.revokedAt)
|
|
294
|
+
return 'revokedKept';
|
|
295
|
+
return 'unchanged';
|
|
296
|
+
};
|
|
297
|
+
const applyRow = async (host, tx, row) => {
|
|
298
|
+
switch (row.entity) {
|
|
299
|
+
case 'account': return applyAccount(host, tx, row);
|
|
300
|
+
case 'credential': return applyCredential(host, tx, row);
|
|
301
|
+
case 'oauth_consent': return applyConsent(host, tx, row);
|
|
302
|
+
}
|
|
303
|
+
};
|
|
304
|
+
// -- In-transaction sync --------------------------------------------------------
|
|
305
|
+
const syncInTransaction = async (clock, batch, tx) => {
|
|
306
|
+
if (tx.mode !== 'write')
|
|
307
|
+
throw new IdentityCustodyErrorV1('identity_transaction_unbound');
|
|
308
|
+
const host = identityTransactionHost(tx);
|
|
309
|
+
if (!digestsValid(batch))
|
|
310
|
+
throw new IdentityCustodyErrorV1('identity_sync_invalid');
|
|
311
|
+
if (structuralIssues(batch).length > 0)
|
|
312
|
+
throw new IdentityCustodyErrorV1('identity_sync_invalid');
|
|
313
|
+
await lockBatch(host, batch);
|
|
314
|
+
const batchUserIds = new Set(batch.rows.filter((row) => row.entity === 'account').map((row) => row.record.userId));
|
|
315
|
+
const counts = zeroCounts();
|
|
316
|
+
for (const [rowIndex, row] of canonicalSort(batch.rows).entries()) {
|
|
317
|
+
const issues = [];
|
|
318
|
+
await detectRow(host, tx, row, rowIndex, batchUserIds, issues);
|
|
319
|
+
if (issues.length > 0)
|
|
320
|
+
throw new IdentityCustodyErrorV1('identity_sync_conflict');
|
|
321
|
+
counts[row.entity][await applyRow(host, tx, row)] += 1;
|
|
322
|
+
}
|
|
323
|
+
return {
|
|
324
|
+
contractVersion: '1.2.0',
|
|
325
|
+
syncId: batch.syncId,
|
|
326
|
+
sourcePlacement: batch.sourcePlacement,
|
|
327
|
+
sourceSnapshotDigest: batch.sourceSnapshotDigest,
|
|
328
|
+
manifestDigest: batch.manifestDigest,
|
|
329
|
+
appliedAt: clock(),
|
|
330
|
+
counts,
|
|
331
|
+
identitiesPreserved: true,
|
|
332
|
+
ownersPreserved: true,
|
|
333
|
+
countersPreserved: true,
|
|
334
|
+
};
|
|
335
|
+
};
|
|
336
|
+
const validateBatch = async (batch, tx) => {
|
|
337
|
+
const host = identityTransactionHost(tx);
|
|
338
|
+
const issues = [];
|
|
339
|
+
if (!digestsValid(batch)) {
|
|
340
|
+
addIssue(issues, 'account', 'identity_sync_invalid', -1);
|
|
341
|
+
return { valid: false, issues };
|
|
342
|
+
}
|
|
343
|
+
issues.push(...structuralIssues(batch));
|
|
344
|
+
if (issues.length > 0)
|
|
345
|
+
return { valid: false, issues };
|
|
346
|
+
const batchUserIds = new Set(batch.rows.filter((row) => row.entity === 'account').map((row) => row.record.userId));
|
|
347
|
+
for (const [rowIndex, row] of canonicalSort(batch.rows).entries()) {
|
|
348
|
+
await detectRow(host, tx, row, rowIndex, batchUserIds, issues);
|
|
349
|
+
}
|
|
350
|
+
return { valid: issues.length === 0, issues };
|
|
351
|
+
};
|
|
352
|
+
// -- Factories (host-generic per §3.5: CM state only via identityTransactionHost) --
|
|
353
|
+
export const createIdentityReplicaSyncV1 = (input) => {
|
|
354
|
+
requireIdentityRunOptions(input.syncOptions);
|
|
355
|
+
requireIdentityRunOptions(input.validationOptions);
|
|
356
|
+
if (input.syncOptions.mode !== 'write' || input.syncOptions.purpose !== 'import'
|
|
357
|
+
|| input.validationOptions.mode !== 'read' || input.validationOptions.purpose !== 'import') {
|
|
358
|
+
throw new IdentityCustodyErrorV1('identity_contract_unavailable');
|
|
359
|
+
}
|
|
360
|
+
return {
|
|
361
|
+
validate: (batch) => input.unitOfWork.run(input.validationOptions, (tx) => validateBatch(batch, tx)),
|
|
362
|
+
syncBatch: (batch) => input.unitOfWork.run(input.syncOptions, (tx) => syncInTransaction(input.clock, batch, tx)),
|
|
363
|
+
syncBatchInTransaction: (batch, tx) => syncInTransaction(input.clock, batch, tx),
|
|
364
|
+
};
|
|
365
|
+
};
|
|
366
|
+
export const createIdentityReplicaExporterV1 = (input) => {
|
|
367
|
+
requireIdentityRunOptions(input.exportOptions);
|
|
368
|
+
if (input.exportOptions.mode !== 'read' || input.exportOptions.purpose !== 'import') {
|
|
369
|
+
throw new IdentityCustodyErrorV1('identity_contract_unavailable');
|
|
370
|
+
}
|
|
371
|
+
return {
|
|
372
|
+
exportBatch: async ({ syncId, sourcePlacement, sourceSnapshotRef }) => input.unitOfWork.run(input.exportOptions, async (tx) => {
|
|
373
|
+
const host = identityTransactionHost(tx);
|
|
374
|
+
const rows = [];
|
|
375
|
+
for (const account of await tx.stores.accounts.listAccounts()) {
|
|
376
|
+
const profile = await tx.custody.profiles.find(account.userId);
|
|
377
|
+
if (!profile)
|
|
378
|
+
throw new IdentityCustodyErrorV1('identity_material_missing');
|
|
379
|
+
rows.push({ entity: 'account', record: account, profile });
|
|
380
|
+
for (const credential of await tx.custody.credentials.listForUser(account.userId)) {
|
|
381
|
+
rows.push({ entity: 'credential', record: credential });
|
|
382
|
+
}
|
|
383
|
+
for (const consent of await host.journal.listConsentsForUserCore(account.userId)) {
|
|
384
|
+
rows.push({ entity: 'oauth_consent', record: consent });
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
const sorted = canonicalSort(rows);
|
|
388
|
+
const exportedAt = input.clock();
|
|
389
|
+
return {
|
|
390
|
+
contractVersion: '1.2.0',
|
|
391
|
+
syncId,
|
|
392
|
+
sourcePlacement,
|
|
393
|
+
sourceSnapshotRef,
|
|
394
|
+
exportedAt,
|
|
395
|
+
rows: sorted,
|
|
396
|
+
manifestDigest: manifestDigestOf(sorted),
|
|
397
|
+
sourceSnapshotDigest: snapshotDigestOf({ contractVersion: '1.2.0', syncId, sourcePlacement, sourceSnapshotRef, exportedAt, rows: sorted }),
|
|
398
|
+
};
|
|
399
|
+
}),
|
|
400
|
+
};
|
|
401
|
+
};
|
|
402
|
+
//# sourceMappingURL=replica-sync.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"replica-sync.js","sourceRoot":"","sources":["../../../src/storage/identity/replica-sync.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,8EAA8E;AAC9E,6EAA6E;AAC7E,2EAA2E;AAC3E,yEAAyE;AAEzE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAazC,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,EAAE,sBAAsB,EAAE,MAAM,4CAA4C,CAAC;AACpF,OAAO,EAAE,uBAAuB,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AACrG,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAKlE,MAAM,YAAY,GAAsB,CAAC,SAAS,EAAE,YAAY,EAAE,eAAe,CAAC,CAAC;AAInF,MAAM,UAAU,GAAG,GAAkC,EAAE,CACrD,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,MA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AU,IAAI,MAAM,EAAE,CAAC,OAAO,CAAC,WAAW,CAAC,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;oBAClF,IAAI,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,CAAC;gBAC1D,CAAC;gBACD,KAAK,MAAM,OAAO,IAAI,MAAM,IAAI,CAAC,OAAO,CAAC,uBAAuB,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;oBACjF,IAAI,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC;gBAC1D,CAAC;YACH,CAAC;YACD,MAAM,MAAM,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC;YACnC,MAAM,UAAU,GAAG,KAAK,CAAC,KAAK,EAAE,CAAC;YACjC,OAAO;gBACL,eAAe,EAAE,OAAgB;gBACjC,MAAM;gBACN,eAAe;gBACf,iBAAiB;gBACjB,UAAU;gBACV,IAAI,EAAE,MAAM;gBACZ,cAAc,EAAE,gBAAgB,CAAC,MAAM,CAAC;gBACxC,oBAAoB,EAAE,gBAAgB,CAAC,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,iBAAiB,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;aAC3I,CAAC;QACJ,CAAC,CAAC;KACL,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type IdentitySchemaDialect = 'postgres' | 'sqlite';
|
|
2
|
+
/** Every table this slice owns; writes live only in this module. */
|
|
3
|
+
export declare const IDENTITY_TABLES: readonly ["identity_user_accounts", "identity_proofs", "identity_invitations", "identity_device_codes", "identity_login_sessions", "identity_audit_events", "identity_account_profiles", "identity_webauthn_credentials", "identity_single_use_proofs", "identity_email_registration_tickets", "identity_invitation_digests", "identity_login_token_bindings", "identity_social_links", "identity_subject_fences", "identity_deletion_operations", "identity_deletion_attempts", "identity_revocation_outbox", "identity_import_receipts", "identity_custody_schema_versions", "connector_revocation_custody", "identity_legacy_connector_tombstones"];
|
|
4
|
+
export type IdentityTableName = (typeof IDENTITY_TABLES)[number];
|
|
5
|
+
/** Qualified table reference: `"schema"."table"` on PostgreSQL, plain on SQLite. */
|
|
6
|
+
export declare const identityTable: (dialect: IdentitySchemaDialect, schema: string | null, table: IdentityTableName) => string;
|
|
7
|
+
/**
|
|
8
|
+
* Idempotent DDL for the A2.1 slice. `schema` names the PostgreSQL control
|
|
9
|
+
* schema; it is ignored on SQLite where tables live in the store file's
|
|
10
|
+
* single schema (local profile, spec r2 §2.9).
|
|
11
|
+
*/
|
|
12
|
+
export declare const identitySchemaStatements: (dialect: IdentitySchemaDialect, schema: string) => readonly string[];
|
|
13
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/storage/identity/schema.ts"],"names":[],"mappings":"AAUA,MAAM,MAAM,qBAAqB,GAAG,UAAU,GAAG,QAAQ,CAAC;AAE1D,oEAAoE;AACpE,eAAO,MAAM,eAAe,wnBAuBlB,CAAC;AAEX,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC;AAEjE,oFAAoF;AACpF,eAAO,MAAM,aAAa,YAAa,qBAAqB,UAAU,MAAM,GAAG,IAAI,SAAS,iBAAiB,KAAG,MAC9C,CAAC;AAkVnE;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,YAAa,qBAAqB,UAAU,MAAM,KAAG,SAAS,MAAM,EA0CxG,CAAC"}
|