@hearsay-tools/squawk 0.19.0-pr4418.8633 → 0.19.0-pr4419.8657
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/dist/automations/tools.d.ts +8 -8
- package/dist/boot.js +2 -0
- package/dist/boot.js.map +1 -1
- package/dist/ci-wait/controller.d.ts +7 -7
- package/dist/contract/index.js +1 -1
- package/dist/core/agent-env.js +2 -0
- package/dist/core/agent-env.js.map +1 -1
- package/dist/core/http-route-registry.d.ts +37 -0
- package/dist/core/http-route-registry.js +47 -0
- package/dist/core/http-route-registry.js.map +1 -0
- package/dist/core/product-env.d.ts +2 -0
- package/dist/core/product-env.js +4 -0
- package/dist/core/product-env.js.map +1 -1
- package/dist/core/runner-definition.d.ts +9 -0
- package/dist/core/runner-definition.js.map +1 -1
- package/dist/core/runner-facts.d.ts +6 -3
- package/dist/core/runner-facts.js.map +1 -1
- package/dist/core/secret-redaction.d.ts +10 -4
- package/dist/core/secret-redaction.js +37 -0
- package/dist/core/secret-redaction.js.map +1 -1
- package/dist/delegation/routes.d.ts +65 -65
- package/dist/features/mcp/cli.d.ts +4 -0
- package/dist/features/mcp/cli.js +19 -4
- package/dist/features/mcp/cli.js.map +1 -1
- package/dist/features/mcp/http.d.ts +23 -0
- package/dist/features/mcp/http.js +236 -0
- package/dist/features/mcp/http.js.map +1 -0
- package/dist/features/mcp/index.d.ts +6 -4
- package/dist/features/mcp/index.js +16 -4
- package/dist/features/mcp/index.js.map +1 -1
- package/dist/features/mcp/token-cli.d.ts +9 -0
- package/dist/features/mcp/token-cli.js +188 -0
- package/dist/features/mcp/token-cli.js.map +1 -0
- package/dist/features/mcp/tools.d.ts +4 -0
- package/dist/features/mcp/tools.js +24 -3
- package/dist/features/mcp/tools.js.map +1 -1
- package/dist/home/entry-authorization.js +1 -1
- package/dist/home/entry-authorization.js.map +1 -1
- package/dist/home/home.d.ts +2 -0
- package/dist/home/home.js +1 -0
- package/dist/home/home.js.map +1 -1
- package/dist/home/legacy-source.js +1 -1
- package/dist/home/legacy-source.js.map +1 -1
- package/dist/home/migration-plan.js +4 -4
- package/dist/home/migration-plan.js.map +1 -1
- package/dist/home/recovery-watch.js +2 -2
- package/dist/home/recovery-watch.js.map +1 -1
- package/dist/home/recovery.js +1 -1
- package/dist/home/recovery.js.map +1 -1
- package/dist/home/store.js +3 -3
- package/dist/home/store.js.map +1 -1
- package/dist/mcp-tokens.d.ts +85 -0
- package/dist/mcp-tokens.js +356 -0
- package/dist/mcp-tokens.js.map +1 -0
- package/dist/plugin/api.d.ts +3 -0
- package/dist/plugin/api.js +20 -1
- package/dist/plugin/api.js.map +1 -1
- package/dist/plugin/cli.js +1 -1
- package/dist/plugin/cli.js.map +1 -1
- package/dist/plugin/index.d.ts +1 -0
- package/dist/plugin/index.js.map +1 -1
- package/dist/release/stable.d.ts +8 -0
- package/dist/release/stable.js +12 -0
- package/dist/release/stable.js.map +1 -1
- package/dist/runners/codex/codex-app-server-runner.js +2 -42
- package/dist/runners/codex/codex-app-server-runner.js.map +1 -1
- package/dist/runners/codex/codex-questions.d.ts +5 -0
- package/dist/runners/codex/codex-questions.js +55 -0
- package/dist/runners/codex/codex-questions.js.map +1 -0
- package/dist/runners/codex/mock.d.ts +1 -0
- package/dist/runners/codex/mock.js +1 -0
- package/dist/runners/codex/mock.js.map +1 -1
- package/dist/runners/omp/mock.d.ts +1 -0
- package/dist/runners/omp/mock.js +1 -0
- package/dist/runners/omp/mock.js.map +1 -1
- package/dist/runners/opencode/facts.d.ts +1 -1
- package/dist/runners/opencode/facts.js +3 -2
- package/dist/runners/opencode/facts.js.map +1 -1
- package/dist/runners/opencode/opencode-questions.js +9 -1
- package/dist/runners/opencode/opencode-questions.js.map +1 -1
- package/dist/runners/opencode/opencode-server-runner.d.ts +1 -1
- package/dist/runners/pi/mock.d.ts +1 -0
- package/dist/runners/pi/mock.js +1 -0
- package/dist/runners/pi/mock.js.map +1 -1
- package/dist/runs/record-write-rules.js +2 -2
- package/dist/runs/record-write-rules.js.map +1 -1
- package/dist/runs/run-redaction.d.ts +1 -0
- package/dist/runs/run-redaction.js +18 -7
- package/dist/runs/run-redaction.js.map +1 -1
- package/dist/server/activity-routes.d.ts +23 -23
- package/dist/server/automations-routes.d.ts +150 -150
- package/dist/server/home-recovery-routes.js +7 -4
- package/dist/server/home-recovery-routes.js.map +1 -1
- package/dist/server/live-routes.d.ts +6 -6
- package/dist/server/models-routes.d.ts +12 -12
- package/dist/server/plugin-http-routes.d.ts +21 -0
- package/dist/server/plugin-http-routes.js +52 -0
- package/dist/server/plugin-http-routes.js.map +1 -0
- package/dist/server/project-settings-routes.d.ts +107 -107
- package/dist/server/providers-routes.d.ts +57 -57
- package/dist/server/repo-routes.d.ts +21 -21
- package/dist/server/reports-api.d.ts +2 -2
- package/dist/server/runners-routes.d.ts +10 -10
- package/dist/server/server.d.ts +1845 -1842
- package/dist/server/server.js +15 -3
- package/dist/server/server.js.map +1 -1
- package/dist/server/workspace-live-routes.d.ts +6 -6
- package/dist/server/workspace-routes.d.ts +84 -84
- package/dist/server-install/engine.js +25 -1
- package/dist/server-install/engine.js.map +1 -1
- package/dist/server-install/platforms/ubuntu-vps-nginx.d.ts +14 -0
- package/dist/server-install/platforms/ubuntu-vps-nginx.js +85 -0
- package/dist/server-install/platforms/ubuntu-vps-nginx.js.map +1 -0
- package/dist/server-install/platforms/ubuntu-vps.d.ts +2 -11
- package/dist/server-install/platforms/ubuntu-vps.js +2 -67
- package/dist/server-install/platforms/ubuntu-vps.js.map +1 -1
- package/package.json +4 -4
- package/web/dist/assets/accounts-section-B9Hypl0g.js +1 -0
- package/web/dist/assets/activity-motion-DGlEy383.js +2 -0
- package/web/dist/assets/activity-route-Dgzzvc1C.js +1 -0
- package/web/dist/assets/agent-config-section-CDjUBgnZ.js +7 -0
- package/web/dist/assets/agent-defaults-section-D9w6Arbq.js +1 -0
- package/web/dist/assets/{appearance-Bcl2amXv.js → appearance-Ciu3klj7.js} +1 -1
- package/web/dist/assets/{archive-on-merge-field-Bm8miJjt.js → archive-on-merge-field-C7_Fwy2A.js} +1 -1
- package/web/dist/assets/arrow-up-right-DKGzsMqY.js +1 -0
- package/web/dist/assets/attention-CBCeJN5w.js +1 -0
- package/web/dist/assets/automations-route-CuTrlJe_.js +2 -0
- package/web/dist/assets/automations-route-CzqZXK0W.css +1 -0
- package/web/dist/assets/{commit-list-DtEqtn9o.js → commit-list-hmnkwJgy.js} +1 -1
- package/web/dist/assets/{diff-BK789dS0.js → diff-Bph54Mj6.js} +2 -2
- package/web/dist/assets/{diff-controls-BFqQNxRu.js → diff-controls-D6zRC-Ch.js} +1 -1
- package/web/dist/assets/{diff-view-BEgQ7jZV.js → diff-view-DmmXxueT.js} +1 -1
- package/web/dist/assets/file-preview-DLiwl3fv.js +2 -0
- package/web/dist/assets/{folder-browser-BfclRPcX.js → folder-browser-B7IbnF0d.js} +1 -1
- package/web/dist/assets/{git-toolbar-Pugtjt-9.js → git-toolbar-DMB3ZSSD.js} +1 -1
- package/web/dist/assets/github-FbXescpa.js +1 -0
- package/web/dist/assets/global-activity-route-DjrD5AkK.js +1 -0
- package/web/dist/assets/html-report-BX3msvci.js +3 -0
- package/web/dist/assets/html-report-frame-uuqkBC0u.js +1 -0
- package/web/dist/assets/{image-preview-Dx2w5oIn.js → image-preview-BZAATe5s.js} +1 -1
- package/web/dist/assets/index-Bd4H0_xW.css +1 -0
- package/web/dist/assets/index-cS5ELSRA.js +21 -0
- package/web/dist/assets/{label-DEH7fJN4.js → label-Bt8n7Spq.js} +1 -1
- package/web/dist/assets/live-reads-Crd6fVGH.js +1 -0
- package/web/dist/assets/markdown-DBhG8Ap2.js +2 -0
- package/web/dist/assets/{nav-row-styles-DqKjMToI.js → nav-row-styles-DKeXbc4N.js} +1 -1
- package/web/dist/assets/{notifications-section-DCiqPl3M.js → notifications-section-C8UK7f5C.js} +1 -1
- package/web/dist/assets/open-in-menu-BPp88ouw.js +1 -0
- package/web/dist/assets/page-shell-7pLJMOgh.js +1 -0
- package/web/dist/assets/page-shell-DQPYcKyL.css +1 -0
- package/web/dist/assets/play-BY_SWlhj.js +1 -0
- package/web/dist/assets/preview-pane-connected-EbemQD3m.js +3 -0
- package/web/dist/assets/project-location-BRxXN249.js +1 -0
- package/web/dist/assets/{project-router-Bii3ofOk.js → project-router-CLJTc7gv.js} +1 -1
- package/web/dist/assets/project-scope-context-Rv6S_BXt.js +4 -0
- package/web/dist/assets/projects-section-BzneiDK3.js +1 -0
- package/web/dist/assets/{prompt-templates-section-toLPd5u2.js → prompt-templates-section-WO6Xiv1C.js} +1 -1
- package/web/dist/assets/queries-qCF-eOqZ.js +1 -0
- package/web/dist/assets/{reference-chip-rylFalfg.js → reference-chip-D0v0keVC.js} +1 -1
- package/web/dist/assets/{remote-settings-notice-N9vtBTIK.js → remote-settings-notice-BCmpPIT0.js} +1 -1
- package/web/dist/assets/repo-git-DBWXyzHg.js +1 -0
- package/web/dist/assets/report-reader-DYr8I-SW.js +1 -0
- package/web/dist/assets/reports-CR7j7BEy.js +1 -0
- package/web/dist/assets/reports-CgbU2SrW.css +1 -0
- package/web/dist/assets/{resources-section-B88h1y0Q.js → resources-section-CiPTx574.js} +1 -1
- package/web/dist/assets/run-header-Sse1VUYh.js +2 -0
- package/web/dist/assets/{select-BaydzE-I.js → select-CmF4qPJi.js} +1 -1
- package/web/dist/assets/{session-context-section-BJKRXbss.js → session-context-section-B5P8F_s5.js} +2 -2
- package/web/dist/assets/settings-agent-picker-Byi8AjNU.js +1 -0
- package/web/dist/assets/settings-shell-CqiAPuLq.css +1 -0
- package/web/dist/assets/settings-shell-e0iMUIPe.js +1 -0
- package/web/dist/assets/{sidebar-section-B57HIEgv.js → sidebar-section-CsHTxgwu.js} +1 -1
- package/web/dist/assets/skills-8Hl9CjlR.js +1 -0
- package/web/dist/assets/{tab-link-B1CULYRs.js → tab-link-Bu1g-ArE.js} +1 -1
- package/web/dist/assets/task-changes-CwyUr6Mq.js +1 -0
- package/web/dist/assets/task-commits-CWVxea1v.js +1 -0
- package/web/dist/assets/task-files-CrNywZLV.js +1 -0
- package/web/dist/assets/task-github-item-BiDV7gjB.js +1 -0
- package/web/dist/assets/{task-groups-BbnYlkYj.js → task-groups-4tzKGROI.js} +1 -1
- package/web/dist/assets/task-thread-CbAxAUZB.css +1 -0
- package/web/dist/assets/task-thread-DYZiyJqH.js +12 -0
- package/web/dist/assets/{tasks-table-Cx7AM7lZ.js → tasks-table-C5uoZMFs.js} +1 -1
- package/web/dist/assets/{thread-state-R0MTvwlo.js → thread-state-DCUR4Djq.js} +1 -1
- package/web/dist/assets/toaster-BXnLIU3z.js +1 -0
- package/web/dist/assets/use-hand-to-agent-state-Ch0ok71s.css +1 -0
- package/web/dist/assets/use-hand-to-agent-state-jy8ex2Zf.js +1 -0
- package/web/dist/assets/workflows-DhEJXkD0.js +7 -0
- package/web/dist/assets/workflows-DsE0ExV6.css +1 -0
- package/web/dist/assets/workspace-tools-DrUvrG9H.js +1 -0
- package/web/dist/assets/{worktrees-section-C07tNayi.js → worktrees-section-CTVeHaAF.js} +4 -4
- package/web/dist/index.html +18 -19
- package/web/dist/assets/accounts-section-COizLyTO.js +0 -1
- package/web/dist/assets/activity-motion-DfI5xoMG.js +0 -2
- package/web/dist/assets/activity-route-BQs2vBeo.js +0 -1
- package/web/dist/assets/agent-config-section-BwBo-HRw.js +0 -7
- package/web/dist/assets/agent-defaults-section-h-Gjb_gh.js +0 -1
- package/web/dist/assets/attention-8bNiiAFt.js +0 -1
- package/web/dist/assets/automations-route-CutF-cGn.css +0 -1
- package/web/dist/assets/automations-route-rSezHxBp.js +0 -2
- package/web/dist/assets/file-preview-CDWTFZ4P.js +0 -2
- package/web/dist/assets/github-CvpaGHe6.js +0 -1
- package/web/dist/assets/global-activity-route-Di_ICsRI.js +0 -1
- package/web/dist/assets/index-CGjknHnV.css +0 -1
- package/web/dist/assets/index-CJFT0IZP.js +0 -21
- package/web/dist/assets/live-reads-BJ9eDISf.js +0 -1
- package/web/dist/assets/live-refetch-VoLPvzhe.js +0 -1
- package/web/dist/assets/markdown-Dv0r75AX.js +0 -4
- package/web/dist/assets/open-in-menu-HM5l7Bwk.js +0 -1
- package/web/dist/assets/play-CmVAj_fu.js +0 -1
- package/web/dist/assets/preview-pane-connected-WV9oolnn.js +0 -3
- package/web/dist/assets/project-location-CfJLc6aJ.js +0 -1
- package/web/dist/assets/project-scope-context-BdqKyBHa.js +0 -4
- package/web/dist/assets/projects-section-D2cACaaG.js +0 -1
- package/web/dist/assets/queries-C7VNk-nW.js +0 -1
- package/web/dist/assets/repo-git-DJym0aRY.js +0 -1
- package/web/dist/assets/report-reader-CjskGtxS.js +0 -1
- package/web/dist/assets/reports-B-G9HA48.js +0 -1
- package/web/dist/assets/reports-CNFNb36Z.css +0 -1
- package/web/dist/assets/run-header-B-olCSdg.js +0 -2
- package/web/dist/assets/settings-agent-picker-6xZMIC_D.js +0 -1
- package/web/dist/assets/settings-shell-BkTgs1S9.js +0 -1
- package/web/dist/assets/settings-shell-iSd4xMWS.css +0 -1
- package/web/dist/assets/skills-pBrfwrKF.js +0 -1
- package/web/dist/assets/task-changes-CXldTh93.js +0 -1
- package/web/dist/assets/task-commits-BZ3B_GPB.js +0 -1
- package/web/dist/assets/task-files-BSfmCkJc.js +0 -1
- package/web/dist/assets/task-github-item-v2bygvdO.js +0 -1
- package/web/dist/assets/task-thread-BPWnJ7Qx.js +0 -9
- package/web/dist/assets/task-thread-DzADOhZd.css +0 -1
- package/web/dist/assets/toaster-Bo5vCbz-.js +0 -1
- package/web/dist/assets/use-hand-to-agent-state-B6h6kcQg.css +0 -1
- package/web/dist/assets/use-hand-to-agent-state-BckHuhr8.js +0 -1
- package/web/dist/assets/useInfiniteQuery--iQKfpUQ.js +0 -1
- package/web/dist/assets/useQuery-BSyhc3l3.js +0 -1
- package/web/dist/assets/workflows-BBc2PFDB.js +0 -7
- package/web/dist/assets/workflows-C6suai0L.css +0 -1
- package/web/dist/assets/workspace-tools-CiTG-ArW.js +0 -1
|
@@ -27,18 +27,6 @@ export declare function delegationFailure(error: unknown): {
|
|
|
27
27
|
export declare function createDelegationRoutes(service: DelegationService, credentials: CredentialRegistry): import("hono/hono-base").HonoBase<Env, {
|
|
28
28
|
"/list": {
|
|
29
29
|
$get: {
|
|
30
|
-
output: {
|
|
31
|
-
error: string;
|
|
32
|
-
code?: "invalid_input" | undefined;
|
|
33
|
-
};
|
|
34
|
-
outputFormat: "json";
|
|
35
|
-
status: 400;
|
|
36
|
-
input: {
|
|
37
|
-
query: {
|
|
38
|
-
offset?: string | undefined;
|
|
39
|
-
};
|
|
40
|
-
};
|
|
41
|
-
} | {
|
|
42
30
|
output: {
|
|
43
31
|
workers: {
|
|
44
32
|
workerId: string;
|
|
@@ -91,6 +79,18 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
91
79
|
offset?: string | undefined;
|
|
92
80
|
};
|
|
93
81
|
};
|
|
82
|
+
} | {
|
|
83
|
+
output: {
|
|
84
|
+
error: string;
|
|
85
|
+
code?: "invalid_input" | undefined;
|
|
86
|
+
};
|
|
87
|
+
outputFormat: "json";
|
|
88
|
+
status: 400;
|
|
89
|
+
input: {
|
|
90
|
+
query: {
|
|
91
|
+
offset?: string | undefined;
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
94
|
};
|
|
95
95
|
};
|
|
96
96
|
} & {
|
|
@@ -677,18 +677,6 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
677
677
|
} & {
|
|
678
678
|
"/:workerId": {
|
|
679
679
|
$get: {
|
|
680
|
-
output: {
|
|
681
|
-
error: string;
|
|
682
|
-
code?: "invalid_input" | undefined;
|
|
683
|
-
};
|
|
684
|
-
outputFormat: "json";
|
|
685
|
-
status: 400;
|
|
686
|
-
input: {
|
|
687
|
-
param: {
|
|
688
|
-
workerId: string;
|
|
689
|
-
};
|
|
690
|
-
};
|
|
691
|
-
} | {
|
|
692
680
|
output: {
|
|
693
681
|
workerId: string;
|
|
694
682
|
settled: boolean;
|
|
@@ -813,11 +801,7 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
813
801
|
workerId: string;
|
|
814
802
|
};
|
|
815
803
|
};
|
|
816
|
-
}
|
|
817
|
-
};
|
|
818
|
-
} & {
|
|
819
|
-
"/:workerId/collect": {
|
|
820
|
-
$post: {
|
|
804
|
+
} | {
|
|
821
805
|
output: {
|
|
822
806
|
error: string;
|
|
823
807
|
code?: "invalid_input" | undefined;
|
|
@@ -828,10 +812,12 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
828
812
|
param: {
|
|
829
813
|
workerId: string;
|
|
830
814
|
};
|
|
831
|
-
} & {
|
|
832
|
-
json: Record<string, never>;
|
|
833
815
|
};
|
|
834
|
-
}
|
|
816
|
+
};
|
|
817
|
+
};
|
|
818
|
+
} & {
|
|
819
|
+
"/:workerId/collect": {
|
|
820
|
+
$post: {
|
|
835
821
|
output: {
|
|
836
822
|
workerId: string;
|
|
837
823
|
parentRunId: string;
|
|
@@ -954,11 +940,7 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
954
940
|
} & {
|
|
955
941
|
json: Record<string, never>;
|
|
956
942
|
};
|
|
957
|
-
}
|
|
958
|
-
};
|
|
959
|
-
} & {
|
|
960
|
-
"/:workerId/steer": {
|
|
961
|
-
$post: {
|
|
943
|
+
} | {
|
|
962
944
|
output: {
|
|
963
945
|
error: string;
|
|
964
946
|
code?: "invalid_input" | undefined;
|
|
@@ -970,11 +952,13 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
970
952
|
workerId: string;
|
|
971
953
|
};
|
|
972
954
|
} & {
|
|
973
|
-
json:
|
|
974
|
-
text: string;
|
|
975
|
-
};
|
|
955
|
+
json: Record<string, never>;
|
|
976
956
|
};
|
|
977
|
-
}
|
|
957
|
+
};
|
|
958
|
+
};
|
|
959
|
+
} & {
|
|
960
|
+
"/:workerId/steer": {
|
|
961
|
+
$post: {
|
|
978
962
|
output: {
|
|
979
963
|
workerId: string;
|
|
980
964
|
state: "delivered" | "queued";
|
|
@@ -990,11 +974,7 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
990
974
|
text: string;
|
|
991
975
|
};
|
|
992
976
|
};
|
|
993
|
-
}
|
|
994
|
-
};
|
|
995
|
-
} & {
|
|
996
|
-
"/:workerId/stop": {
|
|
997
|
-
$post: {
|
|
977
|
+
} | {
|
|
998
978
|
output: {
|
|
999
979
|
error: string;
|
|
1000
980
|
code?: "invalid_input" | undefined;
|
|
@@ -1006,9 +986,15 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
1006
986
|
workerId: string;
|
|
1007
987
|
};
|
|
1008
988
|
} & {
|
|
1009
|
-
json:
|
|
989
|
+
json: {
|
|
990
|
+
text: string;
|
|
991
|
+
};
|
|
1010
992
|
};
|
|
1011
|
-
}
|
|
993
|
+
};
|
|
994
|
+
};
|
|
995
|
+
} & {
|
|
996
|
+
"/:workerId/stop": {
|
|
997
|
+
$post: {
|
|
1012
998
|
output: {
|
|
1013
999
|
workerId: string;
|
|
1014
1000
|
state: "stopping" | "terminated";
|
|
@@ -1022,11 +1008,7 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
1022
1008
|
} & {
|
|
1023
1009
|
json: Record<string, never>;
|
|
1024
1010
|
};
|
|
1025
|
-
}
|
|
1026
|
-
};
|
|
1027
|
-
} & {
|
|
1028
|
-
"/:workerId/destroy": {
|
|
1029
|
-
$post: {
|
|
1011
|
+
} | {
|
|
1030
1012
|
output: {
|
|
1031
1013
|
error: string;
|
|
1032
1014
|
code?: "invalid_input" | undefined;
|
|
@@ -1038,11 +1020,13 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
1038
1020
|
workerId: string;
|
|
1039
1021
|
};
|
|
1040
1022
|
} & {
|
|
1041
|
-
json:
|
|
1042
|
-
discardWork?: true | undefined;
|
|
1043
|
-
};
|
|
1023
|
+
json: Record<string, never>;
|
|
1044
1024
|
};
|
|
1045
|
-
}
|
|
1025
|
+
};
|
|
1026
|
+
};
|
|
1027
|
+
} & {
|
|
1028
|
+
"/:workerId/destroy": {
|
|
1029
|
+
$post: {
|
|
1046
1030
|
output: {
|
|
1047
1031
|
workerId: string;
|
|
1048
1032
|
state: "complete" | "incomplete";
|
|
@@ -1071,6 +1055,22 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
1071
1055
|
discardWork?: true | undefined;
|
|
1072
1056
|
};
|
|
1073
1057
|
};
|
|
1058
|
+
} | {
|
|
1059
|
+
output: {
|
|
1060
|
+
error: string;
|
|
1061
|
+
code?: "invalid_input" | undefined;
|
|
1062
|
+
};
|
|
1063
|
+
outputFormat: "json";
|
|
1064
|
+
status: 400;
|
|
1065
|
+
input: {
|
|
1066
|
+
param: {
|
|
1067
|
+
workerId: string;
|
|
1068
|
+
};
|
|
1069
|
+
} & {
|
|
1070
|
+
json: {
|
|
1071
|
+
discardWork?: true | undefined;
|
|
1072
|
+
};
|
|
1073
|
+
};
|
|
1074
1074
|
} | {
|
|
1075
1075
|
output: {
|
|
1076
1076
|
workerId: string;
|
|
@@ -1106,11 +1106,13 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
1106
1106
|
"/:workerId/diff": {
|
|
1107
1107
|
$get: {
|
|
1108
1108
|
output: {
|
|
1109
|
-
|
|
1110
|
-
|
|
1109
|
+
workerId: string;
|
|
1110
|
+
baselineSha: string;
|
|
1111
|
+
diff: string;
|
|
1112
|
+
truncated: boolean;
|
|
1111
1113
|
};
|
|
1112
1114
|
outputFormat: "json";
|
|
1113
|
-
status:
|
|
1115
|
+
status: 200;
|
|
1114
1116
|
input: {
|
|
1115
1117
|
param: {
|
|
1116
1118
|
workerId: string;
|
|
@@ -1118,13 +1120,11 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
1118
1120
|
};
|
|
1119
1121
|
} | {
|
|
1120
1122
|
output: {
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
diff: string;
|
|
1124
|
-
truncated: boolean;
|
|
1123
|
+
error: string;
|
|
1124
|
+
code?: "invalid_input" | undefined;
|
|
1125
1125
|
};
|
|
1126
1126
|
outputFormat: "json";
|
|
1127
|
-
status:
|
|
1127
|
+
status: 400;
|
|
1128
1128
|
input: {
|
|
1129
1129
|
param: {
|
|
1130
1130
|
workerId: string;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import type { Home } from '../../home/home.ts';
|
|
1
2
|
import { type DiscoverOriginOptions } from '../../task-cli/discovery.ts';
|
|
2
3
|
import { type ServeMcpStdioOptions } from './stdio.ts';
|
|
4
|
+
import { type McpTokenCliIo } from './token-cli.ts';
|
|
3
5
|
export declare const MCP_HELP: string;
|
|
4
6
|
export interface McpCliDeps {
|
|
5
7
|
cwd?: () => string;
|
|
@@ -9,6 +11,8 @@ export interface McpCliDeps {
|
|
|
9
11
|
origin: string;
|
|
10
12
|
}>;
|
|
11
13
|
serve?: (options: ServeMcpStdioOptions) => Promise<void>;
|
|
14
|
+
home?: () => Home;
|
|
15
|
+
tokenIo?: McpTokenCliIo;
|
|
12
16
|
version?: string;
|
|
13
17
|
}
|
|
14
18
|
export declare function runMcpCommand(argv: string[], env: NodeJS.ProcessEnv, deps?: McpCliDeps): Promise<number>;
|
package/dist/features/mcp/cli.js
CHANGED
|
@@ -2,20 +2,22 @@ import { readFileSync } from 'node:fs';
|
|
|
2
2
|
import { dirname, join, resolve } from 'node:path';
|
|
3
3
|
import { fileURLToPath } from 'node:url';
|
|
4
4
|
import { parseArgs } from 'node:util';
|
|
5
|
-
import { productEnv } from '../../core/product-env.js';
|
|
5
|
+
import { inTaskContext, productEnv } from '../../core/product-env.js';
|
|
6
6
|
import { commandText } from '../../home/command.js';
|
|
7
7
|
import { discoverCockpitOrigin } from '../../task-cli/discovery.js';
|
|
8
8
|
import { TaskCliError } from '../../task-cli/http.js';
|
|
9
9
|
import { serveMcpStdio } from './stdio.js';
|
|
10
|
-
|
|
10
|
+
import { runMcpTokenCommand } from './token-cli.js';
|
|
11
|
+
export const MCP_HELP = commandText(`Squawk MCP — stdio MCP server and HTTP bearer token management for outside orchestrators
|
|
11
12
|
|
|
12
13
|
Usage:
|
|
13
14
|
cez mcp [--url <origin>] [--repo <dir>]
|
|
15
|
+
cez mcp token <create|list|revoke> [options]
|
|
14
16
|
|
|
15
17
|
Options:
|
|
16
18
|
--url <origin> Connect to this cockpit origin instead of local discovery (also HSQ_URL / CEZ_URL).
|
|
17
19
|
--repo <dir> Match the cockpit serving this repository (default: cwd, falling back to a single local cockpit).
|
|
18
|
-
-h, --help Show this help.
|
|
20
|
+
-h, --help Show this help (use \`cez mcp token --help\` for token management options).
|
|
19
21
|
|
|
20
22
|
Notes:
|
|
21
23
|
- Keeps stdout strictly for MCP JSON-RPC frames; diagnostics go to stderr.
|
|
@@ -55,9 +57,22 @@ function formatCliError(error) {
|
|
|
55
57
|
}
|
|
56
58
|
return { message: error instanceof Error ? error.message : String(error), exitCode: 1 };
|
|
57
59
|
}
|
|
60
|
+
async function runMcpTokenDispatch(argv, env, deps, writeOut, writeErr) {
|
|
61
|
+
if (inTaskContext(env)) {
|
|
62
|
+
writeErr(commandText('cez mcp token is host-only and refuses to run inside a Squawk task (HSQ_TASK_ID / CEZ_TASK_ID is set).'));
|
|
63
|
+
return 1;
|
|
64
|
+
}
|
|
65
|
+
if (!deps.home) {
|
|
66
|
+
writeErr('MCP token management requires a resolved Squawk home.');
|
|
67
|
+
return 1;
|
|
68
|
+
}
|
|
69
|
+
return runMcpTokenCommand(argv.slice(1), deps.home(), deps.tokenIo ?? { stdout: writeOut });
|
|
70
|
+
}
|
|
58
71
|
export async function runMcpCommand(argv, env, deps = {}) {
|
|
59
72
|
const writeOut = deps.stdout ?? ((line) => console.log(line));
|
|
60
73
|
const writeErr = deps.stderr ?? ((line) => console.error(line));
|
|
74
|
+
if (argv[0] === 'token')
|
|
75
|
+
return runMcpTokenDispatch(argv, env, deps, writeOut, writeErr);
|
|
61
76
|
try {
|
|
62
77
|
const parsed = parseMcpArgs(argv);
|
|
63
78
|
if (parsed.values.help) {
|
|
@@ -67,7 +82,7 @@ export async function runMcpCommand(argv, env, deps = {}) {
|
|
|
67
82
|
if (parsed.positionals.length > 0) {
|
|
68
83
|
throw new TaskCliError(64, { code: 'invalid_input', error: `unexpected argument '${parsed.positionals[0]}'` });
|
|
69
84
|
}
|
|
70
|
-
if (
|
|
85
|
+
if (inTaskContext(env)) {
|
|
71
86
|
writeErr(commandText('cez mcp is for outside orchestrators and refuses to start inside a Squawk task (HSQ_TASK_ID / CEZ_TASK_ID is set).'));
|
|
72
87
|
return 1;
|
|
73
88
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../../src/features/mcp/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../../src/features/mcp/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,OAAO,EAAE,qBAAqB,EAA8B,MAAM,6BAA6B,CAAC;A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S,CAAC,CAAC;QAC/E,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,KAAK,SAAS,CAAC;QACtD,MAAM,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;QACvF,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,IAAI,qBAAqB,CAAC,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,YAAY,EAAE,CAAC,CAAC;QAClG,MAAM,CAAC,IAAI,CAAC,KAAK,IAAI,aAAa,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,IAAI,kBAAkB,EAAE,EAAE,CAAC,CAAC;QAC/F,OAAO,CAAC,CAAC;IACX,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,SAAS,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;QACxC,QAAQ,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QAC5B,OAAO,SAAS,CAAC,QAAQ,CAAC;IAC5B,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { HttpRouteContext, HttpRouteDefinition } from '../../core/http-route-registry.ts';
|
|
2
|
+
export declare const MCP_HTTP_ROUTE_ID = "mcp";
|
|
3
|
+
export declare const MCP_HTTP_PATH = "/api/v1/mcp";
|
|
4
|
+
export declare const MCP_MAX_BODY_BYTES: number;
|
|
5
|
+
export declare const MCP_KEEP_ALIVE_MS = 15000;
|
|
6
|
+
export interface McpHttpHandlerOptions {
|
|
7
|
+
env?: NodeJS.ProcessEnv | undefined;
|
|
8
|
+
pollMs?: number | undefined;
|
|
9
|
+
heartbeatMs?: number | undefined;
|
|
10
|
+
keepAliveMs?: number | undefined;
|
|
11
|
+
}
|
|
12
|
+
/** Parse `Authorization: Bearer <token>`. Rejects missing, Basic, empty, or multi-word headers. */
|
|
13
|
+
export declare function parseBearerHeader(header: string | null): string | null;
|
|
14
|
+
/**
|
|
15
|
+
* Resolve the cockpit origin returned in MCP task URLs. Behind a hosted reverse proxy, honor
|
|
16
|
+
* `X-Forwarded-Proto` and `X-Forwarded-Host` (falling back to `Host`); in local mode, ignore
|
|
17
|
+
* forwarded headers and use the loopback request host. Invalid authorities fall back safely.
|
|
18
|
+
*/
|
|
19
|
+
export declare function resolvePublicOrigin(request: Request, context: HttpRouteContext, loopbackOrigin: string): string;
|
|
20
|
+
/** Handle one HTTP request to `/api/v1/mcp`. */
|
|
21
|
+
export declare function handleMcpHttpRequest(request: Request, context: HttpRouteContext, options?: McpHttpHandlerOptions): Promise<Response>;
|
|
22
|
+
export declare function createMcpHttpRoute(options?: McpHttpHandlerOptions): HttpRouteDefinition;
|
|
23
|
+
export declare const mcpHttpRoute: HttpRouteDefinition;
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stateless Streamable HTTP MCP endpoint (`/api/v1/mcp`, hearsay-tools/squawk#4402).
|
|
3
|
+
*
|
|
4
|
+
* Security invariants (after the global `/api/*` loopback-Host check in local mode; skips global
|
|
5
|
+
* 32 MiB `bodyLimit` buffering via `managesBodyLimit: true`):
|
|
6
|
+
* 1. Reject any request carrying an `Origin` header (`403`) before reading the body.
|
|
7
|
+
* 2. Fail closed (`404`) when no MCP bearer token is configured for this port or env.
|
|
8
|
+
* 3. Require `Authorization: Bearer <token>` verified via SHA-256 + `crypto.timingSafeEqual`
|
|
9
|
+
* (`401` + `WWW-Authenticate: Bearer` on missing, invalid, or Basic auth) before reading the body.
|
|
10
|
+
* 4. Allow `POST` only (`405` + `Allow: POST` on `GET`/`DELETE`/other methods).
|
|
11
|
+
* 5. Enforce a 1 MiB streaming request body limit (`413`) on authenticated `POST`s.
|
|
12
|
+
*/
|
|
13
|
+
import { WebStandardStreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js';
|
|
14
|
+
import { registerRuntimeSecret } from '../../core/secret-redaction.js';
|
|
15
|
+
import { authenticateMcpRequest } from '../../mcp-tokens.js';
|
|
16
|
+
import { createOrchestratorMcpServer } from './tools.js';
|
|
17
|
+
export const MCP_HTTP_ROUTE_ID = 'mcp';
|
|
18
|
+
export const MCP_HTTP_PATH = '/api/v1/mcp';
|
|
19
|
+
export const MCP_MAX_BODY_BYTES = 1024 * 1024; // 1 MiB
|
|
20
|
+
export const MCP_KEEP_ALIVE_MS = 15_000;
|
|
21
|
+
/** Parse `Authorization: Bearer <token>`. Rejects missing, Basic, empty, or multi-word headers. */
|
|
22
|
+
export function parseBearerHeader(header) {
|
|
23
|
+
if (!header)
|
|
24
|
+
return null;
|
|
25
|
+
const match = /^Bearer\s+(\S+)$/i.exec(header.trim());
|
|
26
|
+
return match?.[1] ?? null;
|
|
27
|
+
}
|
|
28
|
+
/** Read a request body up to `maxBytes`. Returns `null` when the payload exceeds the cap. */
|
|
29
|
+
async function readBoundedBody(request, maxBytes) {
|
|
30
|
+
const declared = request.headers.get('content-length');
|
|
31
|
+
if (declared !== null) {
|
|
32
|
+
const length = Number(declared);
|
|
33
|
+
if (Number.isFinite(length) && length > maxBytes) {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
const reader = request.body?.getReader();
|
|
38
|
+
if (!reader)
|
|
39
|
+
return new Uint8Array(0);
|
|
40
|
+
let total = 0;
|
|
41
|
+
const chunks = [];
|
|
42
|
+
try {
|
|
43
|
+
for (;;) {
|
|
44
|
+
const next = await reader.read();
|
|
45
|
+
if (next.done)
|
|
46
|
+
break;
|
|
47
|
+
total += next.value.byteLength;
|
|
48
|
+
if (total > maxBytes) {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
chunks.push(next.value);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
finally {
|
|
55
|
+
reader.releaseLock();
|
|
56
|
+
}
|
|
57
|
+
const combined = new Uint8Array(new ArrayBuffer(total));
|
|
58
|
+
let offset = 0;
|
|
59
|
+
for (const chunk of chunks) {
|
|
60
|
+
combined.set(chunk, offset);
|
|
61
|
+
offset += chunk.byteLength;
|
|
62
|
+
}
|
|
63
|
+
return combined;
|
|
64
|
+
}
|
|
65
|
+
function wrapStreamCleanup(body, onDone) {
|
|
66
|
+
let finished = false;
|
|
67
|
+
const finish = () => {
|
|
68
|
+
if (finished)
|
|
69
|
+
return;
|
|
70
|
+
finished = true;
|
|
71
|
+
onDone();
|
|
72
|
+
};
|
|
73
|
+
const reader = body.getReader();
|
|
74
|
+
return new ReadableStream({
|
|
75
|
+
async pull(controller) {
|
|
76
|
+
try {
|
|
77
|
+
const next = await reader.read();
|
|
78
|
+
if (next.done) {
|
|
79
|
+
controller.close();
|
|
80
|
+
finish();
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
controller.enqueue(next.value);
|
|
84
|
+
}
|
|
85
|
+
catch (error) {
|
|
86
|
+
controller.error(error);
|
|
87
|
+
finish();
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
async cancel(reason) {
|
|
91
|
+
try {
|
|
92
|
+
await reader.cancel(reason);
|
|
93
|
+
}
|
|
94
|
+
catch { /* stream already closed */ }
|
|
95
|
+
finish();
|
|
96
|
+
},
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
function firstHeaderToken(value) {
|
|
100
|
+
if (!value)
|
|
101
|
+
return null;
|
|
102
|
+
const first = value.split(',')[0]?.trim();
|
|
103
|
+
return first ? first : null;
|
|
104
|
+
}
|
|
105
|
+
function parseRequestUrl(url) {
|
|
106
|
+
try {
|
|
107
|
+
return new URL(url);
|
|
108
|
+
}
|
|
109
|
+
catch {
|
|
110
|
+
return null;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
function parseOriginAuthority(proto, rawHost) {
|
|
114
|
+
if (!rawHost || /[\s/@\\]/.test(rawHost))
|
|
115
|
+
return null;
|
|
116
|
+
const parsed = parseRequestUrl(`${proto}://${rawHost}`);
|
|
117
|
+
if (!parsed)
|
|
118
|
+
return null;
|
|
119
|
+
const hasExtras = Boolean(parsed.username || parsed.password || parsed.search || parsed.hash);
|
|
120
|
+
return hasExtras || parsed.pathname !== '/' ? null : parsed.origin;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Resolve the cockpit origin returned in MCP task URLs. Behind a hosted reverse proxy, honor
|
|
124
|
+
* `X-Forwarded-Proto` and `X-Forwarded-Host` (falling back to `Host`); in local mode, ignore
|
|
125
|
+
* forwarded headers and use the loopback request host. Invalid authorities fall back safely.
|
|
126
|
+
*/
|
|
127
|
+
export function resolvePublicOrigin(request, context, loopbackOrigin) {
|
|
128
|
+
const requestUrl = parseRequestUrl(request.url);
|
|
129
|
+
const hosted = context.isHostedMode();
|
|
130
|
+
const forwardedProto = hosted ? firstHeaderToken(request.headers.get('x-forwarded-proto'))?.toLowerCase() : undefined;
|
|
131
|
+
const proto = forwardedProto === 'http' || forwardedProto === 'https'
|
|
132
|
+
? forwardedProto
|
|
133
|
+
: requestUrl?.protocol === 'https:' ? 'https' : 'http';
|
|
134
|
+
const rawHost = (hosted ? firstHeaderToken(request.headers.get('x-forwarded-host')) : null)
|
|
135
|
+
?? firstHeaderToken(request.headers.get('host'))
|
|
136
|
+
?? requestUrl?.host
|
|
137
|
+
?? null;
|
|
138
|
+
return parseOriginAuthority(proto, rawHost) ?? loopbackOrigin;
|
|
139
|
+
}
|
|
140
|
+
function unauthorizedResponse() {
|
|
141
|
+
return Response.json({ error: 'unauthorized: valid Bearer token required' }, { status: 401, headers: { 'WWW-Authenticate': 'Bearer' } });
|
|
142
|
+
}
|
|
143
|
+
/** Handle one HTTP request to `/api/v1/mcp`. */
|
|
144
|
+
export async function handleMcpHttpRequest(request, context, options = {}) {
|
|
145
|
+
if (request.headers.get('origin') !== null) {
|
|
146
|
+
return Response.json({ error: 'forbidden: Origin header is not allowed on /api/v1/mcp' }, { status: 403 });
|
|
147
|
+
}
|
|
148
|
+
const env = options.env ?? process.env;
|
|
149
|
+
const port = context.squawkPort();
|
|
150
|
+
const rawToken = parseBearerHeader(request.headers.get('authorization'));
|
|
151
|
+
const auth = authenticateMcpRequest(rawToken, env, port, context.home);
|
|
152
|
+
if (auth.status === 'unconfigured') {
|
|
153
|
+
return Response.json({ error: 'not found' }, { status: 404 });
|
|
154
|
+
}
|
|
155
|
+
if (auth.status === 'unauthorized') {
|
|
156
|
+
return unauthorizedResponse();
|
|
157
|
+
}
|
|
158
|
+
const verified = auth.verified;
|
|
159
|
+
if (rawToken)
|
|
160
|
+
registerRuntimeSecret(rawToken);
|
|
161
|
+
if (request.method !== 'POST') {
|
|
162
|
+
return Response.json({ error: 'method not allowed: use POST /api/v1/mcp' }, { status: 405, headers: { Allow: 'POST' } });
|
|
163
|
+
}
|
|
164
|
+
const bodyBytes = await readBoundedBody(request, MCP_MAX_BODY_BYTES);
|
|
165
|
+
if (bodyBytes === null) {
|
|
166
|
+
return Response.json({ error: 'request body exceeds 1 MiB limit' }, { status: 413 });
|
|
167
|
+
}
|
|
168
|
+
const abortController = new AbortController();
|
|
169
|
+
const onRequestAbort = () => abortController.abort(request.signal.reason);
|
|
170
|
+
if (request.signal.aborted)
|
|
171
|
+
onRequestAbort();
|
|
172
|
+
else
|
|
173
|
+
request.signal.addEventListener('abort', onRequestAbort, { once: true });
|
|
174
|
+
const loopbackOrigin = port !== undefined ? `http://127.0.0.1:${port}` : 'http://127.0.0.1';
|
|
175
|
+
const publicOrigin = resolvePublicOrigin(request, context, loopbackOrigin);
|
|
176
|
+
const inProcessFetch = (input, init) => {
|
|
177
|
+
const rawUrl = typeof input === 'string' ? input : input instanceof URL ? input.href : input.url;
|
|
178
|
+
const target = new URL(rawUrl, loopbackOrigin);
|
|
179
|
+
const internalUrl = `${loopbackOrigin}${target.pathname}${target.search}`;
|
|
180
|
+
return context.fetchApp(new Request(internalUrl, init));
|
|
181
|
+
};
|
|
182
|
+
const server = createOrchestratorMcpServer({
|
|
183
|
+
origin: publicOrigin,
|
|
184
|
+
version: context.version,
|
|
185
|
+
fetch: inProcessFetch,
|
|
186
|
+
allowedProject: verified.project,
|
|
187
|
+
requestSignal: abortController.signal,
|
|
188
|
+
pollMs: options.pollMs,
|
|
189
|
+
heartbeatMs: options.heartbeatMs,
|
|
190
|
+
});
|
|
191
|
+
// Stateless mode: omit sessionIdGenerator so no Mcp-Session-Id is issued.
|
|
192
|
+
const transport = new WebStandardStreamableHTTPServerTransport({
|
|
193
|
+
keepAliveMs: options.keepAliveMs ?? MCP_KEEP_ALIVE_MS,
|
|
194
|
+
});
|
|
195
|
+
const cleanup = () => {
|
|
196
|
+
request.signal.removeEventListener('abort', onRequestAbort);
|
|
197
|
+
if (!abortController.signal.aborted)
|
|
198
|
+
abortController.abort();
|
|
199
|
+
void transport.close().catch(() => { });
|
|
200
|
+
void server.close().catch(() => { });
|
|
201
|
+
};
|
|
202
|
+
try {
|
|
203
|
+
await server.connect(transport);
|
|
204
|
+
const forwarded = new Request(request.url, {
|
|
205
|
+
method: 'POST',
|
|
206
|
+
headers: request.headers,
|
|
207
|
+
body: bodyBytes ?? new Uint8Array(0),
|
|
208
|
+
});
|
|
209
|
+
const response = await transport.handleRequest(forwarded);
|
|
210
|
+
const isSse = (response.headers.get('content-type') ?? '').includes('text/event-stream');
|
|
211
|
+
if (isSse && response.body) {
|
|
212
|
+
return new Response(wrapStreamCleanup(response.body, cleanup), {
|
|
213
|
+
status: response.status,
|
|
214
|
+
statusText: response.statusText,
|
|
215
|
+
headers: response.headers,
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
cleanup();
|
|
219
|
+
return response;
|
|
220
|
+
}
|
|
221
|
+
catch (error) {
|
|
222
|
+
cleanup();
|
|
223
|
+
throw error;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
export function createMcpHttpRoute(options = {}) {
|
|
227
|
+
return {
|
|
228
|
+
id: MCP_HTTP_ROUTE_ID,
|
|
229
|
+
method: 'ALL',
|
|
230
|
+
path: MCP_HTTP_PATH,
|
|
231
|
+
managesBodyLimit: true,
|
|
232
|
+
handle: (request, context) => handleMcpHttpRequest(request, context, options),
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
export const mcpHttpRoute = createMcpHttpRoute();
|
|
236
|
+
//# sourceMappingURL=http.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.js","sourceRoot":"","sources":["../../../src/features/mcp/http.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,wCAAwC,EAAE,MAAM,+DAA+D,CAAC;AAEzH,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,OAAO,EAAE,2BAA2B,EAAE,MAAM,YAAY,CAAC;AAEzD,MAAM,CAAC,MAAM,iBAAiB,GAAG,KAAK,CAAC;AACvC,MAAM,CAAC,MAAM,aAAa,GAAG,aAAa,CAAC;AAC3C,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC,QAAQ;AACvD,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC;AASxC,mGAAmG;AACnG,MAAM,UAAU,iBAAiB,CAAC,MAAqB;IACrD,IAAI,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC;IACzB,MAAM,KAAK,GAAG,mBAAmB,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;IACtD,OAAO,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;AAC5B,CAAC;AAED,6FAA6F;AAC7F,KAAK,UAAU,eAAe,CAAC,OAAgB,EAAE,QAAgB;IAC/D,MAAM,QAAQ,GAAG,OAAO,CAAC,OAAO,CAA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AED,MAAM,UAAU,kBAAkB,CAAC,OAAO,GAA0B,EAAE;IACpE,OAAO;QACL,EAAE,EAAE,iBAAiB;QACrB,MAAM,EAAE,KAAK;QACb,IAAI,EAAE,aAAa;QACnB,gBAAgB,EAAE,IAAI;QACtB,MAAM,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,CAAC,oBAAoB,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC;KAC9E,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,YAAY,GAAwB,kBAAkB,EAAE,CAAC"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The bundled orchestrator MCP feature (spec 2026-11-27-orchestrator-mcp-server,
|
|
3
|
-
* hearsay-tools/squawk#4401): registers `hsq mcp`
|
|
4
|
-
* Nothing outside this folder imports it.
|
|
3
|
+
* hearsay-tools/squawk#4401 and hearsay-tools/squawk#4402): registers `hsq mcp` and
|
|
4
|
+
* `POST /api/v1/mcp` through the plugin API only. Nothing outside this folder imports it.
|
|
5
5
|
*/
|
|
6
|
-
import type { CliCommandDefinition, SquawkPluginApi } from '../../plugin/index.ts';
|
|
7
|
-
/** `hsq mcp`:
|
|
6
|
+
import type { CliCommandDefinition, HttpRouteDefinition, SquawkPluginApi } from '../../plugin/index.ts';
|
|
7
|
+
/** `hsq mcp`: stdio MCP server and host-CLI bearer token management (`hsq mcp token`). */
|
|
8
8
|
export declare const mcpCliCommand: CliCommandDefinition;
|
|
9
|
+
/** Stateless Streamable HTTP MCP route (`/api/v1/mcp`), loaded lazily on first request. */
|
|
10
|
+
export declare const mcpHttpRoute: HttpRouteDefinition;
|
|
9
11
|
export default function setup(api: SquawkPluginApi): void;
|
|
@@ -1,13 +1,25 @@
|
|
|
1
|
-
/** `hsq mcp`:
|
|
1
|
+
/** `hsq mcp`: stdio MCP server and host-CLI bearer token management (`hsq mcp token`). */
|
|
2
2
|
export const mcpCliCommand = {
|
|
3
3
|
name: 'mcp',
|
|
4
|
-
usage: [
|
|
4
|
+
usage: [
|
|
5
|
+
' cez mcp [--url <origin>] [--repo <dir>] serve Squawk task tools over MCP stdio (see: mcp --help)',
|
|
6
|
+
' cez mcp token <create|list|revoke> manage bearer tokens for POST /api/v1/mcp',
|
|
7
|
+
],
|
|
5
8
|
parseMode: 'subcommand',
|
|
6
|
-
homeMode: '
|
|
9
|
+
homeMode: 'conditional',
|
|
7
10
|
runtimeMode: 'none',
|
|
8
|
-
load: async () => (await import('./cli.js')).runMcpCommand,
|
|
11
|
+
load: async (home) => async (argv, env) => (await import('./cli.js')).runMcpCommand(argv, env, { home: () => home(env) }),
|
|
12
|
+
};
|
|
13
|
+
/** Stateless Streamable HTTP MCP route (`/api/v1/mcp`), loaded lazily on first request. */
|
|
14
|
+
export const mcpHttpRoute = {
|
|
15
|
+
id: 'mcp',
|
|
16
|
+
method: 'ALL',
|
|
17
|
+
path: '/api/v1/mcp',
|
|
18
|
+
managesBodyLimit: true,
|
|
19
|
+
handle: async (request, context) => (await import('./http.js')).handleMcpHttpRequest(request, context),
|
|
9
20
|
};
|
|
10
21
|
export default function setup(api) {
|
|
11
22
|
api.registerCliCommand(mcpCliCommand);
|
|
23
|
+
api.registerHttpRoute(mcpHttpRoute);
|
|
12
24
|
}
|
|
13
25
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/features/mcp/index.ts"],"names":[],"mappings":"AAOA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/features/mcp/index.ts"],"names":[],"mappings":"AAOA,0FAA0F;AAC1F,MAAM,CAAC,MAAM,aAAa,GAAyB;IACjD,IAAI,EAAE,KAAK;IACX,KAAK,EAAE;QACL,qGAAqG;QACrG,sFAAsF;KACvF;IACD,SAAS,EAAE,YAAY;IACvB,QAAQ,EAAE,aAAa;IACvB,WAAW,EAAE,MAAM;IACnB,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,CACxC,CAAC,MAAM,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,aAAa,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;CACjF,CAAC;AAEF,2FAA2F;AAC3F,MAAM,CAAC,MAAM,YAAY,GAAwB;IAC/C,EAAE,EAAE,KAAK;IACT,MAAM,EAAE,KAAK;IACb,IAAI,EAAE,aAAa;IACnB,gBAAgB,EAAE,IAAI;IACtB,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC,MAAM,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,oBAAoB,CAAC,OAAO,EAAE,OAAO,CAAC;CACvG,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,GAAoB;IAChD,GAAG,CAAC,kBAAkB,CAAC,aAAa,CAAC,CAAC;IACtC,GAAG,CAAC,iBAAiB,CAAC,YAAY,CAAC,CAAC;AACtC,CAAC"}
|