@bevel-software/platform-core-backend 0.35.0 → 0.36.1
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/agent-guide/directory-structure.md +1 -1
- package/agent-guide/onboarding.md +111 -0
- package/agent-guide/start-here.md +1 -0
- package/agent-guide/tool-manuals.md +1 -0
- package/dist/core/catalog-cache-invalidation.d.ts +2 -2
- package/dist/core/catalog-cache-invalidation.d.ts.map +1 -1
- package/dist/core/compose-embed.d.ts +2 -2
- package/dist/core/compose-embed.d.ts.map +1 -1
- package/dist/core/compose-embed.js +1 -1
- package/dist/core/compose-embed.js.map +1 -1
- package/dist/core/core-ports.d.ts +19 -4
- 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.map +1 -1
- package/dist/core/create-core-server.js +26 -24
- package/dist/core/create-core-server.js.map +1 -1
- package/dist/core/create-core-services.d.ts +19 -13
- package/dist/core/create-core-services.d.ts.map +1 -1
- package/dist/core/create-core-services.js +68 -56
- package/dist/core/create-core-services.js.map +1 -1
- package/dist/core/lifecycle.d.ts +4 -4
- package/dist/core/lifecycle.d.ts.map +1 -1
- package/dist/core/lifecycle.js +5 -5
- package/dist/core/lifecycle.js.map +1 -1
- package/dist/core-config.d.ts +2 -2
- package/dist/core-config.js +3 -3
- package/dist/core-config.js.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/modules/access/access-control.service.js +1 -1
- package/dist/modules/access/access-control.service.js.map +1 -1
- package/dist/modules/access/access-declarations.d.ts +2 -2
- package/dist/modules/access/access-declarations.d.ts.map +1 -1
- package/dist/modules/access/access-declarations.js +2 -2
- package/dist/modules/access/access-declarations.js.map +1 -1
- package/dist/modules/access/access-mutation.service.d.ts +2 -2
- package/dist/modules/access/access-mutation.service.d.ts.map +1 -1
- package/dist/modules/access/access-mutation.service.js +2 -2
- package/dist/modules/access/access-mutation.service.js.map +1 -1
- package/dist/modules/access/access-requests.routes.d.ts +2 -2
- package/dist/modules/access/access-requests.routes.d.ts.map +1 -1
- package/dist/modules/access/access-requests.routes.js +5 -5
- package/dist/modules/access/access-requests.routes.js.map +1 -1
- package/dist/modules/access/access-requests.service.d.ts +2 -2
- package/dist/modules/access/access-requests.service.d.ts.map +1 -1
- package/dist/modules/access/access-requests.service.js +11 -11
- package/dist/modules/access/access-requests.service.js.map +1 -1
- package/dist/modules/access/access.routes.d.ts +2 -2
- package/dist/modules/access/access.routes.d.ts.map +1 -1
- package/dist/modules/access/access.routes.js +9 -9
- package/dist/modules/access/access.routes.js.map +1 -1
- package/dist/modules/access/admin-locked-commit.d.ts +5 -5
- package/dist/modules/access/admin-locked-commit.d.ts.map +1 -1
- package/dist/modules/access/admin-locked-commit.js +7 -7
- package/dist/modules/access/admin-locked-commit.js.map +1 -1
- package/dist/modules/access/admin-route-helpers.d.ts +1 -1
- package/dist/modules/access/admin-route-helpers.js +5 -5
- package/dist/modules/access/admin-route-helpers.js.map +1 -1
- package/dist/modules/access/change-read-gate.d.ts +1 -1
- package/dist/modules/access/change-read-gate.js +1 -1
- package/dist/modules/access/groups-admin.service.d.ts +7 -7
- package/dist/modules/access/groups-admin.service.d.ts.map +1 -1
- package/dist/modules/access/groups-admin.service.js +6 -6
- package/dist/modules/access/groups-admin.service.js.map +1 -1
- package/dist/modules/access/reference-scan.d.ts +1 -1
- package/dist/modules/access/roles-admin.service.d.ts +7 -7
- package/dist/modules/access/roles-admin.service.d.ts.map +1 -1
- package/dist/modules/access/roles-admin.service.js +8 -8
- package/dist/modules/access/roles-admin.service.js.map +1 -1
- package/dist/modules/access/synced-groups-committer.d.ts +4 -4
- package/dist/modules/access/synced-groups-committer.d.ts.map +1 -1
- package/dist/modules/access/synced-groups-committer.js +7 -7
- package/dist/modules/access/synced-groups-committer.js.map +1 -1
- package/dist/modules/access/user-access-removal.service.d.ts +6 -6
- package/dist/modules/access/user-access-removal.service.d.ts.map +1 -1
- package/dist/modules/access/user-access-removal.service.js +4 -4
- package/dist/modules/access/user-access-removal.service.js.map +1 -1
- package/dist/modules/access-model/access-errors.d.ts +4 -4
- package/dist/modules/access-model/access-errors.d.ts.map +1 -1
- package/dist/modules/access-model/access-errors.js +4 -4
- package/dist/modules/access-model/access-errors.js.map +1 -1
- package/dist/modules/access-model/access-grammar.d.ts +1 -1
- package/dist/modules/access-model/access-grammar.js +4 -4
- package/dist/modules/access-model/change-gate.d.ts +1 -1
- package/dist/modules/access-model/change-gate.js +1 -1
- package/dist/modules/access-model/roles-yaml-guard.d.ts +4 -4
- package/dist/modules/access-model/roles-yaml-guard.d.ts.map +1 -1
- package/dist/modules/access-model/roles-yaml-guard.js +4 -4
- package/dist/modules/access-model/roles-yaml-guard.js.map +1 -1
- package/dist/modules/agent-guide/agent-guide.d.ts +19 -14
- package/dist/modules/agent-guide/agent-guide.d.ts.map +1 -1
- package/dist/modules/agent-guide/agent-guide.js +42 -18
- package/dist/modules/agent-guide/agent-guide.js.map +1 -1
- package/dist/modules/agent-guide/guide-budget.d.ts +5 -2
- package/dist/modules/agent-guide/guide-budget.d.ts.map +1 -1
- package/dist/modules/agent-guide/guide-budget.js +6 -2
- package/dist/modules/agent-guide/guide-budget.js.map +1 -1
- package/dist/modules/agent-instructions/agent-instructions.routes.d.ts +12 -5
- package/dist/modules/agent-instructions/agent-instructions.routes.d.ts.map +1 -1
- package/dist/modules/agent-instructions/agent-instructions.routes.js +13 -6
- package/dist/modules/agent-instructions/agent-instructions.routes.js.map +1 -1
- package/dist/modules/agent-instructions/compose.d.ts +15 -8
- package/dist/modules/agent-instructions/compose.d.ts.map +1 -1
- package/dist/modules/agent-instructions/compose.js +24 -10
- package/dist/modules/agent-instructions/compose.js.map +1 -1
- package/dist/modules/agent-instructions/shared-file-rules.d.ts +14 -6
- package/dist/modules/agent-instructions/shared-file-rules.d.ts.map +1 -1
- package/dist/modules/agent-instructions/shared-file-rules.js +51 -11
- package/dist/modules/agent-instructions/shared-file-rules.js.map +1 -1
- package/dist/modules/auth/account-erasure.service.d.ts +36 -7
- package/dist/modules/auth/account-erasure.service.d.ts.map +1 -1
- package/dist/modules/auth/account-erasure.service.js +30 -10
- package/dist/modules/auth/account-erasure.service.js.map +1 -1
- package/dist/modules/auth/account-hooks.d.ts +20 -0
- package/dist/modules/auth/account-hooks.d.ts.map +1 -1
- package/dist/modules/auth/account-hooks.js +10 -0
- package/dist/modules/auth/account-hooks.js.map +1 -1
- package/dist/modules/auth/account-switch-lock.js +2 -2
- package/dist/modules/auth/account-switch-lock.js.map +1 -1
- package/dist/modules/auth/account.routes.d.ts +7 -2
- package/dist/modules/auth/account.routes.d.ts.map +1 -1
- package/dist/modules/auth/account.routes.js +23 -4
- package/dist/modules/auth/account.routes.js.map +1 -1
- package/dist/modules/auth/auth.service.d.ts +1 -1
- package/dist/modules/auth/auth.service.js +4 -4
- package/dist/modules/auth/auth.service.js.map +1 -1
- package/dist/modules/auth/index.d.ts +1 -0
- package/dist/modules/auth/index.d.ts.map +1 -1
- package/dist/modules/database/core-schema.js +2 -2
- package/dist/modules/database/core-schema.js.map +1 -1
- package/dist/modules/diff/diff.routes.d.ts +3 -3
- package/dist/modules/diff/diff.routes.d.ts.map +1 -1
- package/dist/modules/diff/diff.routes.js +7 -7
- package/dist/modules/diff/diff.routes.js.map +1 -1
- package/dist/modules/embed/embed.routes.js +1 -1
- package/dist/modules/embed/embed.routes.js.map +1 -1
- package/dist/modules/embed/embed.service.d.ts +4 -4
- package/dist/modules/embed/embed.service.d.ts.map +1 -1
- package/dist/modules/embed/embed.service.js +18 -18
- package/dist/modules/embed/embed.service.js.map +1 -1
- package/dist/modules/kb-fs/branch-name.js +8 -8
- package/dist/modules/kb-fs/branch-name.js.map +1 -1
- package/dist/modules/kb-fs/file-change-notifier.d.ts +2 -2
- package/dist/modules/kb-fs/locking-filesystem.d.ts +9 -9
- package/dist/modules/kb-fs/locking-filesystem.d.ts.map +1 -1
- package/dist/modules/kb-fs/locking-filesystem.js +27 -27
- package/dist/modules/kb-fs/locking-filesystem.js.map +1 -1
- package/dist/modules/kb-fs/repo-path.js +5 -5
- package/dist/modules/kb-fs/repo-path.js.map +1 -1
- package/dist/modules/kb-fs/tmp-ref.d.ts +2 -2
- package/dist/modules/kb-fs/tmp-ref.d.ts.map +1 -1
- package/dist/modules/kb-fs/tmp-ref.js +2 -2
- package/dist/modules/kb-fs/tmp-ref.js.map +1 -1
- package/dist/modules/kb-sync/index.d.ts +1 -1
- package/dist/modules/kb-sync/index.d.ts.map +1 -1
- package/dist/modules/kb-sync/kb-sync.interface.d.ts +3 -3
- package/dist/modules/kb-sync/kb-sync.interface.d.ts.map +1 -1
- package/dist/modules/kb-sync/kb-sync.service.d.ts +3 -3
- package/dist/modules/kb-sync/kb-sync.service.d.ts.map +1 -1
- package/dist/modules/kb-sync/kb-sync.service.js +10 -10
- package/dist/modules/kb-sync/kb-sync.service.js.map +1 -1
- package/dist/modules/mcp/mcp.service.d.ts +11 -4
- package/dist/modules/mcp/mcp.service.d.ts.map +1 -1
- package/dist/modules/mcp/mcp.service.js +75 -19
- package/dist/modules/mcp/mcp.service.js.map +1 -1
- package/dist/modules/onboarding/onboarding.contract.d.ts +1 -1
- package/dist/modules/onboarding/onboarding.routes.js +2 -2
- package/dist/modules/onboarding/onboarding.routes.js.map +1 -1
- package/dist/modules/onboarding/starter-pack.service.d.ts +4 -4
- package/dist/modules/onboarding/starter-pack.service.d.ts.map +1 -1
- package/dist/modules/onboarding/starter-pack.service.js +4 -4
- package/dist/modules/onboarding/starter-pack.service.js.map +1 -1
- package/dist/modules/plugins/join-request-jobs.service.d.ts +2 -2
- package/dist/modules/plugins/join-request-jobs.service.d.ts.map +1 -1
- package/dist/modules/plugins/join-request-jobs.service.js +7 -7
- package/dist/modules/plugins/join-request-jobs.service.js.map +1 -1
- package/dist/modules/plugins/join-requests.service.d.ts +3 -3
- package/dist/modules/plugins/join-requests.service.d.ts.map +1 -1
- package/dist/modules/plugins/join-requests.service.js +5 -5
- package/dist/modules/plugins/join-requests.service.js.map +1 -1
- package/dist/modules/plugins/plugin-rename.service.js +1 -1
- package/dist/modules/plugins/plugin-rename.service.js.map +1 -1
- package/dist/modules/plugins/plugins.routes.d.ts +2 -2
- package/dist/modules/plugins/plugins.routes.d.ts.map +1 -1
- package/dist/modules/plugins/plugins.routes.js +8 -8
- package/dist/modules/plugins/plugins.routes.js.map +1 -1
- package/dist/modules/secrets-vault/db-secrets-vault.service.d.ts +77 -2
- package/dist/modules/secrets-vault/db-secrets-vault.service.d.ts.map +1 -1
- package/dist/modules/secrets-vault/db-secrets-vault.service.js +479 -53
- package/dist/modules/secrets-vault/db-secrets-vault.service.js.map +1 -1
- package/dist/modules/secrets-vault/index.d.ts +2 -1
- package/dist/modules/secrets-vault/index.d.ts.map +1 -1
- package/dist/modules/secrets-vault/index.js +1 -0
- package/dist/modules/secrets-vault/index.js.map +1 -1
- package/dist/modules/secrets-vault/managed-sign-in-erasure.d.ts +36 -0
- package/dist/modules/secrets-vault/managed-sign-in-erasure.d.ts.map +1 -0
- package/dist/modules/secrets-vault/managed-sign-in-erasure.js +37 -0
- package/dist/modules/secrets-vault/managed-sign-in-erasure.js.map +1 -0
- package/dist/modules/secrets-vault/secrets-vault.contract.d.ts +152 -0
- package/dist/modules/secrets-vault/secrets-vault.contract.d.ts.map +1 -1
- package/dist/modules/secrets-vault/secrets-vault.contract.js.map +1 -1
- package/dist/modules/secrets-vault/secrets-vault.routes.d.ts +7 -1
- package/dist/modules/secrets-vault/secrets-vault.routes.d.ts.map +1 -1
- package/dist/modules/secrets-vault/secrets-vault.routes.js +125 -10
- package/dist/modules/secrets-vault/secrets-vault.routes.js.map +1 -1
- package/dist/modules/settings/connection-check.js +1 -1
- package/dist/modules/settings/connection-check.js.map +1 -1
- package/dist/modules/settings/deployment-settings.service.js +1 -1
- package/dist/modules/settings/git-root-folders.js +1 -1
- package/dist/modules/settings/git-root-folders.js.map +1 -1
- package/dist/modules/settings/setup.routes.d.ts +1 -1
- package/dist/modules/settings/setup.routes.js +1 -1
- package/dist/modules/skills/pending-skills.service.d.ts +3 -3
- package/dist/modules/skills/pending-skills.service.d.ts.map +1 -1
- package/dist/modules/skills/pending-skills.service.js +4 -4
- package/dist/modules/skills/pending-skills.service.js.map +1 -1
- package/dist/modules/skills/skill-access-requests.routes.d.ts +2 -2
- package/dist/modules/skills/skill-access-requests.routes.d.ts.map +1 -1
- package/dist/modules/skills/skill-access-requests.routes.js +5 -5
- package/dist/modules/skills/skill-access-requests.routes.js.map +1 -1
- package/dist/modules/tool-helpers/tool-context.d.ts +4 -4
- package/dist/modules/tool-helpers/tool-context.d.ts.map +1 -1
- package/dist/modules/tool-helpers/tool-context.js +2 -2
- package/dist/modules/tool-helpers/tool-context.js.map +1 -1
- package/dist/modules/tool-helpers/tool-handler.js +2 -2
- package/dist/modules/tool-helpers/tool-handler.js.map +1 -1
- package/dist/modules/tool-helpers/tool.contract.d.ts +4 -4
- package/dist/modules/tool-helpers/tool.contract.d.ts.map +1 -1
- package/dist/modules/tool-manuals/mcp-server-edit.service.js +1 -1
- package/dist/modules/tool-manuals/mcp-server-edit.service.js.map +1 -1
- package/dist/modules/tool-manuals/pending-tools.service.d.ts +3 -3
- package/dist/modules/tool-manuals/pending-tools.service.d.ts.map +1 -1
- package/dist/modules/tool-manuals/pending-tools.service.js +4 -4
- package/dist/modules/tool-manuals/pending-tools.service.js.map +1 -1
- package/dist/modules/tool-manuals/tool-delete.service.js +1 -1
- package/dist/modules/tool-manuals/tool-delete.service.js.map +1 -1
- package/dist/modules/tool-manuals/tool-manuals.contract.d.ts +43 -3
- package/dist/modules/tool-manuals/tool-manuals.contract.d.ts.map +1 -1
- package/dist/modules/tool-manuals/tool-manuals.service.d.ts +6 -0
- package/dist/modules/tool-manuals/tool-manuals.service.d.ts.map +1 -1
- package/dist/modules/tool-manuals/tool-manuals.service.js +51 -5
- 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 +36 -15
- package/dist/modules/tool-manuals/tool-manuals.tools.js.map +1 -1
- package/dist/modules/version-control/agent-tools/change-request-read-shape.d.ts.map +1 -0
- package/dist/modules/version-control/agent-tools/change-request-read-shape.js.map +1 -0
- package/dist/modules/version-control/agent-tools/change-request-read.tools.d.ts.map +1 -0
- package/dist/modules/{workflow → version-control}/agent-tools/change-request-read.tools.js +2 -2
- package/dist/modules/version-control/agent-tools/change-request-read.tools.js.map +1 -0
- package/dist/modules/version-control/agent-tools/change-request-summary.d.ts.map +1 -0
- package/dist/modules/version-control/agent-tools/change-request-summary.js.map +1 -0
- package/dist/modules/{workflow/agent-tools/workflow.tools.d.ts → version-control/agent-tools/version-control.tools.d.ts} +4 -4
- package/dist/modules/version-control/agent-tools/version-control.tools.d.ts.map +1 -0
- package/dist/modules/{workflow/agent-tools/workflow.tools.js → version-control/agent-tools/version-control.tools.js} +31 -31
- package/dist/modules/version-control/agent-tools/version-control.tools.js.map +1 -0
- package/dist/modules/{workflow → version-control}/change-request-hooks.d.ts +1 -1
- package/dist/modules/version-control/change-request-hooks.d.ts.map +1 -0
- package/dist/modules/version-control/change-request-hooks.js.map +1 -0
- package/dist/modules/version-control/change-request-review/approval-lock.d.ts.map +1 -0
- package/dist/modules/version-control/change-request-review/approval-lock.js.map +1 -0
- package/dist/modules/{workflow/review-workflow/review-workflow.interface.d.ts → version-control/change-request-review/change-request-review.interface.d.ts} +2 -2
- package/dist/modules/version-control/change-request-review/change-request-review.interface.d.ts.map +1 -0
- package/dist/modules/version-control/change-request-review/change-request-review.interface.js +2 -0
- package/dist/modules/version-control/change-request-review/change-request-review.interface.js.map +1 -0
- package/dist/modules/{workflow/review-workflow/review-workflow.service.d.ts → version-control/change-request-review/change-request-review.service.d.ts} +3 -3
- package/dist/modules/version-control/change-request-review/change-request-review.service.d.ts.map +1 -0
- package/dist/modules/{workflow/review-workflow/review-workflow.service.js → version-control/change-request-review/change-request-review.service.js} +26 -26
- package/dist/modules/version-control/change-request-review/change-request-review.service.js.map +1 -0
- package/dist/modules/{workflow → version-control}/event-bus.d.ts +8 -8
- package/dist/modules/version-control/event-bus.d.ts.map +1 -0
- package/dist/modules/{workflow → version-control}/event-bus.js +4 -4
- package/dist/modules/version-control/event-bus.js.map +1 -0
- package/dist/modules/{workflow → version-control}/events-delivery.d.ts +4 -4
- package/dist/modules/version-control/events-delivery.d.ts.map +1 -0
- package/dist/modules/version-control/events-delivery.js.map +1 -0
- package/dist/modules/{workflow → version-control}/events.routes.d.ts +4 -4
- package/dist/modules/version-control/events.routes.d.ts.map +1 -0
- package/dist/modules/version-control/events.routes.js.map +1 -0
- package/dist/modules/{workflow → version-control}/file-lock.service.d.ts +2 -2
- package/dist/modules/version-control/file-lock.service.d.ts.map +1 -0
- package/dist/modules/{workflow → version-control}/file-lock.service.js +6 -6
- package/dist/modules/version-control/file-lock.service.js.map +1 -0
- package/dist/modules/version-control/git/change-request-link.d.ts.map +1 -0
- package/dist/modules/version-control/git/change-request-link.js.map +1 -0
- package/dist/modules/version-control/git/git-version.d.ts.map +1 -0
- package/dist/modules/version-control/git/git-version.js.map +1 -0
- package/dist/modules/{workflow → version-control}/git/git.service.d.ts +8 -8
- package/dist/modules/version-control/git/git.service.d.ts.map +1 -0
- package/dist/modules/{workflow → version-control}/git/git.service.js +53 -53
- package/dist/modules/version-control/git/git.service.js.map +1 -0
- package/dist/modules/version-control/git/merge-commit.d.ts.map +1 -0
- package/dist/modules/version-control/git/merge-commit.js.map +1 -0
- package/dist/modules/version-control/git/node-git-runner.d.ts.map +1 -0
- package/dist/modules/{workflow → version-control}/git/node-git-runner.js +1 -1
- package/dist/modules/version-control/git/node-git-runner.js.map +1 -0
- package/dist/modules/{workflow → version-control}/git/pull-request.service.d.ts +5 -5
- package/dist/modules/version-control/git/pull-request.service.d.ts.map +1 -0
- package/dist/modules/{workflow → version-control}/git/pull-request.service.js +10 -10
- package/dist/modules/version-control/git/pull-request.service.js.map +1 -0
- package/dist/modules/{workflow → version-control}/index.d.ts +6 -5
- package/dist/modules/version-control/index.d.ts.map +1 -0
- package/dist/modules/{workflow → version-control}/index.js +3 -2
- package/dist/modules/version-control/index.js.map +1 -0
- package/dist/modules/{workflow → version-control}/pending-commits.service.d.ts +2 -2
- package/dist/modules/version-control/pending-commits.service.d.ts.map +1 -0
- package/dist/modules/{workflow → version-control}/pending-commits.service.js +2 -2
- package/dist/modules/version-control/pending-commits.service.js.map +1 -0
- package/dist/modules/{workflow → version-control}/pending-commits.worker.d.ts +5 -5
- package/dist/modules/version-control/pending-commits.worker.d.ts.map +1 -0
- package/dist/modules/{workflow → version-control}/pending-commits.worker.js +3 -3
- package/dist/modules/version-control/pending-commits.worker.js.map +1 -0
- package/dist/modules/{workflow → version-control}/read-on-branch.d.ts +2 -2
- package/dist/modules/version-control/read-on-branch.d.ts.map +1 -0
- package/dist/modules/{workflow → version-control}/read-on-branch.js +2 -2
- package/dist/modules/version-control/read-on-branch.js.map +1 -0
- package/dist/modules/version-control/recovery-bot.d.ts.map +1 -0
- package/dist/modules/version-control/recovery-bot.js.map +1 -0
- package/dist/modules/version-control/sanitize-error.d.ts.map +1 -0
- package/dist/modules/version-control/sanitize-error.js.map +1 -0
- package/dist/modules/{workflow/workflow-hooks.d.ts → version-control/version-control-hooks.d.ts} +4 -4
- package/dist/modules/version-control/version-control-hooks.d.ts.map +1 -0
- package/dist/modules/{workflow/workflow-hooks.js → version-control/version-control-hooks.js} +3 -3
- package/dist/modules/version-control/version-control-hooks.js.map +1 -0
- package/dist/modules/{workflow/workflow.routes.d.ts → version-control/version-control.routes.d.ts} +6 -5
- package/dist/modules/version-control/version-control.routes.d.ts.map +1 -0
- package/dist/modules/{workflow/workflow.routes.js → version-control/version-control.routes.js} +61 -60
- package/dist/modules/version-control/version-control.routes.js.map +1 -0
- package/dist/modules/{workflow/workflow.service.d.ts → version-control/version-control.service.d.ts} +26 -31
- package/dist/modules/version-control/version-control.service.d.ts.map +1 -0
- package/dist/modules/{workflow/workflow.service.js → version-control/version-control.service.js} +89 -94
- package/dist/modules/version-control/version-control.service.js.map +1 -0
- package/dist/modules/workspace/agent-access.gate.d.ts +5 -5
- package/dist/modules/workspace/agent-access.gate.d.ts.map +1 -1
- package/dist/modules/workspace/agent-access.gate.js +1 -1
- package/dist/modules/workspace/git-internals.middleware.d.ts +1 -1
- package/dist/modules/workspace/git-internals.middleware.js +2 -2
- package/dist/modules/workspace/kb-repository.js +1 -1
- package/dist/modules/workspace/kb-repository.js.map +1 -1
- package/dist/modules/workspace/startup/kb-git.d.ts +1 -1
- package/dist/modules/workspace/startup/kb-git.d.ts.map +1 -1
- package/dist/modules/workspace/startup/kb-git.js +1 -1
- package/dist/modules/workspace/startup/kb-git.js.map +1 -1
- package/dist/modules/workspace/startup/steps/seed-tree.d.ts +2 -2
- package/dist/modules/workspace/startup/steps/seed-tree.d.ts.map +1 -1
- package/dist/modules/workspace/startup/steps/seed-tree.js +1 -1
- package/dist/modules/workspace/startup/steps/seed-tree.js.map +1 -1
- package/dist/modules/workspace/startup/steps/template-files.step.d.ts +2 -2
- package/dist/modules/workspace/startup/steps/template-files.step.d.ts.map +1 -1
- package/dist/modules/workspace/startup/steps/template-files.step.js +2 -2
- package/dist/modules/workspace/startup/steps/template-files.step.js.map +1 -1
- package/dist/modules/workspace/startup/steps/template-source.d.ts +17 -4
- package/dist/modules/workspace/startup/steps/template-source.d.ts.map +1 -1
- package/dist/modules/workspace/startup/steps/template-source.js +8 -5
- package/dist/modules/workspace/startup/steps/template-source.js.map +1 -1
- package/dist/modules/workspace/workspace-tmp.js +3 -3
- package/dist/modules/workspace/workspace-tmp.js.map +1 -1
- package/dist/modules/workspace/workspace.routes.d.ts +4 -4
- package/dist/modules/workspace/workspace.routes.d.ts.map +1 -1
- package/dist/modules/workspace/workspace.routes.js +22 -22
- package/dist/modules/workspace/workspace.routes.js.map +1 -1
- package/dist/modules/workspace/workspace.service.d.ts +6 -6
- package/dist/modules/workspace/workspace.service.d.ts.map +1 -1
- package/dist/modules/workspace/workspace.service.js +11 -11
- 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 +15 -10
- package/dist/modules/workspace/workspace.tools.js.map +1 -1
- package/dist/shared/canonical-file-identity.d.ts +2 -2
- package/dist/shared/canonical-file-identity.js +5 -5
- package/dist/shared/canonical-file-identity.js.map +1 -1
- package/dist/shared/domain-errors.d.ts +39 -39
- package/dist/shared/domain-errors.d.ts.map +1 -1
- package/dist/shared/domain-errors.js +44 -44
- package/dist/shared/domain-errors.js.map +1 -1
- package/dist/shared/git.contract.d.ts +1 -1
- package/dist/shared/git.contract.js +1 -1
- package/dist/shared/http-errors.d.ts +3 -3
- package/dist/shared/http-errors.d.ts.map +1 -1
- package/dist/shared/http-errors.js +1 -1
- package/dist/shared/http-errors.js.map +1 -1
- package/dist/shared/pending-proposals.d.ts +3 -3
- package/dist/shared/pending-proposals.d.ts.map +1 -1
- package/dist/shared/pending-proposals.js +2 -2
- package/dist/shared/pending-proposals.js.map +1 -1
- package/dist/tenancy/static-tenant-source.js +1 -1
- package/dist/tenancy/static-tenant-source.js.map +1 -1
- package/migrations/0012_agent_audit.sql +40 -40
- package/migrations/0013_agent_identity_and_key_soft_delete.sql +29 -29
- package/migrations/meta/0012_snapshot.json +2246 -2246
- package/migrations/meta/0013_snapshot.json +2258 -2258
- package/package.json +4 -4
- package/src/__tests__/account-admin.ts +27 -0
- package/src/__tests__/hexis-catalog.ts +4 -4
- package/src/__tests__/kb-context.ts +30 -30
- package/src/__tests__/kb-layout-config.test.ts +21 -0
- package/src/__tests__/open-change-gate.ts +1 -1
- package/src/__tests__/tool-handler.ts +15 -0
- package/src/__tests__/tool-wiring.ts +10 -4
- package/src/__tests__/workspace-service.ts +1 -1
- package/src/core/__tests__/catalog-cache-invalidation.test.ts +3 -3
- package/src/core/__tests__/compose-embed.test.ts +1 -1
- package/src/core/__tests__/damaged-document.tools.test.ts +3 -3
- package/src/core/__tests__/erasure-slices-wired-once.test.ts +46 -0
- package/src/core/__tests__/gated-boot.test.ts +2 -2
- package/src/core/__tests__/lifecycle.test.ts +9 -9
- package/src/core/catalog-cache-invalidation.ts +2 -2
- package/src/core/compose-embed.ts +3 -3
- package/src/core/core-ports.ts +19 -4
- package/src/core/create-core-server.ts +39 -25
- package/src/core/create-core-services.ts +79 -63
- package/src/core/lifecycle.ts +9 -9
- package/src/core-config.ts +3 -3
- package/src/index.ts +5 -5
- package/src/modules/access/__tests__/access-control.admin-root-floor.test.ts +4 -4
- package/src/modules/access/__tests__/access-own-read-grant.test.ts +14 -14
- package/src/modules/access/__tests__/access-requests.routes.test.ts +20 -20
- package/src/modules/access/__tests__/access.routes.admins.test.ts +4 -4
- package/src/modules/access/__tests__/access.routes.batch.test.ts +4 -4
- package/src/modules/access/__tests__/access.routes.folder-governs.test.ts +6 -6
- package/src/modules/access/__tests__/access.routes.group-grant.test.ts +6 -6
- package/src/modules/access/__tests__/access.routes.overrides.test.ts +5 -5
- package/src/modules/access/__tests__/access.routes.proposal-branch.test.ts +6 -6
- package/src/modules/access/__tests__/access.routes.prospective.test.ts +3 -3
- package/src/modules/access/__tests__/access.routes.revoke.test.ts +6 -6
- package/src/modules/access/__tests__/access.routes.unknown-email.test.ts +6 -6
- package/src/modules/access/__tests__/admin-locked-commit.test.ts +6 -6
- package/src/modules/access/__tests__/admin-route-helpers.test.ts +5 -5
- package/src/modules/access/__tests__/groups-admin.service.test.ts +27 -27
- package/src/modules/access/__tests__/roles-admin.security.test.ts +14 -13
- package/src/modules/access/__tests__/roles-admin.service.test.ts +27 -27
- package/src/modules/access/__tests__/roles-capabilities.test.ts +19 -19
- package/src/modules/access/__tests__/roles.routes.test.ts +6 -6
- package/src/modules/access/__tests__/synced-groups-committer.test.ts +13 -13
- package/src/modules/access/__tests__/user-access-removal.service.test.ts +29 -29
- package/src/modules/access/access-control.service.ts +1 -1
- package/src/modules/access/access-declarations.ts +2 -2
- package/src/modules/access/access-mutation.service.ts +2 -2
- package/src/modules/access/access-requests.routes.ts +7 -7
- package/src/modules/access/access-requests.service.ts +13 -13
- package/src/modules/access/access.routes.ts +11 -11
- package/src/modules/access/admin-locked-commit.ts +11 -11
- package/src/modules/access/admin-route-helpers.ts +5 -5
- package/src/modules/access/change-read-gate.ts +1 -1
- package/src/modules/access/groups-admin.service.ts +7 -7
- package/src/modules/access/reference-scan.ts +1 -1
- package/src/modules/access/roles-admin.service.ts +9 -9
- package/src/modules/access/synced-groups-committer.ts +11 -11
- package/src/modules/access/user-access-removal.service.ts +7 -7
- package/src/modules/access-model/__tests__/access-grammar.test.ts +2 -2
- package/src/modules/access-model/access-errors.ts +4 -4
- package/src/modules/access-model/access-grammar.ts +4 -4
- package/src/modules/access-model/change-gate.ts +1 -1
- package/src/modules/access-model/roles-yaml-guard.ts +4 -4
- package/src/modules/agent-guide/__tests__/agent-guide.test.ts +19 -4
- package/src/modules/agent-guide/__tests__/agent-guide.tools.test.ts +1 -1
- package/src/modules/agent-guide/__tests__/guide-matches-code.test.ts +2 -2
- package/src/modules/agent-guide/agent-guide.ts +48 -22
- package/src/modules/agent-guide/guide-budget.ts +6 -2
- package/src/modules/agent-instructions/__tests__/agent-instructions.route.test.ts +4 -5
- package/src/modules/agent-instructions/__tests__/compose.test.ts +1 -1
- package/src/modules/agent-instructions/__tests__/shared-file-rules.test.ts +113 -7
- package/src/modules/agent-instructions/agent-instructions.routes.ts +12 -5
- package/src/modules/agent-instructions/compose.ts +24 -9
- package/src/modules/agent-instructions/shared-file-rules.ts +53 -11
- package/src/modules/agent-scope/__tests__/agent-surfaces.connect-as.test.ts +1 -1
- package/src/modules/audit/__tests__/agent-rest-audit.middleware.test.ts +113 -113
- package/src/modules/audit/__tests__/event-classifier.test.ts +121 -121
- package/src/modules/audit/event-classifier.ts +155 -155
- package/src/modules/auth/__tests__/account-deactivation.test.ts +1 -1
- package/src/modules/auth/__tests__/account-erasure.approval-gate.test.ts +4 -4
- package/src/modules/auth/__tests__/account-erasure.participants.test.ts +56 -0
- package/src/modules/auth/__tests__/account-switch-lock.pg.test.ts +2 -2
- package/src/modules/auth/__tests__/account-switch-lock.test.ts +2 -2
- package/src/modules/auth/__tests__/account.routes.test.ts +73 -11
- package/src/modules/auth/__tests__/auth.service.test.ts +1 -1
- package/src/modules/auth/account-erasure.service.ts +27 -9
- package/src/modules/auth/account-hooks.ts +34 -0
- package/src/modules/auth/account-switch-lock.ts +2 -2
- package/src/modules/auth/account.routes.ts +23 -5
- package/src/modules/auth/auth.service.ts +4 -4
- package/src/modules/auth/index.ts +1 -0
- package/src/modules/database/__tests__/advisory-lock.test.ts +169 -169
- package/src/modules/database/__tests__/migrations-unqualified.test.ts +32 -32
- package/src/modules/database/core-schema.ts +2 -2
- package/src/modules/diff/__tests__/diff.routes.read-gate.test.ts +2 -2
- package/src/modules/diff/__tests__/diff.routes.rejectPathsLocked.test.ts +12 -12
- package/src/modules/diff/diff.routes.ts +8 -8
- package/src/modules/embed/__tests__/embed.service.lock.test.ts +7 -7
- package/src/modules/embed/__tests__/embed.service.test.ts +42 -42
- package/src/modules/embed/__tests__/embed.tools.test.ts +1 -1
- package/src/modules/embed/embed.routes.ts +1 -1
- package/src/modules/embed/embed.service.ts +17 -17
- package/src/modules/kb-fs/__tests__/branch-name.test.ts +2 -2
- package/src/modules/kb-fs/__tests__/locking-filesystem.test.ts +260 -260
- package/src/modules/kb-fs/__tests__/move-with-edits.test.ts +34 -34
- package/src/modules/kb-fs/__tests__/repo-path.test.ts +8 -8
- package/src/modules/kb-fs/branch-name.ts +8 -8
- package/src/modules/kb-fs/file-change-notifier.ts +2 -2
- package/src/modules/kb-fs/locking-filesystem.ts +30 -30
- package/src/modules/kb-fs/repo-path.ts +5 -5
- package/src/modules/kb-fs/tmp-ref.ts +3 -3
- package/src/modules/kb-sync/__tests__/kb-sync.service.test.ts +36 -36
- package/src/modules/kb-sync/index.ts +1 -1
- package/src/modules/kb-sync/kb-sync.interface.ts +3 -3
- package/src/modules/kb-sync/kb-sync.service.ts +9 -9
- package/src/modules/marketplace/__tests__/github-facade.test.ts +1 -1
- package/src/modules/marketplace/__tests__/marketplace-git.test.ts +1 -1
- package/src/modules/mcp/__tests__/mcp-proxy-helpers.test.ts +4 -2
- package/src/modules/mcp/__tests__/mcp.e2e.test.ts +69 -8
- package/src/modules/mcp/__tests__/mcp.service.test.ts +91 -13
- package/src/modules/mcp/__tests__/read-only-hint.pg.test.ts +194 -0
- package/src/modules/mcp/mcp.service.ts +89 -28
- package/src/modules/onboarding/__tests__/starter-pack.service.test.ts +55 -55
- package/src/modules/onboarding/onboarding.contract.ts +1 -1
- package/src/modules/onboarding/onboarding.routes.ts +2 -2
- package/src/modules/onboarding/starter-pack.service.ts +6 -6
- package/src/modules/plugins/__tests__/bundle-dialect.e2e.test.ts +1 -1
- package/src/modules/plugins/__tests__/compile-marketplace.test.ts +1 -1
- package/src/modules/plugins/__tests__/join-request-jobs.service.test.ts +43 -43
- package/src/modules/plugins/__tests__/join-requests.service.test.ts +19 -19
- package/src/modules/plugins/__tests__/join-requests.settlement.test.ts +26 -26
- package/src/modules/plugins/__tests__/plugins.routes.test.ts +25 -25
- package/src/modules/plugins/join-request-jobs.service.ts +10 -10
- package/src/modules/plugins/join-requests.service.ts +4 -4
- package/src/modules/plugins/plugin-rename.service.ts +1 -1
- package/src/modules/plugins/plugins.routes.ts +9 -9
- package/src/modules/secrets-vault/__tests__/db-secrets-vault.managed.test.ts +773 -0
- package/src/modules/secrets-vault/__tests__/db-secrets-vault.oauth.test.ts +28 -1
- package/src/modules/secrets-vault/__tests__/managed-sign-in.route.test.ts +351 -0
- package/src/modules/secrets-vault/db-secrets-vault.service.ts +562 -95
- package/src/modules/secrets-vault/index.ts +7 -0
- package/src/modules/secrets-vault/managed-sign-in-erasure.ts +41 -0
- package/src/modules/secrets-vault/secrets-variable-loader.ts +134 -134
- package/src/modules/secrets-vault/secrets-vault.contract.ts +152 -0
- package/src/modules/secrets-vault/secrets-vault.routes.ts +157 -10
- package/src/modules/settings/__tests__/repository-source.test.ts +1 -1
- package/src/modules/settings/__tests__/setup.routes.layout-phase.test.ts +1 -1
- package/src/modules/settings/__tests__/setup.routes.managed-phase.test.ts +1 -1
- package/src/modules/settings/connection-check.ts +1 -1
- package/src/modules/settings/deployment-settings.service.ts +1 -1
- package/src/modules/settings/git-root-folders.ts +1 -1
- package/src/modules/settings/setup.routes.ts +1 -1
- package/src/modules/skills/__tests__/allowed-tools-warn.tools.test.ts +3 -3
- package/src/modules/skills/__tests__/branch-skills.tools.test.ts +1 -1
- package/src/modules/skills/__tests__/pending-skills.service.test.ts +8 -8
- package/src/modules/skills/__tests__/skill-access-requests.routes.test.ts +18 -18
- package/src/modules/skills/__tests__/skills.service.test.ts +3 -3
- package/src/modules/skills/pending-skills.service.ts +3 -3
- package/src/modules/skills/skill-access-requests.routes.ts +7 -7
- package/src/modules/tool-helpers/__tests__/agent-roles-write.test.ts +4 -4
- package/src/modules/tool-helpers/__tests__/branch-declaration.test.ts +3 -3
- package/src/modules/tool-helpers/__tests__/can-write.tools.test.ts +3 -3
- package/src/modules/tool-helpers/__tests__/phase4-tools.test.ts +4 -4
- package/src/modules/tool-helpers/__tests__/tools-surface.test.ts +3 -3
- package/src/modules/tool-helpers/__tests__/validate-token.test.ts +1 -1
- package/src/modules/tool-helpers/tool-context.ts +6 -6
- package/src/modules/tool-helpers/tool-handler.ts +2 -2
- package/src/modules/tool-helpers/tool.contract.ts +4 -4
- package/src/modules/tool-manuals/__tests__/pending-tools.service.test.ts +9 -9
- package/src/modules/tool-manuals/__tests__/tool-manuals.managed-sign-in.test.ts +89 -0
- package/src/modules/tool-manuals/__tests__/tool-manuals.restart.test.ts +1 -1
- package/src/modules/tool-manuals/__tests__/tool-manuals.tools.test.ts +36 -1
- package/src/modules/tool-manuals/mcp-server-edit.service.ts +1 -1
- package/src/modules/tool-manuals/pending-tools.service.ts +3 -3
- package/src/modules/tool-manuals/tool-delete.service.ts +1 -1
- package/src/modules/tool-manuals/tool-manuals.contract.ts +41 -3
- package/src/modules/tool-manuals/tool-manuals.service.ts +53 -5
- package/src/modules/tool-manuals/tool-manuals.tools.ts +41 -15
- package/src/modules/tool-registry/__tests__/own-tool-schemas.test.ts +4 -4
- package/src/modules/tool-registry/__tests__/read-only-hints.test.ts +3 -3
- package/src/modules/tool-registry/__tests__/tool-description-length.test.ts +6 -6
- package/src/modules/{workflow → version-control}/__tests__/apply-failure.test.ts +54 -54
- package/src/modules/{workflow → version-control}/__tests__/event-bus.test.ts +27 -27
- package/src/modules/{workflow → version-control}/__tests__/events-delivery.test.ts +37 -37
- package/src/modules/{workflow → version-control}/__tests__/file-lock.service.deletion-gate.test.ts +2 -2
- package/src/modules/{workflow → version-control}/__tests__/file-lock.service.path-identity.test.ts +8 -8
- package/src/modules/{workflow → version-control}/__tests__/merge-announces-tree.test.ts +11 -11
- package/src/modules/{workflow → version-control}/__tests__/pending-commits.worker.concurrency.test.ts +9 -9
- package/src/modules/{workflow → version-control}/__tests__/pending-commits.worker.test.ts +25 -25
- package/src/modules/{workflow → version-control}/__tests__/preserve-roles-yaml.test.ts +42 -42
- package/src/modules/version-control/__tests__/public-surface.test.ts +114 -0
- package/src/modules/{workflow/__tests__/workflow.routes.folder-proposals.test.ts → version-control/__tests__/version-control.routes.folder-proposals.test.ts} +18 -18
- package/src/modules/{workflow/__tests__/workflow.routes.fork-point-file.test.ts → version-control/__tests__/version-control.routes.fork-point-file.test.ts} +19 -19
- package/src/modules/{workflow/__tests__/workflow.routes.history-read-gate.test.ts → version-control/__tests__/version-control.routes.history-read-gate.test.ts} +13 -13
- package/src/modules/{workflow/__tests__/workflow.routes.lock-path.test.ts → version-control/__tests__/version-control.routes.lock-path.test.ts} +18 -18
- package/src/modules/{workflow/__tests__/workflow.routes.open-change-request.test.ts → version-control/__tests__/version-control.routes.open-change-request.test.ts} +7 -7
- package/src/modules/{workflow/__tests__/workflow.routes.push-refused.test.ts → version-control/__tests__/version-control.routes.push-refused.test.ts} +14 -14
- package/src/modules/{workflow/__tests__/workflow.service.branch-in-use.test.ts → version-control/__tests__/version-control.service.branch-in-use.test.ts} +6 -6
- package/src/modules/{workflow/__tests__/workflow.service.commitFileWhileLocked.test.ts → version-control/__tests__/version-control.service.commitFileWhileLocked.test.ts} +14 -14
- package/src/modules/{workflow/__tests__/workflow.service.delete-branch.test.ts → version-control/__tests__/version-control.service.delete-branch.test.ts} +14 -14
- package/src/modules/{workflow/__tests__/workflow.service.deleted-branch-sweep.test.ts → version-control/__tests__/version-control.service.deleted-branch-sweep.test.ts} +4 -4
- package/src/modules/{workflow/__tests__/workflow.service.facade.test.ts → version-control/__tests__/version-control.service.facade.test.ts} +97 -99
- package/src/modules/{workflow/__tests__/workflow.service.folder-proposals.test.ts → version-control/__tests__/version-control.service.folder-proposals.test.ts} +7 -7
- package/src/modules/{workflow/__tests__/workflow.service.platform-restore.test.ts → version-control/__tests__/version-control.service.platform-restore.test.ts} +6 -6
- package/src/modules/{workflow/__tests__/workflow.service.read-gate.test.ts → version-control/__tests__/version-control.service.read-gate.test.ts} +9 -9
- package/src/modules/{workflow/__tests__/workflow.service.releaseLock.test.ts → version-control/__tests__/version-control.service.releaseLock.test.ts} +42 -42
- package/src/modules/{workflow/__tests__/workflow.service.repository-replaced.test.ts → version-control/__tests__/version-control.service.repository-replaced.test.ts} +4 -4
- package/src/modules/{workflow/__tests__/workflow.service.sync.test.ts → version-control/__tests__/version-control.service.sync.test.ts} +17 -17
- package/src/modules/{workflow/__tests__/workflow.service.update-change-request.pg.test.ts → version-control/__tests__/version-control.service.update-change-request.pg.test.ts} +6 -6
- package/src/modules/{workflow/__tests__/workflow.service.update-change-request.test.ts → version-control/__tests__/version-control.service.update-change-request.test.ts} +11 -11
- package/src/modules/{workflow/__tests__/workflow.service.update-from-target.test.ts → version-control/__tests__/version-control.service.update-from-target.test.ts} +22 -22
- package/src/modules/{workflow → version-control}/agent-tools/__tests__/change-request-read.tools.test.ts +3 -3
- package/src/modules/{workflow → version-control}/agent-tools/__tests__/update-change-request.parity.test.ts +16 -16
- package/src/modules/{workflow/agent-tools/__tests__/workflow.tools.test.ts → version-control/agent-tools/__tests__/version-control.tools.test.ts} +9 -9
- package/src/modules/{workflow → version-control}/agent-tools/change-request-read.tools.ts +2 -2
- package/src/modules/{workflow/agent-tools/workflow.tools.ts → version-control/agent-tools/version-control.tools.ts} +30 -30
- package/src/modules/{workflow → version-control}/change-request-hooks.ts +1 -1
- package/src/modules/{workflow/review-workflow → version-control/change-request-review}/__tests__/approval-states.test.ts +5 -5
- package/src/modules/{workflow/review-workflow → version-control/change-request-review}/__tests__/cancel-pr.test.ts +8 -8
- package/src/modules/{workflow/review-workflow → version-control/change-request-review}/__tests__/carry-approvals-forward.test.ts +6 -6
- package/src/modules/{workflow/review-workflow → version-control/change-request-review}/__tests__/erase-approver.test.ts +5 -5
- package/src/modules/{workflow/review-workflow → version-control/change-request-review}/__tests__/merge-gate.test.ts +3 -3
- package/src/modules/{workflow/review-workflow → version-control/change-request-review}/__tests__/merge-records-own-commit.test.ts +3 -3
- package/src/modules/{workflow/review-workflow/review-workflow.interface.ts → version-control/change-request-review/change-request-review.interface.ts} +1 -1
- package/src/modules/{workflow/review-workflow/review-workflow.service.ts → version-control/change-request-review/change-request-review.service.ts} +28 -28
- package/src/modules/{workflow → version-control}/event-bus.ts +14 -14
- package/src/modules/{workflow → version-control}/events-delivery.ts +11 -11
- package/src/modules/{workflow → version-control}/events.routes.ts +5 -5
- package/src/modules/{workflow → version-control}/file-lock.service.ts +6 -6
- package/src/modules/{workflow → version-control}/git/__tests__/git-test-helpers.ts +3 -3
- package/src/modules/{workflow → version-control}/git/__tests__/git.service.accessGating.test.ts +5 -5
- package/src/modules/{workflow → version-control}/git/__tests__/git.service.appliedChange.test.ts +4 -4
- package/src/modules/{workflow → version-control}/git/__tests__/git.service.changedFilesForPr.test.ts +16 -16
- package/src/modules/{workflow → version-control}/git/__tests__/git.service.changedPathsMemo.test.ts +2 -2
- package/src/modules/{workflow → version-control}/git/__tests__/git.service.commitChanges.test.ts +3 -3
- package/src/modules/{workflow → version-control}/git/__tests__/git.service.commitFile.strayPath.test.ts +10 -10
- package/src/modules/{workflow → version-control}/git/__tests__/git.service.commitFile.test.ts +3 -3
- package/src/modules/{workflow → version-control}/git/__tests__/git.service.createBranch.test.ts +3 -3
- package/src/modules/{workflow → version-control}/git/__tests__/git.service.deleteBranch.test.ts +7 -7
- package/src/modules/{workflow → version-control}/git/__tests__/git.service.diffFileAtCommit.test.ts +9 -9
- package/src/modules/{workflow → version-control}/git/__tests__/git.service.diffFileBetweenBranches.test.ts +23 -23
- package/src/modules/{workflow → version-control}/git/__tests__/git.service.fileBytesAtCommit.test.ts +7 -7
- package/src/modules/{workflow → version-control}/git/__tests__/git.service.fileContentsAtCommit.test.ts +3 -3
- package/src/modules/{workflow → version-control}/git/__tests__/git.service.forkPoint.test.ts +2 -2
- package/src/modules/{workflow → version-control}/git/__tests__/git.service.history-guards.test.ts +2 -2
- package/src/modules/{workflow → version-control}/git/__tests__/git.service.list-branches.test.ts +12 -12
- package/src/modules/{workflow → version-control}/git/__tests__/git.service.listTrackedFiles.test.ts +2 -2
- package/src/modules/{workflow → version-control}/git/__tests__/git.service.logForFile.test.ts +6 -6
- package/src/modules/{workflow → version-control}/git/__tests__/git.service.mergeChangeRequest.test.ts +20 -20
- package/src/modules/{workflow → version-control}/git/__tests__/git.service.mergeIntoBranch.test.ts +16 -16
- package/src/modules/{workflow → version-control}/git/__tests__/git.service.pendingChanges.test.ts +2 -2
- package/src/modules/{workflow → version-control}/git/__tests__/git.service.postMergePull.test.ts +5 -5
- package/src/modules/{workflow → version-control}/git/__tests__/git.service.prFetchFailure.test.ts +2 -2
- package/src/modules/{workflow → version-control}/git/__tests__/git.service.pull.test.ts +12 -12
- package/src/modules/{workflow → version-control}/git/__tests__/git.service.readFileAtRef.test.ts +3 -3
- package/src/modules/{workflow → version-control}/git/__tests__/git.service.revertPathsAndPush.test.ts +2 -2
- package/src/modules/{workflow → version-control}/git/__tests__/git.service.status.test.ts +4 -4
- package/src/modules/{workflow → version-control}/git/__tests__/git.service.syncFromRemote.test.ts +8 -8
- package/src/modules/{workflow → version-control}/git/__tests__/git.service.worktrees.test.ts +4 -4
- package/src/modules/{workflow → version-control}/git/__tests__/pull-request.service.list-fetch.test.ts +2 -2
- package/src/modules/{workflow → version-control}/git/__tests__/pull-request.service.test.ts +6 -6
- package/src/modules/{workflow → version-control}/git/git.service.ts +57 -57
- package/src/modules/{workflow → version-control}/git/node-git-runner.ts +1 -1
- package/src/modules/{workflow → version-control}/git/pull-request.service.ts +12 -12
- package/src/modules/{workflow → version-control}/index.ts +6 -5
- package/src/modules/{workflow → version-control}/pending-commits.service.ts +2 -2
- package/src/modules/{workflow → version-control}/pending-commits.worker.ts +8 -8
- package/src/modules/{workflow → version-control}/read-on-branch.ts +2 -2
- package/src/modules/{workflow/workflow-hooks.ts → version-control/version-control-hooks.ts} +3 -3
- package/src/modules/{workflow/workflow.routes.ts → version-control/version-control.routes.ts} +64 -63
- package/src/modules/{workflow/workflow.service.ts → version-control/version-control.service.ts} +92 -97
- package/src/modules/workspace/__tests__/agent-access.gate.test.ts +8 -8
- package/src/modules/workspace/__tests__/agent-downloads.test.ts +13 -16
- package/src/modules/workspace/__tests__/agent-uploads.test.ts +11 -12
- package/src/modules/workspace/__tests__/escape-sequences.routes.test.ts +11 -16
- package/src/modules/workspace/__tests__/file-stat-access.test.ts +3 -3
- package/src/modules/workspace/__tests__/git-internals.security.test.ts +27 -27
- package/src/modules/workspace/__tests__/kb-repository.test.ts +1 -1
- package/src/modules/workspace/__tests__/rest-tool-arguments.test.ts +3 -3
- package/src/modules/workspace/__tests__/start-session.default-branch.test.ts +152 -0
- package/src/modules/workspace/__tests__/workspace-paths-inside-the-repo.test.ts +6 -6
- package/src/modules/workspace/__tests__/workspace-tmp.tools.test.ts +13 -14
- package/src/modules/workspace/__tests__/workspace.routes.at-ref.test.ts +6 -6
- package/src/modules/workspace/__tests__/workspace.routes.branch-errors.test.ts +4 -4
- package/src/modules/workspace/__tests__/workspace.routes.create-grant.test.ts +6 -6
- package/src/modules/workspace/__tests__/workspace.routes.delete.test.ts +8 -8
- package/src/modules/workspace/__tests__/workspace.routes.download-implies-read.test.ts +4 -4
- package/src/modules/workspace/__tests__/workspace.routes.download.test.ts +6 -6
- package/src/modules/workspace/__tests__/workspace.routes.file-writes.test.ts +6 -6
- package/src/modules/workspace/__tests__/workspace.routes.folder-zip-access.test.ts +4 -4
- package/src/modules/workspace/__tests__/workspace.routes.folders.test.ts +6 -6
- package/src/modules/workspace/__tests__/workspace.routes.move-platform-files.test.ts +7 -7
- package/src/modules/workspace/__tests__/workspace.routes.read-gate.test.ts +13 -13
- package/src/modules/workspace/__tests__/workspace.service.any-workspace-credentials.test.ts +1 -1
- package/src/modules/workspace/__tests__/workspace.service.replaced-repository.test.ts +1 -1
- package/src/modules/workspace/__tests__/workspace.service.worktrees.test.ts +1 -1
- package/src/modules/workspace/__tests__/workspace.tools.agents-file.test.ts +5 -5
- package/src/modules/workspace/__tests__/workspace.tools.branch-errors.test.ts +5 -5
- package/src/modules/workspace/__tests__/workspace.tools.test.ts +27 -27
- package/src/modules/workspace/agent-access.gate.ts +5 -5
- package/src/modules/workspace/git-internals.middleware.ts +2 -2
- package/src/modules/workspace/kb-repository.ts +1 -1
- package/src/modules/workspace/startup/__tests__/kb-startup-runner.degraded.test.ts +1 -1
- package/src/modules/workspace/startup/__tests__/kb-startup-runner.test.ts +1 -1
- package/src/modules/workspace/startup/__tests__/kb-startup-runner.worktrees.test.ts +1 -1
- package/src/modules/workspace/startup/kb-git.ts +1 -1
- package/src/modules/workspace/startup/steps/__tests__/steps.test.ts +94 -70
- package/src/modules/workspace/startup/steps/seed-tree.ts +4 -5
- package/src/modules/workspace/startup/steps/template-files.step.ts +4 -5
- package/src/modules/workspace/startup/steps/template-source.ts +21 -6
- package/src/modules/workspace/workspace-tmp.ts +4 -4
- package/src/modules/workspace/workspace.routes.ts +26 -26
- package/src/modules/workspace/workspace.service.ts +11 -11
- package/src/modules/workspace/workspace.tools.ts +17 -10
- package/src/shared/__tests__/canonical-file-identity.test.ts +5 -5
- package/src/shared/__tests__/http-errors.test.ts +4 -4
- package/src/shared/canonical-file-identity.ts +5 -5
- package/src/shared/domain-errors.ts +44 -44
- package/src/shared/git.contract.ts +1 -1
- package/src/shared/http-errors.ts +3 -3
- package/src/shared/kb-context.ts +130 -130
- package/src/shared/pending-proposals.ts +4 -4
- package/src/tenancy/__tests__/tenant-host.test.ts +372 -372
- package/src/tenancy/__tests__/tenant-runtime.test.ts +221 -221
- package/src/tenancy/__tests__/tenant-secrets.test.ts +35 -35
- package/src/tenancy/index.ts +35 -35
- package/src/tenancy/static-tenant-source.ts +1 -1
- package/src/tenancy/tenant-host.ts +261 -261
- package/src/tenancy/tenant-runtime.ts +208 -208
- package/src/tenancy/tenant-source.contract.ts +59 -59
- package/dist/modules/workflow/agent-tools/change-request-read-shape.d.ts.map +0 -1
- package/dist/modules/workflow/agent-tools/change-request-read-shape.js.map +0 -1
- package/dist/modules/workflow/agent-tools/change-request-read.tools.d.ts.map +0 -1
- package/dist/modules/workflow/agent-tools/change-request-read.tools.js.map +0 -1
- package/dist/modules/workflow/agent-tools/change-request-summary.d.ts.map +0 -1
- package/dist/modules/workflow/agent-tools/change-request-summary.js.map +0 -1
- package/dist/modules/workflow/agent-tools/workflow.tools.d.ts.map +0 -1
- package/dist/modules/workflow/agent-tools/workflow.tools.js.map +0 -1
- package/dist/modules/workflow/change-request-hooks.d.ts.map +0 -1
- package/dist/modules/workflow/change-request-hooks.js.map +0 -1
- package/dist/modules/workflow/event-bus.d.ts.map +0 -1
- package/dist/modules/workflow/event-bus.js.map +0 -1
- package/dist/modules/workflow/events-delivery.d.ts.map +0 -1
- package/dist/modules/workflow/events-delivery.js.map +0 -1
- package/dist/modules/workflow/events.routes.d.ts.map +0 -1
- package/dist/modules/workflow/events.routes.js.map +0 -1
- package/dist/modules/workflow/file-lock.service.d.ts.map +0 -1
- package/dist/modules/workflow/file-lock.service.js.map +0 -1
- package/dist/modules/workflow/git/change-request-link.d.ts.map +0 -1
- package/dist/modules/workflow/git/change-request-link.js.map +0 -1
- package/dist/modules/workflow/git/git-version.d.ts.map +0 -1
- package/dist/modules/workflow/git/git-version.js.map +0 -1
- package/dist/modules/workflow/git/git.service.d.ts.map +0 -1
- package/dist/modules/workflow/git/git.service.js.map +0 -1
- package/dist/modules/workflow/git/merge-commit.d.ts.map +0 -1
- package/dist/modules/workflow/git/merge-commit.js.map +0 -1
- package/dist/modules/workflow/git/node-git-runner.d.ts.map +0 -1
- package/dist/modules/workflow/git/node-git-runner.js.map +0 -1
- package/dist/modules/workflow/git/pull-request.service.d.ts.map +0 -1
- package/dist/modules/workflow/git/pull-request.service.js.map +0 -1
- package/dist/modules/workflow/index.d.ts.map +0 -1
- package/dist/modules/workflow/index.js.map +0 -1
- package/dist/modules/workflow/pending-commits.service.d.ts.map +0 -1
- package/dist/modules/workflow/pending-commits.service.js.map +0 -1
- package/dist/modules/workflow/pending-commits.worker.d.ts.map +0 -1
- package/dist/modules/workflow/pending-commits.worker.js.map +0 -1
- package/dist/modules/workflow/read-on-branch.d.ts.map +0 -1
- package/dist/modules/workflow/read-on-branch.js.map +0 -1
- package/dist/modules/workflow/recovery-bot.d.ts.map +0 -1
- package/dist/modules/workflow/recovery-bot.js.map +0 -1
- package/dist/modules/workflow/review-workflow/approval-lock.d.ts.map +0 -1
- package/dist/modules/workflow/review-workflow/approval-lock.js.map +0 -1
- package/dist/modules/workflow/review-workflow/review-workflow.interface.d.ts.map +0 -1
- package/dist/modules/workflow/review-workflow/review-workflow.interface.js +0 -2
- package/dist/modules/workflow/review-workflow/review-workflow.interface.js.map +0 -1
- package/dist/modules/workflow/review-workflow/review-workflow.service.d.ts.map +0 -1
- package/dist/modules/workflow/review-workflow/review-workflow.service.js.map +0 -1
- package/dist/modules/workflow/sanitize-error.d.ts.map +0 -1
- package/dist/modules/workflow/sanitize-error.js.map +0 -1
- package/dist/modules/workflow/workflow-hooks.d.ts.map +0 -1
- package/dist/modules/workflow/workflow-hooks.js.map +0 -1
- package/dist/modules/workflow/workflow.routes.d.ts.map +0 -1
- package/dist/modules/workflow/workflow.routes.js.map +0 -1
- package/dist/modules/workflow/workflow.service.d.ts.map +0 -1
- package/dist/modules/workflow/workflow.service.js.map +0 -1
- package/src/modules/mcp/__tests__/read-only-hint.e2e.test.ts +0 -213
- /package/dist/modules/{workflow → version-control}/agent-tools/change-request-read-shape.d.ts +0 -0
- /package/dist/modules/{workflow → version-control}/agent-tools/change-request-read-shape.js +0 -0
- /package/dist/modules/{workflow → version-control}/agent-tools/change-request-read.tools.d.ts +0 -0
- /package/dist/modules/{workflow → version-control}/agent-tools/change-request-summary.d.ts +0 -0
- /package/dist/modules/{workflow → version-control}/agent-tools/change-request-summary.js +0 -0
- /package/dist/modules/{workflow → version-control}/change-request-hooks.js +0 -0
- /package/dist/modules/{workflow/review-workflow → version-control/change-request-review}/approval-lock.d.ts +0 -0
- /package/dist/modules/{workflow/review-workflow → version-control/change-request-review}/approval-lock.js +0 -0
- /package/dist/modules/{workflow → version-control}/events-delivery.js +0 -0
- /package/dist/modules/{workflow → version-control}/events.routes.js +0 -0
- /package/dist/modules/{workflow → version-control}/git/change-request-link.d.ts +0 -0
- /package/dist/modules/{workflow → version-control}/git/change-request-link.js +0 -0
- /package/dist/modules/{workflow → version-control}/git/git-version.d.ts +0 -0
- /package/dist/modules/{workflow → version-control}/git/git-version.js +0 -0
- /package/dist/modules/{workflow → version-control}/git/merge-commit.d.ts +0 -0
- /package/dist/modules/{workflow → version-control}/git/merge-commit.js +0 -0
- /package/dist/modules/{workflow → version-control}/git/node-git-runner.d.ts +0 -0
- /package/dist/modules/{workflow → version-control}/recovery-bot.d.ts +0 -0
- /package/dist/modules/{workflow → version-control}/recovery-bot.js +0 -0
- /package/dist/modules/{workflow → version-control}/sanitize-error.d.ts +0 -0
- /package/dist/modules/{workflow → version-control}/sanitize-error.js +0 -0
- /package/src/modules/{workflow → version-control}/__tests__/change-request-hooks.test.ts +0 -0
- /package/src/modules/{workflow → version-control}/__tests__/fake-file-lock-db.ts +0 -0
- /package/src/modules/{workflow → version-control}/__tests__/pending-commits.canonical.test.ts +0 -0
- /package/src/modules/{workflow → version-control}/__tests__/pending-commits.enqueue-if-absent.test.ts +0 -0
- /package/src/modules/{workflow → version-control}/__tests__/pending-commits.repository-replaced.test.ts +0 -0
- /package/src/modules/{workflow → version-control}/__tests__/sanitize-error.test.ts +0 -0
- /package/src/modules/{workflow → version-control}/agent-tools/__tests__/change-request-read-shape.test.ts +0 -0
- /package/src/modules/{workflow → version-control}/agent-tools/change-request-read-shape.ts +0 -0
- /package/src/modules/{workflow → version-control}/agent-tools/change-request-summary.ts +0 -0
- /package/src/modules/{workflow/review-workflow → version-control/change-request-review}/approval-lock.ts +0 -0
- /package/src/modules/{workflow → version-control}/git/__tests__/branchAuthor.test.ts +0 -0
- /package/src/modules/{workflow → version-control}/git/__tests__/change-request-link.test.ts +0 -0
- /package/src/modules/{workflow → version-control}/git/__tests__/git-version.failure.test.ts +0 -0
- /package/src/modules/{workflow → version-control}/git/__tests__/git-version.test.ts +0 -0
- /package/src/modules/{workflow → version-control}/git/__tests__/node-git-runner.test.ts +0 -0
- /package/src/modules/{workflow → version-control}/git/__tests__/pull-request.service.getPrDetail.test.ts +0 -0
- /package/src/modules/{workflow → version-control}/git/__tests__/pull-request.service.placeholder.test.ts +0 -0
- /package/src/modules/{workflow → version-control}/git/__tests__/pull-request.service.viewer-can-cancel.test.ts +0 -0
- /package/src/modules/{workflow → version-control}/git/__tests__/pull-request.service.viewer-can-delete.test.ts +0 -0
- /package/src/modules/{workflow → version-control}/git/__tests__/pull-request.service.viewer-can-update.test.ts +0 -0
- /package/src/modules/{workflow → version-control}/git/change-request-link.ts +0 -0
- /package/src/modules/{workflow → version-control}/git/git-version.ts +0 -0
- /package/src/modules/{workflow → version-control}/git/merge-commit.ts +0 -0
- /package/src/modules/{workflow → version-control}/recovery-bot.ts +0 -0
- /package/src/modules/{workflow → version-control}/sanitize-error.ts +0 -0
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* groups-admin.routes) — one error shape, one input-coercion rule, so the two
|
|
4
4
|
* surfaces can't drift apart again.
|
|
5
5
|
*
|
|
6
|
-
* Error shape: a sub-500 `
|
|
6
|
+
* Error shape: a sub-500 `VersionControlDomainError` renders as its own status +
|
|
7
7
|
* message + payload; everything else — a raw error OR a 500-status domain
|
|
8
8
|
* error (e.g. AccessMutationService wraps unexpected raw errors in a 500
|
|
9
9
|
* AccessMutationError, message included) — is an INTERNAL error: logged
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
import type express from 'express';
|
|
16
16
|
import { logger } from '../../shared/logging.js';
|
|
17
|
-
import {
|
|
17
|
+
import { VersionControlDomainError } from '../../shared/domain-errors.js';
|
|
18
18
|
import { domainErrorBody } from '../../shared/http-errors.js';
|
|
19
19
|
|
|
20
20
|
/** One error shape for every access-family route. */
|
|
@@ -22,11 +22,11 @@ export function toHttpError(
|
|
|
22
22
|
err: unknown,
|
|
23
23
|
logTag: string,
|
|
24
24
|
): { status: number; body: Record<string, unknown> } {
|
|
25
|
-
if (err instanceof
|
|
25
|
+
if (err instanceof VersionControlDomainError && err.status < 500) {
|
|
26
26
|
return { status: err.status, body: domainErrorBody(err) };
|
|
27
27
|
}
|
|
28
28
|
logger(logTag).error('route failure:', { err });
|
|
29
|
-
const status = err instanceof
|
|
29
|
+
const status = err instanceof VersionControlDomainError ? err.status : 500;
|
|
30
30
|
return { status, body: { error: 'Internal error.' } };
|
|
31
31
|
}
|
|
32
32
|
|
|
@@ -49,7 +49,7 @@ export function requireNonEmptyString(
|
|
|
49
49
|
opts?: { trim?: boolean },
|
|
50
50
|
): string {
|
|
51
51
|
if (typeof value !== 'string' || value.trim() === '') {
|
|
52
|
-
throw new
|
|
52
|
+
throw new VersionControlDomainError(`${field} must be a non-empty string`, 400);
|
|
53
53
|
}
|
|
54
54
|
return opts?.trim ? value.trim() : value;
|
|
55
55
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Read-before-write: the gate every change passes on its way to the lock
|
|
3
|
-
* (`
|
|
3
|
+
* (`VersionControlService.acquireLock`), on every branch. Contract and rationale in
|
|
4
4
|
* `access-model/change-gate.ts`; this is the service that answers.
|
|
5
5
|
*
|
|
6
6
|
* The verdict is taken against the WORKING TREE, not `HEAD` as the write gate
|
|
@@ -28,9 +28,9 @@
|
|
|
28
28
|
*/
|
|
29
29
|
|
|
30
30
|
import { workspaceIdForBranch } from '../../shared/workspace-id.js';
|
|
31
|
-
import type {
|
|
32
|
-
import type { AuthUser, IWorkspaceService,
|
|
33
|
-
import {
|
|
31
|
+
import type { VersionControlEventBus } from '../version-control/index.js';
|
|
32
|
+
import type { AuthUser, IWorkspaceService, IVersionControlService } from '@bevel-software/platform-shared';
|
|
33
|
+
import { VersionControlDomainError } from '../../shared/domain-errors.js';
|
|
34
34
|
import type { ITreeWalker } from '../../shared/fs.contract.js';
|
|
35
35
|
import type { IAccessControl } from './access-control.interface.js';
|
|
36
36
|
import {
|
|
@@ -63,7 +63,7 @@ const ROLES_YAML = 'roles.yaml';
|
|
|
63
63
|
|
|
64
64
|
/** A group mutation that cannot proceed. `payload.kind` distinguishes the
|
|
65
65
|
* mode refusal (`'idp-mode'`) for the UI. */
|
|
66
|
-
export class GroupsAdminError extends
|
|
66
|
+
export class GroupsAdminError extends VersionControlDomainError {
|
|
67
67
|
constructor(message: string, status = 422, payload?: Record<string, unknown>) {
|
|
68
68
|
super(message, status, payload);
|
|
69
69
|
this.name = 'GroupsAdminError';
|
|
@@ -118,18 +118,18 @@ export class GroupsAdminService {
|
|
|
118
118
|
|
|
119
119
|
constructor(
|
|
120
120
|
private readonly workspaceService: IWorkspaceService,
|
|
121
|
-
private readonly
|
|
121
|
+
private readonly versionControlService: IVersionControlService,
|
|
122
122
|
private readonly accessControl: IAccessControl,
|
|
123
123
|
/** The composition root's walk — the one the resolver finds access rules with. */
|
|
124
124
|
disk: ITreeWalker,
|
|
125
125
|
private readonly kbDirName: string,
|
|
126
126
|
/** Live-binding thunk — see RolesAdminService's identical note. */
|
|
127
127
|
private readonly defaultBranchOf: () => string,
|
|
128
|
-
private readonly eventBus?:
|
|
128
|
+
private readonly eventBus?: VersionControlEventBus,
|
|
129
129
|
) {
|
|
130
130
|
this.locked = new AdminLockedCommits({
|
|
131
131
|
workspaceService,
|
|
132
|
-
|
|
132
|
+
versionControlService,
|
|
133
133
|
kbDirName,
|
|
134
134
|
defaultBranchOf,
|
|
135
135
|
makeError: (message, status, payload) => new GroupsAdminError(message, status, payload),
|
|
@@ -507,7 +507,7 @@ export function readableReferences(
|
|
|
507
507
|
const SCAN_TTL_MS = 30_000;
|
|
508
508
|
|
|
509
509
|
/**
|
|
510
|
-
* The slice of the
|
|
510
|
+
* The slice of the version-control event bus the scanner taps for cache
|
|
511
511
|
* invalidation. Structural (not the concrete class) so test doubles and the
|
|
512
512
|
* services' optional bus stay compatible.
|
|
513
513
|
*/
|
|
@@ -36,9 +36,9 @@ import { workspaceIdForBranch } from '../../shared/workspace-id.js';
|
|
|
36
36
|
import { logger } from '../../shared/logging.js';
|
|
37
37
|
|
|
38
38
|
const log = logger('roles.recover');
|
|
39
|
-
import type {
|
|
40
|
-
import type { AuthUser, IWorkspaceService,
|
|
41
|
-
import {
|
|
39
|
+
import type { VersionControlEventBus } from '../version-control/index.js';
|
|
40
|
+
import type { AuthUser, IWorkspaceService, IVersionControlService } from '@bevel-software/platform-shared';
|
|
41
|
+
import { VersionControlDomainError } from '../../shared/domain-errors.js';
|
|
42
42
|
import type { ITreeWalker } from '../../shared/fs.contract.js';
|
|
43
43
|
import type { IAccessControl } from './access-control.interface.js';
|
|
44
44
|
import {
|
|
@@ -77,7 +77,7 @@ import { AdminLockedCommits } from './admin-locked-commit.js';
|
|
|
77
77
|
import { KbReferenceScanner, readableReferences } from './reference-scan.js';
|
|
78
78
|
|
|
79
79
|
/** A mutation that cannot proceed (invariant violation, contention, not found). */
|
|
80
|
-
export class RolesAdminError extends
|
|
80
|
+
export class RolesAdminError extends VersionControlDomainError {
|
|
81
81
|
constructor(message: string, status = 422, payload?: Record<string, unknown>) {
|
|
82
82
|
super(message, status, payload);
|
|
83
83
|
this.name = 'RolesAdminError';
|
|
@@ -185,7 +185,7 @@ export class RolesAdminService {
|
|
|
185
185
|
|
|
186
186
|
constructor(
|
|
187
187
|
private readonly workspaceService: IWorkspaceService,
|
|
188
|
-
private readonly
|
|
188
|
+
private readonly versionControlService: IVersionControlService,
|
|
189
189
|
private readonly accessControl: IAccessControl,
|
|
190
190
|
/** The composition root's walk — the one the resolver finds access rules with. */
|
|
191
191
|
disk: ITreeWalker,
|
|
@@ -205,7 +205,7 @@ export class RolesAdminService {
|
|
|
205
205
|
* a roles.yaml / access.md change is an access change, and without this an
|
|
206
206
|
* open tab keeps a now-stale read verdict until a manual reload.
|
|
207
207
|
*/
|
|
208
|
-
private readonly eventBus?:
|
|
208
|
+
private readonly eventBus?: VersionControlEventBus,
|
|
209
209
|
/**
|
|
210
210
|
* This deployment's configured admins (`ADMIN_EMAIL`) — the same list the
|
|
211
211
|
* resolver treats as `deploymentOwners`, so it serves two purposes here:
|
|
@@ -218,7 +218,7 @@ export class RolesAdminService {
|
|
|
218
218
|
) {
|
|
219
219
|
this.locked = new AdminLockedCommits({
|
|
220
220
|
workspaceService,
|
|
221
|
-
|
|
221
|
+
versionControlService,
|
|
222
222
|
kbDirName,
|
|
223
223
|
defaultBranchOf,
|
|
224
224
|
makeError: (message, status, payload) => new RolesAdminError(message, status, payload),
|
|
@@ -293,7 +293,7 @@ export class RolesAdminService {
|
|
|
293
293
|
* error is status-less and would surface as 500).
|
|
294
294
|
*/
|
|
295
295
|
private async assertRolesUnlocked(workspaceId: string, actor: AuthUser): Promise<void> {
|
|
296
|
-
const held = await this.
|
|
296
|
+
const held = await this.versionControlService.getLock(
|
|
297
297
|
workspaceId,
|
|
298
298
|
this.defaultBranch,
|
|
299
299
|
`${this.kbDirName}/${ROLES_YAML}`,
|
|
@@ -422,7 +422,7 @@ export class RolesAdminService {
|
|
|
422
422
|
// the fix never reaches it). Best-effort: if origin is unreachable we fall
|
|
423
423
|
// back to the local state and still attempt the local fix.
|
|
424
424
|
try {
|
|
425
|
-
await this.
|
|
425
|
+
await this.versionControlService.resetToRemote(workspaceId, this.defaultBranch);
|
|
426
426
|
this.accessControl.invalidate(workspaceId);
|
|
427
427
|
} catch (err) {
|
|
428
428
|
log.warn('could not sync with origin before recovery; proceeding with local state:', { err });
|
|
@@ -2,14 +2,14 @@ import path from 'node:path';
|
|
|
2
2
|
import { logger } from '../../shared/logging.js';
|
|
3
3
|
|
|
4
4
|
const log = logger('directory-sync');
|
|
5
|
-
import type { AuthUser,
|
|
5
|
+
import type { AuthUser, IVersionControlService } from '@bevel-software/platform-shared';
|
|
6
6
|
import type { WorkspaceService } from '../workspace/index.js';
|
|
7
7
|
import { workspaceIdForBranch } from '../../shared/workspace-id.js';
|
|
8
8
|
import type { AccessControlService } from './access-control.service.js';
|
|
9
9
|
import { SYNCED_GROUPS_YAML } from '../access-model/index.js';
|
|
10
|
-
import type {
|
|
10
|
+
import type { VersionControlEventBus } from '../version-control/index.js';
|
|
11
11
|
import { LockingFilesystem } from '../kb-fs/index.js';
|
|
12
|
-
import { PushNeedsAgentResolutionError,
|
|
12
|
+
import { PushNeedsAgentResolutionError, VersionControlDomainError } from '../../shared/domain-errors.js';
|
|
13
13
|
import { isAbsence } from '../../shared/fs.contract.js';
|
|
14
14
|
import type { SyncedGroupsWriterDeps } from './synced-groups-writer.js';
|
|
15
15
|
|
|
@@ -27,9 +27,9 @@ import type { SyncedGroupsWriterDeps } from './synced-groups-writer.js';
|
|
|
27
27
|
*/
|
|
28
28
|
export function createSyncedGroupsCommitter(deps: {
|
|
29
29
|
workspaceService: WorkspaceService;
|
|
30
|
-
|
|
30
|
+
versionControlService: IVersionControlService;
|
|
31
31
|
accessControl: AccessControlService;
|
|
32
|
-
eventBus:
|
|
32
|
+
eventBus: VersionControlEventBus;
|
|
33
33
|
kbDirName: string;
|
|
34
34
|
bot: AuthUser;
|
|
35
35
|
/** Thunk — DEFAULT_BRANCH is a live binding that stays empty until setup. */
|
|
@@ -37,7 +37,7 @@ export function createSyncedGroupsCommitter(deps: {
|
|
|
37
37
|
}): Pick<SyncedGroupsWriterDeps, 'readCurrent' | 'persist' | 'onWritten'> {
|
|
38
38
|
const {
|
|
39
39
|
workspaceService,
|
|
40
|
-
|
|
40
|
+
versionControlService,
|
|
41
41
|
accessControl,
|
|
42
42
|
eventBus,
|
|
43
43
|
kbDirName,
|
|
@@ -77,7 +77,7 @@ export function createSyncedGroupsCommitter(deps: {
|
|
|
77
77
|
// roles admin's atomic writes use.
|
|
78
78
|
const fsys = new LockingFilesystem(
|
|
79
79
|
{ basePath, contained: true },
|
|
80
|
-
{
|
|
80
|
+
{ versionControl: versionControlService, workspaceId, branch, user: bot, kbDirName },
|
|
81
81
|
);
|
|
82
82
|
try {
|
|
83
83
|
await fsys.writeFiles(
|
|
@@ -115,19 +115,19 @@ export function createSyncedGroupsCommitter(deps: {
|
|
|
115
115
|
// an operator (or any later write on the branch) pushes it.
|
|
116
116
|
let armed = false;
|
|
117
117
|
try {
|
|
118
|
-
await
|
|
118
|
+
await versionControlService.releaseLock(workspaceId, branch, wsRelPath, bot);
|
|
119
119
|
armed = true;
|
|
120
120
|
} catch (armErr) {
|
|
121
121
|
const lockAlreadyReleased =
|
|
122
|
-
armErr instanceof
|
|
122
|
+
armErr instanceof VersionControlDomainError && armErr.payload?.kind === 'lock-not-held';
|
|
123
123
|
if (lockAlreadyReleased) {
|
|
124
124
|
try {
|
|
125
|
-
armed = await
|
|
125
|
+
armed = await versionControlService.hasQueuedCommit(workspaceId, branch, wsRelPath);
|
|
126
126
|
if (!armed) {
|
|
127
127
|
// The row may already be gone because the worker WON the
|
|
128
128
|
// race: drained it and pushed. A branch with nothing left
|
|
129
129
|
// unpushed cannot be holding our landed commit hostage.
|
|
130
|
-
armed = !(await
|
|
130
|
+
armed = !(await versionControlService.hasUnpushedCommits(workspaceId));
|
|
131
131
|
}
|
|
132
132
|
} catch (queueErr) {
|
|
133
133
|
log.warn('could not verify the pending-commit queue:', { err: queueErr });
|
|
@@ -37,9 +37,9 @@
|
|
|
37
37
|
*/
|
|
38
38
|
|
|
39
39
|
import { workspaceIdForBranch } from '../../shared/workspace-id.js';
|
|
40
|
-
import type {
|
|
41
|
-
import type { AuthUser, IWorkspaceService,
|
|
42
|
-
import { PushNeedsAgentResolutionError,
|
|
40
|
+
import type { VersionControlEventBus } from '../version-control/index.js';
|
|
41
|
+
import type { AuthUser, IWorkspaceService, IVersionControlService } from '@bevel-software/platform-shared';
|
|
42
|
+
import { PushNeedsAgentResolutionError, VersionControlDomainError } from '../../shared/domain-errors.js';
|
|
43
43
|
import type { IAccessControl } from './access-control.interface.js';
|
|
44
44
|
import {
|
|
45
45
|
ADMIN_CANONICAL,
|
|
@@ -92,7 +92,7 @@ async function mapPooled<T, R>(items: readonly T[], limit: number, fn: (item: T)
|
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
/** A removal this service refuses (guard) or cannot run. */
|
|
95
|
-
export class UserAccessRemovalError extends
|
|
95
|
+
export class UserAccessRemovalError extends VersionControlDomainError {
|
|
96
96
|
constructor(message: string, status = 422, payload?: Record<string, unknown>) {
|
|
97
97
|
super(message, status, payload);
|
|
98
98
|
this.name = 'UserAccessRemovalError';
|
|
@@ -343,7 +343,7 @@ export class UserAccessRemovalService {
|
|
|
343
343
|
|
|
344
344
|
constructor(
|
|
345
345
|
private readonly workspaceService: IWorkspaceService,
|
|
346
|
-
|
|
346
|
+
versionControlService: IVersionControlService,
|
|
347
347
|
private readonly accessControl: IAccessControl,
|
|
348
348
|
/**
|
|
349
349
|
* The resolver's own walk. NOT `workspaceService.listFiles`: that honours
|
|
@@ -354,13 +354,13 @@ export class UserAccessRemovalService {
|
|
|
354
354
|
private readonly kbDirName: string,
|
|
355
355
|
/** Live-binding thunk — DEFAULT_BRANCH stays empty until setup. */
|
|
356
356
|
private readonly defaultBranchOf: () => string,
|
|
357
|
-
private readonly eventBus?:
|
|
357
|
+
private readonly eventBus?: VersionControlEventBus,
|
|
358
358
|
/** The deployment owner(s) (`ADMIN_EMAIL`) — never removed this way. */
|
|
359
359
|
private readonly deploymentOwners: readonly string[] = [],
|
|
360
360
|
) {
|
|
361
361
|
this.locked = new AdminLockedCommits({
|
|
362
362
|
workspaceService,
|
|
363
|
-
|
|
363
|
+
versionControlService,
|
|
364
364
|
kbDirName,
|
|
365
365
|
defaultBranchOf,
|
|
366
366
|
makeError: (message, status, payload) => new UserAccessRemovalError(message, status, payload),
|
|
@@ -145,7 +145,7 @@ describe('the access-frontmatter extension set', () => {
|
|
|
145
145
|
it('throws on a malformed extension rather than skipping it', () => {
|
|
146
146
|
// A typo would otherwise leave capability-granting files ungoverned, at
|
|
147
147
|
// boot, with nothing to distinguish it from a successful registration.
|
|
148
|
-
expect(() => registerAccessFrontmatterExtensions(['
|
|
148
|
+
expect(() => registerAccessFrontmatterExtensions(['workflow'])).toThrow(/malformed/);
|
|
149
149
|
expect(() => registerAccessFrontmatterExtensions(['.two.dots'])).toThrow(/malformed/);
|
|
150
150
|
expect(() => registerAccessFrontmatterExtensions([''])).toThrow(/malformed/);
|
|
151
151
|
expect(hasAccessFrontmatterExtension('x.pipeline_typo_guard')).toBe(false);
|
|
@@ -186,7 +186,7 @@ describe('the access-frontmatter extension set', () => {
|
|
|
186
186
|
});
|
|
187
187
|
|
|
188
188
|
describe('parseOwnAccessEntries — whole-document YAML the subset parser cannot read', () => {
|
|
189
|
-
// A `.tool` / `.
|
|
189
|
+
// A `.tool` / `.workflow` / `.agent` is one `---` fenced YAML document, and
|
|
190
190
|
// real ones use folded and literal scalars and nested maps. The subset
|
|
191
191
|
// parser stops at the first such line; the verbs must still be read.
|
|
192
192
|
const doc = [
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { VersionControlDomainError } from '../../shared/domain-errors.js';
|
|
2
2
|
import { sanitizedPath } from '../../shared/printable.js';
|
|
3
3
|
|
|
4
4
|
export interface AccessDeniedDetails {
|
|
@@ -55,7 +55,7 @@ export function unreadableRefusalSentence(repoRelative: string): string {
|
|
|
55
55
|
* "you don't have permission to write to <path>; eligible: <roles + users>"
|
|
56
56
|
* without a follow-up roundtrip.
|
|
57
57
|
*/
|
|
58
|
-
export class AccessDeniedError extends
|
|
58
|
+
export class AccessDeniedError extends VersionControlDomainError {
|
|
59
59
|
readonly access: AccessDeniedDetails;
|
|
60
60
|
|
|
61
61
|
constructor(details: AccessDeniedDetails) {
|
|
@@ -89,7 +89,7 @@ export class AccessDeniedError extends WorkflowDomainError {
|
|
|
89
89
|
* 503 and the caller retries. Distinct from AccessConfigError (the config is
|
|
90
90
|
* there and wrong) and AccessDeniedError (a real permission decision).
|
|
91
91
|
*/
|
|
92
|
-
export class AccessUnreadableError extends
|
|
92
|
+
export class AccessUnreadableError extends VersionControlDomainError {
|
|
93
93
|
constructor(ref: string, relativePath: string) {
|
|
94
94
|
super(
|
|
95
95
|
`Access rules at ${ref} could not be read (git failed on ${relativePath}); nothing was decided. Try again.`,
|
|
@@ -105,7 +105,7 @@ export class AccessUnreadableError extends WorkflowDomainError {
|
|
|
105
105
|
* or malformed at runtime — distinct from AccessDeniedError because the cause
|
|
106
106
|
* is a config bug, not a permission decision.
|
|
107
107
|
*/
|
|
108
|
-
export class AccessConfigError extends
|
|
108
|
+
export class AccessConfigError extends VersionControlDomainError {
|
|
109
109
|
readonly errors: string[];
|
|
110
110
|
|
|
111
111
|
constructor(errors: string[]) {
|
|
@@ -285,8 +285,8 @@ const accessFrontmatterExtensions = new Set<string>(CORE_ACCESS_FRONTMATTER_EXTE
|
|
|
285
285
|
*/
|
|
286
286
|
export function registerAccessFrontmatterExtensions(extensions: readonly string[]): void {
|
|
287
287
|
// Validate EVERYTHING first, then apply. These registrations decide which
|
|
288
|
-
// files' edits carry enforced access grants, so a typo (`
|
|
289
|
-
// `.
|
|
288
|
+
// files' edits carry enforced access grants, so a typo (`workflow` for
|
|
289
|
+
// `.workflow`) must THROW rather than be skipped — a silent skip makes a
|
|
290
290
|
// failed registration indistinguishable from a successful one, at boot,
|
|
291
291
|
// where nobody is looking. And it must throw before the registry changes:
|
|
292
292
|
// a list that is half-applied when it throws leaves later scans governing a
|
|
@@ -295,7 +295,7 @@ export function registerAccessFrontmatterExtensions(extensions: readonly string[
|
|
|
295
295
|
const n = ext.trim().toLowerCase();
|
|
296
296
|
if (!/^\.[a-z0-9]+$/.test(n)) {
|
|
297
297
|
throw new Error(
|
|
298
|
-
`access frontmatter extension "${ext}" is malformed — expected a leading dot, e.g. ".
|
|
298
|
+
`access frontmatter extension "${ext}" is malformed — expected a leading dot, e.g. ".workflow"`,
|
|
299
299
|
);
|
|
300
300
|
}
|
|
301
301
|
return n;
|
|
@@ -313,7 +313,7 @@ export function accessFrontmatterExtensionList(): string[] {
|
|
|
313
313
|
*
|
|
314
314
|
* Case-SENSITIVE on the path, as it always was: `doc.MD` is not a node and
|
|
315
315
|
* carries no enforced grant. Registered extensions are normalized to lowercase
|
|
316
|
-
* so `.
|
|
316
|
+
* so `.Workflow` and `.workflow` register the same thing, but which FILES are
|
|
317
317
|
* governed must not change because the set became registrable — widening it to
|
|
318
318
|
* `X.MD` silently in a release would be an access-model change nobody asked
|
|
319
319
|
* for, made in a refactor.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* The contract of the READ-BEFORE-WRITE gate: nothing is created, changed or
|
|
3
3
|
* removed at a place its author cannot read. The service that answers
|
|
4
4
|
* (filesystem stats, access checks) is `modules/access/change-read-gate.ts`;
|
|
5
|
-
* this file carries only the types, so the
|
|
5
|
+
* this file carries only the types, so the version-control, kb-fs and tool modules
|
|
6
6
|
* depend on the contract and never on the access module.
|
|
7
7
|
*
|
|
8
8
|
* Why `read`, when every write already needs `write`: on a draft branch no
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
import type { FileContent } from '@mastra/core/workspace';
|
|
25
25
|
import { GROUP_REF_PREFIX, canonicalRoleName, parseRolesYaml, parseYamlSubset } from './access-grammar.js';
|
|
26
26
|
import type { GroupsIndex } from './group-files.js';
|
|
27
|
-
import {
|
|
27
|
+
import { VersionControlDomainError } from '../../shared/domain-errors.js';
|
|
28
28
|
import type { WriteValidator } from '../kb-fs/index.js';
|
|
29
29
|
|
|
30
30
|
/** Repo-relative basename of the roles file (it lives at the KB repo root). */
|
|
@@ -35,7 +35,7 @@ export const ROLES_YAML_BASENAME = 'roles.yaml';
|
|
|
35
35
|
* the edit is refused and nothing is written. Carries the parser errors so the
|
|
36
36
|
* editor / agent can show exactly what's wrong.
|
|
37
37
|
*/
|
|
38
|
-
export class RolesYamlInvalidError extends
|
|
38
|
+
export class RolesYamlInvalidError extends VersionControlDomainError {
|
|
39
39
|
readonly errors: string[];
|
|
40
40
|
constructor(errors: string[]) {
|
|
41
41
|
super(
|
|
@@ -102,7 +102,7 @@ export const NEW_ROLE_GUIDANCE =
|
|
|
102
102
|
* self-contained because a tool error reaches the agent as its message alone,
|
|
103
103
|
* and the agent relays it to its user.
|
|
104
104
|
*/
|
|
105
|
-
export class RolesYamlNewRoleError extends
|
|
105
|
+
export class RolesYamlNewRoleError extends VersionControlDomainError {
|
|
106
106
|
readonly roleNames: string[];
|
|
107
107
|
constructor(roleNames: string[]) {
|
|
108
108
|
const quoted = roleNames.map((n) => `'${n}'`).join(', ');
|
|
@@ -171,7 +171,7 @@ interface GroupEntry {
|
|
|
171
171
|
* entry with only a log warning — the role silently reaches nobody — so it is
|
|
172
172
|
* refused up front, naming each entry, in the same 422 shape as the others.
|
|
173
173
|
*/
|
|
174
|
-
export class RolesYamlUnknownGroupError extends
|
|
174
|
+
export class RolesYamlUnknownGroupError extends VersionControlDomainError {
|
|
175
175
|
readonly entries: { role: string; entry: string }[];
|
|
176
176
|
constructor(entries: { role: string; entry: string }[], sourceFile: string) {
|
|
177
177
|
const listed = entries.map((e) => `'- ${e.entry}' under role '${e.role}'`).join(', ');
|
|
@@ -43,7 +43,7 @@ describe('the guide is composed from the platform\'s sections', () => {
|
|
|
43
43
|
const sections = await coreAgentGuideSections(DEFAULT_KB_LAYOUT);
|
|
44
44
|
expect(sections.map((s) => s.id)).toEqual(CORE_SECTION_IDS);
|
|
45
45
|
const rules = sections.find((s) => s.id === WORKING_WITH_FILES_SECTION_ID)!;
|
|
46
|
-
expect(rules.body).toBe(sharedFileRulesSection(DEFAULT_KB_LAYOUT));
|
|
46
|
+
expect(rules.body).toBe(sharedFileRulesSection(DEFAULT_KB_LAYOUT, ''));
|
|
47
47
|
expect(rules.literal).toBe(true);
|
|
48
48
|
// Every section begins with its heading, so the guide reads as one document.
|
|
49
49
|
for (const s of sections) expect(s.body.startsWith('## '), s.id).toBe(true);
|
|
@@ -66,7 +66,7 @@ describe('the guide is composed from the platform\'s sections', () => {
|
|
|
66
66
|
// never passed through the renderer again: a folder literally named like a
|
|
67
67
|
// placeholder comes out as the folder it is.
|
|
68
68
|
const odd = await composeAgentGuide({ ...DEFAULT_KB_LAYOUT, knowledgeBaseDir: '{{skillsDir}}', skillsDir: 'Playbooks' });
|
|
69
|
-
expect(odd).toContain(sharedFileRulesSection({ ...DEFAULT_KB_LAYOUT, knowledgeBaseDir: '{{skillsDir}}', skillsDir: 'Playbooks' }));
|
|
69
|
+
expect(odd).toContain(sharedFileRulesSection({ ...DEFAULT_KB_LAYOUT, knowledgeBaseDir: '{{skillsDir}}', skillsDir: 'Playbooks' }, ''));
|
|
70
70
|
});
|
|
71
71
|
|
|
72
72
|
it('says it is served, not written, and names the one file it is read as', async () => {
|
|
@@ -127,7 +127,7 @@ describe('the guide is composed from the platform\'s sections', () => {
|
|
|
127
127
|
expect(section(guide, '## Words used here')).toContain('Ask the graph.');
|
|
128
128
|
expect(section(guide, '## Words used here')).not.toContain('Plugin');
|
|
129
129
|
expect(guide.trimEnd().endsWith('Nodes live under `Docs/<Ontology>/Knowledge/`.')).toBe(true);
|
|
130
|
-
expect(guide).toContain(sharedFileRulesSection({ ...DEFAULT_KB_LAYOUT, knowledgeBaseDir: 'Docs' }));
|
|
130
|
+
expect(guide).toContain(sharedFileRulesSection({ ...DEFAULT_KB_LAYOUT, knowledgeBaseDir: 'Docs' }, ''));
|
|
131
131
|
// An async hook is awaited, and the layout it is handed is the resolved one.
|
|
132
132
|
const seen: string[] = [];
|
|
133
133
|
await composeAgentGuide({ knowledgeBaseDir: ' Docs ', skillsDir: 'Skills', pluginsDir: 'Plugins' }, async (sections, layout) => {
|
|
@@ -192,6 +192,21 @@ describe('the guide is composed from the platform\'s sections', () => {
|
|
|
192
192
|
expect(guideStartText(without)).toBe(joinGuideSections(without));
|
|
193
193
|
});
|
|
194
194
|
|
|
195
|
+
it("refuses a hook that drops or empties the onboarding section, which the platform's onboard prompt points at", async () => {
|
|
196
|
+
await expect(
|
|
197
|
+
composeAgentGuide(DEFAULT_KB_LAYOUT, (sections) => sections.filter((s) => s.id !== 'onboarding')),
|
|
198
|
+
).rejects.toThrow(/dropped the "onboarding" section, which the platform's `onboard` prompt points at/);
|
|
199
|
+
await expect(
|
|
200
|
+
composeAgentGuide(DEFAULT_KB_LAYOUT, (sections) => sections.map((s) => (s.id === 'onboarding' ? { id: s.id, body: ' \n' } : s))),
|
|
201
|
+
).rejects.toThrow(/emptied the "onboarding" section/);
|
|
202
|
+
// Replacing it under the same id is the hook's right: an organisation
|
|
203
|
+
// ships its own onboarding.
|
|
204
|
+
const own = await composeAgentGuide(DEFAULT_KB_LAYOUT, (sections) =>
|
|
205
|
+
sections.map((s) => (s.id === 'onboarding' ? { id: s.id, body: '## Welcome\n\nOur own flow.' } : s)),
|
|
206
|
+
);
|
|
207
|
+
expect(own).toContain('Our own flow.');
|
|
208
|
+
});
|
|
209
|
+
|
|
195
210
|
it('refuses a hook that drops or empties the shared file rules, which every file tool points at', async () => {
|
|
196
211
|
await expect(
|
|
197
212
|
composeAgentGuide(DEFAULT_KB_LAYOUT, (sections) => sections.filter((s) => s.id !== WORKING_WITH_FILES_SECTION_ID)),
|
|
@@ -211,7 +226,7 @@ describe('the guide is composed from the platform\'s sections', () => {
|
|
|
211
226
|
{ id: WORKING_WITH_FILES_SECTION_ID, body: '' },
|
|
212
227
|
...sections,
|
|
213
228
|
]);
|
|
214
|
-
expect(twice).toContain(sharedFileRulesSection(DEFAULT_KB_LAYOUT));
|
|
229
|
+
expect(twice).toContain(sharedFileRulesSection(DEFAULT_KB_LAYOUT, ''));
|
|
215
230
|
// Replacing it under the same id is the hook's right.
|
|
216
231
|
const replaced = await composeAgentGuide(DEFAULT_KB_LAYOUT, (sections) =>
|
|
217
232
|
sections.map((s) => (s.id === WORKING_WITH_FILES_SECTION_ID ? { id: s.id, body: '## Working with files\n\nOurs.\n' } : s)),
|
|
@@ -44,7 +44,7 @@ describe('get_agent_guide', () => {
|
|
|
44
44
|
source: 'internal',
|
|
45
45
|
abortSignal: new AbortController().signal,
|
|
46
46
|
workspaceService: {} as never,
|
|
47
|
-
|
|
47
|
+
versionControlService: {} as never,
|
|
48
48
|
events: {} as never,
|
|
49
49
|
getFilesystem: async () => {
|
|
50
50
|
throw new Error('the guide reads no file');
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
HEXIS_EXTENSION_NS,
|
|
8
8
|
HEXIS_TOOLS_DIR,
|
|
9
9
|
PERSONAL_PLUGIN_PREFIX,
|
|
10
|
-
|
|
10
|
+
WORKFLOWS_DIR,
|
|
11
11
|
PLUGIN_MANIFEST_FILE,
|
|
12
12
|
PLUGIN_MCP_FILE,
|
|
13
13
|
PLUGIN_SKILLS_DIR,
|
|
@@ -217,7 +217,7 @@ describe('the guide names the folders and files kb-layout.ts defines', () => {
|
|
|
217
217
|
|
|
218
218
|
it('names the platform files and reserved folders by their defined names', async () => {
|
|
219
219
|
const guide = (await agentGuideSections(DEFAULT_KB_LAYOUT)).map((s) => s.body).join('\n');
|
|
220
|
-
for (const name of [...FIXED_PLATFORM_FILE_NAMES, GROUPS_YAML, SYNCED_GROUPS_YAML, PREAMBLE_FILE, BUNDLE_FILE, DATA_DIR, AGENTS_DIR,
|
|
220
|
+
for (const name of [...FIXED_PLATFORM_FILE_NAMES, GROUPS_YAML, SYNCED_GROUPS_YAML, PREAMBLE_FILE, BUNDLE_FILE, DATA_DIR, AGENTS_DIR, WORKFLOWS_DIR]) {
|
|
221
221
|
expect(guide, name).toContain(name);
|
|
222
222
|
}
|
|
223
223
|
// A lowercase `.yaml` or `.json` file the guide names is one of the
|
|
@@ -41,6 +41,7 @@ import {
|
|
|
41
41
|
resolveKbLayout,
|
|
42
42
|
type KbLayout,
|
|
43
43
|
} from '@bevel-software/platform-shared';
|
|
44
|
+
import { ONBOARDING_GUIDE_SECTION_ID } from '@bevel-software/platform-mcp-core';
|
|
44
45
|
import { agentGuideDir } from '../../assets.js';
|
|
45
46
|
import { sharedFileRulesSection } from '../agent-instructions/index.js';
|
|
46
47
|
|
|
@@ -93,6 +94,19 @@ export type AgentGuideReader = () => Promise<string>;
|
|
|
93
94
|
/** The computed section: the rules every file tool shares. */
|
|
94
95
|
export const WORKING_WITH_FILES_SECTION_ID = 'working-with-files';
|
|
95
96
|
|
|
97
|
+
/**
|
|
98
|
+
* The sections a hook may neither drop nor empty, because something outside
|
|
99
|
+
* the guide points an agent at them by id (see `composeAgentGuide`).
|
|
100
|
+
*/
|
|
101
|
+
const REQUIRED_SECTIONS: readonly { id: string; pointedAtBy: string; content: string }[] = Object.freeze([
|
|
102
|
+
{ id: WORKING_WITH_FILES_SECTION_ID, pointedAtBy: 'which every file tool points at', content: 'the rules' },
|
|
103
|
+
{
|
|
104
|
+
id: ONBOARDING_GUIDE_SECTION_ID,
|
|
105
|
+
pointedAtBy: "which the platform's `onboard` prompt points at",
|
|
106
|
+
content: 'an onboarding flow',
|
|
107
|
+
},
|
|
108
|
+
]);
|
|
109
|
+
|
|
96
110
|
/**
|
|
97
111
|
* What to do on a knowledge base nobody has written in yet: the section the
|
|
98
112
|
* `firstRun` note `start_session` answers with points at (see
|
|
@@ -116,6 +130,8 @@ export const WHOLE_GUIDE_SECTION = 'all';
|
|
|
116
130
|
*/
|
|
117
131
|
export const CORE_SECTION_IDS: readonly string[] = Object.freeze([
|
|
118
132
|
START_HERE_SECTION_ID,
|
|
133
|
+
// Named in mcp-core, where the platform's `/onboard` prompt points at it.
|
|
134
|
+
ONBOARDING_GUIDE_SECTION_ID,
|
|
119
135
|
'how-agents-find-things',
|
|
120
136
|
'for-git-users',
|
|
121
137
|
'glossary',
|
|
@@ -174,9 +190,10 @@ async function readCoreSectionFiles(): Promise<ReadonlyMap<string, string>> {
|
|
|
174
190
|
/**
|
|
175
191
|
* Core's sections for `layout`: the files, placeholders unrendered, with the
|
|
176
192
|
* shared-rules section computed and in its place. What a distribution's hook
|
|
177
|
-
* is handed.
|
|
193
|
+
* is handed. `defaultBranch` is the branch the shared rules name (see
|
|
194
|
+
* {@link AgentGuideContext.defaultBranch}).
|
|
178
195
|
*/
|
|
179
|
-
export async function coreAgentGuideSections(layout: KbLayout): Promise<AgentGuideSection[]> {
|
|
196
|
+
export async function coreAgentGuideSections(layout: KbLayout, defaultBranch = ''): Promise<AgentGuideSection[]> {
|
|
180
197
|
coreSectionFiles ??= readCoreSectionFiles();
|
|
181
198
|
let files: ReadonlyMap<string, string>;
|
|
182
199
|
try {
|
|
@@ -188,7 +205,7 @@ export async function coreAgentGuideSections(layout: KbLayout): Promise<AgentGui
|
|
|
188
205
|
}
|
|
189
206
|
return CORE_SECTION_IDS.map((id) =>
|
|
190
207
|
id === WORKING_WITH_FILES_SECTION_ID
|
|
191
|
-
? { id, body: sharedFileRulesSection(layout), literal: true }
|
|
208
|
+
? { id, body: sharedFileRulesSection(layout, defaultBranch), literal: true }
|
|
192
209
|
: { id, body: files.get(id)! },
|
|
193
210
|
);
|
|
194
211
|
}
|
|
@@ -205,8 +222,9 @@ export interface AgentGuideContext {
|
|
|
205
222
|
/**
|
|
206
223
|
* The knowledge base's default branch, rendered into `{{defaultBranch}}` so
|
|
207
224
|
* the start section names the branch every file tool's `branch` takes for
|
|
208
|
-
* what is live
|
|
209
|
-
*
|
|
225
|
+
* what is live, and named by the shared file rules in the same sentence the
|
|
226
|
+
* MCP handshake carries. Read when the guide is composed: a fresh deployment
|
|
227
|
+
* gets its branch model from the setup screen after the services are built.
|
|
210
228
|
*/
|
|
211
229
|
defaultBranch?: string;
|
|
212
230
|
}
|
|
@@ -239,16 +257,19 @@ export type AgentGuideSectionsReader = () => Promise<RenderedGuideSection[]>;
|
|
|
239
257
|
* its own under the same id, beside core's or in its place: of two sections
|
|
240
258
|
* under one id the LAST is served, where the FIRST stood, so a distribution
|
|
241
259
|
* overrides core's `start-here` or `html-views` by adding its own and the
|
|
242
|
-
* guide keeps its order (see {@link oneSectionPerId}).
|
|
243
|
-
*
|
|
244
|
-
*
|
|
245
|
-
*
|
|
246
|
-
*
|
|
247
|
-
*
|
|
248
|
-
*
|
|
249
|
-
*
|
|
250
|
-
*
|
|
251
|
-
* empty
|
|
260
|
+
* guide keeps its order (see {@link oneSectionPerId}). TWO exceptions, the
|
|
261
|
+
* sections something outside the guide points an agent at by id
|
|
262
|
+
* (`REQUIRED_SECTIONS`): the shared file rules
|
|
263
|
+
* ({@link WORKING_WITH_FILES_SECTION_ID}), which every file tool names — a
|
|
264
|
+
* client that drops the handshake instructions has the guide as the only
|
|
265
|
+
* place to read them — and the onboarding section
|
|
266
|
+
* ({@link ONBOARDING_GUIDE_SECTION_ID}), which the platform's `onboard`
|
|
267
|
+
* prompt sends an agent to. Each must come back WITH TEXT IN IT, as core's
|
|
268
|
+
* or as the hook's own replacement. A hook that drops one, or hands it back
|
|
269
|
+
* empty, is a composition error, thrown rather than served. Judged on what
|
|
270
|
+
* would be SERVED — the rendered, trimmed body — so a replacement of
|
|
271
|
+
* whitespace is caught like a missing one, rather than passing the check and
|
|
272
|
+
* vanishing with the other empty sections below.
|
|
252
273
|
*/
|
|
253
274
|
export async function agentGuideSections(
|
|
254
275
|
layout: KbLayout,
|
|
@@ -256,7 +277,7 @@ export async function agentGuideSections(
|
|
|
256
277
|
context: AgentGuideContext = {},
|
|
257
278
|
): Promise<RenderedGuideSection[]> {
|
|
258
279
|
const resolved = resolveKbLayout(layout);
|
|
259
|
-
const core = await coreAgentGuideSections(resolved);
|
|
280
|
+
const core = await coreAgentGuideSections(resolved, context.defaultBranch);
|
|
260
281
|
const sections = withRoutes(oneSectionPerId(hook ? await hook(core, resolved) : core));
|
|
261
282
|
const kbDirName = context.kbDirName?.trim() || DEFAULT_KB_DIR_NAME;
|
|
262
283
|
const defaultBranch = context.defaultBranch?.trim() || UNCONFIGURED_DEFAULT_BRANCH;
|
|
@@ -276,12 +297,17 @@ export async function agentGuideSections(
|
|
|
276
297
|
// One section per id by now (`oneSectionPerId`), so a hook's own version
|
|
277
298
|
// of the rules is what is judged, on what survives the empty-body filter
|
|
278
299
|
// below.
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
)
|
|
300
|
+
// Two sections something outside the guide points at, so a hook may not
|
|
301
|
+
// take them away: the file tools name the rules, and the platform's
|
|
302
|
+
// `onboard` prompt sends an agent to the onboarding section by id.
|
|
303
|
+
for (const required of REQUIRED_SECTIONS) {
|
|
304
|
+
const found = rendered.filter((section) => section.id === required.id);
|
|
305
|
+
if (!found.some((section) => section.body.length > 0)) {
|
|
306
|
+
throw new Error(
|
|
307
|
+
`The agent guide hook ${found.length === 0 ? 'dropped' : 'emptied'} the "${required.id}" ` +
|
|
308
|
+
`section, ${required.pointedAtBy}. Keep it, or replace it under the same id with ${required.content} in it.`,
|
|
309
|
+
);
|
|
310
|
+
}
|
|
285
311
|
}
|
|
286
312
|
return rendered.filter((section) => section.body.length > 0);
|
|
287
313
|
}
|