@bevel-software/platform-core-backend 0.19.0 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/catalog-cache-invalidation.d.ts +7 -2
- package/dist/core/catalog-cache-invalidation.d.ts.map +1 -1
- package/dist/core/catalog-cache-invalidation.js +8 -9
- package/dist/core/catalog-cache-invalidation.js.map +1 -1
- package/dist/core/core-ports.d.ts +19 -0
- package/dist/core/core-ports.d.ts.map +1 -1
- package/dist/core/core-ports.js.map +1 -1
- package/dist/core/create-core-server.d.ts +2 -0
- package/dist/core/create-core-server.d.ts.map +1 -1
- package/dist/core/create-core-server.js +45 -105
- package/dist/core/create-core-server.js.map +1 -1
- package/dist/core/create-core-services.d.ts +33 -5
- package/dist/core/create-core-services.d.ts.map +1 -1
- package/dist/core/create-core-services.js +146 -82
- package/dist/core/create-core-services.js.map +1 -1
- package/dist/core/lifecycle.d.ts +74 -28
- package/dist/core/lifecycle.d.ts.map +1 -1
- package/dist/core/lifecycle.js +157 -20
- package/dist/core/lifecycle.js.map +1 -1
- package/dist/core/public-config.d.ts +5 -1
- package/dist/core/public-config.d.ts.map +1 -1
- package/dist/core/public-config.js +7 -5
- package/dist/core/public-config.js.map +1 -1
- package/dist/core-config.d.ts +95 -1
- package/dist/core-config.d.ts.map +1 -1
- package/dist/core-config.js +24 -8
- package/dist/core-config.js.map +1 -1
- package/dist/index.d.ts +5 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -3
- package/dist/index.js.map +1 -1
- package/dist/modules/access/access-control.service.d.ts +18 -1
- package/dist/modules/access/access-control.service.d.ts.map +1 -1
- package/dist/modules/access/access-control.service.js +19 -8
- package/dist/modules/access/access-control.service.js.map +1 -1
- package/dist/modules/access/access.routes.d.ts +2 -1
- package/dist/modules/access/access.routes.d.ts.map +1 -1
- package/dist/modules/access/access.routes.js +10 -10
- package/dist/modules/access/access.routes.js.map +1 -1
- package/dist/modules/access/change-read-gate.d.ts +6 -3
- package/dist/modules/access/change-read-gate.d.ts.map +1 -1
- package/dist/modules/access/change-read-gate.js +9 -6
- package/dist/modules/access/change-read-gate.js.map +1 -1
- package/dist/modules/access/creator-access.d.ts +4 -2
- package/dist/modules/access/creator-access.d.ts.map +1 -1
- package/dist/modules/access/creator-access.js +7 -4
- package/dist/modules/access/creator-access.js.map +1 -1
- package/dist/modules/agent-instructions/read-preamble.d.ts +2 -1
- package/dist/modules/agent-instructions/read-preamble.d.ts.map +1 -1
- package/dist/modules/agent-instructions/read-preamble.js +6 -9
- package/dist/modules/agent-instructions/read-preamble.js.map +1 -1
- package/dist/modules/audit/agent-audit.service.d.ts +54 -0
- package/dist/modules/audit/agent-audit.service.d.ts.map +1 -0
- package/dist/modules/audit/agent-audit.service.js +290 -0
- package/dist/modules/audit/agent-audit.service.js.map +1 -0
- package/dist/modules/audit/agent-rest-audit.middleware.d.ts +40 -0
- package/dist/modules/audit/agent-rest-audit.middleware.d.ts.map +1 -0
- package/dist/modules/audit/agent-rest-audit.middleware.js +75 -0
- package/dist/modules/audit/agent-rest-audit.middleware.js.map +1 -0
- package/dist/modules/audit/audit.contract.d.ts +145 -0
- package/dist/modules/audit/audit.contract.d.ts.map +1 -0
- package/dist/modules/audit/audit.contract.js +35 -0
- package/dist/modules/audit/audit.contract.js.map +1 -0
- package/dist/modules/audit/audit.routes.d.ts +21 -0
- package/dist/modules/audit/audit.routes.d.ts.map +1 -0
- package/dist/modules/audit/audit.routes.js +157 -0
- package/dist/modules/audit/audit.routes.js.map +1 -0
- package/dist/modules/audit/event-classifier.d.ts +52 -0
- package/dist/modules/audit/event-classifier.d.ts.map +1 -0
- package/dist/modules/audit/event-classifier.js +123 -0
- package/dist/modules/audit/event-classifier.js.map +1 -0
- package/dist/modules/audit/index.d.ts +7 -0
- package/dist/modules/audit/index.d.ts.map +1 -0
- package/dist/modules/audit/index.js +7 -0
- package/dist/modules/audit/index.js.map +1 -0
- package/dist/modules/audit/request-audit.d.ts +57 -0
- package/dist/modules/audit/request-audit.d.ts.map +1 -0
- package/dist/modules/audit/request-audit.js +117 -0
- package/dist/modules/audit/request-audit.js.map +1 -0
- package/dist/modules/auth/account-admission.d.ts +40 -0
- package/dist/modules/auth/account-admission.d.ts.map +1 -0
- package/dist/modules/auth/account-admission.js +17 -0
- package/dist/modules/auth/account-admission.js.map +1 -0
- package/dist/modules/auth/account.routes.d.ts.map +1 -1
- package/dist/modules/auth/account.routes.js +4 -1
- package/dist/modules/auth/account.routes.js.map +1 -1
- package/dist/modules/auth/auth.service.d.ts +19 -1
- package/dist/modules/auth/auth.service.d.ts.map +1 -1
- package/dist/modules/auth/auth.service.js +33 -1
- package/dist/modules/auth/auth.service.js.map +1 -1
- package/dist/modules/auth/oidc-auth-provider.d.ts.map +1 -1
- package/dist/modules/auth/oidc-auth-provider.js +9 -0
- package/dist/modules/auth/oidc-auth-provider.js.map +1 -1
- package/dist/modules/connection-probe/connection-probe.service.d.ts +13 -1
- package/dist/modules/connection-probe/connection-probe.service.d.ts.map +1 -1
- package/dist/modules/connection-probe/connection-probe.service.js +10 -2
- package/dist/modules/connection-probe/connection-probe.service.js.map +1 -1
- package/dist/modules/database/advisory-lock.d.ts +17 -0
- package/dist/modules/database/advisory-lock.d.ts.map +1 -1
- package/dist/modules/database/advisory-lock.js +24 -3
- package/dist/modules/database/advisory-lock.js.map +1 -1
- package/dist/modules/database/connection.d.ts +67 -2
- package/dist/modules/database/connection.d.ts.map +1 -1
- package/dist/modules/database/connection.js +118 -12
- package/dist/modules/database/connection.js.map +1 -1
- package/dist/modules/database/core-schema.d.ts +414 -0
- package/dist/modules/database/core-schema.d.ts.map +1 -1
- package/dist/modules/database/core-schema.js +99 -0
- package/dist/modules/database/core-schema.js.map +1 -1
- package/dist/modules/database/migrate.d.ts +1 -1
- package/dist/modules/database/migrate.d.ts.map +1 -1
- package/dist/modules/database/migrate.js +27 -3
- package/dist/modules/database/migrate.js.map +1 -1
- package/dist/modules/diff/diff.service.d.ts.map +1 -1
- package/dist/modules/diff/diff.service.js +6 -1
- package/dist/modules/diff/diff.service.js.map +1 -1
- package/dist/modules/kb-fs/branch-name.d.ts +0 -1
- package/dist/modules/kb-fs/branch-name.d.ts.map +1 -1
- package/dist/modules/kb-fs/branch-name.js +3 -3
- package/dist/modules/kb-fs/branch-name.js.map +1 -1
- package/dist/modules/kb-fs/clone-config.d.ts +9 -8
- package/dist/modules/kb-fs/clone-config.d.ts.map +1 -1
- package/dist/modules/kb-fs/clone-config.js +14 -12
- package/dist/modules/kb-fs/clone-config.js.map +1 -1
- package/dist/modules/kb-fs/git-guarded-filesystem.d.ts +9 -1
- package/dist/modules/kb-fs/git-guarded-filesystem.d.ts.map +1 -1
- package/dist/modules/kb-fs/git-guarded-filesystem.js +16 -3
- package/dist/modules/kb-fs/git-guarded-filesystem.js.map +1 -1
- package/dist/modules/mcp/mcp-auth.middleware.d.ts +1 -0
- package/dist/modules/mcp/mcp-auth.middleware.d.ts.map +1 -1
- package/dist/modules/mcp/mcp-auth.middleware.js +32 -0
- package/dist/modules/mcp/mcp-auth.middleware.js.map +1 -1
- package/dist/modules/mcp/mcp.routes.d.ts.map +1 -1
- package/dist/modules/mcp/mcp.routes.js +8 -1
- package/dist/modules/mcp/mcp.routes.js.map +1 -1
- package/dist/modules/mcp/mcp.service.d.ts +16 -1
- package/dist/modules/mcp/mcp.service.d.ts.map +1 -1
- package/dist/modules/mcp/mcp.service.js +52 -9
- package/dist/modules/mcp/mcp.service.js.map +1 -1
- package/dist/modules/mcp/oauth/bevel-oauth-provider.d.ts +59 -0
- package/dist/modules/mcp/oauth/bevel-oauth-provider.d.ts.map +1 -1
- package/dist/modules/mcp/oauth/bevel-oauth-provider.js +180 -8
- package/dist/modules/mcp/oauth/bevel-oauth-provider.js.map +1 -1
- package/dist/modules/plugins/compile/marketplace-compiler.service.d.ts +4 -4
- package/dist/modules/plugins/compile/marketplace-compiler.service.d.ts.map +1 -1
- package/dist/modules/plugins/compile/marketplace-compiler.service.js +7 -10
- package/dist/modules/plugins/compile/marketplace-compiler.service.js.map +1 -1
- package/dist/modules/plugins/discovery/bundle-dialect/bundle.source.d.ts +4 -1
- package/dist/modules/plugins/discovery/bundle-dialect/bundle.source.d.ts.map +1 -1
- package/dist/modules/plugins/discovery/bundle-dialect/bundle.source.js +5 -3
- package/dist/modules/plugins/discovery/bundle-dialect/bundle.source.js.map +1 -1
- package/dist/modules/plugins/discovery/kb-plugin-source.d.ts +6 -1
- package/dist/modules/plugins/discovery/kb-plugin-source.d.ts.map +1 -1
- package/dist/modules/plugins/discovery/kb-plugin-source.js +14 -9
- package/dist/modules/plugins/discovery/kb-plugin-source.js.map +1 -1
- package/dist/modules/plugins/discovery/native.source.d.ts +4 -1
- package/dist/modules/plugins/discovery/native.source.d.ts.map +1 -1
- package/dist/modules/plugins/discovery/native.source.js +4 -2
- package/dist/modules/plugins/discovery/native.source.js.map +1 -1
- package/dist/modules/plugins/index.d.ts +1 -1
- package/dist/modules/plugins/index.d.ts.map +1 -1
- package/dist/modules/plugins/index.js +1 -1
- package/dist/modules/plugins/index.js.map +1 -1
- package/dist/modules/plugins/join-request-jobs.service.d.ts +3 -1
- package/dist/modules/plugins/join-request-jobs.service.d.ts.map +1 -1
- package/dist/modules/plugins/join-request-jobs.service.js +6 -6
- package/dist/modules/plugins/join-request-jobs.service.js.map +1 -1
- package/dist/modules/plugins/join-requests.service.d.ts +3 -1
- package/dist/modules/plugins/join-requests.service.d.ts.map +1 -1
- package/dist/modules/plugins/join-requests.service.js +9 -8
- package/dist/modules/plugins/join-requests.service.js.map +1 -1
- package/dist/modules/plugins/plugin-links.d.ts +65 -10
- package/dist/modules/plugins/plugin-links.d.ts.map +1 -1
- package/dist/modules/plugins/plugin-links.js +136 -31
- package/dist/modules/plugins/plugin-links.js.map +1 -1
- package/dist/modules/plugins/plugin-links.service.d.ts +107 -5
- package/dist/modules/plugins/plugin-links.service.d.ts.map +1 -1
- package/dist/modules/plugins/plugin-links.service.js +151 -21
- package/dist/modules/plugins/plugin-links.service.js.map +1 -1
- package/dist/modules/plugins/plugin-provision.service.d.ts +10 -3
- package/dist/modules/plugins/plugin-provision.service.d.ts.map +1 -1
- package/dist/modules/plugins/plugin-provision.service.js +33 -26
- package/dist/modules/plugins/plugin-provision.service.js.map +1 -1
- package/dist/modules/plugins/plugin-rename.service.d.ts +4 -2
- package/dist/modules/plugins/plugin-rename.service.d.ts.map +1 -1
- package/dist/modules/plugins/plugin-rename.service.js +10 -12
- package/dist/modules/plugins/plugin-rename.service.js.map +1 -1
- package/dist/modules/plugins/plugins.routes.d.ts +3 -0
- package/dist/modules/plugins/plugins.routes.d.ts.map +1 -1
- package/dist/modules/plugins/plugins.routes.js +45 -15
- package/dist/modules/plugins/plugins.routes.js.map +1 -1
- package/dist/modules/plugins/plugins.service.d.ts +4 -4
- package/dist/modules/plugins/plugins.service.d.ts.map +1 -1
- package/dist/modules/plugins/plugins.service.js +7 -10
- package/dist/modules/plugins/plugins.service.js.map +1 -1
- package/dist/modules/plugins/teams.routes.d.ts +4 -1
- package/dist/modules/plugins/teams.routes.d.ts.map +1 -1
- package/dist/modules/plugins/teams.routes.js +11 -9
- package/dist/modules/plugins/teams.routes.js.map +1 -1
- package/dist/modules/secrets-vault/index.d.ts +1 -1
- package/dist/modules/secrets-vault/index.d.ts.map +1 -1
- package/dist/modules/secrets-vault/index.js +1 -1
- package/dist/modules/secrets-vault/index.js.map +1 -1
- package/dist/modules/secrets-vault/secrets-variable-loader.d.ts +29 -11
- package/dist/modules/secrets-vault/secrets-variable-loader.d.ts.map +1 -1
- package/dist/modules/secrets-vault/secrets-variable-loader.js +46 -21
- package/dist/modules/secrets-vault/secrets-variable-loader.js.map +1 -1
- package/dist/modules/secrets-vault/secrets-vault.routes.d.ts +3 -0
- package/dist/modules/secrets-vault/secrets-vault.routes.d.ts.map +1 -1
- package/dist/modules/secrets-vault/secrets-vault.routes.js +4 -6
- package/dist/modules/secrets-vault/secrets-vault.routes.js.map +1 -1
- package/dist/modules/settings/deployment-settings.service.d.ts +22 -10
- package/dist/modules/settings/deployment-settings.service.d.ts.map +1 -1
- package/dist/modules/settings/deployment-settings.service.js +52 -28
- package/dist/modules/settings/deployment-settings.service.js.map +1 -1
- package/dist/modules/settings/setup.routes.d.ts +9 -2
- package/dist/modules/settings/setup.routes.d.ts.map +1 -1
- package/dist/modules/settings/setup.routes.js +20 -14
- package/dist/modules/settings/setup.routes.js.map +1 -1
- package/dist/modules/skills/allowed-tools-check.d.ts +4 -3
- package/dist/modules/skills/allowed-tools-check.d.ts.map +1 -1
- package/dist/modules/skills/allowed-tools-check.js +8 -8
- package/dist/modules/skills/allowed-tools-check.js.map +1 -1
- package/dist/modules/skills/pending-skills.service.d.ts +3 -1
- package/dist/modules/skills/pending-skills.service.d.ts.map +1 -1
- package/dist/modules/skills/pending-skills.service.js +9 -6
- package/dist/modules/skills/pending-skills.service.js.map +1 -1
- package/dist/modules/skills/skill-access-requests.routes.d.ts +2 -1
- package/dist/modules/skills/skill-access-requests.routes.d.ts.map +1 -1
- package/dist/modules/skills/skill-access-requests.routes.js +6 -6
- package/dist/modules/skills/skill-access-requests.routes.js.map +1 -1
- package/dist/modules/skills/skills.routes.d.ts +4 -1
- package/dist/modules/skills/skills.routes.d.ts.map +1 -1
- package/dist/modules/skills/skills.routes.js +4 -4
- package/dist/modules/skills/skills.routes.js.map +1 -1
- package/dist/modules/skills/skills.service.d.ts +4 -2
- package/dist/modules/skills/skills.service.d.ts.map +1 -1
- package/dist/modules/skills/skills.service.js +13 -11
- package/dist/modules/skills/skills.service.js.map +1 -1
- package/dist/modules/tool-auth/external-api-key.interface.d.ts +21 -5
- package/dist/modules/tool-auth/external-api-key.interface.d.ts.map +1 -1
- package/dist/modules/tool-auth/external-api-key.interface.js.map +1 -1
- package/dist/modules/tool-auth/external-api-key.service.d.ts +1 -0
- package/dist/modules/tool-auth/external-api-key.service.d.ts.map +1 -1
- package/dist/modules/tool-auth/external-api-key.service.js +22 -9
- package/dist/modules/tool-auth/external-api-key.service.js.map +1 -1
- package/dist/modules/tool-auth/internal-token.service.d.ts +10 -0
- package/dist/modules/tool-auth/internal-token.service.d.ts.map +1 -1
- package/dist/modules/tool-auth/internal-token.service.js +1 -0
- package/dist/modules/tool-auth/internal-token.service.js.map +1 -1
- package/dist/modules/tool-auth/tool-auth.middleware.d.ts +8 -0
- package/dist/modules/tool-auth/tool-auth.middleware.d.ts.map +1 -1
- package/dist/modules/tool-auth/tool-auth.middleware.js +9 -1
- package/dist/modules/tool-auth/tool-auth.middleware.js.map +1 -1
- package/dist/modules/tool-manuals/mcp-json-discovery.d.ts +2 -1
- package/dist/modules/tool-manuals/mcp-json-discovery.d.ts.map +1 -1
- package/dist/modules/tool-manuals/mcp-json-discovery.js +6 -5
- package/dist/modules/tool-manuals/mcp-json-discovery.js.map +1 -1
- package/dist/modules/tool-manuals/mcp-server-edit.service.d.ts +4 -2
- package/dist/modules/tool-manuals/mcp-server-edit.service.d.ts.map +1 -1
- package/dist/modules/tool-manuals/mcp-server-edit.service.js +12 -10
- package/dist/modules/tool-manuals/mcp-server-edit.service.js.map +1 -1
- package/dist/modules/tool-manuals/pending-tools.service.d.ts +3 -1
- package/dist/modules/tool-manuals/pending-tools.service.d.ts.map +1 -1
- package/dist/modules/tool-manuals/pending-tools.service.js +19 -16
- package/dist/modules/tool-manuals/pending-tools.service.js.map +1 -1
- package/dist/modules/tool-manuals/tool-delete.service.d.ts +4 -2
- package/dist/modules/tool-manuals/tool-delete.service.d.ts.map +1 -1
- package/dist/modules/tool-manuals/tool-delete.service.js +14 -12
- package/dist/modules/tool-manuals/tool-delete.service.js.map +1 -1
- package/dist/modules/tool-manuals/tool-manuals.routes.d.ts +3 -1
- package/dist/modules/tool-manuals/tool-manuals.routes.d.ts.map +1 -1
- package/dist/modules/tool-manuals/tool-manuals.routes.js +7 -7
- package/dist/modules/tool-manuals/tool-manuals.routes.js.map +1 -1
- package/dist/modules/tool-manuals/tool-manuals.service.d.ts +4 -2
- package/dist/modules/tool-manuals/tool-manuals.service.d.ts.map +1 -1
- package/dist/modules/tool-manuals/tool-manuals.service.js +15 -12
- package/dist/modules/tool-manuals/tool-manuals.service.js.map +1 -1
- package/dist/modules/tool-manuals/tool-manuals.tools.d.ts +3 -0
- package/dist/modules/tool-manuals/tool-manuals.tools.d.ts.map +1 -1
- package/dist/modules/tool-manuals/tool-manuals.tools.js +4 -6
- package/dist/modules/tool-manuals/tool-manuals.tools.js.map +1 -1
- package/dist/modules/workflow/agent-tools/workflow.tools.d.ts +3 -2
- package/dist/modules/workflow/agent-tools/workflow.tools.d.ts.map +1 -1
- package/dist/modules/workflow/agent-tools/workflow.tools.js +9 -9
- package/dist/modules/workflow/agent-tools/workflow.tools.js.map +1 -1
- package/dist/modules/workflow/git/git.service.d.ts +11 -5
- package/dist/modules/workflow/git/git.service.d.ts.map +1 -1
- package/dist/modules/workflow/git/git.service.js +23 -14
- package/dist/modules/workflow/git/git.service.js.map +1 -1
- package/dist/modules/workflow/git/node-git-runner.d.ts +26 -2
- package/dist/modules/workflow/git/node-git-runner.d.ts.map +1 -1
- package/dist/modules/workflow/git/node-git-runner.js +35 -5
- package/dist/modules/workflow/git/node-git-runner.js.map +1 -1
- package/dist/modules/workflow/review-workflow/review-workflow.service.d.ts.map +1 -1
- package/dist/modules/workflow/review-workflow/review-workflow.service.js +9 -4
- package/dist/modules/workflow/review-workflow/review-workflow.service.js.map +1 -1
- package/dist/modules/workflow/session-ontology.service.d.ts +6 -1
- package/dist/modules/workflow/session-ontology.service.d.ts.map +1 -1
- package/dist/modules/workflow/session-ontology.service.js +6 -2
- package/dist/modules/workflow/session-ontology.service.js.map +1 -1
- package/dist/modules/workflow/workflow.service.d.ts +8 -3
- package/dist/modules/workflow/workflow.service.d.ts.map +1 -1
- package/dist/modules/workflow/workflow.service.js +33 -23
- package/dist/modules/workflow/workflow.service.js.map +1 -1
- package/dist/modules/workspace/session-ontology.gate.d.ts +3 -1
- package/dist/modules/workspace/session-ontology.gate.d.ts.map +1 -1
- package/dist/modules/workspace/session-ontology.gate.js +3 -3
- package/dist/modules/workspace/session-ontology.gate.js.map +1 -1
- package/dist/modules/workspace/startup/kb-git.d.ts +4 -3
- package/dist/modules/workspace/startup/kb-git.d.ts.map +1 -1
- package/dist/modules/workspace/startup/kb-git.js +15 -13
- package/dist/modules/workspace/startup/kb-git.js.map +1 -1
- package/dist/modules/workspace/startup/kb-startup-runner.d.ts +5 -8
- package/dist/modules/workspace/startup/kb-startup-runner.d.ts.map +1 -1
- package/dist/modules/workspace/startup/kb-startup-runner.js +35 -38
- package/dist/modules/workspace/startup/kb-startup-runner.js.map +1 -1
- package/dist/modules/workspace/startup/steps/groups-to-plugins.step.d.ts +7 -1
- package/dist/modules/workspace/startup/steps/groups-to-plugins.step.d.ts.map +1 -1
- package/dist/modules/workspace/startup/steps/groups-to-plugins.step.js +23 -16
- package/dist/modules/workspace/startup/steps/groups-to-plugins.step.js.map +1 -1
- package/dist/modules/workspace/startup/steps/personal-spaces.step.d.ts +7 -1
- package/dist/modules/workspace/startup/steps/personal-spaces.step.d.ts.map +1 -1
- package/dist/modules/workspace/startup/steps/personal-spaces.step.js +12 -5
- package/dist/modules/workspace/startup/steps/personal-spaces.step.js.map +1 -1
- package/dist/modules/workspace/startup/steps/plugin-display-names.step.d.ts +7 -1
- package/dist/modules/workspace/startup/steps/plugin-display-names.step.d.ts.map +1 -1
- package/dist/modules/workspace/startup/steps/plugin-display-names.step.js +12 -5
- package/dist/modules/workspace/startup/steps/plugin-display-names.step.js.map +1 -1
- package/dist/modules/workspace/startup/steps/plugin-manifests.step.d.ts +7 -1
- package/dist/modules/workspace/startup/steps/plugin-manifests.step.d.ts.map +1 -1
- package/dist/modules/workspace/startup/steps/plugin-manifests.step.js +12 -5
- package/dist/modules/workspace/startup/steps/plugin-manifests.step.js.map +1 -1
- package/dist/modules/workspace/startup/steps/seed-tree.d.ts +4 -1
- package/dist/modules/workspace/startup/steps/seed-tree.d.ts.map +1 -1
- package/dist/modules/workspace/startup/steps/seed-tree.js +14 -11
- package/dist/modules/workspace/startup/steps/seed-tree.js.map +1 -1
- package/dist/modules/workspace/startup/steps/template-files.step.d.ts +17 -3
- package/dist/modules/workspace/startup/steps/template-files.step.d.ts.map +1 -1
- package/dist/modules/workspace/startup/steps/template-files.step.js +36 -30
- package/dist/modules/workspace/startup/steps/template-files.step.js.map +1 -1
- package/dist/modules/workspace/startup/steps/template-source.d.ts +6 -1
- package/dist/modules/workspace/startup/steps/template-source.d.ts.map +1 -1
- package/dist/modules/workspace/startup/steps/template-source.js +10 -6
- package/dist/modules/workspace/startup/steps/template-source.js.map +1 -1
- package/dist/modules/workspace/workspace.routes.d.ts +2 -1
- package/dist/modules/workspace/workspace.routes.d.ts.map +1 -1
- package/dist/modules/workspace/workspace.routes.js +8 -7
- package/dist/modules/workspace/workspace.routes.js.map +1 -1
- package/dist/modules/workspace/workspace.service.d.ts +26 -12
- package/dist/modules/workspace/workspace.service.d.ts.map +1 -1
- package/dist/modules/workspace/workspace.service.js +41 -28
- package/dist/modules/workspace/workspace.service.js.map +1 -1
- package/dist/modules/workspace/workspace.tools.d.ts +2 -1
- package/dist/modules/workspace/workspace.tools.d.ts.map +1 -1
- package/dist/modules/workspace/workspace.tools.js +69 -31
- package/dist/modules/workspace/workspace.tools.js.map +1 -1
- package/dist/modules/workspace/write-denial.d.ts +3 -2
- package/dist/modules/workspace/write-denial.d.ts.map +1 -1
- package/dist/modules/workspace/write-denial.js +6 -5
- package/dist/modules/workspace/write-denial.js.map +1 -1
- package/dist/shared/git-internals.d.ts +7 -1
- package/dist/shared/git-internals.d.ts.map +1 -1
- package/dist/shared/git-internals.js +67 -9
- package/dist/shared/git-internals.js.map +1 -1
- package/dist/shared/git.contract.d.ts +52 -7
- package/dist/shared/git.contract.d.ts.map +1 -1
- package/dist/shared/git.contract.js +30 -8
- package/dist/shared/git.contract.js.map +1 -1
- package/dist/shared/kb-context.d.ts +76 -0
- package/dist/shared/kb-context.d.ts.map +1 -0
- package/dist/shared/kb-context.js +108 -0
- package/dist/shared/kb-context.js.map +1 -0
- package/dist/shared/kb-layout.d.ts +3 -2
- package/dist/shared/kb-layout.d.ts.map +1 -1
- package/dist/shared/kb-layout.js +4 -3
- package/dist/shared/kb-layout.js.map +1 -1
- package/dist/shared/kb-layout.test.js +35 -27
- package/dist/shared/kb-layout.test.js.map +1 -1
- package/dist/shared/pending-proposals.d.ts +4 -1
- package/dist/shared/pending-proposals.d.ts.map +1 -1
- package/dist/shared/pending-proposals.js +3 -4
- package/dist/shared/pending-proposals.js.map +1 -1
- package/dist/shared/redact-secret.d.ts +5 -5
- package/dist/shared/redact-secret.js +5 -5
- package/dist/tenancy/index.d.ts +13 -0
- package/dist/tenancy/index.d.ts.map +1 -0
- package/dist/tenancy/index.js +13 -0
- package/dist/tenancy/index.js.map +1 -0
- package/dist/tenancy/static-tenant-source.d.ts +98 -0
- package/dist/tenancy/static-tenant-source.d.ts.map +1 -0
- package/dist/tenancy/static-tenant-source.js +220 -0
- package/dist/tenancy/static-tenant-source.js.map +1 -0
- package/dist/tenancy/tenant-host.d.ts +80 -0
- package/dist/tenancy/tenant-host.d.ts.map +1 -0
- package/dist/tenancy/tenant-host.js +217 -0
- package/dist/tenancy/tenant-host.js.map +1 -0
- package/dist/tenancy/tenant-runtime.d.ts +91 -0
- package/dist/tenancy/tenant-runtime.d.ts.map +1 -0
- package/dist/tenancy/tenant-runtime.js +174 -0
- package/dist/tenancy/tenant-runtime.js.map +1 -0
- package/dist/tenancy/tenant-secrets.d.ts +24 -0
- package/dist/tenancy/tenant-secrets.d.ts.map +1 -0
- package/dist/tenancy/tenant-secrets.js +30 -0
- package/dist/tenancy/tenant-secrets.js.map +1 -0
- package/dist/tenancy/tenant-source.contract.d.ts +45 -0
- package/dist/tenancy/tenant-source.contract.d.ts.map +1 -0
- package/dist/tenancy/tenant-source.contract.js +21 -0
- package/dist/tenancy/tenant-source.contract.js.map +1 -0
- package/migrations/0000_core_init.sql +14 -14
- package/migrations/0003_deployment_settings.sql +1 -1
- package/migrations/0005_github_facade.sql +1 -1
- package/migrations/0012_agent_audit.sql +41 -0
- package/migrations/0013_agent_identity_and_key_soft_delete.sql +29 -0
- package/migrations/meta/0012_snapshot.json +2247 -0
- package/migrations/meta/0013_snapshot.json +2259 -0
- package/migrations/meta/_journal.json +14 -0
- package/package.json +4 -4
- package/src/__tests__/branch-model.test.ts +7 -6
- package/src/__tests__/kb-context.ts +30 -0
- package/src/__tests__/kb-layout-config.test.ts +35 -30
- package/src/core/__tests__/catalog-cache-invalidation.test.ts +2 -1
- package/src/core/__tests__/lifecycle.test.ts +78 -1
- package/src/core/__tests__/public-config.test.ts +5 -1
- package/src/core/catalog-cache-invalidation.ts +16 -11
- package/src/core/core-ports.ts +19 -0
- package/src/core/create-core-server.ts +55 -106
- package/src/core/create-core-services.ts +193 -95
- package/src/core/lifecycle.ts +214 -29
- package/src/core/public-config.ts +8 -5
- package/src/core-config.ts +107 -8
- package/src/index.ts +25 -2
- package/src/modules/access/__tests__/access-control.admin-root-floor.test.ts +2 -1
- package/src/modules/access/__tests__/access.routes.batch.test.ts +2 -1
- package/src/modules/access/__tests__/access.routes.folder-governs.test.ts +2 -1
- package/src/modules/access/__tests__/access.routes.group-grant.test.ts +2 -1
- package/src/modules/access/__tests__/access.routes.overrides.test.ts +2 -1
- package/src/modules/access/__tests__/access.routes.proposal-branch.test.ts +2 -1
- package/src/modules/access/__tests__/access.routes.prospective.test.ts +2 -1
- package/src/modules/access/__tests__/access.routes.revoke.test.ts +2 -1
- package/src/modules/access/__tests__/access.routes.unknown-email.test.ts +2 -1
- package/src/modules/access/__tests__/change-read-gate.test.ts +13 -11
- package/src/modules/access/__tests__/creator-access.test.ts +3 -2
- package/src/modules/access/__tests__/roles.routes.test.ts +2 -1
- package/src/modules/access/access-control.service.ts +20 -6
- package/src/modules/access/access.routes.ts +10 -13
- package/src/modules/access/change-read-gate.ts +10 -4
- package/src/modules/access/creator-access.ts +7 -2
- package/src/modules/agent-instructions/__tests__/read-preamble.test.ts +13 -12
- package/src/modules/agent-instructions/read-preamble.ts +10 -12
- package/src/modules/audit/__tests__/agent-audit.service.test.ts +370 -0
- package/src/modules/audit/__tests__/agent-rest-audit.middleware.test.ts +113 -0
- package/src/modules/audit/__tests__/audit.routes.test.ts +201 -0
- package/src/modules/audit/__tests__/event-classifier.test.ts +121 -0
- package/src/modules/audit/agent-audit.service.ts +316 -0
- package/src/modules/audit/agent-rest-audit.middleware.ts +83 -0
- package/src/modules/audit/audit.contract.ts +164 -0
- package/src/modules/audit/audit.routes.ts +168 -0
- package/src/modules/audit/event-classifier.ts +155 -0
- package/src/modules/audit/index.ts +14 -0
- package/src/modules/audit/request-audit.ts +141 -0
- package/src/modules/auth/__tests__/account.routes.test.ts +15 -0
- package/src/modules/auth/__tests__/auth.service.test.ts +60 -0
- package/src/modules/auth/account-admission.ts +44 -0
- package/src/modules/auth/account.routes.ts +4 -1
- package/src/modules/auth/auth.service.ts +33 -1
- package/src/modules/auth/oidc-auth-provider.ts +9 -0
- package/src/modules/connection-probe/connection-probe.service.ts +7 -1
- package/src/modules/database/__tests__/advisory-lock.test.ts +23 -1
- package/src/modules/database/__tests__/connection.test.ts +98 -0
- package/src/modules/database/__tests__/migrations-unqualified.test.ts +32 -0
- package/src/modules/database/advisory-lock.ts +28 -4
- package/src/modules/database/connection.ts +143 -13
- package/src/modules/database/core-schema.ts +104 -0
- package/src/modules/database/migrate.ts +48 -14
- package/src/modules/diff/__tests__/diff.service.seed-atomicity.test.ts +2 -1
- package/src/modules/diff/__tests__/diff.service.test.ts +2 -1
- package/src/modules/diff/diff.service.ts +6 -1
- package/src/modules/kb-fs/__tests__/branch-name.test.ts +6 -6
- package/src/modules/kb-fs/__tests__/clone-config.test.ts +24 -20
- package/src/modules/kb-fs/branch-name.ts +3 -3
- package/src/modules/kb-fs/clone-config.ts +15 -12
- package/src/modules/kb-fs/git-guarded-filesystem.ts +16 -3
- package/src/modules/marketplace/__tests__/marketplace-repo.head.test.ts +2 -1
- package/src/modules/mcp/__tests__/bevel-oauth-provider.test.ts +183 -13
- package/src/modules/mcp/__tests__/mcp-auth.middleware.test.ts +60 -2
- package/src/modules/mcp/__tests__/mcp.routes.local-token.test.ts +24 -4
- package/src/modules/mcp/__tests__/mcp.routes.stateless.test.ts +1 -1
- package/src/modules/mcp/__tests__/mcp.service.test.ts +120 -3
- package/src/modules/mcp/mcp-auth.middleware.ts +31 -0
- package/src/modules/mcp/mcp.routes.ts +11 -1
- package/src/modules/mcp/mcp.service.ts +73 -8
- package/src/modules/mcp/oauth/bevel-oauth-provider.ts +184 -6
- package/src/modules/plugins/__tests__/bundle-dialect.e2e.test.ts +12 -11
- package/src/modules/plugins/__tests__/bundle-dialect.test.ts +2 -1
- package/src/modules/plugins/__tests__/compile-marketplace.test.ts +6 -4
- package/src/modules/plugins/__tests__/join-request-jobs.service.test.ts +2 -1
- package/src/modules/plugins/__tests__/join-requests.service.test.ts +2 -1
- package/src/modules/plugins/__tests__/plugin-creation-display-name.test.ts +4 -3
- package/src/modules/plugins/__tests__/plugin-index.service.test.ts +6 -4
- package/src/modules/plugins/__tests__/plugin-links.service.test.ts +220 -5
- package/src/modules/plugins/__tests__/plugin-provision.service.test.ts +3 -1
- package/src/modules/plugins/__tests__/plugin-rename.service.test.ts +7 -6
- package/src/modules/plugins/__tests__/plugins.routes.test.ts +11 -2
- package/src/modules/plugins/__tests__/teams.routes.test.ts +2 -1
- package/src/modules/plugins/compile/marketplace-compiler.service.ts +7 -9
- package/src/modules/plugins/discovery/__tests__/kb-plugin-source.test.ts +20 -16
- package/src/modules/plugins/discovery/bundle-dialect/bundle.source.ts +9 -2
- package/src/modules/plugins/discovery/kb-plugin-source.ts +15 -8
- package/src/modules/plugins/discovery/native.source.ts +4 -1
- package/src/modules/plugins/index.ts +1 -1
- package/src/modules/plugins/join-request-jobs.service.ts +8 -7
- package/src/modules/plugins/join-requests.service.ts +7 -7
- package/src/modules/plugins/plugin-links.service.ts +192 -19
- package/src/modules/plugins/plugin-links.ts +147 -27
- package/src/modules/plugins/plugin-provision.service.ts +54 -27
- package/src/modules/plugins/plugin-rename.service.ts +10 -10
- package/src/modules/plugins/plugins.routes.ts +45 -15
- package/src/modules/plugins/plugins.service.ts +7 -11
- package/src/modules/plugins/teams.routes.ts +16 -8
- package/src/modules/secrets-vault/__tests__/connect-pending.route.test.ts +7 -0
- package/src/modules/secrets-vault/__tests__/secrets-variable-loader.test.ts +40 -0
- package/src/modules/secrets-vault/__tests__/tool-owner-gate.route.test.ts +2 -0
- package/src/modules/secrets-vault/index.ts +2 -0
- package/src/modules/secrets-vault/secrets-variable-loader.ts +51 -21
- package/src/modules/secrets-vault/secrets-vault.routes.ts +7 -6
- package/src/modules/settings/__tests__/deployment-settings.service.test.ts +59 -11
- package/src/modules/settings/__tests__/git-root-folders.test.ts +2 -1
- package/src/modules/settings/__tests__/setup.routes.boot-failure.test.ts +2 -1
- package/src/modules/settings/__tests__/setup.routes.layout-phase.test.ts +7 -4
- package/src/modules/settings/__tests__/setup.routes.oidc.test.ts +2 -0
- package/src/modules/settings/__tests__/setup.routes.sync-status.test.ts +2 -0
- package/src/modules/settings/__tests__/setup.routes.test.ts +33 -52
- package/src/modules/settings/deployment-settings.service.ts +68 -28
- package/src/modules/settings/setup.routes.ts +26 -16
- package/src/modules/skills/__tests__/allowed-tools-check.test.ts +11 -10
- package/src/modules/skills/__tests__/allowed-tools-warn.tools.test.ts +4 -3
- package/src/modules/skills/__tests__/pending-skills.service.test.ts +3 -1
- package/src/modules/skills/__tests__/skill-access-requests.routes.test.ts +2 -1
- package/src/modules/skills/__tests__/skills.routes.warnings.test.ts +2 -1
- package/src/modules/skills/__tests__/skills.service.test.ts +3 -2
- package/src/modules/skills/allowed-tools-check.ts +7 -6
- package/src/modules/skills/pending-skills.service.ts +9 -8
- package/src/modules/skills/skill-access-requests.routes.ts +7 -7
- package/src/modules/skills/skills.routes.ts +4 -3
- package/src/modules/skills/skills.service.ts +13 -9
- package/src/modules/tool-auth/__tests__/external-api-key.service.test.ts +29 -8
- package/src/modules/tool-auth/__tests__/internal-token.service.test.ts +6 -0
- package/src/modules/tool-auth/external-api-key.interface.ts +22 -5
- package/src/modules/tool-auth/external-api-key.service.ts +25 -8
- package/src/modules/tool-auth/internal-token.service.ts +11 -0
- package/src/modules/tool-auth/tool-auth.middleware.ts +17 -1
- package/src/modules/tool-helpers/__tests__/agent-roles-write.test.ts +3 -2
- package/src/modules/tool-helpers/__tests__/phase4-tools.test.ts +3 -2
- package/src/modules/tool-manuals/__tests__/mcp-json-discovery.test.ts +17 -12
- package/src/modules/tool-manuals/__tests__/mcp-server-edit.service.test.ts +2 -1
- package/src/modules/tool-manuals/__tests__/pending-tools.service.test.ts +4 -1
- package/src/modules/tool-manuals/__tests__/tool-delete.service.test.ts +2 -1
- package/src/modules/tool-manuals/__tests__/tool-manuals.archive.route.test.ts +2 -1
- package/src/modules/tool-manuals/__tests__/tool-manuals.cli.test.ts +5 -4
- package/src/modules/tool-manuals/__tests__/tool-manuals.detail.route.test.ts +2 -1
- package/src/modules/tool-manuals/__tests__/tool-manuals.invalid.routes.test.ts +4 -2
- package/src/modules/tool-manuals/__tests__/tool-manuals.invalid.test.ts +13 -5
- package/src/modules/tool-manuals/__tests__/tool-manuals.mcp-oauth.test.ts +2 -1
- package/src/modules/tool-manuals/__tests__/tool-manuals.restart.test.ts +9 -1
- package/src/modules/tool-manuals/__tests__/tool-manuals.service.test.ts +3 -2
- package/src/modules/tool-manuals/__tests__/tool-manuals.tools.test.ts +2 -0
- package/src/modules/tool-manuals/mcp-json-discovery.ts +6 -4
- package/src/modules/tool-manuals/mcp-server-edit.service.ts +13 -11
- package/src/modules/tool-manuals/pending-tools.service.ts +19 -16
- package/src/modules/tool-manuals/tool-delete.service.ts +13 -10
- package/src/modules/tool-manuals/tool-manuals.routes.ts +10 -8
- package/src/modules/tool-manuals/tool-manuals.service.ts +15 -13
- package/src/modules/tool-manuals/tool-manuals.tools.ts +7 -6
- package/src/modules/workflow/__tests__/apply-failure.test.ts +2 -1
- package/src/modules/workflow/__tests__/merge-announces-tree.test.ts +14 -26
- package/src/modules/workflow/__tests__/preserve-roles-yaml.test.ts +2 -1
- package/src/modules/workflow/__tests__/session-ontology.service.test.ts +3 -2
- package/src/modules/workflow/__tests__/workflow.routes.lock-path.test.ts +2 -1
- package/src/modules/workflow/__tests__/workflow.service.branch-in-use.test.ts +3 -10
- package/src/modules/workflow/__tests__/workflow.service.commitFileWhileLocked.test.ts +2 -1
- package/src/modules/workflow/__tests__/workflow.service.deleted-branch-sweep.test.ts +3 -10
- package/src/modules/workflow/__tests__/workflow.service.facade.test.ts +28 -27
- package/src/modules/workflow/__tests__/workflow.service.folder-proposals.test.ts +2 -1
- package/src/modules/workflow/__tests__/workflow.service.platform-restore.test.ts +2 -1
- package/src/modules/workflow/__tests__/workflow.service.read-gate.test.ts +3 -2
- package/src/modules/workflow/__tests__/workflow.service.releaseLock.test.ts +2 -1
- package/src/modules/workflow/__tests__/workflow.service.sync.test.ts +5 -4
- package/src/modules/workflow/__tests__/workflow.service.update-from-target.test.ts +2 -1
- package/src/modules/workflow/agent-tools/__tests__/workflow.tools.test.ts +2 -1
- package/src/modules/workflow/agent-tools/workflow.tools.ts +11 -9
- package/src/modules/workflow/git/__tests__/git.service.accessGating.test.ts +5 -4
- package/src/modules/workflow/git/__tests__/git.service.changedFilesForPr.test.ts +12 -11
- package/src/modules/workflow/git/__tests__/git.service.commitChanges.test.ts +9 -8
- package/src/modules/workflow/git/__tests__/git.service.commitFile.strayPath.test.ts +8 -7
- package/src/modules/workflow/git/__tests__/git.service.commitFile.test.ts +6 -5
- package/src/modules/workflow/git/__tests__/git.service.createBranch.test.ts +3 -2
- package/src/modules/workflow/git/__tests__/git.service.deleteBranch.test.ts +3 -2
- package/src/modules/workflow/git/__tests__/git.service.diffFileAtCommit.test.ts +7 -6
- package/src/modules/workflow/git/__tests__/git.service.diffFileBetweenBranches.test.ts +16 -15
- package/src/modules/workflow/git/__tests__/git.service.fileContentsAtCommit.test.ts +3 -2
- package/src/modules/workflow/git/__tests__/git.service.forkPoint.test.ts +2 -1
- package/src/modules/workflow/git/__tests__/git.service.history-guards.test.ts +2 -1
- package/src/modules/workflow/git/__tests__/git.service.list-branches.test.ts +10 -9
- package/src/modules/workflow/git/__tests__/git.service.listTrackedFiles.test.ts +2 -1
- package/src/modules/workflow/git/__tests__/git.service.logForFile.test.ts +6 -5
- package/src/modules/workflow/git/__tests__/git.service.mergeChangeRequest.test.ts +9 -8
- package/src/modules/workflow/git/__tests__/git.service.pendingChanges.test.ts +2 -1
- package/src/modules/workflow/git/__tests__/git.service.postMergePull.test.ts +4 -3
- package/src/modules/workflow/git/__tests__/git.service.pull.test.ts +9 -8
- package/src/modules/workflow/git/__tests__/git.service.readFileAtRef.test.ts +2 -1
- package/src/modules/workflow/git/__tests__/git.service.revertPathsAndPush.test.ts +2 -1
- package/src/modules/workflow/git/__tests__/git.service.status.test.ts +4 -3
- package/src/modules/workflow/git/__tests__/git.service.syncFromRemote.test.ts +8 -7
- package/src/modules/workflow/git/__tests__/node-git-runner.test.ts +41 -3
- package/src/modules/workflow/git/git.service.ts +24 -13
- package/src/modules/workflow/git/node-git-runner.ts +37 -4
- package/src/modules/workflow/review-workflow/review-workflow.service.ts +9 -6
- package/src/modules/workflow/session-ontology.service.ts +7 -2
- package/src/modules/workflow/workflow.service.ts +31 -24
- package/src/modules/workspace/__tests__/file-stat-access.test.ts +3 -2
- package/src/modules/workspace/__tests__/git-internals.security.test.ts +144 -52
- package/src/modules/workspace/__tests__/session-ontology.gate.test.ts +4 -2
- package/src/modules/workspace/__tests__/workspace-paths-inside-the-repo.test.ts +3 -2
- package/src/modules/workspace/__tests__/workspace.routes.branch-errors.test.ts +2 -1
- package/src/modules/workspace/__tests__/workspace.routes.create-grant.test.ts +2 -1
- package/src/modules/workspace/__tests__/workspace.routes.delete.test.ts +2 -1
- package/src/modules/workspace/__tests__/workspace.routes.download-implies-read.test.ts +2 -1
- package/src/modules/workspace/__tests__/workspace.routes.download.test.ts +2 -1
- package/src/modules/workspace/__tests__/workspace.routes.file-writes.test.ts +2 -1
- package/src/modules/workspace/__tests__/workspace.routes.folders.test.ts +5 -4
- package/src/modules/workspace/__tests__/workspace.routes.move-platform-files.test.ts +2 -1
- package/src/modules/workspace/__tests__/workspace.routes.read-gate.test.ts +2 -1
- package/src/modules/workspace/__tests__/workspace.service.ensure-remotes-fetched.test.ts +2 -2
- package/src/modules/workspace/__tests__/workspace.service.list-cloned.test.ts +6 -5
- package/src/modules/workspace/__tests__/workspace.service.move-never-overwrites.test.ts +2 -1
- package/src/modules/workspace/__tests__/workspace.service.read-filter.test.ts +2 -1
- package/src/modules/workspace/__tests__/workspace.service.test.ts +84 -50
- package/src/modules/workspace/__tests__/workspace.service.unknown-branch.test.ts +2 -1
- package/src/modules/workspace/__tests__/workspace.tools.agents-file.test.ts +10 -7
- package/src/modules/workspace/__tests__/workspace.tools.branch-errors.test.ts +4 -3
- package/src/modules/workspace/__tests__/workspace.tools.test.ts +9 -8
- package/src/modules/workspace/__tests__/write-denial.test.ts +5 -4
- package/src/modules/workspace/session-ontology.gate.ts +6 -4
- package/src/modules/workspace/startup/__tests__/kb-startup-runner.degraded.test.ts +6 -2
- package/src/modules/workspace/startup/__tests__/kb-startup-runner.test.ts +29 -21
- package/src/modules/workspace/startup/kb-git.ts +15 -22
- package/src/modules/workspace/startup/kb-startup-runner.ts +40 -46
- package/src/modules/workspace/startup/steps/__tests__/steps.test.ts +104 -98
- package/src/modules/workspace/startup/steps/groups-to-plugins.step.ts +24 -16
- package/src/modules/workspace/startup/steps/personal-spaces.step.ts +14 -5
- package/src/modules/workspace/startup/steps/plugin-display-names.step.ts +13 -5
- package/src/modules/workspace/startup/steps/plugin-manifests.step.ts +14 -5
- package/src/modules/workspace/startup/steps/seed-tree.ts +11 -9
- package/src/modules/workspace/startup/steps/template-files.step.ts +43 -34
- package/src/modules/workspace/startup/steps/template-source.ts +8 -5
- package/src/modules/workspace/workspace.routes.ts +8 -7
- package/src/modules/workspace/workspace.service.ts +39 -27
- package/src/modules/workspace/workspace.tools.ts +68 -31
- package/src/modules/workspace/write-denial.ts +7 -5
- package/src/shared/__tests__/git-internals.test.ts +41 -0
- package/src/shared/__tests__/kb-layout.plugin.test.ts +19 -16
- package/src/shared/git-internals.ts +61 -6
- package/src/shared/git.contract.ts +70 -8
- package/src/shared/kb-context.ts +130 -0
- package/src/shared/kb-layout.test.ts +37 -27
- package/src/shared/kb-layout.ts +4 -3
- package/src/shared/pending-proposals.ts +7 -4
- package/src/shared/redact-secret.ts +5 -5
- package/src/tenancy/__tests__/static-tenant-source.test.ts +177 -0
- package/src/tenancy/__tests__/tenant-host.test.ts +372 -0
- package/src/tenancy/__tests__/tenant-runtime.test.ts +221 -0
- package/src/tenancy/__tests__/tenant-secrets.test.ts +35 -0
- package/src/tenancy/index.ts +35 -0
- package/src/tenancy/static-tenant-source.ts +296 -0
- package/src/tenancy/tenant-host.ts +261 -0
- package/src/tenancy/tenant-runtime.ts +208 -0
- package/src/tenancy/tenant-secrets.ts +41 -0
- package/src/tenancy/tenant-source.contract.ts +59 -0
- package/dist/modules/access/access-errors.d.ts +0 -34
- package/dist/modules/access/access-errors.d.ts.map +0 -1
- package/dist/modules/access/access-errors.js +0 -40
- package/dist/modules/access/access-errors.js.map +0 -1
- package/dist/modules/access/access-splice.d.ts +0 -140
- package/dist/modules/access/access-splice.d.ts.map +0 -1
- package/dist/modules/access/access-splice.js +0 -389
- package/dist/modules/access/access-splice.js.map +0 -1
- package/dist/modules/access/group-files.d.ts +0 -83
- package/dist/modules/access/group-files.d.ts.map +0 -1
- package/dist/modules/access/group-files.js +0 -167
- package/dist/modules/access/group-files.js.map +0 -1
- package/dist/modules/access/kb-read-filter.d.ts +0 -41
- package/dist/modules/access/kb-read-filter.d.ts.map +0 -1
- package/dist/modules/access/kb-read-filter.js +0 -60
- package/dist/modules/access/kb-read-filter.js.map +0 -1
- package/dist/modules/access/render-roles-yaml.d.ts +0 -22
- package/dist/modules/access/render-roles-yaml.d.ts.map +0 -1
- package/dist/modules/access/render-roles-yaml.js +0 -56
- package/dist/modules/access/render-roles-yaml.js.map +0 -1
- package/dist/modules/access/roles-yaml-guard.d.ts +0 -56
- package/dist/modules/access/roles-yaml-guard.d.ts.map +0 -1
- package/dist/modules/access/roles-yaml-guard.js +0 -79
- package/dist/modules/access/roles-yaml-guard.js.map +0 -1
- package/dist/modules/diff/diff-paths.d.ts +0 -2
- package/dist/modules/diff/diff-paths.d.ts.map +0 -1
- package/dist/modules/diff/diff-paths.js +0 -9
- package/dist/modules/diff/diff-paths.js.map +0 -1
- package/dist/modules/groups/group-provision.service.d.ts +0 -130
- package/dist/modules/groups/group-provision.service.d.ts.map +0 -1
- package/dist/modules/groups/group-provision.service.js +0 -288
- package/dist/modules/groups/group-provision.service.js.map +0 -1
- package/dist/modules/groups/groups.contract.d.ts +0 -106
- package/dist/modules/groups/groups.contract.d.ts.map +0 -1
- package/dist/modules/groups/groups.contract.js +0 -36
- package/dist/modules/groups/groups.contract.js.map +0 -1
- package/dist/modules/groups/groups.routes.d.ts +0 -42
- package/dist/modules/groups/groups.routes.d.ts.map +0 -1
- package/dist/modules/groups/groups.routes.js +0 -379
- package/dist/modules/groups/groups.routes.js.map +0 -1
- package/dist/modules/groups/groups.service.d.ts +0 -60
- package/dist/modules/groups/groups.service.d.ts.map +0 -1
- package/dist/modules/groups/groups.service.js +0 -172
- package/dist/modules/groups/groups.service.js.map +0 -1
- package/dist/modules/groups/index.d.ts +0 -7
- package/dist/modules/groups/index.d.ts.map +0 -1
- package/dist/modules/groups/index.js +0 -6
- package/dist/modules/groups/index.js.map +0 -1
- package/dist/modules/groups/join-proposals.d.ts +0 -53
- package/dist/modules/groups/join-proposals.d.ts.map +0 -1
- package/dist/modules/groups/join-proposals.js +0 -67
- package/dist/modules/groups/join-proposals.js.map +0 -1
- package/dist/modules/groups/join-requests.service.d.ts +0 -81
- package/dist/modules/groups/join-requests.service.d.ts.map +0 -1
- package/dist/modules/groups/join-requests.service.js +0 -135
- package/dist/modules/groups/join-requests.service.js.map +0 -1
- package/dist/modules/mcp/mcp-session-store.d.ts +0 -74
- package/dist/modules/mcp/mcp-session-store.d.ts.map +0 -1
- package/dist/modules/mcp/mcp-session-store.js +0 -131
- package/dist/modules/mcp/mcp-session-store.js.map +0 -1
- package/dist/modules/workflow/file-change-notifier.d.ts +0 -38
- package/dist/modules/workflow/file-change-notifier.d.ts.map +0 -1
- package/dist/modules/workflow/file-change-notifier.js +0 -22
- package/dist/modules/workflow/file-change-notifier.js.map +0 -1
- package/dist/modules/workflow/git/branch-name.d.ts +0 -10
- package/dist/modules/workflow/git/branch-name.d.ts.map +0 -1
- package/dist/modules/workflow/git/branch-name.js +0 -76
- package/dist/modules/workflow/git/branch-name.js.map +0 -1
- package/dist/modules/workflow/git/clone-config.d.ts +0 -61
- package/dist/modules/workflow/git/clone-config.d.ts.map +0 -1
- package/dist/modules/workflow/git/clone-config.js +0 -69
- package/dist/modules/workflow/git/clone-config.js.map +0 -1
- package/dist/modules/workflow/git/mutex.d.ts +0 -11
- package/dist/modules/workflow/git/mutex.d.ts.map +0 -1
- package/dist/modules/workflow/git/mutex.js +0 -23
- package/dist/modules/workflow/git/mutex.js.map +0 -1
- package/dist/modules/workflow/locking-filesystem.d.ts +0 -137
- package/dist/modules/workflow/locking-filesystem.d.ts.map +0 -1
- package/dist/modules/workflow/locking-filesystem.js +0 -553
- package/dist/modules/workflow/locking-filesystem.js.map +0 -1
- package/dist/modules/workflow/read-only-filesystem.d.ts +0 -24
- package/dist/modules/workflow/read-only-filesystem.d.ts.map +0 -1
- package/dist/modules/workflow/read-only-filesystem.js +0 -39
- package/dist/modules/workflow/read-only-filesystem.js.map +0 -1
- package/dist/modules/workflow/workflow.errors.d.ts +0 -197
- package/dist/modules/workflow/workflow.errors.d.ts.map +0 -1
- package/dist/modules/workflow/workflow.errors.js +0 -298
- package/dist/modules/workflow/workflow.errors.js.map +0 -1
- package/dist/modules/workspace/bevel-ignore.d.ts +0 -30
- package/dist/modules/workspace/bevel-ignore.d.ts.map +0 -1
- package/dist/modules/workspace/bevel-ignore.js +0 -61
- package/dist/modules/workspace/bevel-ignore.js.map +0 -1
- package/dist/modules/workspace/kb-seed.interface.d.ts +0 -36
- package/dist/modules/workspace/kb-seed.interface.d.ts.map +0 -1
- package/dist/modules/workspace/kb-seed.interface.js +0 -2
- package/dist/modules/workspace/kb-seed.interface.js.map +0 -1
- package/dist/modules/workspace/kb-seed.service.d.ts +0 -125
- package/dist/modules/workspace/kb-seed.service.d.ts.map +0 -1
- package/dist/modules/workspace/kb-seed.service.js +0 -535
- package/dist/modules/workspace/kb-seed.service.js.map +0 -1
- package/dist/modules/workspace/plugins-migration.d.ts +0 -50
- package/dist/modules/workspace/plugins-migration.d.ts.map +0 -1
- package/dist/modules/workspace/plugins-migration.js +0 -379
- package/dist/modules/workspace/plugins-migration.js.map +0 -1
- package/dist/shared/fs-errors.d.ts +0 -8
- package/dist/shared/fs-errors.d.ts.map +0 -1
- package/dist/shared/fs-errors.js +0 -11
- package/dist/shared/fs-errors.js.map +0 -1
- package/dist/shared/fs-walk.d.ts +0 -23
- package/dist/shared/fs-walk.d.ts.map +0 -1
- package/dist/shared/fs-walk.js +0 -42
- package/dist/shared/fs-walk.js.map +0 -1
- package/dist/shared/hash-email.d.ts +0 -11
- package/dist/shared/hash-email.d.ts.map +0 -1
- package/dist/shared/hash-email.js +0 -14
- package/dist/shared/hash-email.js.map +0 -1
- package/dist/shared/kb-walk.d.ts +0 -52
- package/dist/shared/kb-walk.d.ts.map +0 -1
- package/dist/shared/kb-walk.js +0 -76
- package/dist/shared/kb-walk.js.map +0 -1
|
@@ -1,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 { NodeFs } from '../../kb-fs/node-fs.js';
|
|
3
4
|
import fs from 'node:fs/promises';
|
|
4
5
|
import path from 'node:path';
|
|
@@ -36,7 +37,7 @@ describe('WorkspaceService.listClonedWorkspaces', () => {
|
|
|
36
37
|
// A stray file at the root is ignored.
|
|
37
38
|
await fs.writeFile(path.join(root, 'notes.txt'), 'x');
|
|
38
39
|
|
|
39
|
-
const svc = new WorkspaceService(root, 'https://example.test/kb.git',
|
|
40
|
+
const svc = new WorkspaceService(root, 'https://example.test/kb.git', testKbContext(), new NodeFs());
|
|
40
41
|
const found = await svc.listClonedWorkspaces();
|
|
41
42
|
expect(found.sort((a, b) => a.branch.localeCompare(b.branch))).toEqual([
|
|
42
43
|
{ id: 'ali%2Fnew-skill', branch: 'ali/new-skill' },
|
|
@@ -45,7 +46,7 @@ describe('WorkspaceService.listClonedWorkspaces', () => {
|
|
|
45
46
|
});
|
|
46
47
|
|
|
47
48
|
it('is empty when the workspaces root does not exist yet', async () => {
|
|
48
|
-
const svc = new WorkspaceService(path.join(root, 'missing'), 'https://example.test/kb.git',
|
|
49
|
+
const svc = new WorkspaceService(path.join(root, 'missing'), 'https://example.test/kb.git', testKbContext(), new NodeFs());
|
|
49
50
|
expect(await svc.listClonedWorkspaces()).toEqual([]);
|
|
50
51
|
});
|
|
51
52
|
});
|
|
@@ -66,14 +67,14 @@ describe('WorkspaceService.listClonedWorkspaces — what is not a clone', () =>
|
|
|
66
67
|
for (const name of ['main', 'foo!', '-leading-dash', 'a..b', 'has space']) {
|
|
67
68
|
await fs.mkdir(path.join(root, name, 'knowledge-base', '.git'), { recursive: true });
|
|
68
69
|
}
|
|
69
|
-
const svc = new WorkspaceService(root, 'https://example.test/kb.git',
|
|
70
|
+
const svc = new WorkspaceService(root, 'https://example.test/kb.git', testKbContext(), new NodeFs());
|
|
70
71
|
expect(await svc.listClonedWorkspaces()).toEqual([{ id: 'main', branch: 'main' }]);
|
|
71
72
|
});
|
|
72
73
|
|
|
73
74
|
it('a branch whose bootstrap is in flight right now', async () => {
|
|
74
75
|
await fs.mkdir(path.join(root, 'main', 'knowledge-base', '.git'), { recursive: true });
|
|
75
76
|
await fs.mkdir(path.join(root, 'ali%2Fx', 'knowledge-base', '.git'), { recursive: true });
|
|
76
|
-
const svc = new WorkspaceService(root, 'https://example.test/kb.git',
|
|
77
|
+
const svc = new WorkspaceService(root, 'https://example.test/kb.git', testKbContext(), new NodeFs());
|
|
77
78
|
// While a clone runs, `.git` exists but the tree is not checked out yet.
|
|
78
79
|
// The listing asks the public predicate, which is stubbed here rather than
|
|
79
80
|
// the tracker behind it — no public seam can hold a real clone open.
|
|
@@ -88,7 +89,7 @@ describe('WorkspaceService.listClonedWorkspaces — what is not a clone', () =>
|
|
|
88
89
|
// to stage one in a temp dir; the code path is the same `throw err`.
|
|
89
90
|
const file = path.join(root, 'not-a-dir');
|
|
90
91
|
await fs.writeFile(file, 'x');
|
|
91
|
-
const svc = new WorkspaceService(file, 'https://example.test/kb.git',
|
|
92
|
+
const svc = new WorkspaceService(file, 'https://example.test/kb.git', testKbContext(), new NodeFs());
|
|
92
93
|
expect(await svc.listClonedWorkspaces()).toEqual([]);
|
|
93
94
|
});
|
|
94
95
|
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
|
|
2
|
+
import { testKbContext } from '../../../__tests__/kb-context.js';
|
|
2
3
|
import fs from 'node:fs/promises';
|
|
3
4
|
import path from 'node:path';
|
|
4
5
|
import os from 'node:os';
|
|
@@ -57,7 +58,7 @@ describe('WorkspaceService.moveEntry — a name that is taken is refused, never
|
|
|
57
58
|
svc = new WorkspaceService(
|
|
58
59
|
root,
|
|
59
60
|
'https://github.com/Bevel-Software/knowledge-base.git',
|
|
60
|
-
KB,
|
|
61
|
+
testKbContext({ kbDirName: KB }),
|
|
61
62
|
new NodeFs(),
|
|
62
63
|
);
|
|
63
64
|
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
|
|
2
|
+
import { testKbContext } from '../../../__tests__/kb-context.js';
|
|
2
3
|
import { NodeFs } from '../../kb-fs/node-fs.js';
|
|
3
4
|
import fs from 'node:fs/promises';
|
|
4
5
|
import path from 'node:path';
|
|
@@ -47,7 +48,7 @@ describe('WorkspaceService.listFiles — read filter', () => {
|
|
|
47
48
|
// readers, say), and its files are readable.
|
|
48
49
|
await mkFile(workspaceDir, 'Scopes/Deploy/SKILL.md');
|
|
49
50
|
await mkFile(workspaceDir, 'Scopes/other.md');
|
|
50
|
-
svc = new WorkspaceService(root, 'https://example.invalid/repo.git', KB, new NodeFs());
|
|
51
|
+
svc = new WorkspaceService(root, 'https://example.invalid/repo.git', testKbContext({ kbDirName: KB }), new NodeFs());
|
|
51
52
|
await svc.getWorkspacePath(workspaceId);
|
|
52
53
|
});
|
|
53
54
|
|
|
@@ -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 { NodeFs } from '../../kb-fs/node-fs.js';
|
|
3
4
|
import { execFile } from 'node:child_process';
|
|
4
5
|
import { promisify } from 'node:util';
|
|
@@ -65,7 +66,7 @@ describe('WorkspaceService — branch-keyed identity', () => {
|
|
|
65
66
|
});
|
|
66
67
|
|
|
67
68
|
it('a malformed workspace id (bad percent-escape) rejects as a 400 BranchNameError, not a 500', async () => {
|
|
68
|
-
const svc = new WorkspaceService(root, 'https://github.com/Bevel-Software/knowledge-base.git',
|
|
69
|
+
const svc = new WorkspaceService(root, 'https://github.com/Bevel-Software/knowledge-base.git', testKbContext(), new NodeFs());
|
|
69
70
|
// `%zz` fails decodeURIComponent, falls back to itself, and `%` never
|
|
70
71
|
// passes the branch-name rules — the cold-path bootstrap must surface
|
|
71
72
|
// that as the status-carrying domain error, not a wrapped plain Error.
|
|
@@ -77,7 +78,7 @@ describe('WorkspaceService — branch-keyed identity', () => {
|
|
|
77
78
|
|
|
78
79
|
it('returns workspace info derived from the branch — no .workspace.json on disk', async () => {
|
|
79
80
|
const { workspaceId, workspaceDir } = await seedBranchWorkspace(root, 'target-company-state');
|
|
80
|
-
const svc = new WorkspaceService(root, 'https://github.com/Bevel-Software/knowledge-base.git',
|
|
81
|
+
const svc = new WorkspaceService(root, 'https://github.com/Bevel-Software/knowledge-base.git', testKbContext(), new NodeFs());
|
|
81
82
|
const info = await svc.getOrCreateForBranch('target-company-state');
|
|
82
83
|
|
|
83
84
|
expect(info.id).toBe(workspaceId);
|
|
@@ -90,7 +91,7 @@ describe('WorkspaceService — branch-keyed identity', () => {
|
|
|
90
91
|
it('two branches map to distinct directories', async () => {
|
|
91
92
|
const a = await seedBranchWorkspace(root, 'target-company-state');
|
|
92
93
|
const b = await seedBranchWorkspace(root, 'alice/feature');
|
|
93
|
-
const svc = new WorkspaceService(root, 'https://github.com/Bevel-Software/knowledge-base.git',
|
|
94
|
+
const svc = new WorkspaceService(root, 'https://github.com/Bevel-Software/knowledge-base.git', testKbContext(), new NodeFs());
|
|
94
95
|
|
|
95
96
|
const infoA = await svc.getOrCreateForBranch('target-company-state');
|
|
96
97
|
const infoB = await svc.getOrCreateForBranch('alice/feature');
|
|
@@ -113,7 +114,7 @@ describe('WorkspaceService — branch-keyed identity', () => {
|
|
|
113
114
|
const squatter = path.join(workspaceDir, 'knowledge-base');
|
|
114
115
|
await fs.writeFile(squatter, 'not a clone', 'utf8');
|
|
115
116
|
|
|
116
|
-
const svc = new WorkspaceService(root, 'https://github.com/Bevel-Software/knowledge-base.git',
|
|
117
|
+
const svc = new WorkspaceService(root, 'https://github.com/Bevel-Software/knowledge-base.git', testKbContext(), new NodeFs());
|
|
117
118
|
await expect(svc.getOrCreateForBranch('target-company-state')).rejects.toThrow(
|
|
118
119
|
/"knowledge-base" in this workspace exists but is not a directory/,
|
|
119
120
|
);
|
|
@@ -121,21 +122,21 @@ describe('WorkspaceService — branch-keyed identity', () => {
|
|
|
121
122
|
});
|
|
122
123
|
|
|
123
124
|
it('rejects invalid branch names before touching disk', async () => {
|
|
124
|
-
const svc = new WorkspaceService(root, 'https://github.com/Bevel-Software/knowledge-base.git',
|
|
125
|
+
const svc = new WorkspaceService(root, 'https://github.com/Bevel-Software/knowledge-base.git', testKbContext(), new NodeFs());
|
|
125
126
|
await expect(svc.getOrCreateForBranch('')).rejects.toThrow();
|
|
126
127
|
await expect(svc.getOrCreateForBranch('-bad-leading-dash')).rejects.toThrow();
|
|
127
128
|
});
|
|
128
129
|
|
|
129
130
|
it('getOrCreateForUser falls back to target-company-state when no branch is supplied', async () => {
|
|
130
131
|
await seedBranchWorkspace(root, 'target-company-state');
|
|
131
|
-
const svc = new WorkspaceService(root, 'https://github.com/Bevel-Software/knowledge-base.git',
|
|
132
|
+
const svc = new WorkspaceService(root, 'https://github.com/Bevel-Software/knowledge-base.git', testKbContext(), new NodeFs());
|
|
132
133
|
const info = await svc.getOrCreateForUser({ id: 'u', email: 'a@b.c', name: 'A' });
|
|
133
134
|
expect(info.id).toBe(workspaceIdForBranch('target-company-state'));
|
|
134
135
|
});
|
|
135
136
|
|
|
136
137
|
it('getOrCreateForUser respects an explicit branch override', async () => {
|
|
137
138
|
await seedBranchWorkspace(root, 'alice/feature');
|
|
138
|
-
const svc = new WorkspaceService(root, 'https://github.com/Bevel-Software/knowledge-base.git',
|
|
139
|
+
const svc = new WorkspaceService(root, 'https://github.com/Bevel-Software/knowledge-base.git', testKbContext(), new NodeFs());
|
|
139
140
|
const info = await svc.getOrCreateForUser({ id: 'u', email: 'a@b.c', name: 'A' }, 'alice/feature');
|
|
140
141
|
expect(info.id).toBe(workspaceIdForBranch('alice/feature'));
|
|
141
142
|
});
|
|
@@ -155,7 +156,7 @@ describe('WorkspaceService.createDirectory', () => {
|
|
|
155
156
|
workspaceDir = seeded.workspaceDir;
|
|
156
157
|
repoDir = path.join(workspaceDir, 'knowledge-base');
|
|
157
158
|
workspaceId = seeded.workspaceId;
|
|
158
|
-
svc = new WorkspaceService(root, 'https://github.com/Bevel-Software/knowledge-base.git',
|
|
159
|
+
svc = new WorkspaceService(root, 'https://github.com/Bevel-Software/knowledge-base.git', testKbContext(), new NodeFs());
|
|
159
160
|
// Hydrate the in-memory map so subsequent ops resolve fast.
|
|
160
161
|
await svc.getWorkspacePath(workspaceId);
|
|
161
162
|
});
|
|
@@ -266,7 +267,7 @@ describe('WorkspaceService.writeFile — expectedContent', () => {
|
|
|
266
267
|
const seeded = await seedBranchWorkspace(root, 'target-company-state');
|
|
267
268
|
workspaceDir = seeded.workspaceDir;
|
|
268
269
|
workspaceId = seeded.workspaceId;
|
|
269
|
-
svc = new WorkspaceService(root, 'https://github.com/Bevel-Software/knowledge-base.git',
|
|
270
|
+
svc = new WorkspaceService(root, 'https://github.com/Bevel-Software/knowledge-base.git', testKbContext(), new NodeFs());
|
|
270
271
|
});
|
|
271
272
|
|
|
272
273
|
afterEach(async () => {
|
|
@@ -407,7 +408,7 @@ describe('WorkspaceService.withPathTurn', () => {
|
|
|
407
408
|
const seeded = await seedBranchWorkspace(root, 'target-company-state');
|
|
408
409
|
workspaceDir = seeded.workspaceDir;
|
|
409
410
|
workspaceId = seeded.workspaceId;
|
|
410
|
-
svc = new WorkspaceService(root, 'https://github.com/Bevel-Software/knowledge-base.git',
|
|
411
|
+
svc = new WorkspaceService(root, 'https://github.com/Bevel-Software/knowledge-base.git', testKbContext(), new NodeFs());
|
|
411
412
|
});
|
|
412
413
|
|
|
413
414
|
afterEach(async () => {
|
|
@@ -420,51 +421,68 @@ describe('WorkspaceService.withPathTurn', () => {
|
|
|
420
421
|
await Promise.resolve();
|
|
421
422
|
};
|
|
422
423
|
|
|
423
|
-
|
|
424
|
-
|
|
424
|
+
/**
|
|
425
|
+
* A turn whose body records when it runs — and, for the FIRST one, tells
|
|
426
|
+
* the test when it HOLDS the turn, so the next can be issued behind it.
|
|
427
|
+
*
|
|
428
|
+
* What the queue guarantees is one body at a time per file. It does NOT
|
|
429
|
+
* guarantee that turns issued together chain in the order they were
|
|
430
|
+
* issued: before a turn joins the queue its spelling is resolved and judged
|
|
431
|
+
* against the git folder on disk, and those probes finish in whatever order
|
|
432
|
+
* the disk answers, so a later call can join first. Asserting on names in a
|
|
433
|
+
* fixed order therefore needs the earlier turn to be HELD before the later
|
|
434
|
+
* one is issued; interleaving is then the only thing that could reorder.
|
|
435
|
+
*/
|
|
436
|
+
const recorder = (order: string[]) => {
|
|
437
|
+
let holding: (() => void) | undefined;
|
|
438
|
+
const held = new Promise<void>((resolve) => { holding = resolve; });
|
|
425
439
|
const body = (name: string) => async (): Promise<void> => {
|
|
426
440
|
order.push(`${name}:enter`);
|
|
441
|
+
holding?.();
|
|
427
442
|
await yieldTwice();
|
|
428
443
|
order.push(`${name}:exit`);
|
|
429
444
|
};
|
|
445
|
+
return { body, held };
|
|
446
|
+
};
|
|
447
|
+
|
|
448
|
+
/** Each name's exit follows its own enter at once: no body ran inside another. */
|
|
449
|
+
const expectNoInterleaving = (order: string[], names: string[]): void => {
|
|
450
|
+
for (const name of names) {
|
|
451
|
+
const enter = order.indexOf(`${name}:enter`);
|
|
452
|
+
expect(enter).toBeGreaterThanOrEqual(0);
|
|
453
|
+
expect(order[enter + 1]).toBe(`${name}:exit`);
|
|
454
|
+
}
|
|
455
|
+
};
|
|
430
456
|
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
// names `a` as the one that goes first — fails for a scheduling reason
|
|
435
|
-
// rather than an interleaving one.
|
|
436
|
-
await svc.withPathTurn(workspaceId, 'knowledge-base/mcp-description.md', async () => undefined);
|
|
457
|
+
it('runs one turn at a time, so two bodies never interleave', async () => {
|
|
458
|
+
const order: string[] = [];
|
|
459
|
+
const { body, held } = recorder(order);
|
|
437
460
|
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
]);
|
|
461
|
+
const a = svc.withPathTurn(workspaceId, 'knowledge-base/mcp-description.md', body('a'));
|
|
462
|
+
await held;
|
|
463
|
+
const b = svc.withPathTurn(workspaceId, 'knowledge-base/mcp-description.md', body('b'));
|
|
464
|
+
await Promise.all([a, b]);
|
|
442
465
|
|
|
443
466
|
expect(order).toEqual(['a:enter', 'a:exit', 'b:enter', 'b:exit']);
|
|
444
467
|
});
|
|
445
468
|
|
|
446
469
|
it('treats two spellings of one file as one queue', async () => {
|
|
447
470
|
const order: string[] = [];
|
|
448
|
-
const body
|
|
449
|
-
order.push(`${name}:enter`);
|
|
450
|
-
await yieldTwice();
|
|
451
|
-
order.push(`${name}:exit`);
|
|
452
|
-
};
|
|
453
|
-
|
|
454
|
-
// Warm the workspace lookup first: a turn chains onto the queue only after
|
|
455
|
-
// it, and a COLD lookup resolves its three callers in disk order rather
|
|
456
|
-
// than call order — the queue is one either way, but this asserts FIFO.
|
|
457
|
-
await svc.withPathTurn(workspaceId, 'knowledge-base/mcp-description.md', async () => undefined);
|
|
471
|
+
const { body, held } = recorder(order);
|
|
458
472
|
|
|
473
|
+
const plain = svc.withPathTurn(workspaceId, 'knowledge-base/mcp-description.md', body('plain'));
|
|
474
|
+
await held;
|
|
475
|
+
// Issued together: they may join in either order, but each waits for
|
|
476
|
+
// `plain` and for each other, because all three name one file.
|
|
459
477
|
await Promise.all([
|
|
460
|
-
|
|
478
|
+
plain,
|
|
461
479
|
svc.withPathTurn(workspaceId, './knowledge-base/mcp-description.md', body('dotted')),
|
|
462
480
|
svc.withPathTurn(workspaceId, 'knowledge-base//mcp-description.md', body('doubled')),
|
|
463
481
|
]);
|
|
464
482
|
|
|
465
|
-
expect(order).toEqual([
|
|
466
|
-
|
|
467
|
-
]);
|
|
483
|
+
expect(order.slice(0, 2)).toEqual(['plain:enter', 'plain:exit']);
|
|
484
|
+
expect(order).toHaveLength(6);
|
|
485
|
+
expectNoInterleaving(order, ['plain', 'dotted', 'doubled']);
|
|
468
486
|
});
|
|
469
487
|
|
|
470
488
|
it('lets another file run while one path is held: a turn is per file', async () => {
|
|
@@ -506,10 +524,16 @@ describe('WorkspaceService.withPathTurn', () => {
|
|
|
506
524
|
svc.writeFile(workspaceId, rel, 'From B.', { expectedContent: '' }),
|
|
507
525
|
]),
|
|
508
526
|
);
|
|
527
|
+
const [a] = results;
|
|
509
528
|
expect(results.filter((r) => r.status === 'fulfilled')).toHaveLength(1);
|
|
510
529
|
const refused = results.find((r) => r.status === 'rejected') as PromiseRejectedResult;
|
|
511
530
|
expect(refused.reason).toMatchObject({ status: 409 });
|
|
512
|
-
|
|
531
|
+
// Which of the two goes first is not promised (each resolves its path
|
|
532
|
+
// before it chains onto the held turn's tail); what is, is that the file
|
|
533
|
+
// holds the winner's text whole and the loser was refused.
|
|
534
|
+
expect(await fs.readFile(path.join(workspaceDir, rel), 'utf-8')).toBe(
|
|
535
|
+
a.status === 'fulfilled' ? 'From A.' : 'From B.',
|
|
536
|
+
);
|
|
513
537
|
});
|
|
514
538
|
|
|
515
539
|
it('updates the diff baseline inside the turn, in the order the mutations landed', async () => {
|
|
@@ -612,7 +636,7 @@ describe('WorkspaceService.assertContentMatches', () => {
|
|
|
612
636
|
const seeded = await seedBranchWorkspace(root, 'target-company-state');
|
|
613
637
|
workspaceDir = seeded.workspaceDir;
|
|
614
638
|
workspaceId = seeded.workspaceId;
|
|
615
|
-
svc = new WorkspaceService(root, 'https://github.com/Bevel-Software/knowledge-base.git',
|
|
639
|
+
svc = new WorkspaceService(root, 'https://github.com/Bevel-Software/knowledge-base.git', testKbContext(), new NodeFs());
|
|
616
640
|
});
|
|
617
641
|
|
|
618
642
|
afterEach(async () => {
|
|
@@ -657,7 +681,7 @@ describe('WorkspaceService.createFolderZip', () => {
|
|
|
657
681
|
workspaceDir = seeded.workspaceDir;
|
|
658
682
|
repoDir = path.join(workspaceDir, 'knowledge-base');
|
|
659
683
|
workspaceId = seeded.workspaceId;
|
|
660
|
-
svc = new WorkspaceService(root, 'https://github.com/Bevel-Software/knowledge-base.git',
|
|
684
|
+
svc = new WorkspaceService(root, 'https://github.com/Bevel-Software/knowledge-base.git', testKbContext(), new NodeFs());
|
|
661
685
|
await svc.getWorkspacePath(workspaceId);
|
|
662
686
|
});
|
|
663
687
|
|
|
@@ -813,7 +837,7 @@ describe('WorkspaceService — clone bootstrap & sibling reference', () => {
|
|
|
813
837
|
});
|
|
814
838
|
|
|
815
839
|
it('clones a branch on first bootstrap and checks out the right ref', async () => {
|
|
816
|
-
const svc = new WorkspaceService(workspacesRoot, upstream,
|
|
840
|
+
const svc = new WorkspaceService(workspacesRoot, upstream, testKbContext(), new NodeFs());
|
|
817
841
|
const info = await svc.getOrCreateForBranch('target-company-state');
|
|
818
842
|
|
|
819
843
|
const repo = path.join(info.absolutePath, 'knowledge-base');
|
|
@@ -822,7 +846,7 @@ describe('WorkspaceService — clone bootstrap & sibling reference', () => {
|
|
|
822
846
|
});
|
|
823
847
|
|
|
824
848
|
it('uses an existing sibling clone as a --reference and stays dissociated', async () => {
|
|
825
|
-
const svc = new WorkspaceService(workspacesRoot, upstream,
|
|
849
|
+
const svc = new WorkspaceService(workspacesRoot, upstream, testKbContext(), new NodeFs());
|
|
826
850
|
// First branch: plain clone — becomes the sibling for the next bootstrap.
|
|
827
851
|
await svc.getOrCreateForBranch('target-company-state');
|
|
828
852
|
// Second branch: should borrow the first clone's objects, then dissociate.
|
|
@@ -850,7 +874,7 @@ describe('WorkspaceService — clone bootstrap & sibling reference', () => {
|
|
|
850
874
|
// post-merge pull of a target branch. Every clone this service hands out must
|
|
851
875
|
// therefore track exactly one upstream ref through exactly one refspec.
|
|
852
876
|
it('stamps a single fetch refspec and upstream ref on a fresh clone', async () => {
|
|
853
|
-
const svc = new WorkspaceService(workspacesRoot, upstream,
|
|
877
|
+
const svc = new WorkspaceService(workspacesRoot, upstream, testKbContext(), new NodeFs());
|
|
854
878
|
const info = await svc.getOrCreateForBranch('target-company-state');
|
|
855
879
|
const repo = path.join(info.absolutePath, 'knowledge-base');
|
|
856
880
|
|
|
@@ -874,7 +898,7 @@ describe('WorkspaceService — clone bootstrap & sibling reference', () => {
|
|
|
874
898
|
await runGit(repo, ['config', '--add', 'remote.origin.fetch', '+refs/heads/*:refs/remotes/origin/*']);
|
|
875
899
|
await runGit(repo, ['config', '--add', 'branch.alice/draft.merge', 'refs/heads/target-company-state']);
|
|
876
900
|
|
|
877
|
-
const svc = new WorkspaceService(workspacesRoot, upstream,
|
|
901
|
+
const svc = new WorkspaceService(workspacesRoot, upstream, testKbContext(), new NodeFs());
|
|
878
902
|
await svc.getOrCreateForBranch('alice/draft');
|
|
879
903
|
|
|
880
904
|
expect(await gitOut(repo, ['config', '--get-all', 'remote.origin.fetch']))
|
|
@@ -886,7 +910,7 @@ describe('WorkspaceService — clone bootstrap & sibling reference', () => {
|
|
|
886
910
|
});
|
|
887
911
|
|
|
888
912
|
it('notifies the cloned-workspace listener with the workspace id after a clone', async () => {
|
|
889
|
-
const svc = new WorkspaceService(workspacesRoot, upstream,
|
|
913
|
+
const svc = new WorkspaceService(workspacesRoot, upstream, testKbContext(), new NodeFs());
|
|
890
914
|
const cloned: string[] = [];
|
|
891
915
|
svc.setWorkspaceClonedListener((id) => cloned.push(id));
|
|
892
916
|
|
|
@@ -914,7 +938,7 @@ describe('WorkspaceService — symbolic links', () => {
|
|
|
914
938
|
const seeded = await seedBranchWorkspace(root, 'main');
|
|
915
939
|
workspaceDir = seeded.workspaceDir;
|
|
916
940
|
workspaceId = seeded.workspaceId;
|
|
917
|
-
svc = new WorkspaceService(root, 'https://github.com/Bevel-Software/knowledge-base.git',
|
|
941
|
+
svc = new WorkspaceService(root, 'https://github.com/Bevel-Software/knowledge-base.git', testKbContext(), new NodeFs());
|
|
918
942
|
});
|
|
919
943
|
|
|
920
944
|
afterEach(async () => {
|
|
@@ -999,7 +1023,7 @@ describe('WorkspaceService — symbolic links', () => {
|
|
|
999
1023
|
// A mounted-volume shape: the whole workspaces root reached through a link.
|
|
1000
1024
|
const mount = path.join(root, 'mount');
|
|
1001
1025
|
await fs.symlink(root, mount, linkType);
|
|
1002
|
-
const viaMount = new WorkspaceService(mount, 'https://github.com/Bevel-Software/knowledge-base.git',
|
|
1026
|
+
const viaMount = new WorkspaceService(mount, 'https://github.com/Bevel-Software/knowledge-base.git', testKbContext(), new NodeFs());
|
|
1003
1027
|
expect(await viaMount.readFile(workspaceId, rel)).toBe('Hello.');
|
|
1004
1028
|
await viaMount.writeFile(workspaceId, rel, 'Hello again.');
|
|
1005
1029
|
expect(await fs.readFile(path.join(workspaceDir, rel), 'utf-8')).toBe('Hello again.');
|
|
@@ -1032,7 +1056,7 @@ describe('WorkspaceService.sweepOrphanedWorkspaces', () => {
|
|
|
1032
1056
|
|
|
1033
1057
|
it('removes the clone of a branch that is not in the known set', async () => {
|
|
1034
1058
|
const { workspaceId, workspaceDir } = await seedBranchWorkspace(root, 'target-company-state');
|
|
1035
|
-
const svc = new WorkspaceService(root, 'https://github.com/Bevel-Software/knowledge-base.git',
|
|
1059
|
+
const svc = new WorkspaceService(root, 'https://github.com/Bevel-Software/knowledge-base.git', testKbContext(), new NodeFs());
|
|
1036
1060
|
await svc.getOrCreateForBranch('target-company-state');
|
|
1037
1061
|
|
|
1038
1062
|
// The branch vanishes from the known set; the sweep reclaims its clone.
|
|
@@ -1053,7 +1077,7 @@ describe('WorkspaceService.readAllKbFiles', () => {
|
|
|
1053
1077
|
const seeded = await seedBranchWorkspace(root, 'target-company-state');
|
|
1054
1078
|
repoRoot = path.join(seeded.workspaceDir, 'knowledge-base');
|
|
1055
1079
|
workspaceId = seeded.workspaceId;
|
|
1056
|
-
svc = new WorkspaceService(root, 'https://github.com/Bevel-Software/knowledge-base.git',
|
|
1080
|
+
svc = new WorkspaceService(root, 'https://github.com/Bevel-Software/knowledge-base.git', testKbContext(), new NodeFs());
|
|
1057
1081
|
await svc.getWorkspacePath(workspaceId);
|
|
1058
1082
|
});
|
|
1059
1083
|
|
|
@@ -1112,7 +1136,7 @@ describe('WorkspaceService.unzipFile — ontology-session write guard', () => {
|
|
|
1112
1136
|
workspaceDir = seeded.workspaceDir;
|
|
1113
1137
|
repoDir = path.join(workspaceDir, 'knowledge-base');
|
|
1114
1138
|
workspaceId = seeded.workspaceId;
|
|
1115
|
-
svc = new WorkspaceService(root, 'https://github.com/Bevel-Software/knowledge-base.git',
|
|
1139
|
+
svc = new WorkspaceService(root, 'https://github.com/Bevel-Software/knowledge-base.git', testKbContext(), new NodeFs());
|
|
1116
1140
|
await svc.getWorkspacePath(workspaceId);
|
|
1117
1141
|
});
|
|
1118
1142
|
|
|
@@ -1255,7 +1279,7 @@ describe('WorkspaceService — every operation resolves inside the repository',
|
|
|
1255
1279
|
workspaceDir = seeded.workspaceDir;
|
|
1256
1280
|
repoDir = path.join(workspaceDir, 'knowledge-base');
|
|
1257
1281
|
workspaceId = seeded.workspaceId;
|
|
1258
|
-
svc = new WorkspaceService(root, 'https://example.invalid/kb.git',
|
|
1282
|
+
svc = new WorkspaceService(root, 'https://example.invalid/kb.git', testKbContext(), new NodeFs());
|
|
1259
1283
|
await svc.getWorkspacePath(workspaceId);
|
|
1260
1284
|
});
|
|
1261
1285
|
|
|
@@ -1294,11 +1318,21 @@ describe('WorkspaceService — every operation resolves inside the repository',
|
|
|
1294
1318
|
});
|
|
1295
1319
|
|
|
1296
1320
|
it('takes its path and folder turns on the repository path, so two spellings are one queue', async () => {
|
|
1321
|
+
// The second spelling is issued only once the first HOLDS its turn. What
|
|
1322
|
+
// is asserted is the queue — the second waits for the first to finish —
|
|
1323
|
+
// not the order two calls enter it: before the queue each spelling is
|
|
1324
|
+
// judged against the git folder on disk, and those probes take as long as
|
|
1325
|
+
// the spelling makes them, so two calls issued together can chain in
|
|
1326
|
+
// either order (the FIFO case is pinned above, on warmed equal spellings).
|
|
1297
1327
|
const order: string[] = [];
|
|
1328
|
+
let holding!: () => void;
|
|
1329
|
+
const held = new Promise<void>((r) => { holding = r; });
|
|
1298
1330
|
const slow = svc.withPathTurn(workspaceId, 'contended.md', async () => {
|
|
1331
|
+
holding();
|
|
1299
1332
|
await new Promise((r) => setTimeout(r, 20));
|
|
1300
1333
|
order.push('first');
|
|
1301
1334
|
});
|
|
1335
|
+
await held;
|
|
1302
1336
|
const fast = svc.withPathTurn(workspaceId, 'knowledge-base/contended.md', async () => {
|
|
1303
1337
|
order.push('second');
|
|
1304
1338
|
});
|
|
@@ -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 { execFile } from 'node:child_process';
|
|
3
4
|
import { promisify } from 'node:util';
|
|
4
5
|
import fs from 'node:fs/promises';
|
|
@@ -63,7 +64,7 @@ describe('WorkspaceService — a branch origin does not have', () => {
|
|
|
63
64
|
const deleteOnHost = (branch: string): Promise<void> => runGit(upstream, ['branch', '-D', branch]);
|
|
64
65
|
|
|
65
66
|
const service = (repoUrl = upstream): WorkspaceService =>
|
|
66
|
-
new WorkspaceService(workspacesRoot, repoUrl,
|
|
67
|
+
new WorkspaceService(workspacesRoot, repoUrl, testKbContext(), new NodeFs());
|
|
67
68
|
|
|
68
69
|
it('a name nothing has ever cloned or listed is a 404 that names only the branch', async () => {
|
|
69
70
|
const svc = service();
|
|
@@ -2,7 +2,8 @@ import express from 'express';
|
|
|
2
2
|
import { afterEach, describe, expect, it } from 'vitest';
|
|
3
3
|
import { join } from 'node:path';
|
|
4
4
|
import { tmpdir } from 'node:os';
|
|
5
|
-
import { DEFAULT_KB_LAYOUT
|
|
5
|
+
import { DEFAULT_KB_LAYOUT } from '@bevel-software/platform-shared';
|
|
6
|
+
import { testKbContext } from '../../../__tests__/kb-context.js';
|
|
6
7
|
import { ToolRegistry } from '../../tool-registry/tool-registry.js';
|
|
7
8
|
import { createToolHandlerFactory } from '../../tool-helpers/tool-handler.js';
|
|
8
9
|
import type { ToolAuth } from '../../tool-auth/tool-auth.middleware.js';
|
|
@@ -24,6 +25,8 @@ import { registerWorkspaceTools } from '../workspace.tools.js';
|
|
|
24
25
|
* for it.
|
|
25
26
|
*/
|
|
26
27
|
const KB_DIR = 'knowledge-base';
|
|
28
|
+
/** The context the tools read; a case applies a deployment's own names to it. */
|
|
29
|
+
const kb = testKbContext({ kbDirName: KB_DIR });
|
|
27
30
|
|
|
28
31
|
/** Every workspace tool's description, keyed by name, under the layout in effect. */
|
|
29
32
|
async function descriptions(registry: ToolRegistry = new ToolRegistry()): Promise<Map<string, string>> {
|
|
@@ -37,11 +40,11 @@ async function descriptions(registry: ToolRegistry = new ToolRegistry()): Promis
|
|
|
37
40
|
new SpillStore(join(tmpdir(), 'bevel-test-spills')),
|
|
38
41
|
new DocExtractService(join(tmpdir(), 'bevel-test-doc-extract')),
|
|
39
42
|
{} as unknown as IAccessControl,
|
|
40
|
-
|
|
43
|
+
kb,
|
|
41
44
|
{
|
|
42
45
|
service: {} as never,
|
|
43
46
|
enabled: false,
|
|
44
|
-
|
|
47
|
+
kb,
|
|
45
48
|
recoveryBotEmail: 'recovery-bot@bevel.local',
|
|
46
49
|
hooks: new WorkflowHooks(),
|
|
47
50
|
},
|
|
@@ -57,7 +60,7 @@ async function listed(registry: ToolRegistry): Promise<Map<string, string>> {
|
|
|
57
60
|
return new Map(tools.map((t) => [t.name, t.description ?? '']));
|
|
58
61
|
}
|
|
59
62
|
|
|
60
|
-
afterEach(() =>
|
|
63
|
+
afterEach(() => kb.applyLayout({ ...DEFAULT_KB_LAYOUT }));
|
|
61
64
|
|
|
62
65
|
describe('the conventions note every workspace tool carries', () => {
|
|
63
66
|
it('names AGENTS.md, and CLAUDE.md beside it, under the default name', async () => {
|
|
@@ -71,7 +74,7 @@ describe('the conventions note every workspace tool carries', () => {
|
|
|
71
74
|
});
|
|
72
75
|
|
|
73
76
|
it('names the configured file first and the organisation\'s own AGENTS.md second', async () => {
|
|
74
|
-
|
|
77
|
+
kb.applyLayout({ ...DEFAULT_KB_LAYOUT, agentsFile: 'HEXIS.md' });
|
|
75
78
|
const byName = await descriptions();
|
|
76
79
|
const note = byName.get('grep') ?? '';
|
|
77
80
|
expect(note).toContain('read `HEXIS.md` at the KB root, then `AGENTS.md` if it also exists');
|
|
@@ -83,7 +86,7 @@ describe('the conventions note every workspace tool carries', () => {
|
|
|
83
86
|
});
|
|
84
87
|
|
|
85
88
|
it('describes the platform files under the configured name, and no longer under AGENTS.md', async () => {
|
|
86
|
-
|
|
89
|
+
kb.applyLayout({ ...DEFAULT_KB_LAYOUT, agentsFile: 'HEXIS.md' });
|
|
87
90
|
const byName = await descriptions();
|
|
88
91
|
const stat = byName.get('file_stat') ?? '';
|
|
89
92
|
expect(stat).toContain('`access.md`, `roles.yaml`, `.bevelignore`, `HEXIS.md`');
|
|
@@ -117,7 +120,7 @@ describe('the conventions note every workspace tool carries', () => {
|
|
|
117
120
|
const atMount = await descriptions(registry);
|
|
118
121
|
expect(atMount.get('grep')).toContain('read `AGENTS.md` at the KB root');
|
|
119
122
|
|
|
120
|
-
|
|
123
|
+
kb.applyLayout({ ...DEFAULT_KB_LAYOUT, agentsFile: 'HEXIS.md' });
|
|
121
124
|
|
|
122
125
|
const now = await listed(registry);
|
|
123
126
|
expect(now.get('grep')).toContain('read `HEXIS.md` at the KB root, then `AGENTS.md` if it also exists');
|
|
@@ -6,6 +6,7 @@ import { join } from 'node:path';
|
|
|
6
6
|
import { promisify } from 'node:util';
|
|
7
7
|
import express from 'express';
|
|
8
8
|
import { afterEach, describe, expect, it } from 'vitest';
|
|
9
|
+
import { testKbContext } from '../../../__tests__/kb-context.js';
|
|
9
10
|
import { NodeFs } from '../../kb-fs/node-fs.js';
|
|
10
11
|
import { ToolRegistry } from '../../tool-registry/tool-registry.js';
|
|
11
12
|
import { createToolHandlerFactory } from '../../tool-helpers/tool-handler.js';
|
|
@@ -109,7 +110,7 @@ describe('workspace tools — a branch that cannot be opened', () => {
|
|
|
109
110
|
workspaces = new WorkspaceService(
|
|
110
111
|
workspacesRoot,
|
|
111
112
|
opts.repoUrl === 'unreachable' ? join(root, 'no-such-repo.git') : upstream,
|
|
112
|
-
KB_DIR,
|
|
113
|
+
testKbContext({ kbDirName: KB_DIR }),
|
|
113
114
|
new NodeFs(),
|
|
114
115
|
);
|
|
115
116
|
|
|
@@ -138,11 +139,11 @@ describe('workspace tools — a branch that cannot be opened', () => {
|
|
|
138
139
|
new SpillStore(spillRoot),
|
|
139
140
|
new DocExtractService(docCacheDir),
|
|
140
141
|
allowAll,
|
|
141
|
-
KB_DIR,
|
|
142
|
+
testKbContext({ kbDirName: KB_DIR }),
|
|
142
143
|
{
|
|
143
144
|
service: {} as never,
|
|
144
145
|
enabled: false,
|
|
145
|
-
kbDirName: KB_DIR,
|
|
146
|
+
kb: testKbContext({ kbDirName: KB_DIR }),
|
|
146
147
|
recoveryBotEmail: 'recovery-bot@bevel.local',
|
|
147
148
|
hooks: new WorkflowHooks(),
|
|
148
149
|
},
|
|
@@ -7,6 +7,7 @@ import { promisify } from 'node:util';
|
|
|
7
7
|
import AdmZip from 'adm-zip';
|
|
8
8
|
import express from 'express';
|
|
9
9
|
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
|
10
|
+
import { testKbContext } from '../../../__tests__/kb-context.js';
|
|
10
11
|
import { LocalFilesystem } from '@mastra/core/workspace';
|
|
11
12
|
import { ToolRegistry } from '../../tool-registry/tool-registry.js';
|
|
12
13
|
import { createToolHandlerFactory } from '../../tool-helpers/tool-handler.js';
|
|
@@ -218,10 +219,10 @@ async function start(
|
|
|
218
219
|
const app = express();
|
|
219
220
|
app.use(express.json());
|
|
220
221
|
const router = express.Router();
|
|
221
|
-
registerWorkspaceTools(registry, router, fakeAuth, toolHandler, new SpillStore(join(tmpdir(), 'bevel-test-spills')), new DocExtractService(docCacheDir), access, KB_DIR, {
|
|
222
|
+
registerWorkspaceTools(registry, router, fakeAuth, toolHandler, new SpillStore(join(tmpdir(), 'bevel-test-spills')), new DocExtractService(docCacheDir), access, testKbContext({ kbDirName: KB_DIR }), {
|
|
222
223
|
service: {} as never,
|
|
223
224
|
enabled: false, // these tests predate and don't exercise the ontology boundary
|
|
224
|
-
kbDirName: KB_DIR,
|
|
225
|
+
kb: testKbContext({ kbDirName: KB_DIR }),
|
|
225
226
|
recoveryBotEmail: 'recovery-bot@bevel.local',
|
|
226
227
|
hooks: new WorkflowHooks(),
|
|
227
228
|
}, writePolicy, {} as never /* sessionSink — start_session not exercised here */);
|
|
@@ -1831,8 +1832,8 @@ describe('start_session', () => {
|
|
|
1831
1832
|
const router = express.Router();
|
|
1832
1833
|
registerWorkspaceTools(
|
|
1833
1834
|
registry, router, auth, toolHandler,
|
|
1834
|
-
new SpillStore(join(tmpdir(), 'bevel-test-spills')), new DocExtractService(join(tmpdir(), 'bevel-test-doc-extract')), allowAll, KB_DIR,
|
|
1835
|
-
{ service: {} as never, enabled: false, kbDirName: KB_DIR, recoveryBotEmail: 'recovery-bot@bevel.local', hooks: new WorkflowHooks() },
|
|
1835
|
+
new SpillStore(join(tmpdir(), 'bevel-test-spills')), new DocExtractService(join(tmpdir(), 'bevel-test-doc-extract')), allowAll, testKbContext({ kbDirName: KB_DIR }),
|
|
1836
|
+
{ service: {} as never, enabled: false, kb: testKbContext({ kbDirName: KB_DIR }), recoveryBotEmail: 'recovery-bot@bevel.local', hooks: new WorkflowHooks() },
|
|
1836
1837
|
new RoutineWritePolicyService(),
|
|
1837
1838
|
sink ?? fakeSessionSink,
|
|
1838
1839
|
);
|
|
@@ -1956,8 +1957,8 @@ describe('start_session', () => {
|
|
|
1956
1957
|
const noopAuth: express.RequestHandler = (_req, _res, next) => next();
|
|
1957
1958
|
registerWorkspaceTools(
|
|
1958
1959
|
registry, router, noopAuth, (() => () => {}) as never,
|
|
1959
|
-
new SpillStore(join(tmpdir(), 'bevel-test-spills')), new DocExtractService(join(tmpdir(), 'bevel-test-doc-extract')), allowAll, KB_DIR,
|
|
1960
|
-
{ service: {} as never, enabled: false, kbDirName: KB_DIR, recoveryBotEmail: 'recovery-bot@bevel.local', hooks: new WorkflowHooks() },
|
|
1960
|
+
new SpillStore(join(tmpdir(), 'bevel-test-spills')), new DocExtractService(join(tmpdir(), 'bevel-test-doc-extract')), allowAll, testKbContext({ kbDirName: KB_DIR }),
|
|
1961
|
+
{ service: {} as never, enabled: false, kb: testKbContext({ kbDirName: KB_DIR }), recoveryBotEmail: 'recovery-bot@bevel.local', hooks: new WorkflowHooks() },
|
|
1961
1962
|
new RoutineWritePolicyService(),
|
|
1962
1963
|
{} as never,
|
|
1963
1964
|
);
|
|
@@ -1998,8 +1999,8 @@ describe('branch is a required parameter in the tool contract', () => {
|
|
|
1998
1999
|
new SpillStore(join(tmpdir(), 'bevel-test-spills')),
|
|
1999
2000
|
new DocExtractService(join(tmpdir(), 'bevel-test-doc-extract')),
|
|
2000
2001
|
allowAll,
|
|
2001
|
-
KB_DIR,
|
|
2002
|
-
{ service: {} as never, enabled: false, kbDirName: KB_DIR, recoveryBotEmail: 'recovery-bot@bevel.local', hooks: new WorkflowHooks() },
|
|
2002
|
+
testKbContext({ kbDirName: KB_DIR }),
|
|
2003
|
+
{ service: {} as never, enabled: false, kb: testKbContext({ kbDirName: KB_DIR }), recoveryBotEmail: 'recovery-bot@bevel.local', hooks: new WorkflowHooks() },
|
|
2003
2004
|
new RoutineWritePolicyService(),
|
|
2004
2005
|
{} as never,
|
|
2005
2006
|
);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { describe, it, expect, vi } from 'vitest';
|
|
2
|
+
import { testKbContext } from '../../../__tests__/kb-context.js';
|
|
2
3
|
import { writeDenial } from '../write-denial.js';
|
|
3
4
|
import { AccessDeniedError } from '../../access-model/access-errors.js';
|
|
4
5
|
import type { ChangeReadVerdict, IChangeReadGate } from '../../access-model/change-gate.js';
|
|
@@ -34,7 +35,7 @@ describe('writeDenial asks the read gate about the refused path as the refuser s
|
|
|
34
35
|
eligibleUsers: [],
|
|
35
36
|
targetKind: 'dir',
|
|
36
37
|
});
|
|
37
|
-
const out = await writeDenial(err, INPUT, noAccess, KB, gate);
|
|
38
|
+
const out = await writeDenial(err, INPUT, noAccess, testKbContext({ kbDirName: KB }), gate);
|
|
38
39
|
expect(judge).toHaveBeenCalledWith(
|
|
39
40
|
'target-company-state',
|
|
40
41
|
'alice@example.com',
|
|
@@ -48,7 +49,7 @@ describe('writeDenial asks the read gate about the refused path as the refuser s
|
|
|
48
49
|
it('a refusal that says nothing about its kind is judged as a file', async () => {
|
|
49
50
|
const { gate, judge } = gateThat({ allowed: false, unreadable: 'KnowledgeBase' });
|
|
50
51
|
const err = new AccessDeniedError({ path: `${KB}/KnowledgeBase/loose.md`, eligibleRoles: [], eligibleUsers: [] });
|
|
51
|
-
const out = await writeDenial(err, INPUT, noAccess, KB, gate);
|
|
52
|
+
const out = await writeDenial(err, INPUT, noAccess, testKbContext({ kbDirName: KB }), gate);
|
|
52
53
|
expect(judge).toHaveBeenCalledWith(expect.any(String), 'alice@example.com', `${KB}/KnowledgeBase/loose.md`, 'file');
|
|
53
54
|
expect(out.details).toMatchObject({
|
|
54
55
|
kind: 'write-denied',
|
|
@@ -60,7 +61,7 @@ describe('writeDenial asks the read gate about the refused path as the refuser s
|
|
|
60
61
|
it('without a gate the read verdict alone decides, as before', async () => {
|
|
61
62
|
const accessControl = { canRead: vi.fn(async () => true) } as unknown as IAccessControl;
|
|
62
63
|
const err = new AccessDeniedError({ path: `${KB}/KnowledgeBase/Sales/deal.md`, eligibleRoles: [], eligibleUsers: [] });
|
|
63
|
-
const out = await writeDenial(err, INPUT, accessControl, KB);
|
|
64
|
+
const out = await writeDenial(err, INPUT, accessControl, testKbContext({ kbDirName: KB }));
|
|
64
65
|
expect(accessControl.canRead).toHaveBeenCalledWith('target-company-state', 'alice@example.com', 'KnowledgeBase/Sales/deal.md');
|
|
65
66
|
expect(out.details).toMatchObject({ kind: 'write-denied', canPropose: true });
|
|
66
67
|
});
|
|
@@ -68,7 +69,7 @@ describe('writeDenial asks the read gate about the refused path as the refuser s
|
|
|
68
69
|
it('a gate that cannot answer refuses to offer the route', async () => {
|
|
69
70
|
const gate: IChangeReadGate = { judge: vi.fn(async () => { throw new Error('git down'); }), assertMayChange: vi.fn() };
|
|
70
71
|
const err = new AccessDeniedError({ path: `${KB}/KnowledgeBase/Sales/deal.md`, eligibleRoles: [], eligibleUsers: [] });
|
|
71
|
-
const out = await writeDenial(err, INPUT, noAccess, KB, gate);
|
|
72
|
+
const out = await writeDenial(err, INPUT, noAccess, testKbContext({ kbDirName: KB }), gate);
|
|
72
73
|
expect(out.details).toMatchObject({ canPropose: false });
|
|
73
74
|
expect(out.details?.cannotProposeReason).toContain('could not be determined');
|
|
74
75
|
});
|