@bevel-software/platform-core-backend 0.14.0 → 0.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/THIRD-PARTY-NOTICES.md +6 -6
- package/dist/core/catalog-cache-invalidation.d.ts +29 -0
- package/dist/core/catalog-cache-invalidation.d.ts.map +1 -0
- package/dist/core/catalog-cache-invalidation.js +71 -0
- package/dist/core/catalog-cache-invalidation.js.map +1 -0
- package/dist/core/create-core-server.d.ts.map +1 -1
- package/dist/core/create-core-server.js +99 -8
- package/dist/core/create-core-server.js.map +1 -1
- package/dist/core/create-core-services.d.ts +18 -1
- package/dist/core/create-core-services.d.ts.map +1 -1
- package/dist/core/create-core-services.js +96 -43
- package/dist/core/create-core-services.js.map +1 -1
- package/dist/modules/access/access-control.interface.d.ts +18 -6
- package/dist/modules/access/access-control.interface.d.ts.map +1 -1
- package/dist/modules/access/access-control.service.d.ts +26 -1
- package/dist/modules/access/access-control.service.d.ts.map +1 -1
- package/dist/modules/access/access-control.service.js +213 -71
- package/dist/modules/access/access-control.service.js.map +1 -1
- package/dist/modules/access/access.routes.d.ts.map +1 -1
- package/dist/modules/access/access.routes.js +59 -7
- package/dist/modules/access/access.routes.js.map +1 -1
- package/dist/modules/access-model/access-grammar.d.ts +51 -1
- package/dist/modules/access-model/access-grammar.d.ts.map +1 -1
- package/dist/modules/access-model/access-grammar.js +95 -1
- package/dist/modules/access-model/access-grammar.js.map +1 -1
- package/dist/modules/access-model/group-files.d.ts.map +1 -1
- package/dist/modules/access-model/group-files.js +4 -1
- package/dist/modules/access-model/group-files.js.map +1 -1
- package/dist/modules/access-model/plugin-principals.d.ts +49 -0
- package/dist/modules/access-model/plugin-principals.d.ts.map +1 -0
- package/dist/modules/access-model/plugin-principals.js +125 -0
- package/dist/modules/access-model/plugin-principals.js.map +1 -0
- package/dist/modules/database/core-schema.d.ts +326 -0
- package/dist/modules/database/core-schema.d.ts.map +1 -1
- package/dist/modules/database/core-schema.js +52 -0
- package/dist/modules/database/core-schema.js.map +1 -1
- package/dist/modules/kb-sync/index.d.ts +6 -0
- package/dist/modules/kb-sync/index.d.ts.map +1 -0
- package/dist/modules/kb-sync/index.js +5 -0
- package/dist/modules/kb-sync/index.js.map +1 -0
- package/dist/modules/kb-sync/kb-sync.interface.d.ts +77 -0
- package/dist/modules/kb-sync/kb-sync.interface.d.ts.map +1 -0
- package/dist/modules/kb-sync/kb-sync.interface.js +2 -0
- package/dist/modules/kb-sync/kb-sync.interface.js.map +1 -0
- package/dist/modules/kb-sync/kb-sync.routes.d.ts +70 -0
- package/dist/modules/kb-sync/kb-sync.routes.d.ts.map +1 -0
- package/dist/modules/kb-sync/kb-sync.routes.js +135 -0
- package/dist/modules/kb-sync/kb-sync.routes.js.map +1 -0
- package/dist/modules/kb-sync/kb-sync.service.d.ts +45 -0
- package/dist/modules/kb-sync/kb-sync.service.d.ts.map +1 -0
- package/dist/modules/kb-sync/kb-sync.service.js +183 -0
- package/dist/modules/kb-sync/kb-sync.service.js.map +1 -0
- package/dist/modules/kb-sync/sync-auth.d.ts +59 -0
- package/dist/modules/kb-sync/sync-auth.d.ts.map +1 -0
- package/dist/modules/kb-sync/sync-auth.js +62 -0
- package/dist/modules/kb-sync/sync-auth.js.map +1 -0
- package/dist/modules/kb-sync/sync-payload.d.ts +32 -0
- package/dist/modules/kb-sync/sync-payload.d.ts.map +1 -0
- package/dist/modules/kb-sync/sync-payload.js +105 -0
- package/dist/modules/kb-sync/sync-payload.js.map +1 -0
- package/dist/modules/marketplace/git-http.routes.d.ts +42 -0
- package/dist/modules/marketplace/git-http.routes.d.ts.map +1 -0
- package/dist/modules/marketplace/git-http.routes.js +190 -0
- package/dist/modules/marketplace/git-http.routes.js.map +1 -0
- package/dist/modules/marketplace/github-facade/github-facade-admin.routes.d.ts +23 -0
- package/dist/modules/marketplace/github-facade/github-facade-admin.routes.d.ts.map +1 -0
- package/dist/modules/marketplace/github-facade/github-facade-admin.routes.js +59 -0
- package/dist/modules/marketplace/github-facade/github-facade-admin.routes.js.map +1 -0
- package/dist/modules/marketplace/github-facade/github-facade-codes.store.d.ts +59 -0
- package/dist/modules/marketplace/github-facade/github-facade-codes.store.d.ts.map +1 -0
- package/dist/modules/marketplace/github-facade/github-facade-codes.store.js +96 -0
- package/dist/modules/marketplace/github-facade/github-facade-codes.store.js.map +1 -0
- package/dist/modules/marketplace/github-facade/github-facade-credentials.service.d.ts +99 -0
- package/dist/modules/marketplace/github-facade/github-facade-credentials.service.d.ts.map +1 -0
- package/dist/modules/marketplace/github-facade/github-facade-credentials.service.js +147 -0
- package/dist/modules/marketplace/github-facade/github-facade-credentials.service.js.map +1 -0
- package/dist/modules/marketplace/github-facade/github-facade.routes.d.ts +47 -0
- package/dist/modules/marketplace/github-facade/github-facade.routes.d.ts.map +1 -0
- package/dist/modules/marketplace/github-facade/github-facade.routes.js +228 -0
- package/dist/modules/marketplace/github-facade/github-facade.routes.js.map +1 -0
- package/dist/modules/marketplace/github-facade/github-facade.service.d.ts +109 -0
- package/dist/modules/marketplace/github-facade/github-facade.service.d.ts.map +1 -0
- package/dist/modules/marketplace/github-facade/github-facade.service.js +172 -0
- package/dist/modules/marketplace/github-facade/github-facade.service.js.map +1 -0
- package/dist/modules/marketplace/github-facade/index.d.ts +6 -0
- package/dist/modules/marketplace/github-facade/index.d.ts.map +1 -0
- package/dist/modules/marketplace/github-facade/index.js +6 -0
- package/dist/modules/marketplace/github-facade/index.js.map +1 -0
- package/dist/modules/marketplace/index.d.ts +4 -0
- package/dist/modules/marketplace/index.d.ts.map +1 -0
- package/dist/modules/marketplace/index.js +4 -0
- package/dist/modules/marketplace/index.js.map +1 -0
- package/dist/modules/marketplace/marketplace-repo.service.d.ts +122 -0
- package/dist/modules/marketplace/marketplace-repo.service.d.ts.map +1 -0
- package/dist/modules/marketplace/marketplace-repo.service.js +300 -0
- package/dist/modules/marketplace/marketplace-repo.service.js.map +1 -0
- package/dist/modules/mcp/oauth/bevel-oauth-provider.d.ts.map +1 -1
- package/dist/modules/mcp/oauth/bevel-oauth-provider.js +4 -0
- package/dist/modules/mcp/oauth/bevel-oauth-provider.js.map +1 -1
- package/dist/modules/mcp/oauth/oauth-consent.routes.d.ts +14 -8
- package/dist/modules/mcp/oauth/oauth-consent.routes.d.ts.map +1 -1
- package/dist/modules/mcp/oauth/oauth-consent.routes.js +13 -1
- package/dist/modules/mcp/oauth/oauth-consent.routes.js.map +1 -1
- package/dist/modules/mcp/oauth/oauth-state.d.ts +13 -2
- package/dist/modules/mcp/oauth/oauth-state.d.ts.map +1 -1
- package/dist/modules/mcp/oauth/oauth-state.js +3 -1
- package/dist/modules/mcp/oauth/oauth-state.js.map +1 -1
- package/dist/modules/plugins/compile/compile-marketplace.d.ts +97 -0
- package/dist/modules/plugins/compile/compile-marketplace.d.ts.map +1 -0
- package/dist/modules/plugins/compile/compile-marketplace.js +240 -0
- package/dist/modules/plugins/compile/compile-marketplace.js.map +1 -0
- package/dist/modules/plugins/compile/marketplace-compiler.service.d.ts +66 -0
- package/dist/modules/plugins/compile/marketplace-compiler.service.d.ts.map +1 -0
- package/dist/modules/plugins/compile/marketplace-compiler.service.js +132 -0
- package/dist/modules/plugins/compile/marketplace-compiler.service.js.map +1 -0
- package/dist/modules/plugins/discovery/bundle-dialect/bundle.source.d.ts +37 -0
- package/dist/modules/plugins/discovery/bundle-dialect/bundle.source.d.ts.map +1 -0
- package/dist/modules/plugins/discovery/bundle-dialect/bundle.source.js +135 -0
- package/dist/modules/plugins/discovery/bundle-dialect/bundle.source.js.map +1 -0
- package/dist/modules/plugins/discovery/bundle-dialect/registry.d.ts +45 -0
- package/dist/modules/plugins/discovery/bundle-dialect/registry.d.ts.map +1 -0
- package/dist/modules/plugins/discovery/bundle-dialect/registry.js +147 -0
- package/dist/modules/plugins/discovery/bundle-dialect/registry.js.map +1 -0
- package/dist/modules/plugins/discovery/kb-plugin-source.d.ts +37 -0
- package/dist/modules/plugins/discovery/kb-plugin-source.d.ts.map +1 -0
- package/dist/modules/plugins/discovery/kb-plugin-source.js +107 -0
- package/dist/modules/plugins/discovery/kb-plugin-source.js.map +1 -0
- package/dist/modules/plugins/discovery/native.source.d.ts +15 -0
- package/dist/modules/plugins/discovery/native.source.d.ts.map +1 -0
- package/dist/modules/plugins/discovery/native.source.js +102 -0
- package/dist/modules/plugins/discovery/native.source.js.map +1 -0
- package/dist/modules/plugins/discovery/plugin-source.d.ts +96 -0
- package/dist/modules/plugins/discovery/plugin-source.d.ts.map +1 -0
- package/dist/modules/plugins/discovery/plugin-source.js +2 -0
- package/dist/modules/plugins/discovery/plugin-source.js.map +1 -0
- package/dist/modules/plugins/index.d.ts +10 -1
- package/dist/modules/plugins/index.d.ts.map +1 -1
- package/dist/modules/plugins/index.js +8 -0
- package/dist/modules/plugins/index.js.map +1 -1
- package/dist/modules/plugins/plugin-links.d.ts +66 -0
- package/dist/modules/plugins/plugin-links.d.ts.map +1 -0
- package/dist/modules/plugins/plugin-links.js +160 -0
- package/dist/modules/plugins/plugin-links.js.map +1 -0
- package/dist/modules/plugins/plugin-links.service.d.ts +114 -0
- package/dist/modules/plugins/plugin-links.service.d.ts.map +1 -0
- package/dist/modules/plugins/plugin-links.service.js +304 -0
- package/dist/modules/plugins/plugin-links.service.js.map +1 -0
- package/dist/modules/plugins/plugin-provision.service.d.ts +39 -3
- package/dist/modules/plugins/plugin-provision.service.d.ts.map +1 -1
- package/dist/modules/plugins/plugin-provision.service.js +152 -52
- package/dist/modules/plugins/plugin-provision.service.js.map +1 -1
- package/dist/modules/plugins/plugin-rename.service.d.ts +69 -0
- package/dist/modules/plugins/plugin-rename.service.d.ts.map +1 -0
- package/dist/modules/plugins/plugin-rename.service.js +245 -0
- package/dist/modules/plugins/plugin-rename.service.js.map +1 -0
- package/dist/modules/plugins/plugins.contract.d.ts +27 -1
- package/dist/modules/plugins/plugins.contract.d.ts.map +1 -1
- package/dist/modules/plugins/plugins.routes.d.ts +7 -1
- package/dist/modules/plugins/plugins.routes.d.ts.map +1 -1
- package/dist/modules/plugins/plugins.routes.js +120 -12
- package/dist/modules/plugins/plugins.routes.js.map +1 -1
- package/dist/modules/plugins/plugins.service.d.ts +50 -3
- package/dist/modules/plugins/plugins.service.d.ts.map +1 -1
- package/dist/modules/plugins/plugins.service.js +108 -47
- package/dist/modules/plugins/plugins.service.js.map +1 -1
- package/dist/modules/settings/deployment-settings.service.d.ts +9 -0
- package/dist/modules/settings/deployment-settings.service.d.ts.map +1 -1
- package/dist/modules/settings/deployment-settings.service.js +82 -2
- package/dist/modules/settings/deployment-settings.service.js.map +1 -1
- package/dist/modules/settings/setup.routes.d.ts +26 -0
- package/dist/modules/settings/setup.routes.d.ts.map +1 -1
- package/dist/modules/settings/setup.routes.js +9 -1
- package/dist/modules/settings/setup.routes.js.map +1 -1
- package/dist/modules/skills/index.d.ts +1 -0
- package/dist/modules/skills/index.d.ts.map +1 -1
- package/dist/modules/skills/index.js +1 -0
- package/dist/modules/skills/index.js.map +1 -1
- package/dist/modules/skills/pending-skills.service.d.ts.map +1 -1
- package/dist/modules/skills/pending-skills.service.js +9 -4
- package/dist/modules/skills/pending-skills.service.js.map +1 -1
- package/dist/modules/skills/skill-access-requests.routes.d.ts +38 -0
- package/dist/modules/skills/skill-access-requests.routes.d.ts.map +1 -0
- package/dist/modules/skills/skill-access-requests.routes.js +168 -0
- package/dist/modules/skills/skill-access-requests.routes.js.map +1 -0
- package/dist/modules/skills/skills.contract.d.ts +31 -0
- package/dist/modules/skills/skills.contract.d.ts.map +1 -1
- package/dist/modules/skills/skills.routes.d.ts +28 -3
- package/dist/modules/skills/skills.routes.d.ts.map +1 -1
- package/dist/modules/skills/skills.routes.js +42 -3
- package/dist/modules/skills/skills.routes.js.map +1 -1
- package/dist/modules/skills/skills.service.d.ts +4 -0
- package/dist/modules/skills/skills.service.d.ts.map +1 -1
- package/dist/modules/skills/skills.service.js +83 -22
- package/dist/modules/skills/skills.service.js.map +1 -1
- package/dist/modules/tool-auth/external-api-key.interface.d.ts +18 -1
- package/dist/modules/tool-auth/external-api-key.interface.d.ts.map +1 -1
- package/dist/modules/tool-auth/external-api-key.interface.js +2 -1
- package/dist/modules/tool-auth/external-api-key.interface.js.map +1 -1
- package/dist/modules/tool-auth/external-api-key.service.d.ts +13 -4
- package/dist/modules/tool-auth/external-api-key.service.d.ts.map +1 -1
- package/dist/modules/tool-auth/external-api-key.service.js +26 -9
- package/dist/modules/tool-auth/external-api-key.service.js.map +1 -1
- package/dist/modules/tool-manuals/mcp-json-discovery.d.ts +36 -0
- package/dist/modules/tool-manuals/mcp-json-discovery.d.ts.map +1 -1
- package/dist/modules/tool-manuals/mcp-json-discovery.js +130 -92
- package/dist/modules/tool-manuals/mcp-json-discovery.js.map +1 -1
- package/dist/modules/tool-manuals/tool-manuals.service.d.ts +6 -1
- package/dist/modules/tool-manuals/tool-manuals.service.d.ts.map +1 -1
- package/dist/modules/tool-manuals/tool-manuals.service.js +18 -25
- package/dist/modules/tool-manuals/tool-manuals.service.js.map +1 -1
- package/dist/modules/workflow/git/git.service.d.ts +40 -2
- package/dist/modules/workflow/git/git.service.d.ts.map +1 -1
- package/dist/modules/workflow/git/git.service.js +227 -54
- package/dist/modules/workflow/git/git.service.js.map +1 -1
- package/dist/modules/workflow/git/pull-request.service.d.ts +6 -0
- package/dist/modules/workflow/git/pull-request.service.d.ts.map +1 -1
- package/dist/modules/workflow/git/pull-request.service.js +8 -0
- package/dist/modules/workflow/git/pull-request.service.js.map +1 -1
- package/dist/modules/workflow/workflow.service.d.ts +52 -1
- package/dist/modules/workflow/workflow.service.d.ts.map +1 -1
- package/dist/modules/workflow/workflow.service.js +242 -9
- package/dist/modules/workflow/workflow.service.js.map +1 -1
- package/dist/modules/workspace/startup/steps/plugin-manifests.step.d.ts +35 -0
- package/dist/modules/workspace/startup/steps/plugin-manifests.step.d.ts.map +1 -0
- package/dist/modules/workspace/startup/steps/plugin-manifests.step.js +121 -0
- package/dist/modules/workspace/startup/steps/plugin-manifests.step.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 +46 -2
- package/dist/modules/workspace/startup/steps/seed-tree.js.map +1 -1
- package/dist/modules/workspace/startup/steps/template-files.step.d.ts.map +1 -1
- package/dist/modules/workspace/startup/steps/template-files.step.js +112 -25
- package/dist/modules/workspace/startup/steps/template-files.step.js.map +1 -1
- package/dist/modules/workspace/workspace.routes.d.ts.map +1 -1
- package/dist/modules/workspace/workspace.routes.js +9 -9
- package/dist/modules/workspace/workspace.routes.js.map +1 -1
- package/dist/modules/workspace/workspace.service.d.ts +33 -0
- package/dist/modules/workspace/workspace.service.d.ts.map +1 -1
- package/dist/modules/workspace/workspace.service.js +110 -16
- package/dist/modules/workspace/workspace.service.js.map +1 -1
- package/dist/shared/domain-errors.d.ts +20 -0
- package/dist/shared/domain-errors.d.ts.map +1 -1
- package/dist/shared/domain-errors.js +29 -0
- package/dist/shared/domain-errors.js.map +1 -1
- package/dist/shared/fs-errors.d.ts +8 -0
- package/dist/shared/fs-errors.d.ts.map +1 -0
- package/dist/shared/fs-errors.js +11 -0
- package/dist/shared/fs-errors.js.map +1 -0
- package/dist/shared/fs-walk.d.ts +20 -6
- package/dist/shared/fs-walk.d.ts.map +1 -1
- package/dist/shared/fs-walk.js +35 -27
- package/dist/shared/fs-walk.js.map +1 -1
- package/dist/shared/kb-walk.d.ts +52 -0
- package/dist/shared/kb-walk.d.ts.map +1 -0
- package/dist/shared/kb-walk.js +76 -0
- package/dist/shared/kb-walk.js.map +1 -0
- package/dist/shared/path-order.d.ts +18 -0
- package/dist/shared/path-order.d.ts.map +1 -0
- package/dist/shared/path-order.js +35 -0
- package/dist/shared/path-order.js.map +1 -0
- package/dist/shared/ttl-cache.d.ts +28 -1
- package/dist/shared/ttl-cache.d.ts.map +1 -1
- package/dist/shared/ttl-cache.js +33 -1
- package/dist/shared/ttl-cache.js.map +1 -1
- package/kb-template/.bevelignore +1 -1
- package/kb-template/AGENTS.md +95 -30
- package/kb-template/Skills/.gitkeep +0 -0
- package/migrations/0005_github_facade.sql +25 -0
- package/migrations/meta/0005_snapshot.json +1717 -0
- package/migrations/meta/_journal.json +7 -0
- package/package.json +6 -6
- package/src/__tests__/kb-layout-config.test.ts +110 -0
- package/src/core/__tests__/catalog-cache-invalidation.test.ts +146 -0
- package/src/core/catalog-cache-invalidation.ts +92 -0
- package/src/core/create-core-server.ts +123 -7
- package/src/core/create-core-services.ts +162 -41
- package/src/modules/access/__tests__/access-control.invalidate-race.test.ts +86 -0
- package/src/modules/access/__tests__/access-control.service.test.ts +19 -3
- package/src/modules/access/__tests__/access-plugin-principals.test.ts +368 -0
- package/src/modules/access/__tests__/groups-admin.service.test.ts +8 -0
- package/src/modules/access/access-control.interface.ts +20 -9
- package/src/modules/access/access-control.service.ts +240 -78
- package/src/modules/access/access.routes.ts +96 -14
- package/src/modules/access-model/__tests__/access-grammar.test.ts +18 -0
- package/src/modules/access-model/__tests__/plugin-token-canonical.test.ts +40 -0
- package/src/modules/access-model/access-grammar.ts +114 -2
- package/src/modules/access-model/group-files.ts +4 -0
- package/src/modules/access-model/plugin-principals.ts +137 -0
- package/src/modules/database/core-schema.ts +54 -0
- package/src/modules/kb-sync/__tests__/kb-sync.routes.test.ts +297 -0
- package/src/modules/kb-sync/__tests__/kb-sync.service.test.ts +295 -0
- package/src/modules/kb-sync/__tests__/sync-auth.test.ts +118 -0
- package/src/modules/kb-sync/__tests__/sync-payload.test.ts +148 -0
- package/src/modules/kb-sync/index.ts +19 -0
- package/src/modules/kb-sync/kb-sync.interface.ts +79 -0
- package/src/modules/kb-sync/kb-sync.routes.ts +197 -0
- package/src/modules/kb-sync/kb-sync.service.ts +201 -0
- package/src/modules/kb-sync/sync-auth.ts +118 -0
- package/src/modules/kb-sync/sync-payload.ts +143 -0
- package/src/modules/marketplace/__tests__/github-facade.test.ts +443 -0
- package/src/modules/marketplace/__tests__/marketplace-git.test.ts +179 -0
- package/src/modules/marketplace/git-http.routes.ts +193 -0
- package/src/modules/marketplace/github-facade/github-facade-admin.routes.ts +78 -0
- package/src/modules/marketplace/github-facade/github-facade-codes.store.ts +145 -0
- package/src/modules/marketplace/github-facade/github-facade-credentials.service.ts +208 -0
- package/src/modules/marketplace/github-facade/github-facade.routes.ts +268 -0
- package/src/modules/marketplace/github-facade/github-facade.service.ts +221 -0
- package/src/modules/marketplace/github-facade/index.ts +25 -0
- package/src/modules/marketplace/index.ts +3 -0
- package/src/modules/marketplace/marketplace-repo.service.ts +337 -0
- package/src/modules/mcp/oauth/bevel-oauth-provider.ts +3 -0
- package/src/modules/mcp/oauth/oauth-consent.routes.ts +24 -2
- package/src/modules/mcp/oauth/oauth-state.ts +15 -3
- package/src/modules/plugins/__tests__/bundle-dialect.e2e.test.ts +163 -0
- package/src/modules/plugins/__tests__/compile-marketplace.test.ts +294 -0
- package/src/modules/plugins/__tests__/plugin-index.service.test.ts +56 -12
- package/src/modules/plugins/__tests__/plugin-links.service.test.ts +287 -0
- package/src/modules/plugins/__tests__/plugin-provision.service.test.ts +205 -5
- package/src/modules/plugins/__tests__/plugin-rename.service.test.ts +394 -0
- package/src/modules/plugins/__tests__/plugins.routes.test.ts +80 -33
- package/src/modules/plugins/compile/compile-marketplace.ts +403 -0
- package/src/modules/plugins/compile/marketplace-compiler.service.ts +150 -0
- package/src/modules/plugins/discovery/__tests__/kb-plugin-source.test.ts +329 -0
- package/src/modules/plugins/discovery/bundle-dialect/bundle.source.ts +140 -0
- package/src/modules/plugins/discovery/bundle-dialect/registry.ts +175 -0
- package/src/modules/plugins/discovery/kb-plugin-source.ts +114 -0
- package/src/modules/plugins/discovery/native.source.ts +122 -0
- package/src/modules/plugins/discovery/plugin-source.ts +99 -0
- package/src/modules/plugins/index.ts +10 -0
- package/src/modules/plugins/plugin-links.service.ts +363 -0
- package/src/modules/plugins/plugin-links.ts +184 -0
- package/src/modules/plugins/plugin-provision.service.ts +160 -54
- package/src/modules/plugins/plugin-rename.service.ts +298 -0
- package/src/modules/plugins/plugins.contract.ts +28 -1
- package/src/modules/plugins/plugins.routes.ts +128 -11
- package/src/modules/plugins/plugins.service.ts +106 -53
- package/src/modules/settings/__tests__/deployment-settings.service.test.ts +57 -0
- package/src/modules/settings/__tests__/setup.routes.sync-status.test.ts +77 -0
- package/src/modules/settings/deployment-settings.service.ts +95 -2
- package/src/modules/settings/setup.routes.ts +24 -0
- package/src/modules/skills/__tests__/skill-access-requests.routes.test.ts +128 -0
- package/src/modules/skills/__tests__/skills.service.test.ts +85 -0
- package/src/modules/skills/index.ts +1 -0
- package/src/modules/skills/pending-skills.service.ts +7 -5
- package/src/modules/skills/skill-access-requests.routes.ts +199 -0
- package/src/modules/skills/skills.contract.ts +32 -0
- package/src/modules/skills/skills.routes.ts +59 -3
- package/src/modules/skills/skills.service.ts +84 -22
- package/src/modules/tool-auth/external-api-key.interface.ts +20 -1
- package/src/modules/tool-auth/external-api-key.service.ts +31 -13
- package/src/modules/tool-manuals/__tests__/mcp-json-discovery.test.ts +24 -1
- package/src/modules/tool-manuals/__tests__/tool-manuals.cli.test.ts +2 -0
- package/src/modules/tool-manuals/mcp-json-discovery.ts +154 -88
- package/src/modules/tool-manuals/tool-manuals.service.ts +14 -23
- package/src/modules/workflow/__tests__/preserve-roles-yaml.test.ts +1 -1
- package/src/modules/workflow/__tests__/workflow.service.commitFileWhileLocked.test.ts +1 -0
- package/src/modules/workflow/__tests__/workflow.service.facade.test.ts +2 -2
- package/src/modules/workflow/__tests__/workflow.service.releaseLock.test.ts +119 -2
- package/src/modules/workflow/__tests__/workflow.service.sync.test.ts +437 -0
- package/src/modules/workflow/git/__tests__/git.service.postMergePull.test.ts +3 -3
- package/src/modules/workflow/git/__tests__/git.service.pull.test.ts +47 -4
- package/src/modules/workflow/git/__tests__/git.service.syncFromRemote.test.ts +253 -0
- package/src/modules/workflow/git/git.service.ts +239 -56
- package/src/modules/workflow/git/pull-request.service.ts +9 -0
- package/src/modules/workflow/workflow.service.ts +260 -9
- package/src/modules/workspace/__tests__/workspace.routes.read-gate.test.ts +6 -7
- package/src/modules/workspace/__tests__/workspace.service.list-cloned.test.ts +93 -0
- package/src/modules/workspace/__tests__/workspace.service.missing-branch.test.ts +28 -0
- package/src/modules/workspace/__tests__/workspace.service.read-filter.test.ts +42 -12
- package/src/modules/workspace/startup/steps/__tests__/steps.test.ts +219 -4
- package/src/modules/workspace/startup/steps/plugin-manifests.step.ts +129 -0
- package/src/modules/workspace/startup/steps/seed-tree.ts +44 -2
- package/src/modules/workspace/startup/steps/template-files.step.ts +131 -27
- package/src/modules/workspace/workspace.routes.ts +9 -17
- package/src/modules/workspace/workspace.service.ts +107 -16
- package/src/shared/__tests__/filename.test.ts +0 -0
- package/src/shared/__tests__/fs-walk.test.ts +22 -1
- package/src/shared/__tests__/kb-walk.test.ts +107 -0
- package/src/shared/__tests__/path-order.test.ts +24 -0
- package/src/shared/__tests__/ttl-cache.test.ts +55 -0
- package/src/shared/domain-errors.ts +29 -0
- package/src/shared/fs-errors.ts +10 -0
- package/src/shared/fs-walk.ts +38 -23
- package/src/shared/kb-walk.ts +95 -0
- package/src/shared/path-order.ts +33 -0
- package/src/shared/ttl-cache.ts +33 -1
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import type { MintedExternalApiKey } from '../../tool-auth/external-api-key.interface.js';
|
|
2
|
+
import { type McpAuthRequestState } from '../../mcp/oauth/oauth-state.js';
|
|
3
|
+
import type { GitHubFacadeCredentialsService } from './github-facade-credentials.service.js';
|
|
4
|
+
import type { GitHubFacadeCodeStore } from './github-facade-codes.store.js';
|
|
5
|
+
/**
|
|
6
|
+
* The KIND stored on a connection key minted through the facade, and the
|
|
7
|
+
* plaintext prefix that kind is minted with. `gho_` is what a GitHub OAuth
|
|
8
|
+
* token looks like — the shape a consumer expecting a GitHub Enterprise host
|
|
9
|
+
* accepts; the key is otherwise an ordinary connection key — hashed at rest,
|
|
10
|
+
* revocable from the person's external-agent page, accepted by every surface
|
|
11
|
+
* a connection key is. The kind, not the label, is what tells such a key
|
|
12
|
+
* apart: a label is the person's to edit.
|
|
13
|
+
*/
|
|
14
|
+
export declare const GITHUB_LINK_KEY_KIND = "github-link";
|
|
15
|
+
export declare const GITHUB_LINK_KEY_PREFIX = "gho_";
|
|
16
|
+
/**
|
|
17
|
+
* A product that talks to this deployment as if it were a GitHub Enterprise
|
|
18
|
+
* Server. The facade itself is consumer-neutral — GitHub's OAuth pair and
|
|
19
|
+
* REST subset are the contract — and a consumer is the one thing that is not:
|
|
20
|
+
* where its callback lives (the only place a code may be sent), what the
|
|
21
|
+
* consent page calls it, and how the keys it holds are labelled for the
|
|
22
|
+
* person. Claude is the first; another product with a "connect your GitHub
|
|
23
|
+
* Enterprise" flow is one more entry, not one more module.
|
|
24
|
+
*/
|
|
25
|
+
export interface GitHubFacadeConsumer {
|
|
26
|
+
id: string;
|
|
27
|
+
/** What the consent page says is asking. */
|
|
28
|
+
name: string;
|
|
29
|
+
/** Hostnames a redirect_uri may point at. */
|
|
30
|
+
redirectHosts: readonly string[];
|
|
31
|
+
/** The label on the connection keys minted for this consumer. */
|
|
32
|
+
keyLabel: string;
|
|
33
|
+
}
|
|
34
|
+
/** claude.ai and Cowork: the consumer this facade was built against. */
|
|
35
|
+
export declare const CLAUDE_CONSUMER: GitHubFacadeConsumer;
|
|
36
|
+
export interface GitHubFacadeKeyMinter {
|
|
37
|
+
mint(userId: string, label: string, options?: {
|
|
38
|
+
kind?: string;
|
|
39
|
+
}): Promise<MintedExternalApiKey>;
|
|
40
|
+
}
|
|
41
|
+
export interface GitHubFacadeDeps {
|
|
42
|
+
credentials: GitHubFacadeCredentialsService;
|
|
43
|
+
codes: GitHubFacadeCodeStore;
|
|
44
|
+
keys: GitHubFacadeKeyMinter;
|
|
45
|
+
/** Who may connect through the facade. */
|
|
46
|
+
consumers: readonly GitHubFacadeConsumer[];
|
|
47
|
+
/** HMAC secret for the signed authorize state — the same one the MCP flow uses. */
|
|
48
|
+
stateSecret: string;
|
|
49
|
+
/** SPA base URL — where the browser is sent to sign in and approve. */
|
|
50
|
+
publicFrontendUrl: string;
|
|
51
|
+
}
|
|
52
|
+
export declare class GitHubFacadeRequestError extends Error {
|
|
53
|
+
readonly status: number;
|
|
54
|
+
readonly code: string;
|
|
55
|
+
constructor(status: number, code: string, message: string);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* The "connect your GitHub Enterprise account" flow, as a consumer such as claude.ai drives it
|
|
59
|
+
* against a GitHub Enterprise host — with hexis standing where GitHub would.
|
|
60
|
+
*
|
|
61
|
+
* 1. The browser lands on `/login/oauth/authorize?client_id&redirect_uri&state`.
|
|
62
|
+
* We check the client id is ours and the redirect goes to claude.ai,
|
|
63
|
+
* pack the request into the SAME signed state the MCP authorization
|
|
64
|
+
* flow uses, and send the browser to the SPA's `/connect` page — where a
|
|
65
|
+
* hexis session (or a sign-in) attaches a person to the request.
|
|
66
|
+
* 2. Finish on that page comes back through the consent routes with the
|
|
67
|
+
* state; {@link completeConsent} stores a one-time code bound to that
|
|
68
|
+
* person and returns the callback URL carrying it.
|
|
69
|
+
* 3. Anthropic's backend posts the code with our client id and secret to
|
|
70
|
+
* `/login/oauth/access_token`; {@link exchangeCode} turns it into a
|
|
71
|
+
* connection key for that person — the token every later fetch carries.
|
|
72
|
+
*
|
|
73
|
+
* Nothing here is remembered in the process: credentials and codes are read
|
|
74
|
+
* from their stores on every step, so the replica that issued a code and the
|
|
75
|
+
* replica that exchanges it need not be the same one.
|
|
76
|
+
*/
|
|
77
|
+
export declare class GitHubFacade {
|
|
78
|
+
private readonly deps;
|
|
79
|
+
constructor(deps: GitHubFacadeDeps);
|
|
80
|
+
/** Where to send the browser for an authorize request, or a 4xx to answer with. */
|
|
81
|
+
authorizeRedirect(query: Record<string, unknown>): Promise<string>;
|
|
82
|
+
/** True when a verified state is one of ours (a GitHub-shaped link, not an MCP client). */
|
|
83
|
+
isFacadeRequest(st: McpAuthRequestState): boolean;
|
|
84
|
+
/** What the consent page should say is asking, for one of our states. */
|
|
85
|
+
clientNameFor(st: McpAuthRequestState): string;
|
|
86
|
+
/**
|
|
87
|
+
* The person approved on `/connect`: a one-time code for them, and the
|
|
88
|
+
* claude.ai callback to send the browser to. Supersedes any live code the
|
|
89
|
+
* same person already had for this client.
|
|
90
|
+
*/
|
|
91
|
+
completeConsent(userId: string, st: McpAuthRequestState): Promise<{
|
|
92
|
+
redirectTo: string;
|
|
93
|
+
}>;
|
|
94
|
+
/**
|
|
95
|
+
* The token exchange. Client id and secret must be ours and the code live;
|
|
96
|
+
* every check runs BEFORE the code is spent, so a request that is wrong
|
|
97
|
+
* about something else (its redirect, say) can be corrected and retried.
|
|
98
|
+
* Spending is one conditional update in the store — the first exchange
|
|
99
|
+
* wins, on whichever replica, and only the winner mints.
|
|
100
|
+
*/
|
|
101
|
+
exchangeCode(body: Record<string, unknown>): Promise<{
|
|
102
|
+
access_token: string;
|
|
103
|
+
token_type: 'bearer';
|
|
104
|
+
scope: '';
|
|
105
|
+
}>;
|
|
106
|
+
/** The consumer whose callback a redirect_uri is, or null — https only, host exactly. */
|
|
107
|
+
private consumerFor;
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=github-facade.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github-facade.service.d.ts","sourceRoot":"","sources":["../../../../src/modules/marketplace/github-facade/github-facade.service.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,+CAA+C,CAAC;AAC1F,OAAO,EAAmB,KAAK,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAC3F,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,wCAAwC,CAAC;AAC7F,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAE5E;;;;;;;;GAQG;AACH,eAAO,MAAM,oBAAoB,gBAAgB,CAAC;AAClD,eAAO,MAAM,sBAAsB,SAAS,CAAC;AAE7C;;;;;;;;GAQ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AAG,OAAO;IAIjD,yEAAyE;IACzE,aAAa,CAAC,EAAE,EAAE,mBAAmB,GAAG,MAAM;IAI9C;;;;OAIG;IACG,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,mBAAmB,GAAG,OAAO,CAAC;QAAE,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC;IAmB/F;;;;;;OAMG;IACG,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC;QACzD,YAAY,EAAE,MAAM,CAAC;QACrB,UAAU,EAAE,QAAQ,CAAC;QACrB,KAAK,EAAE,EAAE,CAAC;KACX,CAAC;IA6BF,yFAAyF;IACzF,OAAO,CAAC,WAAW;CAUpB"}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { createHash, randomBytes, timingSafeEqual } from 'node:crypto';
|
|
2
|
+
import { signAuthRequest } from '../../mcp/oauth/oauth-state.js';
|
|
3
|
+
/**
|
|
4
|
+
* The KIND stored on a connection key minted through the facade, and the
|
|
5
|
+
* plaintext prefix that kind is minted with. `gho_` is what a GitHub OAuth
|
|
6
|
+
* token looks like — the shape a consumer expecting a GitHub Enterprise host
|
|
7
|
+
* accepts; the key is otherwise an ordinary connection key — hashed at rest,
|
|
8
|
+
* revocable from the person's external-agent page, accepted by every surface
|
|
9
|
+
* a connection key is. The kind, not the label, is what tells such a key
|
|
10
|
+
* apart: a label is the person's to edit.
|
|
11
|
+
*/
|
|
12
|
+
export const GITHUB_LINK_KEY_KIND = 'github-link';
|
|
13
|
+
export const GITHUB_LINK_KEY_PREFIX = 'gho_';
|
|
14
|
+
/** claude.ai and Cowork: the consumer this facade was built against. */
|
|
15
|
+
export const CLAUDE_CONSUMER = {
|
|
16
|
+
id: 'claude',
|
|
17
|
+
name: 'Claude',
|
|
18
|
+
redirectHosts: ['claude.ai'],
|
|
19
|
+
keyLabel: 'Claude (claude.ai and Cowork)',
|
|
20
|
+
};
|
|
21
|
+
const CODE_TTL_MS = 10 * 60_000;
|
|
22
|
+
const CODE_BYTES = 10;
|
|
23
|
+
export class GitHubFacadeRequestError extends Error {
|
|
24
|
+
status;
|
|
25
|
+
code;
|
|
26
|
+
constructor(status, code, message) {
|
|
27
|
+
super(message);
|
|
28
|
+
this.status = status;
|
|
29
|
+
this.code = code;
|
|
30
|
+
this.name = 'GitHubFacadeRequestError';
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* The "connect your GitHub Enterprise account" flow, as a consumer such as claude.ai drives it
|
|
35
|
+
* against a GitHub Enterprise host — with hexis standing where GitHub would.
|
|
36
|
+
*
|
|
37
|
+
* 1. The browser lands on `/login/oauth/authorize?client_id&redirect_uri&state`.
|
|
38
|
+
* We check the client id is ours and the redirect goes to claude.ai,
|
|
39
|
+
* pack the request into the SAME signed state the MCP authorization
|
|
40
|
+
* flow uses, and send the browser to the SPA's `/connect` page — where a
|
|
41
|
+
* hexis session (or a sign-in) attaches a person to the request.
|
|
42
|
+
* 2. Finish on that page comes back through the consent routes with the
|
|
43
|
+
* state; {@link completeConsent} stores a one-time code bound to that
|
|
44
|
+
* person and returns the callback URL carrying it.
|
|
45
|
+
* 3. Anthropic's backend posts the code with our client id and secret to
|
|
46
|
+
* `/login/oauth/access_token`; {@link exchangeCode} turns it into a
|
|
47
|
+
* connection key for that person — the token every later fetch carries.
|
|
48
|
+
*
|
|
49
|
+
* Nothing here is remembered in the process: credentials and codes are read
|
|
50
|
+
* from their stores on every step, so the replica that issued a code and the
|
|
51
|
+
* replica that exchanges it need not be the same one.
|
|
52
|
+
*/
|
|
53
|
+
export class GitHubFacade {
|
|
54
|
+
deps;
|
|
55
|
+
constructor(deps) {
|
|
56
|
+
this.deps = deps;
|
|
57
|
+
}
|
|
58
|
+
/** Where to send the browser for an authorize request, or a 4xx to answer with. */
|
|
59
|
+
async authorizeRedirect(query) {
|
|
60
|
+
const clientId = str(query.client_id);
|
|
61
|
+
const redirectUri = str(query.redirect_uri);
|
|
62
|
+
const state = str(query.state);
|
|
63
|
+
const creds = await this.deps.credentials.ensure();
|
|
64
|
+
if (!clientId || !safeEqual(clientId, creds.clientId)) {
|
|
65
|
+
throw new GitHubFacadeRequestError(400, 'unknown_client', 'Unknown client_id.');
|
|
66
|
+
}
|
|
67
|
+
if (!this.consumerFor(redirectUri)) {
|
|
68
|
+
throw new GitHubFacadeRequestError(400, 'invalid_redirect', 'redirect_uri does not belong to a known consumer.');
|
|
69
|
+
}
|
|
70
|
+
const signed = signAuthRequest(this.deps.stateSecret, {
|
|
71
|
+
c: clientId,
|
|
72
|
+
r: redirectUri,
|
|
73
|
+
s: state || undefined,
|
|
74
|
+
gh: true,
|
|
75
|
+
});
|
|
76
|
+
const url = new URL('/connect', this.deps.publicFrontendUrl);
|
|
77
|
+
url.searchParams.set('oauth', signed);
|
|
78
|
+
return url.toString();
|
|
79
|
+
}
|
|
80
|
+
/** True when a verified state is one of ours (a GitHub-shaped link, not an MCP client). */
|
|
81
|
+
isFacadeRequest(st) {
|
|
82
|
+
return st.gh === true;
|
|
83
|
+
}
|
|
84
|
+
/** What the consent page should say is asking, for one of our states. */
|
|
85
|
+
clientNameFor(st) {
|
|
86
|
+
return this.consumerFor(st.r)?.name ?? 'an external product';
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* The person approved on `/connect`: a one-time code for them, and the
|
|
90
|
+
* claude.ai callback to send the browser to. Supersedes any live code the
|
|
91
|
+
* same person already had for this client.
|
|
92
|
+
*/
|
|
93
|
+
async completeConsent(userId, st) {
|
|
94
|
+
const creds = await this.deps.credentials.ensure();
|
|
95
|
+
if (!safeEqual(st.c, creds.clientId) || !this.consumerFor(st.r)) {
|
|
96
|
+
throw new GitHubFacadeRequestError(400, 'invalid_request', 'The authorization request is not one of ours.');
|
|
97
|
+
}
|
|
98
|
+
const code = randomBytes(CODE_BYTES).toString('hex');
|
|
99
|
+
await this.deps.codes.put({
|
|
100
|
+
codeHash: hashCode(code),
|
|
101
|
+
userId,
|
|
102
|
+
clientId: st.c,
|
|
103
|
+
redirectUri: st.r,
|
|
104
|
+
expiresAt: new Date(Date.now() + CODE_TTL_MS),
|
|
105
|
+
});
|
|
106
|
+
const url = new URL(st.r);
|
|
107
|
+
url.searchParams.set('code', code);
|
|
108
|
+
if (st.s)
|
|
109
|
+
url.searchParams.set('state', st.s);
|
|
110
|
+
return { redirectTo: url.toString() };
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* The token exchange. Client id and secret must be ours and the code live;
|
|
114
|
+
* every check runs BEFORE the code is spent, so a request that is wrong
|
|
115
|
+
* about something else (its redirect, say) can be corrected and retried.
|
|
116
|
+
* Spending is one conditional update in the store — the first exchange
|
|
117
|
+
* wins, on whichever replica, and only the winner mints.
|
|
118
|
+
*/
|
|
119
|
+
async exchangeCode(body) {
|
|
120
|
+
const creds = await this.deps.credentials.ensure();
|
|
121
|
+
const clientId = str(body.client_id);
|
|
122
|
+
const clientSecret = str(body.client_secret);
|
|
123
|
+
const code = str(body.code);
|
|
124
|
+
if (!clientId || !clientSecret || !safeEqual(clientId, creds.clientId) || !safeEqual(clientSecret, creds.clientSecret)) {
|
|
125
|
+
throw new GitHubFacadeRequestError(401, 'incorrect_client_credentials', 'The client_id and/or client_secret passed are incorrect.');
|
|
126
|
+
}
|
|
127
|
+
const pending = code ? await this.deps.codes.peek(hashCode(code)) : null;
|
|
128
|
+
if (!pending || pending.clientId !== clientId) {
|
|
129
|
+
throw new GitHubFacadeRequestError(400, 'bad_verification_code', 'The code passed is incorrect or expired.');
|
|
130
|
+
}
|
|
131
|
+
const redirectUri = str(body.redirect_uri);
|
|
132
|
+
if (redirectUri && redirectUri !== pending.redirectUri) {
|
|
133
|
+
throw new GitHubFacadeRequestError(400, 'redirect_uri_mismatch', 'The redirect_uri does not match the authorization.');
|
|
134
|
+
}
|
|
135
|
+
const spent = await this.deps.codes.consume(pending.codeHash);
|
|
136
|
+
if (!spent) {
|
|
137
|
+
throw new GitHubFacadeRequestError(400, 'bad_verification_code', 'The code passed is incorrect or expired.');
|
|
138
|
+
}
|
|
139
|
+
// The consumer is the one the code was issued for — the redirect the
|
|
140
|
+
// person approved names it — so the key is labelled for that product.
|
|
141
|
+
const consumer = this.consumerFor(spent.redirectUri);
|
|
142
|
+
const minted = await this.deps.keys.mint(spent.userId, consumer?.keyLabel ?? 'GitHub-compatible link', {
|
|
143
|
+
kind: GITHUB_LINK_KEY_KIND,
|
|
144
|
+
});
|
|
145
|
+
return { access_token: minted.plaintext, token_type: 'bearer', scope: '' };
|
|
146
|
+
}
|
|
147
|
+
/** The consumer whose callback a redirect_uri is, or null — https only, host exactly. */
|
|
148
|
+
consumerFor(redirectUri) {
|
|
149
|
+
let parsed;
|
|
150
|
+
try {
|
|
151
|
+
parsed = new URL(redirectUri);
|
|
152
|
+
}
|
|
153
|
+
catch {
|
|
154
|
+
return null;
|
|
155
|
+
}
|
|
156
|
+
if (parsed.protocol !== 'https:')
|
|
157
|
+
return null;
|
|
158
|
+
return this.deps.consumers.find((c) => c.redirectHosts.includes(parsed.hostname)) ?? null;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
function hashCode(code) {
|
|
162
|
+
return createHash('sha256').update(code).digest('hex');
|
|
163
|
+
}
|
|
164
|
+
function str(v) {
|
|
165
|
+
return typeof v === 'string' ? v : '';
|
|
166
|
+
}
|
|
167
|
+
function safeEqual(a, b) {
|
|
168
|
+
const ab = Buffer.from(a);
|
|
169
|
+
const bb = Buffer.from(b);
|
|
170
|
+
return ab.length === bb.length && timingSafeEqual(ab, bb);
|
|
171
|
+
}
|
|
172
|
+
//# sourceMappingURL=github-facade.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github-facade.service.js","sourceRoot":"","sources":["../../../../src/modules/marketplace/github-facade/github-facade.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;A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|
1
|
+
export { GitHubFacadeCredentialsService, DbGitHubFacadeCredentialsStore, MemoryGitHubFacadeCredentialsStore, GitHubFacadeUnavailableError, type GitHubFacadeCredentials, type GitHubFacadeCredentialsStore, } from './github-facade-credentials.service.js';
|
|
2
|
+
export { DbGitHubFacadeCodeStore, MemoryGitHubFacadeCodeStore, type GitHubFacadeCodeStore, type PendingFacadeCode, } from './github-facade-codes.store.js';
|
|
3
|
+
export { GitHubFacade, GitHubFacadeRequestError, GITHUB_LINK_KEY_KIND, GITHUB_LINK_KEY_PREFIX, CLAUDE_CONSUMER, type GitHubFacadeConsumer, type GitHubFacadeDeps, } from './github-facade.service.js';
|
|
4
|
+
export { createGitHubFacadeRoutes, type GitHubFacadeRoutesDeps } from './github-facade.routes.js';
|
|
5
|
+
export { createGitHubFacadeAdminRoutes, type GitHubFacadeAdminRoutesDeps } from './github-facade-admin.routes.js';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/modules/marketplace/github-facade/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,8BAA8B,EAC9B,8BAA8B,EAC9B,kCAAkC,EAClC,4BAA4B,EAC5B,KAAK,uBAAuB,EAC5B,KAAK,4BAA4B,GAClC,MAAM,wCAAwC,CAAC;AAChD,OAAO,EACL,uBAAuB,EACvB,2BAA2B,EAC3B,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,GACvB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,YAAY,EACZ,wBAAwB,EACxB,oBAAoB,EACpB,sBAAsB,EACtB,eAAe,EACf,KAAK,oBAAoB,EACzB,KAAK,gBAAgB,GACtB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,wBAAwB,EAAE,KAAK,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAClG,OAAO,EAAE,6BAA6B,EAAE,KAAK,2BAA2B,EAAE,MAAM,iCAAiC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { GitHubFacadeCredentialsService, DbGitHubFacadeCredentialsStore, MemoryGitHubFacadeCredentialsStore, GitHubFacadeUnavailableError, } from './github-facade-credentials.service.js';
|
|
2
|
+
export { DbGitHubFacadeCodeStore, MemoryGitHubFacadeCodeStore, } from './github-facade-codes.store.js';
|
|
3
|
+
export { GitHubFacade, GitHubFacadeRequestError, GITHUB_LINK_KEY_KIND, GITHUB_LINK_KEY_PREFIX, CLAUDE_CONSUMER, } from './github-facade.service.js';
|
|
4
|
+
export { createGitHubFacadeRoutes } from './github-facade.routes.js';
|
|
5
|
+
export { createGitHubFacadeAdminRoutes } from './github-facade-admin.routes.js';
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/modules/marketplace/github-facade/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,8BAA8B,EAC9B,8BAA8B,EAC9B,kCAAkC,EAClC,4BAA4B,GAG7B,MAAM,wCAAwC,CAAC;AAChD,OAAO,EACL,uBAAuB,EACvB,2BAA2B,GAG5B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,YAAY,EACZ,wBAAwB,EACxB,oBAAoB,EACpB,sBAAsB,EACtB,eAAe,GAGhB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,wBAAwB,EAA+B,MAAM,2BAA2B,CAAC;AAClG,OAAO,EAAE,6BAA6B,EAAoC,MAAM,iCAAiC,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { MarketplaceRepoService, type MarketplaceCompiler, type EnsureResult } from './marketplace-repo.service.js';
|
|
2
|
+
export { createMarketplaceGitRoutes, type MarketplaceKeyResolver } from './git-http.routes.js';
|
|
3
|
+
export * from './github-facade/index.js';
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/modules/marketplace/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,KAAK,mBAAmB,EAAE,KAAK,YAAY,EAAE,MAAM,+BAA+B,CAAC;AACpH,OAAO,EAAE,0BAA0B,EAAE,KAAK,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAC/F,cAAc,0BAA0B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/marketplace/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAA+C,MAAM,+BAA+B,CAAC;AACpH,OAAO,EAAE,0BAA0B,EAA+B,MAAM,sBAAsB,CAAC;AAC/F,cAAc,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { type ChildProcess } from 'node:child_process';
|
|
2
|
+
import type { VirtualTree } from '../plugins/compile/compile-marketplace.js';
|
|
3
|
+
/** What the repo service asks the compiler for — the one seam it has. */
|
|
4
|
+
export interface MarketplaceCompiler {
|
|
5
|
+
sourceCommit(): Promise<string>;
|
|
6
|
+
compileFor(audience: {
|
|
7
|
+
userEmail: string;
|
|
8
|
+
},
|
|
9
|
+
/** The commit the tree is compiled from, when the caller already read it. */
|
|
10
|
+
sourceCommit?: string): Promise<VirtualTree & {
|
|
11
|
+
sourceCommit: string;
|
|
12
|
+
}>;
|
|
13
|
+
}
|
|
14
|
+
export interface EnsureResult {
|
|
15
|
+
/** The git namespace the caller's tree lives in. */
|
|
16
|
+
namespace: string;
|
|
17
|
+
/** True when a new commit was written this call. */
|
|
18
|
+
compiled: boolean;
|
|
19
|
+
sourceCommit: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* ONE bare repository, ONE git namespace per caller.
|
|
23
|
+
*
|
|
24
|
+
* Every person's compiled marketplace is a branch in its own namespace
|
|
25
|
+
* (`refs/namespaces/<ns>/refs/heads/main`), which is exactly what git
|
|
26
|
+
* namespaces exist for (gitnamespaces(7)): `git http-backend` run with
|
|
27
|
+
* `GIT_NAMESPACE=<ns>` advertises only that namespace's refs, so a clone sees
|
|
28
|
+
* a repository whose `main` is their tree and nothing else — while every
|
|
29
|
+
* identical skill across callers is one blob in one object store.
|
|
30
|
+
*
|
|
31
|
+
* Freshness is LAZY and keyed on the knowledge base's default-branch commit:
|
|
32
|
+
* every input to a compile (skills, manifests, access rules, roles, groups)
|
|
33
|
+
* lives in that repository, so "same source commit" means "same answer".
|
|
34
|
+
* The last compiled source per namespace sits in a sidecar file rather than
|
|
35
|
+
* a commit trailer, so an unchanged tree costs no commit and no re-check.
|
|
36
|
+
*
|
|
37
|
+
* Each recompile appends a commit whose parent is the namespace's current
|
|
38
|
+
* head, so a client's `git pull` is always a fast-forward — including when
|
|
39
|
+
* access was withdrawn and files vanish. Writes go through git plumbing
|
|
40
|
+
* against a temporary index: no working tree of the bare repo, no checkout.
|
|
41
|
+
*
|
|
42
|
+
* Read-only by construction: `http.receivepack` is pinned off (http-backend
|
|
43
|
+
* would otherwise enable pushes for an authenticated REMOTE_USER), and the
|
|
44
|
+
* route refuses the receive-pack service before git ever sees it.
|
|
45
|
+
*/
|
|
46
|
+
export declare class MarketplaceRepoService {
|
|
47
|
+
/** Absolute path of the bare repository (created on first use). */
|
|
48
|
+
readonly repoDir: string;
|
|
49
|
+
private readonly compiler;
|
|
50
|
+
private readonly committer;
|
|
51
|
+
private readonly locks;
|
|
52
|
+
private initialised;
|
|
53
|
+
constructor(
|
|
54
|
+
/** Absolute path of the bare repository (created on first use). */
|
|
55
|
+
repoDir: string, compiler: MarketplaceCompiler, committer?: {
|
|
56
|
+
name: string;
|
|
57
|
+
email: string;
|
|
58
|
+
});
|
|
59
|
+
/** The directory `GIT_PROJECT_ROOT` points at, and the repo's name under it. */
|
|
60
|
+
get projectRoot(): string;
|
|
61
|
+
get repoName(): string;
|
|
62
|
+
/** The namespace for a user id — one path segment, stable, opaque. */
|
|
63
|
+
static namespaceFor(userId: string): string;
|
|
64
|
+
ensureRepo(): Promise<void>;
|
|
65
|
+
/**
|
|
66
|
+
* Bring the caller's namespace up to the knowledge base's current commit,
|
|
67
|
+
* compiling only when it moved. Serialised per namespace: two fetches
|
|
68
|
+
* arriving together compile once.
|
|
69
|
+
*/
|
|
70
|
+
ensureCompiled(user: {
|
|
71
|
+
id: string;
|
|
72
|
+
email: string;
|
|
73
|
+
}): Promise<EnsureResult>;
|
|
74
|
+
/**
|
|
75
|
+
* The caller's namespace and its head commit, compiled if stale — what the
|
|
76
|
+
* GitHub-shaped REST surface (the Cowork path) reads instead of cloning.
|
|
77
|
+
*/
|
|
78
|
+
headFor(user: {
|
|
79
|
+
id: string;
|
|
80
|
+
email: string;
|
|
81
|
+
}): Promise<{
|
|
82
|
+
namespace: string;
|
|
83
|
+
sha: string;
|
|
84
|
+
}>;
|
|
85
|
+
/** One commit as the REST surface describes it. */
|
|
86
|
+
describeCommit(sha: string): Promise<{
|
|
87
|
+
sha: string;
|
|
88
|
+
tree: string;
|
|
89
|
+
message: string;
|
|
90
|
+
authorName: string;
|
|
91
|
+
authorEmail: string;
|
|
92
|
+
date: string;
|
|
93
|
+
}>;
|
|
94
|
+
/**
|
|
95
|
+
* Whether `sha` is the namespace's head or one of its ancestors — the only
|
|
96
|
+
* commits a caller may read as that namespace. The object store is shared
|
|
97
|
+
* across everyone, so a sha alone is never enough.
|
|
98
|
+
*/
|
|
99
|
+
contains(namespace: string, sha: string): Promise<boolean>;
|
|
100
|
+
/** The tree at `sha` as a zip stream, every path under `prefix/`. Check {@link contains} first. */
|
|
101
|
+
archiveZip(sha: string, prefix: string): ChildProcess;
|
|
102
|
+
private refOf;
|
|
103
|
+
private headOf;
|
|
104
|
+
/**
|
|
105
|
+
* Write `tree` as a commit on the namespace's branch. Materialises the
|
|
106
|
+
* virtual tree into a scratch directory, stages it into a throwaway index
|
|
107
|
+
* against the bare object store, and commits — no working tree involved.
|
|
108
|
+
* When the tree hash equals the head's, nothing is committed.
|
|
109
|
+
*/
|
|
110
|
+
private commitTree;
|
|
111
|
+
/**
|
|
112
|
+
* Point the namespace's HEAD at its branch — valid before the branch
|
|
113
|
+
* exists. A read first: the symref is written only when absent or wrong,
|
|
114
|
+
* so the common path touches nothing.
|
|
115
|
+
*/
|
|
116
|
+
private ensureHead;
|
|
117
|
+
private sidecarDir;
|
|
118
|
+
private readSidecar;
|
|
119
|
+
private writeSidecar;
|
|
120
|
+
private git;
|
|
121
|
+
}
|
|
122
|
+
//# sourceMappingURL=marketplace-repo.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"marketplace-repo.service.d.ts","sourceRoot":"","sources":["../../../src/modules/marketplace/marketplace-repo.service.ts"],"names":[],"mappings":"AAGA,OAAO,EAAmB,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGxE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2CAA2C,CAAC;AAI7E,yEAAyE;AACzE,MAAM,WAAW,mBAAmB;IAClC,YAAY,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IAChC,UAAU,CACR,QAAQ,EAAE;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE;IAC/B,6EAA6E;IAC7E,YAAY,CAAC,EAAE,MAAM,GACpB,OAAO,CAAC,WAAW,GAAG;QAAE,YAAY,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACpD;AAED,MAAM,WAAW,YAAY;IAC3B,oDAAoD;IACpD,SAAS,EAAE,MAAM,CAAC;IAClB,oDAAoD;IACpD,QAAQ,EAAE,OAAO,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,qBAAa,sBAAsB;IAK/B,mEAAmE;IACnE,QAAQ,CAAC,OAAO,EAAE,MAAM;IACxB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,Q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