@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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-core-services.d.ts","sourceRoot":"","sources":["../../src/core/create-core-services.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,C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,sBAAsB,EAAE,sBAAsB,CAAC;IAC/C,qBAAqB,EAAE,qBAAqB,CAAC;IAC7C,oBAAoB,EAAE,oBAAoB,CAAC;IAC3C,UAAU,EAAE,UAAU,CAAC;IACvB,iBAAiB,EAAE,UAAU,CAAC,OAAO,uBAAuB,CAAC,CAAC;IAC9D,gBAAgB,EAAE,kBAAkB,CAAC;IACrC;;;;OAIG;IACH,sBAAsB,EAAE,MAAM,CAAC;IAC/B,oGAAoG;IACpG,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,YAAY,EAAE,YAAY,CAAC;IAC3B,kBAAkB,EAAE,UAAU,CAAC,OAAO,wBAAwB,CAAC,CAAC;IAChE,oBAAoB,EAAE,UAAU,CAAC,OAAO,0BAA0B,CAAC,CAAC;IACpE,kBAAkB,EAAE,UAAU,CAAC,OAAO,wBAAwB,CAAC,CAAC;IAEhE,sEAAsE;IACtE,WAAW,EAAE,YAAY,CAAC;IAC1B,iEAAiE;IACjE,UAAU,EAAE,cAAc,CAAC;IAC3B,4EAA4E;IAC5E,aAAa,EAAE,kBAAkB,EAAE,CAAC;CACrC;AAED,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,YAAY,EACpB,KAAK,GAAE,SAAc,GACpB,OAAO,CAAC,YAAY,CAAC,CA+8BvB"}
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
2
|
import { logger } from '../shared/logging.js';
|
|
3
|
-
|
|
3
|
+
// The browser-side live bindings, imported here and nowhere else in this
|
|
4
|
+
// package: `mirrorSharedBindings` below keeps them in step with `kb` for an
|
|
5
|
+
// overlay that still reads them. Core's own modules read only `KbContext`.
|
|
6
|
+
// eslint-disable-next-line no-restricted-imports
|
|
7
|
+
import { configureBranchModel, configureKbLayout } from '@bevel-software/platform-shared';
|
|
8
|
+
import { sql } from 'drizzle-orm';
|
|
9
|
+
import { DEFAULT_DB_SCHEMA, assertSearchPath } from '../modules/database/connection.js';
|
|
10
|
+
import { DEFAULT_SECRETS_SCOPE } from '../modules/secrets-vault/secrets-variable-loader.js';
|
|
11
|
+
import { KbContext } from '../shared/kb-context.js';
|
|
4
12
|
import { getDb } from '../modules/database/connection.js';
|
|
5
13
|
import { runCoreMigrations } from '../modules/database/migrate.js';
|
|
6
14
|
import { coreMigrationsDir } from '../assets.js';
|
|
@@ -18,6 +26,7 @@ import { DeploymentSettingsService } from '../modules/settings/deployment-settin
|
|
|
18
26
|
import { KbSyncService } from '../modules/kb-sync/kb-sync.service.js';
|
|
19
27
|
import { NodeFs } from '../modules/kb-fs/node-fs.js';
|
|
20
28
|
import { assertKbDirNameFree } from '../modules/kb-fs/repo-path.js';
|
|
29
|
+
import { gitCredentials } from '../shared/git.contract.js';
|
|
21
30
|
import { AdvisoryLease, AdvisoryLock } from '../modules/database/advisory-lock.js';
|
|
22
31
|
import { holdCommitWorkerLease, withStartupTask } from './lifecycle.js';
|
|
23
32
|
/** The hosted MCP endpoint at a deployment address, with any userinfo stripped. */
|
|
@@ -80,6 +89,7 @@ import { InternalTokenService, deriveInternalTokenSecret, } from '../modules/too
|
|
|
80
89
|
import { createToolAuthMiddleware, createManualAuthMiddleware, } from '../modules/tool-auth/tool-auth.middleware.js';
|
|
81
90
|
import { unmeteredLlmUsage } from '../modules/tool-auth/llm-usage-meter.js';
|
|
82
91
|
import { McpService } from '../modules/mcp/mcp.service.js';
|
|
92
|
+
import { AgentAuditService, retentionDaysFrom } from '../modules/audit/agent-audit.service.js';
|
|
83
93
|
import { readAgentPreamble } from '../modules/agent-instructions/index.js';
|
|
84
94
|
import { createMcpAuthMiddleware } from '../modules/mcp/mcp-auth.middleware.js';
|
|
85
95
|
import { BevelOAuthProvider } from '../modules/mcp/oauth/bevel-oauth-provider.js';
|
|
@@ -97,7 +107,21 @@ export async function createCoreServices(config, ports = {}) {
|
|
|
97
107
|
// (see `git-version.ts`): every clone, fetch and refresh below depends on it,
|
|
98
108
|
// so an unsupported binary is better surfaced here than at the first merge.
|
|
99
109
|
await assertGitVersion();
|
|
100
|
-
|
|
110
|
+
// What tells this knowledge base's locks, migration ledger and secrets
|
|
111
|
+
// loader apart from another's in the same process and database. Empty for
|
|
112
|
+
// the default schema, so a single-tenant deployment keeps the lock ids and
|
|
113
|
+
// the ledger it always had.
|
|
114
|
+
const tenantKey = config.dbSchema === DEFAULT_DB_SCHEMA ? '' : config.dbSchema;
|
|
115
|
+
const db = getDb(config.databaseUrl, { schema: config.dbSchema });
|
|
116
|
+
// A schema of its own is created on first use, so a tenant's first
|
|
117
|
+
// activation needs nothing done by hand; `public` always exists. Then the
|
|
118
|
+
// server is asked whether the connections really search that schema: a
|
|
119
|
+
// pooler that dropped the startup parameter would otherwise land every
|
|
120
|
+
// tenant's tables in `public`, silently — see `assertSearchPath`.
|
|
121
|
+
if (tenantKey) {
|
|
122
|
+
await db.execute(sql.raw(`create schema if not exists "${config.dbSchema}"`));
|
|
123
|
+
await assertSearchPath(db, config.dbSchema);
|
|
124
|
+
}
|
|
101
125
|
// Migrations must run BEFORE any service that reads or writes a managed
|
|
102
126
|
// table. `PendingCommitsService.startupReconcile` (called later in this
|
|
103
127
|
// function) hits `pending_commits` — on a fresh DB, deferring migrations to
|
|
@@ -113,40 +137,12 @@ export async function createCoreServices(config, ports = {}) {
|
|
|
113
137
|
// is resolved through them, and a fresh install has none of it in the
|
|
114
138
|
// environment. `load()` is env-first, so an existing deployment sees exactly
|
|
115
139
|
// what it saw before — a stored row only answers where a variable is silent.
|
|
116
|
-
const settings = new DeploymentSettingsService(db, config.secretsEncKey);
|
|
140
|
+
const settings = new DeploymentSettingsService(db, config.secretsEncKey, undefined, { env: config.settingsEnv });
|
|
117
141
|
await settings.load();
|
|
118
|
-
/**
|
|
119
|
-
* The branch model, before anything reads it. It used to be applied at import
|
|
120
|
-
* time from the environment, which is what forced the frontend to bake it
|
|
121
|
-
* into its bundle; it now comes through the settings store like the rest of
|
|
122
|
-
* the deployment's configuration (environment first, as always).
|
|
123
|
-
*
|
|
124
|
-
* UNCONFIGURED IS ALLOWED, and that is the point: a fresh deployment has no
|
|
125
|
-
* branch model, and refusing to boot would take away the setup screen where
|
|
126
|
-
* one gets entered. What reads it before then is the setup path itself, which
|
|
127
|
-
* does not need it — the bootstrap admin is recognised without a workspace.
|
|
128
|
-
* `isComplete` keeps the rest of the app behind the gate until it is set, and
|
|
129
|
-
* the setting is restart-to-apply because services take the value at
|
|
130
|
-
* construction.
|
|
131
|
-
*/
|
|
132
|
-
const branchModel = {
|
|
133
|
-
defaultBranch: settings.resolve('defaultBranch'),
|
|
134
|
-
protectedBranches: settings.resolve('protectedBranches'),
|
|
135
|
-
};
|
|
136
|
-
if (!validateBranchModel(branchModel))
|
|
137
|
-
configureBranchModel(branchModel);
|
|
138
142
|
// The layout variables that were retired this release, folded into their
|
|
139
143
|
// saved settings before anything reads the layout — so the boot that imports
|
|
140
144
|
// them also RUNS on the imported names rather than on the defaults.
|
|
141
145
|
await settings.importLegacyLayoutEnv();
|
|
142
|
-
// The KB layout — the three renameable roots and the agent guide's file name
|
|
143
|
-
// — applied the same way and at the same moment, before any service captures
|
|
144
|
-
// one of them. Unlike the branch model it always resolves (every name has a
|
|
145
|
-
// default), so an invalid value is a real misconfiguration and stops the boot.
|
|
146
|
-
configureKbLayout(settings.resolveKbLayout());
|
|
147
|
-
// A token supplied through the setup screen has to reach the credential
|
|
148
|
-
// helper, which reads `$GITHUB_TOKEN` at call time.
|
|
149
|
-
settings.syncGitTokenEnv();
|
|
150
146
|
// `kbDirName` is read ONCE and threaded into a dozen services as a plain
|
|
151
147
|
// string, which is why changing it needs a restart (the setting says so).
|
|
152
148
|
// The remote URL and username are read per-operation instead, so an admin
|
|
@@ -157,14 +153,62 @@ export async function createCoreServices(config, ports = {}) {
|
|
|
157
153
|
// unnameable. Both are operator settings, so the collision is refused here,
|
|
158
154
|
// by name, before any service captures either.
|
|
159
155
|
assertKbDirNameFree(kbDirName, settings.resolveKbLayout());
|
|
156
|
+
/**
|
|
157
|
+
* The knowledge base's context — the checkout folder, the branch model and
|
|
158
|
+
* the layout — built before any service, and handed to each one that reads
|
|
159
|
+
* a name from it (see `shared/kb-context.ts`). The values come through the
|
|
160
|
+
* settings store like the rest of the deployment's configuration
|
|
161
|
+
* (environment first, as always).
|
|
162
|
+
*
|
|
163
|
+
* The branch model: UNCONFIGURED IS ALLOWED, and that is the point. A fresh
|
|
164
|
+
* deployment has no branch model, and refusing to boot would take away the
|
|
165
|
+
* setup screen where one gets entered. What reads it before then is the
|
|
166
|
+
* setup path itself, which does not need it — the bootstrap admin is
|
|
167
|
+
* recognised without a workspace. `isComplete` keeps the rest of the app
|
|
168
|
+
* behind the gate until it is set, and the save that completes setup applies
|
|
169
|
+
* it to this very object, which every service reads at use rather than
|
|
170
|
+
* capturing at construction.
|
|
171
|
+
*
|
|
172
|
+
* The layout — the three renameable roots and the agent guide's file name —
|
|
173
|
+
* always resolves (every name has a default), so an invalid value is a real
|
|
174
|
+
* misconfiguration and stops the boot.
|
|
175
|
+
*/
|
|
176
|
+
const kb = new KbContext(kbDirName, KbContext.branchModelOrUnconfigured({
|
|
177
|
+
defaultBranch: settings.resolve('defaultBranch'),
|
|
178
|
+
protectedBranches: settings.resolve('protectedBranches'),
|
|
179
|
+
}), settings.resolveKbLayout());
|
|
180
|
+
// The shared package's process-wide live bindings, kept in step with `kb`
|
|
181
|
+
// for an overlay that still reads them — now, and again when the setup-
|
|
182
|
+
// completing save applies a model or a layout. Nothing in this package
|
|
183
|
+
// reads them; a host serving several knowledge bases turns this off.
|
|
184
|
+
if (ports.mirrorSharedBindings !== false) {
|
|
185
|
+
const mirrorBranchModel = () => {
|
|
186
|
+
if (kb.isBranchModelConfigured()) {
|
|
187
|
+
configureBranchModel({ defaultBranch: kb.defaultBranch, protectedBranches: [...kb.protectedBranches] });
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
const mirrorLayout = () => configureKbLayout(kb.layout);
|
|
191
|
+
mirrorBranchModel();
|
|
192
|
+
mirrorLayout();
|
|
193
|
+
kb.onBranchModelApplied(mirrorBranchModel);
|
|
194
|
+
kb.onLayoutApplied(mirrorLayout);
|
|
195
|
+
}
|
|
160
196
|
// The disk: one walk, one probe, for every reader below.
|
|
161
197
|
const disk = new NodeFs();
|
|
198
|
+
// What git authenticates with, read on every call: the username and token
|
|
199
|
+
// the setup screen stored, or the environment's. Environment first for the
|
|
200
|
+
// token, as for every setting (`resolve` is env-first); the legacy
|
|
201
|
+
// `GITHUB_TOKEN` / `GH_TOKEN` spellings only through `config`, since the
|
|
202
|
+
// settings catalogue knows `GIT_TOKEN` alone. Handed to the runner, which
|
|
203
|
+
// puts the token into each child's environment — never into this
|
|
204
|
+
// process's, which several knowledge bases may share.
|
|
205
|
+
const gitCredentialsInEffect = gitCredentials(() => settings.resolve('gitUsername') || config.gitUsername, () => settings.resolve('gitToken') || config.gitToken || null);
|
|
162
206
|
// How git is run, for every module that runs it: one environment, one buffer
|
|
163
207
|
// ceiling, one error shape, and — the reason it exists — one deadline, so a
|
|
164
208
|
// git that never returns cannot hold a workspace (and with it the commit
|
|
165
209
|
// queue) open indefinitely. See `shared/git.contract.ts`.
|
|
166
|
-
const gitRunner = new NodeGitRunner(config.gitTimeoutMs);
|
|
167
|
-
const workspaceService = new WorkspaceService(config.workspacesRoot, () => settings.resolve('kbRepoUrl'),
|
|
210
|
+
const gitRunner = new NodeGitRunner(config.gitTimeoutMs, gitCredentialsInEffect);
|
|
211
|
+
const workspaceService = new WorkspaceService(config.workspacesRoot, () => settings.resolve('kbRepoUrl'), kb, disk, gitRunner);
|
|
168
212
|
// The KB startup phase: every seeding, scaffolding and migration concern,
|
|
169
213
|
// run through one runner at the deployment's quiet moments (boot + setup
|
|
170
214
|
// completion) instead of lazily on branch loads. Root folders this
|
|
@@ -180,18 +224,18 @@ export async function createCoreServices(config, ports = {}) {
|
|
|
180
224
|
// read-only, needs no remote, and must be said even on a deployment whose
|
|
181
225
|
// setup never finished — so `noteBesideCheckout` runs once from the server
|
|
182
226
|
// builder, ahead of this gated phase.)
|
|
183
|
-
new GroupsToPluginsStep(disk),
|
|
184
|
-
new PluginManifestsStep(disk),
|
|
227
|
+
new GroupsToPluginsStep(disk, kb),
|
|
228
|
+
new PluginManifestsStep(disk, kb),
|
|
185
229
|
// After the manifests step: a folder that only just got its manifest got
|
|
186
230
|
// one the renderer wrote, which already carries the display name — the
|
|
187
231
|
// backfill then has nothing to do for it. Ordered the other way, the
|
|
188
232
|
// backfill would walk a tree still missing those manifests.
|
|
189
|
-
new PluginDisplayNamesStep(disk),
|
|
190
|
-
new PersonalSpacesStep(disk),
|
|
233
|
+
new PluginDisplayNamesStep(disk, kb),
|
|
234
|
+
new PersonalSpacesStep(disk, kb),
|
|
191
235
|
// A getter, not a value: the step is built here, while the process may
|
|
192
236
|
// still hold the defaults, and the save that completes first-run setup
|
|
193
237
|
// applies the admin's answer afterwards.
|
|
194
|
-
new TemplateFilesStep(disk, extraDirs, () => settings.resolveAgentsFileLink()),
|
|
238
|
+
new TemplateFilesStep(disk, kb, extraDirs, () => settings.resolveAgentsFileLink()),
|
|
195
239
|
new RolesYamlStep(disk, [config.adminEmail]),
|
|
196
240
|
...(ports.kbStartupSteps ?? []),
|
|
197
241
|
];
|
|
@@ -200,18 +244,16 @@ export async function createCoreServices(config, ports = {}) {
|
|
|
200
244
|
// setup screen after this object exists, and the setup-completion run is
|
|
201
245
|
// the first thing that needs them.
|
|
202
246
|
kbRepoUrl: () => settings.resolve('kbRepoUrl'),
|
|
203
|
-
gitUsername: () => settings.resolve('gitUsername') || 'x-access-token',
|
|
204
|
-
gitToken: () => settings.resolve('gitToken'),
|
|
205
247
|
workspacesRoot: config.workspacesRoot,
|
|
206
248
|
kbDirName,
|
|
207
249
|
templateDir: config.kbTemplateDir,
|
|
208
|
-
defaultBranch: () =>
|
|
209
|
-
protectedBranches: () => [...
|
|
250
|
+
defaultBranch: () => kb.defaultBranch,
|
|
251
|
+
protectedBranches: () => [...kb.protectedBranches],
|
|
210
252
|
// The deployment owner is the initial Admin of a freshly seeded KB — the
|
|
211
253
|
// same answer `SEED_ADMIN_EMAILS` used to ask for a second time.
|
|
212
254
|
seedAdminEmails: [config.adminEmail],
|
|
213
255
|
steps: kbStartupSteps,
|
|
214
|
-
buildSeedTree: buildSeedTree(disk, config.kbTemplateDir, extraDirs, [config.adminEmail]),
|
|
256
|
+
buildSeedTree: buildSeedTree(disk, config.kbTemplateDir, extraDirs, [config.adminEmail], kb),
|
|
215
257
|
gitRunner,
|
|
216
258
|
});
|
|
217
259
|
// Shared, workspace-independent store for oversized `call_tool_chain` results,
|
|
@@ -226,43 +268,43 @@ export async function createCoreServices(config, ports = {}) {
|
|
|
226
268
|
// gate cannot disagree about who the owner is. They did: the owner could
|
|
227
269
|
// open App roles and then be refused the save, with the UI showing
|
|
228
270
|
// them as an admin and the gate saying "Eligible: Admin".
|
|
229
|
-
const accessControl = new AccessControlService(workspaceService, kbDirName, disk, [config.adminEmail], gitRunner);
|
|
271
|
+
const accessControl = new AccessControlService(workspaceService, kbDirName, disk, [config.adminEmail], gitRunner, kb);
|
|
230
272
|
// Creator read-grant on creation: read is default-deny and the roots grant
|
|
231
273
|
// it to nobody, so every surface that starts a new folder at a root (human
|
|
232
274
|
// routes, agent tools, upload apply) consults this planner to keep the new
|
|
233
275
|
// folder visible to its creator.
|
|
234
|
-
const creatorAccess = new CreatorAccessService(workspaceService, accessControl,
|
|
276
|
+
const creatorAccess = new CreatorAccessService(workspaceService, accessControl, kb, disk);
|
|
235
277
|
// Read-before-write: the gate every lock acquire asks, on every branch —
|
|
236
278
|
// nothing is created, changed or removed where its author cannot read,
|
|
237
279
|
// except that new folder at a root (see `access-model/change-gate.ts`).
|
|
238
|
-
const changeGate = new ChangeReadGate(workspaceService, accessControl,
|
|
280
|
+
const changeGate = new ChangeReadGate(workspaceService, accessControl, kb, disk);
|
|
239
281
|
// Ontology-session boundary: records each agent run's touched ontologies and
|
|
240
282
|
// blocks writes once a run has crossed ontologies. Postgres-backed so the
|
|
241
283
|
// boundary survives a restart.
|
|
242
|
-
const sessionOntologyService = new SessionOntologyService(db);
|
|
284
|
+
const sessionOntologyService = new SessionOntologyService(db, kb);
|
|
243
285
|
// Per-run write restriction (by file extension). Shared by the workspace tool
|
|
244
286
|
// surface (which enforces it) and the routine runner (which sets it for
|
|
245
287
|
// dashboard-only `watchlist_check` runs). In-memory: a restriction lives only for
|
|
246
288
|
// one run, unlike the Postgres-backed ontology touched-set above.
|
|
247
289
|
const routineWritePolicy = new RoutineWritePolicyService();
|
|
248
290
|
// Skills: discovered from the default-branch workspace only (global catalog).
|
|
249
|
-
const skillService = new SkillService(workspaceService, accessControl,
|
|
291
|
+
const skillService = new SkillService(workspaceService, accessControl, kb, disk);
|
|
250
292
|
// Tool manuals: user-authored `*.tool` files under `Plugins/` in the default
|
|
251
293
|
// branch — access-controlled like Skills, served to external agents via
|
|
252
294
|
// `GET /api/agent/all-tools` and registered on the MCP proxy's UTCP client.
|
|
253
295
|
// Where plugins come from: one walk of the plugins root that reads every
|
|
254
296
|
// plugin folder in whichever file shape it carries (see
|
|
255
297
|
// modules/plugins/discovery). Nothing to configure, nothing to document.
|
|
256
|
-
const pluginSource = new KbPluginSource(disk);
|
|
257
|
-
const toolManualService = new ToolManualService(workspaceService, accessControl,
|
|
298
|
+
const pluginSource = new KbPluginSource(disk, kb);
|
|
299
|
+
const toolManualService = new ToolManualService(workspaceService, accessControl, kb, disk, pluginSource);
|
|
258
300
|
// Plugins: the folders under `Plugins/` that carry a
|
|
259
301
|
// team's skills AND the tools they need. Enumerated for EVERY authenticated
|
|
260
302
|
// caller — a plugin they cannot read still exists for them, as a locked one —
|
|
261
303
|
// with the counts read off the two catalogs above rather than a second scan.
|
|
262
304
|
// The link index resolves manifests against the released catalog, and the
|
|
263
305
|
// plugin index counts through it (inline + linked), so it comes first.
|
|
264
|
-
const pluginLinkIndex = new PluginLinkIndex(workspaceService, skillService, accessControl,
|
|
265
|
-
const pluginIndexService = new PluginIndexService(workspaceService, accessControl, skillService, toolManualService,
|
|
306
|
+
const pluginLinkIndex = new PluginLinkIndex(workspaceService, skillService, accessControl, kb, pluginSource);
|
|
307
|
+
const pluginIndexService = new PluginIndexService(workspaceService, accessControl, skillService, toolManualService, kb, pluginSource, Date.now, pluginLinkIndex);
|
|
266
308
|
// Auth service — resolves identities for login, PR author attribution, and
|
|
267
309
|
// access lookups. (Change requests now store the author email directly, so
|
|
268
310
|
// PullRequestService no longer depends on it for attribution.)
|
|
@@ -274,7 +316,7 @@ export async function createCoreServices(config, ports = {}) {
|
|
|
274
316
|
adminPassword: config.adminPassword,
|
|
275
317
|
allowedEmailDomains: parseDomainList(settings.resolve('allowedEmailDomains')),
|
|
276
318
|
loginPasswordEnabled: config.loginPasswordEnabled,
|
|
277
|
-
});
|
|
319
|
+
}, ports.accountAdmission);
|
|
278
320
|
const authMiddleware = createAuthMiddleware(authService);
|
|
279
321
|
// Shared mutex so git and diff operations on the same workspace serialize
|
|
280
322
|
// against each other — a backup-reseed races a concurrent commit otherwise.
|
|
@@ -286,7 +328,7 @@ export async function createCoreServices(config, ports = {}) {
|
|
|
286
328
|
// this function returns. Core registers none: no commit-time validation
|
|
287
329
|
// (advisory anyway) and no ontology write block.
|
|
288
330
|
const workflowHooks = new WorkflowHooks();
|
|
289
|
-
const gitService = new GitService(workspaceService, workflowHooks,
|
|
331
|
+
const gitService = new GitService(workspaceService, workflowHooks, kb, workspaceMutex, accessControl, gitRunner);
|
|
290
332
|
// `get_skill` with a `version` reads the skill out of the default branch's
|
|
291
333
|
// history; the skill service is built before git exists, so git is handed
|
|
292
334
|
// to it here.
|
|
@@ -337,7 +379,7 @@ export async function createCoreServices(config, ports = {}) {
|
|
|
337
379
|
// id-repair keeps the id namespace collision-free. Subscribers are registered
|
|
338
380
|
// below, once the reacting services exist.
|
|
339
381
|
const fileChangeNotifier = new FileChangeNotifier();
|
|
340
|
-
const workflowService = new WorkflowService(db, gitService, pullRequestService, reviewWorkflowService, workspaceService, accessControl, fileLockService, pendingCommitsService,
|
|
382
|
+
const workflowService = new WorkflowService(db, gitService, pullRequestService, reviewWorkflowService, workspaceService, accessControl, fileLockService, pendingCommitsService, kb, changeGate, eventBus, fileChangeNotifier,
|
|
341
383
|
// Exposed as `workflowService.hooks` — the SAME instance GitService and
|
|
342
384
|
// the session-ontology gate consult, so enterprise registrations against
|
|
343
385
|
// it reach every hook point.
|
|
@@ -346,7 +388,7 @@ export async function createCoreServices(config, ports = {}) {
|
|
|
346
388
|
// (the request's branch vs the default branch), so it holds no state — it
|
|
347
389
|
// only needs to read files at refs and to close a request whose proposals
|
|
348
390
|
// have all landed.
|
|
349
|
-
const joinRequestsService = new JoinRequestsService(workspaceService, workflowService);
|
|
391
|
+
const joinRequestsService = new JoinRequestsService(workspaceService, workflowService, kb);
|
|
350
392
|
// The OTHER half of a join request: the row the subscribe endpoint writes
|
|
351
393
|
// before it answers, and the branch/clone/commit/push/change-request work
|
|
352
394
|
// that runs against it afterwards. The row is what lets the click be
|
|
@@ -355,7 +397,7 @@ export async function createCoreServices(config, ports = {}) {
|
|
|
355
397
|
const pluginJoinRequestJobs = new PluginJoinRequestJobs(new DbJoinRequestStore(db), {
|
|
356
398
|
workflow: workflowService,
|
|
357
399
|
workspaceService,
|
|
358
|
-
|
|
400
|
+
kb,
|
|
359
401
|
// A record keys on the plugin's primary FOLDER below the root, which the
|
|
360
402
|
// catalog is the only thing that can turn back into a path and a name
|
|
361
403
|
// people read. Null once nothing answers to the key — a deleted plugin,
|
|
@@ -381,16 +423,16 @@ export async function createCoreServices(config, ports = {}) {
|
|
|
381
423
|
});
|
|
382
424
|
// Links land as ordinary default-branch commits and change what the plugin
|
|
383
425
|
// index counts, so a link drops that cache too.
|
|
384
|
-
const pluginLinksService = new PluginLinksService(workspaceService, workflowService, accessControl, skillService, pluginLinkIndex,
|
|
426
|
+
const pluginLinksService = new PluginLinksService(workspaceService, workflowService, accessControl, skillService, pluginLinkIndex, kb, eventBus, () => pluginIndexService.invalidate());
|
|
385
427
|
// A rename rewrites grants across the knowledge base in one batch commit,
|
|
386
428
|
// then drops every cache that keyed on the old identity.
|
|
387
|
-
const pluginRenameService = new PluginRenameService(workspaceService, workflowService, accessControl, pluginSource, disk,
|
|
429
|
+
const pluginRenameService = new PluginRenameService(workspaceService, workflowService, accessControl, pluginSource, disk, kb, eventBus, () => {
|
|
388
430
|
pluginIndexService.invalidate();
|
|
389
431
|
pluginLinkIndex.invalidate();
|
|
390
432
|
});
|
|
391
433
|
// Source → distribution. The marketplace's identity is fixed for now; the
|
|
392
434
|
// per-user git endpoint and any mirror both compile through this.
|
|
393
|
-
const marketplaceCompiler = new MarketplaceCompilerService(workspaceService, accessControl, skillService, pluginLinkIndex,
|
|
435
|
+
const marketplaceCompiler = new MarketplaceCompilerService(workspaceService, accessControl, skillService, pluginLinkIndex, kb, {
|
|
394
436
|
name: 'hexis',
|
|
395
437
|
owner: 'Hexis',
|
|
396
438
|
description: 'Skills and plugins from this knowledge base',
|
|
@@ -410,23 +452,23 @@ export async function createCoreServices(config, ports = {}) {
|
|
|
410
452
|
// spans a plugin's mcp.json AND plugin.json extensions block, and this is
|
|
411
453
|
// the ONE writer that rewrites both entries and commits them together (see
|
|
412
454
|
// McpServerEditService).
|
|
413
|
-
const mcpServerEditService = new McpServerEditService(workspaceService, workflowService, accessControl, toolManualService,
|
|
455
|
+
const mcpServerEditService = new McpServerEditService(workspaceService, workflowService, accessControl, toolManualService, kb, disk);
|
|
414
456
|
// Plugin provisioning — the one privileged door that brings `Plugins/<name>/`
|
|
415
457
|
// folders into existence (named plugins and personal folders alike). Commits
|
|
416
458
|
// INLINE through the same pipeline the pending-commits worker uses, so the
|
|
417
459
|
// folder's rules are at HEAD before the endpoint answers.
|
|
418
|
-
const pluginProvisionService = new PluginProvisionService(workspaceService, workflowService, accessControl,
|
|
460
|
+
const pluginProvisionService = new PluginProvisionService(workspaceService, workflowService, accessControl, kb, eventBus, pluginSource, disk);
|
|
419
461
|
// Pending skills: the other half of the catalog — skills that exist only on
|
|
420
462
|
// an open change request's branch. Built here rather than beside
|
|
421
463
|
// `skillService` because it needs the workflow service, which does not exist
|
|
422
464
|
// that early; it holds no state of its own, so where it is constructed is the
|
|
423
465
|
// only thing the ordering decides.
|
|
424
|
-
const pendingSkillsService = new PendingSkillsService(workspaceService, accessControl, skillService, workflowService);
|
|
466
|
+
const pendingSkillsService = new PendingSkillsService(workspaceService, accessControl, skillService, workflowService, kb);
|
|
425
467
|
// The same missing half, for tools: a `.tool` manual or an `mcp.json` server
|
|
426
468
|
// an agent proposes is nowhere in the product until its change request
|
|
427
469
|
// merges. Built here for the same reason — it needs the workflow service —
|
|
428
470
|
// and stateless for the same reason.
|
|
429
|
-
const pendingToolsService = new PendingToolsService(workspaceService, accessControl, toolManualService, workflowService);
|
|
471
|
+
const pendingToolsService = new PendingToolsService(workspaceService, accessControl, toolManualService, workflowService, kb);
|
|
430
472
|
// Catalog freshness: the skill / tool-manual / plugin-index caches all scan
|
|
431
473
|
// the DEFAULT branch's working tree, and all three go stale on the same
|
|
432
474
|
// events (a commit, a working-tree write, a merge) — as does the access
|
|
@@ -436,13 +478,13 @@ export async function createCoreServices(config, ports = {}) {
|
|
|
436
478
|
registerCatalogCacheInvalidation({
|
|
437
479
|
eventBus,
|
|
438
480
|
fileChangeNotifier,
|
|
439
|
-
|
|
481
|
+
kb,
|
|
440
482
|
catalogs: [toolManualService, skillService, pluginIndexService, pluginLinkIndex],
|
|
441
483
|
accessControl,
|
|
442
484
|
});
|
|
443
485
|
// Admin = `Admin` role in roles.yaml, resolved through the access model on the
|
|
444
486
|
// default branch (no env allow-list).
|
|
445
|
-
const adminAccess = new AdminAccessService(accessControl, workspaceService, () =>
|
|
487
|
+
const adminAccess = new AdminAccessService(accessControl, workspaceService, () => kb.defaultBranch,
|
|
446
488
|
// The deployment owner administers accounts/roles even before the KB's
|
|
447
489
|
// roles.yaml lists them, and whatever the sign-in method — this list is
|
|
448
490
|
// consulted before any roles.yaml lookup, so it holds for SSO too.
|
|
@@ -466,21 +508,24 @@ export async function createCoreServices(config, ports = {}) {
|
|
|
466
508
|
// `resolve` reads the shared (admin) row or the caller's own per-user row.
|
|
467
509
|
(key) => toolManualService.scopeOfVariable(key));
|
|
468
510
|
// Register the `bevel-secrets` UTCP variable loader against this vault so any
|
|
469
|
-
// UTCP client can resolve `${VAR}` from the caller's secrets at tool-call
|
|
470
|
-
|
|
511
|
+
// UTCP client can resolve `${VAR}` from the caller's secrets at tool-call
|
|
512
|
+
// time — under this knowledge base's scope, since the loader registry is
|
|
513
|
+
// UTCP's and process-wide while the vault is this graph's.
|
|
514
|
+
const secretsScope = tenantKey ? `${config.tenantId}/${config.dbSchema}` : DEFAULT_SECRETS_SCOPE;
|
|
515
|
+
registerBevelSecretsVariableLoader(secretsVaultService, secretsScope);
|
|
471
516
|
// Deleting ONE tool from its page — the owner's verb, the other end of the
|
|
472
517
|
// promise that made them the owner. Built here because it is the one service
|
|
473
518
|
// that spans both halves of a tool: the definition (a `.tool` file or an
|
|
474
519
|
// mcp.json entry) and the credentials stored under its name, which is why it
|
|
475
520
|
// can only exist once the vault does.
|
|
476
|
-
const toolDeleteService = new ToolDeleteService(workspaceService, workflowService, accessControl, toolManualService, skillService, pluginIndexService, pluginSource, secretsVaultService,
|
|
521
|
+
const toolDeleteService = new ToolDeleteService(workspaceService, workflowService, accessControl, toolManualService, skillService, pluginIndexService, pluginSource, secretsVaultService, kb, disk);
|
|
477
522
|
// The credential probe: whether a tool's stored credential actually WORKS, as
|
|
478
523
|
// distinct from whether one is stored. Built here — after the vault and the
|
|
479
524
|
// tool catalog — because a probe needs both: the catalog to know what to
|
|
480
525
|
// call, the vault to resolve the credential to call it with. Holds no state
|
|
481
526
|
// and takes no `db`: a verdict is returned to the caller that asked for it and
|
|
482
527
|
// never outlives their page (see `ProbeVerdict`).
|
|
483
|
-
const connectionProbeService = new ConnectionProbeService(toolManualService, secretsVaultService);
|
|
528
|
+
const connectionProbeService = new ConnectionProbeService(toolManualService, secretsVaultService, secretsScope);
|
|
484
529
|
// Zero-config OAuth for bare `type: mcp` `.tool`s: when the remote server
|
|
485
530
|
// demands OAuth (MCP authorization spec), discover its authorization server,
|
|
486
531
|
// dynamically register a public PKCE client, and persist the provider as the
|
|
@@ -540,12 +585,17 @@ export async function createCoreServices(config, ports = {}) {
|
|
|
540
585
|
// for readers, and the preamble is a broadcast). One reader, two consumers:
|
|
541
586
|
// the proxy below composes in-process per request; the agent-facing route
|
|
542
587
|
// serves the same composition to the local bridge and the frontend card.
|
|
543
|
-
const readPreamble = () => readAgentPreamble(workspaceService,
|
|
588
|
+
const readPreamble = () => readAgentPreamble(workspaceService, kb, disk);
|
|
589
|
+
// The Audit log. Records through the proxy below (every call an external
|
|
590
|
+
// agent makes), reads keys through the key service so their shape is
|
|
591
|
+
// defined once, and prunes past the retention setting — read per sweep, so
|
|
592
|
+
// a change on the Deployment page applies without a restart.
|
|
593
|
+
const agentAuditService = new AgentAuditService(db, externalApiKeyService, () => retentionDaysFrom(settings.resolve('auditRetentionDays')));
|
|
544
594
|
const mcpService = new McpService({
|
|
545
595
|
// Loopback to our own REST tool surface — 127.0.0.1 (not localhost) to pin
|
|
546
596
|
// IPv4 and dodge resolver ambiguity. The proxy authenticates each call with
|
|
547
597
|
// the caller's own connection key.
|
|
548
|
-
loopbackBaseUrl: `http://127.0.0.1:${config.port}`,
|
|
598
|
+
loopbackBaseUrl: config.loopbackBaseUrl ?? `http://127.0.0.1:${config.port}`,
|
|
549
599
|
// Manual namespace + UTCP variable prefix (KNOWLEDGE_BASE_API_URL / …).
|
|
550
600
|
manualName: 'KNOWLEDGE_BASE',
|
|
551
601
|
// Oversized chain results spill here too — an external MCP caller has no
|
|
@@ -554,6 +604,7 @@ export async function createCoreServices(config, ports = {}) {
|
|
|
554
604
|
// For the needs-authorization setup link surfaced to external agents.
|
|
555
605
|
publicFrontendUrl: config.publicFrontendUrl,
|
|
556
606
|
readAgentPreamble: readPreamble,
|
|
607
|
+
secretsScope,
|
|
557
608
|
},
|
|
558
609
|
// Pre-dispatch per-user credential check: the vault answers "has this caller
|
|
559
610
|
// set it?" and the manual catalog answers "which user-scoped vars does this
|
|
@@ -565,7 +616,9 @@ export async function createCoreServices(config, ports = {}) {
|
|
|
565
616
|
// Grant reset for broken tool sign-ins. A closure because the
|
|
566
617
|
// provider is constructed just below (it needs nothing from McpService;
|
|
567
618
|
// the binding is only dereferenced at call time, long after boot).
|
|
568
|
-
(bearer) => mcpOAuthProvider.revokeByAccessToken(bearer)
|
|
619
|
+
(bearer) => mcpOAuthProvider.revokeByAccessToken(bearer),
|
|
620
|
+
// Every attributable call lands in the Audit log through this.
|
|
621
|
+
agentAuditService);
|
|
569
622
|
// A changed secret invalidates what the proxy built from the old value for
|
|
570
623
|
// that user (null = shared secret → everyone): remembered manual failures,
|
|
571
624
|
// so a just-repaired credential is retried on the very next request instead
|
|
@@ -657,12 +710,6 @@ export async function createCoreServices(config, ports = {}) {
|
|
|
657
710
|
},
|
|
658
711
|
});
|
|
659
712
|
const leased = withStartupTask(pendingCommitsWorker, reconcileQueue);
|
|
660
|
-
// Not `start()`: the worker runs only while this process holds the
|
|
661
|
-
// commit-worker lease. On a redeploy the outgoing container still holds it,
|
|
662
|
-
// so this one serves requests and declines to drain until that one exits;
|
|
663
|
-
// then it takes the lease and starts. Two processes draining one shared
|
|
664
|
-
// clone volume is the failure this prevents — see `core/lifecycle.ts`.
|
|
665
|
-
const commitWorker = holdCommitWorkerLease(new AdvisoryLease(db, AdvisoryLock.CommitWorker), leased);
|
|
666
713
|
// SSO providers. The array REFERENCE is shared with the caller's port — an
|
|
667
714
|
// overlay pushes its own plugins into it after construction (they mount when
|
|
668
715
|
// the server is built, later). Core contributes the generic OIDC provider.
|
|
@@ -703,7 +750,7 @@ export async function createCoreServices(config, ports = {}) {
|
|
|
703
750
|
eventBus,
|
|
704
751
|
kbDirName,
|
|
705
752
|
bot,
|
|
706
|
-
defaultBranchOf: () =>
|
|
753
|
+
defaultBranchOf: () => kb.defaultBranch,
|
|
707
754
|
}),
|
|
708
755
|
debounceMs: opts?.debounceMs,
|
|
709
756
|
log: opts?.log ?? ((message) => logger('directory-sync').warn(message)),
|
|
@@ -712,22 +759,38 @@ export async function createCoreServices(config, ports = {}) {
|
|
|
712
759
|
// Groups — the "who you are" principal sets. Manual-mode CRUD on
|
|
713
760
|
// groups.yaml, IdP-mode refusals, and the connect-time retirement the
|
|
714
761
|
// directory token route drives.
|
|
715
|
-
const groupsAdminService = new GroupsAdminService(workspaceService, workflowService, accessControl, kbDirName, () =>
|
|
762
|
+
const groupsAdminService = new GroupsAdminService(workspaceService, workflowService, accessControl, kbDirName, () => kb.defaultBranch, eventBus);
|
|
716
763
|
// Account deletion's optional half: the erased address out of roles.yaml,
|
|
717
764
|
// groups.yaml and every access rule, in one commit on the default branch.
|
|
718
765
|
// The deployment owner is never removed this way.
|
|
719
|
-
const userAccessRemovalService = new UserAccessRemovalService(workspaceService, workflowService, accessControl, disk, kbDirName, () =>
|
|
766
|
+
const userAccessRemovalService = new UserAccessRemovalService(workspaceService, workflowService, accessControl, disk, kbDirName, () => kb.defaultBranch, eventBus, [config.adminEmail]);
|
|
767
|
+
// THE LAST THING STARTED, once everything above is built: the lease loop
|
|
768
|
+
// is the one piece of this function that keeps running on its own, and a
|
|
769
|
+
// throw anywhere after it would leave a loop holding — or forever asking
|
|
770
|
+
// for — this knowledge base's lock with no graph to stop it. Single-tenant
|
|
771
|
+
// never noticed (the process exited with the throw); a host that retries
|
|
772
|
+
// an activation would. Not `start()`: the worker runs only while this
|
|
773
|
+
// process holds the commit-worker lease. On a redeploy the outgoing
|
|
774
|
+
// container still holds it, so this one serves requests and declines to
|
|
775
|
+
// drain until that one exits; then it takes the lease and starts. Two
|
|
776
|
+
// processes draining one shared clone volume is the failure this prevents
|
|
777
|
+
// — see `core/lifecycle.ts`.
|
|
778
|
+
const commitWorker = holdCommitWorkerLease(new AdvisoryLease(db, AdvisoryLock.CommitWorker, { tenantKey }), leased);
|
|
720
779
|
return {
|
|
721
780
|
config,
|
|
722
781
|
db,
|
|
723
782
|
gitRunner,
|
|
724
783
|
commitWorker,
|
|
784
|
+
startupRetry: null,
|
|
785
|
+
tenantKey,
|
|
786
|
+
secretsScope,
|
|
725
787
|
disk,
|
|
726
788
|
mcpServerEditService,
|
|
727
789
|
toolDeleteService,
|
|
728
790
|
workspaceService,
|
|
729
791
|
kbStartupRunner,
|
|
730
792
|
settings,
|
|
793
|
+
kb,
|
|
731
794
|
kbDirName,
|
|
732
795
|
spillStore,
|
|
733
796
|
docExtractService,
|
|
@@ -780,6 +843,7 @@ export async function createCoreServices(config, ports = {}) {
|
|
|
780
843
|
mcpAuthMiddleware,
|
|
781
844
|
mcpOAuthProvider,
|
|
782
845
|
mcpResourceMetadataUrl,
|
|
846
|
+
agentAuditService,
|
|
783
847
|
toolRegistry,
|
|
784
848
|
toolAuthMiddleware,
|
|
785
849
|
manualAuthMiddleware,
|