@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,141 @@
|
|
|
1
|
+
import { Hono } from 'hono';
|
|
2
|
+
import { bodyLimit } from 'hono/body-limit';
|
|
3
|
+
import { randomBytes } from 'node:crypto';
|
|
4
|
+
import { GitAppError } from './contracts.js';
|
|
5
|
+
const escapeHtml = (value) => value.replace(/[&<>"']/g, (char) => ({
|
|
6
|
+
'&': '&', '<': '<', '>': '>', '"': '"', "'": ''',
|
|
7
|
+
})[char]);
|
|
8
|
+
/** Mount inside cluster-mesh. Both authenticators are mandatory host adapters. */
|
|
9
|
+
export const createGitHubAppRouter = (input) => {
|
|
10
|
+
const app = new Hono();
|
|
11
|
+
const owner = async (request) => {
|
|
12
|
+
const target = await input.resolveOwner(request);
|
|
13
|
+
if (!target)
|
|
14
|
+
throw new GitAppError('access_denied');
|
|
15
|
+
return target;
|
|
16
|
+
};
|
|
17
|
+
const csrf = (request) => {
|
|
18
|
+
if (request.headers.get('origin') !== new URL(input.publicBaseUrl).origin)
|
|
19
|
+
throw new GitAppError('access_denied');
|
|
20
|
+
};
|
|
21
|
+
// same-origin, never no-referrer: a browser serializes the Origin of a
|
|
22
|
+
// non-CORS form POST as "null" under no-referrer (Fetch "append a request
|
|
23
|
+
// Origin header"), so this router's own forms would always fail csrf().
|
|
24
|
+
// same-origin keeps the real Origin on same-origin POSTs and still strips
|
|
25
|
+
// the referrer (and Origin) from every cross-origin request (github.com).
|
|
26
|
+
app.use('*', async (c, next) => {
|
|
27
|
+
c.header('cache-control', 'no-store');
|
|
28
|
+
c.header('referrer-policy', 'same-origin');
|
|
29
|
+
c.header('x-content-type-options', 'nosniff');
|
|
30
|
+
c.header('content-security-policy', "default-src 'none'; form-action https://github.com 'self'; base-uri 'none'; frame-ancestors 'none'");
|
|
31
|
+
await next();
|
|
32
|
+
});
|
|
33
|
+
app.use('*', bodyLimit({ maxSize: 1024 * 1024, onError: (c) => c.json({ error: 'invalid_request' }, 413) }));
|
|
34
|
+
app.onError((error, c) => {
|
|
35
|
+
const code = error instanceof GitAppError ? error.code : 'capability_unavailable';
|
|
36
|
+
return c.json({ error: code }, code === 'access_denied' ? 403 : code === 'invalid_request' ? 400 : 503);
|
|
37
|
+
});
|
|
38
|
+
app.get('/github-app', async (c) => {
|
|
39
|
+
const target = await owner(c.req.raw);
|
|
40
|
+
return c.html(`<html><body><form method="post" action="/github-app/enroll"><button>Enroll ${escapeHtml(target.locator)}</button></form></body></html>`);
|
|
41
|
+
});
|
|
42
|
+
app.post('/github-app/enroll', async (c) => {
|
|
43
|
+
csrf(c.req.raw);
|
|
44
|
+
const started = await input.service.begin(await owner(c.req.raw));
|
|
45
|
+
return c.redirect(started.promptUrl, 303);
|
|
46
|
+
});
|
|
47
|
+
app.get('/github-app/:ref', async (c) => {
|
|
48
|
+
const prompt = await input.service.prompt(await owner(c.req.raw), c.req.param('ref'));
|
|
49
|
+
if (prompt.phase === 'install') {
|
|
50
|
+
// The App exists: resume its installation with the freshly minted state.
|
|
51
|
+
return c.html(`<html><body><a href="${escapeHtml(prompt.installationUrl)}">Install the GitHub App on ${escapeHtml(prompt.locator)}</a></body></html>`);
|
|
52
|
+
}
|
|
53
|
+
return c.html(`<html><body><form method="post" action="${escapeHtml(prompt.manifestUrl)}"><input type="hidden" name="manifest" value="${escapeHtml(JSON.stringify(prompt.manifest))}"><button>Enroll ${escapeHtml(prompt.locator)}</button></form></body></html>`);
|
|
54
|
+
});
|
|
55
|
+
app.get('/github-app/:ref/manifest', async (c) => {
|
|
56
|
+
const result = await input.service.convert(await owner(c.req.raw), c.req.param('ref'), {
|
|
57
|
+
state: c.req.query('state') ?? '', code: c.req.query('code') ?? '',
|
|
58
|
+
});
|
|
59
|
+
return c.redirect(result.installationUrl, 303);
|
|
60
|
+
});
|
|
61
|
+
app.get('/github-app/:ref/installation', async (c) => {
|
|
62
|
+
await input.service.install(await owner(c.req.raw), c.req.param('ref'), {
|
|
63
|
+
state: c.req.query('state') ?? '', installationId: c.req.query('installation_id') ?? '',
|
|
64
|
+
});
|
|
65
|
+
// Drop the sensitive GitHub query string immediately.
|
|
66
|
+
return c.redirect(`/github-app/${c.req.param('ref')}/status`, 303);
|
|
67
|
+
});
|
|
68
|
+
app.get('/github-app/:ref/status', async (c) => c.json(await input.service.status(await owner(c.req.raw), c.req.param('ref'))));
|
|
69
|
+
app.get('/github-app/:ref/rotation', async (c) => {
|
|
70
|
+
const status = await input.service.status(await owner(c.req.raw), c.req.param('ref'));
|
|
71
|
+
const path = `/github-app/${escapeHtml(status.installationRef)}`;
|
|
72
|
+
return c.html([
|
|
73
|
+
'<html><body>',
|
|
74
|
+
`<form method="post" action="${path}/key" enctype="multipart/form-data"><input type="file" name="privateKey" accept=".pem" required><button>Verify and switch App key</button></form>`,
|
|
75
|
+
`<form method="post" action="${path}/webhook-stage"><button>Stage webhook secret (10 minute overlap)</button></form>`,
|
|
76
|
+
`<form method="post" action="${path}/webhook-switch"><button>Switch GitHub webhook sender</button></form>`,
|
|
77
|
+
`<form method="post" action="${path}/webhook-retire"><button>Retire previous webhook secret</button></form>`,
|
|
78
|
+
`<form method="post" action="${path}/revoke"><button>Revoke enrollment</button></form>`,
|
|
79
|
+
'</body></html>',
|
|
80
|
+
].join(''));
|
|
81
|
+
});
|
|
82
|
+
app.post('/github-app/:ref/key', async (c) => {
|
|
83
|
+
csrf(c.req.raw);
|
|
84
|
+
const target = await owner(c.req.raw);
|
|
85
|
+
const body = await c.req.parseBody();
|
|
86
|
+
if (!(body.privateKey instanceof File) || body.privateKey.size > 32768)
|
|
87
|
+
throw new GitAppError('invalid_request');
|
|
88
|
+
return c.json(await input.service.rotateAppKey(target, c.req.param('ref'), await body.privateKey.text()));
|
|
89
|
+
});
|
|
90
|
+
app.post('/github-app/:ref/webhook-stage', async (c) => {
|
|
91
|
+
csrf(c.req.raw);
|
|
92
|
+
return c.json(await input.service.rotateWebhook(await owner(c.req.raw), c.req.param('ref'), randomBytes(32).toString('hex'), 600000));
|
|
93
|
+
});
|
|
94
|
+
app.post('/github-app/:ref/webhook-switch', async (c) => {
|
|
95
|
+
csrf(c.req.raw);
|
|
96
|
+
return c.json(await input.service.switchWebhookSender(await owner(c.req.raw), c.req.param('ref')));
|
|
97
|
+
});
|
|
98
|
+
app.post('/github-app/:ref/webhook-retire', async (c) => {
|
|
99
|
+
csrf(c.req.raw);
|
|
100
|
+
return c.json(await input.service.retirePreviousWebhook(await owner(c.req.raw), c.req.param('ref')));
|
|
101
|
+
});
|
|
102
|
+
app.post('/github-app/:ref/revoke', async (c) => {
|
|
103
|
+
csrf(c.req.raw);
|
|
104
|
+
return c.json(await input.service.revoke(await owner(c.req.raw), c.req.param('ref'), 'owner_revoked'));
|
|
105
|
+
});
|
|
106
|
+
app.post('/github-app/:ref/events', async (c) => {
|
|
107
|
+
const rawBody = new Uint8Array(await c.req.arrayBuffer());
|
|
108
|
+
if (!c.req.header('x-github-delivery'))
|
|
109
|
+
throw new GitAppError('invalid_request');
|
|
110
|
+
return c.json(await input.service.installationEvent(c.req.param('ref'), rawBody, c.req.header('x-hub-signature-256') ?? '', c.req.header('x-github-event') ?? ''));
|
|
111
|
+
});
|
|
112
|
+
app.post('/github-app/broker/lease', async (c) => {
|
|
113
|
+
const principal = await input.authenticateBroker(c.req.raw);
|
|
114
|
+
if (!principal)
|
|
115
|
+
throw new GitAppError('access_denied');
|
|
116
|
+
const body = await c.req.json();
|
|
117
|
+
if (!body || Object.keys(body).sort().join(',') !== 'installationRef,repoId,storageScopeId' ||
|
|
118
|
+
Object.values(body).some((value) => typeof value !== 'string' || !value))
|
|
119
|
+
throw new GitAppError('invalid_request');
|
|
120
|
+
if (body.repoId !== principal.repoId || body.storageScopeId !== principal.storageScopeId)
|
|
121
|
+
throw new GitAppError('access_denied');
|
|
122
|
+
return c.json(await input.service.acquire(body));
|
|
123
|
+
});
|
|
124
|
+
app.post('/github-app/broker/verify', async (c) => {
|
|
125
|
+
const principal = await input.authenticateBroker(c.req.raw);
|
|
126
|
+
if (!principal)
|
|
127
|
+
throw new GitAppError('access_denied');
|
|
128
|
+
const body = await c.req.json();
|
|
129
|
+
if (!body || Object.keys(body).sort().join(',') !== 'deliveryId,rawBody,repoId,signature,storageScopeId,webhookSecretRef' ||
|
|
130
|
+
Object.values(body).some((value) => typeof value !== 'string'))
|
|
131
|
+
throw new GitAppError('invalid_request');
|
|
132
|
+
if (body.repoId !== principal.repoId || body.storageScopeId !== principal.storageScopeId)
|
|
133
|
+
throw new GitAppError('access_denied');
|
|
134
|
+
const rawBody = Buffer.from(body.rawBody, 'base64');
|
|
135
|
+
if (rawBody.toString('base64') !== body.rawBody)
|
|
136
|
+
throw new GitAppError('invalid_request');
|
|
137
|
+
return c.json(await input.service.verify({ ...body, rawBody }));
|
|
138
|
+
});
|
|
139
|
+
return app;
|
|
140
|
+
};
|
|
141
|
+
//# sourceMappingURL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AAE,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,qEAAqE;YACrH,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAC;YAAE,MAAM,IAAI,WAAW,CAAC,iBAAiB,CAAC,CAAC;QAC7G,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS,CAAC,MAAM,IAAI,IAAI,CAAC,cAAc,KAAK,SAAS,CAAC,cAAc;YAAE,MAAM,IAAI,WAAW,CAAC,eAAe,CAAC,CAAC;QACjI,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QACpD,IAAI,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,IAAI,CAAC,OAAO;YAAE,MAAM,IAAI,WAAW,CAAC,iBAAiB,CAAC,CAAC;QAC1F,OAAO,CAAC,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;IAClE,CAAC,CAAC,CAAC;IACH,OAAO,GAAG,CAAC;AACb,CAAC,CAAC"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import type { GitAppOwnerRepository } from './contracts.js';
|
|
2
|
+
import type { EnrollmentRecord, GitAppLifecycleInput, GitHubAppApi, RevocationReason } from './records.js';
|
|
3
|
+
export declare const assertTuple: (record: EnrollmentRecord, input: {
|
|
4
|
+
storageScopeId: string;
|
|
5
|
+
repoId: string;
|
|
6
|
+
}) => void;
|
|
7
|
+
export declare const assertOwner: (record: EnrollmentRecord, input: GitAppOwnerRepository) => void;
|
|
8
|
+
export declare const publicStatus: (record: EnrollmentRecord) => {
|
|
9
|
+
installationRef: string;
|
|
10
|
+
webhookSecretRef: string;
|
|
11
|
+
storageScopeId: string;
|
|
12
|
+
repoId: string;
|
|
13
|
+
state: "unavailable" | "revoked" | "ready" | "install" | "manifest";
|
|
14
|
+
credentialVersion: string;
|
|
15
|
+
webhookRotationPending: boolean;
|
|
16
|
+
webhookOverlapEndsAt: string | null;
|
|
17
|
+
};
|
|
18
|
+
export declare const revokeLeases: (record: EnrollmentRecord, github: GitHubAppApi, now: number) => Promise<void>;
|
|
19
|
+
export declare const invalidateCredentials: (record: EnrollmentRecord, input: GitAppLifecycleInput) => Promise<void>;
|
|
20
|
+
export declare const webhookMatch: (record: EnrollmentRecord, rawBody: Uint8Array, signature: string, now: number) => {
|
|
21
|
+
valid: boolean;
|
|
22
|
+
secretVersion?: undefined;
|
|
23
|
+
} | {
|
|
24
|
+
valid: boolean;
|
|
25
|
+
secretVersion: string;
|
|
26
|
+
};
|
|
27
|
+
export declare const createGitAppLifecycle: (input: GitAppLifecycleInput) => {
|
|
28
|
+
rotateAppKey: (target: GitAppOwnerRepository, ref: string, privateKey: string) => Promise<{
|
|
29
|
+
installationRef: string;
|
|
30
|
+
webhookSecretRef: string;
|
|
31
|
+
storageScopeId: string;
|
|
32
|
+
repoId: string;
|
|
33
|
+
state: "unavailable" | "revoked" | "ready" | "install" | "manifest";
|
|
34
|
+
credentialVersion: string;
|
|
35
|
+
webhookRotationPending: boolean;
|
|
36
|
+
webhookOverlapEndsAt: string | null;
|
|
37
|
+
}>;
|
|
38
|
+
rotateWebhook: (target: GitAppOwnerRepository, ref: string, secret: string, overlapMs: number) => Promise<{
|
|
39
|
+
overlapEndsAt: string;
|
|
40
|
+
installationRef: string;
|
|
41
|
+
webhookSecretRef: string;
|
|
42
|
+
storageScopeId: string;
|
|
43
|
+
repoId: string;
|
|
44
|
+
state: "unavailable" | "revoked" | "ready" | "install" | "manifest";
|
|
45
|
+
credentialVersion: string;
|
|
46
|
+
webhookRotationPending: boolean;
|
|
47
|
+
webhookOverlapEndsAt: string | null;
|
|
48
|
+
}>;
|
|
49
|
+
switchWebhookSender: (target: GitAppOwnerRepository, ref: string) => Promise<{
|
|
50
|
+
installationRef: string;
|
|
51
|
+
webhookSecretRef: string;
|
|
52
|
+
storageScopeId: string;
|
|
53
|
+
repoId: string;
|
|
54
|
+
state: "unavailable" | "revoked" | "ready" | "install" | "manifest";
|
|
55
|
+
credentialVersion: string;
|
|
56
|
+
webhookRotationPending: boolean;
|
|
57
|
+
webhookOverlapEndsAt: string | null;
|
|
58
|
+
}>;
|
|
59
|
+
retirePreviousWebhook: (target: GitAppOwnerRepository, ref: string) => Promise<{
|
|
60
|
+
installationRef: string;
|
|
61
|
+
webhookSecretRef: string;
|
|
62
|
+
storageScopeId: string;
|
|
63
|
+
repoId: string;
|
|
64
|
+
state: "unavailable" | "revoked" | "ready" | "install" | "manifest";
|
|
65
|
+
credentialVersion: string;
|
|
66
|
+
webhookRotationPending: boolean;
|
|
67
|
+
webhookOverlapEndsAt: string | null;
|
|
68
|
+
}>;
|
|
69
|
+
acquire: (input: {
|
|
70
|
+
storageScopeId: string;
|
|
71
|
+
repoId: string;
|
|
72
|
+
installationRef: string;
|
|
73
|
+
}) => Promise<{
|
|
74
|
+
token: string;
|
|
75
|
+
expiresAt: string;
|
|
76
|
+
repositoryId: string;
|
|
77
|
+
permissions: {
|
|
78
|
+
contents: "write";
|
|
79
|
+
metadata: "read";
|
|
80
|
+
};
|
|
81
|
+
credentialVersion: string;
|
|
82
|
+
}>;
|
|
83
|
+
verify: (input: {
|
|
84
|
+
storageScopeId: string;
|
|
85
|
+
repoId: string;
|
|
86
|
+
webhookSecretRef: string;
|
|
87
|
+
rawBody: Uint8Array;
|
|
88
|
+
signature: string;
|
|
89
|
+
deliveryId: string;
|
|
90
|
+
}) => Promise<{
|
|
91
|
+
valid: boolean;
|
|
92
|
+
secretVersion?: string | undefined;
|
|
93
|
+
}>;
|
|
94
|
+
revoke: (target: GitAppOwnerRepository, ref: string, _reason: RevocationReason) => Promise<{
|
|
95
|
+
installationRef: string;
|
|
96
|
+
webhookSecretRef: string;
|
|
97
|
+
storageScopeId: string;
|
|
98
|
+
repoId: string;
|
|
99
|
+
state: "unavailable" | "revoked" | "ready" | "install" | "manifest";
|
|
100
|
+
credentialVersion: string;
|
|
101
|
+
webhookRotationPending: boolean;
|
|
102
|
+
webhookOverlapEndsAt: string | null;
|
|
103
|
+
}>;
|
|
104
|
+
installationEvent: (ref: string, rawBody: Uint8Array, signature: string, event: string) => Promise<{
|
|
105
|
+
accepted: boolean;
|
|
106
|
+
}>;
|
|
107
|
+
};
|
|
108
|
+
//# sourceMappingURL=lifecycle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lifecycle.d.ts","sourceRoot":"","sources":["../../src/forge/lifecycle.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAwD,MAAM,gBAAgB,CAAC;AAClH,OAAO,KAAK,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAG3G,eAAO,MAAM,WAAW,WAAY,gBAAgB,SAAS;IAAE,cAAc,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,SAItG,CAAC;AACF,eAAO,MAAM,WAAW,WAAY,gBAAgB,SAAS,qBAAqB,SAGjF,CAAC;AACF,eAAO,MAAM,YAAY,WAAY,gBAAgB;;;;;;;;;CAMnD,CAAC;AAEH,eAAO,MAAM,YAAY,WAAkB,gBAAgB,UAAU,YAAY,OAAO,MAAM,kBAS7F,CAAC;AACF,eAAO,MAAM,qBAAqB,WAAkB,gBAAgB,SAAS,oBAAoB,kBAQhG,CAAC;AACF,eAAO,MAAM,YAAY,WAAY,gBAAgB,WAAW,UAAU,aAAa,MAAM,OAAO,MAAM;;;;;;CAWzG,CAAC;AAEF,eAAO,MAAM,qBAAqB,UAAW,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAwCvC,qBAAqB,OAAO,MAAM,WAAW,gBAAgB;;;;;;;;;;6BAKrD,MAAM,WAAW,UAAU,aAAa,MAAM,SAAS,MAAM;;;CAgC9F,CAAC"}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { createHmac, timingSafeEqual } from 'node:crypto';
|
|
2
|
+
import { assertGitAppPermissions, GIT_APP_PERMISSIONS, GitAppError, GitAppAccessLostError } from './contracts.js';
|
|
3
|
+
import { createGitAppRotation } from './rotation.js';
|
|
4
|
+
export const assertTuple = (record, input) => {
|
|
5
|
+
if (record.target.storageScopeId !== input.storageScopeId || record.target.repoId !== input.repoId) {
|
|
6
|
+
throw new GitAppError('access_denied');
|
|
7
|
+
}
|
|
8
|
+
};
|
|
9
|
+
export const assertOwner = (record, input) => {
|
|
10
|
+
assertTuple(record, input);
|
|
11
|
+
if (record.target.ownerId !== input.ownerId || record.target.locator !== input.locator)
|
|
12
|
+
throw new GitAppError('access_denied');
|
|
13
|
+
};
|
|
14
|
+
export const publicStatus = (record) => ({
|
|
15
|
+
installationRef: record.installationRef, webhookSecretRef: record.webhookSecretRef,
|
|
16
|
+
storageScopeId: record.target.storageScopeId, repoId: record.target.repoId,
|
|
17
|
+
state: record.state, credentialVersion: record.credentialVersion,
|
|
18
|
+
webhookRotationPending: record.webhookRotationPending ?? false,
|
|
19
|
+
webhookOverlapEndsAt: record.previousWebhook ? new Date(record.previousWebhook.until).toISOString() : null,
|
|
20
|
+
});
|
|
21
|
+
export const revokeLeases = async (record, github, now) => {
|
|
22
|
+
const pending = [];
|
|
23
|
+
for (const lease of record.leases) {
|
|
24
|
+
if (Date.parse(lease.expiresAt) <= now)
|
|
25
|
+
continue;
|
|
26
|
+
try {
|
|
27
|
+
await github.revokeToken(lease.token);
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
pending.push(lease);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
record.leases = pending;
|
|
34
|
+
if (pending.length)
|
|
35
|
+
throw new GitAppError('capability_unavailable');
|
|
36
|
+
};
|
|
37
|
+
export const invalidateCredentials = async (record, input) => {
|
|
38
|
+
record.state = 'revoked';
|
|
39
|
+
record.invalidationPending = true;
|
|
40
|
+
try {
|
|
41
|
+
await input.onCredentialsChanged({ storageScopeId: record.target.storageScopeId, repoId: record.target.repoId,
|
|
42
|
+
installationRef: record.installationRef, credentialVersion: record.credentialVersion });
|
|
43
|
+
record.invalidationPending = false;
|
|
44
|
+
}
|
|
45
|
+
finally {
|
|
46
|
+
await revokeLeases(record, input.github, input.now());
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
export const webhookMatch = (record, rawBody, signature, now) => {
|
|
50
|
+
if (!record.app || !/^sha256=[a-f0-9]{64}$/.test(signature))
|
|
51
|
+
return { valid: false };
|
|
52
|
+
if (record.previousWebhook && now >= record.previousWebhook.until)
|
|
53
|
+
delete record.previousWebhook;
|
|
54
|
+
const candidates = [{ secret: record.app.webhookSecret, version: record.webhookVersion },
|
|
55
|
+
...(record.previousWebhook ? [record.previousWebhook] : [])];
|
|
56
|
+
const presented = Buffer.from(signature.slice(7), 'hex');
|
|
57
|
+
for (const candidate of candidates) {
|
|
58
|
+
const expected = createHmac('sha256', candidate.secret).update(rawBody).digest();
|
|
59
|
+
if (timingSafeEqual(expected, presented))
|
|
60
|
+
return { valid: true, secretVersion: candidate.version };
|
|
61
|
+
}
|
|
62
|
+
return { valid: false };
|
|
63
|
+
};
|
|
64
|
+
export const createGitAppLifecycle = (input) => {
|
|
65
|
+
const { custody, github, now } = input;
|
|
66
|
+
const acquire = (request) => custody.withRecord(request.installationRef, async (record) => {
|
|
67
|
+
assertTuple(record, request);
|
|
68
|
+
if (!['ready', 'unavailable'].includes(record.state) || !record.app || !record.installationId || !record.repositoryId) {
|
|
69
|
+
if (record.state === 'revoked')
|
|
70
|
+
await invalidateCredentials(record, input);
|
|
71
|
+
throw new GitAppError('capability_unavailable');
|
|
72
|
+
}
|
|
73
|
+
try {
|
|
74
|
+
const installed = await github.inspectInstallation(record.app, record.installationId);
|
|
75
|
+
assertGitAppPermissions(installed.permissions);
|
|
76
|
+
if (installed.suspended)
|
|
77
|
+
throw new GitAppAccessLostError();
|
|
78
|
+
const minted = await github.mint(record.app, record.installationId, record.repositoryId, GIT_APP_PERMISSIONS);
|
|
79
|
+
record.leases = record.leases.filter((lease) => Date.parse(lease.expiresAt) > now());
|
|
80
|
+
// An invalid expiry is not evidence that the minted bearer is unusable.
|
|
81
|
+
// Retain it for revocation even when the forge claims it already expired.
|
|
82
|
+
const expiresAt = Date.parse(minted.expiresAt);
|
|
83
|
+
record.leases.push({ token: minted.token, expiresAt: Number.isFinite(expiresAt) && expiresAt > now()
|
|
84
|
+
? minted.expiresAt : new Date(now() + 3600000).toISOString() });
|
|
85
|
+
assertGitAppPermissions(minted.permissions);
|
|
86
|
+
if (!minted.token || minted.repositoryIds.length !== 1 || minted.repositoryIds[0] !== record.repositoryId ||
|
|
87
|
+
!Number.isFinite(Date.parse(minted.expiresAt)) || Date.parse(minted.expiresAt) <= now() + 30000 ||
|
|
88
|
+
Date.parse(minted.expiresAt) > now() + 3600000) {
|
|
89
|
+
await revokeLeases(record, github, now());
|
|
90
|
+
throw new GitAppError('capability_unavailable');
|
|
91
|
+
}
|
|
92
|
+
record.state = 'ready';
|
|
93
|
+
return { token: minted.token, expiresAt: minted.expiresAt, repositoryId: record.repositoryId,
|
|
94
|
+
permissions: { ...GIT_APP_PERMISSIONS }, credentialVersion: record.credentialVersion };
|
|
95
|
+
}
|
|
96
|
+
catch (error) {
|
|
97
|
+
if (error instanceof GitAppAccessLostError)
|
|
98
|
+
await invalidateCredentials(record, input);
|
|
99
|
+
else
|
|
100
|
+
record.state = 'unavailable';
|
|
101
|
+
throw new GitAppError('capability_unavailable');
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
const verify = (request) => custody.withRecord(request.webhookSecretRef, async (record) => {
|
|
105
|
+
assertTuple(record, request);
|
|
106
|
+
if (record.webhookSecretRef !== request.webhookSecretRef || !request.deliveryId || record.state !== 'ready')
|
|
107
|
+
return { valid: false };
|
|
108
|
+
return webhookMatch(record, request.rawBody, request.signature, now());
|
|
109
|
+
});
|
|
110
|
+
const revoke = (target, ref, _reason) => custody.withRecord(ref, async (record) => {
|
|
111
|
+
assertOwner(record, target);
|
|
112
|
+
await invalidateCredentials(record, input);
|
|
113
|
+
return publicStatus(record);
|
|
114
|
+
});
|
|
115
|
+
const installationEvent = (ref, rawBody, signature, event) => custody.withRecord(ref, async (record) => {
|
|
116
|
+
if (!webhookMatch(record, rawBody, signature, now()).valid)
|
|
117
|
+
throw new GitAppError('access_denied');
|
|
118
|
+
if (event !== 'installation' && event !== 'installation_repositories')
|
|
119
|
+
throw new GitAppError('invalid_request');
|
|
120
|
+
let payload;
|
|
121
|
+
try {
|
|
122
|
+
payload = JSON.parse(Buffer.from(rawBody).toString('utf8'));
|
|
123
|
+
}
|
|
124
|
+
catch {
|
|
125
|
+
throw new GitAppError('invalid_request');
|
|
126
|
+
}
|
|
127
|
+
if (String(payload?.installation?.id) !== record.installationId)
|
|
128
|
+
throw new GitAppError('access_denied');
|
|
129
|
+
let invalidate = event === 'installation' && ['deleted', 'suspend'].includes(payload.action);
|
|
130
|
+
if (event === 'installation_repositories' && payload.action === 'removed') {
|
|
131
|
+
invalidate = Array.isArray(payload.repositories_removed) &&
|
|
132
|
+
payload.repositories_removed.some((repository) => String(repository.id) === record.repositoryId);
|
|
133
|
+
}
|
|
134
|
+
if (event === 'installation' && payload.action === 'new_permissions_accepted') {
|
|
135
|
+
try {
|
|
136
|
+
const installed = await github.inspectInstallation(record.app, record.installationId);
|
|
137
|
+
assertGitAppPermissions(installed.permissions);
|
|
138
|
+
if (installed.suspended)
|
|
139
|
+
throw new GitAppAccessLostError();
|
|
140
|
+
if (record.state === 'unavailable')
|
|
141
|
+
record.state = 'ready';
|
|
142
|
+
}
|
|
143
|
+
catch (error) {
|
|
144
|
+
if (error instanceof GitAppAccessLostError)
|
|
145
|
+
invalidate = true;
|
|
146
|
+
else {
|
|
147
|
+
if (record.state === 'ready')
|
|
148
|
+
record.state = 'unavailable';
|
|
149
|
+
throw new GitAppError('capability_unavailable');
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
if (invalidate) {
|
|
154
|
+
await invalidateCredentials(record, input);
|
|
155
|
+
}
|
|
156
|
+
return { accepted: true };
|
|
157
|
+
});
|
|
158
|
+
return { acquire, verify, revoke, installationEvent, ...createGitAppRotation(input) };
|
|
159
|
+
};
|
|
160
|
+
//# sourceMappingURL=lifecycle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lifecycle.js","sourceRoot":"","sources":["../../src/forge/lifecycle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAGlH,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAErD,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,MAAwB,EAAE,KAAiD,EAAE,EAAE;IACzG,IAAI,MAAM,CAAC,MAAM,CAAC,cAAc,KAAK,KAAK,CAAC,cAAc,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,KAAK,KAAK,CAAC,MAAM,EAAE,CAAC;QACnG,MAAM,IAAI,WAAW,CAAC,eAAe,CAAC,CAAC;IACzC,CAAC;AACH,CAAC,CAAC;AACF,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,MAAwB,EAAE,KAA4B,EAAE,EAAE;IACpF,WAAW,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAC3B,IAAI,MAAM,CAAC,MAAM,CAAC,OAAO,KAAK,KAAK,CAAC,OAAO,IAAI,MAAM,CAAC,MAAM,CAAC,OAAO,KAAK,KAAK,CAAC,OAAO;QAAE,MAAM,IAAI,WAAW,CAAC,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,CAAC;IACH,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,iBAAiB,EAAE,GAAG,oBAAoB,CAAC,KAAK,CAAC,EAAE,CAAC;AACxF,CAAC,CAAC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { GitAppOwnerRepository, GitCredentialInvalidation } from './contracts.js';
|
|
2
|
+
/** Internal custody material. Never export from the public package entry. */
|
|
3
|
+
export interface AppCredential {
|
|
4
|
+
appId: string;
|
|
5
|
+
slug: string;
|
|
6
|
+
privateKey: string;
|
|
7
|
+
webhookSecret: string;
|
|
8
|
+
}
|
|
9
|
+
export interface MintedToken {
|
|
10
|
+
token: string;
|
|
11
|
+
expiresAt: string;
|
|
12
|
+
permissions: Record<string, string>;
|
|
13
|
+
repositoryIds: string[];
|
|
14
|
+
}
|
|
15
|
+
export interface GitHubAppApi {
|
|
16
|
+
exchange(code: string): Promise<AppCredential>;
|
|
17
|
+
inspectInstallation(app: AppCredential, installationId: string): Promise<{
|
|
18
|
+
permissions: Record<string, string>;
|
|
19
|
+
suspended: boolean;
|
|
20
|
+
}>;
|
|
21
|
+
resolveRepository(app: AppCredential, installationId: string, locator: string): Promise<string>;
|
|
22
|
+
mint(app: AppCredential, installationId: string, repositoryId: string, permissions: Record<string, string>): Promise<MintedToken>;
|
|
23
|
+
verifyKey(app: AppCredential): Promise<void>;
|
|
24
|
+
updateWebhookSecret(app: AppCredential): Promise<void>;
|
|
25
|
+
revokeToken(token: string): Promise<void>;
|
|
26
|
+
}
|
|
27
|
+
export type RevocationReason = 'suspended' | 'uninstalled' | 'repository_removed' | 'permissions_lost' | 'owner_revoked';
|
|
28
|
+
export interface EnrollmentRecord {
|
|
29
|
+
target: GitAppOwnerRepository;
|
|
30
|
+
installationRef: string;
|
|
31
|
+
webhookSecretRef: string;
|
|
32
|
+
state: 'manifest' | 'install' | 'ready' | 'unavailable' | 'revoked';
|
|
33
|
+
callbackState: string;
|
|
34
|
+
callbackExpiresAt: number;
|
|
35
|
+
credentialVersion: string;
|
|
36
|
+
app?: AppCredential;
|
|
37
|
+
installationId?: string;
|
|
38
|
+
repositoryId?: string;
|
|
39
|
+
previousWebhook?: {
|
|
40
|
+
secret: string;
|
|
41
|
+
version: string;
|
|
42
|
+
until: number;
|
|
43
|
+
};
|
|
44
|
+
webhookVersion: string;
|
|
45
|
+
webhookRotationPending?: boolean;
|
|
46
|
+
invalidationPending?: boolean;
|
|
47
|
+
/** Encrypted revocation cache, never an audit journal; expired entries are erased. */
|
|
48
|
+
leases: {
|
|
49
|
+
token: string;
|
|
50
|
+
expiresAt: string;
|
|
51
|
+
}[];
|
|
52
|
+
}
|
|
53
|
+
/** Host transaction must be durable, serializable and shared across replicas. */
|
|
54
|
+
export interface GitAppEnvelopeStore {
|
|
55
|
+
transaction<T>(ref: string, action: (sealed: string | null) => Promise<{
|
|
56
|
+
sealed: string;
|
|
57
|
+
result: T;
|
|
58
|
+
}>): Promise<T>;
|
|
59
|
+
}
|
|
60
|
+
export interface GitAppCustodian {
|
|
61
|
+
create(record: EnrollmentRecord): Promise<void>;
|
|
62
|
+
withRecord<T>(ref: string, action: (record: EnrollmentRecord) => Promise<T>): Promise<T>;
|
|
63
|
+
}
|
|
64
|
+
export interface GitAppLifecycleInput {
|
|
65
|
+
custody: GitAppCustodian;
|
|
66
|
+
github: GitHubAppApi;
|
|
67
|
+
now: () => number;
|
|
68
|
+
onCredentialsChanged(event: GitCredentialInvalidation): Promise<void>;
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=records.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"records.d.ts","sourceRoot":"","sources":["../../src/forge/records.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAEvF,6EAA6E;AAC7E,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,C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,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,eAAe,CAAC;IACzB,MAAM,EAAE,YAAY,CAAC;IACrB,GAAG,EAAE,MAAM,MAAM,CAAC;IAClB,oBAAoB,CAAC,KAAK,EAAE,yBAAyB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACvE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"records.js","sourceRoot":"","sources":["../../src/forge/records.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { GitAppOwnerRepository } from './contracts.js';
|
|
2
|
+
import type { GitAppLifecycleInput } from './records.js';
|
|
3
|
+
export declare const createGitAppRotation: (input: GitAppLifecycleInput) => {
|
|
4
|
+
rotateAppKey: (target: GitAppOwnerRepository, ref: string, privateKey: string) => Promise<{
|
|
5
|
+
installationRef: string;
|
|
6
|
+
webhookSecretRef: string;
|
|
7
|
+
storageScopeId: string;
|
|
8
|
+
repoId: string;
|
|
9
|
+
state: "unavailable" | "revoked" | "ready" | "install" | "manifest";
|
|
10
|
+
credentialVersion: string;
|
|
11
|
+
webhookRotationPending: boolean;
|
|
12
|
+
webhookOverlapEndsAt: string | null;
|
|
13
|
+
}>;
|
|
14
|
+
rotateWebhook: (target: GitAppOwnerRepository, ref: string, secret: string, overlapMs: number) => Promise<{
|
|
15
|
+
overlapEndsAt: string;
|
|
16
|
+
installationRef: string;
|
|
17
|
+
webhookSecretRef: string;
|
|
18
|
+
storageScopeId: string;
|
|
19
|
+
repoId: string;
|
|
20
|
+
state: "unavailable" | "revoked" | "ready" | "install" | "manifest";
|
|
21
|
+
credentialVersion: string;
|
|
22
|
+
webhookRotationPending: boolean;
|
|
23
|
+
webhookOverlapEndsAt: string | null;
|
|
24
|
+
}>;
|
|
25
|
+
switchWebhookSender: (target: GitAppOwnerRepository, ref: string) => Promise<{
|
|
26
|
+
installationRef: string;
|
|
27
|
+
webhookSecretRef: string;
|
|
28
|
+
storageScopeId: string;
|
|
29
|
+
repoId: string;
|
|
30
|
+
state: "unavailable" | "revoked" | "ready" | "install" | "manifest";
|
|
31
|
+
credentialVersion: string;
|
|
32
|
+
webhookRotationPending: boolean;
|
|
33
|
+
webhookOverlapEndsAt: string | null;
|
|
34
|
+
}>;
|
|
35
|
+
retirePreviousWebhook: (target: GitAppOwnerRepository, ref: string) => Promise<{
|
|
36
|
+
installationRef: string;
|
|
37
|
+
webhookSecretRef: string;
|
|
38
|
+
storageScopeId: string;
|
|
39
|
+
repoId: string;
|
|
40
|
+
state: "unavailable" | "revoked" | "ready" | "install" | "manifest";
|
|
41
|
+
credentialVersion: string;
|
|
42
|
+
webhookRotationPending: boolean;
|
|
43
|
+
webhookOverlapEndsAt: string | null;
|
|
44
|
+
}>;
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=rotation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rotation.d.ts","sourceRoot":"","sources":["../../src/forge/rotation.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAGzD,eAAO,MAAM,oBAAoB,UAAW,oBAAoB;2BAGvC,qBAAqB,OAAO,MAAM,cAAc,MAAM;;;;;;;;;;4BAerD,qBAAqB,OAAO,MAAM,UAAU,MAAM,aAAa,MAAM;;;;;;;;;;;kCAe/D,qBAAqB,OAAO,MAAM;;;;;;;;;;oCAOhC,qBAAqB,OAAO,MAAM;;;;;;;;;;CASnE,CAAC"}
|