@bevel-software/platform-core-backend 0.25.2 → 0.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/agent-guide/access-control.md +251 -0
- package/agent-guide/conventions.md +35 -0
- package/agent-guide/directory-structure.md +145 -0
- package/agent-guide/finding-things.md +7 -0
- package/agent-guide/html-views.md +83 -0
- package/agent-guide/introduction.md +27 -0
- package/agent-guide/new-knowledge-base.md +24 -0
- package/agent-guide/skills.md +47 -0
- package/agent-guide/tool-manuals.md +227 -0
- package/agent-guide/where-a-new-file-goes.md +36 -0
- package/dist/assets.d.ts +26 -0
- package/dist/assets.d.ts.map +1 -1
- package/dist/assets.js +35 -2
- package/dist/assets.js.map +1 -1
- package/dist/core/catalog-revision.d.ts +19 -1
- package/dist/core/catalog-revision.d.ts.map +1 -1
- package/dist/core/catalog-revision.js +14 -3
- package/dist/core/catalog-revision.js.map +1 -1
- package/dist/core/core-ports.d.ts +11 -0
- package/dist/core/core-ports.d.ts.map +1 -1
- package/dist/core/core-ports.js.map +1 -1
- package/dist/core/create-core-server.d.ts +5 -0
- package/dist/core/create-core-server.d.ts.map +1 -1
- package/dist/core/create-core-server.js +65 -3
- package/dist/core/create-core-server.js.map +1 -1
- package/dist/core/create-core-services.d.ts +35 -0
- package/dist/core/create-core-services.d.ts.map +1 -1
- package/dist/core/create-core-services.js +114 -12
- package/dist/core/create-core-services.js.map +1 -1
- package/dist/core/lifecycle.d.ts +16 -1
- package/dist/core/lifecycle.d.ts.map +1 -1
- package/dist/core/lifecycle.js +18 -1
- package/dist/core/lifecycle.js.map +1 -1
- package/dist/core-config.d.ts +21 -0
- package/dist/core-config.d.ts.map +1 -1
- package/dist/core-config.js +22 -1
- package/dist/core-config.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/modules/access/access-control.interface.d.ts +17 -0
- package/dist/modules/access/access-control.interface.d.ts.map +1 -1
- package/dist/modules/access/access-control.service.d.ts +2 -0
- package/dist/modules/access/access-control.service.d.ts.map +1 -1
- package/dist/modules/access/access-control.service.js +27 -0
- package/dist/modules/access/access-control.service.js.map +1 -1
- package/dist/modules/access/directory-sync-bot.js +1 -1
- package/dist/modules/access/directory-sync-bot.js.map +1 -1
- package/dist/modules/agent-guide/agent-guide.d.ts +145 -0
- package/dist/modules/agent-guide/agent-guide.d.ts.map +1 -0
- package/dist/modules/agent-guide/agent-guide.js +199 -0
- package/dist/modules/agent-guide/agent-guide.js.map +1 -0
- package/dist/modules/agent-guide/agent-guide.tools.d.ts +24 -0
- package/dist/modules/agent-guide/agent-guide.tools.d.ts.map +1 -0
- package/dist/modules/agent-guide/agent-guide.tools.js +100 -0
- package/dist/modules/agent-guide/agent-guide.tools.js.map +1 -0
- package/dist/modules/agent-guide/index.d.ts +4 -0
- package/dist/modules/agent-guide/index.d.ts.map +1 -0
- package/dist/modules/agent-guide/index.js +4 -0
- package/dist/modules/agent-guide/index.js.map +1 -0
- package/dist/modules/agent-instructions/agent-instructions.routes.d.ts +3 -2
- package/dist/modules/agent-instructions/agent-instructions.routes.d.ts.map +1 -1
- package/dist/modules/agent-instructions/agent-instructions.routes.js +3 -2
- package/dist/modules/agent-instructions/agent-instructions.routes.js.map +1 -1
- package/dist/modules/agent-instructions/compose.d.ts +14 -6
- package/dist/modules/agent-instructions/compose.d.ts.map +1 -1
- package/dist/modules/agent-instructions/compose.js +28 -8
- package/dist/modules/agent-instructions/compose.js.map +1 -1
- package/dist/modules/agent-instructions/index.d.ts +1 -1
- package/dist/modules/agent-instructions/index.d.ts.map +1 -1
- package/dist/modules/agent-instructions/index.js +1 -1
- package/dist/modules/agent-instructions/index.js.map +1 -1
- package/dist/modules/agent-instructions/shared-file-rules.d.ts +10 -50
- package/dist/modules/agent-instructions/shared-file-rules.d.ts.map +1 -1
- package/dist/modules/agent-instructions/shared-file-rules.js +51 -104
- package/dist/modules/agent-instructions/shared-file-rules.js.map +1 -1
- package/dist/modules/audit/agent-audit.service.d.ts +21 -2
- package/dist/modules/audit/agent-audit.service.d.ts.map +1 -1
- package/dist/modules/audit/agent-audit.service.js +43 -2
- package/dist/modules/audit/agent-audit.service.js.map +1 -1
- package/dist/modules/audit/agent-connection.routes.d.ts +34 -0
- package/dist/modules/audit/agent-connection.routes.d.ts.map +1 -0
- package/dist/modules/audit/agent-connection.routes.js +38 -0
- package/dist/modules/audit/agent-connection.routes.js.map +1 -0
- package/dist/modules/audit/audit.contract.d.ts +24 -0
- package/dist/modules/audit/audit.contract.d.ts.map +1 -1
- package/dist/modules/audit/audit.contract.js.map +1 -1
- package/dist/modules/audit/index.d.ts +1 -0
- package/dist/modules/audit/index.d.ts.map +1 -1
- package/dist/modules/audit/index.js +1 -0
- package/dist/modules/audit/index.js.map +1 -1
- package/dist/modules/auth/account.routes.d.ts.map +1 -1
- package/dist/modules/auth/account.routes.js +10 -3
- package/dist/modules/auth/account.routes.js.map +1 -1
- package/dist/modules/auth/auth.middleware.d.ts +7 -0
- package/dist/modules/auth/auth.middleware.d.ts.map +1 -1
- package/dist/modules/auth/auth.middleware.js +1 -1
- package/dist/modules/auth/auth.middleware.js.map +1 -1
- package/dist/modules/code-mode/code-mode.tool.d.ts.map +1 -1
- package/dist/modules/code-mode/code-mode.tool.js +11 -3
- package/dist/modules/code-mode/code-mode.tool.js.map +1 -1
- package/dist/modules/database/core-schema.d.ts +96 -0
- package/dist/modules/database/core-schema.d.ts.map +1 -1
- package/dist/modules/database/core-schema.js +32 -3
- package/dist/modules/database/core-schema.js.map +1 -1
- package/dist/modules/embed/account-link.service.d.ts +42 -0
- package/dist/modules/embed/account-link.service.d.ts.map +1 -0
- package/dist/modules/embed/account-link.service.js +50 -0
- package/dist/modules/embed/account-link.service.js.map +1 -0
- package/dist/modules/embed/embed-link.d.ts +58 -0
- package/dist/modules/embed/embed-link.d.ts.map +1 -0
- package/dist/modules/embed/embed-link.js +160 -0
- package/dist/modules/embed/embed-link.js.map +1 -0
- package/dist/modules/embed/embed.errors.d.ts +30 -0
- package/dist/modules/embed/embed.errors.d.ts.map +1 -0
- package/dist/modules/embed/embed.errors.js +42 -0
- package/dist/modules/embed/embed.errors.js.map +1 -0
- package/dist/modules/embed/embed.interface.d.ts +204 -0
- package/dist/modules/embed/embed.interface.d.ts.map +1 -0
- package/dist/modules/embed/embed.interface.js +2 -0
- package/dist/modules/embed/embed.interface.js.map +1 -0
- package/dist/modules/embed/embed.routes.d.ts +59 -0
- package/dist/modules/embed/embed.routes.d.ts.map +1 -0
- package/dist/modules/embed/embed.routes.js +343 -0
- package/dist/modules/embed/embed.routes.js.map +1 -0
- package/dist/modules/embed/embed.service.d.ts +169 -0
- package/dist/modules/embed/embed.service.d.ts.map +1 -0
- package/dist/modules/embed/embed.service.js +627 -0
- package/dist/modules/embed/embed.service.js.map +1 -0
- package/dist/modules/embed/embed.tools.d.ts +51 -0
- package/dist/modules/embed/embed.tools.d.ts.map +1 -0
- package/dist/modules/embed/embed.tools.js +170 -0
- package/dist/modules/embed/embed.tools.js.map +1 -0
- package/dist/modules/embed/mcp-app.d.ts +64 -0
- package/dist/modules/embed/mcp-app.d.ts.map +1 -0
- package/dist/modules/embed/mcp-app.js +147 -0
- package/dist/modules/embed/mcp-app.js.map +1 -0
- package/dist/modules/embed/mcp-app.routes.d.ts +21 -0
- package/dist/modules/embed/mcp-app.routes.d.ts.map +1 -0
- package/dist/modules/embed/mcp-app.routes.js +36 -0
- package/dist/modules/embed/mcp-app.routes.js.map +1 -0
- package/dist/modules/github-app/github-app.connection.d.ts +15 -0
- package/dist/modules/github-app/github-app.connection.d.ts.map +1 -1
- package/dist/modules/github-app/github-app.connection.js +34 -3
- package/dist/modules/github-app/github-app.connection.js.map +1 -1
- package/dist/modules/kb-fs/locking-filesystem.d.ts +65 -0
- package/dist/modules/kb-fs/locking-filesystem.d.ts.map +1 -1
- package/dist/modules/kb-fs/locking-filesystem.js +300 -0
- package/dist/modules/kb-fs/locking-filesystem.js.map +1 -1
- package/dist/modules/kb-sync/kb-sync.interface.d.ts +5 -0
- package/dist/modules/kb-sync/kb-sync.interface.d.ts.map +1 -1
- package/dist/modules/kb-sync/kb-sync.service.d.ts.map +1 -1
- package/dist/modules/kb-sync/kb-sync.service.js +6 -0
- package/dist/modules/kb-sync/kb-sync.service.js.map +1 -1
- package/dist/modules/mcp/mcp-auth.middleware.d.ts.map +1 -1
- package/dist/modules/mcp/mcp-auth.middleware.js +2 -1
- package/dist/modules/mcp/mcp-auth.middleware.js.map +1 -1
- package/dist/modules/mcp/mcp.service.d.ts +57 -3
- package/dist/modules/mcp/mcp.service.d.ts.map +1 -1
- package/dist/modules/mcp/mcp.service.js +177 -24
- package/dist/modules/mcp/mcp.service.js.map +1 -1
- package/dist/modules/mcp/oauth/bevel-oauth-provider.d.ts +24 -0
- package/dist/modules/mcp/oauth/bevel-oauth-provider.d.ts.map +1 -1
- package/dist/modules/mcp/oauth/bevel-oauth-provider.js +32 -4
- package/dist/modules/mcp/oauth/bevel-oauth-provider.js.map +1 -1
- package/dist/modules/mcp/tool-schema-guard.d.ts +105 -0
- package/dist/modules/mcp/tool-schema-guard.d.ts.map +1 -0
- package/dist/modules/mcp/tool-schema-guard.js +171 -0
- package/dist/modules/mcp/tool-schema-guard.js.map +1 -0
- package/dist/modules/onboarding/onboarding.contract.d.ts +80 -0
- package/dist/modules/onboarding/onboarding.contract.d.ts.map +1 -0
- package/dist/modules/onboarding/onboarding.contract.js +7 -0
- package/dist/modules/onboarding/onboarding.contract.js.map +1 -0
- package/dist/modules/onboarding/onboarding.routes.d.ts +18 -0
- package/dist/modules/onboarding/onboarding.routes.d.ts.map +1 -0
- package/dist/modules/onboarding/onboarding.routes.js +81 -0
- package/dist/modules/onboarding/onboarding.routes.js.map +1 -0
- package/dist/modules/onboarding/starter-pack.service.d.ts +213 -0
- package/dist/modules/onboarding/starter-pack.service.d.ts.map +1 -0
- package/dist/modules/onboarding/starter-pack.service.js +492 -0
- package/dist/modules/onboarding/starter-pack.service.js.map +1 -0
- package/dist/modules/onboarding/starter-packs.d.ts +78 -0
- package/dist/modules/onboarding/starter-packs.d.ts.map +1 -0
- package/dist/modules/onboarding/starter-packs.js +156 -0
- package/dist/modules/onboarding/starter-packs.js.map +1 -0
- package/dist/modules/plugins/index.d.ts +1 -1
- package/dist/modules/plugins/index.d.ts.map +1 -1
- package/dist/modules/plugins/index.js +1 -1
- package/dist/modules/plugins/index.js.map +1 -1
- package/dist/modules/plugins/plugin-provision.service.d.ts +19 -0
- package/dist/modules/plugins/plugin-provision.service.d.ts.map +1 -1
- package/dist/modules/plugins/plugin-provision.service.js +18 -1
- package/dist/modules/plugins/plugin-provision.service.js.map +1 -1
- package/dist/modules/plugins/plugins.routes.d.ts +0 -36
- package/dist/modules/plugins/plugins.routes.d.ts.map +1 -1
- package/dist/modules/plugins/plugins.routes.js +31 -0
- package/dist/modules/plugins/plugins.routes.js.map +1 -1
- package/dist/modules/plugins/plugins.tools.d.ts +36 -2
- package/dist/modules/plugins/plugins.tools.d.ts.map +1 -1
- package/dist/modules/plugins/plugins.tools.js +71 -14
- package/dist/modules/plugins/plugins.tools.js.map +1 -1
- package/dist/modules/settings/deployment-settings.service.d.ts +34 -7
- package/dist/modules/settings/deployment-settings.service.d.ts.map +1 -1
- package/dist/modules/settings/deployment-settings.service.js +148 -54
- package/dist/modules/settings/deployment-settings.service.js.map +1 -1
- package/dist/modules/settings/repository-source.d.ts +1 -0
- package/dist/modules/settings/repository-source.d.ts.map +1 -1
- package/dist/modules/settings/repository-source.js +3 -3
- package/dist/modules/settings/repository-source.js.map +1 -1
- package/dist/modules/settings/setup.routes.d.ts.map +1 -1
- package/dist/modules/settings/setup.routes.js +3 -6
- package/dist/modules/settings/setup.routes.js.map +1 -1
- package/dist/modules/skills/skills.tools.d.ts.map +1 -1
- package/dist/modules/skills/skills.tools.js +103 -43
- package/dist/modules/skills/skills.tools.js.map +1 -1
- package/dist/modules/tool-auth/connection-key-rejection.d.ts +10 -1
- package/dist/modules/tool-auth/connection-key-rejection.d.ts.map +1 -1
- package/dist/modules/tool-auth/connection-key-rejection.js +11 -3
- package/dist/modules/tool-auth/connection-key-rejection.js.map +1 -1
- package/dist/modules/tool-auth/external-api-key.interface.d.ts +8 -0
- package/dist/modules/tool-auth/external-api-key.interface.d.ts.map +1 -1
- package/dist/modules/tool-auth/external-api-key.service.d.ts +24 -2
- package/dist/modules/tool-auth/external-api-key.service.d.ts.map +1 -1
- package/dist/modules/tool-auth/external-api-key.service.js +59 -2
- package/dist/modules/tool-auth/external-api-key.service.js.map +1 -1
- package/dist/modules/tool-auth/tool-auth.middleware.d.ts.map +1 -1
- package/dist/modules/tool-auth/tool-auth.middleware.js +9 -4
- package/dist/modules/tool-auth/tool-auth.middleware.js.map +1 -1
- package/dist/modules/tool-helpers/index.d.ts +28 -1
- package/dist/modules/tool-helpers/index.d.ts.map +1 -1
- package/dist/modules/tool-helpers/index.js +28 -1
- package/dist/modules/tool-helpers/index.js.map +1 -1
- package/dist/modules/tool-helpers/route-argument-check.d.ts +10 -0
- package/dist/modules/tool-helpers/route-argument-check.d.ts.map +1 -0
- package/dist/modules/tool-helpers/route-argument-check.js +132 -0
- package/dist/modules/tool-helpers/route-argument-check.js.map +1 -0
- package/dist/modules/tool-helpers/route-tool-schemas.d.ts +89 -0
- package/dist/modules/tool-helpers/route-tool-schemas.d.ts.map +1 -0
- package/dist/modules/tool-helpers/route-tool-schemas.js +113 -0
- package/dist/modules/tool-helpers/route-tool-schemas.js.map +1 -0
- package/dist/modules/tool-helpers/tool-def.d.ts +71 -0
- package/dist/modules/tool-helpers/tool-def.d.ts.map +1 -1
- package/dist/modules/tool-helpers/tool-def.js +70 -6
- package/dist/modules/tool-helpers/tool-def.js.map +1 -1
- package/dist/modules/tool-helpers/tool-handler.d.ts +46 -6
- package/dist/modules/tool-helpers/tool-handler.d.ts.map +1 -1
- package/dist/modules/tool-helpers/tool-handler.js +157 -8
- package/dist/modules/tool-helpers/tool-handler.js.map +1 -1
- package/dist/modules/tool-helpers/tool.contract.d.ts +9 -0
- package/dist/modules/tool-helpers/tool.contract.d.ts.map +1 -1
- package/dist/modules/tool-helpers/tool.contract.js.map +1 -1
- package/dist/modules/tool-manuals/tool-manuals.contract.d.ts +23 -4
- package/dist/modules/tool-manuals/tool-manuals.contract.d.ts.map +1 -1
- package/dist/modules/tool-manuals/tool-manuals.contract.js.map +1 -1
- package/dist/modules/tool-manuals/tool-manuals.service.d.ts +4 -0
- package/dist/modules/tool-manuals/tool-manuals.service.d.ts.map +1 -1
- package/dist/modules/tool-manuals/tool-manuals.service.js +14 -0
- package/dist/modules/tool-manuals/tool-manuals.service.js.map +1 -1
- package/dist/modules/tool-manuals/tool-manuals.tools.d.ts +7 -0
- package/dist/modules/tool-manuals/tool-manuals.tools.d.ts.map +1 -1
- package/dist/modules/tool-manuals/tool-manuals.tools.js +77 -38
- package/dist/modules/tool-manuals/tool-manuals.tools.js.map +1 -1
- package/dist/modules/tool-registry/description-length.d.ts +20 -16
- package/dist/modules/tool-registry/description-length.d.ts.map +1 -1
- package/dist/modules/tool-registry/description-length.js +50 -30
- package/dist/modules/tool-registry/description-length.js.map +1 -1
- package/dist/modules/tool-registry/guide-first.d.ts +27 -0
- package/dist/modules/tool-registry/guide-first.d.ts.map +1 -0
- package/dist/modules/tool-registry/guide-first.js +40 -0
- package/dist/modules/tool-registry/guide-first.js.map +1 -0
- package/dist/modules/tool-registry/tool-registry.d.ts +6 -0
- package/dist/modules/tool-registry/tool-registry.d.ts.map +1 -1
- package/dist/modules/tool-registry/tool-registry.js +9 -2
- package/dist/modules/tool-registry/tool-registry.js.map +1 -1
- package/dist/modules/workflow/agent-tools/change-request-read-shape.d.ts +449 -0
- package/dist/modules/workflow/agent-tools/change-request-read-shape.d.ts.map +1 -0
- package/dist/modules/workflow/agent-tools/change-request-read-shape.js +481 -0
- package/dist/modules/workflow/agent-tools/change-request-read-shape.js.map +1 -0
- package/dist/modules/workflow/agent-tools/change-request-read.tools.d.ts +126 -0
- package/dist/modules/workflow/agent-tools/change-request-read.tools.d.ts.map +1 -0
- package/dist/modules/workflow/agent-tools/change-request-read.tools.js +611 -0
- package/dist/modules/workflow/agent-tools/change-request-read.tools.js.map +1 -0
- package/dist/modules/workflow/agent-tools/change-request-summary.d.ts +12 -1
- package/dist/modules/workflow/agent-tools/change-request-summary.d.ts.map +1 -1
- package/dist/modules/workflow/agent-tools/change-request-summary.js +5 -1
- package/dist/modules/workflow/agent-tools/change-request-summary.js.map +1 -1
- package/dist/modules/workflow/agent-tools/workflow.tools.d.ts +8 -1
- package/dist/modules/workflow/agent-tools/workflow.tools.d.ts.map +1 -1
- package/dist/modules/workflow/agent-tools/workflow.tools.js +133 -37
- package/dist/modules/workflow/agent-tools/workflow.tools.js.map +1 -1
- package/dist/modules/workflow/file-lock.service.d.ts +29 -5
- package/dist/modules/workflow/file-lock.service.d.ts.map +1 -1
- package/dist/modules/workflow/file-lock.service.js +62 -5
- package/dist/modules/workflow/file-lock.service.js.map +1 -1
- package/dist/modules/workflow/git/git.service.d.ts +282 -14
- package/dist/modules/workflow/git/git.service.d.ts.map +1 -1
- package/dist/modules/workflow/git/git.service.js +627 -126
- package/dist/modules/workflow/git/git.service.js.map +1 -1
- package/dist/modules/workflow/git/merge-commit.d.ts +73 -0
- package/dist/modules/workflow/git/merge-commit.d.ts.map +1 -0
- package/dist/modules/workflow/git/merge-commit.js +89 -0
- package/dist/modules/workflow/git/merge-commit.js.map +1 -0
- package/dist/modules/workflow/git/node-git-runner.d.ts +15 -0
- package/dist/modules/workflow/git/node-git-runner.d.ts.map +1 -1
- package/dist/modules/workflow/git/node-git-runner.js +78 -6
- package/dist/modules/workflow/git/node-git-runner.js.map +1 -1
- package/dist/modules/workflow/git/pull-request.service.d.ts +94 -1
- package/dist/modules/workflow/git/pull-request.service.d.ts.map +1 -1
- package/dist/modules/workflow/git/pull-request.service.js +332 -37
- package/dist/modules/workflow/git/pull-request.service.js.map +1 -1
- package/dist/modules/workflow/pending-commits.service.d.ts +15 -0
- package/dist/modules/workflow/pending-commits.service.d.ts.map +1 -1
- package/dist/modules/workflow/pending-commits.service.js +25 -1
- package/dist/modules/workflow/pending-commits.service.js.map +1 -1
- package/dist/modules/workflow/pending-commits.worker.d.ts +6 -1
- package/dist/modules/workflow/pending-commits.worker.d.ts.map +1 -1
- package/dist/modules/workflow/pending-commits.worker.js +23 -6
- package/dist/modules/workflow/pending-commits.worker.js.map +1 -1
- package/dist/modules/workflow/recovery-bot.js +1 -1
- package/dist/modules/workflow/recovery-bot.js.map +1 -1
- package/dist/modules/workflow/review-workflow/review-workflow.service.d.ts +35 -0
- package/dist/modules/workflow/review-workflow/review-workflow.service.d.ts.map +1 -1
- package/dist/modules/workflow/review-workflow/review-workflow.service.js +180 -13
- package/dist/modules/workflow/review-workflow/review-workflow.service.js.map +1 -1
- package/dist/modules/workflow/sanitize-error.d.ts +16 -0
- package/dist/modules/workflow/sanitize-error.d.ts.map +1 -1
- package/dist/modules/workflow/sanitize-error.js +45 -0
- package/dist/modules/workflow/sanitize-error.js.map +1 -1
- package/dist/modules/workflow/workflow.routes.d.ts +6 -2
- package/dist/modules/workflow/workflow.routes.d.ts.map +1 -1
- package/dist/modules/workflow/workflow.routes.js +7 -2
- package/dist/modules/workflow/workflow.routes.js.map +1 -1
- package/dist/modules/workflow/workflow.service.d.ts +187 -15
- package/dist/modules/workflow/workflow.service.d.ts.map +1 -1
- package/dist/modules/workflow/workflow.service.js +808 -106
- package/dist/modules/workflow/workflow.service.js.map +1 -1
- package/dist/modules/workspace/agent-download.builder.d.ts +105 -0
- package/dist/modules/workspace/agent-download.builder.d.ts.map +1 -0
- package/dist/modules/workspace/agent-download.builder.js +238 -0
- package/dist/modules/workspace/agent-download.builder.js.map +1 -0
- package/dist/modules/workspace/agent-download.routes.d.ts +77 -0
- package/dist/modules/workspace/agent-download.routes.d.ts.map +1 -0
- package/dist/modules/workspace/agent-download.routes.js +156 -0
- package/dist/modules/workspace/agent-download.routes.js.map +1 -0
- package/dist/modules/workspace/agent-download.store.d.ts +225 -0
- package/dist/modules/workspace/agent-download.store.d.ts.map +1 -0
- package/dist/modules/workspace/agent-download.store.js +423 -0
- package/dist/modules/workspace/agent-download.store.js.map +1 -0
- package/dist/modules/workspace/agent-upload.store.d.ts +10 -1
- package/dist/modules/workspace/agent-upload.store.d.ts.map +1 -1
- package/dist/modules/workspace/agent-upload.store.js +16 -6
- package/dist/modules/workspace/agent-upload.store.js.map +1 -1
- package/dist/modules/workspace/file-readers/raw-mime.d.ts +6 -0
- package/dist/modules/workspace/file-readers/raw-mime.d.ts.map +1 -0
- package/dist/modules/workspace/file-readers/raw-mime.js +38 -0
- package/dist/modules/workspace/file-readers/raw-mime.js.map +1 -0
- package/dist/modules/workspace/file-readers/text-reader.d.ts +5 -5
- package/dist/modules/workspace/file-readers/text-reader.d.ts.map +1 -1
- package/dist/modules/workspace/file-readers/text-reader.js +5 -8
- package/dist/modules/workspace/file-readers/text-reader.js.map +1 -1
- package/dist/modules/workspace/first-run.d.ts +111 -0
- package/dist/modules/workspace/first-run.d.ts.map +1 -0
- package/dist/modules/workspace/first-run.js +181 -0
- package/dist/modules/workspace/first-run.js.map +1 -0
- package/dist/modules/workspace/move-links.d.ts +92 -0
- package/dist/modules/workspace/move-links.d.ts.map +1 -0
- package/dist/modules/workspace/move-links.js +173 -0
- package/dist/modules/workspace/move-links.js.map +1 -0
- package/dist/modules/workspace/startup/steps/seed-tree.d.ts.map +1 -1
- package/dist/modules/workspace/startup/steps/seed-tree.js +24 -39
- package/dist/modules/workspace/startup/steps/seed-tree.js.map +1 -1
- package/dist/modules/workspace/startup/steps/template-files.step.d.ts +58 -52
- package/dist/modules/workspace/startup/steps/template-files.step.d.ts.map +1 -1
- package/dist/modules/workspace/startup/steps/template-files.step.js +209 -223
- package/dist/modules/workspace/startup/steps/template-files.step.js.map +1 -1
- package/dist/modules/workspace/startup/steps/template-source.d.ts +5 -3
- package/dist/modules/workspace/startup/steps/template-source.d.ts.map +1 -1
- package/dist/modules/workspace/startup/steps/template-source.js +5 -3
- package/dist/modules/workspace/startup/steps/template-source.js.map +1 -1
- package/dist/modules/workspace/workspace.routes.d.ts.map +1 -1
- package/dist/modules/workspace/workspace.routes.js +63 -22
- package/dist/modules/workspace/workspace.routes.js.map +1 -1
- package/dist/modules/workspace/workspace.service.d.ts +75 -2
- package/dist/modules/workspace/workspace.service.d.ts.map +1 -1
- package/dist/modules/workspace/workspace.service.js +197 -24
- package/dist/modules/workspace/workspace.service.js.map +1 -1
- package/dist/modules/workspace/workspace.tools.d.ts +68 -1
- package/dist/modules/workspace/workspace.tools.d.ts.map +1 -1
- package/dist/modules/workspace/workspace.tools.js +642 -71
- package/dist/modules/workspace/workspace.tools.js.map +1 -1
- package/dist/modules/write-access/write-access.d.ts.map +1 -1
- package/dist/modules/write-access/write-access.js +9 -0
- package/dist/modules/write-access/write-access.js.map +1 -1
- package/dist/shared/domain-errors.d.ts +84 -1
- package/dist/shared/domain-errors.d.ts.map +1 -1
- package/dist/shared/domain-errors.js +100 -12
- package/dist/shared/domain-errors.js.map +1 -1
- package/dist/shared/git.contract.d.ts +10 -1
- package/dist/shared/git.contract.d.ts.map +1 -1
- package/dist/shared/git.contract.js.map +1 -1
- package/dist/shared/hidden-tools.d.ts +44 -0
- package/dist/shared/hidden-tools.d.ts.map +1 -0
- package/dist/shared/hidden-tools.js +13 -0
- package/dist/shared/hidden-tools.js.map +1 -0
- package/dist/shared/utf8-text.d.ts +15 -0
- package/dist/shared/utf8-text.d.ts.map +1 -0
- package/dist/shared/utf8-text.js +20 -0
- package/dist/shared/utf8-text.js.map +1 -0
- package/dist/tenancy/static-tenant-source.d.ts +2 -1
- package/dist/tenancy/static-tenant-source.d.ts.map +1 -1
- package/dist/tenancy/static-tenant-source.js +9 -2
- package/dist/tenancy/static-tenant-source.js.map +1 -1
- package/kb-template/.bevelignore +0 -5
- package/mcp-app/page.html +349 -0
- package/migrations/0017_atlassian_account_links.sql +37 -0
- package/migrations/meta/0017_snapshot.json +2396 -0
- package/migrations/meta/_journal.json +8 -1
- package/package.json +6 -3
- package/src/__tests__/kb-layout-config.test.ts +10 -100
- package/src/__tests__/packaged-assets-ship.test.ts +66 -0
- package/src/assets.ts +38 -2
- package/src/core/__tests__/catalog-revision.test.ts +40 -0
- package/src/core/__tests__/gated-boot.test.ts +1 -0
- package/src/core/__tests__/lifecycle.test.ts +14 -0
- package/src/core/catalog-revision.ts +15 -2
- package/src/core/core-ports.ts +11 -0
- package/src/core/create-core-server.ts +78 -3
- package/src/core/create-core-services.ts +168 -10
- package/src/core/lifecycle.ts +28 -2
- package/src/core-config.ts +24 -1
- package/src/index.ts +2 -2
- package/src/modules/access/__tests__/access-control.atref-batch.test.ts +58 -0
- package/src/modules/access/__tests__/access-control.platform-restore.test.ts +8 -7
- package/src/modules/access/__tests__/access-control.service.test.ts +19 -0
- package/src/modules/access/__tests__/access-personal-plugin.test.ts +1 -18
- package/src/modules/access/access-control.interface.ts +28 -0
- package/src/modules/access/access-control.service.ts +37 -0
- package/src/modules/access/directory-sync-bot.ts +1 -1
- package/src/modules/agent-guide/__tests__/agent-guide.test.ts +386 -0
- package/src/modules/agent-guide/__tests__/agent-guide.tools.test.ts +207 -0
- package/src/modules/agent-guide/agent-guide.tools.ts +122 -0
- package/src/modules/agent-guide/agent-guide.ts +300 -0
- package/src/modules/agent-guide/index.ts +22 -0
- package/src/modules/agent-instructions/__tests__/shared-file-rules.test.ts +39 -118
- package/src/modules/agent-instructions/agent-instructions.routes.ts +3 -2
- package/src/modules/agent-instructions/compose.ts +26 -8
- package/src/modules/agent-instructions/index.ts +0 -3
- package/src/modules/agent-instructions/shared-file-rules.ts +50 -112
- package/src/modules/audit/__tests__/agent-audit.service.test.ts +64 -4
- package/src/modules/audit/__tests__/agent-connection.routes.test.ts +102 -0
- package/src/modules/audit/agent-audit.service.ts +58 -3
- package/src/modules/audit/agent-connection.routes.ts +56 -0
- package/src/modules/audit/audit.contract.ts +26 -0
- package/src/modules/audit/index.ts +1 -0
- package/src/modules/auth/__tests__/account.routes.test.ts +5 -3
- package/src/modules/auth/account.routes.ts +10 -3
- package/src/modules/auth/auth.middleware.ts +1 -1
- package/src/modules/code-mode/__tests__/code-mode.tool.test.ts +18 -2
- package/src/modules/code-mode/code-mode.tool.ts +13 -2
- package/src/modules/database/core-schema.ts +33 -3
- package/src/modules/embed/__tests__/account-links.migration.test.ts +98 -0
- package/src/modules/embed/__tests__/embed-link.test.ts +122 -0
- package/src/modules/embed/__tests__/embed.routes.test.ts +362 -0
- package/src/modules/embed/__tests__/embed.service.lock.test.ts +193 -0
- package/src/modules/embed/__tests__/embed.service.test.ts +805 -0
- package/src/modules/embed/__tests__/embed.tools.test.ts +304 -0
- package/src/modules/embed/__tests__/mcp-app.test.ts +207 -0
- package/src/modules/embed/account-link.service.ts +76 -0
- package/src/modules/embed/embed-link.ts +180 -0
- package/src/modules/embed/embed.errors.ts +43 -0
- package/src/modules/embed/embed.interface.ts +203 -0
- package/src/modules/embed/embed.routes.ts +363 -0
- package/src/modules/embed/embed.service.ts +705 -0
- package/src/modules/embed/embed.tools.ts +206 -0
- package/src/modules/embed/mcp-app.routes.ts +41 -0
- package/src/modules/embed/mcp-app.ts +173 -0
- package/src/modules/github-app/__tests__/github-app.test.ts +76 -0
- package/src/modules/github-app/github-app.connection.ts +38 -4
- package/src/modules/kb-fs/__tests__/move-with-edits.test.ts +304 -0
- package/src/modules/kb-fs/locking-filesystem.ts +287 -0
- package/src/modules/kb-sync/__tests__/kb-sync.service.test.ts +35 -0
- package/src/modules/kb-sync/kb-sync.interface.ts +2 -0
- package/src/modules/kb-sync/kb-sync.service.ts +6 -0
- package/src/modules/mcp/__tests__/bevel-oauth-provider.test.ts +68 -11
- package/src/modules/mcp/__tests__/fake-downstream-mcp-server.ts +14 -3
- package/src/modules/mcp/__tests__/mcp-proxy-helpers.test.ts +37 -2
- package/src/modules/mcp/__tests__/mcp.app.e2e.test.ts +200 -0
- package/src/modules/mcp/__tests__/mcp.e2e.test.ts +252 -0
- package/src/modules/mcp/__tests__/mcp.service.test.ts +42 -24
- package/src/modules/mcp/__tests__/tool-call-interface.e2e.test.ts +499 -0
- package/src/modules/mcp/__tests__/tool-schema-guard.test.ts +266 -0
- package/src/modules/mcp/mcp-auth.middleware.ts +2 -1
- package/src/modules/mcp/mcp.service.ts +218 -31
- package/src/modules/mcp/oauth/bevel-oauth-provider.ts +42 -4
- package/src/modules/mcp/tool-schema-guard.ts +196 -0
- package/src/modules/onboarding/__tests__/onboarding.routes.test.ts +163 -0
- package/src/modules/onboarding/__tests__/starter-pack.service.test.ts +635 -0
- package/src/modules/onboarding/__tests__/starter-packs.test.ts +169 -0
- package/src/modules/onboarding/onboarding.contract.ts +85 -0
- package/src/modules/onboarding/onboarding.routes.ts +85 -0
- package/src/modules/onboarding/starter-pack.service.ts +580 -0
- package/src/modules/onboarding/starter-packs.ts +182 -0
- package/src/modules/plugins/__tests__/plugins.tools.test.ts +177 -4
- package/src/modules/plugins/index.ts +1 -0
- package/src/modules/plugins/plugin-provision.service.ts +22 -1
- package/src/modules/plugins/plugins.routes.ts +29 -0
- package/src/modules/plugins/plugins.tools.ts +75 -15
- package/src/modules/settings/__tests__/deployment-settings.service.test.ts +176 -56
- package/src/modules/settings/__tests__/repository-source.test.ts +9 -0
- package/src/modules/settings/deployment-settings.service.ts +144 -55
- package/src/modules/settings/repository-source.ts +4 -4
- package/src/modules/settings/setup.routes.ts +3 -6
- package/src/modules/skills/__tests__/skills.tools.description.test.ts +95 -0
- package/src/modules/skills/skills.tools.ts +112 -46
- package/src/modules/tool-auth/__tests__/connection-key-rejection.test.ts +32 -0
- package/src/modules/tool-auth/__tests__/external-api-key.service.test.ts +65 -0
- package/src/modules/tool-auth/connection-key-rejection.ts +13 -3
- package/src/modules/tool-auth/external-api-key.interface.ts +9 -0
- package/src/modules/tool-auth/external-api-key.service.ts +61 -4
- package/src/modules/tool-auth/tool-auth.middleware.ts +13 -4
- package/src/modules/tool-helpers/__tests__/branch-declaration.test.ts +502 -0
- package/src/modules/tool-helpers/__tests__/route-argument-check.test.ts +337 -0
- package/src/modules/tool-helpers/index.ts +34 -1
- package/src/modules/tool-helpers/route-argument-check.ts +149 -0
- package/src/modules/tool-helpers/route-tool-schemas.ts +171 -0
- package/src/modules/tool-helpers/tool-def.ts +132 -7
- package/src/modules/tool-helpers/tool-handler.ts +196 -8
- package/src/modules/tool-helpers/tool.contract.ts +9 -0
- package/src/modules/tool-manuals/__tests__/tool-manuals.detail.route.test.ts +57 -0
- package/src/modules/tool-manuals/__tests__/tool-manuals.tools.test.ts +73 -4
- package/src/modules/tool-manuals/tool-manuals.contract.ts +24 -4
- package/src/modules/tool-manuals/tool-manuals.service.ts +17 -0
- package/src/modules/tool-manuals/tool-manuals.tools.ts +86 -38
- package/src/modules/tool-registry/__tests__/own-tool-schemas.test.ts +173 -0
- package/src/modules/tool-registry/__tests__/tool-description-length.test.ts +81 -66
- package/src/modules/tool-registry/description-length.ts +57 -32
- package/src/modules/tool-registry/guide-first.ts +41 -0
- package/src/modules/tool-registry/tool-registry.ts +9 -2
- package/src/modules/workflow/__tests__/apply-failure.test.ts +6 -1
- package/src/modules/workflow/__tests__/file-lock.service.deletion-gate.test.ts +104 -0
- package/src/modules/workflow/__tests__/pending-commits.repository-replaced.test.ts +66 -0
- package/src/modules/workflow/__tests__/pending-commits.worker.test.ts +31 -2
- package/src/modules/workflow/__tests__/preserve-roles-yaml.test.ts +110 -6
- package/src/modules/workflow/__tests__/sanitize-error.test.ts +89 -1
- package/src/modules/workflow/__tests__/workflow.routes.push-refused.test.ts +202 -0
- package/src/modules/workflow/__tests__/workflow.service.branch-in-use.test.ts +6 -6
- package/src/modules/workflow/__tests__/workflow.service.delete-branch.test.ts +1026 -0
- package/src/modules/workflow/__tests__/workflow.service.facade.test.ts +468 -10
- package/src/modules/workflow/__tests__/workflow.service.folder-proposals.test.ts +4 -0
- package/src/modules/workflow/__tests__/workflow.service.releaseLock.test.ts +5 -4
- package/src/modules/workflow/__tests__/workflow.service.update-from-target.test.ts +54 -2
- package/src/modules/workflow/agent-tools/__tests__/change-request-read-shape.test.ts +705 -0
- package/src/modules/workflow/agent-tools/__tests__/change-request-read.tools.test.ts +1554 -0
- package/src/modules/workflow/agent-tools/__tests__/workflow.tools.test.ts +150 -4
- package/src/modules/workflow/agent-tools/change-request-read-shape.ts +712 -0
- package/src/modules/workflow/agent-tools/change-request-read.tools.ts +759 -0
- package/src/modules/workflow/agent-tools/change-request-summary.ts +5 -1
- package/src/modules/workflow/agent-tools/workflow.tools.ts +137 -35
- package/src/modules/workflow/file-lock.service.ts +67 -5
- package/src/modules/workflow/git/__tests__/git.service.appliedChange.test.ts +285 -0
- package/src/modules/workflow/git/__tests__/git.service.changedFilesForPr.test.ts +124 -0
- package/src/modules/workflow/git/__tests__/git.service.deleteBranch.test.ts +164 -0
- package/src/modules/workflow/git/__tests__/git.service.mergeChangeRequest.test.ts +334 -0
- package/src/modules/workflow/git/__tests__/git.service.pull.test.ts +48 -1
- package/src/modules/workflow/git/__tests__/node-git-runner.test.ts +231 -2
- package/src/modules/workflow/git/__tests__/pull-request.service.list-fetch.test.ts +72 -2
- package/src/modules/workflow/git/__tests__/pull-request.service.placeholder.test.ts +24 -2
- package/src/modules/workflow/git/__tests__/pull-request.service.test.ts +620 -1
- package/src/modules/workflow/git/git.service.ts +714 -133
- package/src/modules/workflow/git/merge-commit.ts +88 -0
- package/src/modules/workflow/git/node-git-runner.ts +82 -7
- package/src/modules/workflow/git/pull-request.service.ts +380 -54
- package/src/modules/workflow/pending-commits.service.ts +29 -1
- package/src/modules/workflow/pending-commits.worker.ts +24 -6
- package/src/modules/workflow/recovery-bot.ts +1 -1
- package/src/modules/workflow/review-workflow/__tests__/approval-states.test.ts +7 -1
- package/src/modules/workflow/review-workflow/__tests__/merge-records-own-commit.test.ts +407 -0
- package/src/modules/workflow/review-workflow/review-workflow.service.ts +191 -12
- package/src/modules/workflow/sanitize-error.ts +50 -0
- package/src/modules/workflow/workflow.routes.ts +7 -2
- package/src/modules/workflow/workflow.service.ts +886 -112
- package/src/modules/workspace/__tests__/agent-downloads.test.ts +823 -0
- package/src/modules/workspace/__tests__/escape-sequences.routes.test.ts +4 -3
- package/src/modules/workspace/__tests__/first-run.test.ts +234 -0
- package/src/modules/workspace/__tests__/git-internals.security.test.ts +5 -2
- package/src/modules/workspace/__tests__/md-links.test.ts +353 -0
- package/src/modules/workspace/__tests__/move-links.test.ts +261 -0
- package/src/modules/workspace/__tests__/rest-tool-arguments.test.ts +219 -0
- package/src/modules/workspace/__tests__/workspace-paths-inside-the-repo.test.ts +3 -0
- package/src/modules/workspace/__tests__/workspace.routes.delete.test.ts +102 -0
- package/src/modules/workspace/__tests__/workspace.routes.download.test.ts +52 -5
- package/src/modules/workspace/__tests__/workspace.routes.folder-zip-access.test.ts +190 -0
- package/src/modules/workspace/__tests__/workspace.routes.move-platform-files.test.ts +21 -10
- package/src/modules/workspace/__tests__/workspace.service.forget-clone-races.test.ts +8 -4
- package/src/modules/workspace/__tests__/workspace.service.test.ts +50 -8
- package/src/modules/workspace/__tests__/workspace.tools.agents-file.test.ts +33 -55
- package/src/modules/workspace/__tests__/workspace.tools.branch-errors.test.ts +44 -1
- package/src/modules/workspace/__tests__/workspace.tools.test.ts +664 -34
- package/src/modules/workspace/agent-download.builder.ts +308 -0
- package/src/modules/workspace/agent-download.routes.ts +183 -0
- package/src/modules/workspace/agent-download.store.ts +533 -0
- package/src/modules/workspace/agent-upload.store.ts +23 -7
- package/src/modules/workspace/file-readers/raw-mime.ts +40 -0
- package/src/modules/workspace/file-readers/text-reader.ts +5 -8
- package/src/modules/workspace/first-run.ts +222 -0
- package/src/modules/workspace/move-links.ts +237 -0
- package/src/modules/workspace/startup/steps/__tests__/steps.test.ts +191 -489
- package/src/modules/workspace/startup/steps/seed-tree.ts +23 -38
- package/src/modules/workspace/startup/steps/template-files.step.ts +217 -249
- package/src/modules/workspace/startup/steps/template-source.ts +5 -3
- package/src/modules/workspace/workspace.routes.ts +64 -22
- package/src/modules/workspace/workspace.service.ts +202 -25
- package/src/modules/workspace/workspace.tools.ts +707 -68
- package/src/modules/write-access/__tests__/write-access.test.ts +13 -0
- package/src/modules/write-access/write-access.ts +9 -0
- package/src/shared/domain-errors.ts +123 -11
- package/src/shared/git.contract.ts +8 -1
- package/src/shared/hidden-tools.ts +45 -0
- package/src/shared/utf8-text.ts +21 -0
- package/src/tenancy/__tests__/static-tenant-source.test.ts +1 -0
- package/src/tenancy/static-tenant-source.ts +10 -2
- package/starter-packs/README.md +103 -0
- package/starter-packs/engineering/KnowledgeBase/About us.md +9 -0
- package/starter-packs/engineering/KnowledgeBase/Architecture.md +9 -0
- package/starter-packs/engineering/KnowledgeBase/Glossary.md +9 -0
- package/starter-packs/engineering/KnowledgeBase/How we ship.md +9 -0
- package/starter-packs/engineering/Plugins/engineering-starter/LICENSE +21 -0
- package/starter-packs/engineering/Plugins/engineering-starter/SOURCE.md +20 -0
- package/starter-packs/engineering/Plugins/engineering-starter/access.md +19 -0
- package/starter-packs/engineering/Plugins/engineering-starter/plugin.json +10 -0
- package/starter-packs/engineering/Plugins/engineering-starter/skills/office-hours/SKILL.md +171 -0
- package/starter-packs/engineering/Plugins/engineering-starter/skills/office-hours/sections/phase-2a-startup-diagnostic.md +157 -0
- package/starter-packs/engineering/Plugins/engineering-starter/skills/office-hours/sections/phase-2b-builder-brainstorm.md +39 -0
- package/starter-packs/engineering/Plugins/engineering-starter/skills/plan-ceo-review/SKILL.md +144 -0
- package/starter-packs/engineering/Plugins/engineering-starter/skills/plan-eng-review/SKILL.md +144 -0
- package/starter-packs/engineering/Plugins/engineering-starter/skills/review/SKILL.md +80 -0
- package/starter-packs/engineering/Plugins/engineering-starter/skills/review/checklist.md +184 -0
- package/starter-packs/engineering/pack.yaml +11 -0
- package/starter-packs/general/KnowledgeBase/About us.md +9 -0
- package/starter-packs/general/KnowledgeBase/Glossary.md +9 -0
- package/starter-packs/general/KnowledgeBase/How we work.md +9 -0
- package/starter-packs/general/Plugins/general-starter/LICENSE +202 -0
- package/starter-packs/general/Plugins/general-starter/SOURCE.md +10 -0
- package/starter-packs/general/Plugins/general-starter/access.md +19 -0
- package/starter-packs/general/Plugins/general-starter/plugin.json +10 -0
- package/starter-packs/general/Plugins/general-starter/skills/memory-management/SKILL.md +332 -0
- package/starter-packs/general/Plugins/general-starter/skills/productivity-start/SKILL.md +163 -0
- package/starter-packs/general/Plugins/general-starter/skills/productivity-update/SKILL.md +167 -0
- package/starter-packs/general/Plugins/general-starter/skills/task-management/SKILL.md +83 -0
- package/starter-packs/general/pack.yaml +10 -0
- package/starter-packs/operations/KnowledgeBase/Glossary.md +9 -0
- package/starter-packs/operations/KnowledgeBase/How we work.md +9 -0
- package/starter-packs/operations/KnowledgeBase/Processes.md +9 -0
- package/starter-packs/operations/KnowledgeBase/Tools we use.md +9 -0
- package/starter-packs/operations/KnowledgeBase/Vendors.md +9 -0
- package/starter-packs/operations/Plugins/operations-starter/LICENSE +202 -0
- package/starter-packs/operations/Plugins/operations-starter/SOURCE.md +10 -0
- package/starter-packs/operations/Plugins/operations-starter/access.md +19 -0
- package/starter-packs/operations/Plugins/operations-starter/plugin.json +10 -0
- package/starter-packs/operations/Plugins/operations-starter/skills/capacity-plan/SKILL.md +111 -0
- package/starter-packs/operations/Plugins/operations-starter/skills/change-request/SKILL.md +119 -0
- package/starter-packs/operations/Plugins/operations-starter/skills/compliance-tracking/SKILL.md +44 -0
- package/starter-packs/operations/Plugins/operations-starter/skills/process-doc/SKILL.md +80 -0
- package/starter-packs/operations/Plugins/operations-starter/skills/process-optimization/SKILL.md +39 -0
- package/starter-packs/operations/Plugins/operations-starter/skills/risk-assessment/SKILL.md +40 -0
- package/starter-packs/operations/Plugins/operations-starter/skills/runbook/SKILL.md +85 -0
- package/starter-packs/operations/Plugins/operations-starter/skills/status-report/SKILL.md +75 -0
- package/starter-packs/operations/Plugins/operations-starter/skills/vendor-review/SKILL.md +102 -0
- package/starter-packs/operations/pack.yaml +12 -0
- package/starter-packs/sales/KnowledgeBase/About us.md +9 -0
- package/starter-packs/sales/KnowledgeBase/Customers.md +9 -0
- package/starter-packs/sales/KnowledgeBase/Glossary.md +9 -0
- package/starter-packs/sales/KnowledgeBase/How we sell.md +9 -0
- package/starter-packs/sales/KnowledgeBase/Objections.md +9 -0
- package/starter-packs/sales/KnowledgeBase/Pricing.md +9 -0
- package/starter-packs/sales/Plugins/sales-starter/LICENSE +202 -0
- package/starter-packs/sales/Plugins/sales-starter/SOURCE.md +10 -0
- package/starter-packs/sales/Plugins/sales-starter/access.md +19 -0
- package/starter-packs/sales/Plugins/sales-starter/plugin.json +10 -0
- package/starter-packs/sales/Plugins/sales-starter/skills/account-context/SKILL.md +94 -0
- package/starter-packs/sales/Plugins/sales-starter/skills/account-plan/SKILL.md +95 -0
- package/starter-packs/sales/Plugins/sales-starter/skills/account-research/SKILL.md +99 -0
- package/starter-packs/sales/Plugins/sales-starter/skills/account-tiering/SKILL.md +101 -0
- package/starter-packs/sales/Plugins/sales-starter/skills/call-prep/SKILL.md +111 -0
- package/starter-packs/sales/Plugins/sales-starter/skills/call-summary/SKILL.md +111 -0
- package/starter-packs/sales/Plugins/sales-starter/skills/close-plan/SKILL.md +106 -0
- package/starter-packs/sales/Plugins/sales-starter/skills/competitive-intelligence/SKILL.md +102 -0
- package/starter-packs/sales/Plugins/sales-starter/skills/create-an-asset/SKILL.md +105 -0
- package/starter-packs/sales/Plugins/sales-starter/skills/crm-hygiene-check/SKILL.md +103 -0
- package/starter-packs/sales/Plugins/sales-starter/skills/customer-health/SKILL.md +108 -0
- package/starter-packs/sales/Plugins/sales-starter/skills/customer-voice/SKILL.md +94 -0
- package/starter-packs/sales/Plugins/sales-starter/skills/daily-briefing/SKILL.md +61 -0
- package/starter-packs/sales/Plugins/sales-starter/skills/deal-advance-gap/SKILL.md +102 -0
- package/starter-packs/sales/Plugins/sales-starter/skills/deal-review/SKILL.md +105 -0
- package/starter-packs/sales/Plugins/sales-starter/skills/deal-signals/SKILL.md +96 -0
- package/starter-packs/sales/Plugins/sales-starter/skills/deal-slip-scenario/SKILL.md +104 -0
- package/starter-packs/sales/Plugins/sales-starter/skills/draft-outreach/SKILL.md +116 -0
- package/starter-packs/sales/Plugins/sales-starter/skills/end-of-day/SKILL.md +114 -0
- package/starter-packs/sales/Plugins/sales-starter/skills/expansion-whitespace/SKILL.md +97 -0
- package/starter-packs/sales/Plugins/sales-starter/skills/forecast/SKILL.md +100 -0
- package/starter-packs/sales/Plugins/sales-starter/skills/handle-objection/SKILL.md +93 -0
- package/starter-packs/sales/Plugins/sales-starter/skills/inbox-sweep/SKILL.md +114 -0
- package/starter-packs/sales/Plugins/sales-starter/skills/lead-triage/SKILL.md +106 -0
- package/starter-packs/sales/Plugins/sales-starter/skills/log-activity/SKILL.md +111 -0
- package/starter-packs/sales/Plugins/sales-starter/skills/pipeline-review/SKILL.md +97 -0
- package/starter-packs/sales/Plugins/sales-starter/skills/renewal-radar/SKILL.md +95 -0
- package/starter-packs/sales/Plugins/sales-starter/skills/rep-context/SKILL.md +90 -0
- package/starter-packs/sales/Plugins/sales-starter/skills/route-lead/SKILL.md +111 -0
- package/starter-packs/sales/Plugins/sales-starter/skills/sales-setup/SKILL.md +200 -0
- package/starter-packs/sales/Plugins/sales-starter/skills/schedule-meeting/SKILL.md +99 -0
- package/starter-packs/sales/Plugins/sales-starter/skills/stakeholder-map/SKILL.md +107 -0
- package/starter-packs/sales/Plugins/sales-starter/skills/team-pipeline/SKILL.md +105 -0
- package/starter-packs/sales/Plugins/sales-starter/skills/update-opportunity/SKILL.md +112 -0
- package/starter-packs/sales/Plugins/sales-starter/skills/weekly-wrap/SKILL.md +90 -0
- package/starter-packs/sales/Plugins/sales-starter/skills/win-loss-review/SKILL.md +88 -0
- package/starter-packs/sales/pack.yaml +13 -0
- package/starter-packs/support/KnowledgeBase/Escalations.md +9 -0
- package/starter-packs/support/KnowledgeBase/Glossary.md +9 -0
- package/starter-packs/support/KnowledgeBase/Known issues.md +9 -0
- package/starter-packs/support/KnowledgeBase/Products.md +9 -0
- package/starter-packs/support/KnowledgeBase/Tone of voice.md +9 -0
- package/starter-packs/support/Plugins/support-starter/LICENSE +202 -0
- package/starter-packs/support/Plugins/support-starter/SOURCE.md +10 -0
- package/starter-packs/support/Plugins/support-starter/access.md +19 -0
- package/starter-packs/support/Plugins/support-starter/plugin.json +10 -0
- package/starter-packs/support/Plugins/support-starter/skills/customer-escalation/SKILL.md +246 -0
- package/starter-packs/support/Plugins/support-starter/skills/customer-research/SKILL.md +250 -0
- package/starter-packs/support/Plugins/support-starter/skills/draft-response/SKILL.md +416 -0
- package/starter-packs/support/Plugins/support-starter/skills/kb-article/SKILL.md +350 -0
- package/starter-packs/support/Plugins/support-starter/skills/ticket-triage/SKILL.md +273 -0
- package/starter-packs/support/pack.yaml +12 -0
- package/kb-template/AGENTS.md +0 -730
|
@@ -0,0 +1,492 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* "What does your team do?" — the one question a new knowledge base's admin
|
|
3
|
+
* is asked after choosing where the knowledge lives, and the pages and skills
|
|
4
|
+
* the answer adds.
|
|
5
|
+
*
|
|
6
|
+
* WHEN IT IS ASKED. Only of an admin, only until somebody has answered, and
|
|
7
|
+
* only while the knowledge folder is still new (`knowledgeFolderIsNew`, the
|
|
8
|
+
* same check the agent's first-run note makes): a knowledge base that already
|
|
9
|
+
* has pages has outgrown starter pages, whoever wrote them. The answer —
|
|
10
|
+
* a pack's id, or `none` for "I'll start from scratch" — is recorded as the
|
|
11
|
+
* deployment setting `starterPack`, and its presence retires the question for
|
|
12
|
+
* good.
|
|
13
|
+
*
|
|
14
|
+
* HOW THE PACK LANDS. As ONE commit on the default branch, authored by the
|
|
15
|
+
* admin who chose it ("Add starter pages and skills for Sales"), through the
|
|
16
|
+
* platform's own multi-file write: `LockingFilesystem.writeFiles`, the batch
|
|
17
|
+
* the roles admin and the synced-groups writer use. It takes every path's
|
|
18
|
+
* lock, writes, commits the set as one change and pushes it, and the
|
|
19
|
+
* protected branch's write gate applies to it as to any write — which an
|
|
20
|
+
* admin passes, as the root's `write: Admin` says. Nothing is overwritten: a
|
|
21
|
+
* path that already exists when the locks are held is left out of the batch.
|
|
22
|
+
*
|
|
23
|
+
* ONE commit across every replica, too. Before the write the admin takes a
|
|
24
|
+
* CLAIM — a settings row inserted only if absent, so of two admins choosing
|
|
25
|
+
* at once on two replicas the database lets one through and tells the other
|
|
26
|
+
* the pack is being added — and holds it until the answer is recorded, after
|
|
27
|
+
* the write landed. A write that fails releases the claim, so the question
|
|
28
|
+
* is asked again. A claim nobody released within `CLAIM_TTL_MS` was left by
|
|
29
|
+
* a process that died mid-write (a write takes seconds) and is taken over,
|
|
30
|
+
* so one crash never strands the question. A CLAIM IS CHECKED, NOT TRUSTED:
|
|
31
|
+
* a holder that outlived its claim — a clone that took minutes — may find it
|
|
32
|
+
* taken over and the question answered meanwhile, so right before the one
|
|
33
|
+
* effect, with every lock held and nothing written, the holder renews the
|
|
34
|
+
* claim where it still reads as its own — one statement that proves it and
|
|
35
|
+
* gives the effect a whole `CLAIM_TTL_MS` of its own — and checks that
|
|
36
|
+
* nothing is answered (`fence`); the answer is recorded only where none is. The answer itself (`starterPack`)
|
|
37
|
+
* is recorded once the pack is there; should that last step fail, the pack
|
|
38
|
+
* is added all the same — said in the log, answered as the success it is —
|
|
39
|
+
* and the pages close the question from then on.
|
|
40
|
+
*
|
|
41
|
+
* The pack's plugin is RUN BY the admin who applied it, the way a plugin made
|
|
42
|
+
* with "Create a plugin" is run by its creator: its `access.md` names them
|
|
43
|
+
* under read, write and owner (added to the rules the pack ships, which open
|
|
44
|
+
* the plugin to the team), and a pack without a manifest gets the one
|
|
45
|
+
* `renderPluginManifest` writes for any new plugin. A plugin folder that is
|
|
46
|
+
* already there — or another plugin answering to the same name, at any
|
|
47
|
+
* depth, by plugin discovery's own reading of the checkout — is left alone
|
|
48
|
+
* entirely: a pack does not write into somebody else's plugin, and never
|
|
49
|
+
* makes a second plugin with the name of one in a grouping folder. That
|
|
50
|
+
* check and the commit happen under the plugin creation's own identity lock
|
|
51
|
+
* (`PluginProvisionService.withIdentities`), so a creation or a deletion of
|
|
52
|
+
* the same name cannot slip between them.
|
|
53
|
+
*/
|
|
54
|
+
import path from 'node:path';
|
|
55
|
+
import { PERSONAL_PLUGIN_PREFIX, PLUGIN_MANIFEST_FILE, pluginManifestName, renderPluginManifest, } from '@bevel-software/platform-shared';
|
|
56
|
+
import { logger } from '../../shared/logging.js';
|
|
57
|
+
import { PushNeedsAgentResolutionError, WorkflowDomainError } from '../../shared/domain-errors.js';
|
|
58
|
+
import { LockingFilesystem } from '../kb-fs/locking-filesystem.js';
|
|
59
|
+
import { isUntouchedStarterPage, knowledgeFolderIsNew, } from '../workspace/first-run.js';
|
|
60
|
+
import { pluginAccessMd, withCreatorGrants } from '../plugins/index.js';
|
|
61
|
+
import { NO_STARTER_PACK, loadStarterPacks, starterPackFiles, } from './starter-packs.js';
|
|
62
|
+
const log = logger('starter-packs');
|
|
63
|
+
/** The deployment setting the choice is recorded in. */
|
|
64
|
+
export const STARTER_PACK_SETTING = 'starterPack';
|
|
65
|
+
/** The claim held while a choice is written (see the module doc): `<user id> <epoch ms>`. */
|
|
66
|
+
export const STARTER_PACK_CLAIM_SETTING = 'starterPackClaim';
|
|
67
|
+
/** A claim older than this was left by a process that died mid-write: a write takes seconds, not minutes. */
|
|
68
|
+
export const CLAIM_TTL_MS = 10 * 60_000;
|
|
69
|
+
/**
|
|
70
|
+
* The catch-all pack, offered as "Something else": its name is that chip's
|
|
71
|
+
* label, so the sentences that would name the team ("for Sales") leave it out.
|
|
72
|
+
*/
|
|
73
|
+
const CATCH_ALL_PACK = 'general';
|
|
74
|
+
/** A refusal the route passes through as its status. */
|
|
75
|
+
export class StarterPackError extends WorkflowDomainError {
|
|
76
|
+
constructor(message, status) {
|
|
77
|
+
super(message, status);
|
|
78
|
+
this.name = 'StarterPackError';
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
export class StarterPackService {
|
|
82
|
+
deps;
|
|
83
|
+
constructor(deps) {
|
|
84
|
+
this.deps = deps;
|
|
85
|
+
}
|
|
86
|
+
/** What the caller is offered, and what was chosen. */
|
|
87
|
+
async status(user) {
|
|
88
|
+
const [chosen, isAdmin, packs] = await Promise.all([
|
|
89
|
+
this.recordedChoice(),
|
|
90
|
+
this.deps.adminAccess.isAdmin(user.email),
|
|
91
|
+
loadStarterPacks(this.deps.disk, this.deps.packsDir),
|
|
92
|
+
]);
|
|
93
|
+
const offered = isAdmin && chosen === null && packs.length > 0 && (await this.knowledgeIsNew(false, user.email));
|
|
94
|
+
const pack = chosen && chosen !== NO_STARTER_PACK ? packs.find((p) => p.id === chosen) : undefined;
|
|
95
|
+
return {
|
|
96
|
+
offered,
|
|
97
|
+
chosen,
|
|
98
|
+
packs: isAdmin ? packs.map(({ id, name, description, order }) => ({ id, name, description, order })) : [],
|
|
99
|
+
chosenPack: pack
|
|
100
|
+
? {
|
|
101
|
+
id: pack.id,
|
|
102
|
+
name: pack.name,
|
|
103
|
+
firstPagePrompt: pack.firstPagePrompt,
|
|
104
|
+
starterPages: await this.untouchedPages(pack, user.email),
|
|
105
|
+
}
|
|
106
|
+
: null,
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Record `id` as the answer and, for a pack, add what it holds. `none`
|
|
111
|
+
* records the skip and adds nothing. Refused with 403 for a member, 409
|
|
112
|
+
* once the question is no longer asked (answered, or the knowledge base
|
|
113
|
+
* has pages now), 404 for a pack that does not exist.
|
|
114
|
+
*/
|
|
115
|
+
async choose(user, id) {
|
|
116
|
+
if (!(await this.deps.adminAccess.isAdmin(user.email))) {
|
|
117
|
+
throw new StarterPackError('Only an admin can add starter pages.', 403);
|
|
118
|
+
}
|
|
119
|
+
return this.deps.choosing.run('starter-pack', async () => {
|
|
120
|
+
/**
|
|
121
|
+
* Every value this call has written as its claim, newest first: the one
|
|
122
|
+
* taken, and each renewal the fence wrote — or may have written, since a
|
|
123
|
+
* renewal whose outcome is unknown is still this call's to release.
|
|
124
|
+
*/
|
|
125
|
+
const lease = { claims: [await this.claim(user)] };
|
|
126
|
+
let pack = null;
|
|
127
|
+
let added = [];
|
|
128
|
+
try {
|
|
129
|
+
// Judged UNDER the claim, so an answer another replica recorded and
|
|
130
|
+
// released between this call's start and its claim — a `none`, say
|
|
131
|
+
// — is found here rather than written over with a pack.
|
|
132
|
+
if ((await this.recordedChoice()) !== null)
|
|
133
|
+
throw alreadyChosen();
|
|
134
|
+
if (!(await this.knowledgeIsNew(true, user.email))) {
|
|
135
|
+
throw new StarterPackError('This knowledge base already has pages, so starter pages are no longer offered.', 409);
|
|
136
|
+
}
|
|
137
|
+
pack = id === NO_STARTER_PACK ? null : ((await loadStarterPacks(this.deps.disk, this.deps.packsDir)).find((p) => p.id === id) ?? null);
|
|
138
|
+
if (id !== NO_STARTER_PACK && !pack)
|
|
139
|
+
throw new StarterPackError(`There is no starter pack "${id}".`, 404);
|
|
140
|
+
if (pack)
|
|
141
|
+
added = await this.apply(user, pack, lease);
|
|
142
|
+
else {
|
|
143
|
+
// The skip is the effect itself: fenced the same way, and recorded
|
|
144
|
+
// only where nothing is answered.
|
|
145
|
+
await this.fence(lease, user);
|
|
146
|
+
if (!(await this.deps.settings.recordIfAbsent(STARTER_PACK_SETTING, id, user.id)))
|
|
147
|
+
throw alreadyChosen();
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
catch (err) {
|
|
151
|
+
// Refused, or nothing landed: the claim goes, and the question is
|
|
152
|
+
// open again (or answered, as the refusal said).
|
|
153
|
+
await this.release(lease);
|
|
154
|
+
throw err;
|
|
155
|
+
}
|
|
156
|
+
if (pack) {
|
|
157
|
+
// The answer, kept once the pack is there (or committed and waiting
|
|
158
|
+
// on its push) — and only where none is: an answer another replica
|
|
159
|
+
// recorded in the moment since the fence is theirs to keep. Should
|
|
160
|
+
// this fail now, the pack IS added: said in the log, answered as the
|
|
161
|
+
// success it is, and the pages close the question from here on
|
|
162
|
+
// (`knowledgeIsNew`).
|
|
163
|
+
await this.deps.settings
|
|
164
|
+
.recordIfAbsent(STARTER_PACK_SETTING, id, user.id)
|
|
165
|
+
.then((recorded) => {
|
|
166
|
+
if (!recorded)
|
|
167
|
+
log.error(`starter pack "${id}" was added, but another answer was recorded meanwhile`);
|
|
168
|
+
})
|
|
169
|
+
.catch((err) => {
|
|
170
|
+
log.error(`starter pack "${id}" was added, but the choice could not be recorded`, { err });
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
await this.release(lease);
|
|
174
|
+
if (!pack)
|
|
175
|
+
return { id, name: null, pages: 0, skills: 0, summary: '' };
|
|
176
|
+
const pages = added.filter((p) => this.isPage(p)).length;
|
|
177
|
+
const skills = added.filter((p) => path.posix.basename(p) === 'SKILL.md').length;
|
|
178
|
+
return { id: pack.id, name: pack.name, pages, skills, summary: summaryOf(pack, pages, skills) };
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
/** The chosen pack as the agent's first-run note needs it, or null. */
|
|
182
|
+
async firstRunStarter() {
|
|
183
|
+
const chosen = await this.recordedChoice();
|
|
184
|
+
if (!chosen || chosen === NO_STARTER_PACK)
|
|
185
|
+
return null;
|
|
186
|
+
const pack = (await loadStarterPacks(this.deps.disk, this.deps.packsDir)).find((p) => p.id === chosen);
|
|
187
|
+
if (!pack)
|
|
188
|
+
return null;
|
|
189
|
+
const knowledgeDir = this.deps.kb.layout.knowledgeBaseDir;
|
|
190
|
+
const pages = new Map();
|
|
191
|
+
for (const file of await this.pagesOf(pack)) {
|
|
192
|
+
pages.set(file.repoPath.slice(knowledgeDir.length + 1), file.content);
|
|
193
|
+
}
|
|
194
|
+
return { name: pack.name, suggestedPages: pack.suggestedPages, pages };
|
|
195
|
+
}
|
|
196
|
+
/** The recorded answer, read from the database so every replica agrees. */
|
|
197
|
+
async recordedChoice() {
|
|
198
|
+
return (await this.deps.settings.reload(STARTER_PACK_SETTING)) || null;
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Take the claim or be refused: a live one is another admin's choice in
|
|
202
|
+
* flight, here or on another replica. One older than `CLAIM_TTL_MS` was
|
|
203
|
+
* left by a process that died mid-write and is taken over — through the
|
|
204
|
+
* same insert-if-absent, so two take-overs at once still end with one
|
|
205
|
+
* holder.
|
|
206
|
+
*/
|
|
207
|
+
async claim(user) {
|
|
208
|
+
const { settings } = this.deps;
|
|
209
|
+
const value = `${user.id} ${Date.now()}`;
|
|
210
|
+
if (await settings.recordIfAbsent(STARTER_PACK_CLAIM_SETTING, value, user.id))
|
|
211
|
+
return value;
|
|
212
|
+
const held = await settings.reload(STARTER_PACK_CLAIM_SETTING);
|
|
213
|
+
const since = Number(held.split(' ').pop());
|
|
214
|
+
if (Number.isFinite(since) && Date.now() - since < CLAIM_TTL_MS)
|
|
215
|
+
throw beingAdded();
|
|
216
|
+
// The take-over replaces THAT claim, in one statement: two replicas that
|
|
217
|
+
// both read it expired cannot both succeed, since the second finds the
|
|
218
|
+
// first's claim where the expired one was and is refused.
|
|
219
|
+
log.warn('taking over a starter-pack claim nobody released', { held });
|
|
220
|
+
if (await settings.swapIfValue(STARTER_PACK_CLAIM_SETTING, held, value, user.id))
|
|
221
|
+
return value;
|
|
222
|
+
// The claim moved under this read: another replica took it over — or
|
|
223
|
+
// its holder finished and released it, and the row is gone. One more
|
|
224
|
+
// try at an empty row before saying a choice is in progress.
|
|
225
|
+
if (await settings.recordIfAbsent(STARTER_PACK_CLAIM_SETTING, value, user.id))
|
|
226
|
+
return value;
|
|
227
|
+
throw beingAdded();
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* THE FENCE before the one effect: that the claim is still this call's,
|
|
231
|
+
* and that nothing has been answered. A claim is a promise with a deadline
|
|
232
|
+
* — one that expired while its holder was still at work (a clone that
|
|
233
|
+
* took minutes) is taken over, and the new holder may answer `none` — so
|
|
234
|
+
* the holder's own word that it holds the claim is checked against the
|
|
235
|
+
* database at the last moment, with every lock held and nothing written.
|
|
236
|
+
*
|
|
237
|
+
* Checked by RENEWING it, in one statement: the claim is replaced with a
|
|
238
|
+
* fresh one of this call's only where it still reads as this call's
|
|
239
|
+
* (`swapIfValue`), which both proves the claim and dates it anew, so the
|
|
240
|
+
* effect that follows has a whole `CLAIM_TTL_MS` before anyone may take
|
|
241
|
+
* the claim over — a commit takes seconds. Refused: nothing lands, and the
|
|
242
|
+
* claim, now a successor's, is left to them.
|
|
243
|
+
*
|
|
244
|
+
* The renewal joins the lease BEFORE it is written: a write whose outcome
|
|
245
|
+
* is unknown (the statement reached the database, its answer did not) may
|
|
246
|
+
* have landed, and a claim this call may have written is this call's to
|
|
247
|
+
* release, or the question would stand closed until it expired.
|
|
248
|
+
*/
|
|
249
|
+
async fence(lease, user) {
|
|
250
|
+
const held = lease.claims[0];
|
|
251
|
+
const renewed = `${user.id} ${Date.now()}`;
|
|
252
|
+
lease.claims.unshift(renewed);
|
|
253
|
+
if (!(await this.deps.settings.swapIfValue(STARTER_PACK_CLAIM_SETTING, held, renewed, user.id))) {
|
|
254
|
+
throw new StarterPackError('Another admin took this choice over while it was in progress; nothing was added. Try again.', 409);
|
|
255
|
+
}
|
|
256
|
+
if ((await this.recordedChoice()) !== null)
|
|
257
|
+
throw alreadyChosen();
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Release one's OWN claim — never a successor's: a claim taken over after
|
|
261
|
+
* it expired is somebody else's now, and a late release must leave it.
|
|
262
|
+
* Whichever of the values this call wrote the row holds is released;
|
|
263
|
+
* each other value is simply not there. One that cannot be released
|
|
264
|
+
* expires on its own.
|
|
265
|
+
*/
|
|
266
|
+
async release(lease) {
|
|
267
|
+
for (const claim of lease.claims) {
|
|
268
|
+
const released = await this.deps.settings.swapIfValue(STARTER_PACK_CLAIM_SETTING, claim, null, null).catch((err) => {
|
|
269
|
+
log.error('the starter-pack claim could not be released; it expires on its own', { err });
|
|
270
|
+
return false;
|
|
271
|
+
});
|
|
272
|
+
if (released)
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Whether the default branch's knowledge folder is still new. `clone`:
|
|
278
|
+
* whether a knowledge base not checked out yet may be (the choice writes to
|
|
279
|
+
* it, so it must); the status question never clones, and answers "no".
|
|
280
|
+
*/
|
|
281
|
+
async knowledgeIsNew(clone, userEmail) {
|
|
282
|
+
const { kb, workspaceService, accessControl, disk } = this.deps;
|
|
283
|
+
if (!kb.isBranchModelConfigured())
|
|
284
|
+
return false;
|
|
285
|
+
const workspaceId = kb.defaultWorkspaceId();
|
|
286
|
+
if (!clone && !(await workspaceService.hasBootstrappedWorkspace(workspaceId)))
|
|
287
|
+
return false;
|
|
288
|
+
const ws = clone ? await workspaceService.getOrCreateForBranch(kb.defaultBranch) : { id: workspaceId };
|
|
289
|
+
const root = await workspaceService.getWorkspacePath(ws.id);
|
|
290
|
+
// As the CALLER may see it: being an admin grants no read of every page,
|
|
291
|
+
// and "offered" or "already has pages" must not tell them of one they
|
|
292
|
+
// may not read. The same gate `start_session`'s first-run note keeps —
|
|
293
|
+
// the knowledge folder itself first, then what is in it.
|
|
294
|
+
const knowledgeDir = kb.layout.knowledgeBaseDir;
|
|
295
|
+
const folder = await accessControl.canReadBatch(ws.id, userEmail, [knowledgeDir]);
|
|
296
|
+
if (folder.get(knowledgeDir) !== true)
|
|
297
|
+
return false;
|
|
298
|
+
const mayRead = async (rels) => {
|
|
299
|
+
const verdicts = await accessControl.canReadBatch(ws.id, userEmail, rels.map((rel) => `${knowledgeDir}/${rel}`));
|
|
300
|
+
return new Map(rels.map((rel) => [rel, verdicts.get(`${knowledgeDir}/${rel}`) === true]));
|
|
301
|
+
};
|
|
302
|
+
return knowledgeFolderIsNew(disk, path.join(root, kb.kbDirName), knowledgeDir, undefined, mayRead);
|
|
303
|
+
}
|
|
304
|
+
/** The pack's pages: its text files under the knowledge folder. */
|
|
305
|
+
async pagesOf(pack) {
|
|
306
|
+
const files = await starterPackFiles(this.deps.disk, pack, this.deps.kb.layout);
|
|
307
|
+
return files.filter((f) => f.root === 'KnowledgeBase' && typeof f.content === 'string' && this.isPage(f.repoPath));
|
|
308
|
+
}
|
|
309
|
+
/** A page: a file under the knowledge folder that is not its access rules. */
|
|
310
|
+
isPage(repoOrWsPath) {
|
|
311
|
+
const { kbDirName, layout } = this.deps.kb;
|
|
312
|
+
const rel = repoOrWsPath.startsWith(`${kbDirName}/`) ? repoOrWsPath.slice(kbDirName.length + 1) : repoOrWsPath;
|
|
313
|
+
return rel.startsWith(`${layout.knowledgeBaseDir}/`) && path.posix.basename(rel) !== 'access.md';
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* The pack's pages still as it wrote them, workspace-relative, and only
|
|
317
|
+
* those the caller may read: the list says a page exists and holds what
|
|
318
|
+
* the pack wrote, which is nothing to tell someone the page's access rules
|
|
319
|
+
* keep out — the same verdict the file routes give. Never clones.
|
|
320
|
+
*/
|
|
321
|
+
async untouchedPages(pack, userEmail) {
|
|
322
|
+
const { kb, workspaceService, accessControl } = this.deps;
|
|
323
|
+
try {
|
|
324
|
+
if (!kb.isBranchModelConfigured())
|
|
325
|
+
return [];
|
|
326
|
+
const workspaceId = kb.defaultWorkspaceId();
|
|
327
|
+
if (!(await workspaceService.hasBootstrappedWorkspace(workspaceId)))
|
|
328
|
+
return [];
|
|
329
|
+
const root = await workspaceService.getWorkspacePath(workspaceId);
|
|
330
|
+
const pages = await this.pagesOf(pack);
|
|
331
|
+
const readable = await accessControl.canReadBatch(workspaceId, userEmail, pages.map((p) => p.repoPath));
|
|
332
|
+
const out = [];
|
|
333
|
+
for (const page of pages) {
|
|
334
|
+
if (!readable.get(page.repoPath))
|
|
335
|
+
continue;
|
|
336
|
+
const wsPath = `${kb.kbDirName}/${page.repoPath}`;
|
|
337
|
+
if (await isUntouchedStarterPage(path.join(root, ...wsPath.split('/')), page.content))
|
|
338
|
+
out.push(wsPath);
|
|
339
|
+
}
|
|
340
|
+
return out;
|
|
341
|
+
}
|
|
342
|
+
catch (err) {
|
|
343
|
+
// A courtesy for the first-page step; an unreadable clone just means
|
|
344
|
+
// every page counts as written.
|
|
345
|
+
log.debug('could not tell which starter pages are untouched', {
|
|
346
|
+
error: err instanceof Error ? err.message : String(err),
|
|
347
|
+
});
|
|
348
|
+
return [];
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* Write the pack's absent files to the default branch as one commit;
|
|
353
|
+
* resolve to the paths written. `lease` is this call's claim, checked and
|
|
354
|
+
* renewed at the last moment (see `fence`).
|
|
355
|
+
*/
|
|
356
|
+
async apply(user, pack, lease) {
|
|
357
|
+
const { kb, workspaceService, workflow, disk } = this.deps;
|
|
358
|
+
const branch = kb.defaultBranch;
|
|
359
|
+
const ws = await workspaceService.getOrCreateForBranch(branch);
|
|
360
|
+
const basePath = await workspaceService.getWorkspacePath(ws.id);
|
|
361
|
+
const files = await starterPackFiles(disk, pack, kb.layout);
|
|
362
|
+
// Held from the name check to the commit: the names the pack's plugins
|
|
363
|
+
// would take, on the lock a creation or a deletion of one of them takes.
|
|
364
|
+
return this.deps.pluginLocks.withIdentities(packPluginFolders(files, kb.layout.pluginsDir), async () => {
|
|
365
|
+
const writes = await this.plan(user, pack, files, path.join(basePath, kb.kbDirName));
|
|
366
|
+
const fsys = new LockingFilesystem({ basePath, contained: true }, { workflow, workspaceId: ws.id, branch, user, kbDirName: kb.kbDirName, fileChanges: this.deps.fileChanges });
|
|
367
|
+
let written = [];
|
|
368
|
+
try {
|
|
369
|
+
await fsys.writeFiles(writes, commitSubjectOf(pack), [], async (candidates) => {
|
|
370
|
+
// With every lock held and nothing written yet: first that this
|
|
371
|
+
// call may still add anything at all (a check that throws refuses
|
|
372
|
+
// the whole batch untouched), then only what is STILL absent, so a
|
|
373
|
+
// page someone made a moment ago is never replaced.
|
|
374
|
+
await this.fence(lease, user);
|
|
375
|
+
const absent = [];
|
|
376
|
+
for (const w of candidates) {
|
|
377
|
+
if (!(await disk.exists(path.join(basePath, ...w.path.split('/')))))
|
|
378
|
+
absent.push(w);
|
|
379
|
+
}
|
|
380
|
+
written = absent.map((w) => w.path);
|
|
381
|
+
return absent;
|
|
382
|
+
});
|
|
383
|
+
}
|
|
384
|
+
catch (err) {
|
|
385
|
+
// The commit landed and only its push is waiting: the pending-commit
|
|
386
|
+
// worker retries it, and the sync banner says so. The pack IS added.
|
|
387
|
+
if (!(err instanceof PushNeedsAgentResolutionError))
|
|
388
|
+
throw err;
|
|
389
|
+
log.warn(`starter pack "${pack.id}" committed; its push is being retried`, { error: err.message });
|
|
390
|
+
}
|
|
391
|
+
if (written.length > 0) {
|
|
392
|
+
// The plugin's rules joined the access model.
|
|
393
|
+
this.deps.accessControl.invalidate(ws.id);
|
|
394
|
+
this.deps.events?.emit({ kind: 'fs-tree-changed', workspaceId: ws.id, branch });
|
|
395
|
+
}
|
|
396
|
+
return written;
|
|
397
|
+
});
|
|
398
|
+
}
|
|
399
|
+
/**
|
|
400
|
+
* The batch to write, workspace-relative: every pack file, with each plugin
|
|
401
|
+
* the pack carries made the admin's (see the module doc) — or left out
|
|
402
|
+
* whole when a plugin by that name is already there: a folder of that name
|
|
403
|
+
* at the plugins root, whatever it holds, or a plugin discovery lists under
|
|
404
|
+
* the same slug at any depth (one in a grouping folder included — the
|
|
405
|
+
* catalog would show two plugins of one name, and a grant would reach the
|
|
406
|
+
* wrong one). Refused outright when discovery could not read part of the
|
|
407
|
+
* checkout: a name cannot be proved free over a hole.
|
|
408
|
+
*/
|
|
409
|
+
async plan(user, pack, files, repoDir) {
|
|
410
|
+
const { kbDirName, layout } = this.deps.kb;
|
|
411
|
+
const [existingFolders, discovered] = await Promise.all([
|
|
412
|
+
folderNames(this.deps.disk, path.join(repoDir, layout.pluginsDir)),
|
|
413
|
+
this.deps.pluginSource.discover(repoDir),
|
|
414
|
+
]);
|
|
415
|
+
if (discovered.unreadable.length > 0) {
|
|
416
|
+
throw new StarterPackError(`Some of the knowledge base could not be read (${discovered.unreadable.join(', ')}), so the pack cannot be checked against the plugins already there. Try again.`, 503);
|
|
417
|
+
}
|
|
418
|
+
const writes = [];
|
|
419
|
+
const plugins = new Map();
|
|
420
|
+
for (const file of files) {
|
|
421
|
+
if (file.root !== 'Plugins') {
|
|
422
|
+
writes.push({ path: `${kbDirName}/${file.repoPath}`, content: file.content });
|
|
423
|
+
continue;
|
|
424
|
+
}
|
|
425
|
+
const folder = pluginFolderOf(file, layout.pluginsDir);
|
|
426
|
+
plugins.set(folder, [...(plugins.get(folder) ?? []), file]);
|
|
427
|
+
}
|
|
428
|
+
for (const [folder, pluginFiles] of plugins) {
|
|
429
|
+
const slug = pluginManifestName(folder);
|
|
430
|
+
if (slug.startsWith(PERSONAL_PLUGIN_PREFIX)) {
|
|
431
|
+
log.warn(`starter pack "${pack.id}": "${folder}" is a personal folder's name — plugin skipped.`);
|
|
432
|
+
continue;
|
|
433
|
+
}
|
|
434
|
+
const taken = existingFolders.find((name) => name.toLowerCase() === folder.toLowerCase() || pluginManifestName(name) === slug) ??
|
|
435
|
+
discovered.plugins.find((p) => pluginManifestName(p.name) === slug)?.folder;
|
|
436
|
+
if (taken) {
|
|
437
|
+
log.info(`starter pack "${pack.id}": a plugin "${taken}" is already there — its files are left as they are.`);
|
|
438
|
+
continue;
|
|
439
|
+
}
|
|
440
|
+
const root = `${layout.pluginsDir}/${folder}`;
|
|
441
|
+
let shippedAccess = null;
|
|
442
|
+
let hasManifest = false;
|
|
443
|
+
for (const file of pluginFiles) {
|
|
444
|
+
if (file.repoPath === `${root}/access.md`) {
|
|
445
|
+
shippedAccess = typeof file.content === 'string' ? file.content : null;
|
|
446
|
+
continue;
|
|
447
|
+
}
|
|
448
|
+
if (file.repoPath === `${root}/${PLUGIN_MANIFEST_FILE}`)
|
|
449
|
+
hasManifest = true;
|
|
450
|
+
writes.push({ path: `${kbDirName}/${file.repoPath}`, content: file.content });
|
|
451
|
+
}
|
|
452
|
+
writes.push({
|
|
453
|
+
path: `${kbDirName}/${root}/access.md`,
|
|
454
|
+
content: shippedAccess ? withCreatorGrants(shippedAccess, user) : pluginAccessMd(user),
|
|
455
|
+
});
|
|
456
|
+
if (!hasManifest)
|
|
457
|
+
writes.push({ path: `${kbDirName}/${root}/${PLUGIN_MANIFEST_FILE}`, content: renderPluginManifest(folder) });
|
|
458
|
+
}
|
|
459
|
+
return writes;
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
function alreadyChosen() {
|
|
463
|
+
return new StarterPackError('Starter pages were already chosen for this knowledge base.', 409);
|
|
464
|
+
}
|
|
465
|
+
function beingAdded() {
|
|
466
|
+
return new StarterPackError('Starter pages are being added right now. Try again in a moment.', 409);
|
|
467
|
+
}
|
|
468
|
+
/** The plugin folder (its first segment under the plugins root) a pack's plugin file belongs to. */
|
|
469
|
+
function pluginFolderOf(file, pluginsDir) {
|
|
470
|
+
return file.repoPath.slice(pluginsDir.length + 1).split('/')[0];
|
|
471
|
+
}
|
|
472
|
+
/** The plugin folders a pack carries, each once. */
|
|
473
|
+
function packPluginFolders(files, pluginsDir) {
|
|
474
|
+
return [...new Set(files.filter((f) => f.root === 'Plugins').map((f) => pluginFolderOf(f, pluginsDir)))];
|
|
475
|
+
}
|
|
476
|
+
/** The commit's subject: "Add starter pages and skills for Sales". */
|
|
477
|
+
export function commitSubjectOf(pack) {
|
|
478
|
+
return pack.id === CATCH_ALL_PACK ? 'Add starter pages and skills' : `Add starter pages and skills for ${pack.name}`;
|
|
479
|
+
}
|
|
480
|
+
/** "Added 4 pages and 1 skill for Sales." */
|
|
481
|
+
export function summaryOf(pack, pages, skills) {
|
|
482
|
+
const count = (n, one) => `${n} ${one}${n === 1 ? '' : 's'}`;
|
|
483
|
+
const parts = [pages > 0 ? count(pages, 'page') : null, skills > 0 ? count(skills, 'skill') : null].filter(Boolean);
|
|
484
|
+
if (parts.length === 0)
|
|
485
|
+
return 'Everything in this pack was already here.';
|
|
486
|
+
return `Added ${parts.join(' and ')}${pack.id === CATCH_ALL_PACK ? '' : ` for ${pack.name}`}.`;
|
|
487
|
+
}
|
|
488
|
+
/** The folders in `dir`, by name; none when it is not there. A folder that cannot be listed is the error: a name cannot be proved free over a hole. */
|
|
489
|
+
async function folderNames(disk, dir) {
|
|
490
|
+
return ((await disk.listDir(dir)) ?? []).filter((e) => e.isDirectory()).map((e) => e.name);
|
|
491
|
+
}
|
|
492
|
+
//# sourceMappingURL=starter-pack.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"starter-pack.service.js","sourceRoot":"","sources":["../../../src/modules/onboarding/starter-pack.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AAEH,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EACL,sBAAsB,EACtB,oBAAoB,EACpB,kBAAkB,EAClB,oBAAoB,GAGrB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,6BAA6B,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAKnG,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAGnE,OAAO,EACL,sBAAsB,EACtB,oBAAoB,GAIrB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAqB,MAAM,qBAAqB,CAAC;AAC3F,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,gBAAgB,GAGjB,MAAM,oBAAoB,CAAC;AAU5B,MAAM,GAAG,GAAG,MAAM,CAAC,eAAe,CAAC,CAAC;AAEpC,wDAAwD;AACxD,MAAM,CAAC,MAAM,oBAAoB,GAAG,aAAa,CAAC;AAClD,6FAA6F;AAC7F,MAAM,CAAC,MAAM,0BAA0B,GAAG,kBAAkB,CAAC;AAC7D,6GAA6G;AAC7G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AAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;AAC7F,CAAC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Starter packs: the pages and the plugin a new knowledge base can be filled
|
|
3
|
+
* with in one click, chosen by what the team does.
|
|
4
|
+
*
|
|
5
|
+
* A pack is a folder under the packs root (`starter-packs/` in this package,
|
|
6
|
+
* or a distribution's `STARTER_PACKS_DIR`):
|
|
7
|
+
*
|
|
8
|
+
* <id>/pack.yaml id, name, description, order, firstPagePrompt, suggestedPages
|
|
9
|
+
* <id>/KnowledgeBase/… pages, under the DEFAULT layout's folder names
|
|
10
|
+
* <id>/Plugins/<name>/… a team plugin in the normal plugin layout
|
|
11
|
+
* <id>/Skills/… shared skills, if a pack carries any
|
|
12
|
+
*
|
|
13
|
+
* The three folders are written under the deployment's OWN names for them
|
|
14
|
+
* (`KnowledgeBase/` lands in whatever `knowledgeBaseDir` is), so a pack is
|
|
15
|
+
* authored once and fits every layout. Anything else in a pack folder (a
|
|
16
|
+
* README, notes for whoever maintains it) is the pack's, not the knowledge
|
|
17
|
+
* base's, and is never copied.
|
|
18
|
+
*
|
|
19
|
+
* A pack that does not read as one — no `pack.yaml`, a field missing or of
|
|
20
|
+
* the wrong kind, an id that is not its folder's name — is passed over with
|
|
21
|
+
* a warning: one broken folder must not take the choice away from everyone.
|
|
22
|
+
*
|
|
23
|
+
* The disk is read through the one walk and the one probe
|
|
24
|
+
* (`shared/fs.contract.ts`), handed in by the caller; only a file's bytes are
|
|
25
|
+
* read here, which neither contract covers.
|
|
26
|
+
*/
|
|
27
|
+
import { type KbLayout } from '@bevel-software/platform-shared';
|
|
28
|
+
import type { IFsProbe, ITreeWalker } from '../../shared/fs.contract.js';
|
|
29
|
+
/** The file that makes a folder a pack. */
|
|
30
|
+
export declare const PACK_MANIFEST = "pack.yaml";
|
|
31
|
+
/** The answer that chooses no pack: "Skip, I'll start from scratch". Never a pack's id. */
|
|
32
|
+
export declare const NO_STARTER_PACK = "none";
|
|
33
|
+
/** The pack's own folders, by their default-layout names, and the layout key each one is written under. */
|
|
34
|
+
export declare const PACK_ROOTS: ReadonlyArray<readonly [string, keyof Pick<KbLayout, 'knowledgeBaseDir' | 'pluginsDir' | 'skillsDir'>]>;
|
|
35
|
+
/** What a chip shows, and the order the chips come in. */
|
|
36
|
+
export interface StarterPackSummary {
|
|
37
|
+
id: string;
|
|
38
|
+
name: string;
|
|
39
|
+
description: string;
|
|
40
|
+
order: number;
|
|
41
|
+
}
|
|
42
|
+
export interface StarterPack extends StarterPackSummary {
|
|
43
|
+
/** Replaces the generic "write your first page" request for a team that chose this pack. */
|
|
44
|
+
firstPagePrompt: string;
|
|
45
|
+
/** The pages the agent's first-run note offers to draft. */
|
|
46
|
+
suggestedPages: string[];
|
|
47
|
+
/** The pack's folder, absolute. */
|
|
48
|
+
dir: string;
|
|
49
|
+
}
|
|
50
|
+
/** One file a pack would add, at the path it would have in the knowledge base. */
|
|
51
|
+
export interface StarterPackFile {
|
|
52
|
+
/** Repository-relative, under the deployment's layout: `KnowledgeBase/About us.md`, `Plugins/x/skills/y/SKILL.md`. */
|
|
53
|
+
repoPath: string;
|
|
54
|
+
/** Which of the pack's folders it came from, by its default name. */
|
|
55
|
+
root: (typeof PACK_ROOTS)[number][0];
|
|
56
|
+
/** The bytes to write: text with the layout placeholders filled, or the file as it is. */
|
|
57
|
+
content: string | Buffer;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Every valid pack under `root`, chip order first (then name). A root that
|
|
61
|
+
* is not there offers no packs; it is not an error, since a distribution may
|
|
62
|
+
* ship none.
|
|
63
|
+
*/
|
|
64
|
+
export declare function loadStarterPacks(disk: IFsProbe, root: string): Promise<StarterPack[]>;
|
|
65
|
+
/** The pack in `dir`, or null (with a warning saying why) when it does not read as one. */
|
|
66
|
+
export declare function readStarterPack(disk: IFsProbe, dir: string): Promise<StarterPack | null>;
|
|
67
|
+
/** Why a parsed `pack.yaml` is not a pack, or null when it is one. */
|
|
68
|
+
export declare function packProblem(manifest: unknown, folder: string): string | null;
|
|
69
|
+
/**
|
|
70
|
+
* Every file the pack would add, at its path under `layout`, in walk order.
|
|
71
|
+
* The knowledge-base walk lists them: dot-entries are left behind (an
|
|
72
|
+
* editor's or an OS's droppings, never content), and so is anything that is
|
|
73
|
+
* not a regular file — a pack is files. A pack folder that is not there, or
|
|
74
|
+
* is a file where a folder was expected, holds nothing; a folder in one that
|
|
75
|
+
* cannot be listed is the error, since a pack with a hole is not the pack.
|
|
76
|
+
*/
|
|
77
|
+
export declare function starterPackFiles(disk: ITreeWalker, pack: StarterPack, layout: Required<KbLayout>): Promise<StarterPackFile[]>;
|
|
78
|
+
//# sourceMappingURL=starter-packs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"starter-packs.d.ts","sourceRoot":"","sources":["../../../src/modules/onboarding/starter-packs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAKH,OAAO,EAA8B,KAAK,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC5F,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAe,MAAM,6BAA6B,CAAC;AAMtF,2CAA2C;AAC3C,eAAO,MAAM,aAAa,cAAc,CAAC;AAEzC,2FAA2F;AAC3F,eAAO,MAAM,eAAe,SAAS,CAAC;AAKtC,2GAA2G;AAC3G,eAAO,MAAM,UAAU,EAAE,aAAa,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,IAAI,CAAC,QAAQ,EAAE,kBAAkB,GAAG,YAAY,GAAG,WAAW,CAAC,CAAC,CAI9H,CAAC;AAEF,0DAA0D;AAC1D,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAA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