@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,50 @@
|
|
|
1
|
+
import { and, eq } from 'drizzle-orm';
|
|
2
|
+
import { atlassianAccountLinks } from '../database/schema.js';
|
|
3
|
+
export class AccountLinkService {
|
|
4
|
+
db;
|
|
5
|
+
constructor(db) {
|
|
6
|
+
this.db = db;
|
|
7
|
+
}
|
|
8
|
+
/** Resolve an account id to its linked Hexis user id, or null. */
|
|
9
|
+
async getUserId(accountId) {
|
|
10
|
+
const [row] = await this.db
|
|
11
|
+
.select()
|
|
12
|
+
.from(atlassianAccountLinks)
|
|
13
|
+
.where(eq(atlassianAccountLinks.atlassianAccountId, accountId))
|
|
14
|
+
.limit(1);
|
|
15
|
+
return row?.userId ?? null;
|
|
16
|
+
}
|
|
17
|
+
/** Link (or re-link) an account id to a Hexis user. Idempotent. */
|
|
18
|
+
async link(accountId, userId) {
|
|
19
|
+
await this.db
|
|
20
|
+
.insert(atlassianAccountLinks)
|
|
21
|
+
.values({ atlassianAccountId: accountId, userId })
|
|
22
|
+
.onConflictDoUpdate({
|
|
23
|
+
target: atlassianAccountLinks.atlassianAccountId,
|
|
24
|
+
set: { userId, updatedAt: new Date() },
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
/** Every account linked to `userId` (one per outside site). */
|
|
28
|
+
async listForUser(userId) {
|
|
29
|
+
return this.db
|
|
30
|
+
.select({
|
|
31
|
+
atlassianAccountId: atlassianAccountLinks.atlassianAccountId,
|
|
32
|
+
createdAt: atlassianAccountLinks.createdAt,
|
|
33
|
+
})
|
|
34
|
+
.from(atlassianAccountLinks)
|
|
35
|
+
.where(eq(atlassianAccountLinks.userId, userId));
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Remove one of `userId`'s links. Scoped to the owner — the userId
|
|
39
|
+
* condition makes deleting someone else's link structurally impossible,
|
|
40
|
+
* not a caller responsibility. Returns whether a row was actually removed.
|
|
41
|
+
*/
|
|
42
|
+
async unlink(userId, accountId) {
|
|
43
|
+
const deleted = await this.db
|
|
44
|
+
.delete(atlassianAccountLinks)
|
|
45
|
+
.where(and(eq(atlassianAccountLinks.atlassianAccountId, accountId), eq(atlassianAccountLinks.userId, userId)))
|
|
46
|
+
.returning({ atlassianAccountId: atlassianAccountLinks.atlassianAccountId });
|
|
47
|
+
return deleted.length > 0;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=account-link.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account-link.service.js","sourceRoot":"","sources":["../../../src/modules/embed/account-link.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AAEtC,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAqB9D,MAAM,OAAO,kBAAkB;IACA;IAA7B,YAA6B,EAAY;QAAZ,OAAE,GAAF,EAAE,CAAU;IAAG,CAAC;IAE7C,kEAAkE;IAClE,KAAK,CAAC,SAAS,CAAC,SAAiB;QAC/B,MAAM,CAAC,GAAG,CA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aACA,SAAS,CAAC,EAAE,kBAAkB,EAAE,qBAAqB,CAAC,kBAAkB,EAAE,CAAC,CAAC;QAC/E,OAAO,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC;IAC5B,CAAC;CACF"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A knowledge-base reference resolved from whatever a consumer hands the
|
|
3
|
+
* mint: a pasted app URL, a repo-relative path, or a bare node id.
|
|
4
|
+
*
|
|
5
|
+
* Two consumers share this grammar and must keep sharing it — the MCP
|
|
6
|
+
* `open_page` tool (a path, from a model) and the Atlassian connector (a
|
|
7
|
+
* `content:` marker, from a person pasting into a ticket). The mint contract
|
|
8
|
+
* is the boundary between Hexis and that connector's own repository, so this
|
|
9
|
+
* parse is the one part of the embed that may not change shape.
|
|
10
|
+
*/
|
|
11
|
+
/** A reference to a FILE, and optionally one heading inside it. */
|
|
12
|
+
export interface EmbedRef {
|
|
13
|
+
/** Repo-relative path, e.g. `Product/Knowledge/Thing.md`. */
|
|
14
|
+
repoRelative: string;
|
|
15
|
+
/** Heading anchor slug (e.g. `problem-statement`), or undefined for the whole file. */
|
|
16
|
+
slug?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* A node-id reference — the canonical copy-link form `/workspace/<branch>/<id>`.
|
|
20
|
+
* Core has no node graph to resolve an id with, so it is handed back for a
|
|
21
|
+
* deployment that does (see `EmbedNodeIdResolver`); without one the mint
|
|
22
|
+
* refuses it the way it refuses any unresolvable reference.
|
|
23
|
+
*/
|
|
24
|
+
export interface EmbedIdRef {
|
|
25
|
+
nodeId: string;
|
|
26
|
+
slug?: string;
|
|
27
|
+
}
|
|
28
|
+
/** Thrown when a reference can't be parsed into a safe path or an id. */
|
|
29
|
+
export declare class EmbedRefParseError extends Error {
|
|
30
|
+
constructor(message: string);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* A safe repo-relative embeddable path: rejects absolute paths, traversal,
|
|
34
|
+
* control characters and percent-encoded separators.
|
|
35
|
+
*
|
|
36
|
+
* Deliberately NO extension allowlist. The enterprise panel this grammar came
|
|
37
|
+
* from accepted `.md`, `.html` and `.htm` only, because those were the two
|
|
38
|
+
* things its own renderer could draw. The embed now renders with the APP's
|
|
39
|
+
* renderer for the file's type — every type the app renders, documents and
|
|
40
|
+
* images included — so an extension list here would be a second, narrower
|
|
41
|
+
* answer to "what can be shown", and the one that is wrong.
|
|
42
|
+
*/
|
|
43
|
+
export declare function isSafeRepoRelativeEmbedPath(repoRelative: string): boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Parse a reference into a file path or a node id. Accepts:
|
|
46
|
+
* - A full app URL: `https://<host>/workspace/<branch>/<kbDir>/<path>#<slug>`
|
|
47
|
+
* (also `/embed/<branch>/…`), optionally angle-bracketed and/or
|
|
48
|
+
* `content:`-prefixed.
|
|
49
|
+
* - A bare path, with or without a fragment: `<kbDir>/<path>#<slug>`,
|
|
50
|
+
* `<path>#<slug>`, or just `<path>` (whole file).
|
|
51
|
+
* - A bare node id (the copy-link form).
|
|
52
|
+
*
|
|
53
|
+
* The branch segment in a URL is intentionally ignored: the editable embed
|
|
54
|
+
* always targets the deployment's default branch. A missing `#slug` means
|
|
55
|
+
* "the whole file".
|
|
56
|
+
*/
|
|
57
|
+
export declare function parseEmbedRef(raw: string, kbDirName: string): EmbedRef | EmbedIdRef;
|
|
58
|
+
//# sourceMappingURL=embed-link.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"embed-link.d.ts","sourceRoot":"","sources":["../../../src/modules/embed/embed-link.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,mEAAmE;AACnE,MAAM,WAAW,QAAQ;IACvB,6DAA6D;IAC7D,YAAY,EAAE,MAAM,CAAC;IACrB,uFAAuF;IACvF,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;;GAKG;AACH,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAKD,yEAAyE;AACzE,qBAAa,kBAAmB,SAAQ,KAAK;gBAC/B,OAAO,EAAE,MAAM;CAI5B;AAWD;;;;;;;;;;GAUG;AACH,wBAAgB,2BAA2B,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAYzE;AA2BD;;;;;;;;;;;;GAYG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,QAAQ,GAAG,UAAU,CAkEnF"}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A knowledge-base reference resolved from whatever a consumer hands the
|
|
3
|
+
* mint: a pasted app URL, a repo-relative path, or a bare node id.
|
|
4
|
+
*
|
|
5
|
+
* Two consumers share this grammar and must keep sharing it — the MCP
|
|
6
|
+
* `open_page` tool (a path, from a model) and the Atlassian connector (a
|
|
7
|
+
* `content:` marker, from a person pasting into a ticket). The mint contract
|
|
8
|
+
* is the boundary between Hexis and that connector's own repository, so this
|
|
9
|
+
* parse is the one part of the embed that may not change shape.
|
|
10
|
+
*/
|
|
11
|
+
/** A node frontmatter id: lowercase alphanumeric + hyphens, no separators/dots. */
|
|
12
|
+
const NODE_ID_RE = /^[a-z0-9][a-z0-9-]*$/;
|
|
13
|
+
/** Thrown when a reference can't be parsed into a safe path or an id. */
|
|
14
|
+
export class EmbedRefParseError extends Error {
|
|
15
|
+
constructor(message) {
|
|
16
|
+
super(message);
|
|
17
|
+
this.name = 'EmbedRefParseError';
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
/** `decodeURIComponent` that turns a malformed escape into a parse error. */
|
|
21
|
+
function safeDecode(s) {
|
|
22
|
+
try {
|
|
23
|
+
return decodeURIComponent(s);
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
throw new EmbedRefParseError('Malformed percent-encoding in reference');
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* A safe repo-relative embeddable path: rejects absolute paths, traversal,
|
|
31
|
+
* control characters and percent-encoded separators.
|
|
32
|
+
*
|
|
33
|
+
* Deliberately NO extension allowlist. The enterprise panel this grammar came
|
|
34
|
+
* from accepted `.md`, `.html` and `.htm` only, because those were the two
|
|
35
|
+
* things its own renderer could draw. The embed now renders with the APP's
|
|
36
|
+
* renderer for the file's type — every type the app renders, documents and
|
|
37
|
+
* images included — so an extension list here would be a second, narrower
|
|
38
|
+
* answer to "what can be shown", and the one that is wrong.
|
|
39
|
+
*/
|
|
40
|
+
export function isSafeRepoRelativeEmbedPath(repoRelative) {
|
|
41
|
+
if (!repoRelative)
|
|
42
|
+
return false;
|
|
43
|
+
// eslint-disable-next-line no-control-regex
|
|
44
|
+
if (/[\x00-\x1f\x7f]/.test(repoRelative))
|
|
45
|
+
return false;
|
|
46
|
+
if (/%2e|%2f|%5c/i.test(repoRelative))
|
|
47
|
+
return false;
|
|
48
|
+
// A backslash is refused, not read as a separator: the workspace path
|
|
49
|
+
// validator refuses it too, so normalising it here would only move a
|
|
50
|
+
// malformed reference from this 400 to a later one.
|
|
51
|
+
if (repoRelative.includes('\\'))
|
|
52
|
+
return false;
|
|
53
|
+
const norm = repoRelative;
|
|
54
|
+
if (norm.startsWith('/'))
|
|
55
|
+
return false;
|
|
56
|
+
return norm.split('/').every((seg) => seg !== '' && seg !== '.' && seg !== '..');
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Whether a reference that parses as a safe path should instead be read as a
|
|
60
|
+
* node id.
|
|
61
|
+
*
|
|
62
|
+
* With the extension allowlist gone, `my-process` is BOTH a legal path and a
|
|
63
|
+
* legal id, so the two forms need a rule rather than a fallback. The rule is
|
|
64
|
+
* the shape the copy-link produces: an id is one segment with no dot in it
|
|
65
|
+
* (`/workspace/<branch>/<id>`). Anything with a separator or an extension is
|
|
66
|
+
* a path, which is every real file in the repository.
|
|
67
|
+
*/
|
|
68
|
+
function looksLikeNodeId(repoRelative) {
|
|
69
|
+
return !repoRelative.includes('/') && !repoRelative.includes('.') && NODE_ID_RE.test(repoRelative);
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* A separator spelled `%2F` or `%5C` is refused BEFORE decoding: decoded, it
|
|
73
|
+
* becomes a real `/` that the safe-path check can no longer tell from one
|
|
74
|
+
* the caller wrote, and `Data%2FThing.md` would name `Data/Thing.md`.
|
|
75
|
+
*/
|
|
76
|
+
function refuseEncodedSeparators(rawPath) {
|
|
77
|
+
if (/%2f|%5c/i.test(rawPath)) {
|
|
78
|
+
throw new EmbedRefParseError(`Not a safe knowledge-base path: ${rawPath}`);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Parse a reference into a file path or a node id. Accepts:
|
|
83
|
+
* - A full app URL: `https://<host>/workspace/<branch>/<kbDir>/<path>#<slug>`
|
|
84
|
+
* (also `/embed/<branch>/…`), optionally angle-bracketed and/or
|
|
85
|
+
* `content:`-prefixed.
|
|
86
|
+
* - A bare path, with or without a fragment: `<kbDir>/<path>#<slug>`,
|
|
87
|
+
* `<path>#<slug>`, or just `<path>` (whole file).
|
|
88
|
+
* - A bare node id (the copy-link form).
|
|
89
|
+
*
|
|
90
|
+
* The branch segment in a URL is intentionally ignored: the editable embed
|
|
91
|
+
* always targets the deployment's default branch. A missing `#slug` means
|
|
92
|
+
* "the whole file".
|
|
93
|
+
*/
|
|
94
|
+
export function parseEmbedRef(raw, kbDirName) {
|
|
95
|
+
if (typeof raw !== 'string' || raw.trim() === '') {
|
|
96
|
+
throw new EmbedRefParseError('Empty reference');
|
|
97
|
+
}
|
|
98
|
+
// A person pastes the marker, so the two decorations arrive in either order
|
|
99
|
+
// — `content: <url>` and `<content: url>` are both things a ticket holds.
|
|
100
|
+
// Peeled in a loop rather than in one fixed order, so neither spelling
|
|
101
|
+
// leaves a `content:` prefix inside the path (where it reads as a scheme and
|
|
102
|
+
// the whole reference is refused).
|
|
103
|
+
let ref = raw.trim();
|
|
104
|
+
for (let i = 0; i < 4; i += 1) {
|
|
105
|
+
const peeled = ref
|
|
106
|
+
.replace(/^content:\s*/i, '')
|
|
107
|
+
.replace(/^<+/, '')
|
|
108
|
+
.replace(/>+$/, '')
|
|
109
|
+
.trim();
|
|
110
|
+
if (peeled === ref)
|
|
111
|
+
break;
|
|
112
|
+
ref = peeled;
|
|
113
|
+
}
|
|
114
|
+
let pathPart;
|
|
115
|
+
let fragment;
|
|
116
|
+
if (/^https?:\/\//i.test(ref)) {
|
|
117
|
+
let url;
|
|
118
|
+
try {
|
|
119
|
+
url = new URL(ref);
|
|
120
|
+
}
|
|
121
|
+
catch {
|
|
122
|
+
throw new EmbedRefParseError(`Not a valid URL: ${ref}`);
|
|
123
|
+
}
|
|
124
|
+
fragment = safeDecode(url.hash.replace(/^#/, ''));
|
|
125
|
+
// The app's route (`workspace` or `embed`) is found wherever it sits: a
|
|
126
|
+
// deployment served under a path prefix carries it after the prefix,
|
|
127
|
+
// which is then not part of the file's path. The branch segment that
|
|
128
|
+
// follows it is ignored — and may carry an encoded separator, since a
|
|
129
|
+
// default branch named `team/main` is written `team%2Fmain` there; only
|
|
130
|
+
// the FILE path after it is held to the plain-separator rule.
|
|
131
|
+
const rawSegments = url.pathname.split('/').filter(Boolean);
|
|
132
|
+
// Matched DECODED (a route name may arrive percent-encoded), while the
|
|
133
|
+
// separator rule below reads the raw spelling.
|
|
134
|
+
const route = rawSegments.findIndex((s) => {
|
|
135
|
+
const decoded = safeDecode(s);
|
|
136
|
+
return decoded === 'workspace' || decoded === 'embed';
|
|
137
|
+
});
|
|
138
|
+
const rest = route >= 0 && rawSegments.length >= route + 3 ? rawSegments.slice(route + 2) : rawSegments;
|
|
139
|
+
refuseEncodedSeparators(rest.join('/'));
|
|
140
|
+
pathPart = rest.map((s) => safeDecode(s)).join('/');
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
const hashIndex = ref.indexOf('#');
|
|
144
|
+
fragment = hashIndex >= 0 ? safeDecode(ref.slice(hashIndex + 1)) : '';
|
|
145
|
+
const rawPath = hashIndex >= 0 ? ref.slice(0, hashIndex) : ref;
|
|
146
|
+
refuseEncodedSeparators(rawPath);
|
|
147
|
+
pathPart = rawPath.split('/').map((s) => safeDecode(s)).join('/');
|
|
148
|
+
}
|
|
149
|
+
let repoRelative = pathPart.replace(/^\.\//, '').replace(/^\/+/, '');
|
|
150
|
+
if (repoRelative.startsWith(`${kbDirName}/`)) {
|
|
151
|
+
repoRelative = repoRelative.slice(kbDirName.length + 1);
|
|
152
|
+
}
|
|
153
|
+
const slug = fragment.trim() || undefined;
|
|
154
|
+
if (looksLikeNodeId(repoRelative))
|
|
155
|
+
return { nodeId: repoRelative, slug };
|
|
156
|
+
if (isSafeRepoRelativeEmbedPath(repoRelative))
|
|
157
|
+
return { repoRelative, slug };
|
|
158
|
+
throw new EmbedRefParseError(`Not a safe knowledge-base path: ${pathPart}`);
|
|
159
|
+
}
|
|
160
|
+
//# sourceMappingURL=embed-link.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"embed-link.js","sourceRoot":"","sources":["../../../src/modules/embed/embed-link.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAqBH,mFAAmF;AACnF,MAAM,UAAU,GAAG,sBAAsB,CAAC;AAE1C,yEAAyE;AACzE,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IAC3C,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;IACnC,CAAC;CACF;AAED,6EAA6E;AAC7E,SAAS,UAAU,CAAC,CAAS;IAC3B,IAAI,CAAC;QACH,OAAO,kBAAkB,CAAC,CAAC,CAAC,CAAC;IAC/B,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,kBAAkB,CAAC,yCAAyC,CAAC,CAAC;IAC1E,CAAC;AACH,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAA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,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACrE,IAAI,YAAY,CAAC,UAAU,CAAC,GAAG,SAAS,GAAG,CAAC,EAAE,CAAC;QAC7C,YAAY,GAAG,YAAY,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAC1D,CAAC;IAED,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,EAAE,IAAI,SAAS,CAAC;IAE1C,IAAI,eAAe,CAAC,YAAY,CAAC;QAAE,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC;IACzE,IAAI,2BAA2B,CAAC,YAAY,CAAC;QAAE,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC;IAC7E,MAAM,IAAI,kBAAkB,CAAC,mCAAmC,QAAQ,EAAE,CAAC,CAAC;AAC9E,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/** The presented embed token is missing, malformed, or expired. */
|
|
2
|
+
export declare class EmbedTokenError extends Error {
|
|
3
|
+
constructor(message?: string);
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* The referenced file doesn't exist on the embed's target branch (→ 404).
|
|
7
|
+
* Raised at mint time for a dead reference and at load time when the file was
|
|
8
|
+
* renamed or removed after the token was minted. The message is user-facing —
|
|
9
|
+
* it is what the embedded view shows for the reference.
|
|
10
|
+
*/
|
|
11
|
+
export declare class EmbedNodeNotFoundError extends Error {
|
|
12
|
+
constructor(message: string);
|
|
13
|
+
}
|
|
14
|
+
/** The viewer lacks the access the operation needs on the default branch. */
|
|
15
|
+
export declare class EmbedAccessError extends Error {
|
|
16
|
+
constructor(message?: string);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Another editor holds the file lock, so a save can't proceed (→ 409). Raised
|
|
20
|
+
* when the viewer's own lock lapsed — a frame left hidden past the TTL — and
|
|
21
|
+
* somebody else took the file in the meantime.
|
|
22
|
+
*/
|
|
23
|
+
export declare class EmbedLockedError extends Error {
|
|
24
|
+
/** Display name / email of the current lock holder, for the UI. */
|
|
25
|
+
readonly heldBy: string;
|
|
26
|
+
constructor(
|
|
27
|
+
/** Display name / email of the current lock holder, for the UI. */
|
|
28
|
+
heldBy: string);
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=embed.errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"embed.errors.d.ts","sourceRoot":"","sources":["../../../src/modules/embed/embed.errors.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,qBAAa,eAAgB,SAAQ,KAAK;gBAC5B,OAAO,SAAmC;CAIvD;AAED;;;;;GAKG;AACH,qBAAa,sBAAuB,SAAQ,KAAK;gBACnC,OAAO,EAAE,MAAM;CAI5B;AAED,6EAA6E;AAC7E,qBAAa,gBAAiB,SAAQ,KAAK;gBAC7B,OAAO,SAA6C;CAIjE;AAED;;;;GAIG;AACH,qBAAa,gBAAiB,SAAQ,KAAK;IAEvC,mEAAmE;aACnD,MAAM,EAAE,MAAM;;IAD9B,mEAAmE;IACnD,MAAM,EAAE,MAAM;CAKjC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/** The presented embed token is missing, malformed, or expired. */
|
|
2
|
+
export class EmbedTokenError extends Error {
|
|
3
|
+
constructor(message = 'Invalid or expired embed token') {
|
|
4
|
+
super(message);
|
|
5
|
+
this.name = 'EmbedTokenError';
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* The referenced file doesn't exist on the embed's target branch (→ 404).
|
|
10
|
+
* Raised at mint time for a dead reference and at load time when the file was
|
|
11
|
+
* renamed or removed after the token was minted. The message is user-facing —
|
|
12
|
+
* it is what the embedded view shows for the reference.
|
|
13
|
+
*/
|
|
14
|
+
export class EmbedNodeNotFoundError extends Error {
|
|
15
|
+
constructor(message) {
|
|
16
|
+
super(message);
|
|
17
|
+
this.name = 'EmbedNodeNotFoundError';
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
/** The viewer lacks the access the operation needs on the default branch. */
|
|
21
|
+
export class EmbedAccessError extends Error {
|
|
22
|
+
constructor(message = 'You do not have edit access to this file') {
|
|
23
|
+
super(message);
|
|
24
|
+
this.name = 'EmbedAccessError';
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Another editor holds the file lock, so a save can't proceed (→ 409). Raised
|
|
29
|
+
* when the viewer's own lock lapsed — a frame left hidden past the TTL — and
|
|
30
|
+
* somebody else took the file in the meantime.
|
|
31
|
+
*/
|
|
32
|
+
export class EmbedLockedError extends Error {
|
|
33
|
+
heldBy;
|
|
34
|
+
constructor(
|
|
35
|
+
/** Display name / email of the current lock holder, for the UI. */
|
|
36
|
+
heldBy) {
|
|
37
|
+
super(`This file is currently being edited by ${heldBy}`);
|
|
38
|
+
this.heldBy = heldBy;
|
|
39
|
+
this.name = 'EmbedLockedError';
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=embed.errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"embed.errors.js","sourceRoot":"","sources":["../../../src/modules/embed/embed.errors.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,MAAM,OAAO,eAAgB,SAAQ,KAAK;IACxC,YAAY,OAAO,GAAG,gCAAgC;QACpD,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;IAChC,CAAC;CACF;AAED;;;;;GAKG;AACH,MAAM,OAAO,sBAAuB,SAAQ,KAAK;IAC/C,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,wBAAwB,CAAC;IACvC,CAAC;CACF;AAED,6EAA6E;AAC7E,MAAM,OAAO,gBAAiB,SAAQ,KAAK;IACzC,YAAY,OAAO,GAAG,0CAA0C;QAC9D,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;IACjC,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,OAAO,gBAAiB,SAAQ,KAAK;IAGvB;IAFlB;IACE,mEAAmE;IACnD,MAAc;QAE9B,KAAK,CAAC,0CAA0C,MAAM,EAAE,CAAC,CAAC;QAF1C,WAAM,GAAN,MAAM,CAAQ;QAG9B,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;IACjC,CAAC;CACF"}
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import type { AuthUser } from '@bevel-software/platform-shared';
|
|
2
|
+
/**
|
|
3
|
+
* WHO an embed token was minted for.
|
|
4
|
+
*
|
|
5
|
+
* Two kinds, and the difference is only how the identity is spelled:
|
|
6
|
+
*
|
|
7
|
+
* - `user` — a Hexis user id. What the MCP `open_page` tool mints: the MCP
|
|
8
|
+
* session already authenticated somebody (a signed-in user, or the owner
|
|
9
|
+
* of the connection key the agent carries), so the token names them
|
|
10
|
+
* outright and there is nothing to link.
|
|
11
|
+
* - `atlassian` — an outside account id, resolved to a Hexis user through
|
|
12
|
+
* the account-link table. What the Atlassian connector's mint produces,
|
|
13
|
+
* and the reason that table exists.
|
|
14
|
+
*
|
|
15
|
+
* Both resolve to one user, whose read and write access the view then obeys.
|
|
16
|
+
* Claims stay PSEUDONYMOUS whichever kind it is — a token travels as an
|
|
17
|
+
* iframe URL parameter, so it carries an id and never an address or a name.
|
|
18
|
+
*/
|
|
19
|
+
export type EmbedSubject = {
|
|
20
|
+
kind: 'user';
|
|
21
|
+
userId: string;
|
|
22
|
+
} | {
|
|
23
|
+
kind: 'atlassian';
|
|
24
|
+
accountId: string;
|
|
25
|
+
};
|
|
26
|
+
/** Result of minting an embed token for one file. */
|
|
27
|
+
export interface EmbedTokenResult {
|
|
28
|
+
/** Signed, short-lived token scoping the bearer to one file + heading + identity. */
|
|
29
|
+
token: string;
|
|
30
|
+
/** Ready-to-iframe URL: `<frontend>/embed?token=…` (the SPA embed route). */
|
|
31
|
+
embedUrl: string;
|
|
32
|
+
}
|
|
33
|
+
/** How the embed should render a file: with the app's renderer for its type. */
|
|
34
|
+
export interface EmbedFileView {
|
|
35
|
+
/** Display name — file basename without its extension. */
|
|
36
|
+
nodeName: string;
|
|
37
|
+
/** Repo-relative path of the embedded file. */
|
|
38
|
+
repoRelative: string;
|
|
39
|
+
/** Workspace-relative path (`<kbDir>/<repoRelative>`) — what the app's renderers take. */
|
|
40
|
+
workspacePath: string;
|
|
41
|
+
/** The knowledge-base directory name, so the view can build app URLs. */
|
|
42
|
+
kbDirName: string;
|
|
43
|
+
/** The branch rendered. Always the deployment's default branch. */
|
|
44
|
+
branch: string;
|
|
45
|
+
/** The file's address in the app, absolute. */
|
|
46
|
+
appUrl: string;
|
|
47
|
+
/** Heading slug this embed is scoped to; absent for a whole file. */
|
|
48
|
+
heading?: string;
|
|
49
|
+
/**
|
|
50
|
+
* The file's TEXT, for a renderer that takes text (markdown, HTML source,
|
|
51
|
+
* plain text, CSV, a `.tool`). Empty for a file whose renderer fetches its
|
|
52
|
+
* own bytes — an image, a PDF, a Word document — which read them from
|
|
53
|
+
* `GET /api/embed/raw` under this same token.
|
|
54
|
+
*/
|
|
55
|
+
content: string;
|
|
56
|
+
/**
|
|
57
|
+
* Whether `content` carries the file's text at all. False says "this
|
|
58
|
+
* renderer reads bytes": the difference between an empty file and a
|
|
59
|
+
* picture, which the view must not confuse.
|
|
60
|
+
*/
|
|
61
|
+
contentIsText: boolean;
|
|
62
|
+
/** Whether the token's identity resolved to a Hexis user at all. */
|
|
63
|
+
linked: boolean;
|
|
64
|
+
/** Whether that user may READ this file. Always false when unlinked. */
|
|
65
|
+
canRead: boolean;
|
|
66
|
+
/** Whether that user may WRITE this file on the default branch. */
|
|
67
|
+
canWrite: boolean;
|
|
68
|
+
/** Where to send an unlinked viewer to link their account. */
|
|
69
|
+
linkUrl: string;
|
|
70
|
+
}
|
|
71
|
+
/** Outcome of an Edit-time lock acquisition. */
|
|
72
|
+
export interface EmbedLockResult {
|
|
73
|
+
acquired: boolean;
|
|
74
|
+
/** Current holder's display name when `acquired` is false. */
|
|
75
|
+
holderName?: string;
|
|
76
|
+
}
|
|
77
|
+
/** Where a proposal landed, so the view can point at it. */
|
|
78
|
+
export interface EmbedProposalResult {
|
|
79
|
+
/** The suggestions branch the proposal was committed to. */
|
|
80
|
+
branch: string;
|
|
81
|
+
/** The change request number, when one could be read back. */
|
|
82
|
+
number?: number;
|
|
83
|
+
/** The change request's address in the app, when its number is known. */
|
|
84
|
+
url?: string;
|
|
85
|
+
}
|
|
86
|
+
/** One outside account linked to a Hexis user (the Connected apps screen). */
|
|
87
|
+
export interface EmbedLinkedAccount {
|
|
88
|
+
atlassianAccountId: string;
|
|
89
|
+
/** Epoch ms of when the link was created. */
|
|
90
|
+
createdAt: number;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Resolve a bare node id (the copy-link form `/workspace/<branch>/<id>`) to
|
|
94
|
+
* its repo-relative path, or null when no node has that id.
|
|
95
|
+
*
|
|
96
|
+
* Core has no node graph, so core refuses an id reference. A deployment that
|
|
97
|
+
* does keeps the Atlassian connector's id references working by registering
|
|
98
|
+
* one of these — the mint's only extension point, and the reason the connector
|
|
99
|
+
* needs no change when the embed moves into Hexis.
|
|
100
|
+
*/
|
|
101
|
+
export type EmbedNodeIdResolver = (nodeId: string) => Promise<string | null>;
|
|
102
|
+
/**
|
|
103
|
+
* What the embed service needs of the workspace: the clone of a branch, and
|
|
104
|
+
* four verbs on one file of it. A port rather than the workspace service
|
|
105
|
+
* itself, so a deployment (or a test) hands in whatever answers these.
|
|
106
|
+
*/
|
|
107
|
+
export interface EmbedWorkspacePort {
|
|
108
|
+
getOrCreateForBranch(branch: string): Promise<{
|
|
109
|
+
id: string;
|
|
110
|
+
}>;
|
|
111
|
+
isFile(workspaceId: string, wsPath: string): Promise<boolean>;
|
|
112
|
+
readFileBinary(workspaceId: string, wsPath: string): Promise<Buffer>;
|
|
113
|
+
writeFile(workspaceId: string, wsPath: string, content: string): Promise<void>;
|
|
114
|
+
/** One mutation at a time per resolved path, in this process: `op` runs after every turn already taken for `wsPath`. */
|
|
115
|
+
withPathTurn<T>(workspaceId: string, wsPath: string, op: () => Promise<T>): Promise<T>;
|
|
116
|
+
}
|
|
117
|
+
/** What the embed service needs of authentication: a user by id, and the email-domain rule. */
|
|
118
|
+
export interface EmbedAuthPort {
|
|
119
|
+
getUserById(userId: string): Promise<AuthUser | null>;
|
|
120
|
+
isEmailDomainAllowed(email: string): boolean;
|
|
121
|
+
/** Whether the account is on: it exists and no admin switched it off — the gate every credential passes. */
|
|
122
|
+
isActive(userId: string): Promise<boolean>;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Mints and consumes embed tokens that let a host — an MCP App's sandbox, an
|
|
126
|
+
* Atlassian panel — display and edit one knowledge-base file inside itself.
|
|
127
|
+
*
|
|
128
|
+
* The file is the source of truth: editing acquires the platform's file lock,
|
|
129
|
+
* saving writes to the default branch and releases it (which commits), and a
|
|
130
|
+
* viewer who may not write proposes instead, exactly as the app's file page
|
|
131
|
+
* does. The framed data methods — load, raw bytes, lock, heartbeat, cancel,
|
|
132
|
+
* save, propose — authenticate by the TOKEN and nothing else: no session is
|
|
133
|
+
* consulted, and a request that carries one without a token is refused. The
|
|
134
|
+
* account-management methods (`linkAccount`, `listLinkedAccounts`,
|
|
135
|
+
* `unlinkAccount`) are the exception, called from session-authenticated
|
|
136
|
+
* routes on a page no host may frame.
|
|
137
|
+
*/
|
|
138
|
+
export interface IEmbedService {
|
|
139
|
+
/**
|
|
140
|
+
* Whether the SHARED-SECRET mint (`POST /api/embed/token`) is configured.
|
|
141
|
+
*
|
|
142
|
+
* Only that one route: the embed surface itself is part of every deployment
|
|
143
|
+
* now, because the MCP App is, and its mint authenticates by the MCP
|
|
144
|
+
* session rather than by a secret. A deployment with no
|
|
145
|
+
* `EMBED_SHARED_SECRET` simply has no Atlassian connector pointed at it.
|
|
146
|
+
*/
|
|
147
|
+
sharedSecretConfigured(): boolean;
|
|
148
|
+
/** Constant-time check of the connector→backend shared secret. */
|
|
149
|
+
verifySharedSecret(secret: string | undefined): boolean;
|
|
150
|
+
/** Mint for a Hexis user — the MCP path. `reference` is a path or an app URL. */
|
|
151
|
+
mintForUser(input: {
|
|
152
|
+
userId: string;
|
|
153
|
+
reference: string;
|
|
154
|
+
}): Promise<EmbedTokenResult>;
|
|
155
|
+
/**
|
|
156
|
+
* Mint for an outside account — the Atlassian connector's path, unchanged.
|
|
157
|
+
* `email` is consulted only by the allowed-email-domains gate and never
|
|
158
|
+
* enters the token.
|
|
159
|
+
*/
|
|
160
|
+
mintToken(input: {
|
|
161
|
+
accountId: string;
|
|
162
|
+
email?: string;
|
|
163
|
+
reference: string;
|
|
164
|
+
}): Promise<EmbedTokenResult>;
|
|
165
|
+
/** Load the file the token is scoped to, with the viewer's read/write status. */
|
|
166
|
+
loadFile(token: string): Promise<EmbedFileView>;
|
|
167
|
+
/**
|
|
168
|
+
* The raw bytes of the embedded file, or of one asset `path` beside it (an
|
|
169
|
+
* image a markdown page shows — a file no reader edits as text, or an SVG,
|
|
170
|
+
* the one text format a page draws as a picture), for the app renderers
|
|
171
|
+
* that read bytes rather than the text buffer. Gated on the token
|
|
172
|
+
* identity's read access, per file. Any other text page than the embedded
|
|
173
|
+
* one is refused: the token scopes the view to ONE page, and another page
|
|
174
|
+
* opens in the app, never through this view's token.
|
|
175
|
+
*/
|
|
176
|
+
readBytes(token: string, path?: string): Promise<{
|
|
177
|
+
bytes: Buffer;
|
|
178
|
+
path: string;
|
|
179
|
+
}>;
|
|
180
|
+
/** Acquire the edit lock (Edit clicked). Requires write access. */
|
|
181
|
+
acquireLock(token: string): Promise<EmbedLockResult>;
|
|
182
|
+
/** Keep a held lock alive while editing. */
|
|
183
|
+
heartbeat(token: string): Promise<void>;
|
|
184
|
+
/** Drop the lock without committing (Cancel / view closed). */
|
|
185
|
+
cancel(token: string): Promise<void>;
|
|
186
|
+
/** Write `content` to the default branch, then release the lock (commits). */
|
|
187
|
+
save(token: string, content: string): Promise<void>;
|
|
188
|
+
/**
|
|
189
|
+
* File `content` as a change request authored by the token's identity, on
|
|
190
|
+
* that person's own suggestions branch. What a viewer without write access
|
|
191
|
+
* does instead of saving; nothing lands on the default branch.
|
|
192
|
+
*/
|
|
193
|
+
propose(token: string, content: string): Promise<EmbedProposalResult>;
|
|
194
|
+
/** Link the token's outside account to `userId` (called after sign-in). */
|
|
195
|
+
linkAccount(token: string, userId: string): Promise<void>;
|
|
196
|
+
/** The outside accounts linked to `userId`, for the Connected apps screen. */
|
|
197
|
+
listLinkedAccounts(userId: string): Promise<EmbedLinkedAccount[]>;
|
|
198
|
+
/**
|
|
199
|
+
* Remove one of `userId`'s links (self-service disconnect / erasure).
|
|
200
|
+
* False when the account isn't linked to this user.
|
|
201
|
+
*/
|
|
202
|
+
unlinkAccount(userId: string, accountId: string): Promise<boolean>;
|
|
203
|
+
}
|
|
204
|
+
//# sourceMappingURL=embed.interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"embed.interface.d.ts","sourceRoot":"","sources":["../../../src/modules/embed/embed.interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAEhE;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,YAAY,GACpB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAChC;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC;AAE7C,qDAAqD;AACrD,MAAM,WAAW,gBAAgB;IAC/B,qFAAqF;IACrF,KAAK,EAAE,MAAM,CAAC;IACd,6EAA6E;IAC7E,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,gFAAgF;AAChF,MAAM,WAAW,aA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}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"embed.interface.js","sourceRoot":"","sources":["../../../src/modules/embed/embed.interface.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import express from 'express';
|
|
2
|
+
import type { IEmbedService } from './embed.interface.js';
|
|
3
|
+
import '../auth/auth.middleware.js';
|
|
4
|
+
/**
|
|
5
|
+
* What `/api/embed/raw` answers as `Content-Type`, by extension — the types a
|
|
6
|
+
* renderer draws from a URL. Anything else is bytes the renderer parses
|
|
7
|
+
* itself (a workbook, a deck), served as the octet stream it is.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* The embed surface: a token-minted, pseudonymous, short-lived page that
|
|
11
|
+
* renders ONE knowledge-base file with the app's own renderer, inside
|
|
12
|
+
* somebody else's frame — an MCP App's sandbox in a chat, an Atlassian issue
|
|
13
|
+
* panel. Two routers, with deliberately different auth stories:
|
|
14
|
+
*
|
|
15
|
+
* - {@link createEmbedRoutes} (mounted at the app root, ahead of the JWT
|
|
16
|
+
* middleware): the connector's shared-secret mint, and the TOKEN-ONLY data
|
|
17
|
+
* routes the SPA `/embed` page calls. Also stamps the framing headers on
|
|
18
|
+
* the two SPA routes.
|
|
19
|
+
* - {@link createEmbedLinkRoutes} (mounted under the JWT middleware): links
|
|
20
|
+
* the viewer's outside account to their just-authenticated Hexis user.
|
|
21
|
+
*
|
|
22
|
+
* Mounted before the production static catch-all, so the framing headers are
|
|
23
|
+
* stamped before `index.html` is served for `/embed*`.
|
|
24
|
+
*
|
|
25
|
+
* ── Why the data routes take the token and NOTHING else ───────────────────
|
|
26
|
+
*
|
|
27
|
+
* The embed page is framed by any site (see the framing headers below), which
|
|
28
|
+
* is what makes it work in every host's sandbox without an admin entry per
|
|
29
|
+
* host. The security of the embed therefore rests entirely on the token:
|
|
30
|
+
* short-lived, scoped to one file and one identity, pseudonymous. A session
|
|
31
|
+
* FALLBACK would hand that away — a hostile page could frame `/embed`, and
|
|
32
|
+
* the browser would attach the visitor's own cookie to every data request the
|
|
33
|
+
* page made, so the attacker's frame would read and write as the victim. So
|
|
34
|
+
* every route here reads `token` and never `req.userId`: a request carrying a
|
|
35
|
+
* perfectly valid session and no token is refused.
|
|
36
|
+
*
|
|
37
|
+
* ── Cross-origin callers ──────────────────────────────────────────────────
|
|
38
|
+
*
|
|
39
|
+
* The MCP App view runs the embed inside a chat host's SANDBOX — another
|
|
40
|
+
* origin, unknowable in advance (a hash subdomain under Claude's content
|
|
41
|
+
* domain, a URL-derived one under ChatGPT's) — and calls the token routes
|
|
42
|
+
* from there. Nothing here has to allow that: the server's app-wide CORS
|
|
43
|
+
* (`create-core-server.ts`, mounted ahead of this router) already reflects
|
|
44
|
+
* any origin and answers the preflight, for every route. That is safe on the
|
|
45
|
+
* token routes for the reason the token-only rule exists: CORS guards a
|
|
46
|
+
* browser's ambient credentials, these routes take none, and the token in
|
|
47
|
+
* the request is the whole credential. The routes test mounts the same CORS
|
|
48
|
+
* to pin that a cross-origin caller gets through.
|
|
49
|
+
*/
|
|
50
|
+
export declare function createEmbedRoutes(embedService: IEmbedService): express.Router;
|
|
51
|
+
/**
|
|
52
|
+
* Links the authenticated Hexis user to the outside account the embed token
|
|
53
|
+
* carries. JWT-protected — `req.userId` is the user we link TO, which is why
|
|
54
|
+
* the page it is called from refuses every framing ancestor.
|
|
55
|
+
*/
|
|
56
|
+
export declare function createEmbedLinkRoutes(embedService: IEmbedService): express.Router;
|
|
57
|
+
/** What a tokenless request is told, on every embed data route. */
|
|
58
|
+
export declare const TOKEN_REQUIRED = "This view needs its embed token. A session is not accepted here.";
|
|
59
|
+
//# sourceMappingURL=embed.routes.d.ts.map
|