@software-dlc/cli 0.157.2
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/CHANGELOG.md +11 -0
- package/LICENSE +105 -0
- package/README.md +31 -0
- package/dist/checkout.d.ts +43 -0
- package/dist/checkout.d.ts.map +1 -0
- package/dist/checkout.js +92 -0
- package/dist/checkout.js.map +1 -0
- package/dist/cli-arguments.d.ts +13 -0
- package/dist/cli-arguments.d.ts.map +1 -0
- package/dist/cli-arguments.js +67 -0
- package/dist/cli-arguments.js.map +1 -0
- package/dist/cli-branch-history.d.ts +48 -0
- package/dist/cli-branch-history.d.ts.map +1 -0
- package/dist/cli-branch-history.js +319 -0
- package/dist/cli-branch-history.js.map +1 -0
- package/dist/cli-branches.d.ts +22 -0
- package/dist/cli-branches.d.ts.map +1 -0
- package/dist/cli-branches.js +59 -0
- package/dist/cli-branches.js.map +1 -0
- package/dist/cli-deploy.d.ts +14 -0
- package/dist/cli-deploy.d.ts.map +1 -0
- package/dist/cli-deploy.js +164 -0
- package/dist/cli-deploy.js.map +1 -0
- package/dist/cli-health.d.ts +3 -0
- package/dist/cli-health.d.ts.map +1 -0
- package/dist/cli-health.js +73 -0
- package/dist/cli-health.js.map +1 -0
- package/dist/cli-help.d.ts +21 -0
- package/dist/cli-help.d.ts.map +1 -0
- package/dist/cli-help.js +176 -0
- package/dist/cli-help.js.map +1 -0
- package/dist/cli-login.d.ts +76 -0
- package/dist/cli-login.d.ts.map +1 -0
- package/dist/cli-login.js +634 -0
- package/dist/cli-login.js.map +1 -0
- package/dist/cli-operation.d.ts +2 -0
- package/dist/cli-operation.d.ts.map +1 -0
- package/dist/cli-operation.js +66 -0
- package/dist/cli-operation.js.map +1 -0
- package/dist/cli-org.d.ts +12 -0
- package/dist/cli-org.d.ts.map +1 -0
- package/dist/cli-org.js +218 -0
- package/dist/cli-org.js.map +1 -0
- package/dist/cli-rebuild.d.ts +20 -0
- package/dist/cli-rebuild.d.ts.map +1 -0
- package/dist/cli-rebuild.js +29 -0
- package/dist/cli-rebuild.js.map +1 -0
- package/dist/cli-reset.d.ts +27 -0
- package/dist/cli-reset.d.ts.map +1 -0
- package/dist/cli-reset.js +44 -0
- package/dist/cli-reset.js.map +1 -0
- package/dist/cli-snapshot.d.ts +398 -0
- package/dist/cli-snapshot.d.ts.map +1 -0
- package/dist/cli-snapshot.js +45 -0
- package/dist/cli-snapshot.js.map +1 -0
- package/dist/cli-task-context.d.ts +3 -0
- package/dist/cli-task-context.d.ts.map +1 -0
- package/dist/cli-task-context.js +112 -0
- package/dist/cli-task-context.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +1004 -0
- package/dist/cli.js.map +1 -0
- package/dist/graph-packages-lock.d.ts +169 -0
- package/dist/graph-packages-lock.d.ts.map +1 -0
- package/dist/graph-packages-lock.js +503 -0
- package/dist/graph-packages-lock.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/local/aggregate-preflight.d.ts +12 -0
- package/dist/local/aggregate-preflight.d.ts.map +1 -0
- package/dist/local/aggregate-preflight.js +22 -0
- package/dist/local/aggregate-preflight.js.map +1 -0
- package/dist/local/allow-mcp.d.ts +77 -0
- package/dist/local/allow-mcp.d.ts.map +1 -0
- package/dist/local/allow-mcp.js +394 -0
- package/dist/local/allow-mcp.js.map +1 -0
- package/dist/local/api-client.d.ts +15 -0
- package/dist/local/api-client.d.ts.map +1 -0
- package/dist/local/api-client.js +87 -0
- package/dist/local/api-client.js.map +1 -0
- package/dist/local/app-contract-readers.d.ts +229 -0
- package/dist/local/app-contract-readers.d.ts.map +1 -0
- package/dist/local/app-contract-readers.js +450 -0
- package/dist/local/app-contract-readers.js.map +1 -0
- package/dist/local/app-org-reader.d.ts +21 -0
- package/dist/local/app-org-reader.d.ts.map +1 -0
- package/dist/local/app-org-reader.js +66 -0
- package/dist/local/app-org-reader.js.map +1 -0
- package/dist/local/app-shell-readers.d.ts +96 -0
- package/dist/local/app-shell-readers.d.ts.map +1 -0
- package/dist/local/app-shell-readers.js +381 -0
- package/dist/local/app-shell-readers.js.map +1 -0
- package/dist/local/app-tasks-read.d.ts +202 -0
- package/dist/local/app-tasks-read.d.ts.map +1 -0
- package/dist/local/app-tasks-read.js +290 -0
- package/dist/local/app-tasks-read.js.map +1 -0
- package/dist/local/app-worktrees.d.ts +69 -0
- package/dist/local/app-worktrees.d.ts.map +1 -0
- package/dist/local/app-worktrees.js +554 -0
- package/dist/local/app-worktrees.js.map +1 -0
- package/dist/local/base-sync-manifest.d.ts +12 -0
- package/dist/local/base-sync-manifest.d.ts.map +1 -0
- package/dist/local/base-sync-manifest.js +57 -0
- package/dist/local/base-sync-manifest.js.map +1 -0
- package/dist/local/blast-radius.d.ts +191 -0
- package/dist/local/blast-radius.d.ts.map +1 -0
- package/dist/local/blast-radius.js +585 -0
- package/dist/local/blast-radius.js.map +1 -0
- package/dist/local/canonical.d.ts +2 -0
- package/dist/local/canonical.d.ts.map +1 -0
- package/dist/local/canonical.js +2 -0
- package/dist/local/canonical.js.map +1 -0
- package/dist/local/config.d.ts +22 -0
- package/dist/local/config.d.ts.map +1 -0
- package/dist/local/config.js +57 -0
- package/dist/local/config.js.map +1 -0
- package/dist/local/document-commands.d.ts +163 -0
- package/dist/local/document-commands.d.ts.map +1 -0
- package/dist/local/document-commands.js +620 -0
- package/dist/local/document-commands.js.map +1 -0
- package/dist/local/document-embeds.d.ts +21 -0
- package/dist/local/document-embeds.d.ts.map +1 -0
- package/dist/local/document-embeds.js +38 -0
- package/dist/local/document-embeds.js.map +1 -0
- package/dist/local/environment-context.d.ts +39 -0
- package/dist/local/environment-context.d.ts.map +1 -0
- package/dist/local/environment-context.js +193 -0
- package/dist/local/environment-context.js.map +1 -0
- package/dist/local/environment-exclude.d.ts +7 -0
- package/dist/local/environment-exclude.d.ts.map +1 -0
- package/dist/local/environment-exclude.js +82 -0
- package/dist/local/environment-exclude.js.map +1 -0
- package/dist/local/environment-sidecar.d.ts +126 -0
- package/dist/local/environment-sidecar.d.ts.map +1 -0
- package/dist/local/environment-sidecar.js +442 -0
- package/dist/local/environment-sidecar.js.map +1 -0
- package/dist/local/environment-switch.d.ts +22 -0
- package/dist/local/environment-switch.d.ts.map +1 -0
- package/dist/local/environment-switch.js +385 -0
- package/dist/local/environment-switch.js.map +1 -0
- package/dist/local/exact-remote-projection.d.ts +17 -0
- package/dist/local/exact-remote-projection.d.ts.map +1 -0
- package/dist/local/exact-remote-projection.js +53 -0
- package/dist/local/exact-remote-projection.js.map +1 -0
- package/dist/local/experimental/path-object-store.d.ts +66 -0
- package/dist/local/experimental/path-object-store.d.ts.map +1 -0
- package/dist/local/experimental/path-object-store.js +135 -0
- package/dist/local/experimental/path-object-store.js.map +1 -0
- package/dist/local/external-worktree-binding.d.ts +21 -0
- package/dist/local/external-worktree-binding.d.ts.map +1 -0
- package/dist/local/external-worktree-binding.js +56 -0
- package/dist/local/external-worktree-binding.js.map +1 -0
- package/dist/local/folder-members.d.ts +34 -0
- package/dist/local/folder-members.d.ts.map +1 -0
- package/dist/local/folder-members.js +168 -0
- package/dist/local/folder-members.js.map +1 -0
- package/dist/local/git-ref-authority.d.ts +11 -0
- package/dist/local/git-ref-authority.d.ts.map +1 -0
- package/dist/local/git-ref-authority.js +76 -0
- package/dist/local/git-ref-authority.js.map +1 -0
- package/dist/local/git.d.ts +88 -0
- package/dist/local/git.d.ts.map +1 -0
- package/dist/local/git.js +413 -0
- package/dist/local/git.js.map +1 -0
- package/dist/local/graph-read.d.ts +168 -0
- package/dist/local/graph-read.d.ts.map +1 -0
- package/dist/local/graph-read.js +360 -0
- package/dist/local/graph-read.js.map +1 -0
- package/dist/local/graph-sync.d.ts +39 -0
- package/dist/local/graph-sync.d.ts.map +1 -0
- package/dist/local/graph-sync.js +186 -0
- package/dist/local/graph-sync.js.map +1 -0
- package/dist/local/guide-commands.d.ts +79 -0
- package/dist/local/guide-commands.d.ts.map +1 -0
- package/dist/local/guide-commands.js +247 -0
- package/dist/local/guide-commands.js.map +1 -0
- package/dist/local/health-files.d.ts +24 -0
- package/dist/local/health-files.d.ts.map +1 -0
- package/dist/local/health-files.js +133 -0
- package/dist/local/health-files.js.map +1 -0
- package/dist/local/health-inspection.d.ts +12 -0
- package/dist/local/health-inspection.d.ts.map +1 -0
- package/dist/local/health-inspection.js +407 -0
- package/dist/local/health-inspection.js.map +1 -0
- package/dist/local/health-policy.d.ts +11 -0
- package/dist/local/health-policy.d.ts.map +1 -0
- package/dist/local/health-policy.js +257 -0
- package/dist/local/health-policy.js.map +1 -0
- package/dist/local/health-projection.d.ts +14 -0
- package/dist/local/health-projection.d.ts.map +1 -0
- package/dist/local/health-projection.js +102 -0
- package/dist/local/health-projection.js.map +1 -0
- package/dist/local/health-schema.d.ts +338 -0
- package/dist/local/health-schema.d.ts.map +1 -0
- package/dist/local/health-schema.js +213 -0
- package/dist/local/health-schema.js.map +1 -0
- package/dist/local/health-store.d.ts +61 -0
- package/dist/local/health-store.d.ts.map +1 -0
- package/dist/local/health-store.js +218 -0
- package/dist/local/health-store.js.map +1 -0
- package/dist/local/index.d.ts +66 -0
- package/dist/local/index.d.ts.map +1 -0
- package/dist/local/index.js +66 -0
- package/dist/local/index.js.map +1 -0
- package/dist/local/journey-commands.d.ts +65 -0
- package/dist/local/journey-commands.d.ts.map +1 -0
- package/dist/local/journey-commands.js +138 -0
- package/dist/local/journey-commands.js.map +1 -0
- package/dist/local/local-org-store.d.ts +46 -0
- package/dist/local/local-org-store.d.ts.map +1 -0
- package/dist/local/local-org-store.js +132 -0
- package/dist/local/local-org-store.js.map +1 -0
- package/dist/local/local-org.d.ts +389 -0
- package/dist/local/local-org.d.ts.map +1 -0
- package/dist/local/local-org.js +855 -0
- package/dist/local/local-org.js.map +1 -0
- package/dist/local/media-upload.d.ts +5 -0
- package/dist/local/media-upload.d.ts.map +1 -0
- package/dist/local/media-upload.js +41 -0
- package/dist/local/media-upload.js.map +1 -0
- package/dist/local/operation.d.ts +155 -0
- package/dist/local/operation.d.ts.map +1 -0
- package/dist/local/operation.js +340 -0
- package/dist/local/operation.js.map +1 -0
- package/dist/local/ownership-reader-schema.d.ts +117 -0
- package/dist/local/ownership-reader-schema.d.ts.map +1 -0
- package/dist/local/ownership-reader-schema.js +105 -0
- package/dist/local/ownership-reader-schema.js.map +1 -0
- package/dist/local/ownership-reader-worker.d.ts +2 -0
- package/dist/local/ownership-reader-worker.d.ts.map +1 -0
- package/dist/local/ownership-reader-worker.js +341 -0
- package/dist/local/ownership-reader-worker.js.map +1 -0
- package/dist/local/ownership-reader.d.ts +10 -0
- package/dist/local/ownership-reader.d.ts.map +1 -0
- package/dist/local/ownership-reader.js +93 -0
- package/dist/local/ownership-reader.js.map +1 -0
- package/dist/local/package-uses-check.d.ts +33 -0
- package/dist/local/package-uses-check.d.ts.map +1 -0
- package/dist/local/package-uses-check.js +62 -0
- package/dist/local/package-uses-check.js.map +1 -0
- package/dist/local/pending-recovery.d.ts +22 -0
- package/dist/local/pending-recovery.d.ts.map +1 -0
- package/dist/local/pending-recovery.js +171 -0
- package/dist/local/pending-recovery.js.map +1 -0
- package/dist/local/portable-commit-store.d.ts +28 -0
- package/dist/local/portable-commit-store.d.ts.map +1 -0
- package/dist/local/portable-commit-store.js +187 -0
- package/dist/local/portable-commit-store.js.map +1 -0
- package/dist/local/portable-commit.d.ts +109 -0
- package/dist/local/portable-commit.d.ts.map +1 -0
- package/dist/local/portable-commit.js +209 -0
- package/dist/local/portable-commit.js.map +1 -0
- package/dist/local/portable-remote.d.ts +432 -0
- package/dist/local/portable-remote.d.ts.map +1 -0
- package/dist/local/portable-remote.js +280 -0
- package/dist/local/portable-remote.js.map +1 -0
- package/dist/local/project-deleted.d.ts +4 -0
- package/dist/local/project-deleted.d.ts.map +1 -0
- package/dist/local/project-deleted.js +13 -0
- package/dist/local/project-deleted.js.map +1 -0
- package/dist/local/projection.d.ts +166 -0
- package/dist/local/projection.d.ts.map +1 -0
- package/dist/local/projection.js +709 -0
- package/dist/local/projection.js.map +1 -0
- package/dist/local/read-operation.d.ts +3 -0
- package/dist/local/read-operation.d.ts.map +1 -0
- package/dist/local/read-operation.js +19 -0
- package/dist/local/read-operation.js.map +1 -0
- package/dist/local/rebuild.d.ts +11 -0
- package/dist/local/rebuild.d.ts.map +1 -0
- package/dist/local/rebuild.js +42 -0
- package/dist/local/rebuild.js.map +1 -0
- package/dist/local/remote-base.d.ts +25 -0
- package/dist/local/remote-base.d.ts.map +1 -0
- package/dist/local/remote-base.js +68 -0
- package/dist/local/remote-base.js.map +1 -0
- package/dist/local/save-layout-worker.d.ts +19 -0
- package/dist/local/save-layout-worker.d.ts.map +1 -0
- package/dist/local/save-layout-worker.js +28 -0
- package/dist/local/save-layout-worker.js.map +1 -0
- package/dist/local/save-layout.d.ts +84 -0
- package/dist/local/save-layout.d.ts.map +1 -0
- package/dist/local/save-layout.js +221 -0
- package/dist/local/save-layout.js.map +1 -0
- package/dist/local/scope-impact.d.ts +31 -0
- package/dist/local/scope-impact.d.ts.map +1 -0
- package/dist/local/scope-impact.js +32 -0
- package/dist/local/scope-impact.js.map +1 -0
- package/dist/local/source-evidence/filesystem-worker.d.ts +2 -0
- package/dist/local/source-evidence/filesystem-worker.d.ts.map +1 -0
- package/dist/local/source-evidence/filesystem-worker.js +139 -0
- package/dist/local/source-evidence/filesystem-worker.js.map +1 -0
- package/dist/local/source-evidence/processes.d.ts +20 -0
- package/dist/local/source-evidence/processes.d.ts.map +1 -0
- package/dist/local/source-evidence/processes.js +133 -0
- package/dist/local/source-evidence/processes.js.map +1 -0
- package/dist/local/source-evidence/protocol.d.ts +52 -0
- package/dist/local/source-evidence/protocol.d.ts.map +1 -0
- package/dist/local/source-evidence/protocol.js +72 -0
- package/dist/local/source-evidence/protocol.js.map +1 -0
- package/dist/local/source-evidence/reader.d.ts +14 -0
- package/dist/local/source-evidence/reader.d.ts.map +1 -0
- package/dist/local/source-evidence/reader.js +308 -0
- package/dist/local/source-evidence/reader.js.map +1 -0
- package/dist/local/source-evidence/schema.d.ts +2504 -0
- package/dist/local/source-evidence/schema.d.ts.map +1 -0
- package/dist/local/source-evidence/schema.js +99 -0
- package/dist/local/source-evidence/schema.js.map +1 -0
- package/dist/local/source-policy/loader.d.ts +29 -0
- package/dist/local/source-policy/loader.d.ts.map +1 -0
- package/dist/local/source-policy/loader.js +209 -0
- package/dist/local/source-policy/loader.js.map +1 -0
- package/dist/local/source-policy/process.d.ts +7 -0
- package/dist/local/source-policy/process.d.ts.map +1 -0
- package/dist/local/source-policy/process.js +53 -0
- package/dist/local/source-policy/process.js.map +1 -0
- package/dist/local/source-policy/protocol.d.ts +27 -0
- package/dist/local/source-policy/protocol.d.ts.map +1 -0
- package/dist/local/source-policy/protocol.js +48 -0
- package/dist/local/source-policy/protocol.js.map +1 -0
- package/dist/local/source-policy/worker.d.ts +2 -0
- package/dist/local/source-policy/worker.d.ts.map +1 -0
- package/dist/local/source-policy/worker.js +100 -0
- package/dist/local/source-policy/worker.js.map +1 -0
- package/dist/local/state-directory.d.ts +17 -0
- package/dist/local/state-directory.d.ts.map +1 -0
- package/dist/local/state-directory.js +68 -0
- package/dist/local/state-directory.js.map +1 -0
- package/dist/local/store-database.d.ts +13 -0
- package/dist/local/store-database.d.ts.map +1 -0
- package/dist/local/store-database.js +187 -0
- package/dist/local/store-database.js.map +1 -0
- package/dist/local/store.d.ts +181 -0
- package/dist/local/store.d.ts.map +1 -0
- package/dist/local/store.js +585 -0
- package/dist/local/store.js.map +1 -0
- package/dist/local/sync.d.ts +47 -0
- package/dist/local/sync.d.ts.map +1 -0
- package/dist/local/sync.js +518 -0
- package/dist/local/sync.js.map +1 -0
- package/dist/local/task-context-inspection.d.ts +23 -0
- package/dist/local/task-context-inspection.d.ts.map +1 -0
- package/dist/local/task-context-inspection.js +165 -0
- package/dist/local/task-context-inspection.js.map +1 -0
- package/dist/local/task-context-observations.d.ts +9553 -0
- package/dist/local/task-context-observations.d.ts.map +1 -0
- package/dist/local/task-context-observations.js +232 -0
- package/dist/local/task-context-observations.js.map +1 -0
- package/dist/local/task-context-provider.d.ts +18 -0
- package/dist/local/task-context-provider.d.ts.map +1 -0
- package/dist/local/task-context-provider.js +231 -0
- package/dist/local/task-context-provider.js.map +1 -0
- package/dist/local/task-context-schema.d.ts +847 -0
- package/dist/local/task-context-schema.d.ts.map +1 -0
- package/dist/local/task-context-schema.js +305 -0
- package/dist/local/task-context-schema.js.map +1 -0
- package/dist/local/task-context-source.d.ts +16 -0
- package/dist/local/task-context-source.d.ts.map +1 -0
- package/dist/local/task-context-source.js +45 -0
- package/dist/local/task-context-source.js.map +1 -0
- package/dist/local/task-context.d.ts +14 -0
- package/dist/local/task-context.d.ts.map +1 -0
- package/dist/local/task-context.js +570 -0
- package/dist/local/task-context.js.map +1 -0
- package/dist/local/test-commands.d.ts +71 -0
- package/dist/local/test-commands.d.ts.map +1 -0
- package/dist/local/test-commands.js +292 -0
- package/dist/local/test-commands.js.map +1 -0
- package/dist/local/tree-save.d.ts +117 -0
- package/dist/local/tree-save.d.ts.map +1 -0
- package/dist/local/tree-save.js +615 -0
- package/dist/local/tree-save.js.map +1 -0
- package/dist/local/variants.d.ts +125 -0
- package/dist/local/variants.d.ts.map +1 -0
- package/dist/local/variants.js +267 -0
- package/dist/local/variants.js.map +1 -0
- package/dist/local/workspace-admission.d.ts +61 -0
- package/dist/local/workspace-admission.d.ts.map +1 -0
- package/dist/local/workspace-admission.js +112 -0
- package/dist/local/workspace-admission.js.map +1 -0
- package/dist/local/workspace-authority-guard.d.ts +18 -0
- package/dist/local/workspace-authority-guard.d.ts.map +1 -0
- package/dist/local/workspace-authority-guard.js +69 -0
- package/dist/local/workspace-authority-guard.js.map +1 -0
- package/dist/local/workspace-authority.d.ts +33 -0
- package/dist/local/workspace-authority.d.ts.map +1 -0
- package/dist/local/workspace-authority.js +33 -0
- package/dist/local/workspace-authority.js.map +1 -0
- package/dist/local/workspace-branch-runtime.d.ts +61 -0
- package/dist/local/workspace-branch-runtime.d.ts.map +1 -0
- package/dist/local/workspace-branch-runtime.js +216 -0
- package/dist/local/workspace-branch-runtime.js.map +1 -0
- package/dist/local/workspace-built-content.d.ts +137 -0
- package/dist/local/workspace-built-content.d.ts.map +1 -0
- package/dist/local/workspace-built-content.js +393 -0
- package/dist/local/workspace-built-content.js.map +1 -0
- package/dist/local/workspace-claim-status-read.d.ts +53 -0
- package/dist/local/workspace-claim-status-read.d.ts.map +1 -0
- package/dist/local/workspace-claim-status-read.js +118 -0
- package/dist/local/workspace-claim-status-read.js.map +1 -0
- package/dist/local/workspace-claim-status.d.ts +172 -0
- package/dist/local/workspace-claim-status.d.ts.map +1 -0
- package/dist/local/workspace-claim-status.js +721 -0
- package/dist/local/workspace-claim-status.js.map +1 -0
- package/dist/local/workspace-claim-views.d.ts +45 -0
- package/dist/local/workspace-claim-views.d.ts.map +1 -0
- package/dist/local/workspace-claim-views.js +45 -0
- package/dist/local/workspace-claim-views.js.map +1 -0
- package/dist/local/workspace-cli.d.ts +46 -0
- package/dist/local/workspace-cli.d.ts.map +1 -0
- package/dist/local/workspace-cli.js +1524 -0
- package/dist/local/workspace-cli.js.map +1 -0
- package/dist/local/workspace-commit-resolver.d.ts +19 -0
- package/dist/local/workspace-commit-resolver.d.ts.map +1 -0
- package/dist/local/workspace-commit-resolver.js +47 -0
- package/dist/local/workspace-commit-resolver.js.map +1 -0
- package/dist/local/workspace-decision-store.d.ts +184 -0
- package/dist/local/workspace-decision-store.d.ts.map +1 -0
- package/dist/local/workspace-decision-store.js +510 -0
- package/dist/local/workspace-decision-store.js.map +1 -0
- package/dist/local/workspace-environment-runtime.d.ts +107 -0
- package/dist/local/workspace-environment-runtime.d.ts.map +1 -0
- package/dist/local/workspace-environment-runtime.js +135 -0
- package/dist/local/workspace-environment-runtime.js.map +1 -0
- package/dist/local/workspace-evidence-drop.d.ts +21 -0
- package/dist/local/workspace-evidence-drop.d.ts.map +1 -0
- package/dist/local/workspace-evidence-drop.js +58 -0
- package/dist/local/workspace-evidence-drop.js.map +1 -0
- package/dist/local/workspace-evidence-sign-tool.d.ts +20 -0
- package/dist/local/workspace-evidence-sign-tool.d.ts.map +1 -0
- package/dist/local/workspace-evidence-sign-tool.js +85 -0
- package/dist/local/workspace-evidence-sign-tool.js.map +1 -0
- package/dist/local/workspace-evidence-status.d.ts +89 -0
- package/dist/local/workspace-evidence-status.d.ts.map +1 -0
- package/dist/local/workspace-evidence-status.js +141 -0
- package/dist/local/workspace-evidence-status.js.map +1 -0
- package/dist/local/workspace-evidence.d.ts +145 -0
- package/dist/local/workspace-evidence.d.ts.map +1 -0
- package/dist/local/workspace-evidence.js +347 -0
- package/dist/local/workspace-evidence.js.map +1 -0
- package/dist/local/workspace-graph-store.d.ts +32 -0
- package/dist/local/workspace-graph-store.d.ts.map +1 -0
- package/dist/local/workspace-graph-store.js +249 -0
- package/dist/local/workspace-graph-store.js.map +1 -0
- package/dist/local/workspace-handoff.d.ts +32 -0
- package/dist/local/workspace-handoff.d.ts.map +1 -0
- package/dist/local/workspace-handoff.js +144 -0
- package/dist/local/workspace-handoff.js.map +1 -0
- package/dist/local/workspace-history-journal.d.ts +70 -0
- package/dist/local/workspace-history-journal.d.ts.map +1 -0
- package/dist/local/workspace-history-journal.js +131 -0
- package/dist/local/workspace-history-journal.js.map +1 -0
- package/dist/local/workspace-history-store.d.ts +98 -0
- package/dist/local/workspace-history-store.d.ts.map +1 -0
- package/dist/local/workspace-history-store.js +632 -0
- package/dist/local/workspace-history-store.js.map +1 -0
- package/dist/local/workspace-history-types.d.ts +307 -0
- package/dist/local/workspace-history-types.d.ts.map +1 -0
- package/dist/local/workspace-history-types.js +2 -0
- package/dist/local/workspace-history-types.js.map +1 -0
- package/dist/local/workspace-integration-runtime.d.ts +48 -0
- package/dist/local/workspace-integration-runtime.d.ts.map +1 -0
- package/dist/local/workspace-integration-runtime.js +419 -0
- package/dist/local/workspace-integration-runtime.js.map +1 -0
- package/dist/local/workspace-lock.d.ts +7 -0
- package/dist/local/workspace-lock.d.ts.map +1 -0
- package/dist/local/workspace-lock.js +211 -0
- package/dist/local/workspace-lock.js.map +1 -0
- package/dist/local/workspace-merge.d.ts +77 -0
- package/dist/local/workspace-merge.d.ts.map +1 -0
- package/dist/local/workspace-merge.js +703 -0
- package/dist/local/workspace-merge.js.map +1 -0
- package/dist/local/workspace-mixed-history.d.ts +33 -0
- package/dist/local/workspace-mixed-history.d.ts.map +1 -0
- package/dist/local/workspace-mixed-history.js +107 -0
- package/dist/local/workspace-mixed-history.js.map +1 -0
- package/dist/local/workspace-overlap-allocation.d.ts +33 -0
- package/dist/local/workspace-overlap-allocation.d.ts.map +1 -0
- package/dist/local/workspace-overlap-allocation.js +69 -0
- package/dist/local/workspace-overlap-allocation.js.map +1 -0
- package/dist/local/workspace-overlap-impact.d.ts +46 -0
- package/dist/local/workspace-overlap-impact.d.ts.map +1 -0
- package/dist/local/workspace-overlap-impact.js +162 -0
- package/dist/local/workspace-overlap-impact.js.map +1 -0
- package/dist/local/workspace-overlap.d.ts +109 -0
- package/dist/local/workspace-overlap.d.ts.map +1 -0
- package/dist/local/workspace-overlap.js +327 -0
- package/dist/local/workspace-overlap.js.map +1 -0
- package/dist/local/workspace-paths.d.ts +4 -0
- package/dist/local/workspace-paths.d.ts.map +1 -0
- package/dist/local/workspace-paths.js +8 -0
- package/dist/local/workspace-paths.js.map +1 -0
- package/dist/local/workspace-pick-runtime.d.ts +70 -0
- package/dist/local/workspace-pick-runtime.d.ts.map +1 -0
- package/dist/local/workspace-pick-runtime.js +177 -0
- package/dist/local/workspace-pick-runtime.js.map +1 -0
- package/dist/local/workspace-pick-store.d.ts +33 -0
- package/dist/local/workspace-pick-store.d.ts.map +1 -0
- package/dist/local/workspace-pick-store.js +43 -0
- package/dist/local/workspace-pick-store.js.map +1 -0
- package/dist/local/workspace-pick.d.ts +73 -0
- package/dist/local/workspace-pick.d.ts.map +1 -0
- package/dist/local/workspace-pick.js +253 -0
- package/dist/local/workspace-pick.js.map +1 -0
- package/dist/local/workspace-portable-authoring.d.ts +43 -0
- package/dist/local/workspace-portable-authoring.d.ts.map +1 -0
- package/dist/local/workspace-portable-authoring.js +128 -0
- package/dist/local/workspace-portable-authoring.js.map +1 -0
- package/dist/local/workspace-prune.d.ts +63 -0
- package/dist/local/workspace-prune.d.ts.map +1 -0
- package/dist/local/workspace-prune.js +267 -0
- package/dist/local/workspace-prune.js.map +1 -0
- package/dist/local/workspace-remote-fetch.d.ts +82 -0
- package/dist/local/workspace-remote-fetch.d.ts.map +1 -0
- package/dist/local/workspace-remote-fetch.js +409 -0
- package/dist/local/workspace-remote-fetch.js.map +1 -0
- package/dist/local/workspace-remote-provider.d.ts +97 -0
- package/dist/local/workspace-remote-provider.d.ts.map +1 -0
- package/dist/local/workspace-remote-provider.js +400 -0
- package/dist/local/workspace-remote-provider.js.map +1 -0
- package/dist/local/workspace-remote-pull-request-journal.d.ts +49 -0
- package/dist/local/workspace-remote-pull-request-journal.d.ts.map +1 -0
- package/dist/local/workspace-remote-pull-request-journal.js +63 -0
- package/dist/local/workspace-remote-pull-request-journal.js.map +1 -0
- package/dist/local/workspace-remote-pull-request.d.ts +36 -0
- package/dist/local/workspace-remote-pull-request.d.ts.map +1 -0
- package/dist/local/workspace-remote-pull-request.js +158 -0
- package/dist/local/workspace-remote-pull-request.js.map +1 -0
- package/dist/local/workspace-remote-push.d.ts +88 -0
- package/dist/local/workspace-remote-push.d.ts.map +1 -0
- package/dist/local/workspace-remote-push.js +297 -0
- package/dist/local/workspace-remote-push.js.map +1 -0
- package/dist/local/workspace-remote-topic-journal.d.ts +56 -0
- package/dist/local/workspace-remote-topic-journal.d.ts.map +1 -0
- package/dist/local/workspace-remote-topic-journal.js +121 -0
- package/dist/local/workspace-remote-topic-journal.js.map +1 -0
- package/dist/local/workspace-remote-topic.d.ts +45 -0
- package/dist/local/workspace-remote-topic.d.ts.map +1 -0
- package/dist/local/workspace-remote-topic.js +204 -0
- package/dist/local/workspace-remote-topic.js.map +1 -0
- package/dist/local/workspace-remote-transfer.d.ts +76 -0
- package/dist/local/workspace-remote-transfer.d.ts.map +1 -0
- package/dist/local/workspace-remote-transfer.js +270 -0
- package/dist/local/workspace-remote-transfer.js.map +1 -0
- package/dist/local/workspace-resolution.d.ts +145 -0
- package/dist/local/workspace-resolution.d.ts.map +1 -0
- package/dist/local/workspace-resolution.js +479 -0
- package/dist/local/workspace-resolution.js.map +1 -0
- package/dist/local/workspace-resolver-provider.d.ts +72 -0
- package/dist/local/workspace-resolver-provider.d.ts.map +1 -0
- package/dist/local/workspace-resolver-provider.js +312 -0
- package/dist/local/workspace-resolver-provider.js.map +1 -0
- package/dist/local/workspace-runtime-handoff.d.ts +52 -0
- package/dist/local/workspace-runtime-handoff.d.ts.map +1 -0
- package/dist/local/workspace-runtime-handoff.js +237 -0
- package/dist/local/workspace-runtime-handoff.js.map +1 -0
- package/dist/local/workspace-runtime-lease.d.ts +26 -0
- package/dist/local/workspace-runtime-lease.d.ts.map +1 -0
- package/dist/local/workspace-runtime-lease.js +123 -0
- package/dist/local/workspace-runtime-lease.js.map +1 -0
- package/dist/local/workspace-runtime.d.ts +690 -0
- package/dist/local/workspace-runtime.d.ts.map +1 -0
- package/dist/local/workspace-runtime.js +2124 -0
- package/dist/local/workspace-runtime.js.map +1 -0
- package/dist/local/workspace-scope.d.ts +70 -0
- package/dist/local/workspace-scope.d.ts.map +1 -0
- package/dist/local/workspace-scope.js +206 -0
- package/dist/local/workspace-scope.js.map +1 -0
- package/dist/local/workspace-sources.d.ts +159 -0
- package/dist/local/workspace-sources.d.ts.map +1 -0
- package/dist/local/workspace-sources.js +570 -0
- package/dist/local/workspace-sources.js.map +1 -0
- package/dist/local/workspace-store-database.d.ts +5 -0
- package/dist/local/workspace-store-database.d.ts.map +1 -0
- package/dist/local/workspace-store-database.js +726 -0
- package/dist/local/workspace-store-database.js.map +1 -0
- package/dist/local/workspace-store.d.ts +261 -0
- package/dist/local/workspace-store.d.ts.map +1 -0
- package/dist/local/workspace-store.js +831 -0
- package/dist/local/workspace-store.js.map +1 -0
- package/dist/local/workspace-topology-runtime.d.ts +27 -0
- package/dist/local/workspace-topology-runtime.d.ts.map +1 -0
- package/dist/local/workspace-topology-runtime.js +396 -0
- package/dist/local/workspace-topology-runtime.js.map +1 -0
- package/dist/local/workspace-topology.d.ts +140 -0
- package/dist/local/workspace-topology.d.ts.map +1 -0
- package/dist/local/workspace-topology.js +359 -0
- package/dist/local/workspace-topology.js.map +1 -0
- package/dist/local/workspace-upstream-inspection.d.ts +60 -0
- package/dist/local/workspace-upstream-inspection.d.ts.map +1 -0
- package/dist/local/workspace-upstream-inspection.js +189 -0
- package/dist/local/workspace-upstream-inspection.js.map +1 -0
- package/dist/local/workspace-upstream-runtime.d.ts +91 -0
- package/dist/local/workspace-upstream-runtime.d.ts.map +1 -0
- package/dist/local/workspace-upstream-runtime.js +270 -0
- package/dist/local/workspace-upstream-runtime.js.map +1 -0
- package/dist/local/workspace-upstream-store.d.ts +51 -0
- package/dist/local/workspace-upstream-store.d.ts.map +1 -0
- package/dist/local/workspace-upstream-store.js +475 -0
- package/dist/local/workspace-upstream-store.js.map +1 -0
- package/dist/local/workspace-viewer-server.d.ts +136 -0
- package/dist/local/workspace-viewer-server.d.ts.map +1 -0
- package/dist/local/workspace-viewer-server.js +1097 -0
- package/dist/local/workspace-viewer-server.js.map +1 -0
- package/dist/local/workspace-viewer-snapshot.d.ts +49 -0
- package/dist/local/workspace-viewer-snapshot.d.ts.map +1 -0
- package/dist/local/workspace-viewer-snapshot.js +91 -0
- package/dist/local/workspace-viewer-snapshot.js.map +1 -0
- package/dist/local/worktree-projection.d.ts +76 -0
- package/dist/local/worktree-projection.d.ts.map +1 -0
- package/dist/local/worktree-projection.js +470 -0
- package/dist/local/worktree-projection.js.map +1 -0
- package/dist/mcp/client-identity.d.ts +8 -0
- package/dist/mcp/client-identity.d.ts.map +1 -0
- package/dist/mcp/client-identity.js +33 -0
- package/dist/mcp/client-identity.js.map +1 -0
- package/dist/mcp/graph-to-code.d.ts +53 -0
- package/dist/mcp/graph-to-code.d.ts.map +1 -0
- package/dist/mcp/graph-to-code.js +1624 -0
- package/dist/mcp/graph-to-code.js.map +1 -0
- package/dist/mcp/index.d.ts +3 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +3 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/mcp/stdio/graph-to-code.d.ts +3 -0
- package/dist/mcp/stdio/graph-to-code.d.ts.map +1 -0
- package/dist/mcp/stdio/graph-to-code.js +55 -0
- package/dist/mcp/stdio/graph-to-code.js.map +1 -0
- package/dist/mcp/stdio/worktree.d.ts +3 -0
- package/dist/mcp/stdio/worktree.d.ts.map +1 -0
- package/dist/mcp/stdio/worktree.js +67 -0
- package/dist/mcp/stdio/worktree.js.map +1 -0
- package/dist/mcp/worktree-claim-status.d.ts +162 -0
- package/dist/mcp/worktree-claim-status.d.ts.map +1 -0
- package/dist/mcp/worktree-claim-status.js +113 -0
- package/dist/mcp/worktree-claim-status.js.map +1 -0
- package/dist/mcp/worktree-dispatch.d.ts +13 -0
- package/dist/mcp/worktree-dispatch.d.ts.map +1 -0
- package/dist/mcp/worktree-dispatch.js +52 -0
- package/dist/mcp/worktree-dispatch.js.map +1 -0
- package/dist/mcp/worktree-errors.d.ts +15 -0
- package/dist/mcp/worktree-errors.d.ts.map +1 -0
- package/dist/mcp/worktree-errors.js +17 -0
- package/dist/mcp/worktree-errors.js.map +1 -0
- package/dist/mcp/worktree-health.d.ts +12 -0
- package/dist/mcp/worktree-health.d.ts.map +1 -0
- package/dist/mcp/worktree-health.js +32 -0
- package/dist/mcp/worktree-health.js.map +1 -0
- package/dist/mcp/worktree-results.d.ts +15 -0
- package/dist/mcp/worktree-results.d.ts.map +1 -0
- package/dist/mcp/worktree-results.js +12 -0
- package/dist/mcp/worktree-results.js.map +1 -0
- package/dist/mcp/worktree-task-context.d.ts +57 -0
- package/dist/mcp/worktree-task-context.d.ts.map +1 -0
- package/dist/mcp/worktree-task-context.js +45 -0
- package/dist/mcp/worktree-task-context.js.map +1 -0
- package/dist/mcp/worktree-tools.d.ts +2648 -0
- package/dist/mcp/worktree-tools.d.ts.map +1 -0
- package/dist/mcp/worktree-tools.js +192 -0
- package/dist/mcp/worktree-tools.js.map +1 -0
- package/dist/mcp/worktree.d.ts +33 -0
- package/dist/mcp/worktree.d.ts.map +1 -0
- package/dist/mcp/worktree.js +551 -0
- package/dist/mcp/worktree.js.map +1 -0
- package/dist/own-package.d.ts +13 -0
- package/dist/own-package.d.ts.map +1 -0
- package/dist/own-package.js +32 -0
- package/dist/own-package.js.map +1 -0
- package/dist/packages-browse.d.ts +107 -0
- package/dist/packages-browse.d.ts.map +1 -0
- package/dist/packages-browse.js +646 -0
- package/dist/packages-browse.js.map +1 -0
- package/dist/packages-cli.d.ts +8 -0
- package/dist/packages-cli.d.ts.map +1 -0
- package/dist/packages-cli.js +184 -0
- package/dist/packages-cli.js.map +1 -0
- package/dist/packages-uses.d.ts +46 -0
- package/dist/packages-uses.d.ts.map +1 -0
- package/dist/packages-uses.js +737 -0
- package/dist/packages-uses.js.map +1 -0
- package/dist/portable.d.ts +7 -0
- package/dist/portable.d.ts.map +1 -0
- package/dist/portable.js +14 -0
- package/dist/portable.js.map +1 -0
- package/dist/quiet-warnings.d.ts +3 -0
- package/dist/quiet-warnings.d.ts.map +1 -0
- package/dist/quiet-warnings.js +21 -0
- package/dist/quiet-warnings.js.map +1 -0
- package/dist/view-seam.d.ts +62 -0
- package/dist/view-seam.d.ts.map +1 -0
- package/dist/view-seam.js +70 -0
- package/dist/view-seam.js.map +1 -0
- package/generated/graph-packages/index.json +5 -0
- package/graph-packages.lock.json +4 -0
- package/package.json +81 -0
- package/viewer/assets/index-BZKGDARF.css +1 -0
- package/viewer/assets/index-DWu0CbZZ.js +272 -0
- package/viewer/index.html +13 -0
|
@@ -0,0 +1,1624 @@
|
|
|
1
|
+
// The Graph-to-Code reads leave Variant Set nodes out for a client that does not offer their
|
|
2
|
+
// version (graph-variants C1). Tool results go to an agent as JSON text, which reads any node
|
|
3
|
+
// type, so every such request offers version 1, as graph-schema's graphVariantSetVersionsQuery().
|
|
4
|
+
const GRAPH_VARIANT_SET_VERSIONS_QUERY = 'graph_variant_set_versions=1';
|
|
5
|
+
const MCP_PROTOCOL_VERSION = '2025-06-18';
|
|
6
|
+
export const MAX_HOSTED_GRAPH_TO_CODE_MCP_REQUEST_BYTES = 64 * 1024;
|
|
7
|
+
const MCP_RESPONSE_HEADERS = {
|
|
8
|
+
'Content-Type': 'application/json',
|
|
9
|
+
'MCP-Protocol-Version': MCP_PROTOCOL_VERSION
|
|
10
|
+
};
|
|
11
|
+
export class HostedMcpRequestTooLargeError extends Error {
|
|
12
|
+
}
|
|
13
|
+
export async function readHostedGraphToCodeMcpRequestBody(request) {
|
|
14
|
+
const declared_length = request.headers.get('content-length');
|
|
15
|
+
if (declared_length !== null &&
|
|
16
|
+
(!/^\d+$/.test(declared_length) ||
|
|
17
|
+
Number(declared_length) > MAX_HOSTED_GRAPH_TO_CODE_MCP_REQUEST_BYTES)) {
|
|
18
|
+
throw new HostedMcpRequestTooLargeError();
|
|
19
|
+
}
|
|
20
|
+
if (!request.body)
|
|
21
|
+
return new Uint8Array();
|
|
22
|
+
const reader = request.body.getReader();
|
|
23
|
+
const chunks = [];
|
|
24
|
+
let byte_length = 0;
|
|
25
|
+
while (true) {
|
|
26
|
+
const result = await reader.read();
|
|
27
|
+
if (result.done)
|
|
28
|
+
break;
|
|
29
|
+
byte_length += result.value.byteLength;
|
|
30
|
+
if (byte_length > MAX_HOSTED_GRAPH_TO_CODE_MCP_REQUEST_BYTES) {
|
|
31
|
+
await reader.cancel();
|
|
32
|
+
throw new HostedMcpRequestTooLargeError();
|
|
33
|
+
}
|
|
34
|
+
chunks.push(result.value);
|
|
35
|
+
}
|
|
36
|
+
const bytes = new Uint8Array(byte_length);
|
|
37
|
+
let offset = 0;
|
|
38
|
+
for (const chunk of chunks) {
|
|
39
|
+
bytes.set(chunk, offset);
|
|
40
|
+
offset += chunk.byteLength;
|
|
41
|
+
}
|
|
42
|
+
return bytes;
|
|
43
|
+
}
|
|
44
|
+
export function buildHostedGraphToCodeMcpRequestTooLargeResponse() {
|
|
45
|
+
return Response.json({
|
|
46
|
+
jsonrpc: '2.0',
|
|
47
|
+
id: null,
|
|
48
|
+
error: {
|
|
49
|
+
code: -32005,
|
|
50
|
+
message: 'MCP request body exceeds the 64 KiB byte budget.'
|
|
51
|
+
}
|
|
52
|
+
}, {
|
|
53
|
+
status: 413,
|
|
54
|
+
headers: MCP_RESPONSE_HEADERS
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
const graph_to_code_target_schema = {
|
|
58
|
+
type: 'object',
|
|
59
|
+
additionalProperties: false,
|
|
60
|
+
properties: {
|
|
61
|
+
branch_id: {
|
|
62
|
+
type: 'string',
|
|
63
|
+
format: 'uuid',
|
|
64
|
+
description: 'Pull or search the current graph for this branch.'
|
|
65
|
+
},
|
|
66
|
+
pull_request_id: {
|
|
67
|
+
type: 'string',
|
|
68
|
+
format: 'uuid',
|
|
69
|
+
description: 'Pull or search the pull request source graph and include active diff/session metadata.'
|
|
70
|
+
},
|
|
71
|
+
commit_id: {
|
|
72
|
+
type: 'string',
|
|
73
|
+
format: 'uuid',
|
|
74
|
+
description: 'Pull or search an immutable commit graph snapshot.'
|
|
75
|
+
},
|
|
76
|
+
worktree_id: {
|
|
77
|
+
type: 'string',
|
|
78
|
+
format: 'uuid',
|
|
79
|
+
description: 'Read an exact provisional AI worktree proposal.'
|
|
80
|
+
},
|
|
81
|
+
worktree_revision: {
|
|
82
|
+
type: 'integer',
|
|
83
|
+
minimum: 0,
|
|
84
|
+
description: 'Required exact revision for a worktree target.'
|
|
85
|
+
},
|
|
86
|
+
worktree_root_hash: {
|
|
87
|
+
type: 'string',
|
|
88
|
+
pattern: '^sha256:[0-9a-f]{64}$',
|
|
89
|
+
description: 'Required exact sync root hash for a worktree target.'
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
description: 'Provide exactly one target id. If omitted, the MCP wrapper uses exactly one configured SDLC_BRANCH_ID, SDLC_PULL_REQUEST_ID, or SDLC_COMMIT_ID.'
|
|
93
|
+
};
|
|
94
|
+
const sdlc_compare_graph_subgraphs_input_schema = {
|
|
95
|
+
type: 'object',
|
|
96
|
+
additionalProperties: false,
|
|
97
|
+
required: ['target', 'source', 'seed_entity_ids'],
|
|
98
|
+
properties: {
|
|
99
|
+
target: graph_to_code_target_schema,
|
|
100
|
+
source: graph_to_code_target_schema,
|
|
101
|
+
seed_entity_ids: {
|
|
102
|
+
type: 'array',
|
|
103
|
+
minItems: 1,
|
|
104
|
+
maxItems: 24,
|
|
105
|
+
items: { type: 'string', minLength: 1, maxLength: 200 }
|
|
106
|
+
},
|
|
107
|
+
projection: {
|
|
108
|
+
type: 'object',
|
|
109
|
+
additionalProperties: false,
|
|
110
|
+
properties: {
|
|
111
|
+
connection_hops: { type: 'integer', minimum: 0, maximum: 3 },
|
|
112
|
+
connection_direction: {
|
|
113
|
+
type: 'string',
|
|
114
|
+
enum: ['incoming', 'outgoing', 'both']
|
|
115
|
+
},
|
|
116
|
+
descendants: { type: 'string', enum: ['none', 'direct', 'all'] },
|
|
117
|
+
include_intersecting_paths: { type: 'boolean' },
|
|
118
|
+
related_path_hops: { type: 'integer', minimum: 0, maximum: 1 },
|
|
119
|
+
include_internal_edges: { type: 'boolean' }
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
max_nodes: { type: 'integer', minimum: 1, maximum: 240 },
|
|
123
|
+
max_edges: { type: 'integer', minimum: 0, maximum: 480 },
|
|
124
|
+
max_paths: { type: 'integer', minimum: 0, maximum: 240 },
|
|
125
|
+
max_path_relations: { type: 'integer', minimum: 0, maximum: 240 }
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
const graph_aggregate_comparison_source_schema = {
|
|
129
|
+
type: 'object',
|
|
130
|
+
additionalProperties: false,
|
|
131
|
+
required: [
|
|
132
|
+
'organization_id',
|
|
133
|
+
'project_id',
|
|
134
|
+
'source_kind',
|
|
135
|
+
'source_id',
|
|
136
|
+
'semantic_revision',
|
|
137
|
+
'semantic_root_hash',
|
|
138
|
+
'presentation_revision'
|
|
139
|
+
],
|
|
140
|
+
properties: {
|
|
141
|
+
organization_id: { type: 'string', minLength: 1 },
|
|
142
|
+
project_id: { type: 'string', minLength: 1 },
|
|
143
|
+
source_kind: {
|
|
144
|
+
type: 'string',
|
|
145
|
+
enum: ['branch', 'commit', 'snapshot', 'worktree']
|
|
146
|
+
},
|
|
147
|
+
source_id: { type: 'string', minLength: 1 },
|
|
148
|
+
semantic_revision: { type: 'string', minLength: 1 },
|
|
149
|
+
semantic_root_hash: {
|
|
150
|
+
type: 'string',
|
|
151
|
+
pattern: '^sha256:[0-9a-f]{64}$'
|
|
152
|
+
},
|
|
153
|
+
presentation_revision: { type: 'string', minLength: 1 }
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
const graph_scope_recipe_input_schema = {
|
|
157
|
+
type: 'object',
|
|
158
|
+
additionalProperties: false,
|
|
159
|
+
required: ['schema_version', 'selectors'],
|
|
160
|
+
properties: {
|
|
161
|
+
schema_version: { type: 'integer', const: 1 },
|
|
162
|
+
selectors: {
|
|
163
|
+
type: 'object',
|
|
164
|
+
additionalProperties: false,
|
|
165
|
+
properties: {
|
|
166
|
+
path_ids: { type: 'array', items: { type: 'string' } },
|
|
167
|
+
path_tree_root_ids: { type: 'array', items: { type: 'string' } },
|
|
168
|
+
node_ids: { type: 'array', items: { type: 'string' } },
|
|
169
|
+
edge_ids: { type: 'array', items: { type: 'string' } }
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
const sdlc_compare_path_aggregates_input_schema = {
|
|
175
|
+
type: 'object',
|
|
176
|
+
additionalProperties: false,
|
|
177
|
+
required: [
|
|
178
|
+
'schema_version',
|
|
179
|
+
'algorithm_version',
|
|
180
|
+
'target',
|
|
181
|
+
'source',
|
|
182
|
+
'merge_base',
|
|
183
|
+
'max_paths',
|
|
184
|
+
'max_response_bytes',
|
|
185
|
+
'page_cursor'
|
|
186
|
+
],
|
|
187
|
+
properties: {
|
|
188
|
+
schema_version: { type: 'integer', const: 1 },
|
|
189
|
+
algorithm_version: { type: 'integer', const: 1 },
|
|
190
|
+
target: graph_aggregate_comparison_source_schema,
|
|
191
|
+
source: graph_aggregate_comparison_source_schema,
|
|
192
|
+
merge_base: {
|
|
193
|
+
anyOf: [graph_aggregate_comparison_source_schema, { type: 'null' }]
|
|
194
|
+
},
|
|
195
|
+
max_paths: { type: 'integer', minimum: 1, maximum: 100 },
|
|
196
|
+
max_response_bytes: {
|
|
197
|
+
type: 'integer',
|
|
198
|
+
minimum: 1024,
|
|
199
|
+
maximum: 262144
|
|
200
|
+
},
|
|
201
|
+
page_cursor: { type: ['string', 'null'], maxLength: 512 },
|
|
202
|
+
contributor_path_id: { type: 'string', minLength: 1, maxLength: 200 },
|
|
203
|
+
max_contributors: { type: 'integer', minimum: 1, maximum: 100 },
|
|
204
|
+
contributor_cursor: { type: ['string', 'null'], maxLength: 512 }
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
const sdlc_compare_scope_aggregates_input_schema = {
|
|
208
|
+
type: 'object',
|
|
209
|
+
additionalProperties: false,
|
|
210
|
+
required: [
|
|
211
|
+
'schema_version',
|
|
212
|
+
'algorithm_version',
|
|
213
|
+
'target',
|
|
214
|
+
'source',
|
|
215
|
+
'merge_base',
|
|
216
|
+
'scope_recipe',
|
|
217
|
+
'page_kind',
|
|
218
|
+
'max_entities',
|
|
219
|
+
'max_response_bytes',
|
|
220
|
+
'page_cursor'
|
|
221
|
+
],
|
|
222
|
+
properties: {
|
|
223
|
+
schema_version: { type: 'integer', const: 1 },
|
|
224
|
+
algorithm_version: { type: 'integer', const: 1 },
|
|
225
|
+
target: graph_aggregate_comparison_source_schema,
|
|
226
|
+
source: graph_aggregate_comparison_source_schema,
|
|
227
|
+
merge_base: {
|
|
228
|
+
anyOf: [graph_aggregate_comparison_source_schema, { type: 'null' }]
|
|
229
|
+
},
|
|
230
|
+
scope_recipe: graph_scope_recipe_input_schema,
|
|
231
|
+
page_kind: { type: 'string', enum: ['entities', 'path_tree'] },
|
|
232
|
+
max_entities: { type: 'integer', minimum: 1, maximum: 100 },
|
|
233
|
+
max_response_bytes: {
|
|
234
|
+
type: 'integer',
|
|
235
|
+
minimum: 1024,
|
|
236
|
+
maximum: 262144
|
|
237
|
+
},
|
|
238
|
+
page_cursor: { type: ['string', 'null'], maxLength: 512 }
|
|
239
|
+
}
|
|
240
|
+
};
|
|
241
|
+
const sdlc_scope_impact_input_schema = {
|
|
242
|
+
type: 'object',
|
|
243
|
+
additionalProperties: false,
|
|
244
|
+
required: ['scope_recipe', 'impact_entity', 'page_kind'],
|
|
245
|
+
properties: {
|
|
246
|
+
schema_version: { type: 'integer', const: 1, default: 1 },
|
|
247
|
+
target: graph_to_code_target_schema,
|
|
248
|
+
scope_recipe: graph_scope_recipe_input_schema,
|
|
249
|
+
impact_entity: {
|
|
250
|
+
type: 'object',
|
|
251
|
+
additionalProperties: false,
|
|
252
|
+
required: ['entity_kind', 'entity_id'],
|
|
253
|
+
properties: {
|
|
254
|
+
entity_kind: { type: 'string', enum: ['node', 'edge'] },
|
|
255
|
+
entity_id: { type: 'string', minLength: 1, maxLength: 200 }
|
|
256
|
+
}
|
|
257
|
+
},
|
|
258
|
+
page_kind: {
|
|
259
|
+
type: 'string',
|
|
260
|
+
enum: [
|
|
261
|
+
'impact_summary',
|
|
262
|
+
'impact_graph_boundary',
|
|
263
|
+
'impact_path_reuse',
|
|
264
|
+
'impact_ownership'
|
|
265
|
+
]
|
|
266
|
+
},
|
|
267
|
+
page_cursor: { type: ['string', 'null'], maxLength: 500 },
|
|
268
|
+
source_pin: {
|
|
269
|
+
type: 'object',
|
|
270
|
+
additionalProperties: false,
|
|
271
|
+
required: ['semantic_revision', 'semantic_root_hash'],
|
|
272
|
+
properties: {
|
|
273
|
+
semantic_revision: { type: 'string', minLength: 1, maxLength: 200 },
|
|
274
|
+
semantic_root_hash: {
|
|
275
|
+
type: 'string',
|
|
276
|
+
pattern: '^sha256:[0-9a-f]{64}$'
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
};
|
|
282
|
+
const sdlc_graph_search_input_schema = {
|
|
283
|
+
type: 'object',
|
|
284
|
+
additionalProperties: false,
|
|
285
|
+
properties: {
|
|
286
|
+
target: graph_to_code_target_schema,
|
|
287
|
+
mode: {
|
|
288
|
+
type: 'string',
|
|
289
|
+
enum: ['search', 'page'],
|
|
290
|
+
default: 'search',
|
|
291
|
+
description: 'Use search for focused retrieval. Use page to list graph entities without terms using cursor pagination.'
|
|
292
|
+
},
|
|
293
|
+
terms: {
|
|
294
|
+
type: 'array',
|
|
295
|
+
items: { type: 'string', minLength: 1, maxLength: 160 },
|
|
296
|
+
maxItems: 24,
|
|
297
|
+
description: 'Search terms for labels, descriptions, relationship labels, and graph entity data.'
|
|
298
|
+
},
|
|
299
|
+
entity_ids: {
|
|
300
|
+
type: 'array',
|
|
301
|
+
items: { type: 'string', minLength: 1, maxLength: 200 },
|
|
302
|
+
maxItems: 200,
|
|
303
|
+
description: 'Exact graph entity ids to return or expand after an initial search.'
|
|
304
|
+
},
|
|
305
|
+
page_cursor: {
|
|
306
|
+
type: 'string',
|
|
307
|
+
maxLength: 1000,
|
|
308
|
+
description: 'Opaque cursor from pagination.next_cursor. Use only with mode page.'
|
|
309
|
+
},
|
|
310
|
+
page_size: {
|
|
311
|
+
type: 'integer',
|
|
312
|
+
minimum: 1,
|
|
313
|
+
maximum: 240,
|
|
314
|
+
default: 80,
|
|
315
|
+
description: 'Maximum nodes returned in page mode.'
|
|
316
|
+
},
|
|
317
|
+
adjacency_hops: {
|
|
318
|
+
type: 'integer',
|
|
319
|
+
minimum: 0,
|
|
320
|
+
maximum: 3,
|
|
321
|
+
default: 1
|
|
322
|
+
},
|
|
323
|
+
include_children: { type: 'boolean', default: false },
|
|
324
|
+
include_parents: { type: 'boolean', default: true },
|
|
325
|
+
include_paths: { type: 'boolean', default: true },
|
|
326
|
+
projection: {
|
|
327
|
+
type: 'object',
|
|
328
|
+
additionalProperties: false,
|
|
329
|
+
description: 'Composable deterministic subgraph projection rules shared with the SDLC editor and hosted AI.',
|
|
330
|
+
properties: {
|
|
331
|
+
connection_hops: { type: 'integer', minimum: 0, maximum: 3 },
|
|
332
|
+
connection_direction: {
|
|
333
|
+
type: 'string',
|
|
334
|
+
enum: ['incoming', 'outgoing', 'both']
|
|
335
|
+
},
|
|
336
|
+
descendants: {
|
|
337
|
+
type: 'string',
|
|
338
|
+
enum: ['none', 'direct', 'all']
|
|
339
|
+
},
|
|
340
|
+
include_intersecting_paths: { type: 'boolean' },
|
|
341
|
+
related_path_hops: { type: 'integer', minimum: 0, maximum: 1 },
|
|
342
|
+
include_internal_edges: { type: 'boolean' }
|
|
343
|
+
}
|
|
344
|
+
},
|
|
345
|
+
max_nodes: {
|
|
346
|
+
type: 'integer',
|
|
347
|
+
minimum: 1,
|
|
348
|
+
maximum: 240,
|
|
349
|
+
default: 80
|
|
350
|
+
},
|
|
351
|
+
max_edges: {
|
|
352
|
+
type: 'integer',
|
|
353
|
+
minimum: 0,
|
|
354
|
+
maximum: 480,
|
|
355
|
+
default: 160
|
|
356
|
+
},
|
|
357
|
+
max_paths: {
|
|
358
|
+
type: 'integer',
|
|
359
|
+
minimum: 0,
|
|
360
|
+
maximum: 240,
|
|
361
|
+
default: 80
|
|
362
|
+
},
|
|
363
|
+
max_path_relations: {
|
|
364
|
+
type: 'integer',
|
|
365
|
+
minimum: 0,
|
|
366
|
+
maximum: 240,
|
|
367
|
+
default: 80
|
|
368
|
+
},
|
|
369
|
+
include_graph_context: {
|
|
370
|
+
type: 'boolean',
|
|
371
|
+
default: false,
|
|
372
|
+
description: 'When true, also returns graph_context as a compact prompt string.'
|
|
373
|
+
},
|
|
374
|
+
format: {
|
|
375
|
+
type: 'string',
|
|
376
|
+
enum: [
|
|
377
|
+
'compact_json',
|
|
378
|
+
'graph_tile_first_class',
|
|
379
|
+
'graph_tile_embedded_edges',
|
|
380
|
+
'graph_tile_embedded_typed_details'
|
|
381
|
+
],
|
|
382
|
+
default: 'compact_json'
|
|
383
|
+
},
|
|
384
|
+
tile_delimiter: {
|
|
385
|
+
type: 'string',
|
|
386
|
+
enum: ['tab', 'comma', 'pipe', 'space'],
|
|
387
|
+
default: 'pipe'
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
};
|
|
391
|
+
const sdlc_empty_input_schema = {
|
|
392
|
+
type: 'object',
|
|
393
|
+
additionalProperties: false,
|
|
394
|
+
properties: {}
|
|
395
|
+
};
|
|
396
|
+
const sdlc_graph_pull_input_schema = {
|
|
397
|
+
type: 'object',
|
|
398
|
+
additionalProperties: false,
|
|
399
|
+
properties: {
|
|
400
|
+
target: graph_to_code_target_schema,
|
|
401
|
+
include_graph_context: {
|
|
402
|
+
type: 'boolean',
|
|
403
|
+
default: false,
|
|
404
|
+
description: 'When true, also returns graph_context as a compact prompt string.'
|
|
405
|
+
},
|
|
406
|
+
format: {
|
|
407
|
+
type: 'string',
|
|
408
|
+
enum: [
|
|
409
|
+
'compact_json',
|
|
410
|
+
'graph_tile_first_class',
|
|
411
|
+
'graph_tile_embedded_edges',
|
|
412
|
+
'graph_tile_embedded_typed_details'
|
|
413
|
+
],
|
|
414
|
+
default: 'compact_json'
|
|
415
|
+
},
|
|
416
|
+
tile_delimiter: {
|
|
417
|
+
type: 'string',
|
|
418
|
+
enum: ['tab', 'comma', 'pipe', 'space'],
|
|
419
|
+
default: 'pipe'
|
|
420
|
+
}
|
|
421
|
+
},
|
|
422
|
+
description: 'Download the full stripped graph snapshot for a branch, pull request, or commit target. If target is omitted, the MCP wrapper uses exactly one configured default target.'
|
|
423
|
+
};
|
|
424
|
+
const sdlc_developer_skills_input_schema = {
|
|
425
|
+
type: 'object',
|
|
426
|
+
additionalProperties: false,
|
|
427
|
+
properties: {
|
|
428
|
+
skill_id: {
|
|
429
|
+
type: 'string',
|
|
430
|
+
description: 'Optional skill id. When omitted, returns the full developer skill catalog.'
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
};
|
|
434
|
+
const sdlc_package_search_input_schema = {
|
|
435
|
+
type: 'object',
|
|
436
|
+
additionalProperties: false,
|
|
437
|
+
properties: {
|
|
438
|
+
query: { type: 'string', maxLength: 160 },
|
|
439
|
+
project_id: { type: 'string', format: 'uuid' }
|
|
440
|
+
}
|
|
441
|
+
};
|
|
442
|
+
const sdlc_package_get_input_schema = {
|
|
443
|
+
type: 'object',
|
|
444
|
+
additionalProperties: false,
|
|
445
|
+
required: ['package_id'],
|
|
446
|
+
properties: { package_id: { type: 'string', format: 'uuid' } }
|
|
447
|
+
};
|
|
448
|
+
const sdlc_package_compare_input_schema = {
|
|
449
|
+
type: 'object',
|
|
450
|
+
additionalProperties: false,
|
|
451
|
+
required: ['package_id', 'branch_id'],
|
|
452
|
+
properties: {
|
|
453
|
+
package_id: { type: 'string', format: 'uuid' },
|
|
454
|
+
branch_id: { type: 'string', format: 'uuid' }
|
|
455
|
+
}
|
|
456
|
+
};
|
|
457
|
+
const sdlc_package_proposal_list_input_schema = {
|
|
458
|
+
type: 'object',
|
|
459
|
+
additionalProperties: false,
|
|
460
|
+
required: ['organization_id', 'project_id'],
|
|
461
|
+
properties: {
|
|
462
|
+
organization_id: { type: 'string', format: 'uuid' },
|
|
463
|
+
project_id: { type: 'string', format: 'uuid' }
|
|
464
|
+
}
|
|
465
|
+
};
|
|
466
|
+
const sdlc_package_proposal_create_input_schema = {
|
|
467
|
+
type: 'object',
|
|
468
|
+
additionalProperties: false,
|
|
469
|
+
required: ['organization_id', 'project_id', 'branch_id', 'title'],
|
|
470
|
+
properties: {
|
|
471
|
+
organization_id: { type: 'string', format: 'uuid' },
|
|
472
|
+
project_id: { type: 'string', format: 'uuid' },
|
|
473
|
+
branch_id: { type: 'string', format: 'uuid' },
|
|
474
|
+
source_workspace_id: { type: 'string', format: 'uuid' },
|
|
475
|
+
title: { type: 'string', minLength: 1, maxLength: 200 },
|
|
476
|
+
summary: { type: 'string', maxLength: 1000 },
|
|
477
|
+
rationale: { type: 'string', maxLength: 2000 },
|
|
478
|
+
package_name: { type: 'string', minLength: 1 },
|
|
479
|
+
package_display_name: { type: 'string', minLength: 1 },
|
|
480
|
+
asset_id: { type: 'string', minLength: 1 },
|
|
481
|
+
package_version: {
|
|
482
|
+
type: 'string',
|
|
483
|
+
pattern: '^[0-9]+\\.[0-9]+\\.[0-9]+(?:-[0-9A-Za-z.-]+)?(?:\\+[0-9A-Za-z.-]+)?$'
|
|
484
|
+
},
|
|
485
|
+
asset_version: { type: 'string', minLength: 1 },
|
|
486
|
+
branch_node_ids: {
|
|
487
|
+
type: 'array',
|
|
488
|
+
minItems: 1,
|
|
489
|
+
items: { type: 'string', format: 'uuid' }
|
|
490
|
+
},
|
|
491
|
+
branch_path_id: { type: 'string', format: 'uuid' },
|
|
492
|
+
evidence: { type: 'object', additionalProperties: true }
|
|
493
|
+
}
|
|
494
|
+
};
|
|
495
|
+
const SDLC_GRAPH_TO_CODE_MCP_TOOLS = [
|
|
496
|
+
{
|
|
497
|
+
name: 'sdlc_graph_pull',
|
|
498
|
+
title: 'Pull SDLC Graph',
|
|
499
|
+
description: 'Read-only full graph pull for local coding agents. Thin wrapper over POST /api/v1/graph-to-code/pull.',
|
|
500
|
+
inputSchema: sdlc_graph_pull_input_schema
|
|
501
|
+
},
|
|
502
|
+
{
|
|
503
|
+
name: 'sdlc_graph_search',
|
|
504
|
+
title: 'Search SDLC Graph',
|
|
505
|
+
description: 'Read-only graph search for coding agents. Thin wrapper over /api/v1/graph/{branch,commit}/{id}/search and /api/v1/pull-request/{id}/search.',
|
|
506
|
+
inputSchema: sdlc_graph_search_input_schema
|
|
507
|
+
},
|
|
508
|
+
{
|
|
509
|
+
name: 'sdlc_compare_graph_subgraphs',
|
|
510
|
+
title: 'Compare SDLC Graph Subgraphs',
|
|
511
|
+
description: 'Project the same seeded semantic subgraph from two exact graph targets and compare content hashes.',
|
|
512
|
+
inputSchema: sdlc_compare_graph_subgraphs_input_schema
|
|
513
|
+
},
|
|
514
|
+
{
|
|
515
|
+
name: 'sdlc_compare_path_aggregates',
|
|
516
|
+
title: 'Compare SDLC Path Aggregates',
|
|
517
|
+
description: 'Compare Path definitions, membership, retained-member content, and result roots across exact graph sources.',
|
|
518
|
+
inputSchema: sdlc_compare_path_aggregates_input_schema
|
|
519
|
+
},
|
|
520
|
+
{
|
|
521
|
+
name: 'sdlc_compare_scope_aggregates',
|
|
522
|
+
title: 'Compare SDLC Scope Aggregates',
|
|
523
|
+
description: 'Compare one Scope recipe and its member impact across exact graph sources.',
|
|
524
|
+
inputSchema: sdlc_compare_scope_aggregates_input_schema
|
|
525
|
+
},
|
|
526
|
+
{
|
|
527
|
+
name: 'sdlc_scope_impact',
|
|
528
|
+
title: 'Read SDLC Scope Impact',
|
|
529
|
+
description: 'Read bounded exact-member Scope Graph boundary, Path reuse, attribution, and ownership evidence without expanding the scope.',
|
|
530
|
+
inputSchema: sdlc_scope_impact_input_schema
|
|
531
|
+
},
|
|
532
|
+
{
|
|
533
|
+
name: 'sdlc_graph_to_code_schema',
|
|
534
|
+
title: 'Read Graph to Code Schema',
|
|
535
|
+
description: 'Fetch the live Graph to Code Developer API schema index and MCP metadata.',
|
|
536
|
+
inputSchema: sdlc_empty_input_schema
|
|
537
|
+
},
|
|
538
|
+
{
|
|
539
|
+
name: 'sdlc_developer_skills',
|
|
540
|
+
title: 'Read SDLC Developer Skills',
|
|
541
|
+
description: 'Fetch generic SDLC development skills and Graph to Code repeat-run guidance.',
|
|
542
|
+
inputSchema: sdlc_developer_skills_input_schema
|
|
543
|
+
},
|
|
544
|
+
{
|
|
545
|
+
name: 'sdlc_package_search',
|
|
546
|
+
title: 'Search SDLC Packages',
|
|
547
|
+
description: 'Discover readable graph packages without importing or mutating them.',
|
|
548
|
+
inputSchema: sdlc_package_search_input_schema
|
|
549
|
+
},
|
|
550
|
+
{
|
|
551
|
+
name: 'sdlc_package_get',
|
|
552
|
+
title: 'Read SDLC Package',
|
|
553
|
+
description: 'Read immutable package versions, asset content, and package-local manifests. Committed source provenance is included only when you can read the package source project.',
|
|
554
|
+
inputSchema: sdlc_package_get_input_schema
|
|
555
|
+
},
|
|
556
|
+
{
|
|
557
|
+
name: 'sdlc_package_compare',
|
|
558
|
+
title: 'Compare SDLC Package Source',
|
|
559
|
+
description: 'Classify a package source as current, ahead, behind, or diverged from a branch head.',
|
|
560
|
+
inputSchema: sdlc_package_compare_input_schema
|
|
561
|
+
},
|
|
562
|
+
{
|
|
563
|
+
name: 'sdlc_package_proposal_list',
|
|
564
|
+
title: 'List Graph Package Proposals',
|
|
565
|
+
description: 'List AI/user package proposals and their commit-readiness for one project. This does not publish a package.',
|
|
566
|
+
inputSchema: sdlc_package_proposal_list_input_schema
|
|
567
|
+
},
|
|
568
|
+
{
|
|
569
|
+
name: 'sdlc_package_proposal_create',
|
|
570
|
+
title: 'Suggest Graph Package Candidate',
|
|
571
|
+
description: 'Suggest exact graph nodes or one path for user-controlled package promotion. Include the exact current package version when repository manifest evidence provides one. Working content is accepted but remains blocked until the exact scope is committed.',
|
|
572
|
+
inputSchema: sdlc_package_proposal_create_input_schema
|
|
573
|
+
}
|
|
574
|
+
];
|
|
575
|
+
// Platform Task Core: the ordinary Task commands a user API key may run, each
|
|
576
|
+
// with its own scope (tasks:write; queues:manage to configure and run a
|
|
577
|
+
// queue). The commands that change access are never offered here.
|
|
578
|
+
const SDLC_TASK_COMMANDS = [
|
|
579
|
+
'create_task',
|
|
580
|
+
'update_task',
|
|
581
|
+
'set_contributor',
|
|
582
|
+
'checklist',
|
|
583
|
+
'reorder',
|
|
584
|
+
'reparent',
|
|
585
|
+
'set_relation',
|
|
586
|
+
'set_project_link',
|
|
587
|
+
'archive_task',
|
|
588
|
+
'restore_task',
|
|
589
|
+
'publish_schema_revision',
|
|
590
|
+
'create_workflow',
|
|
591
|
+
'update_workflow',
|
|
592
|
+
'create_list',
|
|
593
|
+
'configure_list',
|
|
594
|
+
'open_hold',
|
|
595
|
+
'release_hold',
|
|
596
|
+
'resolve_hold',
|
|
597
|
+
'claim_task',
|
|
598
|
+
'renew_claim',
|
|
599
|
+
'end_claim',
|
|
600
|
+
'create_queue',
|
|
601
|
+
'configure_queue',
|
|
602
|
+
'archive_queue',
|
|
603
|
+
'join_queue',
|
|
604
|
+
'leave_queue',
|
|
605
|
+
'start_turn',
|
|
606
|
+
'renew_turn',
|
|
607
|
+
'end_turn',
|
|
608
|
+
'reorder_queue_entry',
|
|
609
|
+
'release_queue_create',
|
|
610
|
+
'release_queue_configure',
|
|
611
|
+
'release_queue_join',
|
|
612
|
+
'release_queue_leave',
|
|
613
|
+
'release_queue_end_turn',
|
|
614
|
+
'release_queue_run_stalled_turn',
|
|
615
|
+
'release_queue_freeze',
|
|
616
|
+
'release_queue_thaw',
|
|
617
|
+
'release_queue_stall_hold',
|
|
618
|
+
'release_queue_stall_unhold',
|
|
619
|
+
'implement_queue_create',
|
|
620
|
+
'implement_queue_configure',
|
|
621
|
+
'implement_queue_join',
|
|
622
|
+
'implement_queue_set_change_request',
|
|
623
|
+
'implement_queue_take_manager',
|
|
624
|
+
'implement_queue_renew_manager',
|
|
625
|
+
'implement_queue_end_manager',
|
|
626
|
+
'implement_queue_open_batch',
|
|
627
|
+
'implement_queue_batch_member',
|
|
628
|
+
'implement_queue_end_batch',
|
|
629
|
+
'implement_queue_release_entry'
|
|
630
|
+
];
|
|
631
|
+
const sdlc_task_organization_property = {
|
|
632
|
+
type: 'string',
|
|
633
|
+
format: 'uuid',
|
|
634
|
+
description: 'The Organization. Defaults to SDLC_ORGANIZATION_ID when the server has it.'
|
|
635
|
+
};
|
|
636
|
+
const sdlc_task_page_properties = {
|
|
637
|
+
cursor: { type: 'string', maxLength: 4096 },
|
|
638
|
+
limit: { type: 'integer', minimum: 1, maximum: 100 }
|
|
639
|
+
};
|
|
640
|
+
const SDLC_TASK_MCP_TOOLS = [
|
|
641
|
+
{
|
|
642
|
+
name: 'sdlc_tasks_configuration',
|
|
643
|
+
title: 'Read Task Configuration',
|
|
644
|
+
description: 'Read the Workspaces, Lists, Workflows, Statuses, Priorities and schemas you may use, with every id and revision the Task commands take. Needs a key with tasks:read.',
|
|
645
|
+
inputSchema: {
|
|
646
|
+
type: 'object',
|
|
647
|
+
additionalProperties: false,
|
|
648
|
+
properties: { organization_id: sdlc_task_organization_property }
|
|
649
|
+
}
|
|
650
|
+
},
|
|
651
|
+
{
|
|
652
|
+
name: 'sdlc_tasks_list',
|
|
653
|
+
title: 'List Tasks',
|
|
654
|
+
description: "Read one page of a List's Tasks in queue order. Needs tasks:read.",
|
|
655
|
+
inputSchema: {
|
|
656
|
+
type: 'object',
|
|
657
|
+
additionalProperties: false,
|
|
658
|
+
required: ['list_id'],
|
|
659
|
+
properties: {
|
|
660
|
+
organization_id: sdlc_task_organization_property,
|
|
661
|
+
list_id: { type: 'string', format: 'uuid' },
|
|
662
|
+
state: { type: 'string', enum: ['active', 'archived'] },
|
|
663
|
+
status_ids: {
|
|
664
|
+
type: 'array',
|
|
665
|
+
minItems: 1,
|
|
666
|
+
maxItems: 50,
|
|
667
|
+
items: { type: 'string', format: 'uuid' }
|
|
668
|
+
},
|
|
669
|
+
assigned_to_me: { type: 'boolean' },
|
|
670
|
+
...sdlc_task_page_properties
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
},
|
|
674
|
+
{
|
|
675
|
+
name: 'sdlc_tasks_get',
|
|
676
|
+
title: 'Read Task',
|
|
677
|
+
description: 'Read one Task with its contributors, checklist, open Holds, its open claim (who is working on it), relations, children and Project links. Needs tasks:read.',
|
|
678
|
+
inputSchema: {
|
|
679
|
+
type: 'object',
|
|
680
|
+
additionalProperties: false,
|
|
681
|
+
required: ['task_id'],
|
|
682
|
+
properties: {
|
|
683
|
+
organization_id: sdlc_task_organization_property,
|
|
684
|
+
task_id: { type: 'string', format: 'uuid' }
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
},
|
|
688
|
+
{
|
|
689
|
+
name: 'sdlc_tasks_activity',
|
|
690
|
+
title: 'Read Task Activity',
|
|
691
|
+
description: "Read one page of a Task's Activity (task_id), of every Task in a List (list_id) or of a queue (queue_id), the cursor an agent polls for changes. Give exactly one. Needs tasks:read.",
|
|
692
|
+
inputSchema: {
|
|
693
|
+
type: 'object',
|
|
694
|
+
additionalProperties: false,
|
|
695
|
+
properties: {
|
|
696
|
+
organization_id: sdlc_task_organization_property,
|
|
697
|
+
task_id: { type: 'string', format: 'uuid' },
|
|
698
|
+
list_id: { type: 'string', format: 'uuid' },
|
|
699
|
+
queue_id: { type: 'string', format: 'uuid' },
|
|
700
|
+
...sdlc_task_page_properties
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
},
|
|
704
|
+
{
|
|
705
|
+
name: 'sdlc_tasks_queues',
|
|
706
|
+
title: 'List Queues',
|
|
707
|
+
description: "Read the queues the key's user can read, in one Workspace (workspace_id) or all of the Organization's; archived: true lists archived queues instead. Needs tasks:read.",
|
|
708
|
+
inputSchema: {
|
|
709
|
+
type: 'object',
|
|
710
|
+
additionalProperties: false,
|
|
711
|
+
properties: {
|
|
712
|
+
organization_id: sdlc_task_organization_property,
|
|
713
|
+
workspace_id: { type: 'string', format: 'uuid' },
|
|
714
|
+
archived: { type: 'boolean' }
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
},
|
|
718
|
+
{
|
|
719
|
+
name: 'sdlc_tasks_queue',
|
|
720
|
+
title: 'Read Queue',
|
|
721
|
+
description: "Read one queue: its configuration, its layer's, and its state (queue-state/v1): the running turn, the waiting entries in order, and what each waits on. Needs tasks:read.",
|
|
722
|
+
inputSchema: {
|
|
723
|
+
type: 'object',
|
|
724
|
+
additionalProperties: false,
|
|
725
|
+
required: ['queue_id'],
|
|
726
|
+
properties: {
|
|
727
|
+
organization_id: sdlc_task_organization_property,
|
|
728
|
+
queue_id: { type: 'string', format: 'uuid' }
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
},
|
|
732
|
+
{
|
|
733
|
+
name: 'sdlc_tasks_operation',
|
|
734
|
+
title: 'Read Task Command Receipt',
|
|
735
|
+
description: 'Read the committed result of one of your Task commands by its operation_key, for a reply that was lost. Needs tasks:read.',
|
|
736
|
+
inputSchema: {
|
|
737
|
+
type: 'object',
|
|
738
|
+
additionalProperties: false,
|
|
739
|
+
required: ['operation_key'],
|
|
740
|
+
properties: {
|
|
741
|
+
organization_id: sdlc_task_organization_property,
|
|
742
|
+
operation_key: { type: 'string', format: 'uuid' }
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
},
|
|
746
|
+
{
|
|
747
|
+
name: 'sdlc_tasks_waiting_on_you',
|
|
748
|
+
title: 'List Holds Waiting On You',
|
|
749
|
+
description: "Read one page of the open Holds that wait on the key's user: Holds whose target is you, or a Task you are primary on or hold a live claim on. Poll it at each coordination checkpoint; release a Hold with the release_hold command once you have done what it waits for. Needs tasks:read.",
|
|
750
|
+
inputSchema: {
|
|
751
|
+
type: 'object',
|
|
752
|
+
additionalProperties: false,
|
|
753
|
+
properties: {
|
|
754
|
+
organization_id: sdlc_task_organization_property,
|
|
755
|
+
...sdlc_task_page_properties
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
},
|
|
759
|
+
{
|
|
760
|
+
name: 'sdlc_tasks_command',
|
|
761
|
+
title: 'Run Task Command',
|
|
762
|
+
description: "Run one Task command as the key's user, with its strict version 1 request (the same fields as POST /api/v1/organizations/{organization_id}/tasks/commands/{command}). version and a fresh operation_key are added when absent; a lost reply is retried once with the same key, and the answer includes the operation_key, which sdlc_tasks_operation reads. Needs tasks:write; creating, configuring, archiving or reordering a queue, freezing or stall-holding a release queue, and an implement queue's manager and batch commands need queues:manage.",
|
|
763
|
+
inputSchema: {
|
|
764
|
+
type: 'object',
|
|
765
|
+
additionalProperties: false,
|
|
766
|
+
required: ['command', 'request'],
|
|
767
|
+
properties: {
|
|
768
|
+
organization_id: sdlc_task_organization_property,
|
|
769
|
+
command: { type: 'string', enum: [...SDLC_TASK_COMMANDS] },
|
|
770
|
+
request: { type: 'object', additionalProperties: true }
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
];
|
|
775
|
+
function isJsonObject(value) {
|
|
776
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
777
|
+
}
|
|
778
|
+
function getStringField(record, key) {
|
|
779
|
+
const value = record[key];
|
|
780
|
+
return typeof value === 'string' && value.trim().length > 0
|
|
781
|
+
? value.trim()
|
|
782
|
+
: null;
|
|
783
|
+
}
|
|
784
|
+
function trimTrailingSlash(value) {
|
|
785
|
+
return value.replace(/\/+$/, '');
|
|
786
|
+
}
|
|
787
|
+
function readEnvironmentValue(env, candidates) {
|
|
788
|
+
for (const candidate of candidates) {
|
|
789
|
+
const value = env[candidate]?.trim();
|
|
790
|
+
if (value) {
|
|
791
|
+
return value;
|
|
792
|
+
}
|
|
793
|
+
}
|
|
794
|
+
return null;
|
|
795
|
+
}
|
|
796
|
+
function resolveDefaultTargetFromPairs(candidates) {
|
|
797
|
+
const configured_targets = candidates.flatMap(([key, value]) => typeof value === 'string' && value.trim().length > 0
|
|
798
|
+
? [{ key, value: value.trim() }]
|
|
799
|
+
: []);
|
|
800
|
+
if (configured_targets.length !== 1) {
|
|
801
|
+
return null;
|
|
802
|
+
}
|
|
803
|
+
const target = configured_targets[0];
|
|
804
|
+
return { [target.key]: target.value };
|
|
805
|
+
}
|
|
806
|
+
function resolveDefaultTarget(env) {
|
|
807
|
+
return resolveDefaultTargetFromPairs([
|
|
808
|
+
['branch_id', env.SDLC_BRANCH_ID],
|
|
809
|
+
['pull_request_id', env.SDLC_PULL_REQUEST_ID],
|
|
810
|
+
['commit_id', env.SDLC_COMMIT_ID]
|
|
811
|
+
]);
|
|
812
|
+
}
|
|
813
|
+
function resolveDefaultTargetFromUrl(url) {
|
|
814
|
+
return resolveDefaultTargetFromPairs([
|
|
815
|
+
['branch_id', url.searchParams.get('branch_id')],
|
|
816
|
+
['pull_request_id', url.searchParams.get('pull_request_id')],
|
|
817
|
+
['commit_id', url.searchParams.get('commit_id')]
|
|
818
|
+
]);
|
|
819
|
+
}
|
|
820
|
+
export function resolveGraphToCodeMcpEnvironment(env) {
|
|
821
|
+
const base_url = readEnvironmentValue(env, [
|
|
822
|
+
'SDLC_BASE_URL',
|
|
823
|
+
'SDLC_APP_URL',
|
|
824
|
+
'NGROK_SITE_URL',
|
|
825
|
+
'NEXT_PUBLIC_SITE_URL'
|
|
826
|
+
]);
|
|
827
|
+
const api_key = readEnvironmentValue(env, [
|
|
828
|
+
'SDLC_API_KEY',
|
|
829
|
+
'SOFTWAREDLC_API_KEY'
|
|
830
|
+
]);
|
|
831
|
+
if (!base_url) {
|
|
832
|
+
throw new Error('Set SDLC_BASE_URL, SDLC_APP_URL, or NGROK_SITE_URL before starting the MCP server.');
|
|
833
|
+
}
|
|
834
|
+
if (!api_key) {
|
|
835
|
+
throw new Error('Set SDLC_API_KEY before starting the MCP server.');
|
|
836
|
+
}
|
|
837
|
+
const default_organization_id = readEnvironmentValue(env, [
|
|
838
|
+
'SDLC_ORGANIZATION_ID'
|
|
839
|
+
]);
|
|
840
|
+
return {
|
|
841
|
+
base_url: trimTrailingSlash(base_url),
|
|
842
|
+
api_key,
|
|
843
|
+
default_target: resolveDefaultTarget(env),
|
|
844
|
+
...(default_organization_id ? { default_organization_id } : {})
|
|
845
|
+
};
|
|
846
|
+
}
|
|
847
|
+
export function resolveHostedGraphToCodeMcpEnvironment(request) {
|
|
848
|
+
const authorization_header = request.headers.get('authorization');
|
|
849
|
+
const match = authorization_header?.match(/^Bearer\s+(.+)$/i);
|
|
850
|
+
const api_key = match?.[1]?.trim();
|
|
851
|
+
if (!api_key) {
|
|
852
|
+
return null;
|
|
853
|
+
}
|
|
854
|
+
const url = new URL(request.url);
|
|
855
|
+
return {
|
|
856
|
+
base_url: url.origin,
|
|
857
|
+
api_key,
|
|
858
|
+
default_target: resolveDefaultTargetFromUrl(url)
|
|
859
|
+
};
|
|
860
|
+
}
|
|
861
|
+
function isAllowedHostedOrigin(request) {
|
|
862
|
+
const origin = request.headers.get('origin');
|
|
863
|
+
if (!origin) {
|
|
864
|
+
return true;
|
|
865
|
+
}
|
|
866
|
+
try {
|
|
867
|
+
return new URL(origin).origin === new URL(request.url).origin;
|
|
868
|
+
}
|
|
869
|
+
catch {
|
|
870
|
+
return false;
|
|
871
|
+
}
|
|
872
|
+
}
|
|
873
|
+
function buildSuccessResponse(id, result) {
|
|
874
|
+
return {
|
|
875
|
+
jsonrpc: '2.0',
|
|
876
|
+
id,
|
|
877
|
+
result
|
|
878
|
+
};
|
|
879
|
+
}
|
|
880
|
+
function buildErrorResponse(input) {
|
|
881
|
+
return {
|
|
882
|
+
jsonrpc: '2.0',
|
|
883
|
+
id: input.id,
|
|
884
|
+
error: {
|
|
885
|
+
code: input.code,
|
|
886
|
+
message: input.message,
|
|
887
|
+
...(typeof input.data === 'undefined' ? {} : { data: input.data })
|
|
888
|
+
}
|
|
889
|
+
};
|
|
890
|
+
}
|
|
891
|
+
function buildToolResult(value) {
|
|
892
|
+
return {
|
|
893
|
+
content: [
|
|
894
|
+
{
|
|
895
|
+
type: 'text',
|
|
896
|
+
text: JSON.stringify(value, null, 2)
|
|
897
|
+
}
|
|
898
|
+
]
|
|
899
|
+
};
|
|
900
|
+
}
|
|
901
|
+
function buildToolError(error) {
|
|
902
|
+
return {
|
|
903
|
+
isError: true,
|
|
904
|
+
content: [
|
|
905
|
+
{
|
|
906
|
+
type: 'text',
|
|
907
|
+
text: error instanceof Error ? error.message : 'Tool call failed.'
|
|
908
|
+
}
|
|
909
|
+
]
|
|
910
|
+
};
|
|
911
|
+
}
|
|
912
|
+
function makeUrl(environment, path) {
|
|
913
|
+
return `${environment.base_url}${path}`;
|
|
914
|
+
}
|
|
915
|
+
/** A refusal from the SDLC API, with its HTTP status and body. */
|
|
916
|
+
class SdlcApiError extends Error {
|
|
917
|
+
status;
|
|
918
|
+
payload;
|
|
919
|
+
constructor(message, status, payload) {
|
|
920
|
+
super(message);
|
|
921
|
+
this.status = status;
|
|
922
|
+
this.payload = payload;
|
|
923
|
+
}
|
|
924
|
+
}
|
|
925
|
+
async function fetchJson(input) {
|
|
926
|
+
const response = await input.fetch_impl(makeUrl(input.environment, input.path), {
|
|
927
|
+
method: input.method,
|
|
928
|
+
headers: {
|
|
929
|
+
Authorization: `Bearer ${input.environment.api_key}`,
|
|
930
|
+
Accept: 'application/json',
|
|
931
|
+
...(input.body
|
|
932
|
+
? {
|
|
933
|
+
'Content-Type': 'application/json'
|
|
934
|
+
}
|
|
935
|
+
: {})
|
|
936
|
+
},
|
|
937
|
+
body: input.body ? JSON.stringify(input.body) : undefined
|
|
938
|
+
});
|
|
939
|
+
const payload = (await response.json());
|
|
940
|
+
if (!response.ok) {
|
|
941
|
+
const message = isJsonObject(payload) && typeof payload.error === 'string'
|
|
942
|
+
? payload.error
|
|
943
|
+
: response.statusText || 'SDLC API request failed.';
|
|
944
|
+
throw new SdlcApiError(`SDLC API ${response.status}: ${message}`, response.status, payload);
|
|
945
|
+
}
|
|
946
|
+
return payload;
|
|
947
|
+
}
|
|
948
|
+
function readToolArguments(params) {
|
|
949
|
+
if (!isJsonObject(params)) {
|
|
950
|
+
return {
|
|
951
|
+
name: null,
|
|
952
|
+
arguments_object: {}
|
|
953
|
+
};
|
|
954
|
+
}
|
|
955
|
+
const name = getStringField(params, 'name');
|
|
956
|
+
const raw_arguments = params.arguments;
|
|
957
|
+
return {
|
|
958
|
+
name,
|
|
959
|
+
arguments_object: isJsonObject(raw_arguments) ? raw_arguments : {}
|
|
960
|
+
};
|
|
961
|
+
}
|
|
962
|
+
function resolveGraphTarget(input) {
|
|
963
|
+
const explicit_target = input.arguments_object.target;
|
|
964
|
+
const target = isJsonObject(explicit_target)
|
|
965
|
+
? explicit_target
|
|
966
|
+
: input.environment.default_target;
|
|
967
|
+
if (!target) {
|
|
968
|
+
throw new Error('Provide target.branch_id, target.pull_request_id, or target.commit_id, or configure exactly one SDLC_BRANCH_ID, SDLC_PULL_REQUEST_ID, or SDLC_COMMIT_ID.');
|
|
969
|
+
}
|
|
970
|
+
return target;
|
|
971
|
+
}
|
|
972
|
+
function buildSearchRequest(input) {
|
|
973
|
+
const target = resolveGraphTarget(input);
|
|
974
|
+
const branch_id = getStringField(target, 'branch_id');
|
|
975
|
+
const pull_request_id = getStringField(target, 'pull_request_id');
|
|
976
|
+
const commit_id = getStringField(target, 'commit_id');
|
|
977
|
+
const ids = [branch_id, pull_request_id, commit_id].filter(Boolean);
|
|
978
|
+
if (ids.length !== 1) {
|
|
979
|
+
throw new Error('Provide exactly one target id: branch_id, pull_request_id, or commit_id.');
|
|
980
|
+
}
|
|
981
|
+
const body = {};
|
|
982
|
+
for (const [key, value] of Object.entries(input.arguments_object)) {
|
|
983
|
+
if (key !== 'target') {
|
|
984
|
+
body[key] = value;
|
|
985
|
+
}
|
|
986
|
+
}
|
|
987
|
+
if (branch_id) {
|
|
988
|
+
return {
|
|
989
|
+
path: `/api/v1/graph/branch/${encodeURIComponent(branch_id)}/search?${GRAPH_VARIANT_SET_VERSIONS_QUERY}`,
|
|
990
|
+
body
|
|
991
|
+
};
|
|
992
|
+
}
|
|
993
|
+
if (commit_id) {
|
|
994
|
+
return {
|
|
995
|
+
path: `/api/v1/graph/commit/${encodeURIComponent(commit_id)}/search?${GRAPH_VARIANT_SET_VERSIONS_QUERY}`,
|
|
996
|
+
body
|
|
997
|
+
};
|
|
998
|
+
}
|
|
999
|
+
return {
|
|
1000
|
+
path: `/api/v1/pull-request/${encodeURIComponent(pull_request_id)}/search?${GRAPH_VARIANT_SET_VERSIONS_QUERY}`,
|
|
1001
|
+
body
|
|
1002
|
+
};
|
|
1003
|
+
}
|
|
1004
|
+
function buildPullBody(input) {
|
|
1005
|
+
const explicit_target = input.arguments_object.target;
|
|
1006
|
+
const target = isJsonObject(explicit_target)
|
|
1007
|
+
? explicit_target
|
|
1008
|
+
: input.environment.default_target;
|
|
1009
|
+
if (!target) {
|
|
1010
|
+
throw new Error('Provide target.branch_id, target.pull_request_id, or target.commit_id, or configure exactly one SDLC_BRANCH_ID, SDLC_PULL_REQUEST_ID, or SDLC_COMMIT_ID.');
|
|
1011
|
+
}
|
|
1012
|
+
return {
|
|
1013
|
+
...input.arguments_object,
|
|
1014
|
+
target
|
|
1015
|
+
};
|
|
1016
|
+
}
|
|
1017
|
+
function buildScopeImpactBody(input) {
|
|
1018
|
+
const target = resolveGraphTarget(input);
|
|
1019
|
+
const branch_id = getStringField(target, 'branch_id');
|
|
1020
|
+
if (!branch_id || Object.keys(target).length !== 1) {
|
|
1021
|
+
throw new Error('Scope impact requires exactly one branch target.');
|
|
1022
|
+
}
|
|
1023
|
+
const body = {
|
|
1024
|
+
...input.arguments_object,
|
|
1025
|
+
schema_version: 1,
|
|
1026
|
+
target: { branch_id }
|
|
1027
|
+
};
|
|
1028
|
+
return body;
|
|
1029
|
+
}
|
|
1030
|
+
// A Task route refuses with {code, error} and what says how to fix it: issues
|
|
1031
|
+
// (the schema), issue (the body reader), detail (the function), or
|
|
1032
|
+
// retry_after_seconds (the key's rate limit). The message keeps them all.
|
|
1033
|
+
function taskRefusal(error) {
|
|
1034
|
+
const payload = isJsonObject(error.payload) ? error.payload : {};
|
|
1035
|
+
const code = typeof payload.code === 'string' ? ` ${payload.code}` : '';
|
|
1036
|
+
const text = typeof payload.error === 'string' ? payload.error : 'Task request failed.';
|
|
1037
|
+
const detail = typeof payload.detail === 'string' ? ` (${payload.detail})` : '';
|
|
1038
|
+
const issue = typeof payload.issue === 'string' ? ` (${payload.issue})` : '';
|
|
1039
|
+
const retry = typeof payload.retry_after_seconds === 'number'
|
|
1040
|
+
? ` Retry after ${payload.retry_after_seconds} s.`
|
|
1041
|
+
: '';
|
|
1042
|
+
const issues = payload.issues === undefined ? '' : ` ${JSON.stringify(payload.issues)}`;
|
|
1043
|
+
return new SdlcApiError(`SDLC API ${error.status}${code}: ${text}${detail}${issue}${issues}${retry}`, error.status, error.payload);
|
|
1044
|
+
}
|
|
1045
|
+
// The tool's own input schema decides what an argument may be, so a mistake
|
|
1046
|
+
// is refused here instead of being dropped and widening the request.
|
|
1047
|
+
function checkTaskArguments(name, args) {
|
|
1048
|
+
const tool = SDLC_TASK_MCP_TOOLS.find((t) => t.name === name);
|
|
1049
|
+
const schema = tool && isJsonObject(tool.inputSchema) ? tool.inputSchema : {};
|
|
1050
|
+
const properties = isJsonObject(schema.properties) ? schema.properties : {};
|
|
1051
|
+
const required = Array.isArray(schema.required) ? schema.required : [];
|
|
1052
|
+
for (const key of required) {
|
|
1053
|
+
if (typeof key === 'string' && args[key] === undefined) {
|
|
1054
|
+
throw new Error(`${key} is required.`);
|
|
1055
|
+
}
|
|
1056
|
+
}
|
|
1057
|
+
for (const [key, value] of Object.entries(args)) {
|
|
1058
|
+
const rule = properties[key];
|
|
1059
|
+
if (!isJsonObject(rule)) {
|
|
1060
|
+
throw new Error(`Unknown argument ${key} for ${name}.`);
|
|
1061
|
+
}
|
|
1062
|
+
const fits = rule.type === 'string'
|
|
1063
|
+
? typeof value === 'string'
|
|
1064
|
+
: rule.type === 'integer'
|
|
1065
|
+
? Number.isInteger(value)
|
|
1066
|
+
: rule.type === 'boolean'
|
|
1067
|
+
? typeof value === 'boolean'
|
|
1068
|
+
: rule.type === 'object'
|
|
1069
|
+
? isJsonObject(value)
|
|
1070
|
+
: rule.type === 'array'
|
|
1071
|
+
? Array.isArray(value) &&
|
|
1072
|
+
value.length >= Number(rule.minItems ?? 0) &&
|
|
1073
|
+
value.every((item) => typeof item === 'string')
|
|
1074
|
+
: true;
|
|
1075
|
+
if (!fits) {
|
|
1076
|
+
throw new Error(`${key} is not a valid ${String(rule.type)} for ${name}.`);
|
|
1077
|
+
}
|
|
1078
|
+
if (Array.isArray(rule.enum) &&
|
|
1079
|
+
!rule.enum.includes(value)) {
|
|
1080
|
+
throw new Error(`${key} must be one of: ${rule.enum.join(', ')}.`);
|
|
1081
|
+
}
|
|
1082
|
+
}
|
|
1083
|
+
}
|
|
1084
|
+
async function fetchTaskJson(input) {
|
|
1085
|
+
try {
|
|
1086
|
+
return await fetchJson({
|
|
1087
|
+
environment: input.environment,
|
|
1088
|
+
fetch_impl: input.fetch_impl,
|
|
1089
|
+
path: `/api/v1/organizations/${encodeURIComponent(input.organization_id)}/tasks${input.path}`,
|
|
1090
|
+
method: input.method,
|
|
1091
|
+
body: input.body
|
|
1092
|
+
});
|
|
1093
|
+
}
|
|
1094
|
+
catch (error) {
|
|
1095
|
+
throw error instanceof SdlcApiError ? taskRefusal(error) : error;
|
|
1096
|
+
}
|
|
1097
|
+
}
|
|
1098
|
+
function taskOrganization(input) {
|
|
1099
|
+
const organization_id = getStringField(input.arguments_object, 'organization_id') ??
|
|
1100
|
+
input.environment.default_organization_id;
|
|
1101
|
+
if (!organization_id) {
|
|
1102
|
+
throw new Error('Provide organization_id, or start the server with SDLC_ORGANIZATION_ID.');
|
|
1103
|
+
}
|
|
1104
|
+
return organization_id;
|
|
1105
|
+
}
|
|
1106
|
+
function taskPageQuery(arguments_object) {
|
|
1107
|
+
const params = new URLSearchParams();
|
|
1108
|
+
const cursor = getStringField(arguments_object, 'cursor');
|
|
1109
|
+
if (cursor)
|
|
1110
|
+
params.set('cursor', cursor);
|
|
1111
|
+
if (typeof arguments_object.limit === 'number') {
|
|
1112
|
+
params.set('limit', String(arguments_object.limit));
|
|
1113
|
+
}
|
|
1114
|
+
return params;
|
|
1115
|
+
}
|
|
1116
|
+
function withQuery(path, params) {
|
|
1117
|
+
return params.size ? `${path}?${params.toString()}` : path;
|
|
1118
|
+
}
|
|
1119
|
+
function requiredTaskId(arguments_object, key) {
|
|
1120
|
+
const value = getStringField(arguments_object, key);
|
|
1121
|
+
if (!value)
|
|
1122
|
+
throw new Error(`${key} is required.`);
|
|
1123
|
+
return encodeURIComponent(value);
|
|
1124
|
+
}
|
|
1125
|
+
// A reply that never came (the request failed to arrive or the server failed)
|
|
1126
|
+
// may still have committed; the same operation_key makes a retry safe.
|
|
1127
|
+
function isLostReply(error) {
|
|
1128
|
+
return !(error instanceof SdlcApiError) || error.status >= 500;
|
|
1129
|
+
}
|
|
1130
|
+
/** The Task tools: thin wrappers over the Task key routes. */
|
|
1131
|
+
async function callTaskTool(input) {
|
|
1132
|
+
const args = input.arguments_object;
|
|
1133
|
+
checkTaskArguments(input.name, args);
|
|
1134
|
+
const request = {
|
|
1135
|
+
environment: input.environment,
|
|
1136
|
+
fetch_impl: input.fetch_impl,
|
|
1137
|
+
organization_id: taskOrganization(input)
|
|
1138
|
+
};
|
|
1139
|
+
if (input.name === 'sdlc_tasks_configuration') {
|
|
1140
|
+
return fetchTaskJson({ ...request, path: '/configuration', method: 'GET' });
|
|
1141
|
+
}
|
|
1142
|
+
if (input.name === 'sdlc_tasks_list') {
|
|
1143
|
+
const list_id = requiredTaskId(args, 'list_id');
|
|
1144
|
+
const params = taskPageQuery(args);
|
|
1145
|
+
const state = getStringField(args, 'state');
|
|
1146
|
+
if (state)
|
|
1147
|
+
params.set('state', state);
|
|
1148
|
+
if (Array.isArray(args.status_ids)) {
|
|
1149
|
+
params.set('status_ids', args.status_ids.map(String).join(','));
|
|
1150
|
+
}
|
|
1151
|
+
if (typeof args.assigned_to_me === 'boolean') {
|
|
1152
|
+
params.set('assigned_to_me', String(args.assigned_to_me));
|
|
1153
|
+
}
|
|
1154
|
+
return fetchTaskJson({
|
|
1155
|
+
...request,
|
|
1156
|
+
path: withQuery(`/lists/${list_id}/tasks`, params),
|
|
1157
|
+
method: 'GET'
|
|
1158
|
+
});
|
|
1159
|
+
}
|
|
1160
|
+
if (input.name === 'sdlc_tasks_get') {
|
|
1161
|
+
const task_id = requiredTaskId(args, 'task_id');
|
|
1162
|
+
return fetchTaskJson({
|
|
1163
|
+
...request,
|
|
1164
|
+
path: `/tasks/${task_id}`,
|
|
1165
|
+
method: 'GET'
|
|
1166
|
+
});
|
|
1167
|
+
}
|
|
1168
|
+
if (input.name === 'sdlc_tasks_activity') {
|
|
1169
|
+
const subjects = ['task_id', 'list_id', 'queue_id'].flatMap((key) => {
|
|
1170
|
+
const id = getStringField(args, key);
|
|
1171
|
+
return id ? [{ key, id }] : [];
|
|
1172
|
+
});
|
|
1173
|
+
if (subjects.length !== 1) {
|
|
1174
|
+
throw new Error('Provide exactly one of task_id, list_id or queue_id.');
|
|
1175
|
+
}
|
|
1176
|
+
const { key, id } = subjects[0];
|
|
1177
|
+
const collection = key === 'task_id' ? 'tasks' : key === 'list_id' ? 'lists' : 'queues';
|
|
1178
|
+
return fetchTaskJson({
|
|
1179
|
+
...request,
|
|
1180
|
+
path: withQuery(`/${collection}/${encodeURIComponent(id)}/activity`, taskPageQuery(args)),
|
|
1181
|
+
method: 'GET'
|
|
1182
|
+
});
|
|
1183
|
+
}
|
|
1184
|
+
if (input.name === 'sdlc_tasks_queues') {
|
|
1185
|
+
const params = new URLSearchParams();
|
|
1186
|
+
// Sent as given, so the route refuses a blank one instead of the read
|
|
1187
|
+
// widening to the whole Organization.
|
|
1188
|
+
if (typeof args.workspace_id === 'string') {
|
|
1189
|
+
params.set('workspace_id', args.workspace_id);
|
|
1190
|
+
}
|
|
1191
|
+
if (typeof args.archived === 'boolean') {
|
|
1192
|
+
params.set('archived', String(args.archived));
|
|
1193
|
+
}
|
|
1194
|
+
return fetchTaskJson({
|
|
1195
|
+
...request,
|
|
1196
|
+
path: withQuery('/queues', params),
|
|
1197
|
+
method: 'GET'
|
|
1198
|
+
});
|
|
1199
|
+
}
|
|
1200
|
+
if (input.name === 'sdlc_tasks_queue') {
|
|
1201
|
+
const queue_id = requiredTaskId(args, 'queue_id');
|
|
1202
|
+
return fetchTaskJson({
|
|
1203
|
+
...request,
|
|
1204
|
+
path: `/queues/${queue_id}`,
|
|
1205
|
+
method: 'GET'
|
|
1206
|
+
});
|
|
1207
|
+
}
|
|
1208
|
+
if (input.name === 'sdlc_tasks_operation') {
|
|
1209
|
+
const operation_key = requiredTaskId(args, 'operation_key');
|
|
1210
|
+
return fetchTaskJson({
|
|
1211
|
+
...request,
|
|
1212
|
+
path: `/operations/${operation_key}`,
|
|
1213
|
+
method: 'GET'
|
|
1214
|
+
});
|
|
1215
|
+
}
|
|
1216
|
+
if (input.name === 'sdlc_tasks_waiting_on_you') {
|
|
1217
|
+
return fetchTaskJson({
|
|
1218
|
+
...request,
|
|
1219
|
+
path: withQuery('/waiting-on-you', taskPageQuery(args)),
|
|
1220
|
+
method: 'GET'
|
|
1221
|
+
});
|
|
1222
|
+
}
|
|
1223
|
+
if (input.name === 'sdlc_tasks_command') {
|
|
1224
|
+
const command = getStringField(args, 'command');
|
|
1225
|
+
if (!command ||
|
|
1226
|
+
!SDLC_TASK_COMMANDS.includes(command)) {
|
|
1227
|
+
throw new Error(`command must be one of: ${SDLC_TASK_COMMANDS.join(', ')}.`);
|
|
1228
|
+
}
|
|
1229
|
+
if (!isJsonObject(args.request)) {
|
|
1230
|
+
throw new Error('request must be the command’s request object.');
|
|
1231
|
+
}
|
|
1232
|
+
// Only an absent operation_key is filled in; one the caller gave goes to
|
|
1233
|
+
// the route as it is, which refuses a malformed key.
|
|
1234
|
+
const body = {
|
|
1235
|
+
version: 1,
|
|
1236
|
+
...('operation_key' in args.request
|
|
1237
|
+
? {}
|
|
1238
|
+
: { operation_key: globalThis.crypto.randomUUID() }),
|
|
1239
|
+
...args.request
|
|
1240
|
+
};
|
|
1241
|
+
const operation_key = body.operation_key;
|
|
1242
|
+
const send = () => fetchTaskJson({
|
|
1243
|
+
...request,
|
|
1244
|
+
path: `/commands/${encodeURIComponent(command)}`,
|
|
1245
|
+
method: 'POST',
|
|
1246
|
+
body
|
|
1247
|
+
});
|
|
1248
|
+
let result;
|
|
1249
|
+
try {
|
|
1250
|
+
result = await send();
|
|
1251
|
+
}
|
|
1252
|
+
catch (error) {
|
|
1253
|
+
if (!isLostReply(error))
|
|
1254
|
+
throw error;
|
|
1255
|
+
try {
|
|
1256
|
+
result = await send();
|
|
1257
|
+
}
|
|
1258
|
+
catch (again) {
|
|
1259
|
+
const message = again instanceof Error ? again.message : 'No reply.';
|
|
1260
|
+
throw new Error(`${message} The command may have committed: read it with sdlc_tasks_operation and operation_key ${operation_key}.`);
|
|
1261
|
+
}
|
|
1262
|
+
}
|
|
1263
|
+
return { operation_key, result };
|
|
1264
|
+
}
|
|
1265
|
+
throw new Error(`Unknown tool: ${input.name}`);
|
|
1266
|
+
}
|
|
1267
|
+
async function callTool(input) {
|
|
1268
|
+
try {
|
|
1269
|
+
if (input.name.startsWith('sdlc_tasks_')) {
|
|
1270
|
+
return buildToolResult(await callTaskTool(input));
|
|
1271
|
+
}
|
|
1272
|
+
if (input.name === 'sdlc_graph_search') {
|
|
1273
|
+
const request = buildSearchRequest({
|
|
1274
|
+
arguments_object: input.arguments_object,
|
|
1275
|
+
environment: input.environment
|
|
1276
|
+
});
|
|
1277
|
+
const payload = await fetchJson({
|
|
1278
|
+
environment: input.environment,
|
|
1279
|
+
fetch_impl: input.fetch_impl,
|
|
1280
|
+
path: request.path,
|
|
1281
|
+
method: 'POST',
|
|
1282
|
+
body: request.body
|
|
1283
|
+
});
|
|
1284
|
+
return buildToolResult(payload);
|
|
1285
|
+
}
|
|
1286
|
+
if (input.name === 'sdlc_graph_pull') {
|
|
1287
|
+
const body = buildPullBody({
|
|
1288
|
+
arguments_object: input.arguments_object,
|
|
1289
|
+
environment: input.environment
|
|
1290
|
+
});
|
|
1291
|
+
const payload = await fetchJson({
|
|
1292
|
+
environment: input.environment,
|
|
1293
|
+
fetch_impl: input.fetch_impl,
|
|
1294
|
+
path: `/api/v1/graph-to-code/pull?${GRAPH_VARIANT_SET_VERSIONS_QUERY}`,
|
|
1295
|
+
method: 'POST',
|
|
1296
|
+
body
|
|
1297
|
+
});
|
|
1298
|
+
return buildToolResult(payload);
|
|
1299
|
+
}
|
|
1300
|
+
if (input.name === 'sdlc_compare_graph_subgraphs') {
|
|
1301
|
+
const payload = await fetchJson({
|
|
1302
|
+
environment: input.environment,
|
|
1303
|
+
fetch_impl: input.fetch_impl,
|
|
1304
|
+
path: `/api/graph-to-code/compare-subgraph?${GRAPH_VARIANT_SET_VERSIONS_QUERY}`,
|
|
1305
|
+
method: 'POST',
|
|
1306
|
+
body: input.arguments_object
|
|
1307
|
+
});
|
|
1308
|
+
return buildToolResult(payload);
|
|
1309
|
+
}
|
|
1310
|
+
if (input.name === 'sdlc_compare_path_aggregates') {
|
|
1311
|
+
const payload = await fetchJson({
|
|
1312
|
+
environment: input.environment,
|
|
1313
|
+
fetch_impl: input.fetch_impl,
|
|
1314
|
+
path: '/api/v1/graph/comparison/path-aggregates',
|
|
1315
|
+
method: 'POST',
|
|
1316
|
+
body: input.arguments_object
|
|
1317
|
+
});
|
|
1318
|
+
return buildToolResult(payload);
|
|
1319
|
+
}
|
|
1320
|
+
if (input.name === 'sdlc_compare_scope_aggregates') {
|
|
1321
|
+
const payload = await fetchJson({
|
|
1322
|
+
environment: input.environment,
|
|
1323
|
+
fetch_impl: input.fetch_impl,
|
|
1324
|
+
path: '/api/v1/graph/comparison/scopes',
|
|
1325
|
+
method: 'POST',
|
|
1326
|
+
body: input.arguments_object
|
|
1327
|
+
});
|
|
1328
|
+
return buildToolResult(payload);
|
|
1329
|
+
}
|
|
1330
|
+
if (input.name === 'sdlc_scope_impact') {
|
|
1331
|
+
const payload = await fetchJson({
|
|
1332
|
+
environment: input.environment,
|
|
1333
|
+
fetch_impl: input.fetch_impl,
|
|
1334
|
+
path: '/api/v1/graph-to-code/scope-impact',
|
|
1335
|
+
method: 'POST',
|
|
1336
|
+
body: buildScopeImpactBody({
|
|
1337
|
+
arguments_object: input.arguments_object,
|
|
1338
|
+
environment: input.environment
|
|
1339
|
+
})
|
|
1340
|
+
});
|
|
1341
|
+
return buildToolResult(payload);
|
|
1342
|
+
}
|
|
1343
|
+
if (input.name === 'sdlc_graph_to_code_schema') {
|
|
1344
|
+
const payload = await fetchJson({
|
|
1345
|
+
environment: input.environment,
|
|
1346
|
+
fetch_impl: input.fetch_impl,
|
|
1347
|
+
path: '/api/developer/graph-to-code',
|
|
1348
|
+
method: 'GET'
|
|
1349
|
+
});
|
|
1350
|
+
return buildToolResult(payload);
|
|
1351
|
+
}
|
|
1352
|
+
if (input.name === 'sdlc_developer_skills') {
|
|
1353
|
+
const skill_id = getStringField(input.arguments_object, 'skill_id');
|
|
1354
|
+
const payload = await fetchJson({
|
|
1355
|
+
environment: input.environment,
|
|
1356
|
+
fetch_impl: input.fetch_impl,
|
|
1357
|
+
path: skill_id
|
|
1358
|
+
? `/api/developer/skills/${encodeURIComponent(skill_id)}`
|
|
1359
|
+
: '/api/developer/skills',
|
|
1360
|
+
method: 'GET'
|
|
1361
|
+
});
|
|
1362
|
+
return buildToolResult(payload);
|
|
1363
|
+
}
|
|
1364
|
+
if (input.name === 'sdlc_package_search') {
|
|
1365
|
+
const params = new URLSearchParams();
|
|
1366
|
+
const query = getStringField(input.arguments_object, 'query');
|
|
1367
|
+
const project_id = getStringField(input.arguments_object, 'project_id');
|
|
1368
|
+
if (query)
|
|
1369
|
+
params.set('query', query);
|
|
1370
|
+
if (project_id)
|
|
1371
|
+
params.set('project_id', project_id);
|
|
1372
|
+
const payload = await fetchJson({
|
|
1373
|
+
environment: input.environment,
|
|
1374
|
+
fetch_impl: input.fetch_impl,
|
|
1375
|
+
path: `/api/v1/packages${params.size ? `?${params.toString()}` : ''}`,
|
|
1376
|
+
method: 'GET'
|
|
1377
|
+
});
|
|
1378
|
+
return buildToolResult(payload);
|
|
1379
|
+
}
|
|
1380
|
+
if (input.name === 'sdlc_package_get') {
|
|
1381
|
+
const package_id = getStringField(input.arguments_object, 'package_id');
|
|
1382
|
+
if (!package_id)
|
|
1383
|
+
throw new Error('package_id is required.');
|
|
1384
|
+
const payload = await fetchJson({
|
|
1385
|
+
environment: input.environment,
|
|
1386
|
+
fetch_impl: input.fetch_impl,
|
|
1387
|
+
path: `/api/v1/packages/${encodeURIComponent(package_id)}`,
|
|
1388
|
+
method: 'GET'
|
|
1389
|
+
});
|
|
1390
|
+
return buildToolResult(payload);
|
|
1391
|
+
}
|
|
1392
|
+
if (input.name === 'sdlc_package_compare') {
|
|
1393
|
+
const package_id = getStringField(input.arguments_object, 'package_id');
|
|
1394
|
+
const branch_id = getStringField(input.arguments_object, 'branch_id');
|
|
1395
|
+
if (!package_id || !branch_id) {
|
|
1396
|
+
throw new Error('package_id and branch_id are required.');
|
|
1397
|
+
}
|
|
1398
|
+
const payload = await fetchJson({
|
|
1399
|
+
environment: input.environment,
|
|
1400
|
+
fetch_impl: input.fetch_impl,
|
|
1401
|
+
path: `/api/v1/packages/${encodeURIComponent(package_id)}/compare?branch_id=${encodeURIComponent(branch_id)}`,
|
|
1402
|
+
method: 'GET'
|
|
1403
|
+
});
|
|
1404
|
+
return buildToolResult(payload);
|
|
1405
|
+
}
|
|
1406
|
+
if (input.name === 'sdlc_package_proposal_list') {
|
|
1407
|
+
const organization_id = getStringField(input.arguments_object, 'organization_id');
|
|
1408
|
+
const project_id = getStringField(input.arguments_object, 'project_id');
|
|
1409
|
+
if (!organization_id || !project_id) {
|
|
1410
|
+
throw new Error('organization_id and project_id are required.');
|
|
1411
|
+
}
|
|
1412
|
+
const params = new URLSearchParams({ organization_id, project_id });
|
|
1413
|
+
const payload = await fetchJson({
|
|
1414
|
+
environment: input.environment,
|
|
1415
|
+
fetch_impl: input.fetch_impl,
|
|
1416
|
+
path: `/api/v1/package-proposals?${params.toString()}`,
|
|
1417
|
+
method: 'GET'
|
|
1418
|
+
});
|
|
1419
|
+
return buildToolResult(payload);
|
|
1420
|
+
}
|
|
1421
|
+
if (input.name === 'sdlc_package_proposal_create') {
|
|
1422
|
+
const payload = await fetchJson({
|
|
1423
|
+
environment: input.environment,
|
|
1424
|
+
fetch_impl: input.fetch_impl,
|
|
1425
|
+
path: '/api/v1/package-proposals',
|
|
1426
|
+
method: 'POST',
|
|
1427
|
+
body: input.arguments_object
|
|
1428
|
+
});
|
|
1429
|
+
return buildToolResult(payload);
|
|
1430
|
+
}
|
|
1431
|
+
return buildToolError(new Error(`Unknown tool: ${input.name}`));
|
|
1432
|
+
}
|
|
1433
|
+
catch (error) {
|
|
1434
|
+
return buildToolError(error);
|
|
1435
|
+
}
|
|
1436
|
+
}
|
|
1437
|
+
async function listGraphToCodeMcpTools(input) {
|
|
1438
|
+
try {
|
|
1439
|
+
await fetchJson({
|
|
1440
|
+
environment: input.environment,
|
|
1441
|
+
fetch_impl: input.fetch_impl,
|
|
1442
|
+
path: '/api/developer/graph-to-code',
|
|
1443
|
+
method: 'GET'
|
|
1444
|
+
});
|
|
1445
|
+
}
|
|
1446
|
+
catch (error) {
|
|
1447
|
+
// A key with only Task scopes cannot read the graph schema index; it
|
|
1448
|
+
// still gets the Task tools, whose routes check its scopes themselves.
|
|
1449
|
+
if (error instanceof SdlcApiError &&
|
|
1450
|
+
(error.status === 401 || error.status === 403)) {
|
|
1451
|
+
return SDLC_TASK_MCP_TOOLS;
|
|
1452
|
+
}
|
|
1453
|
+
throw error;
|
|
1454
|
+
}
|
|
1455
|
+
return [...SDLC_GRAPH_TO_CODE_MCP_TOOLS, ...SDLC_TASK_MCP_TOOLS];
|
|
1456
|
+
}
|
|
1457
|
+
export async function handleGraphToCodeMcpMessage(message, options) {
|
|
1458
|
+
if (!isJsonObject(message)) {
|
|
1459
|
+
return buildErrorResponse({
|
|
1460
|
+
id: null,
|
|
1461
|
+
code: -32600,
|
|
1462
|
+
message: 'Invalid JSON-RPC message.'
|
|
1463
|
+
});
|
|
1464
|
+
}
|
|
1465
|
+
const request = message;
|
|
1466
|
+
const id = request.id ?? null;
|
|
1467
|
+
const method = typeof request.method === 'string' ? request.method : undefined;
|
|
1468
|
+
if (!method) {
|
|
1469
|
+
if ('result' in request || 'error' in request) {
|
|
1470
|
+
return null;
|
|
1471
|
+
}
|
|
1472
|
+
return buildErrorResponse({
|
|
1473
|
+
id,
|
|
1474
|
+
code: -32600,
|
|
1475
|
+
message: 'JSON-RPC method is required.'
|
|
1476
|
+
});
|
|
1477
|
+
}
|
|
1478
|
+
if (method.startsWith('notifications/')) {
|
|
1479
|
+
return null;
|
|
1480
|
+
}
|
|
1481
|
+
const fetch_impl = options.fetch_impl ?? fetch;
|
|
1482
|
+
if (method === 'initialize') {
|
|
1483
|
+
return buildSuccessResponse(id, {
|
|
1484
|
+
protocolVersion: MCP_PROTOCOL_VERSION,
|
|
1485
|
+
capabilities: {
|
|
1486
|
+
tools: {
|
|
1487
|
+
listChanged: false
|
|
1488
|
+
}
|
|
1489
|
+
},
|
|
1490
|
+
serverInfo: {
|
|
1491
|
+
name: 'sdlc-graph-to-code-mcp',
|
|
1492
|
+
version: options.server_version ?? 'unknown'
|
|
1493
|
+
},
|
|
1494
|
+
instructions: 'Use sdlc_graph_search for read-only SDLC graph context. This MCP server is a thin wrapper over the SDLC Developer API and never writes graph state. The sdlc_tasks_* tools read and run Tasks and queues as the API key’s user (tasks:read, tasks:write, queues:manage).'
|
|
1495
|
+
});
|
|
1496
|
+
}
|
|
1497
|
+
if (method === 'ping') {
|
|
1498
|
+
return buildSuccessResponse(id, {});
|
|
1499
|
+
}
|
|
1500
|
+
if (method === 'tools/list') {
|
|
1501
|
+
try {
|
|
1502
|
+
const tools = await listGraphToCodeMcpTools({
|
|
1503
|
+
environment: options.environment,
|
|
1504
|
+
fetch_impl
|
|
1505
|
+
});
|
|
1506
|
+
return buildSuccessResponse(id, {
|
|
1507
|
+
tools
|
|
1508
|
+
});
|
|
1509
|
+
}
|
|
1510
|
+
catch (error) {
|
|
1511
|
+
return buildErrorResponse({
|
|
1512
|
+
id,
|
|
1513
|
+
code: -32002,
|
|
1514
|
+
message: error instanceof Error ? error.message : 'Failed to list MCP tools.'
|
|
1515
|
+
});
|
|
1516
|
+
}
|
|
1517
|
+
}
|
|
1518
|
+
if (method === 'tools/call') {
|
|
1519
|
+
const { name, arguments_object } = readToolArguments(request.params);
|
|
1520
|
+
if (!name) {
|
|
1521
|
+
return buildErrorResponse({
|
|
1522
|
+
id,
|
|
1523
|
+
code: -32602,
|
|
1524
|
+
message: 'Tool name is required.'
|
|
1525
|
+
});
|
|
1526
|
+
}
|
|
1527
|
+
const result = await callTool({
|
|
1528
|
+
name,
|
|
1529
|
+
arguments_object,
|
|
1530
|
+
environment: options.environment,
|
|
1531
|
+
fetch_impl
|
|
1532
|
+
});
|
|
1533
|
+
return buildSuccessResponse(id, result);
|
|
1534
|
+
}
|
|
1535
|
+
return buildErrorResponse({
|
|
1536
|
+
id,
|
|
1537
|
+
code: -32601,
|
|
1538
|
+
message: `Unsupported MCP method: ${method}`
|
|
1539
|
+
});
|
|
1540
|
+
}
|
|
1541
|
+
export function buildHostedGraphToCodeMcpGetResponse() {
|
|
1542
|
+
return Response.json({
|
|
1543
|
+
error: 'This MCP endpoint supports POST Streamable HTTP JSON-RPC messages. SSE GET streams are not enabled.'
|
|
1544
|
+
}, {
|
|
1545
|
+
status: 405,
|
|
1546
|
+
headers: {
|
|
1547
|
+
Allow: 'POST',
|
|
1548
|
+
...MCP_RESPONSE_HEADERS
|
|
1549
|
+
}
|
|
1550
|
+
});
|
|
1551
|
+
}
|
|
1552
|
+
export async function handleHostedGraphToCodeMcpRequest(request, options) {
|
|
1553
|
+
if (request.method !== 'POST') {
|
|
1554
|
+
return buildHostedGraphToCodeMcpGetResponse();
|
|
1555
|
+
}
|
|
1556
|
+
if (!isAllowedHostedOrigin(request)) {
|
|
1557
|
+
return Response.json({
|
|
1558
|
+
jsonrpc: '2.0',
|
|
1559
|
+
id: null,
|
|
1560
|
+
error: {
|
|
1561
|
+
code: -32003,
|
|
1562
|
+
message: 'Origin is not allowed for this MCP endpoint.'
|
|
1563
|
+
}
|
|
1564
|
+
}, {
|
|
1565
|
+
status: 403,
|
|
1566
|
+
headers: MCP_RESPONSE_HEADERS
|
|
1567
|
+
});
|
|
1568
|
+
}
|
|
1569
|
+
const environment = resolveHostedGraphToCodeMcpEnvironment(request);
|
|
1570
|
+
if (!environment) {
|
|
1571
|
+
return Response.json({
|
|
1572
|
+
jsonrpc: '2.0',
|
|
1573
|
+
id: null,
|
|
1574
|
+
error: {
|
|
1575
|
+
code: -32001,
|
|
1576
|
+
message: 'Bearer credential is required.'
|
|
1577
|
+
}
|
|
1578
|
+
}, {
|
|
1579
|
+
status: 401,
|
|
1580
|
+
headers: {
|
|
1581
|
+
...MCP_RESPONSE_HEADERS,
|
|
1582
|
+
...options?.unauthorized_headers
|
|
1583
|
+
}
|
|
1584
|
+
});
|
|
1585
|
+
}
|
|
1586
|
+
let message;
|
|
1587
|
+
try {
|
|
1588
|
+
const body = options?.bounded_request_body ??
|
|
1589
|
+
(await readHostedGraphToCodeMcpRequestBody(request));
|
|
1590
|
+
message = JSON.parse(new TextDecoder().decode(body));
|
|
1591
|
+
}
|
|
1592
|
+
catch (error) {
|
|
1593
|
+
if (error instanceof HostedMcpRequestTooLargeError) {
|
|
1594
|
+
return buildHostedGraphToCodeMcpRequestTooLargeResponse();
|
|
1595
|
+
}
|
|
1596
|
+
return Response.json({
|
|
1597
|
+
jsonrpc: '2.0',
|
|
1598
|
+
id: null,
|
|
1599
|
+
error: {
|
|
1600
|
+
code: -32700,
|
|
1601
|
+
message: 'Invalid JSON body.'
|
|
1602
|
+
}
|
|
1603
|
+
}, {
|
|
1604
|
+
status: 400,
|
|
1605
|
+
headers: MCP_RESPONSE_HEADERS
|
|
1606
|
+
});
|
|
1607
|
+
}
|
|
1608
|
+
const response = await handleGraphToCodeMcpMessage(message, {
|
|
1609
|
+
environment,
|
|
1610
|
+
fetch_impl: options?.fetch_impl,
|
|
1611
|
+
server_version: options?.server_version
|
|
1612
|
+
});
|
|
1613
|
+
if (!response) {
|
|
1614
|
+
return new Response(null, {
|
|
1615
|
+
status: 202,
|
|
1616
|
+
headers: MCP_RESPONSE_HEADERS
|
|
1617
|
+
});
|
|
1618
|
+
}
|
|
1619
|
+
return Response.json(response, {
|
|
1620
|
+
status: 200,
|
|
1621
|
+
headers: MCP_RESPONSE_HEADERS
|
|
1622
|
+
});
|
|
1623
|
+
}
|
|
1624
|
+
//# sourceMappingURL=graph-to-code.js.map
|