@deslop/workbench 0.0.360 → 0.0.381
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/anthropic-C02QVQ9u.mjs +6313 -0
- package/dist/azure-openai-responses-CUFLNwdy.mjs +207 -0
- package/dist/client/assets/{(home)-DVKAaI4b.js → (home)-BL3S5BVq.js} +1 -1
- package/dist/client/assets/-workbench-terminal-YB9hQXjr.js +145 -0
- package/dist/client/assets/agent-BmwIVlVZ.js +1 -0
- package/dist/client/assets/agent-CE67X_hb.js +2 -0
- package/dist/client/assets/{arc-CuHXSNPr.js → arc-BjSQqbzd.js} +1 -1
- package/dist/client/assets/architectureDiagram-3BPJPVTR-CTWT1AFv.js +36 -0
- package/dist/client/assets/{blockDiagram-GPEHLZMM-D3jiL-uN.js → blockDiagram-GPEHLZMM-CISQUfO9.js} +1 -1
- package/dist/client/assets/{c4Diagram-AAUBKEIU-bA47L7u8.js → c4Diagram-AAUBKEIU-Ct3OGD9a.js} +1 -1
- package/dist/client/assets/channel-S3CdaK6m.js +1 -0
- package/dist/client/assets/{chunk-2J33WTMH-optplvap.js → chunk-2J33WTMH-BUMgKaV6.js} +1 -1
- package/dist/client/assets/{chunk-3OPIFGDE-k7mTnOn5.js → chunk-3OPIFGDE-BlIdNnu8.js} +1 -1
- package/dist/client/assets/{chunk-4BX2VUAB-Co5qfYem.js → chunk-4BX2VUAB-CiBu5cRv.js} +1 -1
- package/dist/client/assets/{chunk-55IACEB6-7AWIUH7L.js → chunk-55IACEB6-nU8KvKB3.js} +1 -1
- package/dist/client/assets/{chunk-5ZQYHXKU-Bub4jU0C.js → chunk-5ZQYHXKU-DbN9DSns.js} +1 -1
- package/dist/client/assets/{chunk-727SXJPM-DcofuxtV.js → chunk-727SXJPM-DkPu5ecB.js} +2 -2
- package/dist/client/assets/{chunk-AQP2D5EJ-CBwGmuY5.js → chunk-AQP2D5EJ-B8lrSg7a.js} +1 -1
- package/dist/client/assets/{chunk-BSJP7CBP-BInTsaMb.js → chunk-BSJP7CBP-C450xCVa.js} +1 -1
- package/dist/client/assets/{chunk-CSCIHK7Q-BTHSw3Fl.js → chunk-CSCIHK7Q-DoGVP1BZ.js} +2 -2
- package/dist/client/assets/{chunk-FMBD7UC4-BQD4ioRx.js → chunk-FMBD7UC4-cqorOok8.js} +1 -1
- package/dist/client/assets/{chunk-KSCS5N6A-CUDSaUx0.js → chunk-KSCS5N6A-dbmnxO_p.js} +1 -1
- package/dist/client/assets/{chunk-L5ZTLDWV-D0-tvK0S.js → chunk-L5ZTLDWV-D9P-YjsA.js} +1 -1
- package/dist/client/assets/{chunk-LZXEDZCA-BkJ5xlLM.js → chunk-LZXEDZCA-BdVT_AWc.js} +2 -2
- package/dist/client/assets/{chunk-ND2GUHAM-COdW9HuZ.js → chunk-ND2GUHAM-CmHIi1wD.js} +1 -1
- package/dist/client/assets/{chunk-NZK2D7GU-Byrnkfto.js → chunk-NZK2D7GU-hkTOm2qR.js} +1 -1
- package/dist/client/assets/{chunk-O5CBEL6O-C_CProRX.js → chunk-O5CBEL6O-D1fDxsSH.js} +1 -1
- package/dist/client/assets/chunk-QZHKN3VN-BS_CF_l3.js +1 -0
- package/dist/client/assets/chunk-WU5MYG2G-CtG2KJlt.js +1 -0
- package/dist/client/assets/{chunk-XPW4576I-DWr3727k.js → chunk-XPW4576I-BjBK3ctW.js} +2 -2
- package/dist/client/assets/classDiagram-4FO5ZUOK-BdTSUdNF.js +1 -0
- package/dist/client/assets/classDiagram-v2-Q7XG4LA2-BdTSUdNF.js +1 -0
- package/dist/client/assets/compiler-runtime-CLAvuQ-D.js +1 -0
- package/dist/client/assets/cose-bilkent-S5V4N54A-BGt2II16.js +1 -0
- package/dist/client/assets/{cytoscape.esm-FqbQrHcz.js → cytoscape.esm-Kic9WIU3.js} +2 -2
- package/dist/client/assets/{dagre-BM42HDAG-Bwiv8kFL.js → dagre-BM42HDAG-CN7Tha00.js} +1 -1
- package/dist/client/assets/{diagram-2AECGRRQ-BY9KXQPi.js → diagram-2AECGRRQ-DnobmroZ.js} +1 -1
- package/dist/client/assets/{diagram-5GNKFQAL-C-jmG8LL.js → diagram-5GNKFQAL-D6NqAeoi.js} +1 -1
- package/dist/client/assets/{diagram-KO2AKTUF-qDHWGr5P.js → diagram-KO2AKTUF-y8QX4vEL.js} +1 -1
- package/dist/client/assets/{diagram-LMA3HP47-Dg8zuIuL.js → diagram-LMA3HP47-DAEPoAHp.js} +1 -1
- package/dist/client/assets/{diagram-OG6HWLK6-DupmLmKo.js → diagram-OG6HWLK6-B3KiYvxM.js} +1 -1
- package/dist/client/assets/dialog-B0kBnYwI.js +153 -0
- package/dist/client/assets/diff-BP9B4x7R.js +2 -0
- package/dist/client/assets/diff-OmMK6IL0.js +221 -0
- package/dist/client/assets/dist-D9sYb5Oa.js +1 -0
- package/dist/client/assets/{erDiagram-TEJ5UH35-DcYoMsDA.js → erDiagram-TEJ5UH35-CbzdEpkS.js} +1 -1
- package/dist/client/assets/external-link-D7Q28KpR.js +1 -0
- package/dist/client/assets/fallbacks-DwGmG_0c.js +16 -0
- package/dist/client/assets/{flowDiagram-I6XJVG4X-xLfWiyaL.js → flowDiagram-I6XJVG4X-C2H7PQev.js} +1 -1
- package/dist/client/assets/ganttDiagram-6RSMTGT7-BZql2QFP.js +292 -0
- package/dist/client/assets/{gitGraphDiagram-PVQCEYII-DE7nmb1q.js → gitGraphDiagram-PVQCEYII-d2_5HIIo.js} +1 -1
- package/dist/client/assets/{index-D1icept3.js → index-Cc-cDoXa.js} +4 -4
- package/dist/client/assets/index-DT_QSnKQ.css +2 -0
- package/dist/client/assets/{infoDiagram-5YYISTIA-CUzdfhph.js → infoDiagram-5YYISTIA-DaDFMb3D.js} +1 -1
- package/dist/client/assets/input-CEh4Uy0l.js +1 -0
- package/dist/client/assets/{ishikawaDiagram-YF4QCWOH-D3h5fT3O.js → ishikawaDiagram-YF4QCWOH-7tWPtPSR.js} +1 -1
- package/dist/client/assets/{journeyDiagram-JHISSGLW-DXqP7IZk.js → journeyDiagram-JHISSGLW-CYDeiigr.js} +1 -1
- package/dist/client/assets/{kanban-definition-UN3LZRKU-BBdz3OGi.js → kanban-definition-UN3LZRKU-BFoF4JfY.js} +3 -3
- package/dist/client/assets/{katex-Vhh-h91d.js → katex-CddkPoXu.js} +1 -1
- package/dist/client/assets/{line-D2nnU070.js → line-CcJ0IOWh.js} +1 -1
- package/dist/client/assets/{linear-BifnMVyn.js → linear-Ct8JHF0c.js} +1 -1
- package/dist/client/assets/mermaid-parser.core-CKHoAf1J.js +2 -2
- package/dist/client/assets/{mindmap-definition-RKZ34NQL-BAbACAeS.js → mindmap-definition-RKZ34NQL-DTgZ_Z5F.js} +1 -1
- package/dist/client/assets/{pieDiagram-4H26LBE5-YjWBEaV3.js → pieDiagram-4H26LBE5-BmpbjVUG.js} +1 -1
- package/dist/client/assets/pierre-dark-vibrant-D4RhcSIK.js +1 -0
- package/dist/client/assets/pierre-light-vibrant-B76X7i5Y.js +1 -0
- package/dist/client/assets/portless-4_iTgOr5.js +1 -0
- package/dist/client/assets/portless-qyhmpSUj.js +2 -0
- package/dist/client/assets/{quadrantDiagram-W4KKPZXB-0qpR8bhI.js → quadrantDiagram-W4KKPZXB-BncnX7WL.js} +1 -1
- package/dist/client/assets/{requirementDiagram-4Y6WPE33-UxrH60_h.js → requirementDiagram-4Y6WPE33-C4viwYDb.js} +1 -1
- package/dist/client/assets/resizable-A9BpOcmt.js +1 -0
- package/dist/client/assets/route-Da0uHKH9.js +45 -0
- package/dist/client/assets/route-ULg8h9n0.js +2 -0
- package/dist/client/assets/run-CCCofwDU.js +2 -0
- package/dist/client/assets/run-D7w-8aQA.js +1 -0
- package/dist/client/assets/{sankeyDiagram-5OEKKPKP-CtfCq9EV.js → sankeyDiagram-5OEKKPKP-cs1kWOqp.js} +1 -1
- package/dist/client/assets/{sequenceDiagram-3UESZ5HK-BgLwmDnV.js → sequenceDiagram-3UESZ5HK-D7Bj1Dg6.js} +1 -1
- package/dist/client/assets/sonner-DgKrvTU1.js +1 -0
- package/dist/client/assets/src-DzxfdEt6.js +1 -0
- package/dist/client/assets/state-_2CmL5IM.js +2 -0
- package/dist/client/assets/{stateDiagram-AJRCARHV--lvnWH2s.js → stateDiagram-AJRCARHV-xBL-crbl.js} +1 -1
- package/dist/client/assets/stateDiagram-v2-BHNVJYJU-ZbAyaVmU.js +1 -0
- package/dist/client/assets/terminal-DJ8tjXNh.js +1 -0
- package/dist/client/assets/terminal-Dx10AUUW.js +2 -0
- package/dist/client/assets/{timeline-definition-PNZ67QCA-BbIMEZmJ.js → timeline-definition-PNZ67QCA-Bs3JkoMQ.js} +2 -2
- package/dist/client/assets/triangle-alert-cDPYgb7f.js +1 -0
- package/dist/client/assets/{vennDiagram-CIIHVFJN-ClrNZ6mc.js → vennDiagram-CIIHVFJN-D25dPloy.js} +1 -1
- package/dist/client/assets/{wardleyDiagram-YWT4CUSO-B104yVOC.js → wardleyDiagram-YWT4CUSO-B7X6xZZ7.js} +1 -1
- package/dist/client/assets/{xychartDiagram-2RQKCTM6-BBRSu-ZO.js → xychartDiagram-2RQKCTM6-Cgc-2R8L.js} +1 -1
- package/dist/client/index.html +13 -14
- package/dist/completionchunk-DDfxP5hO.mjs +5196 -0
- package/dist/dist-CsBDFjO2.mjs +1163 -0
- package/dist/{execAsync-BeHTdVKh.mjs → execAsync-B-b5b4hb.mjs} +2 -2
- package/dist/from-DGwFTZmN.mjs +3845 -0
- package/dist/{getMachineId-bsd-8V0SSHI2.mjs → getMachineId-bsd-C-aUDBo5.mjs} +4 -3
- package/dist/{getMachineId-darwin-fwMRmXNE.mjs → getMachineId-darwin-CQg0u9gI.mjs} +4 -3
- package/dist/{getMachineId-linux-BglPdw6k.mjs → getMachineId-linux-DQmpbzHz.mjs} +3 -2
- package/dist/{getMachineId-unsupported-B6r8oWEG.mjs → getMachineId-unsupported-BT4Te_jg.mjs} +3 -2
- package/dist/{getMachineId-win-Bvbq3C3K.mjs → getMachineId-win-zoUdci1a.mjs} +4 -3
- package/dist/github-copilot-headers-B--aVYl2.mjs +39 -0
- package/dist/google-DHtiCcEt.mjs +348 -0
- package/dist/google-shared-BT0mQb3v.mjs +25358 -0
- package/dist/google-vertex-CRkz0MgQ.mjs +391 -0
- package/dist/hash-CDrrQIkY.mjs +17 -0
- package/dist/headers-m19bM8_9.mjs +9 -0
- package/dist/mistral-DXtHhhUc.mjs +36806 -0
- package/dist/multipart-parser-6y-zJbR0.mjs +295 -0
- package/dist/openai-CUH8rb7p.mjs +6671 -0
- package/dist/openai-codex-responses-BSLixEC8.mjs +1081 -0
- package/dist/openai-completions-CE-LDmL4.mjs +735 -0
- package/dist/openai-prompt-cache-6hf3xB_x.mjs +9 -0
- package/dist/openai-responses-41QiypX_.mjs +217 -0
- package/dist/openai-responses-shared-BAoGGIxP.mjs +415 -0
- package/dist/openrouter-CDq1vETJ.mjs +125 -0
- package/dist/otel-ugdFQeJO.mjs +23177 -0
- package/dist/photon_rs-D6BNoOSO.mjs +4253 -0
- package/dist/rolldown-runtime-EQORzF3F.mjs +38 -0
- package/dist/sanitize-unicode-CPcy0g31.mjs +27 -0
- package/dist/server.js +247457 -56643
- package/dist/src-BHoXDvRK.mjs +1178 -0
- package/dist/transform-messages-CUKh2_5w.mjs +188 -0
- package/package.json +4 -3
- package/dist/client/assets/-workbench-terminal-CoufoT41.js +0 -145
- package/dist/client/assets/agent-B0AsYIb3.js +0 -2
- package/dist/client/assets/agent-DCVbbaGs.js +0 -1
- package/dist/client/assets/architectureDiagram-3BPJPVTR-hs4IN-ZW.js +0 -36
- package/dist/client/assets/button-Dz6Az3h_.js +0 -16
- package/dist/client/assets/channel-CHiC1IgU.js +0 -1
- package/dist/client/assets/chunk-QZHKN3VN-SFi3gsXX.js +0 -1
- package/dist/client/assets/chunk-WU5MYG2G-OzrGGim9.js +0 -1
- package/dist/client/assets/classDiagram-4FO5ZUOK-DvZGz7Ek.js +0 -1
- package/dist/client/assets/classDiagram-v2-Q7XG4LA2-DvZGz7Ek.js +0 -1
- package/dist/client/assets/compiler-runtime-rGeCHUuX.js +0 -1
- package/dist/client/assets/cose-bilkent-S5V4N54A-BzitJXTQ.js +0 -1
- package/dist/client/assets/diff-BqnMP7Ys.js +0 -217
- package/dist/client/assets/diff-CLnQZZVT.js +0 -2
- package/dist/client/assets/dist-lRkD-JPF.js +0 -1
- package/dist/client/assets/external-link-DPI4TAq4.js +0 -1
- package/dist/client/assets/fallbacks-uU4M5NOw.js +0 -1
- package/dist/client/assets/ganttDiagram-6RSMTGT7-hA3inn7u.js +0 -292
- package/dist/client/assets/index-DNWcrdqu.css +0 -2
- package/dist/client/assets/input-group-1-P7Y_75.js +0 -153
- package/dist/client/assets/loader-circle-BxillczB.js +0 -1
- package/dist/client/assets/portless-ClPWjTC4.js +0 -1
- package/dist/client/assets/portless-QJD7ZmA9.js +0 -2
- package/dist/client/assets/resizable-BaJ5ba6-.js +0 -1
- package/dist/client/assets/route-C-L2dkin.js +0 -45
- package/dist/client/assets/route-b5JXfzPO.js +0 -2
- package/dist/client/assets/run-C7DiKMnt.js +0 -1
- package/dist/client/assets/run-Dt91HvlA.js +0 -2
- package/dist/client/assets/src-oaGqIoNi.js +0 -1
- package/dist/client/assets/state-CVjPP5QG.js +0 -2
- package/dist/client/assets/stateDiagram-v2-BHNVJYJU-BggoNPhO.js +0 -1
- package/dist/client/assets/terminal-C4sv4xT5.js +0 -2
- package/dist/client/assets/terminal-kxE_eoTZ.js +0 -1
- package/dist/client/assets/triangle-alert-CTEZG9zF.js +0 -1
- /package/dist/client/assets/{chunk-QTnfLwEv.js → rolldown-runtime-QTnfLwEv.js} +0 -0
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env -S node --max-old-space-size=16384 --heapsnapshot-near-heap-limit=3 --report-on-fatalerror
|
|
2
|
-
import { a as __toCommonJS, i as __require,
|
|
3
|
-
import {
|
|
4
|
-
|
|
2
|
+
import { a as __toCommonJS, i as __require, t as __commonJSMin } from "./rolldown-runtime-EQORzF3F.mjs";
|
|
3
|
+
import { Or as esm_exports, kr as init_esm } from "./server.js";
|
|
4
|
+
import { t as require_execAsync } from "./execAsync-B-b5b4hb.mjs";
|
|
5
|
+
//#region ../../node_modules/.pnpm/@opentelemetry+resources@2.8.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/src/detectors/platform/node/machine-id/getMachineId-bsd.js
|
|
5
6
|
var require_getMachineId_bsd = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
6
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
8
|
exports.getMachineId = void 0;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env -S node --max-old-space-size=16384 --heapsnapshot-near-heap-limit=3 --report-on-fatalerror
|
|
2
|
-
import { a as __toCommonJS,
|
|
3
|
-
import {
|
|
4
|
-
|
|
2
|
+
import { a as __toCommonJS, t as __commonJSMin } from "./rolldown-runtime-EQORzF3F.mjs";
|
|
3
|
+
import { Or as esm_exports, kr as init_esm } from "./server.js";
|
|
4
|
+
import { t as require_execAsync } from "./execAsync-B-b5b4hb.mjs";
|
|
5
|
+
//#region ../../node_modules/.pnpm/@opentelemetry+resources@2.8.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/src/detectors/platform/node/machine-id/getMachineId-darwin.js
|
|
5
6
|
var require_getMachineId_darwin = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
6
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
8
|
exports.getMachineId = void 0;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env -S node --max-old-space-size=16384 --heapsnapshot-near-heap-limit=3 --report-on-fatalerror
|
|
2
|
-
import { a as __toCommonJS, i as __require,
|
|
3
|
-
|
|
2
|
+
import { a as __toCommonJS, i as __require, t as __commonJSMin } from "./rolldown-runtime-EQORzF3F.mjs";
|
|
3
|
+
import { Or as esm_exports, kr as init_esm } from "./server.js";
|
|
4
|
+
//#region ../../node_modules/.pnpm/@opentelemetry+resources@2.8.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/src/detectors/platform/node/machine-id/getMachineId-linux.js
|
|
4
5
|
var require_getMachineId_linux = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
5
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
7
|
exports.getMachineId = void 0;
|
package/dist/{getMachineId-unsupported-B6r8oWEG.mjs → getMachineId-unsupported-BT4Te_jg.mjs}
RENAMED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env -S node --max-old-space-size=16384 --heapsnapshot-near-heap-limit=3 --report-on-fatalerror
|
|
2
|
-
import { a as __toCommonJS,
|
|
3
|
-
|
|
2
|
+
import { a as __toCommonJS, t as __commonJSMin } from "./rolldown-runtime-EQORzF3F.mjs";
|
|
3
|
+
import { Or as esm_exports, kr as init_esm } from "./server.js";
|
|
4
|
+
//#region ../../node_modules/.pnpm/@opentelemetry+resources@2.8.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/src/detectors/platform/node/machine-id/getMachineId-unsupported.js
|
|
4
5
|
var require_getMachineId_unsupported = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
5
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
7
|
exports.getMachineId = void 0;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env -S node --max-old-space-size=16384 --heapsnapshot-near-heap-limit=3 --report-on-fatalerror
|
|
2
|
-
import { a as __toCommonJS, i as __require,
|
|
3
|
-
import {
|
|
4
|
-
|
|
2
|
+
import { a as __toCommonJS, i as __require, t as __commonJSMin } from "./rolldown-runtime-EQORzF3F.mjs";
|
|
3
|
+
import { Or as esm_exports, kr as init_esm } from "./server.js";
|
|
4
|
+
import { t as require_execAsync } from "./execAsync-B-b5b4hb.mjs";
|
|
5
|
+
//#region ../../node_modules/.pnpm/@opentelemetry+resources@2.8.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/src/detectors/platform/node/machine-id/getMachineId-win.js
|
|
5
6
|
var require_getMachineId_win = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
6
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
8
|
exports.getMachineId = void 0;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
#!/usr/bin/env -S node --max-old-space-size=16384 --heapsnapshot-near-heap-limit=3 --report-on-fatalerror
|
|
2
|
+
import { Rr as getProviderEnvValue } from "./server.js";
|
|
3
|
+
//#region ../../node_modules/.pnpm/@earendil-works+pi-ai@0.79.8_@modelcontextprotocol+sdk@1.29.0_zod@4.4.3__ws@8.21.0_zod@4.4.3/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare.js
|
|
4
|
+
function isCloudflareProvider(provider) {
|
|
5
|
+
return provider === "cloudflare-workers-ai" || provider === "cloudflare-ai-gateway";
|
|
6
|
+
}
|
|
7
|
+
/** Substitute `{VAR}` placeholders in a Cloudflare baseUrl from provider env or process.env. */
|
|
8
|
+
function resolveCloudflareBaseUrl(model, env) {
|
|
9
|
+
const url = model.baseUrl;
|
|
10
|
+
if (!url.includes("{")) return url;
|
|
11
|
+
return url.replace(/\{([A-Z_][A-Z0-9_]*)\}/g, (_match, name) => {
|
|
12
|
+
const value = getProviderEnvValue(name, env);
|
|
13
|
+
if (!value) throw new Error(`${name} is required for provider ${model.provider} but is not set.`);
|
|
14
|
+
return value;
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
//#region ../../node_modules/.pnpm/@earendil-works+pi-ai@0.79.8_@modelcontextprotocol+sdk@1.29.0_zod@4.4.3__ws@8.21.0_zod@4.4.3/node_modules/@earendil-works/pi-ai/dist/providers/github-copilot-headers.js
|
|
19
|
+
function inferCopilotInitiator(messages) {
|
|
20
|
+
const last = messages[messages.length - 1];
|
|
21
|
+
return last && last.role !== "user" ? "agent" : "user";
|
|
22
|
+
}
|
|
23
|
+
function hasCopilotVisionInput(messages) {
|
|
24
|
+
return messages.some((msg) => {
|
|
25
|
+
if (msg.role === "user" && Array.isArray(msg.content)) return msg.content.some((c) => c.type === "image");
|
|
26
|
+
if (msg.role === "toolResult" && Array.isArray(msg.content)) return msg.content.some((c) => c.type === "image");
|
|
27
|
+
return false;
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
function buildCopilotDynamicHeaders(params) {
|
|
31
|
+
const headers = {
|
|
32
|
+
"X-Initiator": inferCopilotInitiator(params.messages),
|
|
33
|
+
"Openai-Intent": "conversation-edits"
|
|
34
|
+
};
|
|
35
|
+
if (params.hasImages) headers["Copilot-Vision-Request"] = "true";
|
|
36
|
+
return headers;
|
|
37
|
+
}
|
|
38
|
+
//#endregion
|
|
39
|
+
export { resolveCloudflareBaseUrl as i, hasCopilotVisionInput as n, isCloudflareProvider as r, buildCopilotDynamicHeaders as t };
|
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
#!/usr/bin/env -S node --max-old-space-size=16384 --heapsnapshot-near-heap-limit=3 --report-on-fatalerror
|
|
2
|
+
import { Ir as calculateCost, Lr as clampThinkingLevel, Vr as registerApiProvider, zr as AssistantMessageEventStream } from "./server.js";
|
|
3
|
+
import { t as sanitizeSurrogates } from "./sanitize-unicode-CPcy0g31.mjs";
|
|
4
|
+
import { r as buildBaseOptions } from "./transform-messages-CUKh2_5w.mjs";
|
|
5
|
+
import { a as mapToolChoice, i as mapStopReason, n as convertTools, o as retainThoughtSignature, r as isThinkingPart, s as GoogleGenAI, t as convertMessages } from "./google-shared-BT0mQb3v.mjs";
|
|
6
|
+
//#region ../../node_modules/.pnpm/@earendil-works+pi-ai@0.79.8_@modelcontextprotocol+sdk@1.29.0_zod@4.4.3__ws@8.21.0_zod@4.4.3/node_modules/@earendil-works/pi-ai/dist/providers/google.js
|
|
7
|
+
let toolCallCounter = 0;
|
|
8
|
+
const streamGoogle = (model, context, options) => {
|
|
9
|
+
const stream = new AssistantMessageEventStream();
|
|
10
|
+
(async () => {
|
|
11
|
+
const output = {
|
|
12
|
+
role: "assistant",
|
|
13
|
+
content: [],
|
|
14
|
+
api: "google-generative-ai",
|
|
15
|
+
provider: model.provider,
|
|
16
|
+
model: model.id,
|
|
17
|
+
usage: {
|
|
18
|
+
input: 0,
|
|
19
|
+
output: 0,
|
|
20
|
+
cacheRead: 0,
|
|
21
|
+
cacheWrite: 0,
|
|
22
|
+
totalTokens: 0,
|
|
23
|
+
cost: {
|
|
24
|
+
input: 0,
|
|
25
|
+
output: 0,
|
|
26
|
+
cacheRead: 0,
|
|
27
|
+
cacheWrite: 0,
|
|
28
|
+
total: 0
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
stopReason: "stop",
|
|
32
|
+
timestamp: Date.now()
|
|
33
|
+
};
|
|
34
|
+
try {
|
|
35
|
+
const apiKey = options?.apiKey;
|
|
36
|
+
if (!apiKey) throw new Error(`No API key for provider: ${model.provider}`);
|
|
37
|
+
const client = createClient(model, apiKey, options?.headers);
|
|
38
|
+
let params = buildParams(model, context, options);
|
|
39
|
+
const nextParams = await options?.onPayload?.(params, model);
|
|
40
|
+
if (nextParams !== void 0) params = nextParams;
|
|
41
|
+
const googleStream = await client.models.generateContentStream(params);
|
|
42
|
+
stream.push({
|
|
43
|
+
type: "start",
|
|
44
|
+
partial: output
|
|
45
|
+
});
|
|
46
|
+
let currentBlock = null;
|
|
47
|
+
const blocks = output.content;
|
|
48
|
+
const blockIndex = () => blocks.length - 1;
|
|
49
|
+
for await (const chunk of googleStream) {
|
|
50
|
+
output.responseId ||= chunk.responseId;
|
|
51
|
+
const candidate = chunk.candidates?.[0];
|
|
52
|
+
if (candidate?.content?.parts) for (const part of candidate.content.parts) {
|
|
53
|
+
if (part.text !== void 0) {
|
|
54
|
+
const isThinking = isThinkingPart(part);
|
|
55
|
+
if (!currentBlock || isThinking && currentBlock.type !== "thinking" || !isThinking && currentBlock.type !== "text") {
|
|
56
|
+
if (currentBlock) if (currentBlock.type === "text") stream.push({
|
|
57
|
+
type: "text_end",
|
|
58
|
+
contentIndex: blocks.length - 1,
|
|
59
|
+
content: currentBlock.text,
|
|
60
|
+
partial: output
|
|
61
|
+
});
|
|
62
|
+
else stream.push({
|
|
63
|
+
type: "thinking_end",
|
|
64
|
+
contentIndex: blockIndex(),
|
|
65
|
+
content: currentBlock.thinking,
|
|
66
|
+
partial: output
|
|
67
|
+
});
|
|
68
|
+
if (isThinking) {
|
|
69
|
+
currentBlock = {
|
|
70
|
+
type: "thinking",
|
|
71
|
+
thinking: "",
|
|
72
|
+
thinkingSignature: void 0
|
|
73
|
+
};
|
|
74
|
+
output.content.push(currentBlock);
|
|
75
|
+
stream.push({
|
|
76
|
+
type: "thinking_start",
|
|
77
|
+
contentIndex: blockIndex(),
|
|
78
|
+
partial: output
|
|
79
|
+
});
|
|
80
|
+
} else {
|
|
81
|
+
currentBlock = {
|
|
82
|
+
type: "text",
|
|
83
|
+
text: ""
|
|
84
|
+
};
|
|
85
|
+
output.content.push(currentBlock);
|
|
86
|
+
stream.push({
|
|
87
|
+
type: "text_start",
|
|
88
|
+
contentIndex: blockIndex(),
|
|
89
|
+
partial: output
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
if (currentBlock.type === "thinking") {
|
|
94
|
+
currentBlock.thinking += part.text;
|
|
95
|
+
currentBlock.thinkingSignature = retainThoughtSignature(currentBlock.thinkingSignature, part.thoughtSignature);
|
|
96
|
+
stream.push({
|
|
97
|
+
type: "thinking_delta",
|
|
98
|
+
contentIndex: blockIndex(),
|
|
99
|
+
delta: part.text,
|
|
100
|
+
partial: output
|
|
101
|
+
});
|
|
102
|
+
} else {
|
|
103
|
+
currentBlock.text += part.text;
|
|
104
|
+
currentBlock.textSignature = retainThoughtSignature(currentBlock.textSignature, part.thoughtSignature);
|
|
105
|
+
stream.push({
|
|
106
|
+
type: "text_delta",
|
|
107
|
+
contentIndex: blockIndex(),
|
|
108
|
+
delta: part.text,
|
|
109
|
+
partial: output
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
if (part.functionCall) {
|
|
114
|
+
if (currentBlock) {
|
|
115
|
+
if (currentBlock.type === "text") stream.push({
|
|
116
|
+
type: "text_end",
|
|
117
|
+
contentIndex: blockIndex(),
|
|
118
|
+
content: currentBlock.text,
|
|
119
|
+
partial: output
|
|
120
|
+
});
|
|
121
|
+
else stream.push({
|
|
122
|
+
type: "thinking_end",
|
|
123
|
+
contentIndex: blockIndex(),
|
|
124
|
+
content: currentBlock.thinking,
|
|
125
|
+
partial: output
|
|
126
|
+
});
|
|
127
|
+
currentBlock = null;
|
|
128
|
+
}
|
|
129
|
+
const providedId = part.functionCall.id;
|
|
130
|
+
const toolCall = {
|
|
131
|
+
type: "toolCall",
|
|
132
|
+
id: !providedId || output.content.some((b) => b.type === "toolCall" && b.id === providedId) ? `${part.functionCall.name}_${Date.now()}_${++toolCallCounter}` : providedId,
|
|
133
|
+
name: part.functionCall.name || "",
|
|
134
|
+
arguments: part.functionCall.args ?? {},
|
|
135
|
+
...part.thoughtSignature && { thoughtSignature: part.thoughtSignature }
|
|
136
|
+
};
|
|
137
|
+
output.content.push(toolCall);
|
|
138
|
+
stream.push({
|
|
139
|
+
type: "toolcall_start",
|
|
140
|
+
contentIndex: blockIndex(),
|
|
141
|
+
partial: output
|
|
142
|
+
});
|
|
143
|
+
stream.push({
|
|
144
|
+
type: "toolcall_delta",
|
|
145
|
+
contentIndex: blockIndex(),
|
|
146
|
+
delta: JSON.stringify(toolCall.arguments),
|
|
147
|
+
partial: output
|
|
148
|
+
});
|
|
149
|
+
stream.push({
|
|
150
|
+
type: "toolcall_end",
|
|
151
|
+
contentIndex: blockIndex(),
|
|
152
|
+
toolCall,
|
|
153
|
+
partial: output
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
if (candidate?.finishReason) {
|
|
158
|
+
output.stopReason = mapStopReason(candidate.finishReason);
|
|
159
|
+
if (output.content.some((b) => b.type === "toolCall")) output.stopReason = "toolUse";
|
|
160
|
+
}
|
|
161
|
+
if (chunk.usageMetadata) {
|
|
162
|
+
output.usage = {
|
|
163
|
+
input: (chunk.usageMetadata.promptTokenCount || 0) - (chunk.usageMetadata.cachedContentTokenCount || 0),
|
|
164
|
+
output: (chunk.usageMetadata.candidatesTokenCount || 0) + (chunk.usageMetadata.thoughtsTokenCount || 0),
|
|
165
|
+
cacheRead: chunk.usageMetadata.cachedContentTokenCount || 0,
|
|
166
|
+
cacheWrite: 0,
|
|
167
|
+
totalTokens: chunk.usageMetadata.totalTokenCount || 0,
|
|
168
|
+
cost: {
|
|
169
|
+
input: 0,
|
|
170
|
+
output: 0,
|
|
171
|
+
cacheRead: 0,
|
|
172
|
+
cacheWrite: 0,
|
|
173
|
+
total: 0
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
calculateCost(model, output.usage);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
if (currentBlock) if (currentBlock.type === "text") stream.push({
|
|
180
|
+
type: "text_end",
|
|
181
|
+
contentIndex: blockIndex(),
|
|
182
|
+
content: currentBlock.text,
|
|
183
|
+
partial: output
|
|
184
|
+
});
|
|
185
|
+
else stream.push({
|
|
186
|
+
type: "thinking_end",
|
|
187
|
+
contentIndex: blockIndex(),
|
|
188
|
+
content: currentBlock.thinking,
|
|
189
|
+
partial: output
|
|
190
|
+
});
|
|
191
|
+
if (options?.signal?.aborted) throw new Error("Request was aborted");
|
|
192
|
+
if (output.stopReason === "aborted" || output.stopReason === "error") throw new Error("An unknown error occurred");
|
|
193
|
+
stream.push({
|
|
194
|
+
type: "done",
|
|
195
|
+
reason: output.stopReason,
|
|
196
|
+
message: output
|
|
197
|
+
});
|
|
198
|
+
stream.end();
|
|
199
|
+
} catch (error) {
|
|
200
|
+
for (const block of output.content) if ("index" in block) delete block.index;
|
|
201
|
+
output.stopReason = options?.signal?.aborted ? "aborted" : "error";
|
|
202
|
+
output.errorMessage = error instanceof Error ? error.message : JSON.stringify(error);
|
|
203
|
+
stream.push({
|
|
204
|
+
type: "error",
|
|
205
|
+
reason: output.stopReason,
|
|
206
|
+
error: output
|
|
207
|
+
});
|
|
208
|
+
stream.end();
|
|
209
|
+
}
|
|
210
|
+
})();
|
|
211
|
+
return stream;
|
|
212
|
+
};
|
|
213
|
+
const streamSimpleGoogle = (model, context, options) => {
|
|
214
|
+
const apiKey = options?.apiKey;
|
|
215
|
+
if (!apiKey) throw new Error(`No API key for provider: ${model.provider}`);
|
|
216
|
+
const base = buildBaseOptions(model, options, apiKey);
|
|
217
|
+
if (!options?.reasoning) return streamGoogle(model, context, {
|
|
218
|
+
...base,
|
|
219
|
+
thinking: { enabled: false }
|
|
220
|
+
});
|
|
221
|
+
const clampedReasoning = clampThinkingLevel(model, options.reasoning);
|
|
222
|
+
const effort = clampedReasoning === "off" ? "high" : clampedReasoning;
|
|
223
|
+
const googleModel = model;
|
|
224
|
+
if (isGemini3ProModel(googleModel) || isGemini3FlashModel(googleModel) || isGemma4Model(googleModel)) return streamGoogle(model, context, {
|
|
225
|
+
...base,
|
|
226
|
+
thinking: {
|
|
227
|
+
enabled: true,
|
|
228
|
+
level: getThinkingLevel(effort, googleModel)
|
|
229
|
+
}
|
|
230
|
+
});
|
|
231
|
+
return streamGoogle(model, context, {
|
|
232
|
+
...base,
|
|
233
|
+
thinking: {
|
|
234
|
+
enabled: true,
|
|
235
|
+
budgetTokens: getGoogleBudget(googleModel, effort, options.thinkingBudgets)
|
|
236
|
+
}
|
|
237
|
+
});
|
|
238
|
+
};
|
|
239
|
+
function register() {
|
|
240
|
+
registerApiProvider({
|
|
241
|
+
api: "google-generative-ai",
|
|
242
|
+
stream: streamGoogle,
|
|
243
|
+
streamSimple: streamSimpleGoogle
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
function createClient(model, apiKey, optionsHeaders) {
|
|
247
|
+
const httpOptions = {};
|
|
248
|
+
if (model.baseUrl) {
|
|
249
|
+
httpOptions.baseUrl = model.baseUrl;
|
|
250
|
+
httpOptions.apiVersion = "";
|
|
251
|
+
}
|
|
252
|
+
if (model.headers || optionsHeaders) httpOptions.headers = {
|
|
253
|
+
...model.headers,
|
|
254
|
+
...optionsHeaders
|
|
255
|
+
};
|
|
256
|
+
return new GoogleGenAI({
|
|
257
|
+
apiKey,
|
|
258
|
+
httpOptions: Object.keys(httpOptions).length > 0 ? httpOptions : void 0
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
function buildParams(model, context, options = {}) {
|
|
262
|
+
const contents = convertMessages(model, context);
|
|
263
|
+
const generationConfig = {};
|
|
264
|
+
if (options.temperature !== void 0) generationConfig.temperature = options.temperature;
|
|
265
|
+
if (options.maxTokens !== void 0) generationConfig.maxOutputTokens = options.maxTokens;
|
|
266
|
+
const config = {
|
|
267
|
+
...Object.keys(generationConfig).length > 0 && generationConfig,
|
|
268
|
+
...context.systemPrompt && { systemInstruction: sanitizeSurrogates(context.systemPrompt) },
|
|
269
|
+
...context.tools && context.tools.length > 0 && { tools: convertTools(context.tools) }
|
|
270
|
+
};
|
|
271
|
+
if (context.tools && context.tools.length > 0 && options.toolChoice) config.toolConfig = { functionCallingConfig: { mode: mapToolChoice(options.toolChoice) } };
|
|
272
|
+
else config.toolConfig = void 0;
|
|
273
|
+
if (options.thinking?.enabled && model.reasoning) {
|
|
274
|
+
const thinkingConfig = { includeThoughts: true };
|
|
275
|
+
if (options.thinking.level !== void 0) thinkingConfig.thinkingLevel = options.thinking.level;
|
|
276
|
+
else if (options.thinking.budgetTokens !== void 0) thinkingConfig.thinkingBudget = options.thinking.budgetTokens;
|
|
277
|
+
config.thinkingConfig = thinkingConfig;
|
|
278
|
+
} else if (model.reasoning && options.thinking && !options.thinking.enabled) config.thinkingConfig = getDisabledThinkingConfig(model);
|
|
279
|
+
if (options.signal) {
|
|
280
|
+
if (options.signal.aborted) throw new Error("Request aborted");
|
|
281
|
+
config.abortSignal = options.signal;
|
|
282
|
+
}
|
|
283
|
+
return {
|
|
284
|
+
model: model.id,
|
|
285
|
+
contents,
|
|
286
|
+
config
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
function isGemma4Model(model) {
|
|
290
|
+
return /gemma-?4/.test(model.id.toLowerCase());
|
|
291
|
+
}
|
|
292
|
+
function isGemini3ProModel(model) {
|
|
293
|
+
return /gemini-3(?:\.\d+)?-pro/.test(model.id.toLowerCase());
|
|
294
|
+
}
|
|
295
|
+
function isGemini3FlashModel(model) {
|
|
296
|
+
const id = model.id.toLowerCase();
|
|
297
|
+
return /gemini-3(?:\.\d+)?-flash/.test(id) || id === "gemini-flash-latest" || id === "gemini-flash-lite-latest";
|
|
298
|
+
}
|
|
299
|
+
function getDisabledThinkingConfig(model) {
|
|
300
|
+
if (isGemini3ProModel(model)) return { thinkingLevel: "LOW" };
|
|
301
|
+
if (isGemini3FlashModel(model)) return { thinkingLevel: "MINIMAL" };
|
|
302
|
+
if (isGemma4Model(model)) return { thinkingLevel: "MINIMAL" };
|
|
303
|
+
return { thinkingBudget: 0 };
|
|
304
|
+
}
|
|
305
|
+
function getThinkingLevel(effort, model) {
|
|
306
|
+
if (isGemini3ProModel(model)) switch (effort) {
|
|
307
|
+
case "minimal":
|
|
308
|
+
case "low": return "LOW";
|
|
309
|
+
case "medium":
|
|
310
|
+
case "high": return "HIGH";
|
|
311
|
+
}
|
|
312
|
+
if (isGemma4Model(model)) switch (effort) {
|
|
313
|
+
case "minimal":
|
|
314
|
+
case "low": return "MINIMAL";
|
|
315
|
+
case "medium":
|
|
316
|
+
case "high": return "HIGH";
|
|
317
|
+
}
|
|
318
|
+
switch (effort) {
|
|
319
|
+
case "minimal": return "MINIMAL";
|
|
320
|
+
case "low": return "LOW";
|
|
321
|
+
case "medium": return "MEDIUM";
|
|
322
|
+
case "high": return "HIGH";
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
function getGoogleBudget(model, effort, customBudgets) {
|
|
326
|
+
if (customBudgets?.[effort] !== void 0) return customBudgets[effort];
|
|
327
|
+
if (model.id.includes("2.5-pro")) return {
|
|
328
|
+
minimal: 128,
|
|
329
|
+
low: 2048,
|
|
330
|
+
medium: 8192,
|
|
331
|
+
high: 32768
|
|
332
|
+
}[effort];
|
|
333
|
+
if (model.id.includes("2.5-flash-lite")) return {
|
|
334
|
+
minimal: 512,
|
|
335
|
+
low: 2048,
|
|
336
|
+
medium: 8192,
|
|
337
|
+
high: 24576
|
|
338
|
+
}[effort];
|
|
339
|
+
if (model.id.includes("2.5-flash")) return {
|
|
340
|
+
minimal: 128,
|
|
341
|
+
low: 2048,
|
|
342
|
+
medium: 8192,
|
|
343
|
+
high: 24576
|
|
344
|
+
}[effort];
|
|
345
|
+
return -1;
|
|
346
|
+
}
|
|
347
|
+
//#endregion
|
|
348
|
+
export { register, streamGoogle, streamSimpleGoogle };
|