@bevel-software/platform-core-backend 0.19.0 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/catalog-cache-invalidation.d.ts +7 -2
- package/dist/core/catalog-cache-invalidation.d.ts.map +1 -1
- package/dist/core/catalog-cache-invalidation.js +8 -9
- package/dist/core/catalog-cache-invalidation.js.map +1 -1
- package/dist/core/core-ports.d.ts +19 -0
- package/dist/core/core-ports.d.ts.map +1 -1
- package/dist/core/core-ports.js.map +1 -1
- package/dist/core/create-core-server.d.ts +2 -0
- package/dist/core/create-core-server.d.ts.map +1 -1
- package/dist/core/create-core-server.js +45 -105
- package/dist/core/create-core-server.js.map +1 -1
- package/dist/core/create-core-services.d.ts +33 -5
- package/dist/core/create-core-services.d.ts.map +1 -1
- package/dist/core/create-core-services.js +146 -82
- package/dist/core/create-core-services.js.map +1 -1
- package/dist/core/lifecycle.d.ts +74 -28
- package/dist/core/lifecycle.d.ts.map +1 -1
- package/dist/core/lifecycle.js +157 -20
- package/dist/core/lifecycle.js.map +1 -1
- package/dist/core/public-config.d.ts +5 -1
- package/dist/core/public-config.d.ts.map +1 -1
- package/dist/core/public-config.js +7 -5
- package/dist/core/public-config.js.map +1 -1
- package/dist/core-config.d.ts +95 -1
- package/dist/core-config.d.ts.map +1 -1
- package/dist/core-config.js +24 -8
- package/dist/core-config.js.map +1 -1
- package/dist/index.d.ts +5 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -3
- package/dist/index.js.map +1 -1
- package/dist/modules/access/access-control.service.d.ts +18 -1
- package/dist/modules/access/access-control.service.d.ts.map +1 -1
- package/dist/modules/access/access-control.service.js +19 -8
- package/dist/modules/access/access-control.service.js.map +1 -1
- package/dist/modules/access/access.routes.d.ts +2 -1
- package/dist/modules/access/access.routes.d.ts.map +1 -1
- package/dist/modules/access/access.routes.js +10 -10
- package/dist/modules/access/access.routes.js.map +1 -1
- package/dist/modules/access/change-read-gate.d.ts +6 -3
- package/dist/modules/access/change-read-gate.d.ts.map +1 -1
- package/dist/modules/access/change-read-gate.js +9 -6
- package/dist/modules/access/change-read-gate.js.map +1 -1
- package/dist/modules/access/creator-access.d.ts +4 -2
- package/dist/modules/access/creator-access.d.ts.map +1 -1
- package/dist/modules/access/creator-access.js +7 -4
- package/dist/modules/access/creator-access.js.map +1 -1
- package/dist/modules/agent-instructions/read-preamble.d.ts +2 -1
- package/dist/modules/agent-instructions/read-preamble.d.ts.map +1 -1
- package/dist/modules/agent-instructions/read-preamble.js +6 -9
- package/dist/modules/agent-instructions/read-preamble.js.map +1 -1
- package/dist/modules/audit/agent-audit.service.d.ts +54 -0
- package/dist/modules/audit/agent-audit.service.d.ts.map +1 -0
- package/dist/modules/audit/agent-audit.service.js +290 -0
- package/dist/modules/audit/agent-audit.service.js.map +1 -0
- package/dist/modules/audit/agent-rest-audit.middleware.d.ts +40 -0
- package/dist/modules/audit/agent-rest-audit.middleware.d.ts.map +1 -0
- package/dist/modules/audit/agent-rest-audit.middleware.js +75 -0
- package/dist/modules/audit/agent-rest-audit.middleware.js.map +1 -0
- package/dist/modules/audit/audit.contract.d.ts +145 -0
- package/dist/modules/audit/audit.contract.d.ts.map +1 -0
- package/dist/modules/audit/audit.contract.js +35 -0
- package/dist/modules/audit/audit.contract.js.map +1 -0
- package/dist/modules/audit/audit.routes.d.ts +21 -0
- package/dist/modules/audit/audit.routes.d.ts.map +1 -0
- package/dist/modules/audit/audit.routes.js +157 -0
- package/dist/modules/audit/audit.routes.js.map +1 -0
- package/dist/modules/audit/event-classifier.d.ts +52 -0
- package/dist/modules/audit/event-classifier.d.ts.map +1 -0
- package/dist/modules/audit/event-classifier.js +123 -0
- package/dist/modules/audit/event-classifier.js.map +1 -0
- package/dist/modules/audit/index.d.ts +7 -0
- package/dist/modules/audit/index.d.ts.map +1 -0
- package/dist/modules/audit/index.js +7 -0
- package/dist/modules/audit/index.js.map +1 -0
- package/dist/modules/audit/request-audit.d.ts +57 -0
- package/dist/modules/audit/request-audit.d.ts.map +1 -0
- package/dist/modules/audit/request-audit.js +117 -0
- package/dist/modules/audit/request-audit.js.map +1 -0
- package/dist/modules/auth/account-admission.d.ts +40 -0
- package/dist/modules/auth/account-admission.d.ts.map +1 -0
- package/dist/modules/auth/account-admission.js +17 -0
- package/dist/modules/auth/account-admission.js.map +1 -0
- package/dist/modules/auth/account.routes.d.ts.map +1 -1
- package/dist/modules/auth/account.routes.js +4 -1
- package/dist/modules/auth/account.routes.js.map +1 -1
- package/dist/modules/auth/auth.service.d.ts +19 -1
- package/dist/modules/auth/auth.service.d.ts.map +1 -1
- package/dist/modules/auth/auth.service.js +33 -1
- package/dist/modules/auth/auth.service.js.map +1 -1
- package/dist/modules/auth/oidc-auth-provider.d.ts.map +1 -1
- package/dist/modules/auth/oidc-auth-provider.js +9 -0
- package/dist/modules/auth/oidc-auth-provider.js.map +1 -1
- package/dist/modules/connection-probe/connection-probe.service.d.ts +13 -1
- package/dist/modules/connection-probe/connection-probe.service.d.ts.map +1 -1
- package/dist/modules/connection-probe/connection-probe.service.js +10 -2
- package/dist/modules/connection-probe/connection-probe.service.js.map +1 -1
- package/dist/modules/database/advisory-lock.d.ts +17 -0
- package/dist/modules/database/advisory-lock.d.ts.map +1 -1
- package/dist/modules/database/advisory-lock.js +24 -3
- package/dist/modules/database/advisory-lock.js.map +1 -1
- package/dist/modules/database/connection.d.ts +67 -2
- package/dist/modules/database/connection.d.ts.map +1 -1
- package/dist/modules/database/connection.js +118 -12
- package/dist/modules/database/connection.js.map +1 -1
- package/dist/modules/database/core-schema.d.ts +414 -0
- package/dist/modules/database/core-schema.d.ts.map +1 -1
- package/dist/modules/database/core-schema.js +99 -0
- package/dist/modules/database/core-schema.js.map +1 -1
- package/dist/modules/database/migrate.d.ts +1 -1
- package/dist/modules/database/migrate.d.ts.map +1 -1
- package/dist/modules/database/migrate.js +27 -3
- package/dist/modules/database/migrate.js.map +1 -1
- package/dist/modules/diff/diff.service.d.ts.map +1 -1
- package/dist/modules/diff/diff.service.js +6 -1
- package/dist/modules/diff/diff.service.js.map +1 -1
- package/dist/modules/kb-fs/branch-name.d.ts +0 -1
- package/dist/modules/kb-fs/branch-name.d.ts.map +1 -1
- package/dist/modules/kb-fs/branch-name.js +3 -3
- package/dist/modules/kb-fs/branch-name.js.map +1 -1
- package/dist/modules/kb-fs/clone-config.d.ts +9 -8
- package/dist/modules/kb-fs/clone-config.d.ts.map +1 -1
- package/dist/modules/kb-fs/clone-config.js +14 -12
- package/dist/modules/kb-fs/clone-config.js.map +1 -1
- package/dist/modules/kb-fs/git-guarded-filesystem.d.ts +9 -1
- package/dist/modules/kb-fs/git-guarded-filesystem.d.ts.map +1 -1
- package/dist/modules/kb-fs/git-guarded-filesystem.js +16 -3
- package/dist/modules/kb-fs/git-guarded-filesystem.js.map +1 -1
- package/dist/modules/mcp/mcp-auth.middleware.d.ts +1 -0
- package/dist/modules/mcp/mcp-auth.middleware.d.ts.map +1 -1
- package/dist/modules/mcp/mcp-auth.middleware.js +32 -0
- package/dist/modules/mcp/mcp-auth.middleware.js.map +1 -1
- package/dist/modules/mcp/mcp.routes.d.ts.map +1 -1
- package/dist/modules/mcp/mcp.routes.js +8 -1
- package/dist/modules/mcp/mcp.routes.js.map +1 -1
- package/dist/modules/mcp/mcp.service.d.ts +16 -1
- package/dist/modules/mcp/mcp.service.d.ts.map +1 -1
- package/dist/modules/mcp/mcp.service.js +52 -9
- package/dist/modules/mcp/mcp.service.js.map +1 -1
- package/dist/modules/mcp/oauth/bevel-oauth-provider.d.ts +59 -0
- package/dist/modules/mcp/oauth/bevel-oauth-provider.d.ts.map +1 -1
- package/dist/modules/mcp/oauth/bevel-oauth-provider.js +180 -8
- package/dist/modules/mcp/oauth/bevel-oauth-provider.js.map +1 -1
- package/dist/modules/plugins/compile/marketplace-compiler.service.d.ts +4 -4
- package/dist/modules/plugins/compile/marketplace-compiler.service.d.ts.map +1 -1
- package/dist/modules/plugins/compile/marketplace-compiler.service.js +7 -10
- package/dist/modules/plugins/compile/marketplace-compiler.service.js.map +1 -1
- package/dist/modules/plugins/discovery/bundle-dialect/bundle.source.d.ts +4 -1
- package/dist/modules/plugins/discovery/bundle-dialect/bundle.source.d.ts.map +1 -1
- package/dist/modules/plugins/discovery/bundle-dialect/bundle.source.js +5 -3
- package/dist/modules/plugins/discovery/bundle-dialect/bundle.source.js.map +1 -1
- package/dist/modules/plugins/discovery/kb-plugin-source.d.ts +6 -1
- package/dist/modules/plugins/discovery/kb-plugin-source.d.ts.map +1 -1
- package/dist/modules/plugins/discovery/kb-plugin-source.js +14 -9
- package/dist/modules/plugins/discovery/kb-plugin-source.js.map +1 -1
- package/dist/modules/plugins/discovery/native.source.d.ts +4 -1
- package/dist/modules/plugins/discovery/native.source.d.ts.map +1 -1
- package/dist/modules/plugins/discovery/native.source.js +4 -2
- package/dist/modules/plugins/discovery/native.source.js.map +1 -1
- package/dist/modules/plugins/index.d.ts +1 -1
- package/dist/modules/plugins/index.d.ts.map +1 -1
- package/dist/modules/plugins/index.js +1 -1
- package/dist/modules/plugins/index.js.map +1 -1
- package/dist/modules/plugins/join-request-jobs.service.d.ts +3 -1
- package/dist/modules/plugins/join-request-jobs.service.d.ts.map +1 -1
- package/dist/modules/plugins/join-request-jobs.service.js +6 -6
- package/dist/modules/plugins/join-request-jobs.service.js.map +1 -1
- package/dist/modules/plugins/join-requests.service.d.ts +3 -1
- package/dist/modules/plugins/join-requests.service.d.ts.map +1 -1
- package/dist/modules/plugins/join-requests.service.js +9 -8
- package/dist/modules/plugins/join-requests.service.js.map +1 -1
- package/dist/modules/plugins/plugin-links.d.ts +65 -10
- package/dist/modules/plugins/plugin-links.d.ts.map +1 -1
- package/dist/modules/plugins/plugin-links.js +136 -31
- package/dist/modules/plugins/plugin-links.js.map +1 -1
- package/dist/modules/plugins/plugin-links.service.d.ts +107 -5
- package/dist/modules/plugins/plugin-links.service.d.ts.map +1 -1
- package/dist/modules/plugins/plugin-links.service.js +151 -21
- package/dist/modules/plugins/plugin-links.service.js.map +1 -1
- package/dist/modules/plugins/plugin-provision.service.d.ts +10 -3
- package/dist/modules/plugins/plugin-provision.service.d.ts.map +1 -1
- package/dist/modules/plugins/plugin-provision.service.js +33 -26
- package/dist/modules/plugins/plugin-provision.service.js.map +1 -1
- package/dist/modules/plugins/plugin-rename.service.d.ts +4 -2
- package/dist/modules/plugins/plugin-rename.service.d.ts.map +1 -1
- package/dist/modules/plugins/plugin-rename.service.js +10 -12
- package/dist/modules/plugins/plugin-rename.service.js.map +1 -1
- package/dist/modules/plugins/plugins.routes.d.ts +3 -0
- package/dist/modules/plugins/plugins.routes.d.ts.map +1 -1
- package/dist/modules/plugins/plugins.routes.js +45 -15
- package/dist/modules/plugins/plugins.routes.js.map +1 -1
- package/dist/modules/plugins/plugins.service.d.ts +4 -4
- package/dist/modules/plugins/plugins.service.d.ts.map +1 -1
- package/dist/modules/plugins/plugins.service.js +7 -10
- package/dist/modules/plugins/plugins.service.js.map +1 -1
- package/dist/modules/plugins/teams.routes.d.ts +4 -1
- package/dist/modules/plugins/teams.routes.d.ts.map +1 -1
- package/dist/modules/plugins/teams.routes.js +11 -9
- package/dist/modules/plugins/teams.routes.js.map +1 -1
- package/dist/modules/secrets-vault/index.d.ts +1 -1
- package/dist/modules/secrets-vault/index.d.ts.map +1 -1
- package/dist/modules/secrets-vault/index.js +1 -1
- package/dist/modules/secrets-vault/index.js.map +1 -1
- package/dist/modules/secrets-vault/secrets-variable-loader.d.ts +29 -11
- package/dist/modules/secrets-vault/secrets-variable-loader.d.ts.map +1 -1
- package/dist/modules/secrets-vault/secrets-variable-loader.js +46 -21
- package/dist/modules/secrets-vault/secrets-variable-loader.js.map +1 -1
- package/dist/modules/secrets-vault/secrets-vault.routes.d.ts +3 -0
- package/dist/modules/secrets-vault/secrets-vault.routes.d.ts.map +1 -1
- package/dist/modules/secrets-vault/secrets-vault.routes.js +4 -6
- package/dist/modules/secrets-vault/secrets-vault.routes.js.map +1 -1
- package/dist/modules/settings/deployment-settings.service.d.ts +22 -10
- package/dist/modules/settings/deployment-settings.service.d.ts.map +1 -1
- package/dist/modules/settings/deployment-settings.service.js +52 -28
- package/dist/modules/settings/deployment-settings.service.js.map +1 -1
- package/dist/modules/settings/setup.routes.d.ts +9 -2
- package/dist/modules/settings/setup.routes.d.ts.map +1 -1
- package/dist/modules/settings/setup.routes.js +20 -14
- package/dist/modules/settings/setup.routes.js.map +1 -1
- package/dist/modules/skills/allowed-tools-check.d.ts +4 -3
- package/dist/modules/skills/allowed-tools-check.d.ts.map +1 -1
- package/dist/modules/skills/allowed-tools-check.js +8 -8
- package/dist/modules/skills/allowed-tools-check.js.map +1 -1
- package/dist/modules/skills/pending-skills.service.d.ts +3 -1
- package/dist/modules/skills/pending-skills.service.d.ts.map +1 -1
- package/dist/modules/skills/pending-skills.service.js +9 -6
- package/dist/modules/skills/pending-skills.service.js.map +1 -1
- package/dist/modules/skills/skill-access-requests.routes.d.ts +2 -1
- package/dist/modules/skills/skill-access-requests.routes.d.ts.map +1 -1
- package/dist/modules/skills/skill-access-requests.routes.js +6 -6
- package/dist/modules/skills/skill-access-requests.routes.js.map +1 -1
- package/dist/modules/skills/skills.routes.d.ts +4 -1
- package/dist/modules/skills/skills.routes.d.ts.map +1 -1
- package/dist/modules/skills/skills.routes.js +4 -4
- package/dist/modules/skills/skills.routes.js.map +1 -1
- package/dist/modules/skills/skills.service.d.ts +4 -2
- package/dist/modules/skills/skills.service.d.ts.map +1 -1
- package/dist/modules/skills/skills.service.js +13 -11
- package/dist/modules/skills/skills.service.js.map +1 -1
- package/dist/modules/tool-auth/external-api-key.interface.d.ts +21 -5
- package/dist/modules/tool-auth/external-api-key.interface.d.ts.map +1 -1
- package/dist/modules/tool-auth/external-api-key.interface.js.map +1 -1
- package/dist/modules/tool-auth/external-api-key.service.d.ts +1 -0
- package/dist/modules/tool-auth/external-api-key.service.d.ts.map +1 -1
- package/dist/modules/tool-auth/external-api-key.service.js +22 -9
- package/dist/modules/tool-auth/external-api-key.service.js.map +1 -1
- package/dist/modules/tool-auth/internal-token.service.d.ts +10 -0
- package/dist/modules/tool-auth/internal-token.service.d.ts.map +1 -1
- package/dist/modules/tool-auth/internal-token.service.js +1 -0
- package/dist/modules/tool-auth/internal-token.service.js.map +1 -1
- package/dist/modules/tool-auth/tool-auth.middleware.d.ts +8 -0
- package/dist/modules/tool-auth/tool-auth.middleware.d.ts.map +1 -1
- package/dist/modules/tool-auth/tool-auth.middleware.js +9 -1
- package/dist/modules/tool-auth/tool-auth.middleware.js.map +1 -1
- package/dist/modules/tool-manuals/mcp-json-discovery.d.ts +2 -1
- package/dist/modules/tool-manuals/mcp-json-discovery.d.ts.map +1 -1
- package/dist/modules/tool-manuals/mcp-json-discovery.js +6 -5
- package/dist/modules/tool-manuals/mcp-json-discovery.js.map +1 -1
- package/dist/modules/tool-manuals/mcp-server-edit.service.d.ts +4 -2
- package/dist/modules/tool-manuals/mcp-server-edit.service.d.ts.map +1 -1
- package/dist/modules/tool-manuals/mcp-server-edit.service.js +12 -10
- package/dist/modules/tool-manuals/mcp-server-edit.service.js.map +1 -1
- package/dist/modules/tool-manuals/pending-tools.service.d.ts +3 -1
- package/dist/modules/tool-manuals/pending-tools.service.d.ts.map +1 -1
- package/dist/modules/tool-manuals/pending-tools.service.js +19 -16
- package/dist/modules/tool-manuals/pending-tools.service.js.map +1 -1
- package/dist/modules/tool-manuals/tool-delete.service.d.ts +4 -2
- package/dist/modules/tool-manuals/tool-delete.service.d.ts.map +1 -1
- package/dist/modules/tool-manuals/tool-delete.service.js +14 -12
- package/dist/modules/tool-manuals/tool-delete.service.js.map +1 -1
- package/dist/modules/tool-manuals/tool-manuals.routes.d.ts +3 -1
- package/dist/modules/tool-manuals/tool-manuals.routes.d.ts.map +1 -1
- package/dist/modules/tool-manuals/tool-manuals.routes.js +7 -7
- package/dist/modules/tool-manuals/tool-manuals.routes.js.map +1 -1
- package/dist/modules/tool-manuals/tool-manuals.service.d.ts +4 -2
- package/dist/modules/tool-manuals/tool-manuals.service.d.ts.map +1 -1
- package/dist/modules/tool-manuals/tool-manuals.service.js +15 -12
- package/dist/modules/tool-manuals/tool-manuals.service.js.map +1 -1
- package/dist/modules/tool-manuals/tool-manuals.tools.d.ts +3 -0
- package/dist/modules/tool-manuals/tool-manuals.tools.d.ts.map +1 -1
- package/dist/modules/tool-manuals/tool-manuals.tools.js +4 -6
- package/dist/modules/tool-manuals/tool-manuals.tools.js.map +1 -1
- package/dist/modules/workflow/agent-tools/workflow.tools.d.ts +3 -2
- package/dist/modules/workflow/agent-tools/workflow.tools.d.ts.map +1 -1
- package/dist/modules/workflow/agent-tools/workflow.tools.js +9 -9
- package/dist/modules/workflow/agent-tools/workflow.tools.js.map +1 -1
- package/dist/modules/workflow/git/git.service.d.ts +11 -5
- package/dist/modules/workflow/git/git.service.d.ts.map +1 -1
- package/dist/modules/workflow/git/git.service.js +23 -14
- package/dist/modules/workflow/git/git.service.js.map +1 -1
- package/dist/modules/workflow/git/node-git-runner.d.ts +26 -2
- package/dist/modules/workflow/git/node-git-runner.d.ts.map +1 -1
- package/dist/modules/workflow/git/node-git-runner.js +35 -5
- package/dist/modules/workflow/git/node-git-runner.js.map +1 -1
- package/dist/modules/workflow/review-workflow/review-workflow.service.d.ts.map +1 -1
- package/dist/modules/workflow/review-workflow/review-workflow.service.js +9 -4
- package/dist/modules/workflow/review-workflow/review-workflow.service.js.map +1 -1
- package/dist/modules/workflow/session-ontology.service.d.ts +6 -1
- package/dist/modules/workflow/session-ontology.service.d.ts.map +1 -1
- package/dist/modules/workflow/session-ontology.service.js +6 -2
- package/dist/modules/workflow/session-ontology.service.js.map +1 -1
- package/dist/modules/workflow/workflow.service.d.ts +8 -3
- package/dist/modules/workflow/workflow.service.d.ts.map +1 -1
- package/dist/modules/workflow/workflow.service.js +33 -23
- package/dist/modules/workflow/workflow.service.js.map +1 -1
- package/dist/modules/workspace/session-ontology.gate.d.ts +3 -1
- package/dist/modules/workspace/session-ontology.gate.d.ts.map +1 -1
- package/dist/modules/workspace/session-ontology.gate.js +3 -3
- package/dist/modules/workspace/session-ontology.gate.js.map +1 -1
- package/dist/modules/workspace/startup/kb-git.d.ts +4 -3
- package/dist/modules/workspace/startup/kb-git.d.ts.map +1 -1
- package/dist/modules/workspace/startup/kb-git.js +15 -13
- package/dist/modules/workspace/startup/kb-git.js.map +1 -1
- package/dist/modules/workspace/startup/kb-startup-runner.d.ts +5 -8
- package/dist/modules/workspace/startup/kb-startup-runner.d.ts.map +1 -1
- package/dist/modules/workspace/startup/kb-startup-runner.js +35 -38
- package/dist/modules/workspace/startup/kb-startup-runner.js.map +1 -1
- package/dist/modules/workspace/startup/steps/groups-to-plugins.step.d.ts +7 -1
- package/dist/modules/workspace/startup/steps/groups-to-plugins.step.d.ts.map +1 -1
- package/dist/modules/workspace/startup/steps/groups-to-plugins.step.js +23 -16
- package/dist/modules/workspace/startup/steps/groups-to-plugins.step.js.map +1 -1
- package/dist/modules/workspace/startup/steps/personal-spaces.step.d.ts +7 -1
- package/dist/modules/workspace/startup/steps/personal-spaces.step.d.ts.map +1 -1
- package/dist/modules/workspace/startup/steps/personal-spaces.step.js +12 -5
- package/dist/modules/workspace/startup/steps/personal-spaces.step.js.map +1 -1
- package/dist/modules/workspace/startup/steps/plugin-display-names.step.d.ts +7 -1
- package/dist/modules/workspace/startup/steps/plugin-display-names.step.d.ts.map +1 -1
- package/dist/modules/workspace/startup/steps/plugin-display-names.step.js +12 -5
- package/dist/modules/workspace/startup/steps/plugin-display-names.step.js.map +1 -1
- package/dist/modules/workspace/startup/steps/plugin-manifests.step.d.ts +7 -1
- package/dist/modules/workspace/startup/steps/plugin-manifests.step.d.ts.map +1 -1
- package/dist/modules/workspace/startup/steps/plugin-manifests.step.js +12 -5
- package/dist/modules/workspace/startup/steps/plugin-manifests.step.js.map +1 -1
- package/dist/modules/workspace/startup/steps/seed-tree.d.ts +4 -1
- package/dist/modules/workspace/startup/steps/seed-tree.d.ts.map +1 -1
- package/dist/modules/workspace/startup/steps/seed-tree.js +14 -11
- package/dist/modules/workspace/startup/steps/seed-tree.js.map +1 -1
- package/dist/modules/workspace/startup/steps/template-files.step.d.ts +17 -3
- package/dist/modules/workspace/startup/steps/template-files.step.d.ts.map +1 -1
- package/dist/modules/workspace/startup/steps/template-files.step.js +36 -30
- package/dist/modules/workspace/startup/steps/template-files.step.js.map +1 -1
- package/dist/modules/workspace/startup/steps/template-source.d.ts +6 -1
- package/dist/modules/workspace/startup/steps/template-source.d.ts.map +1 -1
- package/dist/modules/workspace/startup/steps/template-source.js +10 -6
- package/dist/modules/workspace/startup/steps/template-source.js.map +1 -1
- package/dist/modules/workspace/workspace.routes.d.ts +2 -1
- package/dist/modules/workspace/workspace.routes.d.ts.map +1 -1
- package/dist/modules/workspace/workspace.routes.js +8 -7
- package/dist/modules/workspace/workspace.routes.js.map +1 -1
- package/dist/modules/workspace/workspace.service.d.ts +26 -12
- package/dist/modules/workspace/workspace.service.d.ts.map +1 -1
- package/dist/modules/workspace/workspace.service.js +41 -28
- package/dist/modules/workspace/workspace.service.js.map +1 -1
- package/dist/modules/workspace/workspace.tools.d.ts +2 -1
- package/dist/modules/workspace/workspace.tools.d.ts.map +1 -1
- package/dist/modules/workspace/workspace.tools.js +69 -31
- package/dist/modules/workspace/workspace.tools.js.map +1 -1
- package/dist/modules/workspace/write-denial.d.ts +3 -2
- package/dist/modules/workspace/write-denial.d.ts.map +1 -1
- package/dist/modules/workspace/write-denial.js +6 -5
- package/dist/modules/workspace/write-denial.js.map +1 -1
- package/dist/shared/git-internals.d.ts +7 -1
- package/dist/shared/git-internals.d.ts.map +1 -1
- package/dist/shared/git-internals.js +67 -9
- package/dist/shared/git-internals.js.map +1 -1
- package/dist/shared/git.contract.d.ts +52 -7
- package/dist/shared/git.contract.d.ts.map +1 -1
- package/dist/shared/git.contract.js +30 -8
- package/dist/shared/git.contract.js.map +1 -1
- package/dist/shared/kb-context.d.ts +76 -0
- package/dist/shared/kb-context.d.ts.map +1 -0
- package/dist/shared/kb-context.js +108 -0
- package/dist/shared/kb-context.js.map +1 -0
- package/dist/shared/kb-layout.d.ts +3 -2
- package/dist/shared/kb-layout.d.ts.map +1 -1
- package/dist/shared/kb-layout.js +4 -3
- package/dist/shared/kb-layout.js.map +1 -1
- package/dist/shared/kb-layout.test.js +35 -27
- package/dist/shared/kb-layout.test.js.map +1 -1
- package/dist/shared/pending-proposals.d.ts +4 -1
- package/dist/shared/pending-proposals.d.ts.map +1 -1
- package/dist/shared/pending-proposals.js +3 -4
- package/dist/shared/pending-proposals.js.map +1 -1
- package/dist/shared/redact-secret.d.ts +5 -5
- package/dist/shared/redact-secret.js +5 -5
- package/dist/tenancy/index.d.ts +13 -0
- package/dist/tenancy/index.d.ts.map +1 -0
- package/dist/tenancy/index.js +13 -0
- package/dist/tenancy/index.js.map +1 -0
- package/dist/tenancy/static-tenant-source.d.ts +98 -0
- package/dist/tenancy/static-tenant-source.d.ts.map +1 -0
- package/dist/tenancy/static-tenant-source.js +220 -0
- package/dist/tenancy/static-tenant-source.js.map +1 -0
- package/dist/tenancy/tenant-host.d.ts +80 -0
- package/dist/tenancy/tenant-host.d.ts.map +1 -0
- package/dist/tenancy/tenant-host.js +217 -0
- package/dist/tenancy/tenant-host.js.map +1 -0
- package/dist/tenancy/tenant-runtime.d.ts +91 -0
- package/dist/tenancy/tenant-runtime.d.ts.map +1 -0
- package/dist/tenancy/tenant-runtime.js +174 -0
- package/dist/tenancy/tenant-runtime.js.map +1 -0
- package/dist/tenancy/tenant-secrets.d.ts +24 -0
- package/dist/tenancy/tenant-secrets.d.ts.map +1 -0
- package/dist/tenancy/tenant-secrets.js +30 -0
- package/dist/tenancy/tenant-secrets.js.map +1 -0
- package/dist/tenancy/tenant-source.contract.d.ts +45 -0
- package/dist/tenancy/tenant-source.contract.d.ts.map +1 -0
- package/dist/tenancy/tenant-source.contract.js +21 -0
- package/dist/tenancy/tenant-source.contract.js.map +1 -0
- package/migrations/0000_core_init.sql +14 -14
- package/migrations/0003_deployment_settings.sql +1 -1
- package/migrations/0005_github_facade.sql +1 -1
- package/migrations/0012_agent_audit.sql +41 -0
- package/migrations/0013_agent_identity_and_key_soft_delete.sql +29 -0
- package/migrations/meta/0012_snapshot.json +2247 -0
- package/migrations/meta/0013_snapshot.json +2259 -0
- package/migrations/meta/_journal.json +14 -0
- package/package.json +4 -4
- package/src/__tests__/branch-model.test.ts +7 -6
- package/src/__tests__/kb-context.ts +30 -0
- package/src/__tests__/kb-layout-config.test.ts +35 -30
- package/src/core/__tests__/catalog-cache-invalidation.test.ts +2 -1
- package/src/core/__tests__/lifecycle.test.ts +78 -1
- package/src/core/__tests__/public-config.test.ts +5 -1
- package/src/core/catalog-cache-invalidation.ts +16 -11
- package/src/core/core-ports.ts +19 -0
- package/src/core/create-core-server.ts +55 -106
- package/src/core/create-core-services.ts +193 -95
- package/src/core/lifecycle.ts +214 -29
- package/src/core/public-config.ts +8 -5
- package/src/core-config.ts +107 -8
- package/src/index.ts +25 -2
- package/src/modules/access/__tests__/access-control.admin-root-floor.test.ts +2 -1
- package/src/modules/access/__tests__/access.routes.batch.test.ts +2 -1
- package/src/modules/access/__tests__/access.routes.folder-governs.test.ts +2 -1
- package/src/modules/access/__tests__/access.routes.group-grant.test.ts +2 -1
- package/src/modules/access/__tests__/access.routes.overrides.test.ts +2 -1
- package/src/modules/access/__tests__/access.routes.proposal-branch.test.ts +2 -1
- package/src/modules/access/__tests__/access.routes.prospective.test.ts +2 -1
- package/src/modules/access/__tests__/access.routes.revoke.test.ts +2 -1
- package/src/modules/access/__tests__/access.routes.unknown-email.test.ts +2 -1
- package/src/modules/access/__tests__/change-read-gate.test.ts +13 -11
- package/src/modules/access/__tests__/creator-access.test.ts +3 -2
- package/src/modules/access/__tests__/roles.routes.test.ts +2 -1
- package/src/modules/access/access-control.service.ts +20 -6
- package/src/modules/access/access.routes.ts +10 -13
- package/src/modules/access/change-read-gate.ts +10 -4
- package/src/modules/access/creator-access.ts +7 -2
- package/src/modules/agent-instructions/__tests__/read-preamble.test.ts +13 -12
- package/src/modules/agent-instructions/read-preamble.ts +10 -12
- package/src/modules/audit/__tests__/agent-audit.service.test.ts +370 -0
- package/src/modules/audit/__tests__/agent-rest-audit.middleware.test.ts +113 -0
- package/src/modules/audit/__tests__/audit.routes.test.ts +201 -0
- package/src/modules/audit/__tests__/event-classifier.test.ts +121 -0
- package/src/modules/audit/agent-audit.service.ts +316 -0
- package/src/modules/audit/agent-rest-audit.middleware.ts +83 -0
- package/src/modules/audit/audit.contract.ts +164 -0
- package/src/modules/audit/audit.routes.ts +168 -0
- package/src/modules/audit/event-classifier.ts +155 -0
- package/src/modules/audit/index.ts +14 -0
- package/src/modules/audit/request-audit.ts +141 -0
- package/src/modules/auth/__tests__/account.routes.test.ts +15 -0
- package/src/modules/auth/__tests__/auth.service.test.ts +60 -0
- package/src/modules/auth/account-admission.ts +44 -0
- package/src/modules/auth/account.routes.ts +4 -1
- package/src/modules/auth/auth.service.ts +33 -1
- package/src/modules/auth/oidc-auth-provider.ts +9 -0
- package/src/modules/connection-probe/connection-probe.service.ts +7 -1
- package/src/modules/database/__tests__/advisory-lock.test.ts +23 -1
- package/src/modules/database/__tests__/connection.test.ts +98 -0
- package/src/modules/database/__tests__/migrations-unqualified.test.ts +32 -0
- package/src/modules/database/advisory-lock.ts +28 -4
- package/src/modules/database/connection.ts +143 -13
- package/src/modules/database/core-schema.ts +104 -0
- package/src/modules/database/migrate.ts +48 -14
- package/src/modules/diff/__tests__/diff.service.seed-atomicity.test.ts +2 -1
- package/src/modules/diff/__tests__/diff.service.test.ts +2 -1
- package/src/modules/diff/diff.service.ts +6 -1
- package/src/modules/kb-fs/__tests__/branch-name.test.ts +6 -6
- package/src/modules/kb-fs/__tests__/clone-config.test.ts +24 -20
- package/src/modules/kb-fs/branch-name.ts +3 -3
- package/src/modules/kb-fs/clone-config.ts +15 -12
- package/src/modules/kb-fs/git-guarded-filesystem.ts +16 -3
- package/src/modules/marketplace/__tests__/marketplace-repo.head.test.ts +2 -1
- package/src/modules/mcp/__tests__/bevel-oauth-provider.test.ts +183 -13
- package/src/modules/mcp/__tests__/mcp-auth.middleware.test.ts +60 -2
- package/src/modules/mcp/__tests__/mcp.routes.local-token.test.ts +24 -4
- package/src/modules/mcp/__tests__/mcp.routes.stateless.test.ts +1 -1
- package/src/modules/mcp/__tests__/mcp.service.test.ts +120 -3
- package/src/modules/mcp/mcp-auth.middleware.ts +31 -0
- package/src/modules/mcp/mcp.routes.ts +11 -1
- package/src/modules/mcp/mcp.service.ts +73 -8
- package/src/modules/mcp/oauth/bevel-oauth-provider.ts +184 -6
- package/src/modules/plugins/__tests__/bundle-dialect.e2e.test.ts +12 -11
- package/src/modules/plugins/__tests__/bundle-dialect.test.ts +2 -1
- package/src/modules/plugins/__tests__/compile-marketplace.test.ts +6 -4
- package/src/modules/plugins/__tests__/join-request-jobs.service.test.ts +2 -1
- package/src/modules/plugins/__tests__/join-requests.service.test.ts +2 -1
- package/src/modules/plugins/__tests__/plugin-creation-display-name.test.ts +4 -3
- package/src/modules/plugins/__tests__/plugin-index.service.test.ts +6 -4
- package/src/modules/plugins/__tests__/plugin-links.service.test.ts +220 -5
- package/src/modules/plugins/__tests__/plugin-provision.service.test.ts +3 -1
- package/src/modules/plugins/__tests__/plugin-rename.service.test.ts +7 -6
- package/src/modules/plugins/__tests__/plugins.routes.test.ts +11 -2
- package/src/modules/plugins/__tests__/teams.routes.test.ts +2 -1
- package/src/modules/plugins/compile/marketplace-compiler.service.ts +7 -9
- package/src/modules/plugins/discovery/__tests__/kb-plugin-source.test.ts +20 -16
- package/src/modules/plugins/discovery/bundle-dialect/bundle.source.ts +9 -2
- package/src/modules/plugins/discovery/kb-plugin-source.ts +15 -8
- package/src/modules/plugins/discovery/native.source.ts +4 -1
- package/src/modules/plugins/index.ts +1 -1
- package/src/modules/plugins/join-request-jobs.service.ts +8 -7
- package/src/modules/plugins/join-requests.service.ts +7 -7
- package/src/modules/plugins/plugin-links.service.ts +192 -19
- package/src/modules/plugins/plugin-links.ts +147 -27
- package/src/modules/plugins/plugin-provision.service.ts +54 -27
- package/src/modules/plugins/plugin-rename.service.ts +10 -10
- package/src/modules/plugins/plugins.routes.ts +45 -15
- package/src/modules/plugins/plugins.service.ts +7 -11
- package/src/modules/plugins/teams.routes.ts +16 -8
- package/src/modules/secrets-vault/__tests__/connect-pending.route.test.ts +7 -0
- package/src/modules/secrets-vault/__tests__/secrets-variable-loader.test.ts +40 -0
- package/src/modules/secrets-vault/__tests__/tool-owner-gate.route.test.ts +2 -0
- package/src/modules/secrets-vault/index.ts +2 -0
- package/src/modules/secrets-vault/secrets-variable-loader.ts +51 -21
- package/src/modules/secrets-vault/secrets-vault.routes.ts +7 -6
- package/src/modules/settings/__tests__/deployment-settings.service.test.ts +59 -11
- package/src/modules/settings/__tests__/git-root-folders.test.ts +2 -1
- package/src/modules/settings/__tests__/setup.routes.boot-failure.test.ts +2 -1
- package/src/modules/settings/__tests__/setup.routes.layout-phase.test.ts +7 -4
- package/src/modules/settings/__tests__/setup.routes.oidc.test.ts +2 -0
- package/src/modules/settings/__tests__/setup.routes.sync-status.test.ts +2 -0
- package/src/modules/settings/__tests__/setup.routes.test.ts +33 -52
- package/src/modules/settings/deployment-settings.service.ts +68 -28
- package/src/modules/settings/setup.routes.ts +26 -16
- package/src/modules/skills/__tests__/allowed-tools-check.test.ts +11 -10
- package/src/modules/skills/__tests__/allowed-tools-warn.tools.test.ts +4 -3
- package/src/modules/skills/__tests__/pending-skills.service.test.ts +3 -1
- package/src/modules/skills/__tests__/skill-access-requests.routes.test.ts +2 -1
- package/src/modules/skills/__tests__/skills.routes.warnings.test.ts +2 -1
- package/src/modules/skills/__tests__/skills.service.test.ts +3 -2
- package/src/modules/skills/allowed-tools-check.ts +7 -6
- package/src/modules/skills/pending-skills.service.ts +9 -8
- package/src/modules/skills/skill-access-requests.routes.ts +7 -7
- package/src/modules/skills/skills.routes.ts +4 -3
- package/src/modules/skills/skills.service.ts +13 -9
- package/src/modules/tool-auth/__tests__/external-api-key.service.test.ts +29 -8
- package/src/modules/tool-auth/__tests__/internal-token.service.test.ts +6 -0
- package/src/modules/tool-auth/external-api-key.interface.ts +22 -5
- package/src/modules/tool-auth/external-api-key.service.ts +25 -8
- package/src/modules/tool-auth/internal-token.service.ts +11 -0
- package/src/modules/tool-auth/tool-auth.middleware.ts +17 -1
- package/src/modules/tool-helpers/__tests__/agent-roles-write.test.ts +3 -2
- package/src/modules/tool-helpers/__tests__/phase4-tools.test.ts +3 -2
- package/src/modules/tool-manuals/__tests__/mcp-json-discovery.test.ts +17 -12
- package/src/modules/tool-manuals/__tests__/mcp-server-edit.service.test.ts +2 -1
- package/src/modules/tool-manuals/__tests__/pending-tools.service.test.ts +4 -1
- package/src/modules/tool-manuals/__tests__/tool-delete.service.test.ts +2 -1
- package/src/modules/tool-manuals/__tests__/tool-manuals.archive.route.test.ts +2 -1
- package/src/modules/tool-manuals/__tests__/tool-manuals.cli.test.ts +5 -4
- package/src/modules/tool-manuals/__tests__/tool-manuals.detail.route.test.ts +2 -1
- package/src/modules/tool-manuals/__tests__/tool-manuals.invalid.routes.test.ts +4 -2
- package/src/modules/tool-manuals/__tests__/tool-manuals.invalid.test.ts +13 -5
- package/src/modules/tool-manuals/__tests__/tool-manuals.mcp-oauth.test.ts +2 -1
- package/src/modules/tool-manuals/__tests__/tool-manuals.restart.test.ts +9 -1
- package/src/modules/tool-manuals/__tests__/tool-manuals.service.test.ts +3 -2
- package/src/modules/tool-manuals/__tests__/tool-manuals.tools.test.ts +2 -0
- package/src/modules/tool-manuals/mcp-json-discovery.ts +6 -4
- package/src/modules/tool-manuals/mcp-server-edit.service.ts +13 -11
- package/src/modules/tool-manuals/pending-tools.service.ts +19 -16
- package/src/modules/tool-manuals/tool-delete.service.ts +13 -10
- package/src/modules/tool-manuals/tool-manuals.routes.ts +10 -8
- package/src/modules/tool-manuals/tool-manuals.service.ts +15 -13
- package/src/modules/tool-manuals/tool-manuals.tools.ts +7 -6
- package/src/modules/workflow/__tests__/apply-failure.test.ts +2 -1
- package/src/modules/workflow/__tests__/merge-announces-tree.test.ts +14 -26
- package/src/modules/workflow/__tests__/preserve-roles-yaml.test.ts +2 -1
- package/src/modules/workflow/__tests__/session-ontology.service.test.ts +3 -2
- package/src/modules/workflow/__tests__/workflow.routes.lock-path.test.ts +2 -1
- package/src/modules/workflow/__tests__/workflow.service.branch-in-use.test.ts +3 -10
- package/src/modules/workflow/__tests__/workflow.service.commitFileWhileLocked.test.ts +2 -1
- package/src/modules/workflow/__tests__/workflow.service.deleted-branch-sweep.test.ts +3 -10
- package/src/modules/workflow/__tests__/workflow.service.facade.test.ts +28 -27
- package/src/modules/workflow/__tests__/workflow.service.folder-proposals.test.ts +2 -1
- package/src/modules/workflow/__tests__/workflow.service.platform-restore.test.ts +2 -1
- package/src/modules/workflow/__tests__/workflow.service.read-gate.test.ts +3 -2
- package/src/modules/workflow/__tests__/workflow.service.releaseLock.test.ts +2 -1
- package/src/modules/workflow/__tests__/workflow.service.sync.test.ts +5 -4
- package/src/modules/workflow/__tests__/workflow.service.update-from-target.test.ts +2 -1
- package/src/modules/workflow/agent-tools/__tests__/workflow.tools.test.ts +2 -1
- package/src/modules/workflow/agent-tools/workflow.tools.ts +11 -9
- package/src/modules/workflow/git/__tests__/git.service.accessGating.test.ts +5 -4
- package/src/modules/workflow/git/__tests__/git.service.changedFilesForPr.test.ts +12 -11
- package/src/modules/workflow/git/__tests__/git.service.commitChanges.test.ts +9 -8
- package/src/modules/workflow/git/__tests__/git.service.commitFile.strayPath.test.ts +8 -7
- package/src/modules/workflow/git/__tests__/git.service.commitFile.test.ts +6 -5
- package/src/modules/workflow/git/__tests__/git.service.createBranch.test.ts +3 -2
- package/src/modules/workflow/git/__tests__/git.service.deleteBranch.test.ts +3 -2
- package/src/modules/workflow/git/__tests__/git.service.diffFileAtCommit.test.ts +7 -6
- package/src/modules/workflow/git/__tests__/git.service.diffFileBetweenBranches.test.ts +16 -15
- package/src/modules/workflow/git/__tests__/git.service.fileContentsAtCommit.test.ts +3 -2
- package/src/modules/workflow/git/__tests__/git.service.forkPoint.test.ts +2 -1
- package/src/modules/workflow/git/__tests__/git.service.history-guards.test.ts +2 -1
- package/src/modules/workflow/git/__tests__/git.service.list-branches.test.ts +10 -9
- package/src/modules/workflow/git/__tests__/git.service.listTrackedFiles.test.ts +2 -1
- package/src/modules/workflow/git/__tests__/git.service.logForFile.test.ts +6 -5
- package/src/modules/workflow/git/__tests__/git.service.mergeChangeRequest.test.ts +9 -8
- package/src/modules/workflow/git/__tests__/git.service.pendingChanges.test.ts +2 -1
- package/src/modules/workflow/git/__tests__/git.service.postMergePull.test.ts +4 -3
- package/src/modules/workflow/git/__tests__/git.service.pull.test.ts +9 -8
- package/src/modules/workflow/git/__tests__/git.service.readFileAtRef.test.ts +2 -1
- package/src/modules/workflow/git/__tests__/git.service.revertPathsAndPush.test.ts +2 -1
- package/src/modules/workflow/git/__tests__/git.service.status.test.ts +4 -3
- package/src/modules/workflow/git/__tests__/git.service.syncFromRemote.test.ts +8 -7
- package/src/modules/workflow/git/__tests__/node-git-runner.test.ts +41 -3
- package/src/modules/workflow/git/git.service.ts +24 -13
- package/src/modules/workflow/git/node-git-runner.ts +37 -4
- package/src/modules/workflow/review-workflow/review-workflow.service.ts +9 -6
- package/src/modules/workflow/session-ontology.service.ts +7 -2
- package/src/modules/workflow/workflow.service.ts +31 -24
- package/src/modules/workspace/__tests__/file-stat-access.test.ts +3 -2
- package/src/modules/workspace/__tests__/git-internals.security.test.ts +144 -52
- package/src/modules/workspace/__tests__/session-ontology.gate.test.ts +4 -2
- package/src/modules/workspace/__tests__/workspace-paths-inside-the-repo.test.ts +3 -2
- package/src/modules/workspace/__tests__/workspace.routes.branch-errors.test.ts +2 -1
- package/src/modules/workspace/__tests__/workspace.routes.create-grant.test.ts +2 -1
- package/src/modules/workspace/__tests__/workspace.routes.delete.test.ts +2 -1
- package/src/modules/workspace/__tests__/workspace.routes.download-implies-read.test.ts +2 -1
- package/src/modules/workspace/__tests__/workspace.routes.download.test.ts +2 -1
- package/src/modules/workspace/__tests__/workspace.routes.file-writes.test.ts +2 -1
- package/src/modules/workspace/__tests__/workspace.routes.folders.test.ts +5 -4
- package/src/modules/workspace/__tests__/workspace.routes.move-platform-files.test.ts +2 -1
- package/src/modules/workspace/__tests__/workspace.routes.read-gate.test.ts +2 -1
- package/src/modules/workspace/__tests__/workspace.service.ensure-remotes-fetched.test.ts +2 -2
- package/src/modules/workspace/__tests__/workspace.service.list-cloned.test.ts +6 -5
- package/src/modules/workspace/__tests__/workspace.service.move-never-overwrites.test.ts +2 -1
- package/src/modules/workspace/__tests__/workspace.service.read-filter.test.ts +2 -1
- package/src/modules/workspace/__tests__/workspace.service.test.ts +84 -50
- package/src/modules/workspace/__tests__/workspace.service.unknown-branch.test.ts +2 -1
- package/src/modules/workspace/__tests__/workspace.tools.agents-file.test.ts +10 -7
- package/src/modules/workspace/__tests__/workspace.tools.branch-errors.test.ts +4 -3
- package/src/modules/workspace/__tests__/workspace.tools.test.ts +9 -8
- package/src/modules/workspace/__tests__/write-denial.test.ts +5 -4
- package/src/modules/workspace/session-ontology.gate.ts +6 -4
- package/src/modules/workspace/startup/__tests__/kb-startup-runner.degraded.test.ts +6 -2
- package/src/modules/workspace/startup/__tests__/kb-startup-runner.test.ts +29 -21
- package/src/modules/workspace/startup/kb-git.ts +15 -22
- package/src/modules/workspace/startup/kb-startup-runner.ts +40 -46
- package/src/modules/workspace/startup/steps/__tests__/steps.test.ts +104 -98
- package/src/modules/workspace/startup/steps/groups-to-plugins.step.ts +24 -16
- package/src/modules/workspace/startup/steps/personal-spaces.step.ts +14 -5
- package/src/modules/workspace/startup/steps/plugin-display-names.step.ts +13 -5
- package/src/modules/workspace/startup/steps/plugin-manifests.step.ts +14 -5
- package/src/modules/workspace/startup/steps/seed-tree.ts +11 -9
- package/src/modules/workspace/startup/steps/template-files.step.ts +43 -34
- package/src/modules/workspace/startup/steps/template-source.ts +8 -5
- package/src/modules/workspace/workspace.routes.ts +8 -7
- package/src/modules/workspace/workspace.service.ts +39 -27
- package/src/modules/workspace/workspace.tools.ts +68 -31
- package/src/modules/workspace/write-denial.ts +7 -5
- package/src/shared/__tests__/git-internals.test.ts +41 -0
- package/src/shared/__tests__/kb-layout.plugin.test.ts +19 -16
- package/src/shared/git-internals.ts +61 -6
- package/src/shared/git.contract.ts +70 -8
- package/src/shared/kb-context.ts +130 -0
- package/src/shared/kb-layout.test.ts +37 -27
- package/src/shared/kb-layout.ts +4 -3
- package/src/shared/pending-proposals.ts +7 -4
- package/src/shared/redact-secret.ts +5 -5
- package/src/tenancy/__tests__/static-tenant-source.test.ts +177 -0
- package/src/tenancy/__tests__/tenant-host.test.ts +372 -0
- package/src/tenancy/__tests__/tenant-runtime.test.ts +221 -0
- package/src/tenancy/__tests__/tenant-secrets.test.ts +35 -0
- package/src/tenancy/index.ts +35 -0
- package/src/tenancy/static-tenant-source.ts +296 -0
- package/src/tenancy/tenant-host.ts +261 -0
- package/src/tenancy/tenant-runtime.ts +208 -0
- package/src/tenancy/tenant-secrets.ts +41 -0
- package/src/tenancy/tenant-source.contract.ts +59 -0
- package/dist/modules/access/access-errors.d.ts +0 -34
- package/dist/modules/access/access-errors.d.ts.map +0 -1
- package/dist/modules/access/access-errors.js +0 -40
- package/dist/modules/access/access-errors.js.map +0 -1
- package/dist/modules/access/access-splice.d.ts +0 -140
- package/dist/modules/access/access-splice.d.ts.map +0 -1
- package/dist/modules/access/access-splice.js +0 -389
- package/dist/modules/access/access-splice.js.map +0 -1
- package/dist/modules/access/group-files.d.ts +0 -83
- package/dist/modules/access/group-files.d.ts.map +0 -1
- package/dist/modules/access/group-files.js +0 -167
- package/dist/modules/access/group-files.js.map +0 -1
- package/dist/modules/access/kb-read-filter.d.ts +0 -41
- package/dist/modules/access/kb-read-filter.d.ts.map +0 -1
- package/dist/modules/access/kb-read-filter.js +0 -60
- package/dist/modules/access/kb-read-filter.js.map +0 -1
- package/dist/modules/access/render-roles-yaml.d.ts +0 -22
- package/dist/modules/access/render-roles-yaml.d.ts.map +0 -1
- package/dist/modules/access/render-roles-yaml.js +0 -56
- package/dist/modules/access/render-roles-yaml.js.map +0 -1
- package/dist/modules/access/roles-yaml-guard.d.ts +0 -56
- package/dist/modules/access/roles-yaml-guard.d.ts.map +0 -1
- package/dist/modules/access/roles-yaml-guard.js +0 -79
- package/dist/modules/access/roles-yaml-guard.js.map +0 -1
- package/dist/modules/diff/diff-paths.d.ts +0 -2
- package/dist/modules/diff/diff-paths.d.ts.map +0 -1
- package/dist/modules/diff/diff-paths.js +0 -9
- package/dist/modules/diff/diff-paths.js.map +0 -1
- package/dist/modules/groups/group-provision.service.d.ts +0 -130
- package/dist/modules/groups/group-provision.service.d.ts.map +0 -1
- package/dist/modules/groups/group-provision.service.js +0 -288
- package/dist/modules/groups/group-provision.service.js.map +0 -1
- package/dist/modules/groups/groups.contract.d.ts +0 -106
- package/dist/modules/groups/groups.contract.d.ts.map +0 -1
- package/dist/modules/groups/groups.contract.js +0 -36
- package/dist/modules/groups/groups.contract.js.map +0 -1
- package/dist/modules/groups/groups.routes.d.ts +0 -42
- package/dist/modules/groups/groups.routes.d.ts.map +0 -1
- package/dist/modules/groups/groups.routes.js +0 -379
- package/dist/modules/groups/groups.routes.js.map +0 -1
- package/dist/modules/groups/groups.service.d.ts +0 -60
- package/dist/modules/groups/groups.service.d.ts.map +0 -1
- package/dist/modules/groups/groups.service.js +0 -172
- package/dist/modules/groups/groups.service.js.map +0 -1
- package/dist/modules/groups/index.d.ts +0 -7
- package/dist/modules/groups/index.d.ts.map +0 -1
- package/dist/modules/groups/index.js +0 -6
- package/dist/modules/groups/index.js.map +0 -1
- package/dist/modules/groups/join-proposals.d.ts +0 -53
- package/dist/modules/groups/join-proposals.d.ts.map +0 -1
- package/dist/modules/groups/join-proposals.js +0 -67
- package/dist/modules/groups/join-proposals.js.map +0 -1
- package/dist/modules/groups/join-requests.service.d.ts +0 -81
- package/dist/modules/groups/join-requests.service.d.ts.map +0 -1
- package/dist/modules/groups/join-requests.service.js +0 -135
- package/dist/modules/groups/join-requests.service.js.map +0 -1
- package/dist/modules/mcp/mcp-session-store.d.ts +0 -74
- package/dist/modules/mcp/mcp-session-store.d.ts.map +0 -1
- package/dist/modules/mcp/mcp-session-store.js +0 -131
- package/dist/modules/mcp/mcp-session-store.js.map +0 -1
- package/dist/modules/workflow/file-change-notifier.d.ts +0 -38
- package/dist/modules/workflow/file-change-notifier.d.ts.map +0 -1
- package/dist/modules/workflow/file-change-notifier.js +0 -22
- package/dist/modules/workflow/file-change-notifier.js.map +0 -1
- package/dist/modules/workflow/git/branch-name.d.ts +0 -10
- package/dist/modules/workflow/git/branch-name.d.ts.map +0 -1
- package/dist/modules/workflow/git/branch-name.js +0 -76
- package/dist/modules/workflow/git/branch-name.js.map +0 -1
- package/dist/modules/workflow/git/clone-config.d.ts +0 -61
- package/dist/modules/workflow/git/clone-config.d.ts.map +0 -1
- package/dist/modules/workflow/git/clone-config.js +0 -69
- package/dist/modules/workflow/git/clone-config.js.map +0 -1
- package/dist/modules/workflow/git/mutex.d.ts +0 -11
- package/dist/modules/workflow/git/mutex.d.ts.map +0 -1
- package/dist/modules/workflow/git/mutex.js +0 -23
- package/dist/modules/workflow/git/mutex.js.map +0 -1
- package/dist/modules/workflow/locking-filesystem.d.ts +0 -137
- package/dist/modules/workflow/locking-filesystem.d.ts.map +0 -1
- package/dist/modules/workflow/locking-filesystem.js +0 -553
- package/dist/modules/workflow/locking-filesystem.js.map +0 -1
- package/dist/modules/workflow/read-only-filesystem.d.ts +0 -24
- package/dist/modules/workflow/read-only-filesystem.d.ts.map +0 -1
- package/dist/modules/workflow/read-only-filesystem.js +0 -39
- package/dist/modules/workflow/read-only-filesystem.js.map +0 -1
- package/dist/modules/workflow/workflow.errors.d.ts +0 -197
- package/dist/modules/workflow/workflow.errors.d.ts.map +0 -1
- package/dist/modules/workflow/workflow.errors.js +0 -298
- package/dist/modules/workflow/workflow.errors.js.map +0 -1
- package/dist/modules/workspace/bevel-ignore.d.ts +0 -30
- package/dist/modules/workspace/bevel-ignore.d.ts.map +0 -1
- package/dist/modules/workspace/bevel-ignore.js +0 -61
- package/dist/modules/workspace/bevel-ignore.js.map +0 -1
- package/dist/modules/workspace/kb-seed.interface.d.ts +0 -36
- package/dist/modules/workspace/kb-seed.interface.d.ts.map +0 -1
- package/dist/modules/workspace/kb-seed.interface.js +0 -2
- package/dist/modules/workspace/kb-seed.interface.js.map +0 -1
- package/dist/modules/workspace/kb-seed.service.d.ts +0 -125
- package/dist/modules/workspace/kb-seed.service.d.ts.map +0 -1
- package/dist/modules/workspace/kb-seed.service.js +0 -535
- package/dist/modules/workspace/kb-seed.service.js.map +0 -1
- package/dist/modules/workspace/plugins-migration.d.ts +0 -50
- package/dist/modules/workspace/plugins-migration.d.ts.map +0 -1
- package/dist/modules/workspace/plugins-migration.js +0 -379
- package/dist/modules/workspace/plugins-migration.js.map +0 -1
- package/dist/shared/fs-errors.d.ts +0 -8
- package/dist/shared/fs-errors.d.ts.map +0 -1
- package/dist/shared/fs-errors.js +0 -11
- package/dist/shared/fs-errors.js.map +0 -1
- package/dist/shared/fs-walk.d.ts +0 -23
- package/dist/shared/fs-walk.d.ts.map +0 -1
- package/dist/shared/fs-walk.js +0 -42
- package/dist/shared/fs-walk.js.map +0 -1
- package/dist/shared/hash-email.d.ts +0 -11
- package/dist/shared/hash-email.d.ts.map +0 -1
- package/dist/shared/hash-email.js +0 -14
- package/dist/shared/hash-email.js.map +0 -1
- package/dist/shared/kb-walk.d.ts +0 -52
- package/dist/shared/kb-walk.d.ts.map +0 -1
- package/dist/shared/kb-walk.js +0 -76
- package/dist/shared/kb-walk.js.map +0 -1
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export { GroupIndexService, groupsWorkspaceId } from './groups.service.js';
|
|
2
|
-
export { GroupProvisionService, GroupProvisionError, groupAccessMd, personalAccessMd, } from './group-provision.service.js';
|
|
3
|
-
export { JoinRequestsService, type JoinRequest } from './join-requests.service.js';
|
|
4
|
-
export { pendingProposals, type JoinProposal } from './join-proposals.js';
|
|
5
|
-
export { createGroupsRoutes } from './groups.routes.js';
|
|
6
|
-
export type { IGroupIndexService, GroupCatalogEntry, GroupSummary, ResolvedPrincipals, ResolvedReaders, } from './groups.contract.js';
|
|
7
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/modules/groups/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC3E,OAAO,EACL,qBAAqB,EACrB,mBAAmB,EACnB,aAAa,EACb,gBAAgB,GACjB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,mBAAmB,EAAE,KAAK,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACnF,OAAO,EAAE,gBAAgB,EAAE,KAAK,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAC1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,YAAY,EACV,kBAAkB,EAClB,iBAAiB,EACjB,YAAY,EACZ,kBAAkB,EAClB,eAAe,GAChB,MAAM,sBAAsB,CAAC"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export { GroupIndexService, groupsWorkspaceId } from './groups.service.js';
|
|
2
|
-
export { GroupProvisionService, GroupProvisionError, groupAccessMd, personalAccessMd, } from './group-provision.service.js';
|
|
3
|
-
export { JoinRequestsService } from './join-requests.service.js';
|
|
4
|
-
export { pendingProposals } from './join-proposals.js';
|
|
5
|
-
export { createGroupsRoutes } from './groups.routes.js';
|
|
6
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/groups/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC3E,OAAO,EACL,qBAAqB,EACrB,mBAAmB,EACnB,aAAa,EACb,gBAAgB,GACjB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,mBAAmB,EAAoB,MAAM,4BAA4B,CAAC;AACnF,OAAO,EAAE,gBAAgB,EAAqB,MAAM,qBAAqB,CAAC;AAC1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { type Verb } from '../access/access-control.service.js';
|
|
2
|
-
/**
|
|
3
|
-
* What a join branch is PROPOSING, relative to the default branch.
|
|
4
|
-
*
|
|
5
|
-
* A join request is a change request whose branch edits one group's
|
|
6
|
-
* `access.md`. Rather than treating that change request as an all-or-nothing
|
|
7
|
-
* merge, the group's managers see its individual proposals — "grant Ali read",
|
|
8
|
-
* "grant GTM Team write" — and answer them one at a time. Approving a proposal
|
|
9
|
-
* writes THAT ONE grant onto the default branch through the ordinary access
|
|
10
|
-
* mutation path; the branch is never merged, so nothing else it happens to
|
|
11
|
-
* contain can ride along, and a change request naming five people can be
|
|
12
|
-
* answered with two yeses and three ignores.
|
|
13
|
-
*
|
|
14
|
-
* A proposal is any (principal, verb) GRANT the branch's copy of the file
|
|
15
|
-
* carries that the default branch's copy does not. Deliberately:
|
|
16
|
-
*
|
|
17
|
-
* - grants only. A `deny` entry is not something to "accept", and a branch
|
|
18
|
-
* that REMOVES an existing grant proposes nothing — it is a revocation,
|
|
19
|
-
* which is not what this surface is for. Both are simply invisible here,
|
|
20
|
-
* and both leave the branch as a normal change request in the review UI.
|
|
21
|
-
* - every verb, not just `read`. A branch asking for `write` must be visible
|
|
22
|
-
* AS a write request rather than hiding behind "asked to join"; and the
|
|
23
|
-
* subset test that retires a request has to cover everything the file can
|
|
24
|
-
* express, or a request proposing `write` would never settle.
|
|
25
|
-
*
|
|
26
|
-
* When the list comes back EMPTY the branch adds nothing the default branch
|
|
27
|
-
* does not already grant — its proposals have all been accepted (or were
|
|
28
|
-
* never anything) — and the change request has no reason to stay open.
|
|
29
|
-
*/
|
|
30
|
-
export interface JoinProposal {
|
|
31
|
-
verb: Verb;
|
|
32
|
-
/** Canonical identity — lowercased email, or canonical role name. */
|
|
33
|
-
id: string;
|
|
34
|
-
principal: {
|
|
35
|
-
kind: 'user';
|
|
36
|
-
email: string;
|
|
37
|
-
displayName: string;
|
|
38
|
-
} | {
|
|
39
|
-
kind: 'role';
|
|
40
|
-
role: string;
|
|
41
|
-
};
|
|
42
|
-
/** How to name this principal in the UI. */
|
|
43
|
-
label: string;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* The grants `branchText` adds over `defaultText` — the proposals a manager
|
|
47
|
-
* can accept. Empty ⇒ the branch's rules are a subset of the default's.
|
|
48
|
-
*
|
|
49
|
-
* `path` is only used to label parse errors; both texts are the same file at
|
|
50
|
-
* two refs.
|
|
51
|
-
*/
|
|
52
|
-
export declare function pendingProposals(branchText: string | null, defaultText: string | null, path: string): JoinProposal[];
|
|
53
|
-
//# sourceMappingURL=join-proposals.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"join-proposals.d.ts","sourceRoot":"","sources":["../../../src/modules/groups/join-proposals.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,IAAI,EACV,MAAM,qCAAqC,CAAC;AAE7C;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,IAAI,CAAC;IACX,qEAAqE;IACrE,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EACL;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,GACpD;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IACnC,4CAA4C;IAC5C,KAAK,EAAE,MAAM,CAAC;CACf;AAgCD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,MAAM,GAAG,IAAI,EACzB,WAAW,EAAE,MAAM,GAAG,IAAI,EAC1B,IAAI,EAAE,MAAM,GACX,YAAY,EAAE,CA0BhB"}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { KNOWN_VERBS, parseAccessFile, } from '../access/access-control.service.js';
|
|
2
|
-
/** Canonical identity of an entry, for set comparison across the two files. */
|
|
3
|
-
function identityOf(entry) {
|
|
4
|
-
return entry.kind === 'user' ? `user:${entry.email}` : `role:${entry.role}`;
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* Folder rules from one copy of an `access.md`, per verb, grants only.
|
|
8
|
-
*
|
|
9
|
-
* A file that fails to parse yields NO grants. On the branch side that means
|
|
10
|
-
* a malformed proposal offers nothing to accept (fail-closed). On the default
|
|
11
|
-
* side it means every branch grant looks incoming — which is the safe
|
|
12
|
-
* direction too: the manager is shown proposals to consider rather than
|
|
13
|
-
* having them silently swallowed by an unreadable baseline.
|
|
14
|
-
*/
|
|
15
|
-
function grantsByVerb(text, path) {
|
|
16
|
-
const out = new Map();
|
|
17
|
-
for (const verb of KNOWN_VERBS)
|
|
18
|
-
out.set(verb, new Map());
|
|
19
|
-
if (text === null)
|
|
20
|
-
return out;
|
|
21
|
-
const parsed = parseAccessFile(text, path);
|
|
22
|
-
if (!parsed.ok)
|
|
23
|
-
return out;
|
|
24
|
-
for (const verb of KNOWN_VERBS) {
|
|
25
|
-
const byId = out.get(verb);
|
|
26
|
-
for (const entry of parsed.file.entries[verb]) {
|
|
27
|
-
if (entry.deny)
|
|
28
|
-
continue;
|
|
29
|
-
byId.set(identityOf(entry), entry);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
return out;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* The grants `branchText` adds over `defaultText` — the proposals a manager
|
|
36
|
-
* can accept. Empty ⇒ the branch's rules are a subset of the default's.
|
|
37
|
-
*
|
|
38
|
-
* `path` is only used to label parse errors; both texts are the same file at
|
|
39
|
-
* two refs.
|
|
40
|
-
*/
|
|
41
|
-
export function pendingProposals(branchText, defaultText, path) {
|
|
42
|
-
const branch = grantsByVerb(branchText, path);
|
|
43
|
-
const base = grantsByVerb(defaultText, path);
|
|
44
|
-
const out = [];
|
|
45
|
-
for (const verb of KNOWN_VERBS) {
|
|
46
|
-
const baseIds = base.get(verb);
|
|
47
|
-
for (const [id, entry] of branch.get(verb)) {
|
|
48
|
-
if (baseIds.has(id))
|
|
49
|
-
continue;
|
|
50
|
-
out.push(entry.kind === 'user'
|
|
51
|
-
? {
|
|
52
|
-
verb,
|
|
53
|
-
id,
|
|
54
|
-
principal: { kind: 'user', email: entry.email, displayName: entry.displayName },
|
|
55
|
-
label: entry.displayName,
|
|
56
|
-
}
|
|
57
|
-
: {
|
|
58
|
-
verb,
|
|
59
|
-
id,
|
|
60
|
-
principal: { kind: 'role', role: entry.displayRole },
|
|
61
|
-
label: entry.displayRole,
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
return out;
|
|
66
|
-
}
|
|
67
|
-
//# sourceMappingURL=join-proposals.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"join-proposals.js","sourceRoot":"","sources":["../../../src/modules/groups/join-proposals.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,eAAe,GAGhB,MAAM,qCAAqC,CAAC;AAyC7C,+EAA+E;AAC/E,SAAS,UAAU,CAAC,KAAkB;IACpC,OAAO,KAAK,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,QAAQ,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,CAAC,IAAI,EAAE,CAAC;AAC9E,CAAC;AAED;;;;;;;;GAQG;AACH,SAAS,YAAY,CAAC,IAAmB,EAAE,IAAY;IACr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AAC,EAAE,CAAC;gBAAE,SAAS;YAC9B,GAAG,CAAC,IAAI,CACN,KAAK,CAAC,IAAI,KAAK,MAAM;gBACnB,CAAC,CAAC;oBACE,IAAI;oBACJ,EAAE;oBACF,SAAS,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,WAAW,EAAE,KAAK,CAAC,WAAW,EAAE;oBAC/E,KAAK,EAAE,KAAK,CAAC,WAAW;iBACzB;gBACH,CAAC,CAAC;oBACE,IAAI;oBACJ,EAAE;oBACF,SAAS,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,WAAW,EAAE;oBACpD,KAAK,EAAE,KAAK,CAAC,WAAW;iBACzB,CACN,CAAC;QACJ,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { type AuthUser, type ChangeRequest, type IWorkflowService } from '@bevel-software/platform-shared';
|
|
2
|
-
import { type WorkspaceService } from '../workspace/workspace.service.js';
|
|
3
|
-
import { type JoinProposal } from './join-proposals.js';
|
|
4
|
-
/** One open join change request, with what it still proposes. */
|
|
5
|
-
export interface JoinRequest {
|
|
6
|
-
number: number;
|
|
7
|
-
branch: string;
|
|
8
|
-
requesterName: string;
|
|
9
|
-
createdAt: string;
|
|
10
|
-
/** Grants the branch adds over the default branch. Never empty (see below). */
|
|
11
|
-
proposals: JoinProposal[];
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Join requests as PROPOSALS, and the reconciliation that retires them.
|
|
15
|
-
*
|
|
16
|
-
* The lifecycle has no state of its own — it is derived, every time, from two
|
|
17
|
-
* copies of one file:
|
|
18
|
-
*
|
|
19
|
-
* open the branch's `access.md` grants something the default's does not
|
|
20
|
-
* settled it does not
|
|
21
|
-
*
|
|
22
|
-
* so "approve" is not an operation on the request at all. A manager grants a
|
|
23
|
-
* principal through the ordinary access path (the same lock + commit every
|
|
24
|
-
* other access edit uses, gated the same way), the default branch gains that
|
|
25
|
-
* entry, and the proposal stops being pending because the diff no longer
|
|
26
|
-
* contains it. When the last one goes, the change request has nothing left to
|
|
27
|
-
* say and is rejected, its branch deleted.
|
|
28
|
-
*
|
|
29
|
-
* That reconciliation runs LAZILY on every listing as well as on demand, so a
|
|
30
|
-
* grant made anywhere — this banner, the Manage-access dialog, a hand edit —
|
|
31
|
-
* settles the request that asked for it. Nothing has to remember to.
|
|
32
|
-
*/
|
|
33
|
-
export declare class JoinRequestsService {
|
|
34
|
-
private readonly workspaceService;
|
|
35
|
-
private readonly workflow;
|
|
36
|
-
constructor(workspaceService: WorkspaceService, workflow: IWorkflowService);
|
|
37
|
-
/**
|
|
38
|
-
* Open join requests for `group`, each carrying only its still-pending
|
|
39
|
-
* proposals. Requests with none left are reconciled away (rejected, branch
|
|
40
|
-
* deleted) and omitted.
|
|
41
|
-
*
|
|
42
|
-
* `actor` is who the reconciliation acts as — a manager of the group, since
|
|
43
|
-
* rejecting a change request requires write on everything it touches.
|
|
44
|
-
*/
|
|
45
|
-
list(group: string, folder: string, crs: ChangeRequest[], actor: AuthUser): Promise<JoinRequest[]>;
|
|
46
|
-
/**
|
|
47
|
-
* Re-check ONE request and settle it if nothing is pending. Returns whether
|
|
48
|
-
* it was settled. Called right after a grant so the banner updates in the
|
|
49
|
-
* same round-trip instead of waiting for the next listing.
|
|
50
|
-
*/
|
|
51
|
-
reconcile(group: string, folder: string, cr: ChangeRequest, actor: AuthUser): Promise<boolean>;
|
|
52
|
-
/**
|
|
53
|
-
* Close a request whose proposals have all landed, and delete its branch.
|
|
54
|
-
*
|
|
55
|
-
* Rejecting rather than merging is the point: the grants are already on the
|
|
56
|
-
* default branch, so merging would replay a diff that is now empty of
|
|
57
|
-
* meaning while dragging along anything else the branch carries. The branch
|
|
58
|
-
* goes too — it exists only to hold a proposal that no longer exists.
|
|
59
|
-
*
|
|
60
|
-
* Best-effort by contract: this runs inside a listing, and a request that
|
|
61
|
-
* cannot be closed right now must not take the listing down with it. The
|
|
62
|
-
* next pass tries again.
|
|
63
|
-
*/
|
|
64
|
-
private settle;
|
|
65
|
-
/**
|
|
66
|
-
* The file at one branch, or null when it is absent/unreadable there.
|
|
67
|
-
*
|
|
68
|
-
* Every read runs against the DEFAULT branch's clone at `origin/<branch>`,
|
|
69
|
-
* so one workspace answers for every request and a join branch never needs
|
|
70
|
-
* a clone of its own. `readFileAtRef` takes a REPO-relative path (the KB
|
|
71
|
-
* dir is the repo root there).
|
|
72
|
-
*/
|
|
73
|
-
private readAt;
|
|
74
|
-
/**
|
|
75
|
-
* Refresh remote-tracking refs before reading them. Throttled inside, and
|
|
76
|
-
* best-effort: a request pushed seconds ago is worth one fetch, but a fetch
|
|
77
|
-
* failure must degrade to "read what we have" rather than empty the list.
|
|
78
|
-
*/
|
|
79
|
-
private refresh;
|
|
80
|
-
}
|
|
81
|
-
//# sourceMappingURL=join-requests.service.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"join-requests.service.d.ts","sourceRoot":"","sources":["../../../src/modules/groups/join-requests.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,QAAQ,EACb,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACtB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAwB,KAAK,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAChG,OAAO,EAAoB,KAAK,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAE1E,iEAAiE;AACjE,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,+EAA+E;IAC/E,SAAS,EAAE,YAAY,EAAE,CAAC;CAC3B;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBAAa,mBAAmB;IAE5B,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IACjC,OAAO,CAAC,QAAQ,CAAC,QAAQ;gBADR,gBAAgB,EAAE,gBAAgB,EAClC,QAAQ,EAAE,gBAAgB;IAG7C;;;;;;;OAOG;IACG,IAAI,CACR,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,aAAa,EAAE,EACpB,KAAK,EAAE,QAAQ,GACd,OAAO,CAAC,WAAW,EAAE,CAAC;IA2BzB;;;;OAIG;IACG,SAAS,CACb,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,EAAE,EAAE,aAAa,EACjB,KAAK,EAAE,QAAQ,GACd,OAAO,CAAC,OAAO,CAAC;IAcnB;;;;;;;;;;;OAWG;YACW,MAAM;IAgCpB;;;;;;;OAOG;YACW,MAAM;IAYpB;;;;OAIG;YACW,OAAO;CAKtB"}
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
import { DEFAULT_BRANCH, isJoinBranchFor, } from '@bevel-software/platform-shared';
|
|
2
|
-
import { workspaceIdForBranch } from '../workspace/workspace.service.js';
|
|
3
|
-
import { pendingProposals } from './join-proposals.js';
|
|
4
|
-
/**
|
|
5
|
-
* Join requests as PROPOSALS, and the reconciliation that retires them.
|
|
6
|
-
*
|
|
7
|
-
* The lifecycle has no state of its own — it is derived, every time, from two
|
|
8
|
-
* copies of one file:
|
|
9
|
-
*
|
|
10
|
-
* open the branch's `access.md` grants something the default's does not
|
|
11
|
-
* settled it does not
|
|
12
|
-
*
|
|
13
|
-
* so "approve" is not an operation on the request at all. A manager grants a
|
|
14
|
-
* principal through the ordinary access path (the same lock + commit every
|
|
15
|
-
* other access edit uses, gated the same way), the default branch gains that
|
|
16
|
-
* entry, and the proposal stops being pending because the diff no longer
|
|
17
|
-
* contains it. When the last one goes, the change request has nothing left to
|
|
18
|
-
* say and is rejected, its branch deleted.
|
|
19
|
-
*
|
|
20
|
-
* That reconciliation runs LAZILY on every listing as well as on demand, so a
|
|
21
|
-
* grant made anywhere — this banner, the Manage-access dialog, a hand edit —
|
|
22
|
-
* settles the request that asked for it. Nothing has to remember to.
|
|
23
|
-
*/
|
|
24
|
-
export class JoinRequestsService {
|
|
25
|
-
workspaceService;
|
|
26
|
-
workflow;
|
|
27
|
-
constructor(workspaceService, workflow) {
|
|
28
|
-
this.workspaceService = workspaceService;
|
|
29
|
-
this.workflow = workflow;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Open join requests for `group`, each carrying only its still-pending
|
|
33
|
-
* proposals. Requests with none left are reconciled away (rejected, branch
|
|
34
|
-
* deleted) and omitted.
|
|
35
|
-
*
|
|
36
|
-
* `actor` is who the reconciliation acts as — a manager of the group, since
|
|
37
|
-
* rejecting a change request requires write on everything it touches.
|
|
38
|
-
*/
|
|
39
|
-
async list(group, folder, crs, actor) {
|
|
40
|
-
await this.refresh();
|
|
41
|
-
const accessPath = `${folder}/access.md`;
|
|
42
|
-
const baseText = await this.readAt(DEFAULT_BRANCH, accessPath);
|
|
43
|
-
const out = [];
|
|
44
|
-
for (const cr of crs) {
|
|
45
|
-
if (cr.state !== 'open' || !isJoinBranchFor(cr.branch, group))
|
|
46
|
-
continue;
|
|
47
|
-
const proposals = pendingProposals(await this.readAt(cr.branch, accessPath), baseText, accessPath);
|
|
48
|
-
if (proposals.length === 0) {
|
|
49
|
-
await this.settle(cr, actor);
|
|
50
|
-
continue;
|
|
51
|
-
}
|
|
52
|
-
out.push({
|
|
53
|
-
number: cr.number,
|
|
54
|
-
branch: cr.branch,
|
|
55
|
-
requesterName: cr.appAuthor?.name ?? 'Someone',
|
|
56
|
-
createdAt: cr.createdAt,
|
|
57
|
-
proposals,
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
return out.sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Re-check ONE request and settle it if nothing is pending. Returns whether
|
|
64
|
-
* it was settled. Called right after a grant so the banner updates in the
|
|
65
|
-
* same round-trip instead of waiting for the next listing.
|
|
66
|
-
*/
|
|
67
|
-
async reconcile(group, folder, cr, actor) {
|
|
68
|
-
if (cr.state !== 'open' || !isJoinBranchFor(cr.branch, group))
|
|
69
|
-
return false;
|
|
70
|
-
await this.refresh();
|
|
71
|
-
const accessPath = `${folder}/access.md`;
|
|
72
|
-
const proposals = pendingProposals(await this.readAt(cr.branch, accessPath), await this.readAt(DEFAULT_BRANCH, accessPath), accessPath);
|
|
73
|
-
if (proposals.length > 0)
|
|
74
|
-
return false;
|
|
75
|
-
await this.settle(cr, actor);
|
|
76
|
-
return true;
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Close a request whose proposals have all landed, and delete its branch.
|
|
80
|
-
*
|
|
81
|
-
* Rejecting rather than merging is the point: the grants are already on the
|
|
82
|
-
* default branch, so merging would replay a diff that is now empty of
|
|
83
|
-
* meaning while dragging along anything else the branch carries. The branch
|
|
84
|
-
* goes too — it exists only to hold a proposal that no longer exists.
|
|
85
|
-
*
|
|
86
|
-
* Best-effort by contract: this runs inside a listing, and a request that
|
|
87
|
-
* cannot be closed right now must not take the listing down with it. The
|
|
88
|
-
* next pass tries again.
|
|
89
|
-
*/
|
|
90
|
-
async settle(cr, actor) {
|
|
91
|
-
const wsId = workspaceIdForBranch(DEFAULT_BRANCH);
|
|
92
|
-
try {
|
|
93
|
-
await this.workflow.rejectChangeRequest(cr.number, actor, cr.state, cr.authorId ?? null, cr.base, wsId);
|
|
94
|
-
}
|
|
95
|
-
catch (err) {
|
|
96
|
-
console.warn(`[groups] could not close settled join request #${cr.number}: ${err instanceof Error ? err.message : String(err)}`);
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
try {
|
|
100
|
-
await this.workflow.deleteBranch(wsId, cr.branch, actor);
|
|
101
|
-
}
|
|
102
|
-
catch (err) {
|
|
103
|
-
// The request is closed either way; a leftover branch is cosmetic and
|
|
104
|
-
// the author can still delete it themselves.
|
|
105
|
-
console.warn(`[groups] closed join request #${cr.number} but could not delete "${cr.branch}": ${err instanceof Error ? err.message : String(err)}`);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* The file at one branch, or null when it is absent/unreadable there.
|
|
110
|
-
*
|
|
111
|
-
* Every read runs against the DEFAULT branch's clone at `origin/<branch>`,
|
|
112
|
-
* so one workspace answers for every request and a join branch never needs
|
|
113
|
-
* a clone of its own. `readFileAtRef` takes a REPO-relative path (the KB
|
|
114
|
-
* dir is the repo root there).
|
|
115
|
-
*/
|
|
116
|
-
async readAt(branch, repoRelPath) {
|
|
117
|
-
try {
|
|
118
|
-
return await this.workspaceService.readFileAtRef(workspaceIdForBranch(DEFAULT_BRANCH), `origin/${branch}`, repoRelPath);
|
|
119
|
-
}
|
|
120
|
-
catch {
|
|
121
|
-
return null;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* Refresh remote-tracking refs before reading them. Throttled inside, and
|
|
126
|
-
* best-effort: a request pushed seconds ago is worth one fetch, but a fetch
|
|
127
|
-
* failure must degrade to "read what we have" rather than empty the list.
|
|
128
|
-
*/
|
|
129
|
-
async refresh() {
|
|
130
|
-
await this.workspaceService
|
|
131
|
-
.ensureRemotesFetched(workspaceIdForBranch(DEFAULT_BRANCH))
|
|
132
|
-
.catch(() => undefined);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
//# sourceMappingURL=join-requests.service.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"join-requests.service.js","sourceRoot":"","sources":["../../../src/modules/groups/join-requests.service.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,eAAe,GAIhB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,oBAAoB,EAAyB,MAAM,mCAAmC,CAAC;AAChG,OAAO,EAAE,gBAAgB,EAAqB,MAAM,qBAAqB,CAAC;AAY1E;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,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,MAAM,CAAC,GAAG,CACjD,EAAE,CACH,CAAC;YACF,OAAO;QACT,CAAC;QACD,IAAI,CAAC;YACH,MAAM,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;QAC3D,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,sEAAsE;YACtE,6CAA6C;YAC7C,OAAO,CAAC,IAAI,CACV,iCAAiC,EAAE,CAAC,MAAM,0BAA0B,EAAE,CAAC,MAAM,MAC3E,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CACjD,EAAE,CACH,CAAC;QACJ,CAAC;IACH,CAAC;IAED;;;;;;;OAOG;IACK,KAAK,CAAC,MAAM,CAAC,MAAc,EAAE,WAAmB;QACtD,IAAI,CAAC;YACH,OAAO,MAAM,IAAI,CAAC,gBAAgB,CAAC,aAAa,CAC9C,oBAAoB,CAAC,cAAc,CAAC,EACpC,UAAU,MAAM,EAAE,EAClB,WAAW,CACZ,CAAC;QACJ,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IAED;;;;OAIG;IACK,KAAK,CAAC,OAAO;QACnB,MAAM,IAAI,CAAC,gBAAgB;aACxB,oBAAoB,CAAC,oBAAoB,CAAC,cAAc,CAAC,CAAC;aAC1D,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;IAC5B,CAAC;CACF"}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* In-memory mapping from MCP session id → { userId, tokenId }. Each entry
|
|
3
|
-
* represents one MCP client connection's worth of state: the Bevel user the
|
|
4
|
-
* Bearer token resolved to at `initialize`, and the connection-key id for
|
|
5
|
-
* metering. Conversation continuity is the caller's own (a continuity-aware
|
|
6
|
-
* tool like `ask` returns its `sessionId` in the result and the caller echoes
|
|
7
|
-
* it back); thread/workspace bookkeeping lives on the REST tool surface.
|
|
8
|
-
*
|
|
9
|
-
* Eviction is lazy: each `get` / `touch` sweeps idle entries before the
|
|
10
|
-
* lookup, and `put` enforces the size cap before insert. No background
|
|
11
|
-
* timer — keeps the store cheap to construct and avoids leaking a setInterval
|
|
12
|
-
* handle in tests.
|
|
13
|
-
*
|
|
14
|
-
* Single-replica only. If we add a second backend instance later, sessions
|
|
15
|
-
* need to be persisted (see docs/mcp-remote-access.md → "Out of scope"). The
|
|
16
|
-
* MCP protocol tolerates this — a 404 on an unknown session id is a defined
|
|
17
|
-
* response, and clients re-initialize.
|
|
18
|
-
*/
|
|
19
|
-
export interface McpSession {
|
|
20
|
-
sessionId: string;
|
|
21
|
-
userId: string;
|
|
22
|
-
/**
|
|
23
|
-
* The connection-key id this session authenticated with, or null when the
|
|
24
|
-
* session was opened with a browser JWT (no connection key). Captured at
|
|
25
|
-
* `initialize` so every `ask_bevel_agent` call in the session can be metered
|
|
26
|
-
* against that key's daily token cap.
|
|
27
|
-
*/
|
|
28
|
-
tokenId: string | null;
|
|
29
|
-
createdAt: number;
|
|
30
|
-
lastTouchedAt: number;
|
|
31
|
-
}
|
|
32
|
-
export interface McpSessionStoreOptions {
|
|
33
|
-
/** Drop sessions idle for longer than this. Default: 4 hours. */
|
|
34
|
-
idleTtlMs?: number;
|
|
35
|
-
/** Hard cap on simultaneous live sessions. Oldest-touched evicted first. */
|
|
36
|
-
maxSessions?: number;
|
|
37
|
-
/** Override `Date.now` — injected only by tests. */
|
|
38
|
-
now?: () => number;
|
|
39
|
-
}
|
|
40
|
-
export declare class McpSessionStore {
|
|
41
|
-
private readonly sessions;
|
|
42
|
-
private readonly idleTtlMs;
|
|
43
|
-
private readonly maxSessions;
|
|
44
|
-
private readonly now;
|
|
45
|
-
private readonly evictListeners;
|
|
46
|
-
constructor(opts?: McpSessionStoreOptions);
|
|
47
|
-
/**
|
|
48
|
-
* Subscribe to eviction events. Returns an unsubscribe function so callers
|
|
49
|
-
* can clean up in test teardown. The route layer uses this to drop the
|
|
50
|
-
* transport-state entry in its `active` map and close the underlying SDK
|
|
51
|
-
* transport when the store decides a session has aged out.
|
|
52
|
-
*/
|
|
53
|
-
onEvict(listener: (sessionId: string) => void): () => void;
|
|
54
|
-
/**
|
|
55
|
-
* Register a fresh MCP session. Caller supplies the id (generated by the
|
|
56
|
-
* SDK's transport). Evicts the oldest-touched session if the cap is hit
|
|
57
|
-
* — better than refusing the connection, since a wedged old session is
|
|
58
|
-
* the most likely cause of a full table.
|
|
59
|
-
*/
|
|
60
|
-
create(sessionId: string, userId: string, tokenId?: string | null): McpSession;
|
|
61
|
-
/**
|
|
62
|
-
* Look up a session and bump its `lastTouchedAt`. Returns null when the
|
|
63
|
-
* session is unknown or has aged out. Sweep runs first so an aged entry
|
|
64
|
-
* is collected, not silently revived.
|
|
65
|
-
*/
|
|
66
|
-
get(sessionId: string): McpSession | null;
|
|
67
|
-
delete(sessionId: string): void;
|
|
68
|
-
/** Visible size; useful for diagnostics. Does not sweep. */
|
|
69
|
-
size(): number;
|
|
70
|
-
private sweep;
|
|
71
|
-
private evictOldest;
|
|
72
|
-
private emitEviction;
|
|
73
|
-
}
|
|
74
|
-
//# sourceMappingURL=mcp-session-store.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-session-store.d.ts","sourceRoot":"","sources":["../../../src/modules/mcp/mcp-session-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,MAAM,WAAW,UAAU;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf;;;;;OAKG;IACH,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,sBAAsB;IACrC,iEAAiE;IACjE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,4EAA4E;IAC5E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oDAAoD;IACpD,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;CACpB;AAKD,qBAAa,eAAe;IAC1B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAiC;IAC1D,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IACrC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAe;IASnC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAA0C;gBAE7D,IAAI,GAAE,sBAA2B;IAM7C;;;;;OAKG;IACH,OAAO,CAAC,QAAQ,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,GAAG,MAAM,IAAI;IAO1D;;;;;OAKG;IACH,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,MAAM,GAAG,IAAW,GAAG,UAAU;IAiBpF;;;;OAIG;IACH,GAAG,CAAC,SAAS,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI;IAQzC,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAI/B,4DAA4D;IAC5D,IAAI,IAAI,MAAM;IAId,OAAO,CAAC,KAAK;IAUb,OAAO,CAAC,WAAW;IAenB,OAAO,CAAC,YAAY;CAYrB"}
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* In-memory mapping from MCP session id → { userId, tokenId }. Each entry
|
|
3
|
-
* represents one MCP client connection's worth of state: the Bevel user the
|
|
4
|
-
* Bearer token resolved to at `initialize`, and the connection-key id for
|
|
5
|
-
* metering. Conversation continuity is the caller's own (a continuity-aware
|
|
6
|
-
* tool like `ask` returns its `sessionId` in the result and the caller echoes
|
|
7
|
-
* it back); thread/workspace bookkeeping lives on the REST tool surface.
|
|
8
|
-
*
|
|
9
|
-
* Eviction is lazy: each `get` / `touch` sweeps idle entries before the
|
|
10
|
-
* lookup, and `put` enforces the size cap before insert. No background
|
|
11
|
-
* timer — keeps the store cheap to construct and avoids leaking a setInterval
|
|
12
|
-
* handle in tests.
|
|
13
|
-
*
|
|
14
|
-
* Single-replica only. If we add a second backend instance later, sessions
|
|
15
|
-
* need to be persisted (see docs/mcp-remote-access.md → "Out of scope"). The
|
|
16
|
-
* MCP protocol tolerates this — a 404 on an unknown session id is a defined
|
|
17
|
-
* response, and clients re-initialize.
|
|
18
|
-
*/
|
|
19
|
-
const DEFAULT_IDLE_TTL_MS = 4 * 60 * 60 * 1000;
|
|
20
|
-
const DEFAULT_MAX_SESSIONS = 5000;
|
|
21
|
-
export class McpSessionStore {
|
|
22
|
-
sessions = new Map();
|
|
23
|
-
idleTtlMs;
|
|
24
|
-
maxSessions;
|
|
25
|
-
now;
|
|
26
|
-
// Subscribers notified whenever a session is dropped by the store itself
|
|
27
|
-
// (idle TTL sweep or size-cap eviction). NOT fired by explicit `delete()` —
|
|
28
|
-
// the caller of `delete` already knows the session is gone, and the route
|
|
29
|
-
// layer uses `delete` *because* it's already cleaning up.
|
|
30
|
-
//
|
|
31
|
-
// Callbacks are invoked synchronously; long-running cleanup (e.g.
|
|
32
|
-
// `transport.close()`) should be fire-and-forget so a slow listener can't
|
|
33
|
-
// block the next eviction.
|
|
34
|
-
evictListeners = new Set();
|
|
35
|
-
constructor(opts = {}) {
|
|
36
|
-
this.idleTtlMs = opts.idleTtlMs ?? DEFAULT_IDLE_TTL_MS;
|
|
37
|
-
this.maxSessions = opts.maxSessions ?? DEFAULT_MAX_SESSIONS;
|
|
38
|
-
this.now = opts.now ?? Date.now;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Subscribe to eviction events. Returns an unsubscribe function so callers
|
|
42
|
-
* can clean up in test teardown. The route layer uses this to drop the
|
|
43
|
-
* transport-state entry in its `active` map and close the underlying SDK
|
|
44
|
-
* transport when the store decides a session has aged out.
|
|
45
|
-
*/
|
|
46
|
-
onEvict(listener) {
|
|
47
|
-
this.evictListeners.add(listener);
|
|
48
|
-
return () => {
|
|
49
|
-
this.evictListeners.delete(listener);
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Register a fresh MCP session. Caller supplies the id (generated by the
|
|
54
|
-
* SDK's transport). Evicts the oldest-touched session if the cap is hit
|
|
55
|
-
* — better than refusing the connection, since a wedged old session is
|
|
56
|
-
* the most likely cause of a full table.
|
|
57
|
-
*/
|
|
58
|
-
create(sessionId, userId, tokenId = null) {
|
|
59
|
-
this.sweep();
|
|
60
|
-
if (this.sessions.size >= this.maxSessions) {
|
|
61
|
-
this.evictOldest();
|
|
62
|
-
}
|
|
63
|
-
const now = this.now();
|
|
64
|
-
const session = {
|
|
65
|
-
sessionId,
|
|
66
|
-
userId,
|
|
67
|
-
tokenId,
|
|
68
|
-
createdAt: now,
|
|
69
|
-
lastTouchedAt: now,
|
|
70
|
-
};
|
|
71
|
-
this.sessions.set(sessionId, session);
|
|
72
|
-
return session;
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Look up a session and bump its `lastTouchedAt`. Returns null when the
|
|
76
|
-
* session is unknown or has aged out. Sweep runs first so an aged entry
|
|
77
|
-
* is collected, not silently revived.
|
|
78
|
-
*/
|
|
79
|
-
get(sessionId) {
|
|
80
|
-
this.sweep();
|
|
81
|
-
const session = this.sessions.get(sessionId);
|
|
82
|
-
if (!session)
|
|
83
|
-
return null;
|
|
84
|
-
session.lastTouchedAt = this.now();
|
|
85
|
-
return session;
|
|
86
|
-
}
|
|
87
|
-
delete(sessionId) {
|
|
88
|
-
this.sessions.delete(sessionId);
|
|
89
|
-
}
|
|
90
|
-
/** Visible size; useful for diagnostics. Does not sweep. */
|
|
91
|
-
size() {
|
|
92
|
-
return this.sessions.size;
|
|
93
|
-
}
|
|
94
|
-
sweep() {
|
|
95
|
-
const cutoff = this.now() - this.idleTtlMs;
|
|
96
|
-
for (const [id, s] of this.sessions) {
|
|
97
|
-
if (s.lastTouchedAt < cutoff) {
|
|
98
|
-
this.sessions.delete(id);
|
|
99
|
-
this.emitEviction(id);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
evictOldest() {
|
|
104
|
-
let oldestId = null;
|
|
105
|
-
let oldestTouched = Infinity;
|
|
106
|
-
for (const [id, s] of this.sessions) {
|
|
107
|
-
if (s.lastTouchedAt < oldestTouched) {
|
|
108
|
-
oldestTouched = s.lastTouchedAt;
|
|
109
|
-
oldestId = id;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
if (oldestId) {
|
|
113
|
-
this.sessions.delete(oldestId);
|
|
114
|
-
this.emitEviction(oldestId);
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
emitEviction(sessionId) {
|
|
118
|
-
for (const listener of this.evictListeners) {
|
|
119
|
-
try {
|
|
120
|
-
listener(sessionId);
|
|
121
|
-
}
|
|
122
|
-
catch (err) {
|
|
123
|
-
// A misbehaving listener must not stop the sweep from finishing —
|
|
124
|
-
// otherwise one bad subscriber would block the rest of the eviction
|
|
125
|
-
// pass and leak more sessions.
|
|
126
|
-
console.warn('[mcp-session-store] eviction listener threw:', err);
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
//# sourceMappingURL=mcp-session-store.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-session-store.js","sourceRoot":"","sources":["../../../src/modules/mcp/mcp-session-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAyBH,MAAM,mBAAmB,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAC/C,MAAM,oBAAoB,GAAG,IAAI,CAAC;AAElC,MAAM,OAAO,eAAe;IACT,QAAQ,GAAG,IAAI,GAAG,EAAsB,CAAC;IACzC,SAAS,CAAS;IAClB,WAAW,CAAS;IACpB,GAAG,CAAe;IACnC,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AAC;QAC9B,CAAC;IACH,CAAC;IAEO,YAAY,CAAC,SAAiB;QACpC,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,cAAc,EAAE,CAAC;YAC3C,IAAI,CAAC;gBACH,QAAQ,CAAC,SAAS,CAAC,CAAC;YACtB,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,kEAAkE;gBAClE,oEAAoE;gBACpE,+BAA+B;gBAC/B,OAAO,CAAC,IAAI,CAAC,8CAA8C,EAAE,GAAG,CAAC,CAAC;YACpE,CAAC;QACH,CAAC;IACH,CAAC;CACF"}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* One in-process notification fired AFTER a set of file changes is committed +
|
|
3
|
-
* pushed (post-lock-release), so backend services can react to KB writes without
|
|
4
|
-
* the per-file TTL wait. Distinct from the SSE `WorkflowEventBus`, which fans
|
|
5
|
-
* scoped events to browser sessions; this is an unscoped, server-side domain hook.
|
|
6
|
-
*
|
|
7
|
-
* BATCHED by design: a single-file save emits `paths: [p]`, a batch write
|
|
8
|
-
* (`LockingFilesystem.writeFiles`, e.g. a bulk node upload) emits ONE event with
|
|
9
|
-
* every path it committed. Subscribers that do expensive per-event work (the
|
|
10
|
-
* id-repair rebuilds the id index) handle a whole batch off one rebuild instead
|
|
11
|
-
* of N back-to-back ones.
|
|
12
|
-
*
|
|
13
|
-
* Emitted from the two post-commit chokepoints (`WorkflowService.runPendingCommit`
|
|
14
|
-
* for single-file writes, `LockingFilesystem.writeFiles` for batches).
|
|
15
|
-
*
|
|
16
|
-
* Every listener is invoked inside try/catch — a throwing subscriber must never
|
|
17
|
-
* fail the commit that triggered it (mirrors the SSE bus's per-subscriber
|
|
18
|
-
* isolation). Firing is fire-and-forget; a listener that needs to write files
|
|
19
|
-
* (id-repair) does so on its own, after the locks have already been released.
|
|
20
|
-
*/
|
|
21
|
-
import type { AuthUser } from '@bevel-software/platform-shared';
|
|
22
|
-
export interface FilesChange {
|
|
23
|
-
workspaceId: string;
|
|
24
|
-
branch: string;
|
|
25
|
-
/** Workspace-relative paths committed in this change (≥1; sorted for batches). */
|
|
26
|
-
paths: string[];
|
|
27
|
-
/** Who the change was committed as — a reacting write (id-repair) acts as the same user. */
|
|
28
|
-
byUser: AuthUser;
|
|
29
|
-
}
|
|
30
|
-
export type FilesChangedListener = (change: FilesChange) => void;
|
|
31
|
-
export declare class FileChangeNotifier {
|
|
32
|
-
private readonly listeners;
|
|
33
|
-
/** Register a listener. Returns an unsubscribe fn. */
|
|
34
|
-
onFilesChanged(listener: FilesChangedListener): () => void;
|
|
35
|
-
/** Fan a change out to every listener; isolate + log each so one can't break the commit. */
|
|
36
|
-
emit(change: FilesChange): void;
|
|
37
|
-
}
|
|
38
|
-
//# sourceMappingURL=file-change-notifier.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"file-change-notifier.d.ts","sourceRoot":"","sources":["../../../src/modules/workflow/file-change-notifier.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAEhE,MAAM,WAAW,WAAW;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,kFAAkF;IAClF,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,4FAA4F;IAC5F,MAAM,EAAE,QAAQ,CAAC;CAClB;AAED,MAAM,MAAM,oBAAoB,GAAG,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,CAAC;AAEjE,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAmC;IAE7D,sDAAsD;IACtD,cAAc,CAAC,QAAQ,EAAE,oBAAoB,GAAG,MAAM,IAAI;IAK1D,4FAA4F;IAC5F,IAAI,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI;CAUhC"}
|