@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 @@
|
|
|
1
|
+
{"version":3,"file":"embed.routes.d.ts","sourceRoot":"","sources":["../../../src/modules/embed/embed.routes.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAS1D,OAAO,4BAA4B,CAAC;AAEpC;;;;GAIG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,wBAAgB,iBAAiB,CAAC,YAAY,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CA0I7E;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,YAAY,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAwDjF;AAqBD,mEAAmE;AACnE,eAAO,MAAM,cAAc,qEACyC,CAAC"}
|
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
import express from 'express';
|
|
2
|
+
import { EmbedAccessError, EmbedLockedError, EmbedNodeNotFoundError, EmbedTokenError, } from './embed.errors.js';
|
|
3
|
+
import { EmbedRefParseError } from './embed-link.js';
|
|
4
|
+
import { rawExtensionOf, rawMimeFor } from '../workspace/file-readers/raw-mime.js';
|
|
5
|
+
import '../auth/auth.middleware.js'; // Express Request augmentation
|
|
6
|
+
/**
|
|
7
|
+
* What `/api/embed/raw` answers as `Content-Type`, by extension — the types a
|
|
8
|
+
* renderer draws from a URL. Anything else is bytes the renderer parses
|
|
9
|
+
* itself (a workbook, a deck), served as the octet stream it is.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* The embed surface: a token-minted, pseudonymous, short-lived page that
|
|
13
|
+
* renders ONE knowledge-base file with the app's own renderer, inside
|
|
14
|
+
* somebody else's frame — an MCP App's sandbox in a chat, an Atlassian issue
|
|
15
|
+
* panel. Two routers, with deliberately different auth stories:
|
|
16
|
+
*
|
|
17
|
+
* - {@link createEmbedRoutes} (mounted at the app root, ahead of the JWT
|
|
18
|
+
* middleware): the connector's shared-secret mint, and the TOKEN-ONLY data
|
|
19
|
+
* routes the SPA `/embed` page calls. Also stamps the framing headers on
|
|
20
|
+
* the two SPA routes.
|
|
21
|
+
* - {@link createEmbedLinkRoutes} (mounted under the JWT middleware): links
|
|
22
|
+
* the viewer's outside account to their just-authenticated Hexis user.
|
|
23
|
+
*
|
|
24
|
+
* Mounted before the production static catch-all, so the framing headers are
|
|
25
|
+
* stamped before `index.html` is served for `/embed*`.
|
|
26
|
+
*
|
|
27
|
+
* ── Why the data routes take the token and NOTHING else ───────────────────
|
|
28
|
+
*
|
|
29
|
+
* The embed page is framed by any site (see the framing headers below), which
|
|
30
|
+
* is what makes it work in every host's sandbox without an admin entry per
|
|
31
|
+
* host. The security of the embed therefore rests entirely on the token:
|
|
32
|
+
* short-lived, scoped to one file and one identity, pseudonymous. A session
|
|
33
|
+
* FALLBACK would hand that away — a hostile page could frame `/embed`, and
|
|
34
|
+
* the browser would attach the visitor's own cookie to every data request the
|
|
35
|
+
* page made, so the attacker's frame would read and write as the victim. So
|
|
36
|
+
* every route here reads `token` and never `req.userId`: a request carrying a
|
|
37
|
+
* perfectly valid session and no token is refused.
|
|
38
|
+
*
|
|
39
|
+
* ── Cross-origin callers ──────────────────────────────────────────────────
|
|
40
|
+
*
|
|
41
|
+
* The MCP App view runs the embed inside a chat host's SANDBOX — another
|
|
42
|
+
* origin, unknowable in advance (a hash subdomain under Claude's content
|
|
43
|
+
* domain, a URL-derived one under ChatGPT's) — and calls the token routes
|
|
44
|
+
* from there. Nothing here has to allow that: the server's app-wide CORS
|
|
45
|
+
* (`create-core-server.ts`, mounted ahead of this router) already reflects
|
|
46
|
+
* any origin and answers the preflight, for every route. That is safe on the
|
|
47
|
+
* token routes for the reason the token-only rule exists: CORS guards a
|
|
48
|
+
* browser's ambient credentials, these routes take none, and the token in
|
|
49
|
+
* the request is the whole credential. The routes test mounts the same CORS
|
|
50
|
+
* to pin that a cross-origin caller gets through.
|
|
51
|
+
*/
|
|
52
|
+
export function createEmbedRoutes(embedService) {
|
|
53
|
+
const router = express.Router();
|
|
54
|
+
// ── framing ──────────────────────────────────────────────────────────────
|
|
55
|
+
//
|
|
56
|
+
// The embed page: NO framing restriction at all, so any host may frame it.
|
|
57
|
+
// `X-Frame-Options` is removed rather than merely not set, so a header added
|
|
58
|
+
// globally later (by this app or by a proxy in front of it) cannot silently
|
|
59
|
+
// break every host's embed — the one route that must be frameable says so
|
|
60
|
+
// itself.
|
|
61
|
+
router.get('/embed', (_req, res, next) => {
|
|
62
|
+
res.removeHeader('X-Frame-Options');
|
|
63
|
+
// Only the framing directive goes: a policy's other directives (scripts,
|
|
64
|
+
// objects, connections) protect the page whoever frames it, and stay.
|
|
65
|
+
const csp = res.getHeader('Content-Security-Policy');
|
|
66
|
+
if (typeof csp === 'string') {
|
|
67
|
+
const kept = csp
|
|
68
|
+
.split(';')
|
|
69
|
+
.map((d) => d.trim())
|
|
70
|
+
.filter((d) => d !== '' && !/^frame-ancestors\b/i.test(d));
|
|
71
|
+
if (kept.length > 0)
|
|
72
|
+
res.setHeader('Content-Security-Policy', kept.join('; '));
|
|
73
|
+
else
|
|
74
|
+
res.removeHeader('Content-Security-Policy');
|
|
75
|
+
}
|
|
76
|
+
next();
|
|
77
|
+
});
|
|
78
|
+
// The account-link page is the opposite: it acts under the viewer's own
|
|
79
|
+
// SESSION, so a page that could frame it could link a foreign account to
|
|
80
|
+
// whoever happened to be signed in. Refused for EVERY ancestor — the modern
|
|
81
|
+
// directive and the legacy header, since not every browser honours both.
|
|
82
|
+
router.get('/embed/link', (_req, res, next) => {
|
|
83
|
+
res.setHeader('Content-Security-Policy', "frame-ancestors 'none'");
|
|
84
|
+
res.setHeader('X-Frame-Options', 'DENY');
|
|
85
|
+
next();
|
|
86
|
+
});
|
|
87
|
+
// ── the connector's mint (server-to-server, shared secret) ───────────────
|
|
88
|
+
router.post('/api/embed/token', async (req, res) => {
|
|
89
|
+
if (!embedService.sharedSecretConfigured()) {
|
|
90
|
+
res.status(404).json({ error: 'The shared-secret mint is not configured' });
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
if (!embedService.verifySharedSecret(req.header('x-embed-secret') ?? undefined)) {
|
|
94
|
+
res.status(401).json({ error: 'Invalid embed secret' });
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
const b = req.body;
|
|
98
|
+
if (typeof b?.accountId !== 'string' || typeof b?.reference !== 'string') {
|
|
99
|
+
res.status(400).json({ error: 'accountId and reference are required' });
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
try {
|
|
103
|
+
res.json(await embedService.mintToken({
|
|
104
|
+
accountId: b.accountId,
|
|
105
|
+
email: typeof b.email === 'string' ? b.email : undefined,
|
|
106
|
+
reference: b.reference,
|
|
107
|
+
}));
|
|
108
|
+
}
|
|
109
|
+
catch (err) {
|
|
110
|
+
sendJsonError(res, err);
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
// ── token-only data routes ───────────────────────────────────────────────
|
|
114
|
+
// The file to render, plus the viewer's read/write status.
|
|
115
|
+
router.get('/api/embed/load', async (req, res) => {
|
|
116
|
+
const token = queryToken(req, res);
|
|
117
|
+
if (token === null)
|
|
118
|
+
return;
|
|
119
|
+
// Protected text and a token-bearing link URL: as with `/raw`, nothing
|
|
120
|
+
// may keep the answer past the access it was computed under.
|
|
121
|
+
res.setHeader('Cache-Control', 'no-store, private');
|
|
122
|
+
try {
|
|
123
|
+
res.json(await embedService.loadFile(token));
|
|
124
|
+
}
|
|
125
|
+
catch (err) {
|
|
126
|
+
sendJsonError(res, err);
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
// The file's BYTES, for the app renderers that read bytes rather than a
|
|
130
|
+
// text buffer: an image, a PDF, a Word document — and the pictures a
|
|
131
|
+
// markdown page references, which arrive as `path`.
|
|
132
|
+
router.get('/api/embed/raw', async (req, res) => {
|
|
133
|
+
// The token is in the URL, so no shared cache may keep ANY answer from
|
|
134
|
+
// it — a refusal included, which is why this is set before the token is
|
|
135
|
+
// even looked at.
|
|
136
|
+
res.setHeader('Cache-Control', 'no-store, private');
|
|
137
|
+
const token = queryToken(req, res);
|
|
138
|
+
if (token === null)
|
|
139
|
+
return;
|
|
140
|
+
const path = typeof req.query.path === 'string' ? req.query.path : undefined;
|
|
141
|
+
try {
|
|
142
|
+
const { bytes, path: served } = await embedService.readBytes(token, path);
|
|
143
|
+
// The type from the extension, the one table the workspace raw route
|
|
144
|
+
// serves from: under `nosniff` a browser draws an `<img>` only from an
|
|
145
|
+
// `image/*` answer, and never sniffs SVG at all, so an octet-stream
|
|
146
|
+
// picture is a broken image.
|
|
147
|
+
res.setHeader('Content-Type', rawMimeFor(served));
|
|
148
|
+
// An SVG can carry scripts; drawn through `<img>` they never run, but a
|
|
149
|
+
// tab opened on this address would run them under the app's origin.
|
|
150
|
+
if (rawExtensionOf(served) === '.svg')
|
|
151
|
+
res.setHeader('Content-Security-Policy', 'sandbox');
|
|
152
|
+
// Never a download, always bytes for a renderer to draw: an embed is a
|
|
153
|
+
// view, and `download:` is a separate verb the app's own route gates.
|
|
154
|
+
res.setHeader('Content-Disposition', 'inline');
|
|
155
|
+
res.setHeader('X-Content-Type-Options', 'nosniff');
|
|
156
|
+
res.setHeader('X-Embed-Path', encodeURIComponent(served));
|
|
157
|
+
res.end(bytes);
|
|
158
|
+
}
|
|
159
|
+
catch (err) {
|
|
160
|
+
sendJsonError(res, err);
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
// Lock lifecycle: Edit → lock, timer → heartbeat, Cancel/close → cancel.
|
|
164
|
+
router.post('/api/embed/lock', tokenHandler(async (token) => embedService.acquireLock(token)));
|
|
165
|
+
router.post('/api/embed/heartbeat', tokenHandler(async (token) => {
|
|
166
|
+
await embedService.heartbeat(token);
|
|
167
|
+
return null;
|
|
168
|
+
}));
|
|
169
|
+
router.post('/api/embed/cancel', tokenHandler(async (token) => {
|
|
170
|
+
await embedService.cancel(token);
|
|
171
|
+
return null;
|
|
172
|
+
}));
|
|
173
|
+
// Save to the default branch (a writer), or propose (anybody else).
|
|
174
|
+
router.post('/api/embed/save', contentHandler(async (token, content) => {
|
|
175
|
+
await embedService.save(token, content);
|
|
176
|
+
return null;
|
|
177
|
+
}));
|
|
178
|
+
router.post('/api/embed/propose', contentHandler(async (token, content) => embedService.propose(token, content)));
|
|
179
|
+
return router;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Links the authenticated Hexis user to the outside account the embed token
|
|
183
|
+
* carries. JWT-protected — `req.userId` is the user we link TO, which is why
|
|
184
|
+
* the page it is called from refuses every framing ancestor.
|
|
185
|
+
*/
|
|
186
|
+
export function createEmbedLinkRoutes(embedService) {
|
|
187
|
+
const router = express.Router();
|
|
188
|
+
router.post('/embed/link', async (req, res) => {
|
|
189
|
+
if (!req.userId) {
|
|
190
|
+
res.status(401).json({ error: 'Unauthenticated' });
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
const b = req.body;
|
|
194
|
+
if (typeof b?.token !== 'string') {
|
|
195
|
+
res.status(400).json({ error: 'token is required' });
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
try {
|
|
199
|
+
await embedService.linkAccount(b.token, req.userId);
|
|
200
|
+
res.status(204).end();
|
|
201
|
+
}
|
|
202
|
+
catch (err) {
|
|
203
|
+
sendJsonError(res, err);
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
// Connected-apps management (list + disconnect). A person's ability to see
|
|
207
|
+
// and remove their OWN link — self-service erasure — must not depend on
|
|
208
|
+
// whether the shared-secret mint happens to be configured today.
|
|
209
|
+
router.get('/embed/links', async (req, res) => {
|
|
210
|
+
if (!req.userId) {
|
|
211
|
+
res.status(401).json({ error: 'Unauthenticated' });
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
try {
|
|
215
|
+
res.json(await embedService.listLinkedAccounts(req.userId));
|
|
216
|
+
}
|
|
217
|
+
catch (err) {
|
|
218
|
+
sendJsonError(res, err);
|
|
219
|
+
}
|
|
220
|
+
});
|
|
221
|
+
router.delete('/embed/links/:accountId', async (req, res) => {
|
|
222
|
+
if (!req.userId) {
|
|
223
|
+
res.status(401).json({ error: 'Unauthenticated' });
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
try {
|
|
227
|
+
const removed = await embedService.unlinkAccount(req.userId, req.params.accountId);
|
|
228
|
+
if (!removed) {
|
|
229
|
+
// Not linked to THIS user (absent, or somebody else's) — the same 404
|
|
230
|
+
// either way, so the endpoint cannot probe other people's links.
|
|
231
|
+
res.status(404).json({ error: 'No such connected app' });
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
res.status(204).end();
|
|
235
|
+
}
|
|
236
|
+
catch (err) {
|
|
237
|
+
sendJsonError(res, err);
|
|
238
|
+
}
|
|
239
|
+
});
|
|
240
|
+
return router;
|
|
241
|
+
}
|
|
242
|
+
// ── helpers ─────────────────────────────────────────────────────────────────
|
|
243
|
+
/**
|
|
244
|
+
* The `token` query parameter, or null after answering 401.
|
|
245
|
+
*
|
|
246
|
+
* 401, not 400: a request with no token is a request with no CREDENTIAL here,
|
|
247
|
+
* whatever else it carries. Saying "unauthorized" is what tells a session-only
|
|
248
|
+
* caller — the case the token-only rule exists for — that it was refused for
|
|
249
|
+
* who it is rather than for how it was spelled.
|
|
250
|
+
*/
|
|
251
|
+
function queryToken(req, res) {
|
|
252
|
+
const token = typeof req.query.token === 'string' ? req.query.token : '';
|
|
253
|
+
if (!token) {
|
|
254
|
+
res.status(401).json({ error: TOKEN_REQUIRED });
|
|
255
|
+
return null;
|
|
256
|
+
}
|
|
257
|
+
return token;
|
|
258
|
+
}
|
|
259
|
+
/** What a tokenless request is told, on every embed data route. */
|
|
260
|
+
export const TOKEN_REQUIRED = 'This view needs its embed token. A session is not accepted here.';
|
|
261
|
+
/** Build a handler for a `{ token }`-body endpoint; a null result → 204. */
|
|
262
|
+
function tokenHandler(run) {
|
|
263
|
+
return async (req, res) => {
|
|
264
|
+
const token = req.body?.token;
|
|
265
|
+
if (typeof token !== 'string' || token === '') {
|
|
266
|
+
res.status(401).json({ error: TOKEN_REQUIRED });
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
try {
|
|
270
|
+
const result = await run(token);
|
|
271
|
+
if (result === null || result === undefined)
|
|
272
|
+
res.status(204).end();
|
|
273
|
+
else
|
|
274
|
+
res.json(result);
|
|
275
|
+
}
|
|
276
|
+
catch (err) {
|
|
277
|
+
sendJsonError(res, err);
|
|
278
|
+
}
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
/** Build a handler for a `{ token, content }`-body endpoint. */
|
|
282
|
+
function contentHandler(run) {
|
|
283
|
+
return async (req, res) => {
|
|
284
|
+
const b = req.body;
|
|
285
|
+
if (typeof b?.token !== 'string' || b.token === '') {
|
|
286
|
+
res.status(401).json({ error: TOKEN_REQUIRED });
|
|
287
|
+
return;
|
|
288
|
+
}
|
|
289
|
+
if (typeof b?.content !== 'string') {
|
|
290
|
+
res.status(400).json({ error: 'content is required' });
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
293
|
+
try {
|
|
294
|
+
const result = await run(b.token, b.content);
|
|
295
|
+
if (result === null || result === undefined)
|
|
296
|
+
res.status(204).end();
|
|
297
|
+
else
|
|
298
|
+
res.json(result);
|
|
299
|
+
}
|
|
300
|
+
catch (err) {
|
|
301
|
+
sendJsonError(res, err);
|
|
302
|
+
}
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
function statusFor(err) {
|
|
306
|
+
if (err instanceof EmbedTokenError)
|
|
307
|
+
return 401;
|
|
308
|
+
if (err instanceof EmbedAccessError)
|
|
309
|
+
return 403;
|
|
310
|
+
if (err instanceof EmbedNodeNotFoundError)
|
|
311
|
+
return 404;
|
|
312
|
+
if (err instanceof EmbedLockedError)
|
|
313
|
+
return 409;
|
|
314
|
+
if (err instanceof EmbedRefParseError)
|
|
315
|
+
return 400;
|
|
316
|
+
// A domain error from the workflow layer (a protected-branch refusal, a
|
|
317
|
+
// duplicate request) already carries the status it deserves.
|
|
318
|
+
const status = err?.status;
|
|
319
|
+
if (typeof status === 'number' && status >= 400 && status < 600)
|
|
320
|
+
return status;
|
|
321
|
+
return 500;
|
|
322
|
+
}
|
|
323
|
+
function messageFor(err) {
|
|
324
|
+
if (err instanceof EmbedTokenError ||
|
|
325
|
+
err instanceof EmbedAccessError ||
|
|
326
|
+
err instanceof EmbedNodeNotFoundError ||
|
|
327
|
+
err instanceof EmbedLockedError ||
|
|
328
|
+
err instanceof EmbedRefParseError) {
|
|
329
|
+
return err.message;
|
|
330
|
+
}
|
|
331
|
+
const status = err?.status;
|
|
332
|
+
if (typeof status === 'number' && status >= 400 && status < 500 && err instanceof Error) {
|
|
333
|
+
return err.message;
|
|
334
|
+
}
|
|
335
|
+
return 'Something went wrong.';
|
|
336
|
+
}
|
|
337
|
+
function sendJsonError(res, err) {
|
|
338
|
+
const status = statusFor(err);
|
|
339
|
+
if (status === 500)
|
|
340
|
+
console.error('[embed] unexpected error:', err);
|
|
341
|
+
res.status(status).json({ error: messageFor(err) });
|
|
342
|
+
}
|
|
343
|
+
//# sourceMappingURL=embed.routes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"embed.routes.js","sourceRoot":"","sources":["../../../src/modules/embed/embed.routes.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAE9B,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,sBAAsB,EACtB,eAAe,GAChB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,uCAAuC,CAAC;AACnF,OAAO,4BAA4B,CAAC,CAAC,+BAA+B;AAEpE;;;;GAIG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,MAAM,UAAU,iBAAiB,CAAC,YAA2B;IAC3D,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAEhC,4EAA4E;IAC5E,EAAE;IACF,2EAA2E;IAC3E,6EAA6E;IAC7E,4EAA4E;IAC5E,0EAA0E;IAC1E,UAAU;IACV,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;QACvC,GAAG,CAAC,YAAY,CAAC,iBAAiB,CAAC,CAAC;QACpC,yEAAyE;QACzE,sEAAsE;QACtE,MAAM,GAAG,GAAG,GAAG,CAAC,SAAS,CAAC,yBAAyB,CAAC,CAAC;QACrD,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;YAC5B,MAAM,IAAI,GAAG,GAAG;iBACb,KAAK,CAAC,GAAG,CAAC;iBACV,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;iBACpB,MAAM,CAAC,CAAC,CAAC,EAAE,EAA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Y,gBAAgB;QAC/B,GAAG,YAAY,sBAAsB;QACrC,GAAG,YAAY,gBAAgB;QAC/B,GAAG,YAAY,kBAAkB,EACjC,CAAC;QACD,OAAO,GAAG,CAAC,OAAO,CAAC;IACrB,CAAC;IACD,MAAM,MAAM,GAAI,GAA4B,EAAE,MAAM,CAAC;IACrD,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,IAAI,GAAG,IAAI,MAAM,GAAG,GAAG,IAAI,GAAG,YAAY,KAAK,EAAE,CAAC;QACxF,OAAO,GAAG,CAAC,OAAO,CAAC;IACrB,CAAC;IACD,OAAO,uBAAuB,CAAC;AACjC,CAAC;AAED,SAAS,aAAa,CAAC,GAAqB,EAAE,GAAY;IACxD,MAAM,MAAM,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC;IAC9B,IAAI,MAAM,KAAK,GAAG;QAAE,OAAO,CAAC,KAAK,CAAC,2BAA2B,EAAE,GAAG,CAAC,CAAC;IACpE,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;AACtD,CAAC"}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import type { IGitService, IWorkflowService } from '@bevel-software/platform-shared';
|
|
2
|
+
import type { KbContext } from '../../shared/kb-context.js';
|
|
3
|
+
import type { IAccessControl } from '../access/access-control.interface.js';
|
|
4
|
+
import type { FileReaderRegistry } from '../workspace/file-readers/file-reader.js';
|
|
5
|
+
import type { WriteValidator } from '../kb-fs/locking-filesystem.js';
|
|
6
|
+
import type { EmbedAuthPort, EmbedFileView, EmbedLinkedAccount, EmbedLockResult, EmbedNodeIdResolver, EmbedWorkspacePort, EmbedProposalResult, EmbedTokenResult, IEmbedService } from './embed.interface.js';
|
|
7
|
+
import type { IAccountLinkService } from './account-link.service.js';
|
|
8
|
+
/**
|
|
9
|
+
* Token lifetime — long enough for a view left open in a chat, short enough
|
|
10
|
+
* that a token copied out of a transcript stops working on its own. The
|
|
11
|
+
* token rides in `open_page`'s result, so it sits in the chat transcript, and
|
|
12
|
+
* whoever holds it reads and edits that one file as the token's user until
|
|
13
|
+
* it expires. One hour (Razvan, 2026-10-09; the embed used two before): a
|
|
14
|
+
* page left open in a chat is still covered, and the window is halved. A
|
|
15
|
+
* view older than that shows the expired sentence and the agent opens the
|
|
16
|
+
* page again.
|
|
17
|
+
*/
|
|
18
|
+
export declare const EMBED_TOKEN_TTL_SECONDS: number;
|
|
19
|
+
/** What the embed's config needs from the deployment's. */
|
|
20
|
+
export interface EmbedConfig {
|
|
21
|
+
readonly jwtSecret: string;
|
|
22
|
+
readonly embedSharedSecret: string;
|
|
23
|
+
readonly publicFrontendUrl: string;
|
|
24
|
+
readonly kbDirName: string;
|
|
25
|
+
}
|
|
26
|
+
export declare class EmbedService implements IEmbedService {
|
|
27
|
+
private readonly config;
|
|
28
|
+
private readonly kb;
|
|
29
|
+
private readonly workspaceService;
|
|
30
|
+
private readonly accessControl;
|
|
31
|
+
private readonly authService;
|
|
32
|
+
private readonly workflowService;
|
|
33
|
+
private readonly gitService;
|
|
34
|
+
private readonly accountLinks;
|
|
35
|
+
private readonly readers;
|
|
36
|
+
/**
|
|
37
|
+
* The pre-disk write gate every other write surface runs — the file
|
|
38
|
+
* editor's and the agent tools' `roles.yaml` validity check. An embed
|
|
39
|
+
* save or proposal writes through `workspaceService.writeFile`, which
|
|
40
|
+
* puts bytes on disk without one, so the gate is asked here first.
|
|
41
|
+
*/
|
|
42
|
+
private readonly validateWrite;
|
|
43
|
+
/** See {@link EmbedNodeIdResolver} — core has none, so core refuses an id reference. */
|
|
44
|
+
private readonly resolveNodeId;
|
|
45
|
+
/**
|
|
46
|
+
* Embed tokens are signed with a key DERIVED from the JWT secret (HMAC with
|
|
47
|
+
* a fixed label) rather than the secret itself — domain separation, so an
|
|
48
|
+
* embed token can never be replayed as a session JWT, nor the reverse. The
|
|
49
|
+
* label is part of the token format: changing it invalidates every live
|
|
50
|
+
* token, so it does not change.
|
|
51
|
+
*/
|
|
52
|
+
private readonly signingKey;
|
|
53
|
+
constructor(config: EmbedConfig, kb: KbContext, workspaceService: EmbedWorkspacePort, accessControl: IAccessControl, authService: EmbedAuthPort, workflowService: IWorkflowService, gitService: IGitService, accountLinks: IAccountLinkService, readers: FileReaderRegistry,
|
|
54
|
+
/**
|
|
55
|
+
* The pre-disk write gate every other write surface runs — the file
|
|
56
|
+
* editor's and the agent tools' `roles.yaml` validity check. An embed
|
|
57
|
+
* save or proposal writes through `workspaceService.writeFile`, which
|
|
58
|
+
* puts bytes on disk without one, so the gate is asked here first.
|
|
59
|
+
*/
|
|
60
|
+
validateWrite: WriteValidator,
|
|
61
|
+
/** See {@link EmbedNodeIdResolver} — core has none, so core refuses an id reference. */
|
|
62
|
+
resolveNodeId?: EmbedNodeIdResolver | null);
|
|
63
|
+
sharedSecretConfigured(): boolean;
|
|
64
|
+
verifySharedSecret(secret: string | undefined): boolean;
|
|
65
|
+
mintForUser(input: {
|
|
66
|
+
userId: string;
|
|
67
|
+
reference: string;
|
|
68
|
+
}): Promise<EmbedTokenResult>;
|
|
69
|
+
mintToken(input: {
|
|
70
|
+
accountId: string;
|
|
71
|
+
email?: string;
|
|
72
|
+
reference: string;
|
|
73
|
+
}): Promise<EmbedTokenResult>;
|
|
74
|
+
/**
|
|
75
|
+
* The one mint. Resolves the reference to a path on the default branch,
|
|
76
|
+
* confirms the FILE EXISTS, and signs the claims.
|
|
77
|
+
*
|
|
78
|
+
* Access is NOT checked here and must not be: the two callers check it
|
|
79
|
+
* their own way — `open_page` has already answered the caller the way
|
|
80
|
+
* `read_file` would (refusal and all) before it asks for a token, and the
|
|
81
|
+
* connector's mint is for an account that may not be linked to anyone yet.
|
|
82
|
+
* The load path gates content on the resolved identity's read access, which
|
|
83
|
+
* is the gate that decides what anybody sees.
|
|
84
|
+
*/
|
|
85
|
+
private mint;
|
|
86
|
+
/** The view's address — what a host frames. */
|
|
87
|
+
embedUrlFor(token: string): string;
|
|
88
|
+
/** A file's address in the app — what a link opens in a new tab. */
|
|
89
|
+
appUrlFor(repoRelative: string, slug?: string): string;
|
|
90
|
+
loadFile(token: string): Promise<EmbedFileView>;
|
|
91
|
+
/**
|
|
92
|
+
* Refuse to write text over a file whose bytes are not text: the reader
|
|
93
|
+
* that would show it answers a refusal, not the content, and a save would
|
|
94
|
+
* replace a binary with the viewer's draft.
|
|
95
|
+
*/
|
|
96
|
+
/** A file a page draws rather than a page: bytes no reader edits as text, or an SVG. */
|
|
97
|
+
private isAsset;
|
|
98
|
+
private assertTextEditable;
|
|
99
|
+
readBytes(token: string, path?: string): Promise<{
|
|
100
|
+
bytes: Buffer;
|
|
101
|
+
path: string;
|
|
102
|
+
}>;
|
|
103
|
+
acquireLock(token: string): Promise<EmbedLockResult>;
|
|
104
|
+
heartbeat(token: string): Promise<void>;
|
|
105
|
+
cancel(token: string): Promise<void>;
|
|
106
|
+
save(token: string, content: string): Promise<void>;
|
|
107
|
+
/**
|
|
108
|
+
* File the edit as a change request authored by the viewer, on their own
|
|
109
|
+
* personal suggestions branch — the same branch and the same one-request
|
|
110
|
+
* bundle the app's "Propose changes" uses, so a reader who proposes from a
|
|
111
|
+
* chat and from the app lands in one place.
|
|
112
|
+
*
|
|
113
|
+
* No lock: nothing touches the default branch, and the suggestions branch
|
|
114
|
+
* is this person's own.
|
|
115
|
+
*
|
|
116
|
+
* The write is COMMITTED here, synchronously, before the request is opened.
|
|
117
|
+
* `workspaceService.writeFile` only puts bytes on disk — the app's file
|
|
118
|
+
* routes commit by releasing the lock they took, which enqueues the commit
|
|
119
|
+
* for the background worker. Neither is usable here: without a commit the
|
|
120
|
+
* branch head never moves, and the request opens against a tree identical
|
|
121
|
+
* to its base — `changedFiles: 0`, and a reviewer told "this pull request
|
|
122
|
+
* has no file changes to approve" about a proposal that is sitting
|
|
123
|
+
* uncommitted on disk. An ENQUEUED commit has the same problem with a race
|
|
124
|
+
* on top of it. `commitChanges` commits and pushes before returning, which
|
|
125
|
+
* is what the one other server-side propose flow (the plugin join request)
|
|
126
|
+
* does for exactly this reason.
|
|
127
|
+
*/
|
|
128
|
+
propose(token: string, content: string): Promise<EmbedProposalResult>;
|
|
129
|
+
linkAccount(token: string, userId: string): Promise<void>;
|
|
130
|
+
listLinkedAccounts(userId: string): Promise<EmbedLinkedAccount[]>;
|
|
131
|
+
unlinkAccount(userId: string, accountId: string): Promise<boolean>;
|
|
132
|
+
/**
|
|
133
|
+
* Make sure `user` holds an EDIT lock on `wsPath` on the default branch:
|
|
134
|
+
* keep it when they already do, take it when nobody does (an expired row
|
|
135
|
+
* reads as none), refuse with the holder's name when somebody else does.
|
|
136
|
+
*/
|
|
137
|
+
private ensureHoldsLock;
|
|
138
|
+
private defaultWorkspaceId;
|
|
139
|
+
private wsPathFor;
|
|
140
|
+
/**
|
|
141
|
+
* A change request's address, through the same builder the workflow tools
|
|
142
|
+
* use — so a proposal made from a chat and one made by an agent point at
|
|
143
|
+
* the same place, path prefix of a proxied deployment included.
|
|
144
|
+
*/
|
|
145
|
+
private changeRequestUrl;
|
|
146
|
+
/**
|
|
147
|
+
* Resolve, authorize and locate an edit. Throws `EmbedAccessError` when the
|
|
148
|
+
* identity does not resolve or may not write. Returns the user (for lock
|
|
149
|
+
* attribution) and the workspace-relative path.
|
|
150
|
+
*/
|
|
151
|
+
private requireEditor;
|
|
152
|
+
/** Resolve the token's identity to a user + read/write verdicts. */
|
|
153
|
+
private resolveIdentity;
|
|
154
|
+
/** Whether `repoRelative` is a file on the default branch — a stat, never a read. */
|
|
155
|
+
private fileExists;
|
|
156
|
+
/** The typed 404 of {@link readFileBytes}, for a reference, without reading a byte. */
|
|
157
|
+
private assertExists;
|
|
158
|
+
private readFileBytes;
|
|
159
|
+
private verifyToken;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* A path written relative to `from`'s folder, resolved to a repo-relative
|
|
163
|
+
* path — or null when it escapes the repository or is otherwise unsafe.
|
|
164
|
+
* A path with a leading slash (`/x`) is taken from the repository root:
|
|
165
|
+
* that is the form the embed view sends, translating the workspace path a
|
|
166
|
+
* renderer hands it.
|
|
167
|
+
*/
|
|
168
|
+
export declare function resolveBeside(from: string, path: string): string | null;
|
|
169
|
+
//# sourceMappingURL=embed.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"embed.service.d.ts","sourceRoot":"","sources":["../../../src/modules/embed/embed.service.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAY,WAAW,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAI/F,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AAE5E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0CAA0C,CAAC;AACnF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,KAAK,EACV,aAAa,EACb,aAAa,EACb,kBAAkB,EAClB,eAAe,EACf,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EAEnB,gBAAgB,EAChB,aAAa,EACd,MAAM,sBAAsB,CAAC;AAQ9B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAIrE;;;;;;;;;GASG;AACH,eAAO,MAAM,uBAAuB,QAAU,CAAC;AAE/C,2DAA2D;AAC3D,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AA6BD,qBAAa,YAAa,YAAW,aAAa;IAW9C,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,EAAE;IACnB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