@code-yeongyu/senpi 2026.10.19-2 → 2026.10.20-1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/bundle/chunks/{anthropic-messages-VVRTT7O5.js → anthropic-messages-3QYMAEH2.js} +1 -1
  3. package/dist/bundle/chunks/{args-35XTBPC7.js → args-NHDT5JG3.js} +1 -1
  4. package/dist/bundle/chunks/{azure-openai-responses-BUSMTCQ5.js → azure-openai-responses-2DCY6QKO.js} +1 -1
  5. package/dist/bundle/chunks/chunk-2JGY3V4H.js +395 -0
  6. package/dist/bundle/chunks/{chunk-2RLZXLXS.js → chunk-2LQZJFKQ.js} +1 -1
  7. package/dist/bundle/chunks/{chunk-2IK7QUJX.js → chunk-2SM4TR4H.js} +1 -1
  8. package/dist/bundle/chunks/{chunk-DXOSXUVI.js → chunk-3YKKXTJM.js} +1 -1
  9. package/dist/bundle/chunks/chunk-6L3H4UVN.js +2 -0
  10. package/dist/bundle/chunks/{chunk-46NW3UKO.js → chunk-7R4CJDWT.js} +1 -1
  11. package/dist/bundle/chunks/chunk-AA2L2RHH.js +2 -0
  12. package/dist/bundle/chunks/chunk-DKBJM22C.js +5 -0
  13. package/dist/bundle/chunks/{chunk-Z32CYNHC.js → chunk-F4YDU66P.js} +1 -1
  14. package/dist/bundle/chunks/chunk-FC2YWHEC.js +6 -0
  15. package/dist/bundle/chunks/{chunk-T2EE5G4S.js → chunk-FRFGJC3I.js} +1 -1
  16. package/dist/bundle/chunks/{chunk-57RKQONO.js → chunk-GBAS4FFM.js} +1 -1
  17. package/dist/bundle/chunks/{chunk-FDCYQYBP.js → chunk-JVLIKUBL.js} +1 -1
  18. package/dist/bundle/chunks/{chunk-EKDY4H2J.js → chunk-JXCHRJA7.js} +1 -1
  19. package/dist/bundle/chunks/{chunk-YID5W42N.js → chunk-KXTWMPCP.js} +1 -1
  20. package/dist/bundle/chunks/{chunk-ADNKYKU4.js → chunk-RYQ2FFF5.js} +1 -1
  21. package/dist/bundle/chunks/chunk-SOMFLLPD.js +3 -0
  22. package/dist/bundle/chunks/{chunk-4CJJ4SK6.js → chunk-SOWFP3I7.js} +1 -1
  23. package/dist/bundle/chunks/{chunk-GX7MTG25.js → chunk-TK6RKAB4.js} +4 -4
  24. package/dist/bundle/chunks/{chunk-NN44F5QF.js → chunk-V6RY5A6T.js} +1 -1
  25. package/dist/bundle/chunks/{chunk-77PVTNLJ.js → chunk-W557SQYL.js} +2 -2
  26. package/dist/bundle/chunks/{chunk-F4ZU4RBE.js → chunk-YIRQJCPA.js} +45 -46
  27. package/dist/bundle/chunks/cli-main-JCQTFUHO.js +3 -0
  28. package/dist/bundle/chunks/cloudflare-workers-ai-system-one-4QEQ7MGK.js +1 -1
  29. package/dist/bundle/chunks/{dispatch-R37L3FW5.js → dispatch-YPCDRQYI.js} +1 -1
  30. package/dist/bundle/chunks/{google-generative-ai-4UOGH7RT.js → google-generative-ai-3SKUSCIL.js} +1 -1
  31. package/dist/bundle/chunks/{google-vertex-2A6KZ5TX.js → google-vertex-YHSIIE4G.js} +1 -1
  32. package/dist/bundle/chunks/{help-fast-path-Z5JGXNCS.js → help-fast-path-TUCMQOOF.js} +1 -1
  33. package/dist/bundle/chunks/{host-command-IP3QAZYI.js → host-command-WEOS6VD6.js} +1 -1
  34. package/dist/bundle/chunks/{host-lifecycle-FRQK5GAC.js → host-lifecycle-ZDCO62Z4.js} +1 -1
  35. package/dist/bundle/chunks/host-lifecycle.js +6 -6
  36. package/dist/bundle/chunks/host-session-command-IGTNZ4F6.js +20 -0
  37. package/dist/bundle/chunks/interactive-mode-5KYT7LMW.js +2 -0
  38. package/dist/bundle/chunks/{multi-session-host-EMI54PTJ.js → multi-session-host-25XQFXJC.js} +5 -5
  39. package/dist/bundle/chunks/openai-codex-responses-4BIPACKV.js +10 -0
  40. package/dist/bundle/chunks/{openai-completions-AGTH2RRA.js → openai-completions-NHDMDAS7.js} +1 -1
  41. package/dist/bundle/chunks/{openai-images-5UGZHY27.js → openai-images-PNXQDBSP.js} +1 -1
  42. package/dist/bundle/chunks/{openai-responses-KGXDGHPI.js → openai-responses-2UOPEJLP.js} +1 -1
  43. package/dist/bundle/chunks/{package-manager-cli-TK44VHGK.js → package-manager-cli-CF53LR5X.js} +1 -1
  44. package/dist/bundle/chunks/{role-F6IEUF2N.js → role-OK7RKBGF.js} +1 -1
  45. package/dist/bundle/chunks/{rotation-stream-XX2NXYL3.js → rotation-stream-QRRJ7G5Y.js} +1 -1
  46. package/dist/bundle/chunks/rpc-mode-LOODTK3J.js +2 -0
  47. package/dist/bundle/chunks/{schedule-command-DYHRFIX2.js → schedule-command-LKL6DLOT.js} +1 -1
  48. package/dist/bundle/chunks/session-control-endpoint-MLANJVB2.js +3 -0
  49. package/dist/bundle/chunks/session-picker-RQDVWJRL.js +2 -0
  50. package/dist/bundle/chunks/session-worker.js +240 -240
  51. package/dist/bundle/chunks/session-write-fence-66EMOO4Y.js +2 -0
  52. package/dist/bundle/chunks/typesafe-system-one-W2ZTYF7X.js +1 -1
  53. package/dist/bundle/cli.js +2 -2
  54. package/dist/bundle/host-supervisor.js +6 -6
  55. package/dist/bundle/index.js +1 -1
  56. package/dist/bundle/rpc-entry.js +1 -1
  57. package/dist/bundle/runtime-manifest.json +1 -1
  58. package/dist/core/agent-session.d.ts +0 -2
  59. package/dist/core/agent-session.js +4 -13
  60. package/dist/core/credential-pool/classify.d.ts +7 -0
  61. package/dist/core/credential-pool/classify.js +12 -4
  62. package/dist/core/credential-pool/failover.js +16 -1
  63. package/dist/core/credential-pool/rotation-stream.js +2 -0
  64. package/dist/core/extensions/builtin/anthropic-subscription/auth-lane.js +8 -62
  65. package/dist/core/extensions/builtin/anthropic-subscription/context-window.d.ts +25 -0
  66. package/dist/core/extensions/builtin/anthropic-subscription/context-window.js +38 -0
  67. package/dist/core/extensions/builtin/anthropic-subscription/index.d.ts +2 -2
  68. package/dist/core/extensions/builtin/anthropic-subscription/index.js +4 -6
  69. package/dist/core/extensions/builtin/anthropic-subscription/long-context-retry.d.ts +18 -0
  70. package/dist/core/extensions/builtin/anthropic-subscription/long-context-retry.js +74 -0
  71. package/dist/core/extensions/builtin/anthropic-subscription/long-context.js +13 -5
  72. package/dist/core/extensions/builtin/anthropic-subscription/options.d.ts +0 -10
  73. package/dist/core/extensions/builtin/anthropic-subscription/options.js +8 -16
  74. package/dist/core/extensions/builtin/anthropic-subscription/session-registry-wiring.js +1 -1
  75. package/dist/core/extensions/builtin/anthropic-subscription/session-sync.js +3 -0
  76. package/dist/core/extensions/builtin/terminal/lease-file.d.ts +1 -0
  77. package/dist/core/extensions/builtin/terminal/lease-file.js +5 -3
  78. package/dist/core/foreign-session-holders.d.ts +2 -3
  79. package/dist/core/provider-failure.d.ts +2 -0
  80. package/dist/core/provider-failure.js +3 -0
  81. package/dist/core/reserved-keywords.js +1 -1
  82. package/dist/core/session-hold-errors.d.ts +2 -0
  83. package/dist/core/session-holder-records.d.ts +21 -0
  84. package/dist/core/session-holder-records.js +76 -0
  85. package/dist/core/session-holders.d.ts +3 -3
  86. package/dist/core/session-holders.js +4 -41
  87. package/dist/core/session-manager.d.ts +1 -0
  88. package/dist/core/session-manager.js +8 -1
  89. package/dist/core/session-write-fence.d.ts +18 -0
  90. package/dist/core/session-write-fence.js +71 -0
  91. package/dist/core/user-text-blocks.d.ts +11 -0
  92. package/dist/core/user-text-blocks.js +19 -1
  93. package/dist/modes/rpc/host-daemon-registration.js +2 -1
  94. package/dist/modes/rpc/host-generations.d.ts +6 -0
  95. package/dist/modes/rpc/host-generations.js +35 -4
  96. package/dist/modes/rpc/host-lifecycle-scratch.d.ts +9 -2
  97. package/dist/modes/rpc/host-lifecycle-scratch.js +26 -6
  98. package/dist/modes/rpc/host-lifecycle.js +1 -1
  99. package/dist/modes/rpc/host-reservations.d.ts +5 -0
  100. package/dist/modes/rpc/host-reservations.js +54 -12
  101. package/dist/modes/rpc/host-stalled-evidence.d.ts +27 -1
  102. package/dist/modes/rpc/host-stalled-evidence.js +52 -4
  103. package/dist/modes/rpc/multi-session-host.js +10 -1
  104. package/dist/modes/rpc/session-command-router.js +2 -0
  105. package/dist/modes/rpc/session-held.js +2 -0
  106. package/package.json +6 -6
  107. package/dist/bundle/chunks/chunk-74V6LCWU.js +0 -2
  108. package/dist/bundle/chunks/chunk-DDQJSVIZ.js +0 -5
  109. package/dist/bundle/chunks/chunk-DY2EM44T.js +0 -395
  110. package/dist/bundle/chunks/chunk-HOXW5IHD.js +0 -6
  111. package/dist/bundle/chunks/chunk-UAQW2T7G.js +0 -2
  112. package/dist/bundle/chunks/cli-main-RXZVFXK7.js +0 -3
  113. package/dist/bundle/chunks/host-session-command-KGCQPMES.js +0 -20
  114. package/dist/bundle/chunks/interactive-mode-DQOPIZSI.js +0 -2
  115. package/dist/bundle/chunks/openai-codex-responses-I2NSK6AD.js +0 -10
  116. package/dist/bundle/chunks/rpc-mode-X6J3FC3N.js +0 -2
  117. package/dist/bundle/chunks/session-control-endpoint-XN4BAZTU.js +0 -3
  118. package/dist/bundle/chunks/session-picker-US5YPKC7.js +0 -2
  119. /package/dist/bundle/chunks/{chunk-KW6654UH.js → chunk-RPAHOJ6F.js} +0 -0
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url); { const __piWorkerThreads = require("node:worker_threads"); if (typeof __piWorkerThreads.markAsUncloneable !== "function") { __piWorkerThreads.markAsUncloneable = () => {}; } }
3
+ import{enableStartupCompileCache}from"./chunk-GBAS4FFM.js";import"./chunk-7R4CJDWT.js";import{installStaleExtensionContainment,main}from"./chunk-YIRQJCPA.js";import"./chunk-JVLIKUBL.js";import"./chunk-FC2YWHEC.js";import{configureHttpDispatcher}from"./chunk-2LQZJFKQ.js";import"./chunk-25FRFTSP.js";import"./chunk-EFJKVUID.js";import"./chunk-2JGY3V4H.js";import"./chunk-MF57DS3V.js";import"./chunk-FRFGJC3I.js";import"./chunk-TK6RKAB4.js";import"./chunk-ZMS6YEAO.js";import"./chunk-RPAHOJ6F.js";import"./chunk-SR7DBNWN.js";import"./chunk-2MOGCBPT.js";import"./chunk-HMK6F3RG.js";import"./chunk-6L3H4UVN.js";import"./chunk-QZBH7PDO.js";import"./chunk-SOMFLLPD.js";import"./chunk-MTQQ2VQH.js";import"./chunk-F4YDU66P.js";import"./chunk-KXTWMPCP.js";import"./chunk-QMRJYMNH.js";import"./chunk-6IWSMXBA.js";import"./chunk-FM7NDZR5.js";import"./chunk-EPQK674G.js";import"./chunk-26UBFF6N.js";import"./chunk-IBDADH5Z.js";import"./chunk-3474DPZK.js";import"./chunk-W557SQYL.js";import"./chunk-DKBJM22C.js";import"./chunk-KUZPBZUK.js";import"./chunk-IQWPR35S.js";import"./chunk-H4QOEVS5.js";import"./chunk-KLAX467B.js";import"./chunk-HB35RBP4.js";import"./chunk-QXJVKVA2.js";import"./chunk-7X72IACK.js";import"./chunk-GZVCRV7I.js";import"./chunk-KUPQO7MC.js";import"./chunk-U3VOXCGP.js";import"./chunk-QXREUA5F.js";import"./chunk-RUGYFYH7.js";import"./chunk-OEFCY46F.js";import"./chunk-KRNXUTZJ.js";import"./chunk-TAV6QZFM.js";import"./chunk-PELNNWGO.js";import"./chunk-SOWFP3I7.js";import"./chunk-JKNUKBS3.js";import"./chunk-JXCHRJA7.js";import"./chunk-YU4AYH4C.js";import"./chunk-2SM4TR4H.js";import"./chunk-COH5F7QV.js";import"./chunk-RFB5CBW7.js";import"./chunk-2VZJTDUX.js";import"./chunk-XSRM367N.js";import"./chunk-WASCMT6Y.js";import"./chunk-T36LJ6MW.js";import"./chunk-QGJLZ6BI.js";import"./chunk-WHPDEDCC.js";import"./chunk-AA2L2RHH.js";import"./chunk-HK46JMSC.js";import"./chunk-WQLMQGOW.js";import"./chunk-WDTJ6JKE.js";import"./chunk-5ROMKDLK.js";import"./chunk-3W47LTXQ.js";import"./chunk-LAWS3FYQ.js";import"./chunk-45SZOLCU.js";import"./chunk-DMI55M2N.js";import"./chunk-PJ34QVL5.js";import"./chunk-BMX2U22F.js";import"./chunk-YU2P3CAR.js";import{installEarlyInspectorVmImportRecovery}from"./chunk-RYQ2FFF5.js";import"./chunk-ZOFZRJSL.js";import"./chunk-2SOVDETB.js";import"./chunk-RAIZG6HA.js";import"./chunk-HRPMLI7O.js";import"./chunk-QEQG42HL.js";import{APP_NAME,scrubBrandFromEnvironment}from"./chunk-4J4ABCCL.js";import"./chunk-ATQFN5HI.js";import"./chunk-MIENF2YK.js";import"./chunk-OXNWERO4.js";import"./chunk-QN2BHP3M.js";import"./chunk-WIAXG52U.js";import"./chunk-7ASLQ243.js";import"./chunk-IKOFCODM.js";await enableStartupCompileCache();installEarlyInspectorVmImportRecovery();installStaleExtensionContainment();process.title=APP_NAME;scrubBrandFromEnvironment();process.env.PI_CODING_AGENT="true";process.emitWarning=(()=>{});configureHttpDispatcher();await main(process.argv.slice(2));
@@ -1,2 +1,2 @@
1
1
  import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url); { const __piWorkerThreads = require("node:worker_threads"); if (typeof __piWorkerThreads.markAsUncloneable !== "function") { __piWorkerThreads.markAsUncloneable = () => {}; } }
2
- import{classifySystemOne,isRecord}from"./chunk-25B6JQC4.js";import"./chunk-EDOW5W5H.js";import"./chunk-TAV6QZFM.js";import"./chunk-PELNNWGO.js";import"./chunk-45SZOLCU.js";import"./chunk-LAWS3FYQ.js";import"./chunk-DMI55M2N.js";import"./chunk-PJ34QVL5.js";import"./chunk-IKOFCODM.js";var LABEL="Cloudflare Workers AI";function cloudflareErrorMessage(errors){if(Array.isArray(errors)){let messages=errors.map(error=>isRecord(error)&&typeof error.message=="string"?error.message:void 0).filter(message=>message!==void 0);if(messages.length>0)return`${LABEL} error: ${messages.join("; ")}`}return`${LABEL} request failed`}var transport={api:"cloudflare-workers-ai-system-one",label:LABEL,url:model=>new URL("run",`${model.baseUrl.replace(/\/+$/u,"")}/`),payload:(model,request)=>({model:model.id,input:request}),output:body=>{if(!isRecord(body))throw new Error(`${LABEL} returned an unexpected response`);if(body.success===!1)throw new Error(cloudflareErrorMessage(body.errors));let run=body.result;if(!isRecord(run))throw new Error(`${LABEL} returned an unexpected response`);if(run.state!=="Completed")throw new Error(`${LABEL} run did not complete (state: ${String(run.state)})`);if(!isRecord(run.result))throw new Error(`${LABEL} returned an unexpected response`);return run.result}},classify=(model,context,options)=>classifySystemOne(transport,model,context,options);export{classify};
2
+ import{classifySystemOne,isRecord}from"./chunk-25B6JQC4.js";import"./chunk-EDOW5W5H.js";import"./chunk-TAV6QZFM.js";import"./chunk-PELNNWGO.js";import"./chunk-LAWS3FYQ.js";import"./chunk-45SZOLCU.js";import"./chunk-DMI55M2N.js";import"./chunk-PJ34QVL5.js";import"./chunk-IKOFCODM.js";var LABEL="Cloudflare Workers AI";function cloudflareErrorMessage(errors){if(Array.isArray(errors)){let messages=errors.map(error=>isRecord(error)&&typeof error.message=="string"?error.message:void 0).filter(message=>message!==void 0);if(messages.length>0)return`${LABEL} error: ${messages.join("; ")}`}return`${LABEL} request failed`}var transport={api:"cloudflare-workers-ai-system-one",label:LABEL,url:model=>new URL("run",`${model.baseUrl.replace(/\/+$/u,"")}/`),payload:(model,request)=>({model:model.id,input:request}),output:body=>{if(!isRecord(body))throw new Error(`${LABEL} returned an unexpected response`);if(body.success===!1)throw new Error(cloudflareErrorMessage(body.errors));let run=body.result;if(!isRecord(run))throw new Error(`${LABEL} returned an unexpected response`);if(run.state!=="Completed")throw new Error(`${LABEL} run did not complete (state: ${String(run.state)})`);if(!isRecord(run.result))throw new Error(`${LABEL} returned an unexpected response`);return run.result}},classify=(model,context,options)=>classifySystemOne(transport,model,context,options);export{classify};
@@ -1,5 +1,5 @@
1
1
  import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url); { const __piWorkerThreads = require("node:worker_threads"); if (typeof __piWorkerThreads.markAsUncloneable !== "function") { __piWorkerThreads.markAsUncloneable = () => {}; } }
2
- import{fetchWithinOrigin}from"./chunk-YP72RYUP.js";import{InitializeResultSchema,JSONRPCMessageSchema,LATEST_PROTOCOL_VERSION}from"./chunk-HPCS4HM4.js";import{ConnectError,createMcpLogger,isMcpNeedsAuthError,loadMcpSdkAuth,loadMcpSdkClient,loadMcpSdkStdioTransport,loadMcpSdkStreamableHttpTransport,loadMcpSdkTypes,reapProcessTree,safeOn,safeTimer}from"./chunk-KW6654UH.js";import{external_exports}from"./chunk-KUPQO7MC.js";import"./chunk-4J4ABCCL.js";import"./chunk-ATQFN5HI.js";import"./chunk-IKOFCODM.js";var MCP_CLIENT_ELICITATION_CAPABILITY={elicitation:{}},MCP_ELICITATION_TIMEOUT_MS=300*1e3,legacyUiProvider;async function configureMcpElicitation(client,owner=legacyUiProvider,timeoutMs=MCP_ELICITATION_TIMEOUT_MS){let{ElicitRequestSchema}=await loadMcpSdkTypes();client.setRequestHandler(ElicitRequestSchema,async request2=>{let params=request2.params;if(!("requestedSchema"in params))return{action:"decline"};let ui=typeof owner=="function"?owner():owner?.getMcpElicitationUi();return ui===void 0?{action:"decline"}:await runElicitationForm(ui,params.message,params.requestedSchema,timeoutMs)})}async function runElicitationForm(ui,message,requestedSchema,timeoutMs=MCP_ELICITATION_TIMEOUT_MS){let timer,timeout=new Promise(resolve=>{timer=safeTimer("mcp.elicitation.timeout",timeoutMs,()=>resolve({action:"cancel"}),{logger:createMcpLogger("elicitation")})});try{return await Promise.race([collectForm(ui,message,requestedSchema),timeout])}finally{timer!==void 0&&clearTimeout(timer)}}async function collectForm(ui,message,requestedSchema){let content={},required=new Set(requestedSchema.required??[]);for(let[name,property]of Object.entries(requestedSchema.properties??{})){let title=`${message} \u2014 ${property.title??name}`;if(property.type==="boolean"){content[name]=await ui.confirm(title,property.description??name);continue}if(Array.isArray(property.enum)&&property.enum.length>0){let picked=await ui.select(title,property.enum.map(String));if(picked===void 0)return{action:"decline"};content[name]=picked;continue}let answer=await ui.input(title,property.description);if(answer===void 0||answer.length===0){if(required.has(name))return{action:"decline"};continue}if(property.type==="number"||property.type==="integer"){let parsed=Number(answer);if(!Number.isFinite(parsed))return{action:"decline"};content[name]=parsed;continue}content[name]=answer}return{action:"accept",content}}async function materializeMcpTransport(options){let client=await buildMcpClient(options.elicitationUiProvider);return options.spec.kind==="stdio"?materializeStdio(options.spec,options,client):materializeHttp(options.spec,client)}async function materializeStdio(spec,options,client){let{getDefaultEnvironment,StdioClientTransport}=await loadMcpSdkStdioTransport(),transport=new StdioClientTransport({args:spec.args,command:spec.command,cwd:spec.cwd,env:{...getDefaultEnvironment(),...spec.env,...oauthAccessTokenEnv(spec.authProvider)},stderr:"pipe"});return trackStdioStart(transport,options.onStart),pipeStderr(transport,options.logger,options.sink),dropNullNextCursor(transport),{client,close:()=>closeClientAndTransport(transport,client),readPid:()=>transport.pid,transport}}async function materializeHttp(spec,client){let{StreamableHTTPClientTransport}=await loadMcpSdkStreamableHttpTransport(),transport=new StreamableHTTPClientTransport(spec.url,{authProvider:spec.authProvider,requestInit:spec.requestInit});return dropNullNextCursor(transport),{client,close:()=>closeClientAndTransport(transport,client),readPid:()=>null,transport}}async function buildMcpClient(elicitationUiProvider){let{Client:McpClient}=await loadMcpSdkClient(),client=new McpClient({name:"senpi-mcp-client",version:"0.0.0"},{capabilities:MCP_CLIENT_ELICITATION_CAPABILITY});return await configureMcpElicitation(client,elicitationUiProvider),client}function oauthAccessTokenEnv(authProvider){let accessToken=authProvider?.tokens()?.access_token;return accessToken===void 0||accessToken.length===0?{}:{OAUTH_ACCESS_TOKEN:accessToken}}function dropNullNextCursor(transport){let originalStart=transport.start.bind(transport);transport.start=async()=>{let deliver=transport.onmessage;deliver!==void 0&&(transport.onmessage=(message,extra)=>{if("result"in message&&message.result!==null&&typeof message.result=="object"){let result=message.result;result.nextCursor===null&&delete result.nextCursor}deliver(message,extra)}),await originalStart()}}function trackStdioStart(transport,onStart){let start=transport.start.bind(transport);transport.start=async()=>{await start(),onStart()}}function pipeStderr(transport,logger,sink){let pending="",stderr=transport.stderr;stderr!=null&&(safeOn(stderr,"data","transport.stderr.data",chunk=>{if(!Buffer.isBuffer(chunk)&&typeof chunk!="string")return;pending+=Buffer.isBuffer(chunk)?chunk.toString("utf8"):chunk;let lines=pending.split(/\r?\n/);pending=lines.pop()??"";for(let line of lines)line.length>0&&logger.stderr(line)},sink),safeOn(stderr,"end","transport.stderr.end",()=>{pending.length>0&&logger.stderr(pending),pending=""},sink))}async function closeClientAndTransport(transport,client){isTerminableHttpTransport(transport)&&await transport.terminateSession().catch(()=>{}),await transport.close().catch(()=>{}),await client.close().catch(()=>{})}function isTerminableHttpTransport(transport){return"terminateSession"in transport&&typeof transport.terminateSession=="function"}import{Buffer as Buffer2}from"node:buffer";var MODERN_PROTOCOL_VERSION="2026-07-28",MODERN_ERROR_CODES={HeaderMismatch:-32020,MissingRequiredClientCapabilityError:-32021,UnsupportedProtocolVersionError:-32022};function buildModernRequest(id,method,clientInfo2,clientCapabilities,params={}){return{jsonrpc:"2.0",id,method,params:{...params,_meta:{...params._meta,"io.modelcontextprotocol/protocolVersion":MODERN_PROTOCOL_VERSION,"io.modelcontextprotocol/clientInfo":clientInfo2,"io.modelcontextprotocol/clientCapabilities":clientCapabilities}}}}function modernizeRequest(id,method,clientInfo2,clientCapabilities,version,params){let built=buildModernRequest(id,method,clientInfo2,clientCapabilities,params);return{...built,params:{...built.params,_meta:{...built.params._meta,"io.modelcontextprotocol/protocolVersion":version}}}}function deriveModernHeaders(request2){let headers={"MCP-Protocol-Version":request2.params._meta["io.modelcontextprotocol/protocolVersion"],"Mcp-Method":request2.method},name=request2.method==="resources/read"?request2.params.uri:request2.method==="tools/call"||request2.method==="prompts/get"?request2.params.name:void 0;return typeof name=="string"&&(headers["Mcp-Name"]=/^[\x20-\x7E]*$/.test(name)&&!name.startsWith("base64:")?name:`base64:${Buffer2.from(name,"utf8").toString("base64url")}`),headers}function classifyModernError(body2){let response=parseBody(body2);if(!isRecord(response)||response.jsonrpc!=="2.0"||!isRecord(response.error))return;let error=response.error;if(typeof error.message!="string")return;let common={message:error.message,..."data"in error?{data:error.data}:{}};switch(error.code){case MODERN_ERROR_CODES.HeaderMismatch:return{...common,kind:"HeaderMismatch",code:error.code};case MODERN_ERROR_CODES.MissingRequiredClientCapabilityError:return{...common,kind:"MissingRequiredClientCapabilityError",code:error.code};case MODERN_ERROR_CODES.UnsupportedProtocolVersionError:{let supported=isRecord(error.data)?error.data.supported:void 0;return{...common,kind:"UnsupportedProtocolVersionError",code:error.code,...Array.isArray(supported)&&supported.every(version=>typeof version=="string")?{supportedVersions:supported}:{}}}default:return}}function parseBody(body2){if(typeof body2!="string")return body2;try{return JSON.parse(body2)}catch(error){if(error instanceof SyntaxError)return;throw error}}function isRecord(value){return typeof value=="object"&&value!==null&&!Array.isArray(value)}var discoverySchema=external_exports.object({resultType:external_exports.literal("complete"),supportedVersions:external_exports.array(external_exports.string()),capabilities:external_exports.record(external_exports.string(),external_exports.unknown()),_meta:external_exports.object({"io.modelcontextprotocol/serverInfo":external_exports.object({name:external_exports.string(),version:external_exports.string()}).passthrough()}).passthrough(),instructions:external_exports.string().optional(),ttlMs:external_exports.number().nonnegative().optional(),cacheScope:external_exports.string().optional()}).passthrough(),modernError=classifyModernError,STDIO_PROBE_ID="senpi-era-probe",StdioProbeSilence=class extends Error{constructor(){super("MCP stdio server did not answer discovery in time"),this.name="StdioProbeSilence"}};function discoveryReply(value,id){return complete(value,id)}function request(options,version,id=1){let built=buildModernRequest(id,"server/discover",options.clientInfo,options.clientCapabilities);return{...built,params:{_meta:{...built.params._meta,"io.modelcontextprotocol/protocolVersion":version}}}}function complete(value,id=1){let parsed=external_exports.object({jsonrpc:external_exports.literal("2.0"),id:external_exports.literal(id),result:discoverySchema}).safeParse(value);return parsed.success?parsed.data.result:void 0}function errorReply(value,id){return external_exports.object({jsonrpc:external_exports.literal("2.0"),id:id===void 0?external_exports.union([external_exports.string(),external_exports.number(),external_exports.null()]):external_exports.literal(id),error:external_exports.object({code:external_exports.number(),message:external_exports.string()})}).safeParse(value).success}function mutualVersion(error,options){if(!(error.kind!=="UnsupportedProtocolVersionError"||!error.supportedVersions))return error.supportedVersions.filter(candidate=>options.supportedVersions.includes(candidate)).sort().at(-1)}function indeterminate(reason,action,details={}){return{kind:"indeterminate",reason,action,...details}}function parseJson(text){try{return JSON.parse(text)}catch(error){if(error instanceof SyntaxError)return;throw error}}async function body(response){let text=await response.text();if(!response.headers.get("Content-Type")?.includes("text/event-stream"))return parseJson(text);for(let event of text.replace(/\r\n/g,`
2
+ import{fetchWithinOrigin}from"./chunk-YP72RYUP.js";import{InitializeResultSchema,JSONRPCMessageSchema,LATEST_PROTOCOL_VERSION}from"./chunk-HPCS4HM4.js";import{ConnectError,createMcpLogger,isMcpNeedsAuthError,loadMcpSdkAuth,loadMcpSdkClient,loadMcpSdkStdioTransport,loadMcpSdkStreamableHttpTransport,loadMcpSdkTypes,reapProcessTree,safeOn,safeTimer}from"./chunk-RPAHOJ6F.js";import{external_exports}from"./chunk-KUPQO7MC.js";import"./chunk-4J4ABCCL.js";import"./chunk-ATQFN5HI.js";import"./chunk-IKOFCODM.js";var MCP_CLIENT_ELICITATION_CAPABILITY={elicitation:{}},MCP_ELICITATION_TIMEOUT_MS=300*1e3,legacyUiProvider;async function configureMcpElicitation(client,owner=legacyUiProvider,timeoutMs=MCP_ELICITATION_TIMEOUT_MS){let{ElicitRequestSchema}=await loadMcpSdkTypes();client.setRequestHandler(ElicitRequestSchema,async request2=>{let params=request2.params;if(!("requestedSchema"in params))return{action:"decline"};let ui=typeof owner=="function"?owner():owner?.getMcpElicitationUi();return ui===void 0?{action:"decline"}:await runElicitationForm(ui,params.message,params.requestedSchema,timeoutMs)})}async function runElicitationForm(ui,message,requestedSchema,timeoutMs=MCP_ELICITATION_TIMEOUT_MS){let timer,timeout=new Promise(resolve=>{timer=safeTimer("mcp.elicitation.timeout",timeoutMs,()=>resolve({action:"cancel"}),{logger:createMcpLogger("elicitation")})});try{return await Promise.race([collectForm(ui,message,requestedSchema),timeout])}finally{timer!==void 0&&clearTimeout(timer)}}async function collectForm(ui,message,requestedSchema){let content={},required=new Set(requestedSchema.required??[]);for(let[name,property]of Object.entries(requestedSchema.properties??{})){let title=`${message} \u2014 ${property.title??name}`;if(property.type==="boolean"){content[name]=await ui.confirm(title,property.description??name);continue}if(Array.isArray(property.enum)&&property.enum.length>0){let picked=await ui.select(title,property.enum.map(String));if(picked===void 0)return{action:"decline"};content[name]=picked;continue}let answer=await ui.input(title,property.description);if(answer===void 0||answer.length===0){if(required.has(name))return{action:"decline"};continue}if(property.type==="number"||property.type==="integer"){let parsed=Number(answer);if(!Number.isFinite(parsed))return{action:"decline"};content[name]=parsed;continue}content[name]=answer}return{action:"accept",content}}async function materializeMcpTransport(options){let client=await buildMcpClient(options.elicitationUiProvider);return options.spec.kind==="stdio"?materializeStdio(options.spec,options,client):materializeHttp(options.spec,client)}async function materializeStdio(spec,options,client){let{getDefaultEnvironment,StdioClientTransport}=await loadMcpSdkStdioTransport(),transport=new StdioClientTransport({args:spec.args,command:spec.command,cwd:spec.cwd,env:{...getDefaultEnvironment(),...spec.env,...oauthAccessTokenEnv(spec.authProvider)},stderr:"pipe"});return trackStdioStart(transport,options.onStart),pipeStderr(transport,options.logger,options.sink),dropNullNextCursor(transport),{client,close:()=>closeClientAndTransport(transport,client),readPid:()=>transport.pid,transport}}async function materializeHttp(spec,client){let{StreamableHTTPClientTransport}=await loadMcpSdkStreamableHttpTransport(),transport=new StreamableHTTPClientTransport(spec.url,{authProvider:spec.authProvider,requestInit:spec.requestInit});return dropNullNextCursor(transport),{client,close:()=>closeClientAndTransport(transport,client),readPid:()=>null,transport}}async function buildMcpClient(elicitationUiProvider){let{Client:McpClient}=await loadMcpSdkClient(),client=new McpClient({name:"senpi-mcp-client",version:"0.0.0"},{capabilities:MCP_CLIENT_ELICITATION_CAPABILITY});return await configureMcpElicitation(client,elicitationUiProvider),client}function oauthAccessTokenEnv(authProvider){let accessToken=authProvider?.tokens()?.access_token;return accessToken===void 0||accessToken.length===0?{}:{OAUTH_ACCESS_TOKEN:accessToken}}function dropNullNextCursor(transport){let originalStart=transport.start.bind(transport);transport.start=async()=>{let deliver=transport.onmessage;deliver!==void 0&&(transport.onmessage=(message,extra)=>{if("result"in message&&message.result!==null&&typeof message.result=="object"){let result=message.result;result.nextCursor===null&&delete result.nextCursor}deliver(message,extra)}),await originalStart()}}function trackStdioStart(transport,onStart){let start=transport.start.bind(transport);transport.start=async()=>{await start(),onStart()}}function pipeStderr(transport,logger,sink){let pending="",stderr=transport.stderr;stderr!=null&&(safeOn(stderr,"data","transport.stderr.data",chunk=>{if(!Buffer.isBuffer(chunk)&&typeof chunk!="string")return;pending+=Buffer.isBuffer(chunk)?chunk.toString("utf8"):chunk;let lines=pending.split(/\r?\n/);pending=lines.pop()??"";for(let line of lines)line.length>0&&logger.stderr(line)},sink),safeOn(stderr,"end","transport.stderr.end",()=>{pending.length>0&&logger.stderr(pending),pending=""},sink))}async function closeClientAndTransport(transport,client){isTerminableHttpTransport(transport)&&await transport.terminateSession().catch(()=>{}),await transport.close().catch(()=>{}),await client.close().catch(()=>{})}function isTerminableHttpTransport(transport){return"terminateSession"in transport&&typeof transport.terminateSession=="function"}import{Buffer as Buffer2}from"node:buffer";var MODERN_PROTOCOL_VERSION="2026-07-28",MODERN_ERROR_CODES={HeaderMismatch:-32020,MissingRequiredClientCapabilityError:-32021,UnsupportedProtocolVersionError:-32022};function buildModernRequest(id,method,clientInfo2,clientCapabilities,params={}){return{jsonrpc:"2.0",id,method,params:{...params,_meta:{...params._meta,"io.modelcontextprotocol/protocolVersion":MODERN_PROTOCOL_VERSION,"io.modelcontextprotocol/clientInfo":clientInfo2,"io.modelcontextprotocol/clientCapabilities":clientCapabilities}}}}function modernizeRequest(id,method,clientInfo2,clientCapabilities,version,params){let built=buildModernRequest(id,method,clientInfo2,clientCapabilities,params);return{...built,params:{...built.params,_meta:{...built.params._meta,"io.modelcontextprotocol/protocolVersion":version}}}}function deriveModernHeaders(request2){let headers={"MCP-Protocol-Version":request2.params._meta["io.modelcontextprotocol/protocolVersion"],"Mcp-Method":request2.method},name=request2.method==="resources/read"?request2.params.uri:request2.method==="tools/call"||request2.method==="prompts/get"?request2.params.name:void 0;return typeof name=="string"&&(headers["Mcp-Name"]=/^[\x20-\x7E]*$/.test(name)&&!name.startsWith("base64:")?name:`base64:${Buffer2.from(name,"utf8").toString("base64url")}`),headers}function classifyModernError(body2){let response=parseBody(body2);if(!isRecord(response)||response.jsonrpc!=="2.0"||!isRecord(response.error))return;let error=response.error;if(typeof error.message!="string")return;let common={message:error.message,..."data"in error?{data:error.data}:{}};switch(error.code){case MODERN_ERROR_CODES.HeaderMismatch:return{...common,kind:"HeaderMismatch",code:error.code};case MODERN_ERROR_CODES.MissingRequiredClientCapabilityError:return{...common,kind:"MissingRequiredClientCapabilityError",code:error.code};case MODERN_ERROR_CODES.UnsupportedProtocolVersionError:{let supported=isRecord(error.data)?error.data.supported:void 0;return{...common,kind:"UnsupportedProtocolVersionError",code:error.code,...Array.isArray(supported)&&supported.every(version=>typeof version=="string")?{supportedVersions:supported}:{}}}default:return}}function parseBody(body2){if(typeof body2!="string")return body2;try{return JSON.parse(body2)}catch(error){if(error instanceof SyntaxError)return;throw error}}function isRecord(value){return typeof value=="object"&&value!==null&&!Array.isArray(value)}var discoverySchema=external_exports.object({resultType:external_exports.literal("complete"),supportedVersions:external_exports.array(external_exports.string()),capabilities:external_exports.record(external_exports.string(),external_exports.unknown()),_meta:external_exports.object({"io.modelcontextprotocol/serverInfo":external_exports.object({name:external_exports.string(),version:external_exports.string()}).passthrough()}).passthrough(),instructions:external_exports.string().optional(),ttlMs:external_exports.number().nonnegative().optional(),cacheScope:external_exports.string().optional()}).passthrough(),modernError=classifyModernError,STDIO_PROBE_ID="senpi-era-probe",StdioProbeSilence=class extends Error{constructor(){super("MCP stdio server did not answer discovery in time"),this.name="StdioProbeSilence"}};function discoveryReply(value,id){return complete(value,id)}function request(options,version,id=1){let built=buildModernRequest(id,"server/discover",options.clientInfo,options.clientCapabilities);return{...built,params:{_meta:{...built.params._meta,"io.modelcontextprotocol/protocolVersion":version}}}}function complete(value,id=1){let parsed=external_exports.object({jsonrpc:external_exports.literal("2.0"),id:external_exports.literal(id),result:discoverySchema}).safeParse(value);return parsed.success?parsed.data.result:void 0}function errorReply(value,id){return external_exports.object({jsonrpc:external_exports.literal("2.0"),id:id===void 0?external_exports.union([external_exports.string(),external_exports.number(),external_exports.null()]):external_exports.literal(id),error:external_exports.object({code:external_exports.number(),message:external_exports.string()})}).safeParse(value).success}function mutualVersion(error,options){if(!(error.kind!=="UnsupportedProtocolVersionError"||!error.supportedVersions))return error.supportedVersions.filter(candidate=>options.supportedVersions.includes(candidate)).sort().at(-1)}function indeterminate(reason,action,details={}){return{kind:"indeterminate",reason,action,...details}}function parseJson(text){try{return JSON.parse(text)}catch(error){if(error instanceof SyntaxError)return;throw error}}async function body(response){let text=await response.text();if(!response.headers.get("Content-Type")?.includes("text/event-stream"))return parseJson(text);for(let event of text.replace(/\r\n/g,`
3
3
  `).split(`
4
4
 
5
5
  `)){let data=event.split(`
@@ -1,2 +1,2 @@
1
1
  import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url); { const __piWorkerThreads = require("node:worker_threads"); if (typeof __piWorkerThreads.markAsUncloneable !== "function") { __piWorkerThreads.markAsUncloneable = () => {}; } }
2
- import{GoogleGenAI,convertMessages,convertTools,getDisabledGoogleThinkingConfig,isThinkingPart,mapStopReason,resolveGoogleFunctionCallingMode,resolveGoogleThinkingLevel,retainThoughtSignature,retryGoogleRequest,supportsGoogleStrictToolSampling,toGoogleSdkThinkingLevel,toGoogleThinkingLevel,toProviderNativeContent,usesGoogleThinkingLevel}from"./chunk-6TL72TUD.js";import"./chunk-K2EVQGGT.js";import"./chunk-5AOKDC6G.js";import{getPiUserAgent}from"./chunk-QTG7MY2X.js";import{GOOGLE_RESERVED_BODY_KEYS,applyExtraBody,buildBaseOptions}from"./chunk-MVNVDGYF.js";import"./chunk-EDOW5W5H.js";import{formatProviderError,normalizeProviderError}from"./chunk-TAV6QZFM.js";import"./chunk-PELNNWGO.js";import"./chunk-WQLMQGOW.js";import{sanitizeSurrogates}from"./chunk-WDTJ6JKE.js";import"./chunk-45SZOLCU.js";import{calculateCost,clampThinkingLevel,collapseSystemMessages,getCurrentTools,getInitialSystemMessage,getSystemMessageText}from"./chunk-LAWS3FYQ.js";import{AssistantMessageEventStream}from"./chunk-DMI55M2N.js";import{providerHeadersToRecord}from"./chunk-PJ34QVL5.js";import"./chunk-IKOFCODM.js";var toolCallCounter=0,stream=(model,context,options)=>{let stream2=new AssistantMessageEventStream,normalizedContext=collapseSystemMessages(context);return(async()=>{let output={role:"assistant",content:[],api:"google-generative-ai",provider:model.provider,model:model.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:"pending",timestamp:Date.now()};try{if(options?.fetch&&options.fetch!==globalThis.fetch)throw new Error("Custom fetch is not supported by the Google Generative AI adapter");let apiKey=options?.apiKey;if(!apiKey)throw new Error(`No API key for provider: ${model.provider}`);let client=createClient(model,apiKey,providerHeadersToRecord(options?.headers)),params=buildParams(model,normalizedContext,options),nextParams=await options?.onPayload?.(params,model);nextParams!==void 0&&(params=nextParams);let googleStream=await retryGoogleRequest(()=>client.models.generateContentStream(params),options);stream2.push({type:"start",partial:output});let currentBlock=null,groundingMetadataEmitted=!1,urlContextMetadataEmitted=!1,blocks=output.content,blockIndex=()=>blocks.length-1;for await(let chunk of googleStream){await options?.onProviderStreamEvent?.(chunk,model),output.responseId||=chunk.responseId;let candidate=chunk.candidates?.[0];if(candidate?.content?.parts)for(let part of candidate.content.parts){let handledAsKnownPart=!1;if(part.text!==void 0){handledAsKnownPart=!0;let isThinking=isThinkingPart(part);(!currentBlock||isThinking&&currentBlock.type!=="thinking"||!isThinking&&currentBlock.type!=="text")&&(currentBlock&&(currentBlock.type==="text"?stream2.push({type:"text_end",contentIndex:blocks.length-1,content:currentBlock.text,partial:output}):stream2.push({type:"thinking_end",contentIndex:blockIndex(),content:currentBlock.thinking,partial:output})),isThinking?(currentBlock={type:"thinking",thinking:"",thinkingSignature:void 0},output.content.push(currentBlock),stream2.push({type:"thinking_start",contentIndex:blockIndex(),partial:output})):(currentBlock={type:"text",text:""},output.content.push(currentBlock),stream2.push({type:"text_start",contentIndex:blockIndex(),partial:output}))),currentBlock.type==="thinking"?(currentBlock.thinking+=part.text,currentBlock.thinkingSignature=retainThoughtSignature(currentBlock.thinkingSignature,part.thoughtSignature),stream2.push({type:"thinking_delta",contentIndex:blockIndex(),delta:part.text,partial:output})):(currentBlock.text+=part.text,currentBlock.textSignature=retainThoughtSignature(currentBlock.textSignature,part.thoughtSignature),stream2.push({type:"text_delta",contentIndex:blockIndex(),delta:part.text,partial:output}))}if(part.functionCall){handledAsKnownPart=!0,currentBlock&&(currentBlock.type==="text"?stream2.push({type:"text_end",contentIndex:blockIndex(),content:currentBlock.text,partial:output}):stream2.push({type:"thinking_end",contentIndex:blockIndex(),content:currentBlock.thinking,partial:output}),currentBlock=null);let providedId=part.functionCall.id,toolCall={type:"toolCall",id:!providedId||output.content.some(b=>b.type==="toolCall"&&b.id===providedId)?`${part.functionCall.name}_${Date.now()}_${++toolCallCounter}`:providedId,name:part.functionCall.name||"",arguments:part.functionCall.args??{},...part.thoughtSignature&&{thoughtSignature:part.thoughtSignature}};output.content.push(toolCall),stream2.push({type:"toolcall_start",contentIndex:blockIndex(),partial:output}),stream2.push({type:"toolcall_delta",contentIndex:blockIndex(),delta:JSON.stringify(toolCall.arguments),partial:output}),stream2.push({type:"toolcall_end",contentIndex:blockIndex(),toolCall,partial:output})}handledAsKnownPart||output.content.push(toProviderNativeContent(part))}candidate?.groundingMetadata&&!groundingMetadataEmitted&&(output.content.push({type:"providerNative",subtype:"groundingMetadata",raw:candidate.groundingMetadata}),groundingMetadataEmitted=!0),candidate?.urlContextMetadata&&!urlContextMetadataEmitted&&(output.content.push({type:"providerNative",subtype:"urlContextMetadata",raw:candidate.urlContextMetadata}),urlContextMetadataEmitted=!0),candidate?.finishReason&&(output.rawStopReason=candidate.finishReason,output.stopReason=mapStopReason(candidate.finishReason),output.content.some(b=>b.type==="toolCall")&&output.stopReason==="stop"&&(output.stopReason="toolUse")),chunk.usageMetadata&&(output.usage={input:(chunk.usageMetadata.promptTokenCount||0)-(chunk.usageMetadata.cachedContentTokenCount||0),output:(chunk.usageMetadata.candidatesTokenCount||0)+(chunk.usageMetadata.thoughtsTokenCount||0),cacheRead:chunk.usageMetadata.cachedContentTokenCount||0,cacheWrite:0,reasoning:chunk.usageMetadata.thoughtsTokenCount||0,totalTokens:chunk.usageMetadata.totalTokenCount||0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},calculateCost(model,output.usage))}if(currentBlock&&(currentBlock.type==="text"?stream2.push({type:"text_end",contentIndex:blockIndex(),content:currentBlock.text,partial:output}):stream2.push({type:"thinking_end",contentIndex:blockIndex(),content:currentBlock.thinking,partial:output})),options?.signal?.aborted)throw new Error("Request was aborted");if(output.stopReason==="pending")throw new Error("Google stream ended without a finish reason");if(output.stopReason==="aborted"||output.stopReason==="error"){let errorMessage=output.rawStopReason?`Provider stopped with: ${output.rawStopReason}`:"An unknown error occurred";throw new Error(errorMessage)}stream2.push({type:"done",reason:output.stopReason,message:output}),stream2.end()}catch(error){for(let block of output.content)"index"in block&&delete block.index;output.stopReason=options?.signal?.aborted?"aborted":"error",output.errorMessage=formatProviderError(normalizeProviderError(error)),stream2.push({type:"error",reason:output.stopReason,error:output}),stream2.end()}})(),stream2},streamSimple=(model,context,options)=>{let apiKey=options?.apiKey;if(!apiKey)throw new Error(`No API key for provider: ${model.provider}`);let base={...buildBaseOptions(model,context,options,apiKey),toolChoice:options?.toolChoice};if(!options?.reasoning||options.reasoning==="off")return stream(model,context,{...base,thinking:{enabled:!1}});let clampedReasoning=clampThinkingLevel(model,options.reasoning);if(clampedReasoning==="off")return stream(model,context,{...base,thinking:{enabled:!1}});let resolvedLevel=resolveGoogleThinkingLevel(model,clampedReasoning);return usesGoogleThinkingLevel(model)?stream(model,context,{...base,thinking:{enabled:!0,level:toGoogleThinkingLevel(resolvedLevel)}}):stream(model,context,{...base,thinking:{enabled:!0,budgetTokens:getGoogleBudget(model,resolvedLevel,options.thinkingBudgets)}})};function createClient(model,apiKey,optionsHeaders){let httpOptions={};model.baseUrl&&(httpOptions.baseUrl=model.baseUrl,httpOptions.apiVersion="");let headers=providerHeadersToRecord({"User-Agent":getPiUserAgent(),...model.headers,...optionsHeaders});return headers&&(httpOptions.headers=headers),new GoogleGenAI({apiKey,httpOptions:Object.keys(httpOptions).length>0?httpOptions:void 0})}function buildParams(model,context,options={}){let contents=convertMessages(model,context,{preserveThinking:options.thinking?.enabled===!0}),initialSystemMessage=getInitialSystemMessage(context.messages),currentTools=getCurrentTools(context.messages),generationConfig={};options.temperature!==void 0&&(generationConfig.temperature=options.temperature),options.maxTokens!==void 0&&(generationConfig.maxOutputTokens=options.maxTokens);let supportsStrictMode=supportsGoogleStrictToolSampling(model.id),functionCallingMode=currentTools.length>0?resolveGoogleFunctionCallingMode(currentTools,options.toolChoice,supportsStrictMode):void 0,systemInstruction=initialSystemMessage?getSystemMessageText(initialSystemMessage):"",config={...Object.keys(generationConfig).length>0&&generationConfig,...systemInstruction&&{systemInstruction:sanitizeSurrogates(systemInstruction)},...currentTools.length>0&&{tools:convertTools(currentTools,!1,supportsStrictMode)},...functionCallingMode!==void 0&&{toolConfig:{functionCallingConfig:{mode:functionCallingMode}}}};if(options.thinking?.enabled&&model.reasoning){let thinkingConfig={includeThoughts:!0};options.thinking.level!==void 0?thinkingConfig.thinkingLevel=toGoogleSdkThinkingLevel(options.thinking.level):options.thinking.budgetTokens!==void 0&&(thinkingConfig.thinkingBudget=options.thinking.budgetTokens),config.thinkingConfig=thinkingConfig}else model.reasoning&&options.thinking&&!options.thinking.enabled&&(config.thinkingConfig=getDisabledGoogleThinkingConfig(model));if(options.signal){if(options.signal.aborted)throw new Error("Request aborted");config.abortSignal=options.signal}return applyExtraBody(config,options?.extraBody,GOOGLE_RESERVED_BODY_KEYS),{model:model.id,contents,config}}function getGoogleBudget(model,level,customBudgets){return customBudgets?.[level]!==void 0?customBudgets[level]:model.id.includes("2.5-pro")?{minimal:128,low:2048,medium:8192,high:32768}[level]:model.id.includes("2.5-flash-lite")?{minimal:512,low:2048,medium:8192,high:24576}[level]:model.id.includes("2.5-flash")?{minimal:128,low:2048,medium:8192,high:24576}[level]:-1}export{stream,streamSimple};
2
+ import{GoogleGenAI,convertMessages,convertTools,getDisabledGoogleThinkingConfig,isThinkingPart,mapStopReason,resolveGoogleFunctionCallingMode,resolveGoogleThinkingLevel,retainThoughtSignature,retryGoogleRequest,supportsGoogleStrictToolSampling,toGoogleSdkThinkingLevel,toGoogleThinkingLevel,toProviderNativeContent,usesGoogleThinkingLevel}from"./chunk-6TL72TUD.js";import"./chunk-K2EVQGGT.js";import"./chunk-5AOKDC6G.js";import{getPiUserAgent}from"./chunk-QTG7MY2X.js";import{GOOGLE_RESERVED_BODY_KEYS,applyExtraBody,buildBaseOptions}from"./chunk-MVNVDGYF.js";import"./chunk-EDOW5W5H.js";import{formatProviderError,normalizeProviderError}from"./chunk-TAV6QZFM.js";import"./chunk-PELNNWGO.js";import"./chunk-WQLMQGOW.js";import{sanitizeSurrogates}from"./chunk-WDTJ6JKE.js";import{calculateCost,clampThinkingLevel,collapseSystemMessages,getCurrentTools,getInitialSystemMessage,getSystemMessageText}from"./chunk-LAWS3FYQ.js";import"./chunk-45SZOLCU.js";import{AssistantMessageEventStream}from"./chunk-DMI55M2N.js";import{providerHeadersToRecord}from"./chunk-PJ34QVL5.js";import"./chunk-IKOFCODM.js";var toolCallCounter=0,stream=(model,context,options)=>{let stream2=new AssistantMessageEventStream,normalizedContext=collapseSystemMessages(context);return(async()=>{let output={role:"assistant",content:[],api:"google-generative-ai",provider:model.provider,model:model.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:"pending",timestamp:Date.now()};try{if(options?.fetch&&options.fetch!==globalThis.fetch)throw new Error("Custom fetch is not supported by the Google Generative AI adapter");let apiKey=options?.apiKey;if(!apiKey)throw new Error(`No API key for provider: ${model.provider}`);let client=createClient(model,apiKey,providerHeadersToRecord(options?.headers)),params=buildParams(model,normalizedContext,options),nextParams=await options?.onPayload?.(params,model);nextParams!==void 0&&(params=nextParams);let googleStream=await retryGoogleRequest(()=>client.models.generateContentStream(params),options);stream2.push({type:"start",partial:output});let currentBlock=null,groundingMetadataEmitted=!1,urlContextMetadataEmitted=!1,blocks=output.content,blockIndex=()=>blocks.length-1;for await(let chunk of googleStream){await options?.onProviderStreamEvent?.(chunk,model),output.responseId||=chunk.responseId;let candidate=chunk.candidates?.[0];if(candidate?.content?.parts)for(let part of candidate.content.parts){let handledAsKnownPart=!1;if(part.text!==void 0){handledAsKnownPart=!0;let isThinking=isThinkingPart(part);(!currentBlock||isThinking&&currentBlock.type!=="thinking"||!isThinking&&currentBlock.type!=="text")&&(currentBlock&&(currentBlock.type==="text"?stream2.push({type:"text_end",contentIndex:blocks.length-1,content:currentBlock.text,partial:output}):stream2.push({type:"thinking_end",contentIndex:blockIndex(),content:currentBlock.thinking,partial:output})),isThinking?(currentBlock={type:"thinking",thinking:"",thinkingSignature:void 0},output.content.push(currentBlock),stream2.push({type:"thinking_start",contentIndex:blockIndex(),partial:output})):(currentBlock={type:"text",text:""},output.content.push(currentBlock),stream2.push({type:"text_start",contentIndex:blockIndex(),partial:output}))),currentBlock.type==="thinking"?(currentBlock.thinking+=part.text,currentBlock.thinkingSignature=retainThoughtSignature(currentBlock.thinkingSignature,part.thoughtSignature),stream2.push({type:"thinking_delta",contentIndex:blockIndex(),delta:part.text,partial:output})):(currentBlock.text+=part.text,currentBlock.textSignature=retainThoughtSignature(currentBlock.textSignature,part.thoughtSignature),stream2.push({type:"text_delta",contentIndex:blockIndex(),delta:part.text,partial:output}))}if(part.functionCall){handledAsKnownPart=!0,currentBlock&&(currentBlock.type==="text"?stream2.push({type:"text_end",contentIndex:blockIndex(),content:currentBlock.text,partial:output}):stream2.push({type:"thinking_end",contentIndex:blockIndex(),content:currentBlock.thinking,partial:output}),currentBlock=null);let providedId=part.functionCall.id,toolCall={type:"toolCall",id:!providedId||output.content.some(b=>b.type==="toolCall"&&b.id===providedId)?`${part.functionCall.name}_${Date.now()}_${++toolCallCounter}`:providedId,name:part.functionCall.name||"",arguments:part.functionCall.args??{},...part.thoughtSignature&&{thoughtSignature:part.thoughtSignature}};output.content.push(toolCall),stream2.push({type:"toolcall_start",contentIndex:blockIndex(),partial:output}),stream2.push({type:"toolcall_delta",contentIndex:blockIndex(),delta:JSON.stringify(toolCall.arguments),partial:output}),stream2.push({type:"toolcall_end",contentIndex:blockIndex(),toolCall,partial:output})}handledAsKnownPart||output.content.push(toProviderNativeContent(part))}candidate?.groundingMetadata&&!groundingMetadataEmitted&&(output.content.push({type:"providerNative",subtype:"groundingMetadata",raw:candidate.groundingMetadata}),groundingMetadataEmitted=!0),candidate?.urlContextMetadata&&!urlContextMetadataEmitted&&(output.content.push({type:"providerNative",subtype:"urlContextMetadata",raw:candidate.urlContextMetadata}),urlContextMetadataEmitted=!0),candidate?.finishReason&&(output.rawStopReason=candidate.finishReason,output.stopReason=mapStopReason(candidate.finishReason),output.content.some(b=>b.type==="toolCall")&&output.stopReason==="stop"&&(output.stopReason="toolUse")),chunk.usageMetadata&&(output.usage={input:(chunk.usageMetadata.promptTokenCount||0)-(chunk.usageMetadata.cachedContentTokenCount||0),output:(chunk.usageMetadata.candidatesTokenCount||0)+(chunk.usageMetadata.thoughtsTokenCount||0),cacheRead:chunk.usageMetadata.cachedContentTokenCount||0,cacheWrite:0,reasoning:chunk.usageMetadata.thoughtsTokenCount||0,totalTokens:chunk.usageMetadata.totalTokenCount||0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},calculateCost(model,output.usage))}if(currentBlock&&(currentBlock.type==="text"?stream2.push({type:"text_end",contentIndex:blockIndex(),content:currentBlock.text,partial:output}):stream2.push({type:"thinking_end",contentIndex:blockIndex(),content:currentBlock.thinking,partial:output})),options?.signal?.aborted)throw new Error("Request was aborted");if(output.stopReason==="pending")throw new Error("Google stream ended without a finish reason");if(output.stopReason==="aborted"||output.stopReason==="error"){let errorMessage=output.rawStopReason?`Provider stopped with: ${output.rawStopReason}`:"An unknown error occurred";throw new Error(errorMessage)}stream2.push({type:"done",reason:output.stopReason,message:output}),stream2.end()}catch(error){for(let block of output.content)"index"in block&&delete block.index;output.stopReason=options?.signal?.aborted?"aborted":"error",output.errorMessage=formatProviderError(normalizeProviderError(error)),stream2.push({type:"error",reason:output.stopReason,error:output}),stream2.end()}})(),stream2},streamSimple=(model,context,options)=>{let apiKey=options?.apiKey;if(!apiKey)throw new Error(`No API key for provider: ${model.provider}`);let base={...buildBaseOptions(model,context,options,apiKey),toolChoice:options?.toolChoice};if(!options?.reasoning||options.reasoning==="off")return stream(model,context,{...base,thinking:{enabled:!1}});let clampedReasoning=clampThinkingLevel(model,options.reasoning);if(clampedReasoning==="off")return stream(model,context,{...base,thinking:{enabled:!1}});let resolvedLevel=resolveGoogleThinkingLevel(model,clampedReasoning);return usesGoogleThinkingLevel(model)?stream(model,context,{...base,thinking:{enabled:!0,level:toGoogleThinkingLevel(resolvedLevel)}}):stream(model,context,{...base,thinking:{enabled:!0,budgetTokens:getGoogleBudget(model,resolvedLevel,options.thinkingBudgets)}})};function createClient(model,apiKey,optionsHeaders){let httpOptions={};model.baseUrl&&(httpOptions.baseUrl=model.baseUrl,httpOptions.apiVersion="");let headers=providerHeadersToRecord({"User-Agent":getPiUserAgent(),...model.headers,...optionsHeaders});return headers&&(httpOptions.headers=headers),new GoogleGenAI({apiKey,httpOptions:Object.keys(httpOptions).length>0?httpOptions:void 0})}function buildParams(model,context,options={}){let contents=convertMessages(model,context,{preserveThinking:options.thinking?.enabled===!0}),initialSystemMessage=getInitialSystemMessage(context.messages),currentTools=getCurrentTools(context.messages),generationConfig={};options.temperature!==void 0&&(generationConfig.temperature=options.temperature),options.maxTokens!==void 0&&(generationConfig.maxOutputTokens=options.maxTokens);let supportsStrictMode=supportsGoogleStrictToolSampling(model.id),functionCallingMode=currentTools.length>0?resolveGoogleFunctionCallingMode(currentTools,options.toolChoice,supportsStrictMode):void 0,systemInstruction=initialSystemMessage?getSystemMessageText(initialSystemMessage):"",config={...Object.keys(generationConfig).length>0&&generationConfig,...systemInstruction&&{systemInstruction:sanitizeSurrogates(systemInstruction)},...currentTools.length>0&&{tools:convertTools(currentTools,!1,supportsStrictMode)},...functionCallingMode!==void 0&&{toolConfig:{functionCallingConfig:{mode:functionCallingMode}}}};if(options.thinking?.enabled&&model.reasoning){let thinkingConfig={includeThoughts:!0};options.thinking.level!==void 0?thinkingConfig.thinkingLevel=toGoogleSdkThinkingLevel(options.thinking.level):options.thinking.budgetTokens!==void 0&&(thinkingConfig.thinkingBudget=options.thinking.budgetTokens),config.thinkingConfig=thinkingConfig}else model.reasoning&&options.thinking&&!options.thinking.enabled&&(config.thinkingConfig=getDisabledGoogleThinkingConfig(model));if(options.signal){if(options.signal.aborted)throw new Error("Request aborted");config.abortSignal=options.signal}return applyExtraBody(config,options?.extraBody,GOOGLE_RESERVED_BODY_KEYS),{model:model.id,contents,config}}function getGoogleBudget(model,level,customBudgets){return customBudgets?.[level]!==void 0?customBudgets[level]:model.id.includes("2.5-pro")?{minimal:128,low:2048,medium:8192,high:32768}[level]:model.id.includes("2.5-flash-lite")?{minimal:512,low:2048,medium:8192,high:24576}[level]:model.id.includes("2.5-flash")?{minimal:128,low:2048,medium:8192,high:24576}[level]:-1}export{stream,streamSimple};
@@ -1,2 +1,2 @@
1
1
  import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url); { const __piWorkerThreads = require("node:worker_threads"); if (typeof __piWorkerThreads.markAsUncloneable !== "function") { __piWorkerThreads.markAsUncloneable = () => {}; } }
2
- import{buildGoogleAuthOptions,resolveVertexProjectFromEnv}from"./chunk-74YFRVGQ.js";import{GoogleGenAI,ResourceScope,convertMessages,convertTools,getDisabledGoogleThinkingConfig,isThinkingPart,mapStopReason,resolveGoogleFunctionCallingMode,resolveGoogleThinkingLevel,retainThoughtSignature,retryGoogleRequest,supportsGoogleStrictToolSampling,toGoogleSdkThinkingLevel,toGoogleThinkingLevel,toProviderNativeContent,usesGoogleThinkingLevel}from"./chunk-6TL72TUD.js";import"./chunk-K2EVQGGT.js";import"./chunk-5AOKDC6G.js";import{getPiUserAgent}from"./chunk-QTG7MY2X.js";import{GOOGLE_RESERVED_BODY_KEYS,applyExtraBody,buildBaseOptions}from"./chunk-MVNVDGYF.js";import"./chunk-EDOW5W5H.js";import{formatProviderError,normalizeProviderError}from"./chunk-TAV6QZFM.js";import"./chunk-PELNNWGO.js";import"./chunk-WQLMQGOW.js";import{sanitizeSurrogates}from"./chunk-WDTJ6JKE.js";import{getProviderEnvValue}from"./chunk-5ROMKDLK.js";import"./chunk-45SZOLCU.js";import{calculateCost,clampThinkingLevel,collapseSystemMessages,getCurrentTools,getInitialSystemMessage,getSystemMessageText}from"./chunk-LAWS3FYQ.js";import{AssistantMessageEventStream}from"./chunk-DMI55M2N.js";import{providerHeadersToRecord}from"./chunk-PJ34QVL5.js";import"./chunk-IKOFCODM.js";var API_VERSION="v1",GCP_VERTEX_CREDENTIALS_MARKER="gcp-vertex-credentials",toolCallCounter=0,stream=(model,context,options)=>{let stream2=new AssistantMessageEventStream,normalizedContext=collapseSystemMessages(context);return(async()=>{let output={role:"assistant",content:[],api:"google-vertex",provider:model.provider,model:model.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:"pending",timestamp:Date.now()};try{if(options?.fetch&&options.fetch!==globalThis.fetch)throw new Error("Custom fetch is not supported by the Google Vertex adapter");let apiKey=resolveApiKey(options),headers=providerHeadersToRecord(options?.headers),client=apiKey?createClientWithApiKey(model,apiKey,headers):createClient(model,resolveProject(options),resolveLocation(options),headers,options?.env),params=buildParams(model,normalizedContext,options),nextParams=await options?.onPayload?.(params,model);nextParams!==void 0&&(params=nextParams);let googleStream=await retryGoogleRequest(()=>client.models.generateContentStream(params),options);stream2.push({type:"start",partial:output});let currentBlock=null,groundingMetadataEmitted=!1,urlContextMetadataEmitted=!1,blocks=output.content,blockIndex=()=>blocks.length-1;for await(let chunk of googleStream){await options?.onProviderStreamEvent?.(chunk,model),output.responseId||=chunk.responseId;let candidate=chunk.candidates?.[0];if(candidate?.content?.parts)for(let part of candidate.content.parts){let handledAsKnownPart=!1;if(part.text!==void 0){handledAsKnownPart=!0;let isThinking=isThinkingPart(part);(!currentBlock||isThinking&&currentBlock.type!=="thinking"||!isThinking&&currentBlock.type!=="text")&&(currentBlock&&(currentBlock.type==="text"?stream2.push({type:"text_end",contentIndex:blocks.length-1,content:currentBlock.text,partial:output}):stream2.push({type:"thinking_end",contentIndex:blockIndex(),content:currentBlock.thinking,partial:output})),isThinking?(currentBlock={type:"thinking",thinking:"",thinkingSignature:void 0},output.content.push(currentBlock),stream2.push({type:"thinking_start",contentIndex:blockIndex(),partial:output})):(currentBlock={type:"text",text:""},output.content.push(currentBlock),stream2.push({type:"text_start",contentIndex:blockIndex(),partial:output}))),currentBlock.type==="thinking"?(currentBlock.thinking+=part.text,currentBlock.thinkingSignature=retainThoughtSignature(currentBlock.thinkingSignature,part.thoughtSignature),stream2.push({type:"thinking_delta",contentIndex:blockIndex(),delta:part.text,partial:output})):(currentBlock.text+=part.text,currentBlock.textSignature=retainThoughtSignature(currentBlock.textSignature,part.thoughtSignature),stream2.push({type:"text_delta",contentIndex:blockIndex(),delta:part.text,partial:output}))}if(part.functionCall){handledAsKnownPart=!0,currentBlock&&(currentBlock.type==="text"?stream2.push({type:"text_end",contentIndex:blockIndex(),content:currentBlock.text,partial:output}):stream2.push({type:"thinking_end",contentIndex:blockIndex(),content:currentBlock.thinking,partial:output}),currentBlock=null);let providedId=part.functionCall.id,toolCall={type:"toolCall",id:!providedId||output.content.some(b=>b.type==="toolCall"&&b.id===providedId)?`${part.functionCall.name}_${Date.now()}_${++toolCallCounter}`:providedId,name:part.functionCall.name||"",arguments:part.functionCall.args??{},...part.thoughtSignature&&{thoughtSignature:part.thoughtSignature}};output.content.push(toolCall),stream2.push({type:"toolcall_start",contentIndex:blockIndex(),partial:output}),stream2.push({type:"toolcall_delta",contentIndex:blockIndex(),delta:JSON.stringify(toolCall.arguments),partial:output}),stream2.push({type:"toolcall_end",contentIndex:blockIndex(),toolCall,partial:output})}handledAsKnownPart||output.content.push(toProviderNativeContent(part))}candidate?.groundingMetadata&&!groundingMetadataEmitted&&(output.content.push({type:"providerNative",subtype:"groundingMetadata",raw:candidate.groundingMetadata}),groundingMetadataEmitted=!0),candidate?.urlContextMetadata&&!urlContextMetadataEmitted&&(output.content.push({type:"providerNative",subtype:"urlContextMetadata",raw:candidate.urlContextMetadata}),urlContextMetadataEmitted=!0),candidate?.finishReason&&(output.rawStopReason=candidate.finishReason,output.stopReason=mapStopReason(candidate.finishReason),output.content.some(b=>b.type==="toolCall")&&output.stopReason==="stop"&&(output.stopReason="toolUse")),chunk.usageMetadata&&(output.usage={input:(chunk.usageMetadata.promptTokenCount||0)-(chunk.usageMetadata.cachedContentTokenCount||0),output:(chunk.usageMetadata.candidatesTokenCount||0)+(chunk.usageMetadata.thoughtsTokenCount||0),cacheRead:chunk.usageMetadata.cachedContentTokenCount||0,cacheWrite:0,reasoning:chunk.usageMetadata.thoughtsTokenCount||0,totalTokens:chunk.usageMetadata.totalTokenCount||0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},calculateCost(model,output.usage))}if(currentBlock&&(currentBlock.type==="text"?stream2.push({type:"text_end",contentIndex:blockIndex(),content:currentBlock.text,partial:output}):stream2.push({type:"thinking_end",contentIndex:blockIndex(),content:currentBlock.thinking,partial:output})),options?.signal?.aborted)throw new Error("Request was aborted");if(output.stopReason==="pending")throw new Error("Google Vertex stream ended without a finish reason");if(output.stopReason==="aborted"||output.stopReason==="error"){let errorMessage=output.rawStopReason?`Provider stopped with: ${output.rawStopReason}`:"An unknown error occurred";throw new Error(errorMessage)}stream2.push({type:"done",reason:output.stopReason,message:output}),stream2.end()}catch(error){for(let block of output.content)"index"in block&&delete block.index;output.stopReason=options?.signal?.aborted?"aborted":"error",output.errorMessage=formatProviderError(normalizeProviderError(error)),stream2.push({type:"error",reason:output.stopReason,error:output}),stream2.end()}})(),stream2},streamSimple=(model,context,options)=>{let base={...buildBaseOptions(model,context,options,void 0),toolChoice:options?.toolChoice};if(!options?.reasoning||options.reasoning==="off")return stream(model,context,{...base,thinking:{enabled:!1}});let clampedReasoning=clampThinkingLevel(model,options.reasoning);if(clampedReasoning==="off")return stream(model,context,{...base,thinking:{enabled:!1}});let resolvedLevel=resolveGoogleThinkingLevel(model,clampedReasoning);return usesGoogleThinkingLevel(model)?stream(model,context,{...base,thinking:{enabled:!0,level:toGoogleThinkingLevel(resolvedLevel)}}):stream(model,context,{...base,thinking:{enabled:!0,budgetTokens:getGoogleBudget(model,resolvedLevel,options.thinkingBudgets)}})};function createClient(model,project,location,optionsHeaders,env){let googleAuthOptions=buildGoogleAuthOptions(env);return new GoogleGenAI({vertexai:!0,project,location,apiVersion:API_VERSION,...googleAuthOptions?{googleAuthOptions}:{},httpOptions:buildHttpOptions(model,optionsHeaders)})}function createClientWithApiKey(model,apiKey,optionsHeaders){return new GoogleGenAI({vertexai:!0,apiKey,apiVersion:API_VERSION,httpOptions:buildHttpOptions(model,optionsHeaders)})}function buildHttpOptions(model,optionsHeaders){let httpOptions={},baseUrl=resolveCustomBaseUrl(model.baseUrl);baseUrl&&(httpOptions.baseUrl=baseUrl,httpOptions.baseUrlResourceScope=ResourceScope.COLLECTION,baseUrlIncludesApiVersion(baseUrl)&&(httpOptions.apiVersion=""));let headers=providerHeadersToRecord({"User-Agent":getPiUserAgent(),...model.headers,...optionsHeaders});return headers&&(httpOptions.headers=headers),Object.keys(httpOptions).length>0?httpOptions:void 0}function resolveCustomBaseUrl(baseUrl){let trimmed=baseUrl.trim();if(!(!trimmed||trimmed.includes("{location}")))return trimmed}function baseUrlIncludesApiVersion(baseUrl){try{return new URL(baseUrl).pathname.split("/").some(part=>/^v\d+(?:beta\d*)?$/.test(part))}catch{return/(?:^|\/)v\d+(?:beta\d*)?(?:\/|$)/.test(baseUrl)}}function resolveApiKey(options){let apiKey=options?.apiKey?.trim();if(!(!apiKey||apiKey===GCP_VERTEX_CREDENTIALS_MARKER||isPlaceholderApiKey(apiKey)))return apiKey}function isPlaceholderApiKey(apiKey){return/^<[^>]+>$/.test(apiKey)}function resolveProject(options){let project=resolveVertexProjectFromEnv(options);if(!project)throw new Error("Vertex AI requires a project ID. Set GOOGLE_CLOUD_PROJECT/GCLOUD_PROJECT or pass project in options.");return project}function resolveLocation(options){let location=options?.location||getProviderEnvValue("GOOGLE_CLOUD_LOCATION",options?.env);if(!location)throw new Error("Vertex AI requires a location. Set GOOGLE_CLOUD_LOCATION or pass location in options.");return location}function buildParams(model,context,options={}){let contents=convertMessages(model,context,{preserveThinking:options.thinking?.enabled===!0}),initialSystemMessage=getInitialSystemMessage(context.messages),currentTools=getCurrentTools(context.messages),generationConfig={};options.temperature!==void 0&&(generationConfig.temperature=options.temperature),options.maxTokens!==void 0&&(generationConfig.maxOutputTokens=options.maxTokens);let supportsStrictMode=supportsGoogleStrictToolSampling(model.id),functionCallingMode=currentTools.length>0?resolveGoogleFunctionCallingMode(currentTools,options.toolChoice,supportsStrictMode):void 0,systemInstruction=initialSystemMessage?getSystemMessageText(initialSystemMessage):"",config={...Object.keys(generationConfig).length>0&&generationConfig,...systemInstruction&&{systemInstruction:sanitizeSurrogates(systemInstruction)},...currentTools.length>0&&{tools:convertTools(currentTools,!1,supportsStrictMode)},...functionCallingMode!==void 0&&{toolConfig:{functionCallingConfig:{mode:functionCallingMode}}}};if(options.thinking?.enabled&&model.reasoning){let thinkingConfig={includeThoughts:!0};options.thinking.level!==void 0?thinkingConfig.thinkingLevel=toGoogleSdkThinkingLevel(options.thinking.level):options.thinking.budgetTokens!==void 0&&(thinkingConfig.thinkingBudget=options.thinking.budgetTokens),config.thinkingConfig=thinkingConfig}else model.reasoning&&options.thinking&&!options.thinking.enabled&&(config.thinkingConfig=getDisabledGoogleThinkingConfig(model));if(options.signal){if(options.signal.aborted)throw new Error("Request aborted");config.abortSignal=options.signal}return applyExtraBody(config,options?.extraBody,GOOGLE_RESERVED_BODY_KEYS),{model:model.id,contents,config}}function getGoogleBudget(model,level,customBudgets){return customBudgets?.[level]!==void 0?customBudgets[level]:model.id.includes("2.5-pro")?{minimal:128,low:2048,medium:8192,high:32768}[level]:model.id.includes("2.5-flash")?{minimal:128,low:2048,medium:8192,high:24576}[level]:-1}export{stream,streamSimple};
2
+ import{buildGoogleAuthOptions,resolveVertexProjectFromEnv}from"./chunk-74YFRVGQ.js";import{GoogleGenAI,ResourceScope,convertMessages,convertTools,getDisabledGoogleThinkingConfig,isThinkingPart,mapStopReason,resolveGoogleFunctionCallingMode,resolveGoogleThinkingLevel,retainThoughtSignature,retryGoogleRequest,supportsGoogleStrictToolSampling,toGoogleSdkThinkingLevel,toGoogleThinkingLevel,toProviderNativeContent,usesGoogleThinkingLevel}from"./chunk-6TL72TUD.js";import"./chunk-K2EVQGGT.js";import"./chunk-5AOKDC6G.js";import{getPiUserAgent}from"./chunk-QTG7MY2X.js";import{GOOGLE_RESERVED_BODY_KEYS,applyExtraBody,buildBaseOptions}from"./chunk-MVNVDGYF.js";import"./chunk-EDOW5W5H.js";import{formatProviderError,normalizeProviderError}from"./chunk-TAV6QZFM.js";import"./chunk-PELNNWGO.js";import"./chunk-WQLMQGOW.js";import{sanitizeSurrogates}from"./chunk-WDTJ6JKE.js";import{getProviderEnvValue}from"./chunk-5ROMKDLK.js";import{calculateCost,clampThinkingLevel,collapseSystemMessages,getCurrentTools,getInitialSystemMessage,getSystemMessageText}from"./chunk-LAWS3FYQ.js";import"./chunk-45SZOLCU.js";import{AssistantMessageEventStream}from"./chunk-DMI55M2N.js";import{providerHeadersToRecord}from"./chunk-PJ34QVL5.js";import"./chunk-IKOFCODM.js";var API_VERSION="v1",GCP_VERTEX_CREDENTIALS_MARKER="gcp-vertex-credentials",toolCallCounter=0,stream=(model,context,options)=>{let stream2=new AssistantMessageEventStream,normalizedContext=collapseSystemMessages(context);return(async()=>{let output={role:"assistant",content:[],api:"google-vertex",provider:model.provider,model:model.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:"pending",timestamp:Date.now()};try{if(options?.fetch&&options.fetch!==globalThis.fetch)throw new Error("Custom fetch is not supported by the Google Vertex adapter");let apiKey=resolveApiKey(options),headers=providerHeadersToRecord(options?.headers),client=apiKey?createClientWithApiKey(model,apiKey,headers):createClient(model,resolveProject(options),resolveLocation(options),headers,options?.env),params=buildParams(model,normalizedContext,options),nextParams=await options?.onPayload?.(params,model);nextParams!==void 0&&(params=nextParams);let googleStream=await retryGoogleRequest(()=>client.models.generateContentStream(params),options);stream2.push({type:"start",partial:output});let currentBlock=null,groundingMetadataEmitted=!1,urlContextMetadataEmitted=!1,blocks=output.content,blockIndex=()=>blocks.length-1;for await(let chunk of googleStream){await options?.onProviderStreamEvent?.(chunk,model),output.responseId||=chunk.responseId;let candidate=chunk.candidates?.[0];if(candidate?.content?.parts)for(let part of candidate.content.parts){let handledAsKnownPart=!1;if(part.text!==void 0){handledAsKnownPart=!0;let isThinking=isThinkingPart(part);(!currentBlock||isThinking&&currentBlock.type!=="thinking"||!isThinking&&currentBlock.type!=="text")&&(currentBlock&&(currentBlock.type==="text"?stream2.push({type:"text_end",contentIndex:blocks.length-1,content:currentBlock.text,partial:output}):stream2.push({type:"thinking_end",contentIndex:blockIndex(),content:currentBlock.thinking,partial:output})),isThinking?(currentBlock={type:"thinking",thinking:"",thinkingSignature:void 0},output.content.push(currentBlock),stream2.push({type:"thinking_start",contentIndex:blockIndex(),partial:output})):(currentBlock={type:"text",text:""},output.content.push(currentBlock),stream2.push({type:"text_start",contentIndex:blockIndex(),partial:output}))),currentBlock.type==="thinking"?(currentBlock.thinking+=part.text,currentBlock.thinkingSignature=retainThoughtSignature(currentBlock.thinkingSignature,part.thoughtSignature),stream2.push({type:"thinking_delta",contentIndex:blockIndex(),delta:part.text,partial:output})):(currentBlock.text+=part.text,currentBlock.textSignature=retainThoughtSignature(currentBlock.textSignature,part.thoughtSignature),stream2.push({type:"text_delta",contentIndex:blockIndex(),delta:part.text,partial:output}))}if(part.functionCall){handledAsKnownPart=!0,currentBlock&&(currentBlock.type==="text"?stream2.push({type:"text_end",contentIndex:blockIndex(),content:currentBlock.text,partial:output}):stream2.push({type:"thinking_end",contentIndex:blockIndex(),content:currentBlock.thinking,partial:output}),currentBlock=null);let providedId=part.functionCall.id,toolCall={type:"toolCall",id:!providedId||output.content.some(b=>b.type==="toolCall"&&b.id===providedId)?`${part.functionCall.name}_${Date.now()}_${++toolCallCounter}`:providedId,name:part.functionCall.name||"",arguments:part.functionCall.args??{},...part.thoughtSignature&&{thoughtSignature:part.thoughtSignature}};output.content.push(toolCall),stream2.push({type:"toolcall_start",contentIndex:blockIndex(),partial:output}),stream2.push({type:"toolcall_delta",contentIndex:blockIndex(),delta:JSON.stringify(toolCall.arguments),partial:output}),stream2.push({type:"toolcall_end",contentIndex:blockIndex(),toolCall,partial:output})}handledAsKnownPart||output.content.push(toProviderNativeContent(part))}candidate?.groundingMetadata&&!groundingMetadataEmitted&&(output.content.push({type:"providerNative",subtype:"groundingMetadata",raw:candidate.groundingMetadata}),groundingMetadataEmitted=!0),candidate?.urlContextMetadata&&!urlContextMetadataEmitted&&(output.content.push({type:"providerNative",subtype:"urlContextMetadata",raw:candidate.urlContextMetadata}),urlContextMetadataEmitted=!0),candidate?.finishReason&&(output.rawStopReason=candidate.finishReason,output.stopReason=mapStopReason(candidate.finishReason),output.content.some(b=>b.type==="toolCall")&&output.stopReason==="stop"&&(output.stopReason="toolUse")),chunk.usageMetadata&&(output.usage={input:(chunk.usageMetadata.promptTokenCount||0)-(chunk.usageMetadata.cachedContentTokenCount||0),output:(chunk.usageMetadata.candidatesTokenCount||0)+(chunk.usageMetadata.thoughtsTokenCount||0),cacheRead:chunk.usageMetadata.cachedContentTokenCount||0,cacheWrite:0,reasoning:chunk.usageMetadata.thoughtsTokenCount||0,totalTokens:chunk.usageMetadata.totalTokenCount||0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},calculateCost(model,output.usage))}if(currentBlock&&(currentBlock.type==="text"?stream2.push({type:"text_end",contentIndex:blockIndex(),content:currentBlock.text,partial:output}):stream2.push({type:"thinking_end",contentIndex:blockIndex(),content:currentBlock.thinking,partial:output})),options?.signal?.aborted)throw new Error("Request was aborted");if(output.stopReason==="pending")throw new Error("Google Vertex stream ended without a finish reason");if(output.stopReason==="aborted"||output.stopReason==="error"){let errorMessage=output.rawStopReason?`Provider stopped with: ${output.rawStopReason}`:"An unknown error occurred";throw new Error(errorMessage)}stream2.push({type:"done",reason:output.stopReason,message:output}),stream2.end()}catch(error){for(let block of output.content)"index"in block&&delete block.index;output.stopReason=options?.signal?.aborted?"aborted":"error",output.errorMessage=formatProviderError(normalizeProviderError(error)),stream2.push({type:"error",reason:output.stopReason,error:output}),stream2.end()}})(),stream2},streamSimple=(model,context,options)=>{let base={...buildBaseOptions(model,context,options,void 0),toolChoice:options?.toolChoice};if(!options?.reasoning||options.reasoning==="off")return stream(model,context,{...base,thinking:{enabled:!1}});let clampedReasoning=clampThinkingLevel(model,options.reasoning);if(clampedReasoning==="off")return stream(model,context,{...base,thinking:{enabled:!1}});let resolvedLevel=resolveGoogleThinkingLevel(model,clampedReasoning);return usesGoogleThinkingLevel(model)?stream(model,context,{...base,thinking:{enabled:!0,level:toGoogleThinkingLevel(resolvedLevel)}}):stream(model,context,{...base,thinking:{enabled:!0,budgetTokens:getGoogleBudget(model,resolvedLevel,options.thinkingBudgets)}})};function createClient(model,project,location,optionsHeaders,env){let googleAuthOptions=buildGoogleAuthOptions(env);return new GoogleGenAI({vertexai:!0,project,location,apiVersion:API_VERSION,...googleAuthOptions?{googleAuthOptions}:{},httpOptions:buildHttpOptions(model,optionsHeaders)})}function createClientWithApiKey(model,apiKey,optionsHeaders){return new GoogleGenAI({vertexai:!0,apiKey,apiVersion:API_VERSION,httpOptions:buildHttpOptions(model,optionsHeaders)})}function buildHttpOptions(model,optionsHeaders){let httpOptions={},baseUrl=resolveCustomBaseUrl(model.baseUrl);baseUrl&&(httpOptions.baseUrl=baseUrl,httpOptions.baseUrlResourceScope=ResourceScope.COLLECTION,baseUrlIncludesApiVersion(baseUrl)&&(httpOptions.apiVersion=""));let headers=providerHeadersToRecord({"User-Agent":getPiUserAgent(),...model.headers,...optionsHeaders});return headers&&(httpOptions.headers=headers),Object.keys(httpOptions).length>0?httpOptions:void 0}function resolveCustomBaseUrl(baseUrl){let trimmed=baseUrl.trim();if(!(!trimmed||trimmed.includes("{location}")))return trimmed}function baseUrlIncludesApiVersion(baseUrl){try{return new URL(baseUrl).pathname.split("/").some(part=>/^v\d+(?:beta\d*)?$/.test(part))}catch{return/(?:^|\/)v\d+(?:beta\d*)?(?:\/|$)/.test(baseUrl)}}function resolveApiKey(options){let apiKey=options?.apiKey?.trim();if(!(!apiKey||apiKey===GCP_VERTEX_CREDENTIALS_MARKER||isPlaceholderApiKey(apiKey)))return apiKey}function isPlaceholderApiKey(apiKey){return/^<[^>]+>$/.test(apiKey)}function resolveProject(options){let project=resolveVertexProjectFromEnv(options);if(!project)throw new Error("Vertex AI requires a project ID. Set GOOGLE_CLOUD_PROJECT/GCLOUD_PROJECT or pass project in options.");return project}function resolveLocation(options){let location=options?.location||getProviderEnvValue("GOOGLE_CLOUD_LOCATION",options?.env);if(!location)throw new Error("Vertex AI requires a location. Set GOOGLE_CLOUD_LOCATION or pass location in options.");return location}function buildParams(model,context,options={}){let contents=convertMessages(model,context,{preserveThinking:options.thinking?.enabled===!0}),initialSystemMessage=getInitialSystemMessage(context.messages),currentTools=getCurrentTools(context.messages),generationConfig={};options.temperature!==void 0&&(generationConfig.temperature=options.temperature),options.maxTokens!==void 0&&(generationConfig.maxOutputTokens=options.maxTokens);let supportsStrictMode=supportsGoogleStrictToolSampling(model.id),functionCallingMode=currentTools.length>0?resolveGoogleFunctionCallingMode(currentTools,options.toolChoice,supportsStrictMode):void 0,systemInstruction=initialSystemMessage?getSystemMessageText(initialSystemMessage):"",config={...Object.keys(generationConfig).length>0&&generationConfig,...systemInstruction&&{systemInstruction:sanitizeSurrogates(systemInstruction)},...currentTools.length>0&&{tools:convertTools(currentTools,!1,supportsStrictMode)},...functionCallingMode!==void 0&&{toolConfig:{functionCallingConfig:{mode:functionCallingMode}}}};if(options.thinking?.enabled&&model.reasoning){let thinkingConfig={includeThoughts:!0};options.thinking.level!==void 0?thinkingConfig.thinkingLevel=toGoogleSdkThinkingLevel(options.thinking.level):options.thinking.budgetTokens!==void 0&&(thinkingConfig.thinkingBudget=options.thinking.budgetTokens),config.thinkingConfig=thinkingConfig}else model.reasoning&&options.thinking&&!options.thinking.enabled&&(config.thinkingConfig=getDisabledGoogleThinkingConfig(model));if(options.signal){if(options.signal.aborted)throw new Error("Request aborted");config.abortSignal=options.signal}return applyExtraBody(config,options?.extraBody,GOOGLE_RESERVED_BODY_KEYS),{model:model.id,contents,config}}function getGoogleBudget(model,level,customBudgets){return customBudgets?.[level]!==void 0?customBudgets[level]:model.id.includes("2.5-pro")?{minimal:128,low:2048,medium:8192,high:32768}[level]:model.id.includes("2.5-flash")?{minimal:128,low:2048,medium:8192,high:24576}[level]:-1}export{stream,streamSimple};
@@ -1,2 +1,2 @@
1
1
  import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url); { const __piWorkerThreads = require("node:worker_threads"); if (typeof __piWorkerThreads.markAsUncloneable !== "function") { __piWorkerThreads.markAsUncloneable = () => {}; } }
2
- import{helpFlagsScope,isPlainHelpRequest,resolveHelpProjectTrust,tryPrintHelpWithoutEngine}from"./chunk-2MOGCBPT.js";import"./chunk-HMK6F3RG.js";import"./chunk-EPQK674G.js";import"./chunk-26UBFF6N.js";import"./chunk-GZVCRV7I.js";import"./chunk-U3VOXCGP.js";import"./chunk-2IK7QUJX.js";import"./chunk-COH5F7QV.js";import"./chunk-RFB5CBW7.js";import"./chunk-2VZJTDUX.js";import"./chunk-XSRM367N.js";import"./chunk-T36LJ6MW.js";import"./chunk-QGJLZ6BI.js";import"./chunk-UAQW2T7G.js";import"./chunk-WHPDEDCC.js";import"./chunk-HK46JMSC.js";import"./chunk-WQLMQGOW.js";import"./chunk-WDTJ6JKE.js";import"./chunk-5ROMKDLK.js";import"./chunk-3W47LTXQ.js";import"./chunk-45SZOLCU.js";import"./chunk-LAWS3FYQ.js";import"./chunk-DMI55M2N.js";import"./chunk-PJ34QVL5.js";import"./chunk-4J4ABCCL.js";import"./chunk-ATQFN5HI.js";import"./chunk-MIENF2YK.js";import"./chunk-IKOFCODM.js";export{helpFlagsScope,isPlainHelpRequest,resolveHelpProjectTrust,tryPrintHelpWithoutEngine};
2
+ import{helpFlagsScope,isPlainHelpRequest,resolveHelpProjectTrust,tryPrintHelpWithoutEngine}from"./chunk-2MOGCBPT.js";import"./chunk-HMK6F3RG.js";import"./chunk-EPQK674G.js";import"./chunk-26UBFF6N.js";import"./chunk-GZVCRV7I.js";import"./chunk-U3VOXCGP.js";import"./chunk-2SM4TR4H.js";import"./chunk-COH5F7QV.js";import"./chunk-RFB5CBW7.js";import"./chunk-2VZJTDUX.js";import"./chunk-XSRM367N.js";import"./chunk-T36LJ6MW.js";import"./chunk-QGJLZ6BI.js";import"./chunk-WHPDEDCC.js";import"./chunk-AA2L2RHH.js";import"./chunk-HK46JMSC.js";import"./chunk-WQLMQGOW.js";import"./chunk-WDTJ6JKE.js";import"./chunk-5ROMKDLK.js";import"./chunk-3W47LTXQ.js";import"./chunk-LAWS3FYQ.js";import"./chunk-45SZOLCU.js";import"./chunk-DMI55M2N.js";import"./chunk-PJ34QVL5.js";import"./chunk-4J4ABCCL.js";import"./chunk-ATQFN5HI.js";import"./chunk-MIENF2YK.js";import"./chunk-IKOFCODM.js";export{helpFlagsScope,isPlainHelpRequest,resolveHelpProjectTrust,tryPrintHelpWithoutEngine};
@@ -1,2 +1,2 @@
1
1
  import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url); { const __piWorkerThreads = require("node:worker_threads"); if (typeof __piWorkerThreads.markAsUncloneable !== "function") { __piWorkerThreads.markAsUncloneable = () => {}; } }
2
- import{parseHostArgs,resolveHostSocket,runHostCommand}from"./chunk-Z32CYNHC.js";import"./chunk-YID5W42N.js";import"./chunk-6IWSMXBA.js";import"./chunk-QMRJYMNH.js";import"./chunk-FM7NDZR5.js";import"./chunk-EPQK674G.js";import"./chunk-26UBFF6N.js";import"./chunk-IBDADH5Z.js";import"./chunk-3474DPZK.js";import"./chunk-77PVTNLJ.js";import"./chunk-DDQJSVIZ.js";import"./chunk-KUZPBZUK.js";import"./chunk-KUPQO7MC.js";import"./chunk-U3VOXCGP.js";import"./chunk-2IK7QUJX.js";import"./chunk-COH5F7QV.js";import"./chunk-RFB5CBW7.js";import"./chunk-2VZJTDUX.js";import"./chunk-XSRM367N.js";import"./chunk-T36LJ6MW.js";import"./chunk-QGJLZ6BI.js";import"./chunk-UAQW2T7G.js";import"./chunk-WHPDEDCC.js";import"./chunk-HK46JMSC.js";import"./chunk-WQLMQGOW.js";import"./chunk-WDTJ6JKE.js";import"./chunk-5ROMKDLK.js";import"./chunk-3W47LTXQ.js";import"./chunk-45SZOLCU.js";import"./chunk-LAWS3FYQ.js";import"./chunk-DMI55M2N.js";import"./chunk-PJ34QVL5.js";import"./chunk-HRPMLI7O.js";import"./chunk-QEQG42HL.js";import"./chunk-4J4ABCCL.js";import"./chunk-ATQFN5HI.js";import"./chunk-MIENF2YK.js";import"./chunk-7ASLQ243.js";import"./chunk-IKOFCODM.js";export{parseHostArgs,resolveHostSocket,runHostCommand};
2
+ import{parseHostArgs,resolveHostSocket,runHostCommand}from"./chunk-F4YDU66P.js";import"./chunk-KXTWMPCP.js";import"./chunk-QMRJYMNH.js";import"./chunk-6IWSMXBA.js";import"./chunk-FM7NDZR5.js";import"./chunk-EPQK674G.js";import"./chunk-26UBFF6N.js";import"./chunk-IBDADH5Z.js";import"./chunk-3474DPZK.js";import"./chunk-W557SQYL.js";import"./chunk-DKBJM22C.js";import"./chunk-KUZPBZUK.js";import"./chunk-KUPQO7MC.js";import"./chunk-U3VOXCGP.js";import"./chunk-2SM4TR4H.js";import"./chunk-COH5F7QV.js";import"./chunk-RFB5CBW7.js";import"./chunk-2VZJTDUX.js";import"./chunk-XSRM367N.js";import"./chunk-T36LJ6MW.js";import"./chunk-QGJLZ6BI.js";import"./chunk-WHPDEDCC.js";import"./chunk-AA2L2RHH.js";import"./chunk-HK46JMSC.js";import"./chunk-WQLMQGOW.js";import"./chunk-WDTJ6JKE.js";import"./chunk-5ROMKDLK.js";import"./chunk-3W47LTXQ.js";import"./chunk-LAWS3FYQ.js";import"./chunk-45SZOLCU.js";import"./chunk-DMI55M2N.js";import"./chunk-PJ34QVL5.js";import"./chunk-HRPMLI7O.js";import"./chunk-QEQG42HL.js";import"./chunk-4J4ABCCL.js";import"./chunk-ATQFN5HI.js";import"./chunk-MIENF2YK.js";import"./chunk-7ASLQ243.js";import"./chunk-IKOFCODM.js";export{parseHostArgs,resolveHostSocket,runHostCommand};
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url); { const __piWorkerThreads = require("node:worker_threads"); if (typeof __piWorkerThreads.markAsUncloneable !== "function") { __piWorkerThreads.markAsUncloneable = () => {}; } }
3
- import{INTERNAL_SUPERVISOR_FLAG,classifyChildExit,createInternalSocketPath,findInternalSupervisorArgs,parseSupervisorArgs,resolveCliMainPath,resolveHostChildLaunch,runHostSupervisor,spawnableChildLaunch}from"./chunk-77PVTNLJ.js";import{DEFAULT_HANDOFF_GRACE_MS,DEFAULT_HOST_IDLE_EXIT_MS,HANDOFF_GRACE_MS_ENV,HOST_COLD_START_ENV,HOST_IDLE_EXIT_MS_ENV,IdleExitDecider,parseColdStart,parseIdleExitMs,resolveHostPolicy}from"./chunk-DDQJSVIZ.js";import"./chunk-KUZPBZUK.js";import"./chunk-U3VOXCGP.js";import"./chunk-HRPMLI7O.js";import"./chunk-QEQG42HL.js";import"./chunk-4J4ABCCL.js";import"./chunk-ATQFN5HI.js";import"./chunk-7ASLQ243.js";import"./chunk-IKOFCODM.js";export{DEFAULT_HANDOFF_GRACE_MS,DEFAULT_HOST_IDLE_EXIT_MS,HANDOFF_GRACE_MS_ENV,HOST_COLD_START_ENV,HOST_IDLE_EXIT_MS_ENV,INTERNAL_SUPERVISOR_FLAG,IdleExitDecider,classifyChildExit,createInternalSocketPath,findInternalSupervisorArgs,parseColdStart,parseIdleExitMs,parseSupervisorArgs,resolveCliMainPath,resolveHostChildLaunch,resolveHostPolicy,runHostSupervisor,spawnableChildLaunch};
3
+ import{INTERNAL_SUPERVISOR_FLAG,classifyChildExit,createInternalSocketPath,findInternalSupervisorArgs,parseSupervisorArgs,resolveCliMainPath,resolveHostChildLaunch,runHostSupervisor,spawnableChildLaunch}from"./chunk-W557SQYL.js";import{DEFAULT_HANDOFF_GRACE_MS,DEFAULT_HOST_IDLE_EXIT_MS,HANDOFF_GRACE_MS_ENV,HOST_COLD_START_ENV,HOST_IDLE_EXIT_MS_ENV,IdleExitDecider,parseColdStart,parseIdleExitMs,resolveHostPolicy}from"./chunk-DKBJM22C.js";import"./chunk-KUZPBZUK.js";import"./chunk-U3VOXCGP.js";import"./chunk-HRPMLI7O.js";import"./chunk-QEQG42HL.js";import"./chunk-4J4ABCCL.js";import"./chunk-ATQFN5HI.js";import"./chunk-7ASLQ243.js";import"./chunk-IKOFCODM.js";export{DEFAULT_HANDOFF_GRACE_MS,DEFAULT_HOST_IDLE_EXIT_MS,HANDOFF_GRACE_MS_ENV,HOST_COLD_START_ENV,HOST_IDLE_EXIT_MS_ENV,INTERNAL_SUPERVISOR_FLAG,IdleExitDecider,classifyChildExit,createInternalSocketPath,findInternalSupervisorArgs,parseColdStart,parseIdleExitMs,parseSupervisorArgs,resolveCliMainPath,resolveHostChildLaunch,resolveHostPolicy,runHostSupervisor,spawnableChildLaunch};