@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
|
@@ -16,13 +16,10 @@ import {
|
|
|
16
16
|
DefaultVariableSubstitutor,
|
|
17
17
|
type CallTemplate,
|
|
18
18
|
} from '@utcp/sdk';
|
|
19
|
-
import {
|
|
20
|
-
DEFAULT_BRANCH,
|
|
21
|
-
PLUGINS_DIR,
|
|
22
|
-
} from '@bevel-software/platform-shared';
|
|
23
19
|
import { descriptorsFromMcpJson } from './mcp-json-discovery.js';
|
|
24
20
|
import type { PluginSource } from '../plugins/discovery/plugin-source.js';
|
|
25
21
|
import type { WorkspaceService } from '../workspace/workspace.service.js';
|
|
22
|
+
import type { KbContext } from '../../shared/kb-context.js';
|
|
26
23
|
import { workspaceIdForBranch } from '../../shared/workspace-id.js';
|
|
27
24
|
import type { IAccessControl } from '../access/access-control.interface.js';
|
|
28
25
|
import { assertSafeFetchUrl } from '../../shared/ssrf.js';
|
|
@@ -265,7 +262,7 @@ export class ToolManualService implements IToolManualService {
|
|
|
265
262
|
constructor(
|
|
266
263
|
private readonly workspaceService: WorkspaceService,
|
|
267
264
|
private readonly accessControl: IAccessControl,
|
|
268
|
-
private readonly
|
|
265
|
+
private readonly kb: KbContext,
|
|
269
266
|
private readonly disk: ITreeWalker,
|
|
270
267
|
/** Where plugins (and their MCP servers) come from — the one discovery every catalog shares. */
|
|
271
268
|
private readonly source: PluginSource,
|
|
@@ -274,6 +271,10 @@ export class ToolManualService implements IToolManualService {
|
|
|
274
271
|
this.cache = new TtlCache(CACHE_TTL_MS, now);
|
|
275
272
|
}
|
|
276
273
|
|
|
274
|
+
private get kbDirName(): string {
|
|
275
|
+
return this.kb.kbDirName;
|
|
276
|
+
}
|
|
277
|
+
|
|
277
278
|
/**
|
|
278
279
|
* Wire the MCP OAuth auto-discovery (setter injection: the discovery service
|
|
279
280
|
* depends on the vault, which is constructed after this service — the same
|
|
@@ -329,7 +330,7 @@ export class ToolManualService implements IToolManualService {
|
|
|
329
330
|
userEmail: string,
|
|
330
331
|
branch: string,
|
|
331
332
|
): Promise<{ name: string; path: string; type: ToolManualType }[]> {
|
|
332
|
-
if (!branch || branch ===
|
|
333
|
+
if (!branch || branch === this.kb.defaultBranch) return [];
|
|
333
334
|
// Only a draft this process already holds a clone of — the one the caller
|
|
334
335
|
// wrote the declaration on. `scanDisk` would otherwise BOOTSTRAP any branch
|
|
335
336
|
// name a caller sends, before the read gate below has had a say: a clone
|
|
@@ -456,7 +457,7 @@ export class ToolManualService implements IToolManualService {
|
|
|
456
457
|
async resolveInlineManual(userEmail: string, slug: string): Promise<UtcpManualDict | null> {
|
|
457
458
|
const found = (await this.scan()).manuals.find((m) => m.slug === slug);
|
|
458
459
|
if (!found || found.type !== 'inline') return null;
|
|
459
|
-
const wsId =
|
|
460
|
+
const wsId = this.kb.defaultWorkspaceId();
|
|
460
461
|
if (!(await this.accessControl.canRead(wsId, userEmail, found.path))) return null;
|
|
461
462
|
try {
|
|
462
463
|
return manualSerializer.validateDict({
|
|
@@ -582,7 +583,7 @@ export class ToolManualService implements IToolManualService {
|
|
|
582
583
|
private async accessibleScan(userEmail: string): Promise<ScanResult> {
|
|
583
584
|
const { manuals, invalid } = await this.scan();
|
|
584
585
|
if (manuals.length === 0 && invalid.length === 0) return emptyScan();
|
|
585
|
-
const wsId =
|
|
586
|
+
const wsId = this.kb.defaultWorkspaceId();
|
|
586
587
|
const allowed = await this.accessControl.canReadBatch(wsId, userEmail, [
|
|
587
588
|
...new Set([...manuals.map((m) => m.path), ...invalid.map((i) => i.path)]),
|
|
588
589
|
]);
|
|
@@ -859,7 +860,7 @@ export class ToolManualService implements IToolManualService {
|
|
|
859
860
|
* calls: a refusal lives only in the scan it came from, so a fixed file is a
|
|
860
861
|
* valid manual on the very next scan.
|
|
861
862
|
*/
|
|
862
|
-
private async scanDisk(branch: string =
|
|
863
|
+
private async scanDisk(branch: string = this.kb.defaultBranch): Promise<ScanResult> {
|
|
863
864
|
let wsId: string;
|
|
864
865
|
try {
|
|
865
866
|
wsId = (await this.workspaceService.getOrCreateForBranch(branch)).id;
|
|
@@ -870,9 +871,10 @@ export class ToolManualService implements IToolManualService {
|
|
|
870
871
|
|
|
871
872
|
// A `.tool` sits under `Plugins/`, beside the skills that use it.
|
|
872
873
|
const files: { abs: string; rel: string }[] = [];
|
|
873
|
-
const
|
|
874
|
+
const layout = this.kb.layout;
|
|
875
|
+
const root = path.join(kbRoot, layout.pluginsDir);
|
|
874
876
|
for (const rel of await this.disk.walkFiles(root, (n) => n.toLowerCase().endsWith('.tool'))) {
|
|
875
|
-
files.push({ abs: path.join(root, rel), rel: `${
|
|
877
|
+
files.push({ abs: path.join(root, rel), rel: `${layout.pluginsDir}/${rel}` });
|
|
876
878
|
}
|
|
877
879
|
|
|
878
880
|
// MCP servers come from each plugin's mcp.json — the AUTHORITATIVE source
|
|
@@ -891,7 +893,7 @@ export class ToolManualService implements IToolManualService {
|
|
|
891
893
|
// (a URL, a header, an added or dropped server, a `local: true` flip)
|
|
892
894
|
// moves every server's digest — which is correct, if slightly generous.
|
|
893
895
|
const from = sourceDigest(plugin.mcpJsonText + '\u0000' + (plugin.manifestText ?? ''));
|
|
894
|
-
for (const d of descriptorsFromMcpJson(plugin.relFolder, plugin.mcpJsonText, plugin.manifestText)) {
|
|
896
|
+
for (const d of descriptorsFromMcpJson(plugin.relFolder, plugin.mcpJsonText, plugin.manifestText, layout)) {
|
|
895
897
|
d.sourceRevision = from;
|
|
896
898
|
parsed.push(d);
|
|
897
899
|
}
|
|
@@ -974,7 +976,7 @@ export class ToolManualService implements IToolManualService {
|
|
|
974
976
|
// Only the CATALOG's scan talks. `listDeclaredOnlyOnBranch` re-scans a
|
|
975
977
|
// draft workspace, and a draft's half-written `.tool` is not news about the
|
|
976
978
|
// served catalog — it would also flap the log every time an agent saves.
|
|
977
|
-
if (branch ===
|
|
979
|
+
if (branch === this.kb.defaultBranch) this.logInvalidOnChange(invalid);
|
|
978
980
|
return { manuals, invalid };
|
|
979
981
|
}
|
|
980
982
|
}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import type { Router, RequestHandler } from 'express';
|
|
2
|
-
import { DEFAULT_BRANCH } from '@bevel-software/platform-shared';
|
|
3
2
|
import type { IToolRegistry, UtcpTool } from '../tool-registry/tool.contract.js';
|
|
3
|
+
import type { KbContext } from '../../shared/kb-context.js';
|
|
4
4
|
import type { ToolContext } from '../tool-helpers/tool.contract.js';
|
|
5
5
|
import { toolDef } from '../tool-helpers/tool-def.js';
|
|
6
6
|
import type { ToolHandlerFactory } from '../tool-helpers/tool-handler.js';
|
|
7
7
|
import type { IAccessControl } from '../access/access-control.interface.js';
|
|
8
|
-
import { workspaceIdForBranch } from '../../shared/workspace-id.js';
|
|
9
8
|
import { utcpNamespacedKey } from '../../shared/utcp-namespace.js';
|
|
10
9
|
import type { IToolManualService } from './tool-manuals.contract.js';
|
|
11
10
|
|
|
@@ -42,6 +41,8 @@ export function registerToolManualsTools(
|
|
|
42
41
|
deps: {
|
|
43
42
|
accessControl: IAccessControl;
|
|
44
43
|
variableStatus: VariableStatusPort;
|
|
44
|
+
/** Which branch tools are served from, and its clone. */
|
|
45
|
+
kb: Pick<KbContext, 'defaultBranch' | 'defaultWorkspaceId'>;
|
|
45
46
|
},
|
|
46
47
|
): void {
|
|
47
48
|
registry.registerExternalTool((ctx) => buildListLocalToolsDef(toolManualService, ctx.userEmail));
|
|
@@ -57,9 +58,9 @@ export function registerToolManualsTools(
|
|
|
57
58
|
|
|
58
59
|
// A FUNCTION, not a constant — this factory runs at boot, and on a
|
|
59
60
|
// setup-screen deployment the branch model is applied AFTER boot. Only a
|
|
60
|
-
// read inside a handler body sees the configured
|
|
61
|
+
// read inside a handler body sees the configured default branch; a
|
|
61
62
|
// construction-time capture would hold the empty pre-setup id until restart.
|
|
62
|
-
const defaultWs = () =>
|
|
63
|
+
const defaultWs = () => deps.kb.defaultWorkspaceId();
|
|
63
64
|
const varKey = (manualName: string, varName: string) => utcpNamespacedKey(manualName, varName);
|
|
64
65
|
|
|
65
66
|
const listSetupDef = toolDef({
|
|
@@ -235,9 +236,9 @@ export function registerToolManualsTools(
|
|
|
235
236
|
onBranchOnly,
|
|
236
237
|
note:
|
|
237
238
|
`${onBranchOnly.map((p) => `\`${p.name}\``).join(', ')} ${onBranchOnly.length === 1 ? 'is' : 'are'} declared on ` +
|
|
238
|
-
`\`${branch}\` only. Tools are served from \`${
|
|
239
|
+
`\`${branch}\` only. Tools are served from \`${deps.kb.defaultBranch}\`, so ${onBranchOnly.length === 1 ? 'it stays' : 'they stay'} ` +
|
|
239
240
|
'unlisted, uncallable and without a sign-in until that branch is merged: open a change request with ' +
|
|
240
|
-
`\`open_change_request\` (target \`${
|
|
241
|
+
`\`open_change_request\` (target \`${deps.kb.defaultBranch}\`), then ask the user to review and merge it in the app.`,
|
|
241
242
|
};
|
|
242
243
|
}),
|
|
243
244
|
);
|
|
@@ -4,6 +4,7 @@ import path from 'node:path';
|
|
|
4
4
|
import type { AddressInfo } from 'node:net';
|
|
5
5
|
import express from 'express';
|
|
6
6
|
import { describe, it, expect, afterEach, vi } from 'vitest';
|
|
7
|
+
import { testKbContext } from '../../../__tests__/kb-context.js';
|
|
7
8
|
import type { AuthUser, FileApprovalState, IWorkflowService, WorkflowEvent } from '@bevel-software/platform-shared';
|
|
8
9
|
import type { IAccessControl } from '../../access/access-control.interface.js';
|
|
9
10
|
import type { AuthService } from '../../auth/auth.service.js';
|
|
@@ -382,7 +383,7 @@ function service(
|
|
|
382
383
|
{} as IAccessControl,
|
|
383
384
|
{} as FileLockService,
|
|
384
385
|
{} as PendingCommitsService,
|
|
385
|
-
|
|
386
|
+
testKbContext(),
|
|
386
387
|
openChangeGate(),
|
|
387
388
|
{ emit } as unknown as WorkflowEventBus,
|
|
388
389
|
);
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
branchModelFromEnv,
|
|
5
|
-
configureBranchModel,
|
|
6
|
-
type WorkflowEvent,
|
|
7
|
-
} from '@bevel-software/platform-shared';
|
|
1
|
+
import { describe, it, expect, vi } from 'vitest';
|
|
2
|
+
import { testKbContext } from '../../../__tests__/kb-context.js';
|
|
3
|
+
import type { WorkflowEvent } from '@bevel-software/platform-shared';
|
|
8
4
|
|
|
9
5
|
import type { GitService } from '../git/git.service.js';
|
|
10
6
|
import type { PullRequestService } from '../git/pull-request.service.js';
|
|
@@ -47,24 +43,16 @@ const USER = { id: 'u1', email: 'someone@x.com', name: 'Someone' };
|
|
|
47
43
|
/**
|
|
48
44
|
* A default branch this deployment chose, pinned for the whole file.
|
|
49
45
|
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
* these assertions agree with whatever
|
|
46
|
+
* The environment's pair (which `test-setup.ts` mirrors onto the shared
|
|
47
|
+
* bindings) is what most fixtures run under, so a service that read THAT
|
|
48
|
+
* would make these assertions agree with whatever it happens to say — and a
|
|
53
49
|
* regression that hardcoded a branch name would still pass wherever the two
|
|
54
50
|
* coincided. Deliberately NOT `main`, so `main` written into the emit would
|
|
55
|
-
* fail here rather than slip through.
|
|
51
|
+
* fail here rather than slip through. The service is handed this model by
|
|
52
|
+
* constructor, so nothing process-wide changes for the files after this one.
|
|
56
53
|
*/
|
|
57
54
|
const TRUNK = 'trunk';
|
|
58
|
-
|
|
59
|
-
beforeAll(() => {
|
|
60
|
-
configureBranchModel({ defaultBranch: TRUNK, protectedBranches: [TRUNK] });
|
|
61
|
-
});
|
|
62
|
-
afterAll(() => {
|
|
63
|
-
// Back to what the suite booted with: the binding is process-wide, and a
|
|
64
|
-
// file that leaves its own branch model behind changes the meaning of
|
|
65
|
-
// anything that runs after it in the same worker.
|
|
66
|
-
configureBranchModel(branchModelFromEnv());
|
|
67
|
-
});
|
|
55
|
+
const kb = testKbContext({ kbDirName: KB_DIR, branchModel: { defaultBranch: TRUNK, protectedBranches: [TRUNK] } });
|
|
68
56
|
|
|
69
57
|
function noopAccessControl(): IAccessControl {
|
|
70
58
|
return { invalidate: vi.fn() } as unknown as IAccessControl;
|
|
@@ -120,7 +108,7 @@ function makeSvc(
|
|
|
120
108
|
noopAccessControl(),
|
|
121
109
|
{ acquire: vi.fn(), release: vi.fn() } as unknown as FileLockService,
|
|
122
110
|
{} as unknown as PendingCommitsService,
|
|
123
|
-
|
|
111
|
+
kb,
|
|
124
112
|
openChangeGate(),
|
|
125
113
|
bus,
|
|
126
114
|
);
|
|
@@ -145,10 +133,10 @@ describe('applying a change request announces the tree it rewrote', () => {
|
|
|
145
133
|
expect(treeEvents()).toEqual([
|
|
146
134
|
{ kind: 'fs-tree-changed', workspaceId: encodeURIComponent(TRUNK), branch: TRUNK },
|
|
147
135
|
]);
|
|
148
|
-
// The deployment's own default branch, read from the
|
|
149
|
-
// written into the emit: these two are the same
|
|
150
|
-
// branch name would make them differ.
|
|
151
|
-
expect(
|
|
136
|
+
// The deployment's own default branch, read from the context the service
|
|
137
|
+
// was handed rather than written into the emit: these two are the same
|
|
138
|
+
// thing, and a hardcoded branch name would make them differ.
|
|
139
|
+
expect(kb.defaultBranch).toBe(TRUNK);
|
|
152
140
|
});
|
|
153
141
|
|
|
154
142
|
/**
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';
|
|
2
|
+
import { testKbContext } from '../../../__tests__/kb-context.js';
|
|
2
3
|
import { promises as fs } from 'node:fs';
|
|
3
4
|
import path from 'node:path';
|
|
4
5
|
import os from 'node:os';
|
|
@@ -120,7 +121,7 @@ describe('mergeChangeRequest — roles.yaml preservation guard', () => {
|
|
|
120
121
|
{} as unknown as Database,
|
|
121
122
|
git, prs, reviewWorkflow, workspaceService, ac,
|
|
122
123
|
fileLocks, {} as unknown as PendingCommitsService,
|
|
123
|
-
KB_DIR,
|
|
124
|
+
testKbContext({ kbDirName: KB_DIR }),
|
|
124
125
|
openChangeGate(),
|
|
125
126
|
);
|
|
126
127
|
// Conflicts are now surfaced by the local merge inside `reviewWorkflow.mergePr`
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { describe, it, expect, beforeEach, vi } from 'vitest';
|
|
2
|
+
import { testKbContext } from '../../../__tests__/kb-context.js';
|
|
2
3
|
|
|
3
4
|
import { SessionOntologyService } from '../session-ontology.service.js';
|
|
4
5
|
import type { Database } from '../../database/connection.js';
|
|
@@ -90,7 +91,7 @@ vi.mock('drizzle-orm', async (importOriginal) => {
|
|
|
90
91
|
|
|
91
92
|
function makeService() {
|
|
92
93
|
const db = makeFakeDb();
|
|
93
|
-
return { svc: new SessionOntologyService(db as unknown as Database), db };
|
|
94
|
+
return { svc: new SessionOntologyService(db as unknown as Database, testKbContext()), db };
|
|
94
95
|
}
|
|
95
96
|
|
|
96
97
|
describe('SessionOntologyService (touched-set model)', () => {
|
|
@@ -157,7 +158,7 @@ describe('SessionOntologyService (touched-set model)', () => {
|
|
|
157
158
|
it('survives a "restart": a new instance re-reads the touched set from the store', async () => {
|
|
158
159
|
await svc.checkOperation('s1', P_READ, false);
|
|
159
160
|
await svc.checkOperation('s1', PL_READ, false);
|
|
160
|
-
const afterRestart = new SessionOntologyService(db as unknown as Database);
|
|
161
|
+
const afterRestart = new SessionOntologyService(db as unknown as Database, testKbContext());
|
|
161
162
|
// The poison persists across the restart: writes still blocked.
|
|
162
163
|
expect((await afterRestart.checkOperation('s1', P_READ, true)).allow).toBe(false);
|
|
163
164
|
});
|
|
@@ -2,6 +2,7 @@ import type { Server } from 'node:http';
|
|
|
2
2
|
import type { AddressInfo } from 'node:net';
|
|
3
3
|
import express from 'express';
|
|
4
4
|
import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';
|
|
5
|
+
import { testKbContext } from '../../../__tests__/kb-context.js';
|
|
5
6
|
import type { AuthUser, Change, IWorkflowService } from '@bevel-software/platform-shared';
|
|
6
7
|
import type { Database } from '../../database/connection.js';
|
|
7
8
|
import type { IAccessControl } from '../../access/access-control.interface.js';
|
|
@@ -79,7 +80,7 @@ async function makeHarness(): Promise<Harness> {
|
|
|
79
80
|
{} as IAccessControl,
|
|
80
81
|
new FileLockService(fake.db),
|
|
81
82
|
pending,
|
|
82
|
-
KB,
|
|
83
|
+
testKbContext({ kbDirName: KB }),
|
|
83
84
|
openChangeGate(),
|
|
84
85
|
events,
|
|
85
86
|
);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { describe, it, expect, vi
|
|
1
|
+
import { describe, it, expect, vi } from 'vitest';
|
|
2
|
+
import { testKbContext } from '../../../__tests__/kb-context.js';
|
|
2
3
|
import { drizzle } from 'drizzle-orm/pg-proxy';
|
|
3
|
-
import { configureBranchModel } from '@bevel-software/platform-shared';
|
|
4
4
|
import type { GitService } from '../git/git.service.js';
|
|
5
5
|
import type { PullRequestService } from '../git/pull-request.service.js';
|
|
6
6
|
import type { IReviewWorkflowService } from '../review-workflow/review-workflow.interface.js';
|
|
@@ -103,7 +103,7 @@ function makeService(db: Database, git: Partial<GitService>) {
|
|
|
103
103
|
{} as IAccessControl,
|
|
104
104
|
{} as FileLockService,
|
|
105
105
|
{} as PendingCommitsService,
|
|
106
|
-
|
|
106
|
+
testKbContext(),
|
|
107
107
|
openChangeGate(),
|
|
108
108
|
);
|
|
109
109
|
}
|
|
@@ -132,13 +132,6 @@ function retire(svc: WorkflowService, number: number, base: string) {
|
|
|
132
132
|
).retireMergedSourceBranch(number, base, USER);
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
-
beforeEach(() => {
|
|
136
|
-
configureBranchModel({
|
|
137
|
-
defaultBranch: 'target-company-state',
|
|
138
|
-
protectedBranches: ['current-company-state', 'target-company-state'],
|
|
139
|
-
});
|
|
140
|
-
});
|
|
141
|
-
|
|
142
135
|
describe('post-merge branch retirement', () => {
|
|
143
136
|
it('keeps a branch another open request proposes INTO', async () => {
|
|
144
137
|
const deleted: string[] = [];
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
|
2
|
+
import { testKbContext } from '../../../__tests__/kb-context.js';
|
|
2
3
|
import type { AuthUser, Change } from '@bevel-software/platform-shared';
|
|
3
4
|
import type { GitService } from '../git/git.service.js';
|
|
4
5
|
import type { PullRequestService } from '../git/pull-request.service.js';
|
|
@@ -113,7 +114,7 @@ function makeFacade(git: GitService, locks: FileLockService, events: WorkflowEve
|
|
|
113
114
|
{} as IAccessControl,
|
|
114
115
|
locks,
|
|
115
116
|
pending,
|
|
116
|
-
|
|
117
|
+
testKbContext(),
|
|
117
118
|
openChangeGate(),
|
|
118
119
|
events,
|
|
119
120
|
);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { describe, it, expect, vi
|
|
2
|
-
import {
|
|
1
|
+
import { describe, it, expect, vi } from 'vitest';
|
|
2
|
+
import { testKbContext } from '../../../__tests__/kb-context.js';
|
|
3
3
|
import type { GitService } from '../git/git.service.js';
|
|
4
4
|
import type { PullRequestService } from '../git/pull-request.service.js';
|
|
5
5
|
import type { IReviewWorkflowService } from '../review-workflow/review-workflow.interface.js';
|
|
@@ -67,7 +67,7 @@ function makeService(open: OpenRow[], listBranches: () => Promise<{ name: string
|
|
|
67
67
|
{} as IAccessControl,
|
|
68
68
|
{} as FileLockService,
|
|
69
69
|
{} as PendingCommitsService,
|
|
70
|
-
|
|
70
|
+
testKbContext(),
|
|
71
71
|
openChangeGate(),
|
|
72
72
|
);
|
|
73
73
|
(svc as unknown as { events?: { emit(e: unknown): void } }).events = {
|
|
@@ -76,13 +76,6 @@ function makeService(open: OpenRow[], listBranches: () => Promise<{ name: string
|
|
|
76
76
|
return { svc, git, invalidated, emitted };
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
beforeEach(() => {
|
|
80
|
-
configureBranchModel({
|
|
81
|
-
defaultBranch: 'target-company-state',
|
|
82
|
-
protectedBranches: ['current-company-state', 'target-company-state'],
|
|
83
|
-
});
|
|
84
|
-
});
|
|
85
|
-
|
|
86
79
|
describe('closeChangeRequestsWithDeletedBranches', () => {
|
|
87
80
|
it('closes a request whose source branch is gone', async () => {
|
|
88
81
|
const { svc, invalidated, emitted } = makeService(
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { describe, it, expect, vi } from 'vitest';
|
|
2
|
+
import { testKbContext } from '../../../__tests__/kb-context.js';
|
|
2
3
|
import type {
|
|
3
4
|
AuthUser,
|
|
4
5
|
ChangeInput,
|
|
@@ -13,7 +14,7 @@ import { FileLockService } from '../file-lock.service.js';
|
|
|
13
14
|
import { PendingCommitsService } from '../pending-commits.service.js';
|
|
14
15
|
import { WorkflowService } from '../workflow.service.js';
|
|
15
16
|
import { PullRebaseConflictError, WorkflowDomainError } from '../../../shared/domain-errors.js';
|
|
16
|
-
import { DEFAULT_BRANCH
|
|
17
|
+
import { DEFAULT_BRANCH } from '@bevel-software/platform-shared';
|
|
17
18
|
import type { Database } from '../../database/connection.js';
|
|
18
19
|
import { openChangeGate } from '../../../__tests__/open-change-gate.js';
|
|
19
20
|
|
|
@@ -238,7 +239,7 @@ describe('WorkflowService — branch delegation', () => {
|
|
|
238
239
|
const branches = [{ name: 'main', isCurrent: true, isProtected: true, ahead: 0, behind: 0, hasRemote: true }];
|
|
239
240
|
(git.listBranches as ReturnType<typeof vi.fn>).mockResolvedValue(branches);
|
|
240
241
|
|
|
241
|
-
const svc = new WorkflowService(makeDb(), git, makePrs(), makeReviewWorkflow(), makeWorkspaceService(), makeAccessControl(), makeFileLockService(), makePendingCommits(),
|
|
242
|
+
const svc = new WorkflowService(makeDb(), git, makePrs(), makeReviewWorkflow(), makeWorkspaceService(), makeAccessControl(), makeFileLockService(), makePendingCommits(), testKbContext(), openChangeGate());
|
|
242
243
|
await expect(svc.listBranches('w1')).resolves.toBe(branches);
|
|
243
244
|
// listBranches(workspaceId, opts?) forwards opts — undefined when omitted.
|
|
244
245
|
expect(git.listBranches).toHaveBeenCalledWith('w1', undefined);
|
|
@@ -248,7 +249,7 @@ describe('WorkflowService — branch delegation', () => {
|
|
|
248
249
|
const git = makeGit();
|
|
249
250
|
(git.createBranch as ReturnType<typeof vi.fn>).mockResolvedValue({ name: 'feat' });
|
|
250
251
|
|
|
251
|
-
const svc = new WorkflowService(makeDb(), git, makePrs(), makeReviewWorkflow(), makeWorkspaceService(), makeAccessControl(), makeFileLockService(), makePendingCommits(),
|
|
252
|
+
const svc = new WorkflowService(makeDb(), git, makePrs(), makeReviewWorkflow(), makeWorkspaceService(), makeAccessControl(), makeFileLockService(), makePendingCommits(), testKbContext(), openChangeGate());
|
|
252
253
|
await svc.createBranch('w1', 'feat', 'current-company-state');
|
|
253
254
|
expect(git.createBranch).toHaveBeenCalledWith('w1', 'feat', 'current-company-state');
|
|
254
255
|
});
|
|
@@ -258,7 +259,7 @@ describe('WorkflowService — branch delegation', () => {
|
|
|
258
259
|
const status = { branch: 'main', isDirty: false, hasUpstream: true, unpushedCommits: 0, conflicted: [], unmergedFromUpstream: false };
|
|
259
260
|
(git.status as ReturnType<typeof vi.fn>).mockResolvedValue(status);
|
|
260
261
|
|
|
261
|
-
const svc = new WorkflowService(makeDb(), git, makePrs(), makeReviewWorkflow(), makeWorkspaceService(), makeAccessControl(), makeFileLockService(), makePendingCommits(),
|
|
262
|
+
const svc = new WorkflowService(makeDb(), git, makePrs(), makeReviewWorkflow(), makeWorkspaceService(), makeAccessControl(), makeFileLockService(), makePendingCommits(), testKbContext(), openChangeGate());
|
|
262
263
|
await expect(svc.branchStatus('w1')).resolves.toBe(status);
|
|
263
264
|
expect(git.status).toHaveBeenCalledWith('w1');
|
|
264
265
|
});
|
|
@@ -272,7 +273,7 @@ describe('WorkflowService — change delegation', () => {
|
|
|
272
273
|
const commit = { sha: 'abc', authorName: 'Alice', authorEmail: 'alice@example.com', subject: 'tweak owner', committedAt: '2026-01-01T00:00:00Z' };
|
|
273
274
|
(git.commit as ReturnType<typeof vi.fn>).mockResolvedValue(commit);
|
|
274
275
|
|
|
275
|
-
const svc = new WorkflowService(makeDb(), git, makePrs(), makeReviewWorkflow(), makeWorkspaceService(), makeAccessControl(), makeFileLockService(), makePendingCommits(),
|
|
276
|
+
const svc = new WorkflowService(makeDb(), git, makePrs(), makeReviewWorkflow(), makeWorkspaceService(), makeAccessControl(), makeFileLockService(), makePendingCommits(), testKbContext(), openChangeGate());
|
|
276
277
|
await expect(svc.commitChange('w1', user, input)).resolves.toBe(commit);
|
|
277
278
|
expect(git.commit).toHaveBeenCalledWith('w1', user, input);
|
|
278
279
|
});
|
|
@@ -281,7 +282,7 @@ describe('WorkflowService — change delegation', () => {
|
|
|
281
282
|
const git = makeGit();
|
|
282
283
|
(git.logForFile as ReturnType<typeof vi.fn>).mockResolvedValue([]);
|
|
283
284
|
|
|
284
|
-
const svc = new WorkflowService(makeDb(), git, makePrs(), makeReviewWorkflow(), makeWorkspaceService(), makeAccessControl(), makeFileLockService(), makePendingCommits(),
|
|
285
|
+
const svc = new WorkflowService(makeDb(), git, makePrs(), makeReviewWorkflow(), makeWorkspaceService(), makeAccessControl(), makeFileLockService(), makePendingCommits(), testKbContext(), openChangeGate());
|
|
285
286
|
await svc.listChangesForFile('w1', 'Knowledge/Foo.md', 5);
|
|
286
287
|
expect(git.logForFile).toHaveBeenCalledWith('w1', 'Knowledge/Foo.md', 5);
|
|
287
288
|
});
|
|
@@ -290,7 +291,7 @@ describe('WorkflowService — change delegation', () => {
|
|
|
290
291
|
const git = makeGit();
|
|
291
292
|
(git.diffFileBetweenBranches as ReturnType<typeof vi.fn>).mockResolvedValue('@@ diff');
|
|
292
293
|
|
|
293
|
-
const svc = new WorkflowService(makeDb(), git, makePrs(), makeReviewWorkflow(), makeWorkspaceService(), makeAccessControl(), makeFileLockService(), makePendingCommits(),
|
|
294
|
+
const svc = new WorkflowService(makeDb(), git, makePrs(), makeReviewWorkflow(), makeWorkspaceService(), makeAccessControl(), makeFileLockService(), makePendingCommits(), testKbContext(), openChangeGate());
|
|
294
295
|
const diff = await svc.compareFile('w1', 'Foo.md', 'a', 'b');
|
|
295
296
|
expect(diff).toBe('@@ diff');
|
|
296
297
|
expect(git.diffFileBetweenBranches).toHaveBeenCalledWith('w1', 'Foo.md', 'a', 'b');
|
|
@@ -302,7 +303,7 @@ describe('WorkflowService — change request delegation + cache invalidation', (
|
|
|
302
303
|
const prs = makePrs();
|
|
303
304
|
(prs.listOpenPrs as ReturnType<typeof vi.fn>).mockResolvedValue([]);
|
|
304
305
|
|
|
305
|
-
const svc = new WorkflowService(makeDb(), makeGit(), prs, makeReviewWorkflow(), makeWorkspaceService(), makeAccessControl(), makeFileLockService(), makePendingCommits(),
|
|
306
|
+
const svc = new WorkflowService(makeDb(), makeGit(), prs, makeReviewWorkflow(), makeWorkspaceService(), makeAccessControl(), makeFileLockService(), makePendingCommits(), testKbContext(), openChangeGate());
|
|
306
307
|
await svc.listChangeRequests({ fresh: true });
|
|
307
308
|
expect(prs.listOpenPrs).toHaveBeenCalledWith({ fresh: true });
|
|
308
309
|
});
|
|
@@ -314,7 +315,7 @@ describe('WorkflowService — change request delegation + cache invalidation', (
|
|
|
314
315
|
const input: PostChangeRequestCommentInput = { body: 'hi' };
|
|
315
316
|
(reviewWorkflow.postComment as ReturnType<typeof vi.fn>).mockResolvedValue(comment);
|
|
316
317
|
|
|
317
|
-
const svc = new WorkflowService(makeDb(), makeGit(), prs, reviewWorkflow, makeWorkspaceService(), makeAccessControl(), makeFileLockService(), makePendingCommits(),
|
|
318
|
+
const svc = new WorkflowService(makeDb(), makeGit(), prs, reviewWorkflow, makeWorkspaceService(), makeAccessControl(), makeFileLockService(), makePendingCommits(), testKbContext(), openChangeGate());
|
|
318
319
|
const user = makeUser();
|
|
319
320
|
await expect(svc.postComment(42, user, input, 'sha1')).resolves.toBe(comment);
|
|
320
321
|
expect(reviewWorkflow.postComment).toHaveBeenCalledWith(42, user, input, 'sha1');
|
|
@@ -327,7 +328,7 @@ describe('WorkflowService — change request delegation + cache invalidation', (
|
|
|
327
328
|
const reviewWorkflow = makeReviewWorkflow();
|
|
328
329
|
(reviewWorkflow.approveFile as ReturnType<typeof vi.fn>).mockResolvedValue([]);
|
|
329
330
|
|
|
330
|
-
const svc = new WorkflowService(makeDb(), makeGit(), prs, reviewWorkflow, makeWorkspaceService(), makeAccessControl(), makeFileLockService(), makePendingCommits(),
|
|
331
|
+
const svc = new WorkflowService(makeDb(), makeGit(), prs, reviewWorkflow, makeWorkspaceService(), makeAccessControl(), makeFileLockService(), makePendingCommits(), testKbContext(), openChangeGate());
|
|
331
332
|
await svc.approveFile(7, 'Foo.md', makeUser(), [], 'sha', 'main', null, 'w1');
|
|
332
333
|
expect(prs.invalidateDetailCache).toHaveBeenCalledWith(7);
|
|
333
334
|
expect(prs.invalidateDetailCache).toHaveBeenCalledTimes(1);
|
|
@@ -338,7 +339,7 @@ describe('WorkflowService — change request delegation + cache invalidation', (
|
|
|
338
339
|
const reviewWorkflow = makeReviewWorkflow();
|
|
339
340
|
(reviewWorkflow.cancelPr as ReturnType<typeof vi.fn>).mockResolvedValue({ prNumber: 9, cancelledAt: 't' });
|
|
340
341
|
|
|
341
|
-
const svc = new WorkflowService(makeDb(), makeGit(), prs, reviewWorkflow, makeWorkspaceService(), makeAccessControl(), makeFileLockService(), makePendingCommits(),
|
|
342
|
+
const svc = new WorkflowService(makeDb(), makeGit(), prs, reviewWorkflow, makeWorkspaceService(), makeAccessControl(), makeFileLockService(), makePendingCommits(), testKbContext(), openChangeGate());
|
|
342
343
|
const user = makeUser();
|
|
343
344
|
await svc.rejectChangeRequest(9, user, 'open', null, 'main', 'w1');
|
|
344
345
|
expect(reviewWorkflow.cancelPr).toHaveBeenCalledWith(9, user, 'open', null, 'main', 'w1');
|
|
@@ -357,7 +358,7 @@ describe('WorkflowService — change request delegation + cache invalidation', (
|
|
|
357
358
|
|
|
358
359
|
const git = makeGit();
|
|
359
360
|
const workspaceService = makeWorkspaceService();
|
|
360
|
-
const svc = new WorkflowService(makeDb(), git, prs, reviewWorkflow, workspaceService, makeAccessControl(), makeFileLockService(), makePendingCommits(),
|
|
361
|
+
const svc = new WorkflowService(makeDb(), git, prs, reviewWorkflow, workspaceService, makeAccessControl(), makeFileLockService(), makePendingCommits(), testKbContext(), openChangeGate());
|
|
361
362
|
// Conflicts are surfaced by the local merge inside `reviewWorkflow.mergePr`
|
|
362
363
|
// (mocked here), so there's no provider "mergeable" pre-check to stub.
|
|
363
364
|
const outcome = await svc.mergeChangeRequest(
|
|
@@ -412,7 +413,7 @@ describe('WorkflowService — change request delegation + cache invalidation', (
|
|
|
412
413
|
id: 'resolved-target-ws',
|
|
413
414
|
});
|
|
414
415
|
const pending = makePendingCommits();
|
|
415
|
-
const svc = new WorkflowService(makeDb(), git, prs, reviewWorkflow, workspaceService, makeAccessControl(), makeFileLockService(), pending,
|
|
416
|
+
const svc = new WorkflowService(makeDb(), git, prs, reviewWorkflow, workspaceService, makeAccessControl(), makeFileLockService(), pending, testKbContext(), openChangeGate());
|
|
416
417
|
|
|
417
418
|
const outcome = await svc.mergeChangeRequest(
|
|
418
419
|
4, makeUser(), 'sha', [], 'open', 'PR title', 'main', 'w1', { bypass: true },
|
|
@@ -435,7 +436,7 @@ describe('WorkflowService — change request delegation + cache invalidation', (
|
|
|
435
436
|
describe('WorkflowService — file lock delegation', () => {
|
|
436
437
|
it('acquireLock delegates to FileLockService.acquire', async () => {
|
|
437
438
|
const fileLocks = makeFileLockService();
|
|
438
|
-
const svc = new WorkflowService(makeDb(), makeGit(), makePrs(), makeReviewWorkflow(), makeWorkspaceService(), makeAccessControl(), fileLocks, makePendingCommits(),
|
|
439
|
+
const svc = new WorkflowService(makeDb(), makeGit(), makePrs(), makeReviewWorkflow(), makeWorkspaceService(), makeAccessControl(), fileLocks, makePendingCommits(), testKbContext(), openChangeGate());
|
|
439
440
|
await svc.acquireLock('w1', 'b', 'p', makeUser());
|
|
440
441
|
expect(fileLocks.acquire).toHaveBeenCalledWith('w1', 'b', 'p', expect.objectContaining({ email: 'alice@example.com' }), undefined);
|
|
441
442
|
});
|
|
@@ -445,7 +446,7 @@ describe('WorkflowService — file lock delegation', () => {
|
|
|
445
446
|
// a coordination hold masquerade as an edit lock on the very next read
|
|
446
447
|
// (which is how the write paths decide what the holder may do).
|
|
447
448
|
const fileLocks = makeFileLockService();
|
|
448
|
-
const svc = new WorkflowService(makeDb(), makeGit(), makePrs(), makeReviewWorkflow(), makeWorkspaceService(), makeAccessControl(), fileLocks, makePendingCommits(),
|
|
449
|
+
const svc = new WorkflowService(makeDb(), makeGit(), makePrs(), makeReviewWorkflow(), makeWorkspaceService(), makeAccessControl(), fileLocks, makePendingCommits(), testKbContext(), openChangeGate());
|
|
449
450
|
await svc.acquireLock('w1', 'b', 'p', makeUser(), { coordination: true });
|
|
450
451
|
expect(fileLocks.acquire).toHaveBeenCalledWith(
|
|
451
452
|
'w1', 'b', 'p', expect.objectContaining({ email: 'alice@example.com' }), { coordination: true },
|
|
@@ -454,7 +455,7 @@ describe('WorkflowService — file lock delegation', () => {
|
|
|
454
455
|
|
|
455
456
|
it('getLock delegates to FileLockService.get', async () => {
|
|
456
457
|
const fileLocks = makeFileLockService();
|
|
457
|
-
const svc = new WorkflowService(makeDb(), makeGit(), makePrs(), makeReviewWorkflow(), makeWorkspaceService(), makeAccessControl(), fileLocks, makePendingCommits(),
|
|
458
|
+
const svc = new WorkflowService(makeDb(), makeGit(), makePrs(), makeReviewWorkflow(), makeWorkspaceService(), makeAccessControl(), fileLocks, makePendingCommits(), testKbContext(), openChangeGate());
|
|
458
459
|
await expect(svc.getLock('w1', 'b', 'p')).resolves.toBeNull();
|
|
459
460
|
expect(fileLocks.get).toHaveBeenCalledWith('w1', 'b', 'p');
|
|
460
461
|
});
|
|
@@ -469,7 +470,7 @@ describe('WorkflowService — file lock delegation', () => {
|
|
|
469
470
|
acquiredAt: '', lastHeartbeatAt: '', expiresAt: '',
|
|
470
471
|
});
|
|
471
472
|
const pending = makePendingCommits();
|
|
472
|
-
const svc = new WorkflowService(makeDb(), git, makePrs(), makeReviewWorkflow(), makeWorkspaceService(), makeAccessControl(), fileLocks, pending,
|
|
473
|
+
const svc = new WorkflowService(makeDb(), git, makePrs(), makeReviewWorkflow(), makeWorkspaceService(), makeAccessControl(), fileLocks, pending, testKbContext(), openChangeGate());
|
|
473
474
|
await expect(svc.releaseLock('w1', 'feat', 'Foo.md', makeUser())).resolves.toBeUndefined();
|
|
474
475
|
// No inline git work — the worker handles that out of band.
|
|
475
476
|
expect(git.commitFile).not.toHaveBeenCalled();
|
|
@@ -488,28 +489,28 @@ describe('WorkflowService — file lock delegation', () => {
|
|
|
488
489
|
// One open request rides the branch — deleting it would strand the request.
|
|
489
490
|
// `sourceBranch` matters to the guard now: it decides whether the refusal
|
|
490
491
|
// says "withdraw yours" (source) or names the other request's actors (target).
|
|
491
|
-
const svc = new WorkflowService(makeDb([{ number: 7, sourceBranch: 'feat/x', targetBranch: 'dev', state: 'open' }]), git, makePrs(), makeReviewWorkflow(), makeWorkspaceService(), makeAccessControl(), makeFileLockService(), makePendingCommits(),
|
|
492
|
+
const svc = new WorkflowService(makeDb([{ number: 7, sourceBranch: 'feat/x', targetBranch: 'dev', state: 'open' }]), git, makePrs(), makeReviewWorkflow(), makeWorkspaceService(), makeAccessControl(), makeFileLockService(), makePendingCommits(), testKbContext(), openChangeGate());
|
|
492
493
|
await expect(svc.deleteBranch('w1', 'feat/x', makeUser())).rejects.toThrow(/open change request \(#7\)/);
|
|
493
494
|
expect(git.deleteBranch).not.toHaveBeenCalled();
|
|
494
495
|
});
|
|
495
496
|
|
|
496
497
|
it('deleteBranch refuses when an open request proposes INTO the branch (target end)', async () => {
|
|
497
498
|
const git = makeGit();
|
|
498
|
-
const svc = new WorkflowService(makeDb([{ number: 9, sourceBranch: 'other/y', targetBranch: 'feat/x', state: 'open' }]), git, makePrs(), makeReviewWorkflow(), makeWorkspaceService(), makeAccessControl(), makeFileLockService(), makePendingCommits(),
|
|
499
|
+
const svc = new WorkflowService(makeDb([{ number: 9, sourceBranch: 'other/y', targetBranch: 'feat/x', state: 'open' }]), git, makePrs(), makeReviewWorkflow(), makeWorkspaceService(), makeAccessControl(), makeFileLockService(), makePendingCommits(), testKbContext(), openChangeGate());
|
|
499
500
|
await expect(svc.deleteBranch('w1', 'feat/x', makeUser())).rejects.toThrow(/proposes changes into/);
|
|
500
501
|
expect(git.deleteBranch).not.toHaveBeenCalled();
|
|
501
502
|
});
|
|
502
503
|
|
|
503
504
|
it('deleteBranch proceeds past a CLOSED request — the guard filters on state, not mere mention', async () => {
|
|
504
505
|
const git = makeGit();
|
|
505
|
-
const svc = new WorkflowService(makeDb([{ number: 7, sourceBranch: 'feat/x', targetBranch: 'dev', state: 'closed' }]), git, makePrs(), makeReviewWorkflow(), makeWorkspaceService(), makeAccessControl(), makeFileLockService(), makePendingCommits(),
|
|
506
|
+
const svc = new WorkflowService(makeDb([{ number: 7, sourceBranch: 'feat/x', targetBranch: 'dev', state: 'closed' }]), git, makePrs(), makeReviewWorkflow(), makeWorkspaceService(), makeAccessControl(), makeFileLockService(), makePendingCommits(), testKbContext(), openChangeGate());
|
|
506
507
|
await expect(svc.deleteBranch('w1', 'feat/x', makeUser())).resolves.toBeUndefined();
|
|
507
508
|
expect(git.deleteBranch).toHaveBeenCalled();
|
|
508
509
|
});
|
|
509
510
|
|
|
510
511
|
it('deleteBranch deletes when the branch has no open change request', async () => {
|
|
511
512
|
const git = makeGit();
|
|
512
|
-
const svc = new WorkflowService(makeDb(), git, makePrs(), makeReviewWorkflow(), makeWorkspaceService(), makeAccessControl(), makeFileLockService(), makePendingCommits(),
|
|
513
|
+
const svc = new WorkflowService(makeDb(), git, makePrs(), makeReviewWorkflow(), makeWorkspaceService(), makeAccessControl(), makeFileLockService(), makePendingCommits(), testKbContext(), openChangeGate());
|
|
513
514
|
await expect(svc.deleteBranch('w1', 'feat/x', makeUser())).resolves.toBeUndefined();
|
|
514
515
|
expect(git.deleteBranch).toHaveBeenCalledWith('w1', 'feat/x', expect.objectContaining({ email: 'alice@example.com' }), undefined);
|
|
515
516
|
});
|
|
@@ -529,7 +530,7 @@ describe('WorkflowService — file lock delegation', () => {
|
|
|
529
530
|
vi.mocked(git.deleteBranch)
|
|
530
531
|
.mockImplementationOnce(async () => { order.push('first:start'); await gate; order.push('first:end'); })
|
|
531
532
|
.mockImplementationOnce(async () => { order.push('second'); });
|
|
532
|
-
const svc = new WorkflowService(makeDb(), git, makePrs(), makeReviewWorkflow(), makeWorkspaceService(), makeAccessControl(), makeFileLockService(), makePendingCommits(),
|
|
533
|
+
const svc = new WorkflowService(makeDb(), git, makePrs(), makeReviewWorkflow(), makeWorkspaceService(), makeAccessControl(), makeFileLockService(), makePendingCommits(), testKbContext(), openChangeGate());
|
|
533
534
|
const first = svc.deleteBranch('w1', 'feat/x', makeUser());
|
|
534
535
|
const second = svc.deleteBranch('w1', 'feat/x', makeUser());
|
|
535
536
|
// Only release the gate once the first operation is provably inside its
|
|
@@ -544,7 +545,7 @@ describe('WorkflowService — file lock delegation', () => {
|
|
|
544
545
|
it('releaseLock refuses when the caller does not hold the lock', async () => {
|
|
545
546
|
const git = makeGit();
|
|
546
547
|
const fileLocks = makeFileLockService(); // default: get → null
|
|
547
|
-
const svc = new WorkflowService(makeDb(), git, makePrs(), makeReviewWorkflow(), makeWorkspaceService(), makeAccessControl(), fileLocks, makePendingCommits(),
|
|
548
|
+
const svc = new WorkflowService(makeDb(), git, makePrs(), makeReviewWorkflow(), makeWorkspaceService(), makeAccessControl(), fileLocks, makePendingCommits(), testKbContext(), openChangeGate());
|
|
548
549
|
await expect(svc.releaseLock('w1', 'feat', 'Foo.md', makeUser())).rejects.toThrow(/not held by you/);
|
|
549
550
|
// The commit must NOT run when the caller doesn't hold the lock —
|
|
550
551
|
// otherwise a non-holder could trigger a commit attributed as them.
|
|
@@ -605,7 +606,7 @@ describe('WorkflowService — revertChangeRequestFile / closeEmptyChangeRequest'
|
|
|
605
606
|
returning: vi.fn(async () => updateRows),
|
|
606
607
|
});
|
|
607
608
|
const db = chain as unknown as Database;
|
|
608
|
-
const svc = new WorkflowService(db, git, prs, makeReviewWorkflow(), makeWorkspaceService(), access, fileLocks, makePendingCommits(),
|
|
609
|
+
const svc = new WorkflowService(db, git, prs, makeReviewWorkflow(), makeWorkspaceService(), access, fileLocks, makePendingCommits(), testKbContext(), openChangeGate());
|
|
609
610
|
return { svc, git, prs, access, fileLocks, db: chain };
|
|
610
611
|
}
|
|
611
612
|
|
|
@@ -808,7 +809,7 @@ describe('WorkflowService — deleteChangeRequest (admin moderation verb)', () =
|
|
|
808
809
|
returning: vi.fn(async () => [{ id: 1 }]),
|
|
809
810
|
});
|
|
810
811
|
const workspaces = makeWorkspaceService();
|
|
811
|
-
const svc = new WorkflowService(chain as unknown as Database, git, prs, makeReviewWorkflow(), workspaces, access, makeFileLockService(), makePendingCommits(),
|
|
812
|
+
const svc = new WorkflowService(chain as unknown as Database, git, prs, makeReviewWorkflow(), workspaces, access, makeFileLockService(), makePendingCommits(), testKbContext(), openChangeGate());
|
|
812
813
|
return { svc, prs, db: chain, access, workspaces };
|
|
813
814
|
}
|
|
814
815
|
|
|
@@ -916,7 +917,7 @@ describe('WorkflowService.mergeBranch — an agent merges branches, never an ope
|
|
|
916
917
|
const access = makeAccessControl();
|
|
917
918
|
(access.canWriteBatchAtRef as ReturnType<typeof vi.fn>).mockResolvedValue(opts.canWrite === undefined ? null : opts.canWrite);
|
|
918
919
|
const workspaceService = makeWorkspaceService();
|
|
919
|
-
const svc = new WorkflowService(makeDb([OPEN_REQUEST]), git, makePrs(), makeReviewWorkflow(), workspaceService, access, makeFileLockService(), makePendingCommits(),
|
|
920
|
+
const svc = new WorkflowService(makeDb([OPEN_REQUEST]), git, makePrs(), makeReviewWorkflow(), workspaceService, access, makeFileLockService(), makePendingCommits(), testKbContext(), openChangeGate());
|
|
920
921
|
const merge = (git as unknown as { mergeChangeRequest: ReturnType<typeof vi.fn> }).mergeChangeRequest;
|
|
921
922
|
return { svc, git, access, merge };
|
|
922
923
|
}
|
|
@@ -956,7 +957,7 @@ describe('WorkflowService.mergeBranch — an agent merges branches, never an ope
|
|
|
956
957
|
});
|
|
957
958
|
|
|
958
959
|
it('refuses a protected target when the caller could not commit the changed files directly', async () => {
|
|
959
|
-
expect(isProtectedBranch(PROTECTED)).toBe(true);
|
|
960
|
+
expect(testKbContext().isProtectedBranch(PROTECTED)).toBe(true);
|
|
960
961
|
const { svc, git, access, merge } = harness({ canWrite: new Map([['Team/Process.md', false]]) });
|
|
961
962
|
const err = await svc.mergeBranch(makeUser(), 'alice/other', PROTECTED).catch((e: unknown) => e);
|
|
962
963
|
expect(err).toMatchObject({ status: 403, payload: { kind: 'protected-merge-target', deniedPaths: ['Team/Process.md'] } });
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { describe, it, expect, vi } from 'vitest';
|
|
2
|
+
import { testKbContext } from '../../../__tests__/kb-context.js';
|
|
2
3
|
import type { AuthUser, PullRequestSummary } from '@bevel-software/platform-shared';
|
|
3
4
|
import type { GitService } from '../git/git.service.js';
|
|
4
5
|
import type { PullRequestService } from '../git/pull-request.service.js';
|
|
@@ -138,7 +139,7 @@ function makeHarness(requests: PullRequestSummary[], access: Access = {}) {
|
|
|
138
139
|
accessControl,
|
|
139
140
|
fileLocks,
|
|
140
141
|
pendingCommits,
|
|
141
|
-
|
|
142
|
+
testKbContext(),
|
|
142
143
|
openChangeGate(),
|
|
143
144
|
);
|
|
144
145
|
// Which request an UPDATE is closing is not recoverable from the drizzle
|