studiograph 1.3.48-next.21 → 1.3.48-next.210
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 +26 -16
- package/dist/agent/agent-pool.d.ts +87 -3
- package/dist/agent/agent-pool.js +188 -15
- package/dist/agent/agent-pool.js.map +1 -1
- package/dist/agent/followups.d.ts +34 -0
- package/dist/agent/followups.js +52 -0
- package/dist/agent/followups.js.map +1 -0
- package/dist/agent/orchestrator.d.ts +101 -4
- package/dist/agent/orchestrator.js +464 -66
- package/dist/agent/orchestrator.js.map +1 -1
- package/dist/agent/prompts/entity-types-section.d.ts +34 -0
- package/dist/agent/prompts/entity-types-section.js +76 -0
- package/dist/agent/prompts/entity-types-section.js.map +1 -0
- package/dist/agent/prompts/system.md +112 -54
- package/dist/agent/skill-loader.d.ts +30 -17
- package/dist/agent/skill-loader.js +63 -30
- package/dist/agent/skill-loader.js.map +1 -1
- package/dist/agent/skills/artifact-canvas/skill.md +152 -0
- package/dist/agent/skills/entity-schema.md +75 -431
- package/dist/agent/skills/interview/entity-templates.md +38 -37
- package/dist/agent/skills/interview/question-domains.md +54 -49
- package/dist/agent/skills/interview/skill.md +84 -16
- package/dist/agent/skills/schema-rules.md +28 -28
- package/dist/agent/tools/artifact-tools.d.ts +124 -0
- package/dist/agent/tools/artifact-tools.js +207 -0
- package/dist/agent/tools/artifact-tools.js.map +1 -0
- package/dist/agent/tools/capture-tools.d.ts +31 -0
- package/dist/agent/tools/capture-tools.js +40 -0
- package/dist/agent/tools/capture-tools.js.map +1 -0
- package/dist/agent/tools/folder-tools.d.ts +47 -0
- package/dist/agent/tools/folder-tools.js +249 -0
- package/dist/agent/tools/folder-tools.js.map +1 -0
- package/dist/agent/tools/fs-tools.d.ts +6 -5
- package/dist/agent/tools/fs-tools.js +5 -5
- package/dist/agent/tools/fs-tools.js.map +1 -1
- package/dist/agent/tools/graph-tools.d.ts +48 -72
- package/dist/agent/tools/graph-tools.js +852 -329
- package/dist/agent/tools/graph-tools.js.map +1 -1
- package/dist/agent/tools/history-tools.d.ts +95 -0
- package/dist/agent/tools/history-tools.js +461 -0
- package/dist/agent/tools/history-tools.js.map +1 -0
- package/dist/agent/tools/load-skill.d.ts +6 -5
- package/dist/agent/tools/load-skill.js +3 -3
- package/dist/agent/tools/load-skill.js.map +1 -1
- package/dist/agent/tools/ops-tools.d.ts +5 -4
- package/dist/agent/tools/ops-tools.js +130 -236
- package/dist/agent/tools/ops-tools.js.map +1 -1
- package/dist/agent/tools/permission-tools.d.ts +87 -17
- package/dist/agent/tools/permission-tools.js +233 -43
- package/dist/agent/tools/permission-tools.js.map +1 -1
- package/dist/agent/tools/tool-loader.js +5 -4
- package/dist/agent/tools/tool-loader.js.map +1 -1
- package/dist/agent/tools/web-tools.js +58 -9
- package/dist/agent/tools/web-tools.js.map +1 -1
- package/dist/cli/commands/about.d.ts +1 -0
- package/dist/cli/commands/about.js +55 -3
- package/dist/cli/commands/about.js.map +1 -1
- package/dist/cli/commands/admin/audit-workspace.d.ts +23 -0
- package/dist/cli/commands/admin/audit-workspace.js +133 -0
- package/dist/cli/commands/admin/audit-workspace.js.map +1 -0
- package/dist/cli/commands/admin/audit.d.ts +21 -0
- package/dist/cli/commands/admin/audit.js +174 -0
- package/dist/cli/commands/admin/audit.js.map +1 -0
- package/dist/cli/commands/admin/backup.d.ts +54 -0
- package/dist/cli/commands/admin/backup.js +207 -0
- package/dist/cli/commands/admin/backup.js.map +1 -0
- package/dist/cli/commands/admin/folder.d.ts +11 -0
- package/dist/cli/commands/{collection.js → admin/folder.js} +33 -32
- package/dist/cli/commands/admin/folder.js.map +1 -0
- package/dist/cli/commands/admin/index.d.ts +16 -0
- package/dist/cli/commands/admin/index.js +46 -0
- package/dist/cli/commands/admin/index.js.map +1 -0
- package/dist/cli/commands/admin/migrate-assets.d.ts +53 -0
- package/dist/cli/commands/admin/migrate-assets.js +184 -0
- package/dist/cli/commands/admin/migrate-assets.js.map +1 -0
- package/dist/cli/commands/admin/migrate.d.ts +56 -0
- package/dist/cli/commands/admin/migrate.js +263 -0
- package/dist/cli/commands/admin/migrate.js.map +1 -0
- package/dist/cli/commands/admin/restore.d.ts +24 -0
- package/dist/cli/commands/admin/restore.js +228 -0
- package/dist/cli/commands/admin/restore.js.map +1 -0
- package/dist/cli/commands/admin/secrets.d.ts +23 -0
- package/dist/cli/commands/admin/secrets.js +256 -0
- package/dist/cli/commands/admin/secrets.js.map +1 -0
- package/dist/cli/commands/admin/settings.d.ts +28 -0
- package/dist/cli/commands/admin/settings.js +284 -0
- package/dist/cli/commands/admin/settings.js.map +1 -0
- package/dist/cli/commands/admin/token.d.ts +42 -0
- package/dist/cli/commands/admin/token.js +126 -0
- package/dist/cli/commands/admin/token.js.map +1 -0
- package/dist/cli/commands/admin/transfer-ownership.d.ts +15 -0
- package/dist/cli/commands/admin/transfer-ownership.js +106 -0
- package/dist/cli/commands/admin/transfer-ownership.js.map +1 -0
- package/dist/cli/commands/admin/user.d.ts +11 -0
- package/dist/cli/commands/admin/user.js +187 -0
- package/dist/cli/commands/admin/user.js.map +1 -0
- package/dist/cli/commands/clone.d.ts +25 -3
- package/dist/cli/commands/clone.js +142 -36
- package/dist/cli/commands/clone.js.map +1 -1
- package/dist/cli/commands/config.d.ts +23 -107
- package/dist/cli/commands/config.js +52 -260
- package/dist/cli/commands/config.js.map +1 -1
- package/dist/cli/commands/connector.d.ts +10 -13
- package/dist/cli/commands/connector.js +16 -58
- package/dist/cli/commands/connector.js.map +1 -1
- package/dist/cli/commands/deploy.js +215 -68
- package/dist/cli/commands/deploy.js.map +1 -1
- package/dist/cli/commands/index.js +5 -1
- package/dist/cli/commands/index.js.map +1 -1
- package/dist/cli/commands/init.js +10 -30
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/mcp.js +54 -6
- package/dist/cli/commands/mcp.js.map +1 -1
- package/dist/cli/commands/r2.d.ts +3 -0
- package/dist/cli/commands/r2.js +223 -204
- package/dist/cli/commands/r2.js.map +1 -1
- package/dist/cli/commands/redeploy.js +65 -12
- package/dist/cli/commands/redeploy.js.map +1 -1
- package/dist/cli/commands/reset.d.ts +22 -6
- package/dist/cli/commands/reset.js +132 -34
- package/dist/cli/commands/reset.js.map +1 -1
- package/dist/cli/commands/serve.js +231 -26
- package/dist/cli/commands/serve.js.map +1 -1
- package/dist/cli/commands/sync.d.ts +1 -1
- package/dist/cli/commands/sync.js +237 -227
- package/dist/cli/commands/sync.js.map +1 -1
- package/dist/cli/crypto-bundle.d.ts +39 -0
- package/dist/cli/crypto-bundle.js +94 -0
- package/dist/cli/crypto-bundle.js.map +1 -0
- package/dist/cli/index.js +24 -26
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/railway-pin.d.ts +68 -0
- package/dist/cli/railway-pin.js +96 -0
- package/dist/cli/railway-pin.js.map +1 -0
- package/dist/cli/railway-provisioning.d.ts +53 -0
- package/dist/cli/railway-provisioning.js +85 -0
- package/dist/cli/railway-provisioning.js.map +1 -0
- package/dist/cli/setup-wizard.d.ts +30 -49
- package/dist/cli/setup-wizard.js +39 -40
- package/dist/cli/setup-wizard.js.map +1 -1
- package/dist/core/accent-palette.d.ts +22 -0
- package/dist/core/accent-palette.js +47 -0
- package/dist/core/accent-palette.js.map +1 -0
- package/dist/core/artifact-asset-urls.d.ts +51 -0
- package/dist/core/artifact-asset-urls.js +79 -0
- package/dist/core/artifact-asset-urls.js.map +1 -0
- package/dist/core/artifact-bundle.d.ts +69 -0
- package/dist/core/artifact-bundle.js +305 -0
- package/dist/core/artifact-bundle.js.map +1 -0
- package/dist/core/artifact-escape.d.ts +5 -0
- package/dist/core/artifact-escape.js +26 -0
- package/dist/core/artifact-escape.js.map +1 -0
- package/dist/core/artifact-export.d.ts +17 -0
- package/dist/core/artifact-export.js +529 -0
- package/dist/core/artifact-export.js.map +1 -0
- package/dist/core/cell-anchor.d.ts +29 -0
- package/dist/core/cell-anchor.js +53 -0
- package/dist/core/cell-anchor.js.map +1 -0
- package/dist/core/comment-anchor.d.ts +41 -0
- package/dist/core/comment-anchor.js +147 -0
- package/dist/core/comment-anchor.js.map +1 -0
- package/dist/core/commit-messages.d.ts +57 -0
- package/dist/core/commit-messages.js +85 -0
- package/dist/core/commit-messages.js.map +1 -0
- package/dist/core/embeds.d.ts +96 -0
- package/dist/core/embeds.js +187 -0
- package/dist/core/embeds.js.map +1 -0
- package/dist/core/entity-body-templates.d.ts +21 -0
- package/dist/core/entity-body-templates.js +67 -0
- package/dist/core/entity-body-templates.js.map +1 -0
- package/dist/core/entity-types-catalog.d.ts +65 -0
- package/dist/core/entity-types-catalog.js +142 -0
- package/dist/core/entity-types-catalog.js.map +1 -0
- package/dist/core/field-library.d.ts +62 -0
- package/dist/core/field-library.js +129 -0
- package/dist/core/field-library.js.map +1 -0
- package/dist/core/folder-paths.d.ts +41 -0
- package/dist/core/folder-paths.js +95 -0
- package/dist/core/folder-paths.js.map +1 -0
- package/dist/core/folder-sidecar.d.ts +36 -0
- package/dist/core/folder-sidecar.js +91 -0
- package/dist/core/folder-sidecar.js.map +1 -0
- package/dist/core/format-registry.d.ts +170 -0
- package/dist/core/format-registry.js +412 -0
- package/dist/core/format-registry.js.map +1 -0
- package/dist/core/graph.d.ts +773 -14
- package/dist/core/graph.js +2269 -308
- package/dist/core/graph.js.map +1 -1
- package/dist/core/history-diff.d.ts +35 -0
- package/dist/core/history-diff.js +114 -0
- package/dist/core/history-diff.js.map +1 -0
- package/dist/core/refs.d.ts +41 -0
- package/dist/core/refs.js +80 -0
- package/dist/core/refs.js.map +1 -0
- package/dist/core/schema-registry.d.ts +66 -0
- package/dist/core/schema-registry.js +198 -37
- package/dist/core/schema-registry.js.map +1 -1
- package/dist/core/schemas/connector.d.ts +67 -0
- package/dist/core/schemas/connector.js +100 -0
- package/dist/core/schemas/connector.js.map +1 -0
- package/dist/core/schemas/workspace.d.ts +122 -0
- package/dist/core/schemas/workspace.js +211 -0
- package/dist/core/schemas/workspace.js.map +1 -0
- package/dist/core/secrets/SecretStore.d.ts +77 -0
- package/dist/core/secrets/SecretStore.js +13 -0
- package/dist/core/secrets/SecretStore.js.map +1 -0
- package/dist/core/secrets/SettingsResolver.d.ts +54 -0
- package/dist/core/secrets/SettingsResolver.js +80 -0
- package/dist/core/secrets/SettingsResolver.js.map +1 -0
- package/dist/core/secrets/SettingsStore.d.ts +30 -0
- package/dist/core/secrets/SettingsStore.js +9 -0
- package/dist/core/secrets/SettingsStore.js.map +1 -0
- package/dist/core/secrets/SqliteEncryptedStore.d.ts +90 -0
- package/dist/core/secrets/SqliteEncryptedStore.js +598 -0
- package/dist/core/secrets/SqliteEncryptedStore.js.map +1 -0
- package/dist/core/secrets/audit.d.ts +36 -0
- package/dist/core/secrets/audit.js +60 -0
- package/dist/core/secrets/audit.js.map +1 -0
- package/dist/core/secrets/auth-db-migration.d.ts +129 -0
- package/dist/core/secrets/auth-db-migration.js +653 -0
- package/dist/core/secrets/auth-db-migration.js.map +1 -0
- package/dist/core/secrets/bundle.d.ts +141 -0
- package/dist/core/secrets/bundle.js +435 -0
- package/dist/core/secrets/bundle.js.map +1 -0
- package/dist/core/secrets/dual-write.d.ts +81 -0
- package/dist/core/secrets/dual-write.js +247 -0
- package/dist/core/secrets/dual-write.js.map +1 -0
- package/dist/core/secrets/encryption.d.ts +44 -0
- package/dist/core/secrets/encryption.js +97 -0
- package/dist/core/secrets/encryption.js.map +1 -0
- package/dist/core/secrets/index.d.ts +49 -0
- package/dist/core/secrets/index.js +74 -0
- package/dist/core/secrets/index.js.map +1 -0
- package/dist/core/secrets/master-key.d.ts +38 -0
- package/dist/core/secrets/master-key.js +122 -0
- package/dist/core/secrets/master-key.js.map +1 -0
- package/dist/core/secrets/probes/anthropic.d.ts +98 -0
- package/dist/core/secrets/probes/anthropic.js +300 -0
- package/dist/core/secrets/probes/anthropic.js.map +1 -0
- package/dist/core/secrets/probes/brave.d.ts +9 -0
- package/dist/core/secrets/probes/brave.js +15 -0
- package/dist/core/secrets/probes/brave.js.map +1 -0
- package/dist/core/secrets/probes/r2.d.ts +15 -0
- package/dist/core/secrets/probes/r2.js +14 -0
- package/dist/core/secrets/probes/r2.js.map +1 -0
- package/dist/core/secrets/probes/tavily.d.ts +18 -0
- package/dist/core/secrets/probes/tavily.js +58 -0
- package/dist/core/secrets/probes/tavily.js.map +1 -0
- package/dist/core/secrets/probes/voyage.d.ts +13 -0
- package/dist/core/secrets/probes/voyage.js +52 -0
- package/dist/core/secrets/probes/voyage.js.map +1 -0
- package/dist/core/secrets/r2-structural-migration.d.ts +39 -0
- package/dist/core/secrets/r2-structural-migration.js +109 -0
- package/dist/core/secrets/r2-structural-migration.js.map +1 -0
- package/dist/core/secrets/read-flip.d.ts +59 -0
- package/dist/core/secrets/read-flip.js +87 -0
- package/dist/core/secrets/read-flip.js.map +1 -0
- package/dist/core/secrets/registry.d.ts +188 -0
- package/dist/core/secrets/registry.js +616 -0
- package/dist/core/secrets/registry.js.map +1 -0
- package/dist/core/types.d.ts +77 -483
- package/dist/core/types.js +25 -3
- package/dist/core/types.js.map +1 -1
- package/dist/core/user-config.d.ts +75 -12
- package/dist/core/user-config.js +155 -14
- package/dist/core/user-config.js.map +1 -1
- package/dist/core/validation.d.ts +786 -1373
- package/dist/core/validation.js +458 -147
- package/dist/core/validation.js.map +1 -1
- package/dist/core/workspace-manager.d.ts +87 -14
- package/dist/core/workspace-manager.js +222 -94
- package/dist/core/workspace-manager.js.map +1 -1
- package/dist/core/workspace.d.ts +19 -5
- package/dist/core/workspace.js +67 -39
- package/dist/core/workspace.js.map +1 -1
- package/dist/mcp/comment-virtual-entity.d.ts +36 -0
- package/dist/mcp/comment-virtual-entity.js +71 -0
- package/dist/mcp/comment-virtual-entity.js.map +1 -0
- package/dist/mcp/connector-manager.d.ts +72 -2
- package/dist/mcp/connector-manager.js +211 -32
- package/dist/mcp/connector-manager.js.map +1 -1
- package/dist/mcp/oauth-provider.d.ts +0 -5
- package/dist/mcp/oauth-provider.js +10 -22
- package/dist/mcp/oauth-provider.js.map +1 -1
- package/dist/mcp/oauth-registry.d.ts +46 -8
- package/dist/mcp/oauth-registry.js +52 -13
- package/dist/mcp/oauth-registry.js.map +1 -1
- package/dist/mcp/server-discovery.d.ts +73 -0
- package/dist/mcp/server-discovery.js +164 -0
- package/dist/mcp/server-discovery.js.map +1 -0
- package/dist/mcp/server.d.ts +24 -3
- package/dist/mcp/server.js +53 -10
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/state-signer.d.ts +62 -0
- package/dist/mcp/state-signer.js +205 -0
- package/dist/mcp/state-signer.js.map +1 -0
- package/dist/mcp/stdio-proxy.d.ts +67 -0
- package/dist/mcp/stdio-proxy.js +149 -0
- package/dist/mcp/stdio-proxy.js.map +1 -0
- package/dist/mcp/tools.d.ts +65 -2
- package/dist/mcp/tools.js +1772 -124
- package/dist/mcp/tools.js.map +1 -1
- package/dist/server/__tests__/helpers/graph-api.d.ts +16 -0
- package/dist/server/__tests__/helpers/graph-api.js +16 -0
- package/dist/server/__tests__/helpers/graph-api.js.map +1 -0
- package/dist/server/artifact-asset-mint.d.ts +41 -0
- package/dist/server/artifact-asset-mint.js +59 -0
- package/dist/server/artifact-asset-mint.js.map +1 -0
- package/dist/server/asset-index-queue.d.ts +98 -0
- package/dist/server/asset-index-queue.js +193 -0
- package/dist/server/asset-index-queue.js.map +1 -0
- package/dist/server/body-write-coordinator.d.ts +161 -0
- package/dist/server/body-write-coordinator.js +182 -0
- package/dist/server/body-write-coordinator.js.map +1 -0
- package/dist/server/cloud-billing-flow.d.ts +32 -0
- package/dist/server/cloud-billing-flow.js +75 -0
- package/dist/server/cloud-billing-flow.js.map +1 -0
- package/dist/server/commit-audit.d.ts +26 -0
- package/dist/server/commit-audit.js +30 -0
- package/dist/server/commit-audit.js.map +1 -0
- package/dist/server/index.d.ts +29 -3
- package/dist/server/index.js +657 -269
- package/dist/server/index.js.map +1 -1
- package/dist/server/middleware/sanitize.d.ts +46 -0
- package/dist/server/middleware/sanitize.js +182 -0
- package/dist/server/middleware/sanitize.js.map +1 -0
- package/dist/server/routes/artifact-export-api.d.ts +11 -0
- package/dist/server/routes/artifact-export-api.js +159 -0
- package/dist/server/routes/artifact-export-api.js.map +1 -0
- package/dist/server/routes/asset-api.d.ts +76 -1
- package/dist/server/routes/asset-api.js +761 -61
- package/dist/server/routes/asset-api.js.map +1 -1
- package/dist/server/routes/audit-api.d.ts +24 -0
- package/dist/server/routes/audit-api.js +117 -0
- package/dist/server/routes/audit-api.js.map +1 -0
- package/dist/server/routes/auth-api.js +532 -63
- package/dist/server/routes/auth-api.js.map +1 -1
- package/dist/server/routes/capture-api.d.ts +10 -3
- package/dist/server/routes/capture-api.js +213 -25
- package/dist/server/routes/capture-api.js.map +1 -1
- package/dist/server/routes/chat-sessions-api.d.ts +13 -0
- package/dist/server/routes/chat-sessions-api.js +455 -0
- package/dist/server/routes/chat-sessions-api.js.map +1 -0
- package/dist/server/routes/chat.d.ts +35 -1
- package/dist/server/routes/chat.js +699 -54
- package/dist/server/routes/chat.js.map +1 -1
- package/dist/server/routes/comments-api.d.ts +15 -0
- package/dist/server/routes/comments-api.js +444 -0
- package/dist/server/routes/comments-api.js.map +1 -0
- package/dist/server/routes/config-api.d.ts +3 -2
- package/dist/server/routes/config-api.js +179 -49
- package/dist/server/routes/config-api.js.map +1 -1
- package/dist/server/routes/connectors-api.js +177 -42
- package/dist/server/routes/connectors-api.js.map +1 -1
- package/dist/server/routes/event-ingest-api.d.ts +15 -0
- package/dist/server/routes/{meeting-ingest-api.js → event-ingest-api.js} +35 -20
- package/dist/server/routes/event-ingest-api.js.map +1 -0
- package/dist/server/routes/field-library-api.d.ts +28 -0
- package/dist/server/routes/field-library-api.js +126 -0
- package/dist/server/routes/field-library-api.js.map +1 -0
- package/dist/server/routes/git-http.d.ts +2 -2
- package/dist/server/routes/git-http.js +86 -39
- package/dist/server/routes/git-http.js.map +1 -1
- package/dist/server/routes/graph-api-access.d.ts +57 -0
- package/dist/server/routes/graph-api-access.js +112 -0
- package/dist/server/routes/graph-api-access.js.map +1 -0
- package/dist/server/routes/graph-api.d.ts +1 -1
- package/dist/server/routes/graph-api.js +1455 -325
- package/dist/server/routes/graph-api.js.map +1 -1
- package/dist/server/routes/health.d.ts +18 -0
- package/dist/server/routes/health.js +74 -0
- package/dist/server/routes/health.js.map +1 -0
- package/dist/server/routes/import-batch.d.ts +24 -0
- package/dist/server/routes/import-batch.js +33 -0
- package/dist/server/routes/import-batch.js.map +1 -0
- package/dist/server/routes/insights-api.d.ts +9 -2
- package/dist/server/routes/insights-api.js +355 -61
- package/dist/server/routes/insights-api.js.map +1 -1
- package/dist/server/routes/mcp.d.ts +7 -3
- package/dist/server/routes/mcp.js +24 -8
- package/dist/server/routes/mcp.js.map +1 -1
- package/dist/server/routes/oauth-api.d.ts +67 -0
- package/dist/server/routes/oauth-api.js +421 -0
- package/dist/server/routes/oauth-api.js.map +1 -0
- package/dist/server/routes/permissions-api.d.ts +9 -2
- package/dist/server/routes/permissions-api.js +87 -31
- package/dist/server/routes/permissions-api.js.map +1 -1
- package/dist/server/routes/r2-api.d.ts +25 -0
- package/dist/server/routes/r2-api.js +276 -0
- package/dist/server/routes/r2-api.js.map +1 -0
- package/dist/server/routes/secrets-api.d.ts +36 -0
- package/dist/server/routes/secrets-api.js +308 -0
- package/dist/server/routes/secrets-api.js.map +1 -0
- package/dist/server/routes/settings-api.d.ts +29 -0
- package/dist/server/routes/settings-api.js +180 -0
- package/dist/server/routes/settings-api.js.map +1 -0
- package/dist/server/routes/share-api.d.ts +32 -0
- package/dist/server/routes/share-api.js +234 -0
- package/dist/server/routes/share-api.js.map +1 -0
- package/dist/server/routes/views-api.js +51 -0
- package/dist/server/routes/views-api.js.map +1 -1
- package/dist/server/routes/workspace-api.d.ts +2 -1
- package/dist/server/routes/workspace-api.js +142 -23
- package/dist/server/routes/workspace-api.js.map +1 -1
- package/dist/server/routes/ws.d.ts +3 -2
- package/dist/server/routes/ws.js +68 -17
- package/dist/server/routes/ws.js.map +1 -1
- package/dist/server/session-manager.d.ts +48 -5
- package/dist/server/session-manager.js +182 -14
- package/dist/server/session-manager.js.map +1 -1
- package/dist/server/ws-hub.d.ts +124 -37
- package/dist/server/ws-hub.js +0 -0
- package/dist/server/ws-hub.js.map +1 -1
- package/dist/server/yjs-manager.d.ts +278 -7
- package/dist/server/yjs-manager.js +830 -38
- package/dist/server/yjs-manager.js.map +1 -1
- package/dist/server/yjs-persistence.d.ts +165 -0
- package/dist/server/yjs-persistence.js +557 -0
- package/dist/server/yjs-persistence.js.map +1 -0
- package/dist/server/yjs-text-diff.d.ts +32 -0
- package/dist/server/yjs-text-diff.js +61 -0
- package/dist/server/yjs-text-diff.js.map +1 -0
- package/dist/services/access-control.d.ts +73 -0
- package/dist/services/access-control.js +165 -0
- package/dist/services/access-control.js.map +1 -0
- package/dist/services/artifact-asset-token.d.ts +69 -0
- package/dist/services/artifact-asset-token.js +94 -0
- package/dist/services/artifact-asset-token.js.map +1 -0
- package/dist/services/artifact-library-sources.d.ts +3 -0
- package/dist/services/artifact-library-sources.js +44 -0
- package/dist/services/artifact-library-sources.js.map +1 -0
- package/dist/services/artifact-render-export.d.ts +97 -0
- package/dist/services/artifact-render-export.js +467 -0
- package/dist/services/artifact-render-export.js.map +1 -0
- package/dist/services/asset-caption-service.d.ts +103 -0
- package/dist/services/asset-caption-service.js +186 -0
- package/dist/services/asset-caption-service.js.map +1 -0
- package/dist/services/asset-delete-authz.d.ts +31 -0
- package/dist/services/asset-delete-authz.js +61 -0
- package/dist/services/asset-delete-authz.js.map +1 -0
- package/dist/services/asset-finalize-service.d.ts +58 -0
- package/dist/services/asset-finalize-service.js +216 -0
- package/dist/services/asset-finalize-service.js.map +1 -0
- package/dist/services/asset-import-service.d.ts +111 -0
- package/dist/services/asset-import-service.js +394 -0
- package/dist/services/asset-import-service.js.map +1 -0
- package/dist/services/asset-index-sweep.d.ts +95 -0
- package/dist/services/asset-index-sweep.js +249 -0
- package/dist/services/asset-index-sweep.js.map +1 -0
- package/dist/services/asset-lifecycle-check.d.ts +22 -0
- package/dist/services/asset-lifecycle-check.js +80 -0
- package/dist/services/asset-lifecycle-check.js.map +1 -0
- package/dist/services/asset-listing.d.ts +72 -0
- package/dist/services/asset-listing.js +321 -0
- package/dist/services/asset-listing.js.map +1 -0
- package/dist/services/asset-presign-service.d.ts +68 -0
- package/dist/services/asset-presign-service.js +124 -0
- package/dist/services/asset-presign-service.js.map +1 -0
- package/dist/services/asset-sidecar-service.d.ts +28 -0
- package/dist/services/asset-sidecar-service.js +79 -0
- package/dist/services/asset-sidecar-service.js.map +1 -0
- package/dist/services/asset-upload-errors.d.ts +41 -0
- package/dist/services/asset-upload-errors.js +45 -0
- package/dist/services/asset-upload-errors.js.map +1 -0
- package/dist/services/asset-upload-service.d.ts +56 -0
- package/dist/services/asset-upload-service.js +200 -0
- package/dist/services/asset-upload-service.js.map +1 -0
- package/dist/services/asset-upload-token.d.ts +58 -0
- package/dist/services/asset-upload-token.js +75 -0
- package/dist/services/asset-upload-token.js.map +1 -0
- package/dist/services/assets/asset-index-service.d.ts +127 -0
- package/dist/services/assets/asset-index-service.js +227 -0
- package/dist/services/assets/asset-index-service.js.map +1 -0
- package/dist/services/assets/base.d.ts +128 -2
- package/dist/services/assets/base.js +98 -1
- package/dist/services/assets/base.js.map +1 -1
- package/dist/services/assets/index.d.ts +114 -1
- package/dist/services/assets/index.js +221 -0
- package/dist/services/assets/index.js.map +1 -1
- package/dist/services/assets/local.d.ts +16 -1
- package/dist/services/assets/local.js +110 -1
- package/dist/services/assets/local.js.map +1 -1
- package/dist/services/assets/r2-sync.d.ts +88 -0
- package/dist/services/assets/r2-sync.js +412 -0
- package/dist/services/assets/r2-sync.js.map +1 -0
- package/dist/services/assets/r2.d.ts +87 -1
- package/dist/services/assets/r2.js +203 -1
- package/dist/services/assets/r2.js.map +1 -1
- package/dist/services/auth-service.d.ts +312 -45
- package/dist/services/auth-service.js +1011 -195
- package/dist/services/auth-service.js.map +1 -1
- package/dist/services/chat-session-service.d.ts +188 -0
- package/dist/services/chat-session-service.js +512 -0
- package/dist/services/chat-session-service.js.map +1 -0
- package/dist/services/cloud-inference-billing.d.ts +64 -0
- package/dist/services/cloud-inference-billing.js +313 -0
- package/dist/services/cloud-inference-billing.js.map +1 -0
- package/dist/services/comment-service.d.ts +97 -0
- package/dist/services/comment-service.js +341 -0
- package/dist/services/comment-service.js.map +1 -0
- package/dist/services/comment-virtual-entity.d.ts +36 -0
- package/dist/services/comment-virtual-entity.js +71 -0
- package/dist/services/comment-virtual-entity.js.map +1 -0
- package/dist/services/convert-service.d.ts +64 -0
- package/dist/services/convert-service.js +68 -0
- package/dist/services/convert-service.js.map +1 -0
- package/dist/services/csv-service.d.ts +22 -17
- package/dist/services/csv-service.js +55 -92
- package/dist/services/csv-service.js.map +1 -1
- package/dist/services/entity-mutations.d.ts +213 -0
- package/dist/services/entity-mutations.js +380 -0
- package/dist/services/entity-mutations.js.map +1 -0
- package/dist/services/{meeting-processor.d.ts → event-processor.d.ts} +15 -8
- package/dist/services/{meeting-processor.js → event-processor.js} +124 -65
- package/dist/services/event-processor.js.map +1 -0
- package/dist/services/extract/docx.d.ts +1 -0
- package/dist/services/extract/docx.js +233 -0
- package/dist/services/extract/docx.js.map +1 -0
- package/dist/services/extract/index.d.ts +9 -0
- package/dist/services/extract/index.js +10 -0
- package/dist/services/extract/index.js.map +1 -0
- package/dist/services/extract/pdf.d.ts +13 -0
- package/dist/services/extract/pdf.js +69 -0
- package/dist/services/extract/pdf.js.map +1 -0
- package/dist/services/folder-creation.d.ts +33 -0
- package/dist/services/folder-creation.js +103 -0
- package/dist/services/folder-creation.js.map +1 -0
- package/dist/services/git.d.ts +58 -0
- package/dist/services/git.js +194 -55
- package/dist/services/git.js.map +1 -1
- package/dist/services/graph-maintenance.js +4 -4
- package/dist/services/graph-maintenance.js.map +1 -1
- package/dist/services/import-service.d.ts +51 -2
- package/dist/services/import-service.js +254 -107
- package/dist/services/import-service.js.map +1 -1
- package/dist/services/lint-service.js +10 -17
- package/dist/services/lint-service.js.map +1 -1
- package/dist/services/markdown.d.ts +12 -1
- package/dist/services/markdown.js +77 -9
- package/dist/services/markdown.js.map +1 -1
- package/dist/services/mention-detector.d.ts +23 -0
- package/dist/services/mention-detector.js +47 -0
- package/dist/services/mention-detector.js.map +1 -0
- package/dist/services/model-capabilities.d.ts +41 -0
- package/dist/services/model-capabilities.js +107 -0
- package/dist/services/model-capabilities.js.map +1 -0
- package/dist/services/notification-broadcast.d.ts +32 -0
- package/dist/services/notification-broadcast.js +38 -0
- package/dist/services/notification-broadcast.js.map +1 -0
- package/dist/services/notification-service.d.ts +41 -0
- package/dist/services/notification-service.js +100 -0
- package/dist/services/notification-service.js.map +1 -0
- package/dist/services/oauth-server-store.d.ts +147 -0
- package/dist/services/oauth-server-store.js +319 -0
- package/dist/services/oauth-server-store.js.map +1 -0
- package/dist/services/orphan-service.js +2 -2
- package/dist/services/orphan-service.js.map +1 -1
- package/dist/services/personal-folder.d.ts +40 -0
- package/dist/services/personal-folder.js +101 -0
- package/dist/services/personal-folder.js.map +1 -0
- package/dist/services/scratch-asset-promote.d.ts +57 -0
- package/dist/services/scratch-asset-promote.js +95 -0
- package/dist/services/scratch-asset-promote.js.map +1 -0
- package/dist/services/scratch-attachment-service.d.ts +196 -0
- package/dist/services/scratch-attachment-service.js +347 -0
- package/dist/services/scratch-attachment-service.js.map +1 -0
- package/dist/services/share-link-service.d.ts +57 -0
- package/dist/services/share-link-service.js +142 -0
- package/dist/services/share-link-service.js.map +1 -0
- package/dist/services/user-person-bridge.d.ts +136 -0
- package/dist/services/user-person-bridge.js +340 -0
- package/dist/services/user-person-bridge.js.map +1 -0
- package/dist/services/vector-service.d.ts +282 -5
- package/dist/services/vector-service.js +585 -29
- package/dist/services/vector-service.js.map +1 -1
- package/dist/services/workspace-access.d.ts +108 -0
- package/dist/services/workspace-access.js +149 -0
- package/dist/services/workspace-access.js.map +1 -0
- package/dist/services/workspace-assets-folder.d.ts +46 -0
- package/dist/services/workspace-assets-folder.js +75 -0
- package/dist/services/workspace-assets-folder.js.map +1 -0
- package/dist/utils/git.d.ts +17 -2
- package/dist/utils/git.js +23 -7
- package/dist/utils/git.js.map +1 -1
- package/dist/utils/log.d.ts +42 -0
- package/dist/utils/log.js +137 -0
- package/dist/utils/log.js.map +1 -0
- package/dist/utils/preflight.js +2 -2
- package/dist/utils/preflight.js.map +1 -1
- package/dist/utils/version-checker.d.ts +12 -19
- package/dist/utils/version-checker.js +14 -104
- package/dist/utils/version-checker.js.map +1 -1
- package/dist/web/_app/immutable/assets/0.Bs_z3Z86.css +2 -0
- package/dist/web/_app/immutable/assets/12.DlIf1mKh.css +1 -0
- package/dist/web/_app/immutable/assets/14.7d-Q37wc.css +1 -0
- package/dist/web/_app/immutable/assets/15.BwBFdc1D.css +1 -0
- package/dist/web/_app/immutable/assets/16.CmLrbzZp.css +1 -0
- package/dist/web/_app/immutable/assets/17.DcuK5ZVm.css +1 -0
- package/dist/web/_app/immutable/assets/2.DATnR31c.css +1 -0
- package/dist/web/_app/immutable/assets/3.Cz4H8n_O.css +1 -0
- package/dist/web/_app/immutable/assets/4.aDHteTDy.css +1 -0
- package/dist/web/_app/immutable/assets/6.CF1i5Bon.css +1 -0
- package/dist/web/_app/immutable/assets/ArtifactEntityView.C4ooklFD.css +1 -0
- package/dist/web/_app/immutable/assets/AssetLibraryPicker.BOFW0MvF.css +1 -0
- package/dist/web/_app/immutable/assets/BulkActionsBar.cmKvHzRK.css +1 -0
- package/dist/web/_app/immutable/assets/CalendarView.lBCvS3X5.css +1 -0
- package/dist/web/_app/immutable/assets/CodeMirrorEditor.D6hf2pNJ.css +1 -0
- package/dist/web/_app/immutable/assets/CopyField.DVGZtw4U.css +1 -0
- package/dist/web/_app/immutable/assets/FolderMembersPanel.kiYnDFHu.css +1 -0
- package/dist/web/_app/immutable/assets/FolderMutationDialogs.BMRF6Z3z.css +1 -0
- package/dist/web/_app/immutable/assets/FolderPicker.Cp46GHe2.css +1 -0
- package/dist/web/_app/immutable/assets/GalleryView.WBGxxUQc.css +1 -0
- package/dist/web/_app/immutable/assets/GraphView.BJtGL9py.css +1 -0
- package/dist/web/_app/immutable/assets/KanbanView.BOaI5KFL.css +1 -0
- package/dist/web/_app/immutable/assets/Link.vV0ne105.css +1 -0
- package/dist/web/_app/immutable/assets/Markdown.BZnsSOSf.css +1 -0
- package/dist/web/_app/immutable/assets/Rail.ilusFgD4.css +1 -0
- package/dist/web/_app/immutable/assets/SettingsDialog.D7-BO6S_.css +1 -0
- package/dist/web/_app/immutable/assets/Spinner.UBfl0pab.css +1 -0
- package/dist/web/_app/immutable/assets/StopFilledAlt.fNlDN65D.css +1 -0
- package/dist/web/_app/immutable/assets/TimelineView.xAZBJhHw.css +1 -0
- package/dist/web/_app/immutable/assets/WorkspaceView.C8ErUJAY.css +1 -0
- package/dist/web/_app/immutable/assets/button.BlLm4Dg1.css +1 -0
- package/dist/web/_app/immutable/assets/history-summary.LpmHXasl.css +1 -0
- package/dist/web/_app/immutable/assets/ibm-plex-mono-latin-400-normal.CvHOgSBP.woff +0 -0
- package/dist/web/_app/immutable/assets/ibm-plex-mono-latin-400-normal.DMJ8VG8y.woff2 +0 -0
- package/dist/web/_app/immutable/assets/ibm-plex-mono-latin-500-normal.CB9ihrfo.woff +0 -0
- package/dist/web/_app/immutable/assets/ibm-plex-mono-latin-500-normal.DSY6xOcd.woff2 +0 -0
- package/dist/web/_app/immutable/assets/ibm-plex-sans-latin-400-italic.CZTNEAuW.woff2 +0 -0
- package/dist/web/_app/immutable/assets/ibm-plex-sans-latin-400-italic.CsGl1sm0.woff +0 -0
- package/dist/web/_app/immutable/assets/ibm-plex-sans-latin-400-normal.CDDApCn2.woff2 +0 -0
- package/dist/web/_app/immutable/assets/ibm-plex-sans-latin-400-normal.CYLoc0-x.woff +0 -0
- package/dist/web/_app/immutable/assets/ibm-plex-sans-latin-500-italic.BNK2_mGO.woff2 +0 -0
- package/dist/web/_app/immutable/assets/ibm-plex-sans-latin-500-italic.DpEwFAQM.woff +0 -0
- package/dist/web/_app/immutable/assets/ibm-plex-sans-latin-500-normal.6ng42L7E.woff2 +0 -0
- package/dist/web/_app/immutable/assets/ibm-plex-sans-latin-500-normal.BgVn5rGT.woff +0 -0
- package/dist/web/_app/immutable/assets/ibm-plex-sans-latin-600-normal.Cu4Hd6ag.woff +0 -0
- package/dist/web/_app/immutable/assets/ibm-plex-sans-latin-600-normal.CuJfVYMP.woff2 +0 -0
- package/dist/web/_app/immutable/assets/inline-list.cqga56xT.css +1 -0
- package/dist/web/_app/immutable/assets/list-columns.BgnafZ4K.css +1 -0
- package/dist/web/_app/immutable/assets/realtime.DDCWxn3B.css +1 -0
- package/dist/web/_app/immutable/assets/select.B90KUqR4.css +1 -0
- package/dist/web/_app/immutable/assets/sheet.RF9RBmml.css +1 -0
- package/dist/web/_app/immutable/chunks/22qYtvr82.js +1 -0
- package/dist/web/_app/immutable/chunks/3anKjXOb.js +1 -0
- package/dist/web/_app/immutable/chunks/6S9WOky52.js +1 -0
- package/dist/web/_app/immutable/chunks/7xJ91z7d.js +2 -0
- package/dist/web/_app/immutable/chunks/9K8VREGP.js +1 -0
- package/dist/web/_app/immutable/chunks/B-TGZnCt2.js +1 -0
- package/dist/web/_app/immutable/chunks/B-n5q6ku.js +1 -0
- package/dist/web/_app/immutable/chunks/B0p2fSEV2.js +1 -0
- package/dist/web/_app/immutable/chunks/B2oi87jG.js +2 -0
- package/dist/web/_app/immutable/chunks/B4DG5QOL.js +1 -0
- package/dist/web/_app/immutable/chunks/B6Lt-qaJ.js +1 -0
- package/dist/web/_app/immutable/chunks/B6qeIQZz.js +2 -0
- package/dist/web/_app/immutable/chunks/B9KfEsQw2.js +1 -0
- package/dist/web/_app/immutable/chunks/B9VRF5aH2.js +1 -0
- package/dist/web/_app/immutable/chunks/BCQQzpbj.js +1 -0
- package/dist/web/_app/immutable/chunks/BF0vIqH9.js +1 -0
- package/dist/web/_app/immutable/chunks/BFp1K70l.js +8 -0
- package/dist/web/_app/immutable/chunks/BFr7Funh.js +1 -0
- package/dist/web/_app/immutable/chunks/BFx32D20.js +2 -0
- package/dist/web/_app/immutable/chunks/BLs1h0Rh2.js +1 -0
- package/dist/web/_app/immutable/chunks/BPzV_xOS2.js +1 -0
- package/dist/web/_app/immutable/chunks/BRvMjAzW.js +2 -0
- package/dist/web/_app/immutable/chunks/BV-iCKqa.js +1 -0
- package/dist/web/_app/immutable/chunks/BZi3uKF4.js +1 -0
- package/dist/web/_app/immutable/chunks/B_PyL87x.js +2 -0
- package/dist/web/_app/immutable/chunks/BbfHGU9n2.js +1 -0
- package/dist/web/_app/immutable/chunks/Bbqu2-5G2.js +1 -0
- package/dist/web/_app/immutable/chunks/BdWZJpmv.js +2 -0
- package/dist/web/_app/immutable/chunks/BfnFtsiY.js +1 -0
- package/dist/web/_app/immutable/chunks/BlgjVmFM2.js +14 -0
- package/dist/web/_app/immutable/chunks/BmgXvmIG.js +5 -0
- package/dist/web/_app/immutable/chunks/BpCG9m962.js +1 -0
- package/dist/web/_app/immutable/chunks/BrveeylZ.js +1 -0
- package/dist/web/_app/immutable/chunks/BsW72fyR2.js +1 -0
- package/dist/web/_app/immutable/chunks/Bti_XKwx.js +2692 -0
- package/dist/web/_app/immutable/chunks/BuhW5Fr0.js +689 -0
- package/dist/web/_app/immutable/chunks/Bx74EEyn2.js +1 -0
- package/dist/web/_app/immutable/chunks/BxPN0T61.js +1 -0
- package/dist/web/_app/immutable/chunks/Bxk27YWG.js +1 -0
- package/dist/web/_app/immutable/chunks/Bz9lrgGs.js +1 -0
- package/dist/web/_app/immutable/chunks/BzaxZ6j12.js +1 -0
- package/dist/web/_app/immutable/chunks/C1B4xDs0.js +1 -0
- package/dist/web/_app/immutable/chunks/C1trcC8M.js +7 -0
- package/dist/web/_app/immutable/chunks/C3F_NMTk.js +3 -0
- package/dist/web/_app/immutable/chunks/C4PZmGUQ.js +2 -0
- package/dist/web/_app/immutable/chunks/C6wYiSz8.js +1 -0
- package/dist/web/_app/immutable/chunks/C70saxIl.js +1 -0
- package/dist/web/_app/immutable/chunks/C9tvkk7Y2.js +22 -0
- package/dist/web/_app/immutable/chunks/CE1XZ5DE.js +1 -0
- package/dist/web/_app/immutable/chunks/CEahbtnP.js +1 -0
- package/dist/web/_app/immutable/chunks/CGkd0a-c2.js +2 -0
- package/dist/web/_app/immutable/chunks/CIoNEHQ82.js +184 -0
- package/dist/web/_app/immutable/chunks/CK4z74w5.js +1 -0
- package/dist/web/_app/immutable/chunks/COo3HgCZ.js +1 -0
- package/dist/web/_app/immutable/chunks/CP8_U450.js +1 -0
- package/dist/web/_app/immutable/chunks/CQ1eQ93t2.js +6 -0
- package/dist/web/_app/immutable/chunks/CQyBDccA.js +1 -0
- package/dist/web/_app/immutable/chunks/CUFQMEBn2.js +1 -0
- package/dist/web/_app/immutable/chunks/CV5OSCJc.js +1 -0
- package/dist/web/_app/immutable/chunks/CYEYDNwO2.js +1 -0
- package/dist/web/_app/immutable/chunks/CZgFaimi2.js +83 -0
- package/dist/web/_app/immutable/chunks/CZqvCTCv.js +1 -0
- package/dist/web/_app/immutable/chunks/CcWaWbrI2.js +1 -0
- package/dist/web/_app/immutable/chunks/CdtzRVZK.js +1 -0
- package/dist/web/_app/immutable/chunks/CfYG72Hc.js +1 -0
- package/dist/web/_app/immutable/chunks/Cg-ND0cl.js +1 -0
- package/dist/web/_app/immutable/chunks/Ch1kmm3J2.js +1 -0
- package/dist/web/_app/immutable/chunks/CjiMLTwX2.js +1 -0
- package/dist/web/_app/immutable/chunks/CkoeSJ8K.js +6 -0
- package/dist/web/_app/immutable/chunks/Cp87MaaW.js +1 -0
- package/dist/web/_app/immutable/chunks/Cqm5wAin.js +1 -0
- package/dist/web/_app/immutable/chunks/Ct1uesdW.js +2 -0
- package/dist/web/_app/immutable/chunks/CuYPXpWU.js +1 -0
- package/dist/web/_app/immutable/chunks/Cuq8J2Td.js +1 -0
- package/dist/web/_app/immutable/chunks/CvSEodTA.js +1 -0
- package/dist/web/_app/immutable/chunks/CvqqrTrj.js +1 -0
- package/dist/web/_app/immutable/chunks/CzXdOgVl2.js +7 -0
- package/dist/web/_app/immutable/chunks/D0W7c6Sg.js +185 -0
- package/dist/web/_app/immutable/chunks/D0rBhnqB2.js +1 -0
- package/dist/web/_app/immutable/chunks/D1-GZSN1.js +1 -0
- package/dist/web/_app/immutable/chunks/D1BLcNJ7.js +1 -0
- package/dist/web/_app/immutable/chunks/D1yvtriI.js +1 -0
- package/dist/web/_app/immutable/chunks/D25NMRpl.js +1 -0
- package/dist/web/_app/immutable/chunks/D3F675fu2.js +2 -0
- package/dist/web/_app/immutable/chunks/D4UrtGC1.js +1 -0
- package/dist/web/_app/immutable/chunks/D8wZ2xul.js +4 -0
- package/dist/web/_app/immutable/chunks/DA3HEX3X.js +1 -0
- package/dist/web/_app/immutable/chunks/DE2TCESD2.js +1 -0
- package/dist/web/_app/immutable/chunks/DN-gIRdd2.js +1 -0
- package/dist/web/_app/immutable/chunks/DPUVu0T0.js +1 -0
- package/dist/web/_app/immutable/chunks/DPcejqKZ.js +1 -0
- package/dist/web/_app/immutable/chunks/DQMWa2t7.js +1 -0
- package/dist/web/_app/immutable/chunks/DRPMJ-3M.js +2 -0
- package/dist/web/_app/immutable/chunks/DRPnwQAm.js +1 -0
- package/dist/web/_app/immutable/chunks/DXmfl4Hq2.js +1 -0
- package/dist/web/_app/immutable/chunks/DXsFrDer2.js +1 -0
- package/dist/web/_app/immutable/chunks/DYc5KW3F.js +1 -0
- package/dist/web/_app/immutable/chunks/DcPrzUMJ.js +1 -0
- package/dist/web/_app/immutable/chunks/DdQVGKgM.js +1 -0
- package/dist/web/_app/immutable/chunks/DiFfW--R2.js +2 -0
- package/dist/web/_app/immutable/chunks/DjIqa1_y.js +2 -0
- package/dist/web/_app/immutable/chunks/Dl63IUnH2.js +224 -0
- package/dist/web/_app/immutable/chunks/DmFdD6zT.js +1 -0
- package/dist/web/_app/immutable/chunks/Dn3R8S-U.js +1 -0
- package/dist/web/_app/immutable/chunks/DpNr1GQ2.js +1 -0
- package/dist/web/_app/immutable/chunks/DsFEd8vL2.js +1 -0
- package/dist/web/_app/immutable/chunks/DuxziNnw.js +1 -0
- package/dist/web/_app/immutable/chunks/FuiJnZG0.js +1 -0
- package/dist/web/_app/immutable/chunks/Izkulod7.js +1 -0
- package/dist/web/_app/immutable/chunks/LYL8znYR2.js +23 -0
- package/dist/web/_app/immutable/chunks/ON7Gta0d.js +1 -0
- package/dist/web/_app/immutable/chunks/PhN6tXuJ2.js +1 -0
- package/dist/web/_app/immutable/chunks/PyLyCpuL.js +1 -0
- package/dist/web/_app/immutable/chunks/RG7IUVLn2.js +2 -0
- package/dist/web/_app/immutable/chunks/RK4gCWN0.js +2 -0
- package/dist/web/_app/immutable/chunks/SnzlL4ZV.js +1 -0
- package/dist/web/_app/immutable/chunks/XcWejFm_.js +5 -0
- package/dist/web/_app/immutable/chunks/Xkp5hSA1.js +1 -0
- package/dist/web/_app/immutable/chunks/al_nidE9.js +1 -0
- package/dist/web/_app/immutable/chunks/e50-izZO2.js +1 -0
- package/dist/web/_app/immutable/chunks/golz20La2.js +2 -0
- package/dist/web/_app/immutable/chunks/hG-QCarB.js +1 -0
- package/dist/web/_app/immutable/chunks/kNaey6uv.js +1 -0
- package/dist/web/_app/immutable/chunks/nXReuy-5.js +3 -0
- package/dist/web/_app/immutable/chunks/o61aZZFZ2.js +66 -0
- package/dist/web/_app/immutable/chunks/qwr5boV8.js +1 -0
- package/dist/web/_app/immutable/chunks/rjjyuGhb.js +1 -0
- package/dist/web/_app/immutable/chunks/uBgoVlsx.js +3 -0
- package/dist/web/_app/immutable/chunks/xY0c-UfG.js +3 -0
- package/dist/web/_app/immutable/chunks/xeNvx4Bl2.js +1 -0
- package/dist/web/_app/immutable/chunks/xihTtKlq.js +1 -0
- package/dist/web/_app/immutable/entry/app.dqA31fjy.js +2 -0
- package/dist/web/_app/immutable/entry/start.BB1XrAea.js +1 -0
- package/dist/web/_app/immutable/nodes/0.dALEQAnu.js +2 -0
- package/dist/web/_app/immutable/nodes/1.aFU32Ukj.js +1 -0
- package/dist/web/_app/immutable/nodes/10.C2wB-OnW.js +1 -0
- package/dist/web/_app/immutable/nodes/11.CI3a8Rj5.js +1 -0
- package/dist/web/_app/immutable/nodes/12.CsTvsKzB.js +1 -0
- package/dist/web/_app/immutable/nodes/13.CYrHXCA8.js +1 -0
- package/dist/web/_app/immutable/nodes/14.B31HrQ26.js +1 -0
- package/dist/web/_app/immutable/nodes/15.DxgnZ61h.js +1 -0
- package/dist/web/_app/immutable/nodes/16.DAP8cwVb.js +1 -0
- package/dist/web/_app/immutable/nodes/17.CmwXtCDY.js +77 -0
- package/dist/web/_app/immutable/nodes/2.BuGXEIlN.js +122 -0
- package/dist/web/_app/immutable/nodes/3.CmhZJWHE.js +6 -0
- package/dist/web/_app/immutable/nodes/4.BRfoPTm-.js +11 -0
- package/dist/web/_app/immutable/nodes/5.C7gPuZM_.js +1 -0
- package/dist/web/_app/immutable/nodes/6.qKODVbya.js +6 -0
- package/dist/web/_app/immutable/nodes/7.BZO37zAJ.js +1 -0
- package/dist/web/_app/immutable/nodes/8.xF_Dd1BO.js +1 -0
- package/dist/web/_app/immutable/nodes/9.Bow4UyKV.js +1 -0
- package/dist/web/_app/version.json +1 -1
- package/dist/web/favicon-16.png +0 -0
- package/dist/web/favicon-180.png +0 -0
- package/dist/web/favicon-32.png +0 -0
- package/dist/web/favicon-48.png +0 -0
- package/dist/web/favicon-512.png +0 -0
- package/dist/web/favicon.ico +0 -0
- package/dist/web/favicon.svg +8 -0
- package/dist/web/index.html +56 -21
- package/dist/web/studiograph-logomark.svg +29 -0
- package/package.json +35 -14
- package/dist/agent/skills/enrich-entities.md +0 -136
- package/dist/agent/skills/sync-configuration.md +0 -119
- package/dist/agent/skills/sync-setup.md +0 -82
- package/dist/agent/tools/message-tools.d.ts +0 -42
- package/dist/agent/tools/message-tools.js +0 -106
- package/dist/agent/tools/message-tools.js.map +0 -1
- package/dist/cli/commands/app.d.ts +0 -7
- package/dist/cli/commands/app.js +0 -268
- package/dist/cli/commands/app.js.map +0 -1
- package/dist/cli/commands/clear.d.ts +0 -5
- package/dist/cli/commands/clear.js +0 -36
- package/dist/cli/commands/clear.js.map +0 -1
- package/dist/cli/commands/collection.d.ts +0 -10
- package/dist/cli/commands/collection.js.map +0 -1
- package/dist/cli/commands/join.d.ts +0 -9
- package/dist/cli/commands/join.js +0 -255
- package/dist/cli/commands/join.js.map +0 -1
- package/dist/cli/commands/start.d.ts +0 -7
- package/dist/cli/commands/start.js +0 -584
- package/dist/cli/commands/start.js.map +0 -1
- package/dist/cli/commands/update.d.ts +0 -8
- package/dist/cli/commands/update.js +0 -155
- package/dist/cli/commands/update.js.map +0 -1
- package/dist/cli/commands/user.d.ts +0 -7
- package/dist/cli/commands/user.js +0 -175
- package/dist/cli/commands/user.js.map +0 -1
- package/dist/cli/scaffolding.d.ts +0 -12
- package/dist/cli/scaffolding.js +0 -397
- package/dist/cli/scaffolding.js.map +0 -1
- package/dist/integrations/registry.d.ts +0 -8
- package/dist/integrations/registry.js +0 -7
- package/dist/integrations/registry.js.map +0 -1
- package/dist/integrations/types.d.ts +0 -43
- package/dist/integrations/types.js +0 -5
- package/dist/integrations/types.js.map +0 -1
- package/dist/lib/lib/utils.d.ts +0 -2
- package/dist/lib/lib/utils.js +0 -6
- package/dist/lib/lib/utils.js.map +0 -1
- package/dist/server/chrome/chrome.css +0 -691
- package/dist/server/chrome/chrome.js +0 -374
- package/dist/server/commit-scheduler.d.ts +0 -39
- package/dist/server/commit-scheduler.js +0 -113
- package/dist/server/commit-scheduler.js.map +0 -1
- package/dist/server/plugin-loader.d.ts +0 -53
- package/dist/server/plugin-loader.js +0 -155
- package/dist/server/plugin-loader.js.map +0 -1
- package/dist/server/routes/meeting-ingest-api.d.ts +0 -14
- package/dist/server/routes/meeting-ingest-api.js.map +0 -1
- package/dist/server/routes/messages-api.d.ts +0 -15
- package/dist/server/routes/messages-api.js +0 -385
- package/dist/server/routes/messages-api.js.map +0 -1
- package/dist/services/batch-processor.d.ts +0 -49
- package/dist/services/batch-processor.js +0 -166
- package/dist/services/batch-processor.js.map +0 -1
- package/dist/services/briefing.d.ts +0 -26
- package/dist/services/briefing.js +0 -230
- package/dist/services/briefing.js.map +0 -1
- package/dist/services/heartbeat.d.ts +0 -28
- package/dist/services/heartbeat.js +0 -183
- package/dist/services/heartbeat.js.map +0 -1
- package/dist/services/image-import-service.d.ts +0 -24
- package/dist/services/image-import-service.js +0 -108
- package/dist/services/image-import-service.js.map +0 -1
- package/dist/services/insights.d.ts +0 -38
- package/dist/services/insights.js +0 -269
- package/dist/services/insights.js.map +0 -1
- package/dist/services/meeting-processor.js.map +0 -1
- package/dist/services/message-service.d.ts +0 -68
- package/dist/services/message-service.js +0 -220
- package/dist/services/message-service.js.map +0 -1
- package/dist/utils/workspace-config.d.ts +0 -8
- package/dist/utils/workspace-config.js +0 -22
- package/dist/utils/workspace-config.js.map +0 -1
- package/dist/web/_app/immutable/assets/0.uPSqtsC5.css +0 -1
- package/dist/web/_app/immutable/assets/11.2jzI3cZY.css +0 -1
- package/dist/web/_app/immutable/assets/12.CT4xL4K3.css +0 -1
- package/dist/web/_app/immutable/assets/13.BUrHkYry.css +0 -1
- package/dist/web/_app/immutable/assets/2.DpQWr6q6.css +0 -1
- package/dist/web/_app/immutable/assets/3.BxdqT7zi.css +0 -1
- package/dist/web/_app/immutable/assets/4.DdNqjd0T.css +0 -1
- package/dist/web/_app/immutable/assets/5.DFeGxLYf.css +0 -1
- package/dist/web/_app/immutable/assets/6.DXZr_rI_.css +0 -1
- package/dist/web/_app/immutable/assets/GraphView.D9ePpZez.css +0 -1
- package/dist/web/_app/immutable/assets/Toaster.rN8r_Hzv.css +0 -1
- package/dist/web/_app/immutable/assets/ViewToolbar.BWE03S64.css +0 -1
- package/dist/web/_app/immutable/assets/WorkspaceView.CgGDi_Zb.css +0 -1
- package/dist/web/_app/immutable/assets/wikilinks.CzMBkUMB.css +0 -1
- package/dist/web/_app/immutable/chunks/-jG4Obyh.js +0 -4
- package/dist/web/_app/immutable/chunks/2nrc8f_O.js +0 -1
- package/dist/web/_app/immutable/chunks/7S2LGqoP.js +0 -2
- package/dist/web/_app/immutable/chunks/8Q3ZJIYu.js +0 -1
- package/dist/web/_app/immutable/chunks/B8ydT5xX.js +0 -2
- package/dist/web/_app/immutable/chunks/BB_5th5W.js +0 -3383
- package/dist/web/_app/immutable/chunks/BEn6N5c2.js +0 -1
- package/dist/web/_app/immutable/chunks/BFNNbCAM.js +0 -1
- package/dist/web/_app/immutable/chunks/BFZZEUd5.js +0 -1
- package/dist/web/_app/immutable/chunks/BGk8kfOE.js +0 -2
- package/dist/web/_app/immutable/chunks/BIBCr278.js +0 -1
- package/dist/web/_app/immutable/chunks/BPCkkwqe.js +0 -1
- package/dist/web/_app/immutable/chunks/BhlvzGQx.js +0 -1
- package/dist/web/_app/immutable/chunks/BlMknQeF.js +0 -1
- package/dist/web/_app/immutable/chunks/BpjqrlCg.js +0 -1
- package/dist/web/_app/immutable/chunks/BrebtJNG.js +0 -18
- package/dist/web/_app/immutable/chunks/ByBZ7JIT.js +0 -1
- package/dist/web/_app/immutable/chunks/Bz0ZjVQE.js +0 -2
- package/dist/web/_app/immutable/chunks/BzJTZOK2.js +0 -1
- package/dist/web/_app/immutable/chunks/C0LVZhvn.js +0 -1
- package/dist/web/_app/immutable/chunks/C3uBrOS5.js +0 -1
- package/dist/web/_app/immutable/chunks/C8R1sDpW.js +0 -1
- package/dist/web/_app/immutable/chunks/CDRHrs0g.js +0 -1
- package/dist/web/_app/immutable/chunks/CN5_py1I.js +0 -1
- package/dist/web/_app/immutable/chunks/CPne482a.js +0 -1
- package/dist/web/_app/immutable/chunks/CSVbGg_b.js +0 -5
- package/dist/web/_app/immutable/chunks/CWyU-seV.js +0 -1
- package/dist/web/_app/immutable/chunks/CX_61fY8.js +0 -5
- package/dist/web/_app/immutable/chunks/CYrVHOHA.js +0 -1
- package/dist/web/_app/immutable/chunks/ChsiIm-E.js +0 -1
- package/dist/web/_app/immutable/chunks/CojKppbh.js +0 -1
- package/dist/web/_app/immutable/chunks/CqkleIqs.js +0 -1
- package/dist/web/_app/immutable/chunks/CtYLtD7K.js +0 -1
- package/dist/web/_app/immutable/chunks/D-HDy5qS.js +0 -1
- package/dist/web/_app/immutable/chunks/D5aIYSkd.js +0 -1
- package/dist/web/_app/immutable/chunks/DBBXARVf.js +0 -1
- package/dist/web/_app/immutable/chunks/DFYOFE3o.js +0 -1
- package/dist/web/_app/immutable/chunks/DKaafS50.js +0 -1
- package/dist/web/_app/immutable/chunks/DUMOo1Pn.js +0 -1
- package/dist/web/_app/immutable/chunks/DWX9f6AF.js +0 -1
- package/dist/web/_app/immutable/chunks/DY8-EONP.js +0 -1
- package/dist/web/_app/immutable/chunks/DkoHPElM.js +0 -1
- package/dist/web/_app/immutable/chunks/DnL9f0lc.js +0 -7
- package/dist/web/_app/immutable/chunks/DsnmJJEf.js +0 -1
- package/dist/web/_app/immutable/chunks/DujahU3W.js +0 -1
- package/dist/web/_app/immutable/chunks/FBn-ES5k.js +0 -1
- package/dist/web/_app/immutable/chunks/HQpwSOb3.js +0 -1
- package/dist/web/_app/immutable/chunks/KyjzlWRN.js +0 -2
- package/dist/web/_app/immutable/chunks/PPVm8Dsz.js +0 -1
- package/dist/web/_app/immutable/chunks/UwYfmrPx.js +0 -2
- package/dist/web/_app/immutable/chunks/W25ZVI8L.js +0 -2
- package/dist/web/_app/immutable/chunks/WSUKABI_.js +0 -1
- package/dist/web/_app/immutable/chunks/XjsuEnNE.js +0 -5
- package/dist/web/_app/immutable/chunks/ZD6ARAtb.js +0 -1
- package/dist/web/_app/immutable/chunks/pBTf4stg.js +0 -2
- package/dist/web/_app/immutable/chunks/rGIarcnp.js +0 -1
- package/dist/web/_app/immutable/chunks/vxEtkL8z.js +0 -1
- package/dist/web/_app/immutable/chunks/wDIGUaoU.js +0 -3
- package/dist/web/_app/immutable/entry/app.ZHiTM8WS.js +0 -2
- package/dist/web/_app/immutable/entry/start.C9-FfAVc.js +0 -1
- package/dist/web/_app/immutable/nodes/0.D92Orz8k.js +0 -2
- package/dist/web/_app/immutable/nodes/1.BMdyglM_.js +0 -1
- package/dist/web/_app/immutable/nodes/10.BilVDHSL.js +0 -1
- package/dist/web/_app/immutable/nodes/11.CS9E0Hic.js +0 -1
- package/dist/web/_app/immutable/nodes/12.D3BOxYzG.js +0 -1
- package/dist/web/_app/immutable/nodes/13.CClMKYtN.js +0 -1
- package/dist/web/_app/immutable/nodes/2.C8KKElPL.js +0 -267
- package/dist/web/_app/immutable/nodes/3.C5n5uiWU.js +0 -5
- package/dist/web/_app/immutable/nodes/4.DcGVvgiL.js +0 -11
- package/dist/web/_app/immutable/nodes/5.DxIjnFQO.js +0 -4
- package/dist/web/_app/immutable/nodes/6.lkh6kKLj.js +0 -1
- package/dist/web/_app/immutable/nodes/7.Bg7SbfhA.js +0 -1
- package/dist/web/_app/immutable/nodes/8.DcXWCNBE.js +0 -1
- package/dist/web/_app/immutable/nodes/9.Cefi8Jfm.js +0 -1
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SqliteEncryptedStore — concrete SecretStore + SettingsStore on
|
|
3
|
+
* better-sqlite3.
|
|
4
|
+
*
|
|
5
|
+
* Lives at /workspace/secrets.db on Railway, ~/.studiograph/secrets.db
|
|
6
|
+
* locally. File mode 0600 enforced after open. The audit table lives in
|
|
7
|
+
* the same DB so cross-table operations stay atomic.
|
|
8
|
+
*
|
|
9
|
+
* After the scope-collapse refactor, the schema has no `scope` /
|
|
10
|
+
* `scope_id` columns — Studiograph is single-workspace-per-process, so
|
|
11
|
+
* each key has at most one row. Existing populated databases (with the
|
|
12
|
+
* old `(scope, scope_id, key)` shape) are migrated transparently on
|
|
13
|
+
* first construction via `migrateScopeCollapse()`.
|
|
14
|
+
*
|
|
15
|
+
* AAD binding for encrypted rows keeps the four-tuple `AADInput` shape so
|
|
16
|
+
* the shared encryption module continues to serve auth.db (which uses
|
|
17
|
+
* different `scope: 'user'` AAD per user). Inside this store every row
|
|
18
|
+
* binds AAD with the constant `scope: 'workspace'`, `scopeId: ''` —
|
|
19
|
+
* cosmetic-only after the migration since each row is also uniquely
|
|
20
|
+
* keyed by `(key)`.
|
|
21
|
+
*/
|
|
22
|
+
import type { ActorContext, SecretMetadata, SecretStore, SetSecretInput } from './SecretStore.js';
|
|
23
|
+
import type { SettingMetadata, SettingsStore, SetSettingInput } from './SettingsStore.js';
|
|
24
|
+
import { AuditLogger } from './audit.js';
|
|
25
|
+
export interface SqliteEncryptedStoreOptions {
|
|
26
|
+
dbPath: string;
|
|
27
|
+
masterKey: Uint8Array;
|
|
28
|
+
/** Defaults to 'mk_v1'. Bumped by master-key rotation. */
|
|
29
|
+
keyVersion?: string;
|
|
30
|
+
/** Optional secondary key for transition reads after a rotation. */
|
|
31
|
+
previousMasterKey?: Uint8Array;
|
|
32
|
+
previousKeyVersion?: string;
|
|
33
|
+
}
|
|
34
|
+
export declare class SqliteEncryptedStore implements SecretStore, SettingsStore {
|
|
35
|
+
private readonly db;
|
|
36
|
+
private readonly masterKey;
|
|
37
|
+
private readonly keyVersion;
|
|
38
|
+
private readonly previousMasterKey?;
|
|
39
|
+
private readonly previousKeyVersion?;
|
|
40
|
+
readonly audit: AuditLogger;
|
|
41
|
+
constructor(opts: SqliteEncryptedStoreOptions);
|
|
42
|
+
private initSchema;
|
|
43
|
+
/**
|
|
44
|
+
* One-shot migration: collapse the legacy `(scope, scope_id, key)` tables
|
|
45
|
+
* into the single-tier shape. Steps:
|
|
46
|
+
*
|
|
47
|
+
* 1. Detect legacy shape by querying `PRAGMA table_info` for the
|
|
48
|
+
* `scope` column on settings or secrets.
|
|
49
|
+
* 2. Back up secrets.db → secrets.db.backup.<ts> with mode 0o600.
|
|
50
|
+
* 3. For each legacy row in `secrets`, decrypt with its original AAD
|
|
51
|
+
* (4-tuple including the row's scope+scope_id), re-encrypt under
|
|
52
|
+
* the new constant AAD, INSERT into the new table. Drop the old.
|
|
53
|
+
* 4. For `settings`, INSERT...SELECT keeping just `key`/`value_json`/
|
|
54
|
+
* timestamps. Duplicate keys across scopes would collide; assert
|
|
55
|
+
* none before commit.
|
|
56
|
+
* 5. For `audit_log`, ALTER TABLE DROP COLUMN scope/scope_id. SQLite
|
|
57
|
+
* 3.35+ supports this directly; PK is auto-increment so no rebuild.
|
|
58
|
+
* 6. Mark `meta.scope_collapse_migrated_at`. Re-running is a no-op.
|
|
59
|
+
*
|
|
60
|
+
* Failure modes: per-row decrypt failures during step 3 are logged as
|
|
61
|
+
* decrypt_fail audit rows and the row is skipped. The transaction
|
|
62
|
+
* still commits — the alternative is refusing to start when one
|
|
63
|
+
* historical row got out of sync, which is worse than dropping a key
|
|
64
|
+
* that already couldn't decrypt.
|
|
65
|
+
*/
|
|
66
|
+
private migrateScopeCollapse;
|
|
67
|
+
private actorString;
|
|
68
|
+
set(input: SetSettingInput | SetSecretInput, actor: ActorContext): Promise<any>;
|
|
69
|
+
private setSetting;
|
|
70
|
+
get<T = unknown>(key: string): T | undefined;
|
|
71
|
+
list(): SettingMetadata[];
|
|
72
|
+
delete(key: string, actor: ActorContext): Promise<boolean>;
|
|
73
|
+
private setSecret;
|
|
74
|
+
describe(key: string): SecretMetadata | undefined;
|
|
75
|
+
listSecrets(actor?: ActorContext): SecretMetadata[];
|
|
76
|
+
unsafeGetForResolver(key: string): string | undefined;
|
|
77
|
+
/**
|
|
78
|
+
* Read a value from the `meta` key/value table — used by one-shot
|
|
79
|
+
* migrations to mark completion (e.g., scope-collapse, R2 structural
|
|
80
|
+
* import). Returns undefined when the row is absent. Not audited:
|
|
81
|
+
* meta rows are operational state, not configuration.
|
|
82
|
+
*/
|
|
83
|
+
getMeta(key: string): string | undefined;
|
|
84
|
+
/**
|
|
85
|
+
* Write a value to the `meta` key/value table. Upserts. Paired with
|
|
86
|
+
* `getMeta` for migration completion markers.
|
|
87
|
+
*/
|
|
88
|
+
setMeta(key: string, value: string): void;
|
|
89
|
+
close(): void;
|
|
90
|
+
}
|
|
@@ -0,0 +1,598 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SqliteEncryptedStore — concrete SecretStore + SettingsStore on
|
|
3
|
+
* better-sqlite3.
|
|
4
|
+
*
|
|
5
|
+
* Lives at /workspace/secrets.db on Railway, ~/.studiograph/secrets.db
|
|
6
|
+
* locally. File mode 0600 enforced after open. The audit table lives in
|
|
7
|
+
* the same DB so cross-table operations stay atomic.
|
|
8
|
+
*
|
|
9
|
+
* After the scope-collapse refactor, the schema has no `scope` /
|
|
10
|
+
* `scope_id` columns — Studiograph is single-workspace-per-process, so
|
|
11
|
+
* each key has at most one row. Existing populated databases (with the
|
|
12
|
+
* old `(scope, scope_id, key)` shape) are migrated transparently on
|
|
13
|
+
* first construction via `migrateScopeCollapse()`.
|
|
14
|
+
*
|
|
15
|
+
* AAD binding for encrypted rows keeps the four-tuple `AADInput` shape so
|
|
16
|
+
* the shared encryption module continues to serve auth.db (which uses
|
|
17
|
+
* different `scope: 'user'` AAD per user). Inside this store every row
|
|
18
|
+
* binds AAD with the constant `scope: 'workspace'`, `scopeId: ''` —
|
|
19
|
+
* cosmetic-only after the migration since each row is also uniquely
|
|
20
|
+
* keyed by `(key)`.
|
|
21
|
+
*/
|
|
22
|
+
import Database from 'better-sqlite3';
|
|
23
|
+
import { chmodSync, closeSync, copyFileSync, openSync } from 'fs';
|
|
24
|
+
import { encrypt, decrypt } from './encryption.js';
|
|
25
|
+
import { getKeyDef } from './registry.js';
|
|
26
|
+
import { AuditLogger } from './audit.js';
|
|
27
|
+
const SCHEMA_VERSION = '2';
|
|
28
|
+
const DEFAULT_KEY_VERSION = 'mk_v1';
|
|
29
|
+
/**
|
|
30
|
+
* Constant AAD components written for every row in this store. Kept as a
|
|
31
|
+
* literal so the AADInput type doesn't need a different shape from
|
|
32
|
+
* auth-db-migration's `'user'`-scoped calls.
|
|
33
|
+
*/
|
|
34
|
+
const STORE_AAD_SCOPE = 'workspace';
|
|
35
|
+
const STORE_AAD_SCOPE_ID = '';
|
|
36
|
+
export class SqliteEncryptedStore {
|
|
37
|
+
db;
|
|
38
|
+
masterKey;
|
|
39
|
+
keyVersion;
|
|
40
|
+
previousMasterKey;
|
|
41
|
+
previousKeyVersion;
|
|
42
|
+
audit;
|
|
43
|
+
constructor(opts) {
|
|
44
|
+
// L1: pre-create the DB file with restrictive mode BEFORE handing the
|
|
45
|
+
// path to better-sqlite3. The previous flow was
|
|
46
|
+
// new Database(opts.dbPath) // creates with default umask (0644)
|
|
47
|
+
// chmodSync(opts.dbPath, 0o600) // tightens after the fact
|
|
48
|
+
// which left a window in which a co-located process could open the
|
|
49
|
+
// file with relaxed permissions. `openSync(..., 'wx', 0o600)` is the
|
|
50
|
+
// primary protection — fails if the file already exists, in which
|
|
51
|
+
// case we leave it alone (it already exists from a previous start;
|
|
52
|
+
// the chmod below is defense-in-depth in case its mode drifted).
|
|
53
|
+
if (process.platform !== 'win32') {
|
|
54
|
+
try {
|
|
55
|
+
const fd = openSync(opts.dbPath, 'wx', 0o600);
|
|
56
|
+
closeSync(fd);
|
|
57
|
+
}
|
|
58
|
+
catch (err) {
|
|
59
|
+
// ENOENT (parent dir missing) is a real error; rethrow.
|
|
60
|
+
// EEXIST means the file is already there — fall through to the
|
|
61
|
+
// defense-in-depth chmod below.
|
|
62
|
+
if (err.code !== 'EEXIST')
|
|
63
|
+
throw err;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
this.db = new Database(opts.dbPath);
|
|
67
|
+
if (process.platform !== 'win32') {
|
|
68
|
+
try {
|
|
69
|
+
chmodSync(opts.dbPath, 0o600);
|
|
70
|
+
}
|
|
71
|
+
catch { /* non-fatal */ }
|
|
72
|
+
}
|
|
73
|
+
this.db.pragma('journal_mode = WAL');
|
|
74
|
+
this.db.pragma('foreign_keys = ON');
|
|
75
|
+
this.masterKey = opts.masterKey;
|
|
76
|
+
this.keyVersion = opts.keyVersion ?? DEFAULT_KEY_VERSION;
|
|
77
|
+
this.previousMasterKey = opts.previousMasterKey;
|
|
78
|
+
this.previousKeyVersion = opts.previousKeyVersion;
|
|
79
|
+
this.initSchema();
|
|
80
|
+
this.audit = new AuditLogger(this.db);
|
|
81
|
+
// One-shot migration: collapse legacy (scope, scope_id, key)-keyed
|
|
82
|
+
// tables into the single-tier shape. Idempotent — re-running after
|
|
83
|
+
// success is a no-op via meta.scope_collapse_migrated_at.
|
|
84
|
+
this.migrateScopeCollapse(opts.dbPath);
|
|
85
|
+
}
|
|
86
|
+
initSchema() {
|
|
87
|
+
this.db.exec(`
|
|
88
|
+
CREATE TABLE IF NOT EXISTS settings (
|
|
89
|
+
key TEXT NOT NULL PRIMARY KEY,
|
|
90
|
+
value_json TEXT NOT NULL,
|
|
91
|
+
updated_at INTEGER NOT NULL,
|
|
92
|
+
updated_by TEXT NOT NULL
|
|
93
|
+
);
|
|
94
|
+
|
|
95
|
+
CREATE TABLE IF NOT EXISTS secrets (
|
|
96
|
+
key TEXT NOT NULL PRIMARY KEY,
|
|
97
|
+
ciphertext TEXT NOT NULL,
|
|
98
|
+
key_version TEXT NOT NULL,
|
|
99
|
+
label TEXT,
|
|
100
|
+
provider TEXT,
|
|
101
|
+
last_tested_at INTEGER,
|
|
102
|
+
last_test_result TEXT,
|
|
103
|
+
updated_at INTEGER NOT NULL,
|
|
104
|
+
updated_by TEXT NOT NULL
|
|
105
|
+
);
|
|
106
|
+
|
|
107
|
+
CREATE TABLE IF NOT EXISTS meta (
|
|
108
|
+
key TEXT PRIMARY KEY,
|
|
109
|
+
value TEXT NOT NULL
|
|
110
|
+
);
|
|
111
|
+
`);
|
|
112
|
+
// Defensive cleanup of the legacy `last_rotated_at` column. The rotate
|
|
113
|
+
// feature was removed; existing DBs created before the removal still
|
|
114
|
+
// carry the column even though no code references it. SQLite 3.35+
|
|
115
|
+
// supports ALTER TABLE DROP COLUMN; the try/catch handles fresh DBs
|
|
116
|
+
// (column never existed) and any future re-runs.
|
|
117
|
+
try {
|
|
118
|
+
this.db.exec('ALTER TABLE secrets DROP COLUMN last_rotated_at');
|
|
119
|
+
}
|
|
120
|
+
catch { /* already absent */ }
|
|
121
|
+
// Schema version metadata. Idempotent insert.
|
|
122
|
+
this.db.prepare('INSERT OR IGNORE INTO meta (key, value) VALUES (?, ?)').run('schema_version', SCHEMA_VERSION);
|
|
123
|
+
this.db.prepare('INSERT OR IGNORE INTO meta (key, value) VALUES (?, ?)').run('master_key_version', this.keyVersion);
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* One-shot migration: collapse the legacy `(scope, scope_id, key)` tables
|
|
127
|
+
* into the single-tier shape. Steps:
|
|
128
|
+
*
|
|
129
|
+
* 1. Detect legacy shape by querying `PRAGMA table_info` for the
|
|
130
|
+
* `scope` column on settings or secrets.
|
|
131
|
+
* 2. Back up secrets.db → secrets.db.backup.<ts> with mode 0o600.
|
|
132
|
+
* 3. For each legacy row in `secrets`, decrypt with its original AAD
|
|
133
|
+
* (4-tuple including the row's scope+scope_id), re-encrypt under
|
|
134
|
+
* the new constant AAD, INSERT into the new table. Drop the old.
|
|
135
|
+
* 4. For `settings`, INSERT...SELECT keeping just `key`/`value_json`/
|
|
136
|
+
* timestamps. Duplicate keys across scopes would collide; assert
|
|
137
|
+
* none before commit.
|
|
138
|
+
* 5. For `audit_log`, ALTER TABLE DROP COLUMN scope/scope_id. SQLite
|
|
139
|
+
* 3.35+ supports this directly; PK is auto-increment so no rebuild.
|
|
140
|
+
* 6. Mark `meta.scope_collapse_migrated_at`. Re-running is a no-op.
|
|
141
|
+
*
|
|
142
|
+
* Failure modes: per-row decrypt failures during step 3 are logged as
|
|
143
|
+
* decrypt_fail audit rows and the row is skipped. The transaction
|
|
144
|
+
* still commits — the alternative is refusing to start when one
|
|
145
|
+
* historical row got out of sync, which is worse than dropping a key
|
|
146
|
+
* that already couldn't decrypt.
|
|
147
|
+
*/
|
|
148
|
+
migrateScopeCollapse(dbPath) {
|
|
149
|
+
const already = this.db
|
|
150
|
+
.prepare("SELECT value FROM meta WHERE key='scope_collapse_migrated_at'")
|
|
151
|
+
.get();
|
|
152
|
+
if (already?.value)
|
|
153
|
+
return;
|
|
154
|
+
// Detect legacy shape — old table has a `scope` column.
|
|
155
|
+
const settingsCols = this.db.prepare('PRAGMA table_info(settings)').all();
|
|
156
|
+
const secretsCols = this.db.prepare('PRAGMA table_info(secrets)').all();
|
|
157
|
+
const auditCols = this.db.prepare('PRAGMA table_info(audit_log)').all();
|
|
158
|
+
const settingsLegacy = settingsCols.some((c) => c.name === 'scope');
|
|
159
|
+
const secretsLegacy = secretsCols.some((c) => c.name === 'scope');
|
|
160
|
+
const auditLegacy = auditCols.some((c) => c.name === 'scope') || auditCols.some((c) => c.name === 'scope_id');
|
|
161
|
+
if (!settingsLegacy && !secretsLegacy && !auditLegacy) {
|
|
162
|
+
// Fresh DB created with the post-collapse schema — nothing to do.
|
|
163
|
+
this.db.prepare("INSERT OR REPLACE INTO meta (key, value) VALUES ('scope_collapse_migrated_at', ?)").run(String(Date.now()));
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
// Backup before destructive rebuild. We deliberately do this OUTSIDE
|
|
167
|
+
// any transaction — copy-on-write semantics on Node's copyFileSync
|
|
168
|
+
// give us a snapshot of the on-disk pages.
|
|
169
|
+
//
|
|
170
|
+
// Checkpoint the WAL into the .db BEFORE the copy so the backup is a
|
|
171
|
+
// complete restorable snapshot. Without this, rows still in the .wal
|
|
172
|
+
// sidecar would be missing from the backup (the .wal is intentionally
|
|
173
|
+
// NOT copied alongside — its existence with a stale .db would confuse
|
|
174
|
+
// a restore). Operators restore by copying the backup over the live
|
|
175
|
+
// file with the server shut down.
|
|
176
|
+
try {
|
|
177
|
+
this.db.pragma('wal_checkpoint(FULL)');
|
|
178
|
+
}
|
|
179
|
+
catch { /* non-fatal — best-effort flush */ }
|
|
180
|
+
const backupPath = `${dbPath}.backup.${Date.now()}`;
|
|
181
|
+
try {
|
|
182
|
+
copyFileSync(dbPath, backupPath);
|
|
183
|
+
if (process.platform !== 'win32') {
|
|
184
|
+
try {
|
|
185
|
+
chmodSync(backupPath, 0o600);
|
|
186
|
+
}
|
|
187
|
+
catch { /* non-fatal */ }
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
catch (err) {
|
|
191
|
+
// If we can't take a backup, refuse to migrate — the operator
|
|
192
|
+
// gets a clear error instead of a clobbered DB. The flag stays
|
|
193
|
+
// unset so the next boot retries.
|
|
194
|
+
throw new Error(`[secrets] scope-collapse migration: failed to take backup at ${backupPath}: ${err instanceof Error ? err.message : String(err)}`);
|
|
195
|
+
}
|
|
196
|
+
// Read legacy rows BEFORE rebuilding so we can re-encrypt secrets.
|
|
197
|
+
// The legacy `last_rotated_at` column (if present) is read but
|
|
198
|
+
// discarded — the rotate feature was removed.
|
|
199
|
+
const legacySecrets = secretsLegacy
|
|
200
|
+
? this.db.prepare('SELECT * FROM secrets').all()
|
|
201
|
+
: [];
|
|
202
|
+
const legacySettings = settingsLegacy
|
|
203
|
+
? this.db.prepare('SELECT * FROM settings').all()
|
|
204
|
+
: [];
|
|
205
|
+
// Pre-flight: assert no duplicate keys across scopes (would collide
|
|
206
|
+
// on the new PK). All known data lived at scope='instance'|'workspace'
|
|
207
|
+
// with scopeId='', so the same key in both scopes should be
|
|
208
|
+
// vanishingly rare — but assert to fail loud rather than silently
|
|
209
|
+
// drop one row.
|
|
210
|
+
const dupeSecrets = new Set();
|
|
211
|
+
const seenSecrets = new Set();
|
|
212
|
+
for (const r of legacySecrets) {
|
|
213
|
+
if (seenSecrets.has(r.key))
|
|
214
|
+
dupeSecrets.add(r.key);
|
|
215
|
+
seenSecrets.add(r.key);
|
|
216
|
+
}
|
|
217
|
+
const dupeSettings = new Set();
|
|
218
|
+
const seenSettings = new Set();
|
|
219
|
+
for (const r of legacySettings) {
|
|
220
|
+
if (seenSettings.has(r.key))
|
|
221
|
+
dupeSettings.add(r.key);
|
|
222
|
+
seenSettings.add(r.key);
|
|
223
|
+
}
|
|
224
|
+
if (dupeSecrets.size > 0 || dupeSettings.size > 0) {
|
|
225
|
+
throw new Error(`[secrets] scope-collapse migration: duplicate keys across scopes detected (secrets: [${[...dupeSecrets].join(', ')}], settings: [${[...dupeSettings].join(', ')}]). Backup at ${backupPath}. Resolve by manual SQL before retrying.`);
|
|
226
|
+
}
|
|
227
|
+
// Decrypt every legacy secret under its original AAD up front. If
|
|
228
|
+
// any fails, log decrypt_fail and drop — but keep going. After all
|
|
229
|
+
// rows are decrypted (or dropped), rebuild the tables in one
|
|
230
|
+
// transaction.
|
|
231
|
+
const reencrypted = [];
|
|
232
|
+
for (const r of legacySecrets) {
|
|
233
|
+
const oldCtx = {
|
|
234
|
+
scope: r.scope,
|
|
235
|
+
scopeId: r.scope_id,
|
|
236
|
+
key: r.key,
|
|
237
|
+
keyVersion: r.key_version,
|
|
238
|
+
};
|
|
239
|
+
const encRow = { ciphertext: r.ciphertext, keyVersion: r.key_version };
|
|
240
|
+
let plaintext;
|
|
241
|
+
try {
|
|
242
|
+
if (r.key_version === this.keyVersion) {
|
|
243
|
+
plaintext = decrypt(this.masterKey, encRow, oldCtx);
|
|
244
|
+
}
|
|
245
|
+
else if (this.previousMasterKey && r.key_version === this.previousKeyVersion) {
|
|
246
|
+
plaintext = decrypt(this.previousMasterKey, encRow, oldCtx);
|
|
247
|
+
}
|
|
248
|
+
else {
|
|
249
|
+
plaintext = decrypt(this.masterKey, encRow, oldCtx);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
catch (err) {
|
|
253
|
+
// Log + skip — the row was already undecryptable before the
|
|
254
|
+
// migration, and we shouldn't fail the whole boot for one bad
|
|
255
|
+
// row. The audit logger uses the legacy 4-arg signature (scope
|
|
256
|
+
// + scope_id columns exist on audit_log right now).
|
|
257
|
+
this.audit.write({
|
|
258
|
+
action: 'decrypt_fail',
|
|
259
|
+
actor: { type: 'system', systemId: 'scope-collapse-migration' },
|
|
260
|
+
scope: r.scope,
|
|
261
|
+
scope_id: r.scope_id,
|
|
262
|
+
key: r.key,
|
|
263
|
+
success: false,
|
|
264
|
+
detail: { keyVersion: r.key_version, error: err instanceof Error ? err.message : String(err) },
|
|
265
|
+
});
|
|
266
|
+
continue;
|
|
267
|
+
}
|
|
268
|
+
// Re-encrypt under the new constant AAD.
|
|
269
|
+
const newCtx = {
|
|
270
|
+
scope: STORE_AAD_SCOPE,
|
|
271
|
+
scopeId: STORE_AAD_SCOPE_ID,
|
|
272
|
+
key: r.key,
|
|
273
|
+
keyVersion: this.keyVersion,
|
|
274
|
+
};
|
|
275
|
+
const fresh = encrypt(this.masterKey, plaintext, newCtx);
|
|
276
|
+
reencrypted.push({ key: r.key, ciphertext: fresh.ciphertext, key_version: fresh.keyVersion, row: r });
|
|
277
|
+
}
|
|
278
|
+
const tx = this.db.transaction(() => {
|
|
279
|
+
if (secretsLegacy) {
|
|
280
|
+
this.db.exec('DROP TABLE secrets');
|
|
281
|
+
this.db.exec(`
|
|
282
|
+
CREATE TABLE secrets (
|
|
283
|
+
key TEXT NOT NULL PRIMARY KEY,
|
|
284
|
+
ciphertext TEXT NOT NULL,
|
|
285
|
+
key_version TEXT NOT NULL,
|
|
286
|
+
label TEXT,
|
|
287
|
+
provider TEXT,
|
|
288
|
+
last_tested_at INTEGER,
|
|
289
|
+
last_test_result TEXT,
|
|
290
|
+
updated_at INTEGER NOT NULL,
|
|
291
|
+
updated_by TEXT NOT NULL
|
|
292
|
+
);
|
|
293
|
+
`);
|
|
294
|
+
const insert = this.db.prepare(`
|
|
295
|
+
INSERT INTO secrets (key, ciphertext, key_version, label, provider, last_tested_at, last_test_result, updated_at, updated_by)
|
|
296
|
+
VALUES (@key, @ciphertext, @key_version, @label, @provider, @last_tested_at, @last_test_result, @updated_at, @updated_by)
|
|
297
|
+
`);
|
|
298
|
+
for (const r of reencrypted) {
|
|
299
|
+
insert.run({
|
|
300
|
+
key: r.key,
|
|
301
|
+
ciphertext: r.ciphertext,
|
|
302
|
+
key_version: r.key_version,
|
|
303
|
+
label: r.row.label,
|
|
304
|
+
provider: r.row.provider,
|
|
305
|
+
last_tested_at: r.row.last_tested_at,
|
|
306
|
+
last_test_result: r.row.last_test_result,
|
|
307
|
+
updated_at: r.row.updated_at,
|
|
308
|
+
updated_by: r.row.updated_by,
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
if (settingsLegacy) {
|
|
313
|
+
this.db.exec('DROP TABLE settings');
|
|
314
|
+
this.db.exec(`
|
|
315
|
+
CREATE TABLE settings (
|
|
316
|
+
key TEXT NOT NULL PRIMARY KEY,
|
|
317
|
+
value_json TEXT NOT NULL,
|
|
318
|
+
updated_at INTEGER NOT NULL,
|
|
319
|
+
updated_by TEXT NOT NULL
|
|
320
|
+
);
|
|
321
|
+
`);
|
|
322
|
+
const insertS = this.db.prepare(`
|
|
323
|
+
INSERT INTO settings (key, value_json, updated_at, updated_by)
|
|
324
|
+
VALUES (@key, @value_json, @updated_at, @updated_by)
|
|
325
|
+
`);
|
|
326
|
+
for (const r of legacySettings) {
|
|
327
|
+
insertS.run({
|
|
328
|
+
key: r.key,
|
|
329
|
+
value_json: r.value_json,
|
|
330
|
+
updated_at: r.updated_at,
|
|
331
|
+
updated_by: r.updated_by,
|
|
332
|
+
});
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
if (auditLegacy) {
|
|
336
|
+
// SQLite 3.35+ supports ALTER TABLE DROP COLUMN. The PK is
|
|
337
|
+
// auto-increment id, so no rebuild needed for audit_log — we
|
|
338
|
+
// can drop the now-redundant scope / scope_id columns in place.
|
|
339
|
+
try {
|
|
340
|
+
this.db.exec('ALTER TABLE audit_log DROP COLUMN scope');
|
|
341
|
+
}
|
|
342
|
+
catch { /* may not exist */ }
|
|
343
|
+
try {
|
|
344
|
+
this.db.exec('ALTER TABLE audit_log DROP COLUMN scope_id');
|
|
345
|
+
}
|
|
346
|
+
catch { /* may not exist */ }
|
|
347
|
+
}
|
|
348
|
+
this.db.prepare("INSERT OR REPLACE INTO meta (key, value) VALUES ('scope_collapse_migrated_at', ?)").run(String(Date.now()));
|
|
349
|
+
this.db.prepare("INSERT OR REPLACE INTO meta (key, value) VALUES ('schema_version', ?)").run(SCHEMA_VERSION);
|
|
350
|
+
});
|
|
351
|
+
tx();
|
|
352
|
+
}
|
|
353
|
+
actorString(actor) {
|
|
354
|
+
if (actor.type === 'user')
|
|
355
|
+
return `user:${actor.userId ?? 'unknown'}`;
|
|
356
|
+
return `system:${actor.systemId ?? 'unknown'}`;
|
|
357
|
+
}
|
|
358
|
+
// ── SettingsStore impl ─────────────────────────────────────────────────
|
|
359
|
+
async set(input, actor) {
|
|
360
|
+
// Discriminate by whether the registry classifies the key as a secret.
|
|
361
|
+
const def = getKeyDef(input.key);
|
|
362
|
+
const isSecret = !!def && def.classification === 'workspace-secret';
|
|
363
|
+
if (isSecret)
|
|
364
|
+
return this.setSecret(input, actor);
|
|
365
|
+
return this.setSetting(input, actor);
|
|
366
|
+
}
|
|
367
|
+
async setSetting(input, actor) {
|
|
368
|
+
const updatedAt = Date.now();
|
|
369
|
+
const updatedBy = this.actorString(actor);
|
|
370
|
+
const valueJson = JSON.stringify(input.value);
|
|
371
|
+
// M1: settings write + audit insert run inside one transaction so a
|
|
372
|
+
// disk-full / table-locked / write-failure on either step rolls the
|
|
373
|
+
// whole pair back. Otherwise we'd persist mutations without their
|
|
374
|
+
// audit row, breaking the "every write is logged" property.
|
|
375
|
+
const tx = this.db.transaction(() => {
|
|
376
|
+
this.db.prepare(`
|
|
377
|
+
INSERT INTO settings (key, value_json, updated_at, updated_by)
|
|
378
|
+
VALUES (@key, @value_json, @updated_at, @updated_by)
|
|
379
|
+
ON CONFLICT(key) DO UPDATE SET
|
|
380
|
+
value_json = excluded.value_json,
|
|
381
|
+
updated_at = excluded.updated_at,
|
|
382
|
+
updated_by = excluded.updated_by
|
|
383
|
+
`).run({
|
|
384
|
+
key: input.key,
|
|
385
|
+
value_json: valueJson,
|
|
386
|
+
updated_at: updatedAt,
|
|
387
|
+
updated_by: updatedBy,
|
|
388
|
+
});
|
|
389
|
+
this.audit.write({
|
|
390
|
+
action: 'set',
|
|
391
|
+
actor,
|
|
392
|
+
key: input.key,
|
|
393
|
+
success: true,
|
|
394
|
+
});
|
|
395
|
+
});
|
|
396
|
+
tx();
|
|
397
|
+
return {
|
|
398
|
+
key: input.key,
|
|
399
|
+
valueJson,
|
|
400
|
+
updatedAt,
|
|
401
|
+
updatedBy,
|
|
402
|
+
};
|
|
403
|
+
}
|
|
404
|
+
get(key) {
|
|
405
|
+
const row = this.db.prepare('SELECT value_json FROM settings WHERE key=?').get(key);
|
|
406
|
+
if (!row)
|
|
407
|
+
return undefined;
|
|
408
|
+
try {
|
|
409
|
+
return JSON.parse(row.value_json);
|
|
410
|
+
}
|
|
411
|
+
catch {
|
|
412
|
+
return undefined;
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
list() {
|
|
416
|
+
const rows = this.db.prepare('SELECT * FROM settings').all();
|
|
417
|
+
return rows.map((r) => ({
|
|
418
|
+
key: r.key,
|
|
419
|
+
valueJson: r.value_json,
|
|
420
|
+
updatedAt: r.updated_at,
|
|
421
|
+
updatedBy: r.updated_by,
|
|
422
|
+
}));
|
|
423
|
+
}
|
|
424
|
+
async delete(key, actor) {
|
|
425
|
+
// M1: delete + audit insert run inside one transaction. If audit
|
|
426
|
+
// insert fails, the deletes roll back so we never silently drop a
|
|
427
|
+
// row without its audit trail.
|
|
428
|
+
let removed = false;
|
|
429
|
+
const tx = this.db.transaction(() => {
|
|
430
|
+
// Delete from both tables — same primary-key shape, only one will match.
|
|
431
|
+
const settingsRes = this.db.prepare('DELETE FROM settings WHERE key=?').run(key);
|
|
432
|
+
const secretsRes = this.db.prepare('DELETE FROM secrets WHERE key=?').run(key);
|
|
433
|
+
removed = settingsRes.changes + secretsRes.changes > 0;
|
|
434
|
+
this.audit.write({
|
|
435
|
+
action: 'delete',
|
|
436
|
+
actor,
|
|
437
|
+
key,
|
|
438
|
+
success: removed,
|
|
439
|
+
});
|
|
440
|
+
});
|
|
441
|
+
tx();
|
|
442
|
+
return removed;
|
|
443
|
+
}
|
|
444
|
+
// ── SecretStore impl ───────────────────────────────────────────────────
|
|
445
|
+
async setSecret(input, actor) {
|
|
446
|
+
const def = getKeyDef(input.key);
|
|
447
|
+
if (!def || def.classification !== 'workspace-secret') {
|
|
448
|
+
throw new Error(`SqliteEncryptedStore: cannot set secret for key "${input.key}" — not a registered workspace-secret`);
|
|
449
|
+
}
|
|
450
|
+
const updatedAt = Date.now();
|
|
451
|
+
const updatedBy = this.actorString(actor);
|
|
452
|
+
const ctx = {
|
|
453
|
+
scope: STORE_AAD_SCOPE,
|
|
454
|
+
scopeId: STORE_AAD_SCOPE_ID,
|
|
455
|
+
key: input.key,
|
|
456
|
+
keyVersion: this.keyVersion,
|
|
457
|
+
};
|
|
458
|
+
const enc = encrypt(this.masterKey, input.value, ctx);
|
|
459
|
+
// M1: encrypted-row insert + audit insert run inside one transaction
|
|
460
|
+
// so any failure (disk full, table locked, audit insert error) rolls
|
|
461
|
+
// both writes back. Encryption itself runs outside the txn — if
|
|
462
|
+
// encrypt() throws, we never opened the txn.
|
|
463
|
+
const tx = this.db.transaction(() => {
|
|
464
|
+
this.db.prepare(`
|
|
465
|
+
INSERT INTO secrets (key, ciphertext, key_version, label, provider, last_tested_at, last_test_result, updated_at, updated_by)
|
|
466
|
+
VALUES (@key, @ciphertext, @key_version, @label, @provider, @last_tested_at, @last_test_result, @updated_at, @updated_by)
|
|
467
|
+
ON CONFLICT(key) DO UPDATE SET
|
|
468
|
+
ciphertext = excluded.ciphertext,
|
|
469
|
+
key_version = excluded.key_version,
|
|
470
|
+
label = COALESCE(excluded.label, secrets.label),
|
|
471
|
+
provider = COALESCE(excluded.provider, secrets.provider),
|
|
472
|
+
last_tested_at = excluded.last_tested_at,
|
|
473
|
+
last_test_result = excluded.last_test_result,
|
|
474
|
+
updated_at = excluded.updated_at,
|
|
475
|
+
updated_by = excluded.updated_by
|
|
476
|
+
`).run({
|
|
477
|
+
key: input.key,
|
|
478
|
+
ciphertext: enc.ciphertext,
|
|
479
|
+
key_version: enc.keyVersion,
|
|
480
|
+
label: input.label ?? null,
|
|
481
|
+
provider: input.provider ?? null,
|
|
482
|
+
last_tested_at: null,
|
|
483
|
+
last_test_result: null,
|
|
484
|
+
updated_at: updatedAt,
|
|
485
|
+
updated_by: updatedBy,
|
|
486
|
+
});
|
|
487
|
+
this.audit.write({
|
|
488
|
+
action: 'set',
|
|
489
|
+
actor,
|
|
490
|
+
key: input.key,
|
|
491
|
+
success: true,
|
|
492
|
+
});
|
|
493
|
+
});
|
|
494
|
+
tx();
|
|
495
|
+
return this.describe(input.key);
|
|
496
|
+
}
|
|
497
|
+
describe(key) {
|
|
498
|
+
const row = this.db.prepare('SELECT * FROM secrets WHERE key=?').get(key);
|
|
499
|
+
if (!row)
|
|
500
|
+
return undefined;
|
|
501
|
+
const def = getKeyDef(row.key);
|
|
502
|
+
return {
|
|
503
|
+
key: row.key,
|
|
504
|
+
classification: def?.classification ?? 'workspace-secret',
|
|
505
|
+
label: row.label ?? undefined,
|
|
506
|
+
provider: row.provider ?? undefined,
|
|
507
|
+
lastTestedAt: row.last_tested_at ?? undefined,
|
|
508
|
+
lastTestResult: row.last_test_result ?? undefined,
|
|
509
|
+
updatedAt: row.updated_at,
|
|
510
|
+
updatedBy: row.updated_by,
|
|
511
|
+
keyVersion: row.key_version,
|
|
512
|
+
};
|
|
513
|
+
}
|
|
514
|
+
listSecrets(actor) {
|
|
515
|
+
const rows = this.db.prepare('SELECT * FROM secrets').all();
|
|
516
|
+
if (actor) {
|
|
517
|
+
this.audit.write({
|
|
518
|
+
action: 'describe',
|
|
519
|
+
actor,
|
|
520
|
+
key: '*',
|
|
521
|
+
success: true,
|
|
522
|
+
});
|
|
523
|
+
}
|
|
524
|
+
return rows.map((r) => {
|
|
525
|
+
const def = getKeyDef(r.key);
|
|
526
|
+
return {
|
|
527
|
+
key: r.key,
|
|
528
|
+
classification: def?.classification ?? 'workspace-secret',
|
|
529
|
+
label: r.label ?? undefined,
|
|
530
|
+
provider: r.provider ?? undefined,
|
|
531
|
+
lastTestedAt: r.last_tested_at ?? undefined,
|
|
532
|
+
lastTestResult: r.last_test_result ?? undefined,
|
|
533
|
+
updatedAt: r.updated_at,
|
|
534
|
+
updatedBy: r.updated_by,
|
|
535
|
+
keyVersion: r.key_version,
|
|
536
|
+
};
|
|
537
|
+
});
|
|
538
|
+
}
|
|
539
|
+
unsafeGetForResolver(key) {
|
|
540
|
+
const row = this.db.prepare('SELECT ciphertext, key_version FROM secrets WHERE key=?').get(key);
|
|
541
|
+
if (!row)
|
|
542
|
+
return undefined;
|
|
543
|
+
const ctx = {
|
|
544
|
+
scope: STORE_AAD_SCOPE,
|
|
545
|
+
scopeId: STORE_AAD_SCOPE_ID,
|
|
546
|
+
key,
|
|
547
|
+
keyVersion: row.key_version,
|
|
548
|
+
};
|
|
549
|
+
const encRow = { ciphertext: row.ciphertext, keyVersion: row.key_version };
|
|
550
|
+
try {
|
|
551
|
+
// Try current master key first (steady state).
|
|
552
|
+
if (row.key_version === this.keyVersion) {
|
|
553
|
+
return decrypt(this.masterKey, encRow, ctx);
|
|
554
|
+
}
|
|
555
|
+
// Transitional: row was encrypted under a previous key version.
|
|
556
|
+
if (this.previousMasterKey &&
|
|
557
|
+
row.key_version === this.previousKeyVersion) {
|
|
558
|
+
return decrypt(this.previousMasterKey, encRow, ctx);
|
|
559
|
+
}
|
|
560
|
+
// Fall through — try current key against whatever AAD we have.
|
|
561
|
+
// (Misconfigured rotation; better to error noisily.)
|
|
562
|
+
return decrypt(this.masterKey, encRow, ctx);
|
|
563
|
+
}
|
|
564
|
+
catch (err) {
|
|
565
|
+
// Audit decrypt failures as a security signal but don't throw out
|
|
566
|
+
// through the resolver hot path. Caller treats undefined as "unset".
|
|
567
|
+
this.audit.write({
|
|
568
|
+
action: 'decrypt_fail',
|
|
569
|
+
actor: { type: 'system', systemId: 'resolver' },
|
|
570
|
+
key,
|
|
571
|
+
success: false,
|
|
572
|
+
detail: { keyVersion: row.key_version, error: err instanceof Error ? err.message : String(err) },
|
|
573
|
+
});
|
|
574
|
+
return undefined;
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
/**
|
|
578
|
+
* Read a value from the `meta` key/value table — used by one-shot
|
|
579
|
+
* migrations to mark completion (e.g., scope-collapse, R2 structural
|
|
580
|
+
* import). Returns undefined when the row is absent. Not audited:
|
|
581
|
+
* meta rows are operational state, not configuration.
|
|
582
|
+
*/
|
|
583
|
+
getMeta(key) {
|
|
584
|
+
const row = this.db.prepare('SELECT value FROM meta WHERE key=?').get(key);
|
|
585
|
+
return row?.value;
|
|
586
|
+
}
|
|
587
|
+
/**
|
|
588
|
+
* Write a value to the `meta` key/value table. Upserts. Paired with
|
|
589
|
+
* `getMeta` for migration completion markers.
|
|
590
|
+
*/
|
|
591
|
+
setMeta(key, value) {
|
|
592
|
+
this.db.prepare('INSERT OR REPLACE INTO meta (key, value) VALUES (?, ?)').run(key, value);
|
|
593
|
+
}
|
|
594
|
+
close() {
|
|
595
|
+
this.db.close();
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
//# sourceMappingURL=SqliteEncryptedStore.js.map
|