@bevel-software/platform-core-backend 0.20.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 +23 -105
- package/dist/core/create-core-server.js.map +1 -1
- package/dist/core/create-core-services.d.ts +30 -5
- package/dist/core/create-core-services.d.ts.map +1 -1
- package/dist/core/create-core-services.js +136 -81
- 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/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/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/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/mcp/mcp.service.d.ts +7 -0
- package/dist/modules/mcp/mcp.service.d.ts.map +1 -1
- package/dist/modules/mcp/mcp.service.js +4 -4
- package/dist/modules/mcp/mcp.service.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 +12 -8
- package/dist/modules/settings/deployment-settings.service.d.ts.map +1 -1
- package/dist/modules/settings/deployment-settings.service.js +20 -22
- 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-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 +18 -12
- package/dist/modules/workspace/workspace.service.d.ts.map +1 -1
- package/dist/modules/workspace/workspace.service.js +32 -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 +20 -18
- 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.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 +6 -6
- package/package.json +3 -3
- 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 +27 -106
- package/src/core/create-core-services.ts +180 -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/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/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/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/marketplace/__tests__/marketplace-repo.head.test.ts +2 -1
- package/src/modules/mcp/mcp.service.ts +11 -4
- 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 +24 -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 +21 -20
- 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-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 +10 -9
- 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 +30 -27
- package/src/modules/workspace/workspace.tools.ts +21 -20
- package/src/modules/workspace/write-denial.ts +7 -5
- package/src/shared/__tests__/kb-layout.plugin.test.ts +19 -16
- 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
|
@@ -11,6 +11,7 @@ import { setLogger } from '../../../shared/logging.js';
|
|
|
11
11
|
import type { ILogger } from '../../../shared/logger.contract.js';
|
|
12
12
|
import type { WorkspaceService } from '../../workspace/workspace.service.js';
|
|
13
13
|
import type { IAccessControl } from '../../access/access-control.interface.js';
|
|
14
|
+
import { testKbContext } from '../../../__tests__/kb-context.js';
|
|
14
15
|
|
|
15
16
|
/**
|
|
16
17
|
* ONE BAD `.tool` COSTS ONE TOOL.
|
|
@@ -92,7 +93,14 @@ describe('a malformed `.tool` is isolated, named, and forgotten the moment it is
|
|
|
92
93
|
} as unknown as IAccessControl;
|
|
93
94
|
|
|
94
95
|
const svc = (access: IAccessControl = allowAll) =>
|
|
95
|
-
new ToolManualService(
|
|
96
|
+
new ToolManualService(
|
|
97
|
+
workspaceService,
|
|
98
|
+
access,
|
|
99
|
+
testKbContext({ kbDirName: KB_DIR }),
|
|
100
|
+
disk,
|
|
101
|
+
new KbPluginSource(disk, testKbContext({ kbDirName: KB_DIR })),
|
|
102
|
+
() => clock,
|
|
103
|
+
);
|
|
96
104
|
|
|
97
105
|
/**
|
|
98
106
|
* The refused half of the catalog. There is no way to ask for it alone: both
|
|
@@ -512,9 +520,9 @@ describe('a malformed `.tool` is isolated, named, and forgotten the moment it is
|
|
|
512
520
|
const service = new ToolManualService(
|
|
513
521
|
workspaceService,
|
|
514
522
|
countingAccess,
|
|
515
|
-
KB_DIR,
|
|
523
|
+
testKbContext({ kbDirName: KB_DIR }),
|
|
516
524
|
countingDisk,
|
|
517
|
-
new KbPluginSource(countingDisk),
|
|
525
|
+
new KbPluginSource(countingDisk, testKbContext({ kbDirName: KB_DIR })),
|
|
518
526
|
() => clock,
|
|
519
527
|
);
|
|
520
528
|
|
|
@@ -546,9 +554,9 @@ describe('a malformed `.tool` is isolated, named, and forgotten the moment it is
|
|
|
546
554
|
const service = new ToolManualService(
|
|
547
555
|
workspaceService,
|
|
548
556
|
allowAll,
|
|
549
|
-
KB_DIR,
|
|
557
|
+
testKbContext({ kbDirName: KB_DIR }),
|
|
550
558
|
countingDisk,
|
|
551
|
-
new KbPluginSource(countingDisk),
|
|
559
|
+
new KbPluginSource(countingDisk, testKbContext({ kbDirName: KB_DIR })),
|
|
552
560
|
() => clock,
|
|
553
561
|
);
|
|
554
562
|
|
|
@@ -12,6 +12,7 @@ import { ToolManualService, type McpAuthDiscoveryPort } from '../tool-manuals.se
|
|
|
12
12
|
import { workspaceIdForBranch } from '../../../shared/workspace-id.js';
|
|
13
13
|
import type { WorkspaceService } from '../../workspace/workspace.service.js';
|
|
14
14
|
import type { IAccessControl } from '../../access/access-control.interface.js';
|
|
15
|
+
import { testKbContext } from '../../../__tests__/kb-context.js';
|
|
15
16
|
|
|
16
17
|
const KB_DIR = 'knowledge-base';
|
|
17
18
|
const wsId = workspaceIdForBranch(DEFAULT_BRANCH);
|
|
@@ -62,7 +63,7 @@ describe('ToolManualService — MCP OAuth auto-discovery decoration', () => {
|
|
|
62
63
|
});
|
|
63
64
|
|
|
64
65
|
function svcWith(discovery: McpAuthDiscoveryPort) {
|
|
65
|
-
const svc = new ToolManualService(workspaceService, allowAll, KB_DIR, disk, new KbPluginSource(disk));
|
|
66
|
+
const svc = new ToolManualService(workspaceService, allowAll, testKbContext({ kbDirName: KB_DIR }), disk, new KbPluginSource(disk, testKbContext({ kbDirName: KB_DIR })));
|
|
66
67
|
svc.setMcpAuthDiscovery(discovery);
|
|
67
68
|
return svc;
|
|
68
69
|
}
|
|
@@ -20,6 +20,7 @@ import { createToolAuthMiddleware } from '../../tool-auth/tool-auth.middleware.j
|
|
|
20
20
|
import { createToolContextResolver } from '../../tool-helpers/tool-context.js';
|
|
21
21
|
import { createToolHandlerFactory } from '../../tool-helpers/tool-handler.js';
|
|
22
22
|
import { registerToolManualsTools } from '../tool-manuals.tools.js';
|
|
23
|
+
import { testKbContext } from '../../../__tests__/kb-context.js';
|
|
23
24
|
|
|
24
25
|
/**
|
|
25
26
|
* A server restart must not cost a tool or a sign-in. Everything a registered
|
|
@@ -188,7 +189,13 @@ describe('external tools and their sign-ins across a restart', () => {
|
|
|
188
189
|
),
|
|
189
190
|
} as unknown as WorkspaceService;
|
|
190
191
|
const vault = vaultOver(rows);
|
|
191
|
-
const catalog = new ToolManualService(
|
|
192
|
+
const catalog = new ToolManualService(
|
|
193
|
+
workspaceService,
|
|
194
|
+
allowAll,
|
|
195
|
+
testKbContext({ kbDirName: KB_DIR }),
|
|
196
|
+
disk,
|
|
197
|
+
new KbPluginSource(disk, testKbContext({ kbDirName: KB_DIR })),
|
|
198
|
+
);
|
|
192
199
|
catalog.setMcpAuthDiscovery(new McpOAuthDiscoveryService({ secretsVault: vault, redirectUri: REDIRECT_URI, fetchFn }));
|
|
193
200
|
|
|
194
201
|
const internalToken = new InternalTokenService({ secret: 'test-secret' });
|
|
@@ -212,6 +219,7 @@ describe('external tools and their sign-ins across a restart', () => {
|
|
|
212
219
|
registerToolManualsTools(new ToolRegistry(), router, createToolAuthMiddleware(apiKeys, internalToken), toolHandler, catalog, {
|
|
213
220
|
accessControl: allowAll,
|
|
214
221
|
variableStatus: vault,
|
|
222
|
+
kb: testKbContext({ kbDirName: KB_DIR }),
|
|
215
223
|
});
|
|
216
224
|
app.use('/api', router);
|
|
217
225
|
const server = await new Promise<HttpServer>((r) => {
|
|
@@ -12,6 +12,7 @@ import { ToolManualService } from '../tool-manuals.service.js';
|
|
|
12
12
|
import { workspaceIdForBranch } from '../../../shared/workspace-id.js';
|
|
13
13
|
import type { WorkspaceService } from '../../workspace/workspace.service.js';
|
|
14
14
|
import type { IAccessControl } from '../../access/access-control.interface.js';
|
|
15
|
+
import { testKbContext } from '../../../__tests__/kb-context.js';
|
|
15
16
|
|
|
16
17
|
const KB_DIR = 'knowledge-base';
|
|
17
18
|
const wsId = workspaceIdForBranch(DEFAULT_BRANCH);
|
|
@@ -69,7 +70,7 @@ describe('ToolManualService', () => {
|
|
|
69
70
|
new Map(paths.map((p) => [p, !p.includes('weather')])),
|
|
70
71
|
} as unknown as IAccessControl;
|
|
71
72
|
|
|
72
|
-
const svc = (access: IAccessControl = allowAll) => new ToolManualService(workspaceService, access, KB_DIR, disk, new KbPluginSource(disk));
|
|
73
|
+
const svc = (access: IAccessControl = allowAll) => new ToolManualService(workspaceService, access, testKbContext({ kbDirName: KB_DIR }), disk, new KbPluginSource(disk, testKbContext({ kbDirName: KB_DIR })));
|
|
73
74
|
|
|
74
75
|
beforeEach(async () => {
|
|
75
76
|
root = await mkdtemp(join(tmpdir(), 'tools-'));
|
|
@@ -760,7 +761,7 @@ describe('ToolManualService.listDeclaredOnlyOnBranch', () => {
|
|
|
760
761
|
await rm(root, { recursive: true, force: true });
|
|
761
762
|
});
|
|
762
763
|
|
|
763
|
-
const svc = () => new ToolManualService(workspaceService, readGate, KB_DIR, disk, new KbPluginSource(disk));
|
|
764
|
+
const svc = () => new ToolManualService(workspaceService, readGate, testKbContext({ kbDirName: KB_DIR }), disk, new KbPluginSource(disk, testKbContext({ kbDirName: KB_DIR })));
|
|
764
765
|
|
|
765
766
|
test('names only the readable declarations the default branch does not serve', async () => {
|
|
766
767
|
expect(await svc().listDeclaredOnlyOnBranch('user@example.com', DRAFT)).toEqual([
|
|
@@ -8,6 +8,7 @@ import { createToolContextResolver } from '../../tool-helpers/tool-context.js';
|
|
|
8
8
|
import { createToolHandlerFactory } from '../../tool-helpers/tool-handler.js';
|
|
9
9
|
import { registerToolManualsTools } from '../tool-manuals.tools.js';
|
|
10
10
|
import type { IToolManualService } from '../tool-manuals.contract.js';
|
|
11
|
+
import { testKbContext } from '../../../__tests__/kb-context.js';
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* `list_tool_setup` MUST respect the same access controls as every other tool
|
|
@@ -114,6 +115,7 @@ async function start(): Promise<string> {
|
|
|
114
115
|
registerToolManualsTools(registry, router, toolAuth, toolHandler, toolManualService, {
|
|
115
116
|
accessControl,
|
|
116
117
|
variableStatus: { statusFor },
|
|
118
|
+
kb: testKbContext(),
|
|
117
119
|
});
|
|
118
120
|
app.use('/api', router);
|
|
119
121
|
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
HEXIS_EXTENSION_NS,
|
|
3
3
|
PLUGIN_MCP_FILE,
|
|
4
4
|
PLUGIN_MANIFEST_FILE,
|
|
5
|
-
|
|
5
|
+
type KbLayout,
|
|
6
6
|
} from '@bevel-software/platform-shared';
|
|
7
7
|
import type { ToolManualDescriptor, ToolVariable } from './tool-manuals.contract.js';
|
|
8
8
|
import { logger } from '../../shared/logging.js';
|
|
@@ -317,12 +317,14 @@ export function descriptorsFromMcpJson(
|
|
|
317
317
|
pluginFolder: string,
|
|
318
318
|
mcpJsonText: string,
|
|
319
319
|
pluginJsonText: string | null,
|
|
320
|
+
layout: KbLayout,
|
|
320
321
|
): ToolManualDescriptor[] {
|
|
322
|
+
const { pluginsDir } = layout;
|
|
321
323
|
let mcp: unknown;
|
|
322
324
|
try {
|
|
323
325
|
mcp = JSON.parse(mcpJsonText);
|
|
324
326
|
} catch {
|
|
325
|
-
log.warn(`${
|
|
327
|
+
log.warn(`${pluginsDir}/${pluginFolder}/${PLUGIN_MCP_FILE} is not valid JSON — skipped.`);
|
|
326
328
|
return [];
|
|
327
329
|
}
|
|
328
330
|
if (!isRecord(mcp) || !isRecord(mcp.mcpServers)) return [];
|
|
@@ -336,13 +338,13 @@ export function descriptorsFromMcpJson(
|
|
|
336
338
|
// servers themselves — they are still listed, as the spec's own
|
|
337
339
|
// "invalid components are skipped, valid ones load" posture suggests.
|
|
338
340
|
log.warn(
|
|
339
|
-
`${
|
|
341
|
+
`${pluginsDir}/${pluginFolder}/${PLUGIN_MANIFEST_FILE} is not valid JSON — ` +
|
|
340
342
|
'its mcp-server auth/variable declarations are ignored.',
|
|
341
343
|
);
|
|
342
344
|
}
|
|
343
345
|
}
|
|
344
346
|
const extensions = extensionServers(manifest);
|
|
345
|
-
const mcpJsonPath = `${
|
|
347
|
+
const mcpJsonPath = `${pluginsDir}/${pluginFolder}/${PLUGIN_MCP_FILE}`;
|
|
346
348
|
|
|
347
349
|
const out: ToolManualDescriptor[] = [];
|
|
348
350
|
for (const [name, rawEntry] of Object.entries(mcp.mcpServers)) {
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import fs from 'node:fs/promises';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import {
|
|
4
|
-
DEFAULT_BRANCH,
|
|
5
4
|
HEXIS_EXTENSION_NS,
|
|
6
|
-
PLUGINS_DIR,
|
|
7
5
|
PLUGIN_MANIFEST_FILE,
|
|
8
6
|
PLUGIN_MCP_FILE,
|
|
9
7
|
type AuthUser,
|
|
10
8
|
} from '@bevel-software/platform-shared';
|
|
11
9
|
import type { WorkspaceService } from '../workspace/workspace.service.js';
|
|
12
|
-
import {
|
|
10
|
+
import type { KbContext } from '../../shared/kb-context.js';
|
|
13
11
|
import { validatedVariables } from './mcp-json-discovery.js';
|
|
14
12
|
import { assertSafeFetchUrl } from '../../shared/ssrf.js';
|
|
15
13
|
import { containsVariableReference, findReservedVariableRef } from '../../shared/variable-refs.js';
|
|
@@ -127,10 +125,14 @@ export class McpServerEditService {
|
|
|
127
125
|
private readonly commits: CommitDriver,
|
|
128
126
|
private readonly accessControl: IAccessControl,
|
|
129
127
|
private readonly toolManuals: IToolManualService,
|
|
130
|
-
private readonly
|
|
128
|
+
private readonly kb: KbContext,
|
|
131
129
|
private readonly disk: IFsProbe,
|
|
132
130
|
) {}
|
|
133
131
|
|
|
132
|
+
private get kbDirName(): string {
|
|
133
|
+
return this.kb.kbDirName;
|
|
134
|
+
}
|
|
135
|
+
|
|
134
136
|
/**
|
|
135
137
|
* The merged view of one server, or null when unknown — including when
|
|
136
138
|
* `mcp.json` is absent, is not a JSON object, or has no object entry for it
|
|
@@ -385,9 +387,9 @@ export class McpServerEditService {
|
|
|
385
387
|
// One folder-scoped commit, ungated beyond the caller's own write access —
|
|
386
388
|
// both files or neither. The catalog cache is stale the moment it lands.
|
|
387
389
|
await this.commits.runPendingCommit(
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
`${this.kbDirName}/${
|
|
390
|
+
this.kb.defaultWorkspaceId(),
|
|
391
|
+
this.kb.defaultBranch,
|
|
392
|
+
`${this.kbDirName}/${this.kb.layout.pluginsDir}/${folder}`,
|
|
391
393
|
user,
|
|
392
394
|
);
|
|
393
395
|
this.toolManuals.invalidate();
|
|
@@ -408,7 +410,7 @@ export class McpServerEditService {
|
|
|
408
410
|
return {
|
|
409
411
|
folder,
|
|
410
412
|
name: found.name,
|
|
411
|
-
wsId:
|
|
413
|
+
wsId: this.kb.defaultWorkspaceId(),
|
|
412
414
|
mcpJsonPath: found.path,
|
|
413
415
|
};
|
|
414
416
|
}
|
|
@@ -419,10 +421,10 @@ export class McpServerEditService {
|
|
|
419
421
|
mcpAbs: string;
|
|
420
422
|
manifestAbs: string;
|
|
421
423
|
}> {
|
|
422
|
-
const wsId =
|
|
423
|
-
await this.workspaceService.getOrCreateForBranch(
|
|
424
|
+
const wsId = this.kb.defaultWorkspaceId();
|
|
425
|
+
await this.workspaceService.getOrCreateForBranch(this.kb.defaultBranch);
|
|
424
426
|
const wsDir = await this.workspaceService.getWorkspacePath(wsId);
|
|
425
|
-
const pluginDir = path.join(wsDir, this.kbDirName,
|
|
427
|
+
const pluginDir = path.join(wsDir, this.kbDirName, this.kb.layout.pluginsDir, folder);
|
|
426
428
|
const mcpAbs = path.join(pluginDir, PLUGIN_MCP_FILE);
|
|
427
429
|
const manifestAbs = path.join(pluginDir, PLUGIN_MANIFEST_FILE);
|
|
428
430
|
return {
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
|
-
PLUGINS_DIR,
|
|
3
2
|
PLUGIN_MANIFEST_FILE,
|
|
4
3
|
PLUGIN_MCP_FILE,
|
|
5
|
-
DEFAULT_BRANCH,
|
|
6
4
|
pluginOfPath,
|
|
7
5
|
type ChangeRequest,
|
|
8
6
|
type IWorkflowService,
|
|
7
|
+
type KbLayout,
|
|
9
8
|
} from '@bevel-software/platform-shared';
|
|
10
9
|
import { type WorkspaceService } from '../workspace/workspace.service.js';
|
|
11
|
-
import {
|
|
10
|
+
import type { KbContext } from '../../shared/kb-context.js';
|
|
12
11
|
import type { IAccessControl } from '../access/access-control.interface.js';
|
|
13
12
|
import { readAt, visibleProposedFiles } from '../../shared/pending-proposals.js';
|
|
14
13
|
import { utcpNamespacePrefix } from '../../shared/utcp-namespace.js';
|
|
@@ -56,6 +55,7 @@ export class PendingToolsService implements IPendingToolService {
|
|
|
56
55
|
private readonly accessControl: IAccessControl,
|
|
57
56
|
private readonly toolManuals: Pick<IToolManualService, 'listAllSummaries'>,
|
|
58
57
|
private readonly workflow: IWorkflowService,
|
|
58
|
+
private readonly kb: KbContext,
|
|
59
59
|
) {}
|
|
60
60
|
|
|
61
61
|
async listPendingTools(userEmail: string): Promise<PendingTool[]> {
|
|
@@ -72,19 +72,21 @@ export class PendingToolsService implements IPendingToolService {
|
|
|
72
72
|
return [];
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
+
const layout = this.kb.layout;
|
|
75
76
|
const proposed = await visibleProposedFiles(
|
|
76
77
|
{
|
|
77
78
|
workspaceService: this.workspaceService,
|
|
78
79
|
accessControl: this.accessControl,
|
|
79
80
|
workflow: this.workflow,
|
|
81
|
+
kb: this.kb,
|
|
80
82
|
},
|
|
81
83
|
userEmail,
|
|
82
|
-
isToolDeclaration,
|
|
84
|
+
(p) => isToolDeclaration(p, layout),
|
|
83
85
|
);
|
|
84
86
|
|
|
85
87
|
const out: PendingTool[] = [];
|
|
86
88
|
for (const { cr, path, content, isAuthor } of proposed) {
|
|
87
|
-
for (const descriptor of await this.declarationsIn(cr, path, content)) {
|
|
89
|
+
for (const descriptor of await this.declarationsIn(cr, path, content, layout)) {
|
|
88
90
|
if (released.has(utcpNamespacePrefix(descriptor.name))) continue;
|
|
89
91
|
out.push({
|
|
90
92
|
slug: descriptor.slug,
|
|
@@ -92,7 +94,7 @@ export class PendingToolsService implements IPendingToolService {
|
|
|
92
94
|
path: descriptor.path,
|
|
93
95
|
type: descriptor.type,
|
|
94
96
|
...(descriptor.description ? { description: descriptor.description } : {}),
|
|
95
|
-
plugin: pluginOfPath(descriptor.path),
|
|
97
|
+
plugin: pluginOfPath(descriptor.path, layout),
|
|
96
98
|
changeRequestNumber: cr.number,
|
|
97
99
|
branch: cr.branch,
|
|
98
100
|
authorName: cr.appAuthor?.name ?? cr.author.name ?? 'Someone',
|
|
@@ -118,8 +120,9 @@ export class PendingToolsService implements IPendingToolService {
|
|
|
118
120
|
cr: ChangeRequest,
|
|
119
121
|
path: string,
|
|
120
122
|
content: string,
|
|
123
|
+
layout: KbLayout,
|
|
121
124
|
): Promise<ToolManualDescriptor[]> {
|
|
122
|
-
if (!isMcpJson(path)) {
|
|
125
|
+
if (!isMcpJson(path, layout)) {
|
|
123
126
|
let descriptor: ToolManualDescriptor;
|
|
124
127
|
try {
|
|
125
128
|
descriptor = normalizeToolManual(baseName(path), path, content);
|
|
@@ -140,22 +143,22 @@ export class PendingToolsService implements IPendingToolService {
|
|
|
140
143
|
// missing manifest costs a sentence, not the card. No separate access
|
|
141
144
|
// check: this caller already passed the write gate on the `mcp.json`
|
|
142
145
|
// beside it, which is the plugin folder's own verdict.
|
|
143
|
-
const pluginFolder = path.slice(`${
|
|
146
|
+
const pluginFolder = path.slice(`${layout.pluginsDir}/`.length, -(PLUGIN_MCP_FILE.length + 1));
|
|
144
147
|
const manifest = await readAt(
|
|
145
148
|
this.workspaceService,
|
|
146
|
-
|
|
149
|
+
this.kb.defaultWorkspaceId(),
|
|
147
150
|
cr.branch,
|
|
148
|
-
`${
|
|
151
|
+
`${layout.pluginsDir}/${pluginFolder}/${PLUGIN_MANIFEST_FILE}`,
|
|
149
152
|
);
|
|
150
|
-
return descriptorsFromMcpJson(pluginFolder, content, manifest);
|
|
153
|
+
return descriptorsFromMcpJson(pluginFolder, content, manifest, layout);
|
|
151
154
|
}
|
|
152
155
|
}
|
|
153
156
|
|
|
154
157
|
/** `Plugins/<…>/mcp.json` — a plugin's MCP server declarations. */
|
|
155
|
-
function isMcpJson(repoRelPath: string): boolean {
|
|
158
|
+
function isMcpJson(repoRelPath: string, layout: KbLayout): boolean {
|
|
156
159
|
const segments = repoRelPath.split('/');
|
|
157
160
|
return (
|
|
158
|
-
segments[0] ===
|
|
161
|
+
segments[0] === layout.pluginsDir &&
|
|
159
162
|
segments.length >= 3 &&
|
|
160
163
|
segments[segments.length - 1] === PLUGIN_MCP_FILE
|
|
161
164
|
);
|
|
@@ -169,11 +172,11 @@ function isMcpJson(repoRelPath: string): boolean {
|
|
|
169
172
|
* or a plugin's `mcp.json`. `Plugins/mcp.json` is not one: there is no plugin
|
|
170
173
|
* there for its servers to belong to.
|
|
171
174
|
*/
|
|
172
|
-
function isToolDeclaration(repoRelPath: string): boolean {
|
|
175
|
+
function isToolDeclaration(repoRelPath: string, layout: KbLayout): boolean {
|
|
173
176
|
const segments = repoRelPath.split('/');
|
|
174
|
-
if (segments[0] !==
|
|
177
|
+
if (segments[0] !== layout.pluginsDir || segments.length < 2) return false;
|
|
175
178
|
const last = segments[segments.length - 1] ?? '';
|
|
176
179
|
// Case-insensitive, matching the catalog's own walk.
|
|
177
180
|
if (last.toLowerCase().endsWith('.tool')) return true;
|
|
178
|
-
return isMcpJson(repoRelPath);
|
|
181
|
+
return isMcpJson(repoRelPath, layout);
|
|
179
182
|
}
|
|
@@ -2,14 +2,13 @@ import fs from 'node:fs/promises';
|
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { randomUUID } from 'node:crypto';
|
|
4
4
|
import {
|
|
5
|
-
DEFAULT_BRANCH,
|
|
6
5
|
HEXIS_EXTENSION_NS,
|
|
7
6
|
PLUGIN_MANIFEST_FILE,
|
|
8
7
|
PLUGIN_MCP_FILE,
|
|
9
8
|
type AuthUser,
|
|
10
9
|
} from '@bevel-software/platform-shared';
|
|
11
10
|
import type { WorkspaceService } from '../workspace/workspace.service.js';
|
|
12
|
-
import {
|
|
11
|
+
import type { KbContext } from '../../shared/kb-context.js';
|
|
13
12
|
import { utcpNamespacePrefix } from '../../shared/utcp-namespace.js';
|
|
14
13
|
import type { IAccessControl } from '../access/access-control.interface.js';
|
|
15
14
|
import type { IFsProbe } from '../../shared/fs.contract.js';
|
|
@@ -122,10 +121,14 @@ export class ToolDeleteService {
|
|
|
122
121
|
private readonly pluginIndex: IPluginIndexService,
|
|
123
122
|
private readonly source: PluginSource,
|
|
124
123
|
private readonly vault: Pick<ISecretsVaultService, 'countNamespace' | 'removeNamespace'>,
|
|
125
|
-
private readonly
|
|
124
|
+
private readonly kb: KbContext,
|
|
126
125
|
private readonly disk: IFsProbe,
|
|
127
126
|
) {}
|
|
128
127
|
|
|
128
|
+
private get kbDirName(): string {
|
|
129
|
+
return this.kb.kbDirName;
|
|
130
|
+
}
|
|
131
|
+
|
|
129
132
|
/** What deleting `slug` would affect. Owner-gated like the delete itself. */
|
|
130
133
|
async dependents(userEmail: string, slug: string): Promise<ToolDependents> {
|
|
131
134
|
const { tool, source, plugin, folder } = await this.authorize(userEmail, slug);
|
|
@@ -154,8 +157,8 @@ export class ToolDeleteService {
|
|
|
154
157
|
// removing its file here would be undone by the next sync, or worse.
|
|
155
158
|
throw new ToolDeleteError("This tool's plugin is managed in another format — delete it there.", 422);
|
|
156
159
|
}
|
|
157
|
-
const wsId =
|
|
158
|
-
await this.workspaceService.getOrCreateForBranch(
|
|
160
|
+
const wsId = this.kb.defaultWorkspaceId();
|
|
161
|
+
await this.workspaceService.getOrCreateForBranch(this.kb.defaultBranch);
|
|
159
162
|
const kbRoot = path.join(await this.workspaceService.getWorkspacePath(wsId), this.kbDirName);
|
|
160
163
|
|
|
161
164
|
if (source === 'manual') await this.deleteManual(user, wsId, kbRoot, tool);
|
|
@@ -205,7 +208,7 @@ export class ToolDeleteService {
|
|
|
205
208
|
}
|
|
206
209
|
}
|
|
207
210
|
if (!best) return null;
|
|
208
|
-
const owner = await this.accessControl.canOwner(
|
|
211
|
+
const owner = await this.accessControl.canOwner(this.kb.defaultWorkspaceId(), userEmail, best.folder);
|
|
209
212
|
return owner ? best : null;
|
|
210
213
|
}
|
|
211
214
|
|
|
@@ -263,10 +266,10 @@ export class ToolDeleteService {
|
|
|
263
266
|
folder: string,
|
|
264
267
|
home: PluginCatalogEntry,
|
|
265
268
|
): Promise<ToolDependents['plugins']> {
|
|
266
|
-
const wsId =
|
|
269
|
+
const wsId = this.kb.defaultWorkspaceId();
|
|
267
270
|
let discovered;
|
|
268
271
|
try {
|
|
269
|
-
await this.workspaceService.getOrCreateForBranch(
|
|
272
|
+
await this.workspaceService.getOrCreateForBranch(this.kb.defaultBranch);
|
|
270
273
|
const kbRoot = path.join(await this.workspaceService.getWorkspacePath(wsId), this.kbDirName);
|
|
271
274
|
discovered = await this.source.discover(kbRoot);
|
|
272
275
|
} catch (err) {
|
|
@@ -320,7 +323,7 @@ export class ToolDeleteService {
|
|
|
320
323
|
const parked = path.join(path.dirname(abs), `.deleting-${randomUUID()}`);
|
|
321
324
|
await fs.rename(abs, parked);
|
|
322
325
|
try {
|
|
323
|
-
await this.commits.runPendingCommit(wsId,
|
|
326
|
+
await this.commits.runPendingCommit(wsId, this.kb.defaultBranch, `${this.kbDirName}/${tool.path}`, user, {
|
|
324
327
|
// The route authorized the delete with the owner verb; see class note.
|
|
325
328
|
systemAuthorized: true,
|
|
326
329
|
});
|
|
@@ -393,7 +396,7 @@ export class ToolDeleteService {
|
|
|
393
396
|
// Commit-stage failures propagate as-is: the pipeline may already hold a
|
|
394
397
|
// local commit, and rewriting the tree under it is the state its own
|
|
395
398
|
// recovery misreads (same contract as McpServerEditService).
|
|
396
|
-
await this.commits.runPendingCommit(wsId,
|
|
399
|
+
await this.commits.runPendingCommit(wsId, this.kb.defaultBranch, `${this.kbDirName}/${folder}`, user, {
|
|
397
400
|
systemAuthorized: true,
|
|
398
401
|
});
|
|
399
402
|
}
|
|
@@ -5,9 +5,8 @@ const log = logger('tool-manuals');
|
|
|
5
5
|
import path from 'node:path';
|
|
6
6
|
import fs from 'node:fs/promises';
|
|
7
7
|
import AdmZip from 'adm-zip';
|
|
8
|
-
import { DEFAULT_BRANCH, PLUGINS_DIR } from '@bevel-software/platform-shared';
|
|
9
8
|
import type { WorkspaceService } from '../workspace/workspace.service.js';
|
|
10
|
-
import {
|
|
9
|
+
import type { KbContext } from '../../shared/kb-context.js';
|
|
11
10
|
import { isAbsence, type IFsProbe, type ITreeWalker } from '../../shared/fs.contract.js';
|
|
12
11
|
import type { IAccessControl } from '../access/access-control.interface.js';
|
|
13
12
|
import type { IPluginIndexService } from '../plugins/plugins.contract.js';
|
|
@@ -54,7 +53,8 @@ export function createToolManualsAgentRoutes(
|
|
|
54
53
|
archiveDeps?: {
|
|
55
54
|
workspaceService: WorkspaceService;
|
|
56
55
|
accessControl: IAccessControl;
|
|
57
|
-
|
|
56
|
+
/** The checkout folder, the released branch, and the layout that names the plugins root. */
|
|
57
|
+
kb: Pick<KbContext, 'kbDirName' | 'defaultBranch' | 'defaultWorkspaceId' | 'layout'>;
|
|
58
58
|
disk: ITreeWalker & IFsProbe;
|
|
59
59
|
/**
|
|
60
60
|
* Resolves a plugin IDENTITY (its manifest name) to its folder, so a
|
|
@@ -110,17 +110,19 @@ export function createToolManualsAgentRoutes(
|
|
|
110
110
|
if (!folder || folder === '.' || folder === '..' || /[/\\]/.test(folder)) {
|
|
111
111
|
return void res.status(422).json({ error: 'Not a plugin folder name' });
|
|
112
112
|
}
|
|
113
|
-
const { workspaceService, accessControl,
|
|
114
|
-
const
|
|
115
|
-
|
|
113
|
+
const { workspaceService, accessControl, kb, disk, pluginIndex } = archiveDeps;
|
|
114
|
+
const { kbDirName } = kb;
|
|
115
|
+
const pluginsDir = kb.layout.pluginsDir;
|
|
116
|
+
const wsId = kb.defaultWorkspaceId();
|
|
117
|
+
await workspaceService.getOrCreateForBranch(kb.defaultBranch);
|
|
116
118
|
const wsDir = await workspaceService.getWorkspacePath(wsId);
|
|
117
119
|
// The name is a folder directly under the root, as it always was — or,
|
|
118
120
|
// when no such folder exists, a plugin's IDENTITY, which the index maps
|
|
119
121
|
// to its folder at any depth (`Plugins/departments/eng/ado`). Identity
|
|
120
122
|
// second, so a folder that spells a nested plugin's name keeps meaning
|
|
121
123
|
// the folder.
|
|
122
|
-
let pluginRel = `${
|
|
123
|
-
let pluginDir = path.join(wsDir, kbDirName,
|
|
124
|
+
let pluginRel = `${pluginsDir}/${folder}`;
|
|
125
|
+
let pluginDir = path.join(wsDir, kbDirName, pluginsDir, folder);
|
|
124
126
|
if (pluginIndex && (await disk.lstatOrNull(pluginDir))?.isDirectory() !== true) {
|
|
125
127
|
const byIdentity = (await pluginIndex.catalog()).find((p) => p.name === folder)?.folders[0];
|
|
126
128
|
if (byIdentity) {
|
|
@@ -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
|
);
|