@humain/humain-code 0.4.8 → 0.4.10

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 (143) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/dist/bundle/agent-monitor.js +1 -1
  3. package/dist/bundle/chunks/{anthropic-messages-YMPB2HJ7.js → anthropic-messages-UNHXXOD4.js} +3 -3
  4. package/dist/bundle/chunks/{azure-openai-responses-PDHOT7UC.js → azure-openai-responses-4QRYJCC2.js} +2 -2
  5. package/dist/bundle/chunks/bedrock-converse-stream.js +109 -92
  6. package/dist/bundle/chunks/{chunk-GNOKILVU.js → chunk-2QTTNAD4.js} +3385 -3947
  7. package/dist/bundle/chunks/{chunk-II2442A2.js → chunk-5CDES42D.js} +1 -1
  8. package/dist/bundle/chunks/{chunk-IMR3ZJM5.js → chunk-5XD3DHYL.js} +1 -1
  9. package/dist/bundle/chunks/{chunk-RXHSJSYY.js → chunk-6KAMTNN3.js} +1 -1
  10. package/dist/bundle/chunks/chunk-76X5KOIA.js +28 -0
  11. package/dist/bundle/chunks/{chunk-KRMTBTWU.js → chunk-77EWF2NW.js} +1 -1
  12. package/dist/bundle/chunks/{chunk-SKIP6KJV.js → chunk-7Z5MWPYE.js} +1 -1
  13. package/dist/bundle/chunks/{chunk-PBBQBIHY.js → chunk-AS2Y2MO6.js} +37 -37
  14. package/dist/bundle/chunks/{chunk-TIAXGIMN.js → chunk-AUFEF24K.js} +10 -10
  15. package/dist/bundle/chunks/{chunk-ILRBME2Y.js → chunk-BCF7KZ3R.js} +757 -745
  16. package/dist/bundle/chunks/{chunk-WPLW452J.js → chunk-DZ5C66IU.js} +1 -1
  17. package/dist/bundle/chunks/{chunk-2W5PWUPO.js → chunk-EDKZRYWJ.js} +2 -2
  18. package/dist/bundle/chunks/{chunk-W2QRCQBX.js → chunk-FF26YENK.js} +3 -4
  19. package/dist/bundle/chunks/{chunk-UZ5FVVCP.js → chunk-HMWAH7ZY.js} +1 -1
  20. package/dist/bundle/chunks/{chunk-F7UMX5BV.js → chunk-HSDTSUZE.js} +13 -2
  21. package/dist/bundle/chunks/chunk-I2ZWZAIV.js +751 -0
  22. package/dist/bundle/chunks/{chunk-GUUAEK6G.js → chunk-LCOHFEZZ.js} +1 -1
  23. package/dist/bundle/chunks/chunk-MVYV6MJY.js +23 -0
  24. package/dist/bundle/chunks/{chunk-Z5LYSSTY.js → chunk-QSPDLT2R.js} +2 -2
  25. package/dist/bundle/chunks/{chunk-UBQSONVR.js → chunk-R5VIAWGA.js} +103 -145
  26. package/dist/bundle/chunks/{chunk-YURQPD6Y.js → chunk-RYC5BYVE.js} +1 -2
  27. package/dist/bundle/chunks/{chunk-ROSZII6E.js → chunk-V5ZF7Q7L.js} +1 -1
  28. package/dist/bundle/chunks/chunk-VEYTRNQC.js +5 -0
  29. package/dist/bundle/chunks/{chunk-LQ4S7CRR.js → chunk-VYIIPF57.js} +1 -1
  30. package/dist/bundle/chunks/chunk-WBJN6PEI.js +43 -0
  31. package/dist/bundle/chunks/{chunk-SWRU4BOC.js → chunk-XGO43DKL.js} +1 -1
  32. package/dist/bundle/chunks/{chunk-PMISFIBM.js → chunk-XMHLSV3I.js} +1 -1
  33. package/dist/bundle/chunks/{chunk-3E4SMILM.js → chunk-YJBE3IGR.js} +14 -14
  34. package/dist/bundle/chunks/{chunk-OTXURGIO.js → chunk-YKZGL4MB.js} +1 -1
  35. package/dist/bundle/chunks/chunk-Z33NNMNB.js +6 -0
  36. package/dist/bundle/chunks/{cli-ZKT34WPW.js → cli-5ACW3WND.js} +2 -2
  37. package/dist/bundle/chunks/{cloudflare-workers-ai-system-one-YPOLSCPT.js → cloudflare-workers-ai-system-one-FZ3UQCZ7.js} +1 -1
  38. package/dist/bundle/chunks/{compat-J5FTRJ6S.js → compat-TQKA4I7M.js} +3 -3
  39. package/dist/bundle/chunks/{dist-N7XDUAAO.js → dist-VNSMKBZ6.js} +3 -3
  40. package/dist/bundle/chunks/{dist-6FQCCUSC.js → dist-WHC67QRM.js} +1077 -912
  41. package/dist/bundle/chunks/dist-cjs-RL2OCAP2.js +179 -0
  42. package/dist/bundle/chunks/{easter-egg-3d-5KKDWEIA.js → easter-egg-3d-3L3IKAT6.js} +1 -1
  43. package/dist/bundle/chunks/{esm-NCUV2DF7.js → esm-763X2IA7.js} +1 -1
  44. package/dist/bundle/chunks/event-streams-R5OECII4.js +2 -0
  45. package/dist/bundle/chunks/{execute-OSBDNQU5.js → execute-4X6G65NZ.js} +1 -1
  46. package/dist/bundle/chunks/{extract-56PXVZVW.js → extract-DLZ425VI.js} +4 -4
  47. package/dist/bundle/chunks/github-copilot.js +32 -31
  48. package/dist/bundle/chunks/{google-generative-ai-TS4ZE2RO.js → google-generative-ai-JD2FVOIX.js} +2 -2
  49. package/dist/bundle/chunks/{google-vertex-MJK2SMNE.js → google-vertex-PFBMDCBW.js} +3 -3
  50. package/dist/bundle/chunks/host-4J7H7KDS.js +2 -0
  51. package/dist/bundle/chunks/{llama-cpp-classify-5KAR326J.js → llama-cpp-classify-AGCW7HYN.js} +1 -1
  52. package/dist/bundle/chunks/{mistral-conversations-XA2ZGSAH.js → mistral-conversations-D74NZ65O.js} +2 -2
  53. package/dist/bundle/chunks/{node-XGNY74WT.js → node-W47VUEGE.js} +1 -1
  54. package/dist/bundle/chunks/{openai-codex-responses-Y6NRWMOI.js → openai-codex-responses-JAAA7MSS.js} +3 -3
  55. package/dist/bundle/chunks/{openai-completions-FY77MIZH.js → openai-completions-PGPMGQPU.js} +34 -33
  56. package/dist/bundle/chunks/{openai-decisions-MKH4OJHH.js → openai-decisions-QQ4MEABI.js} +1 -1
  57. package/dist/bundle/chunks/openai-responses-FG2R2M4L.js +23 -0
  58. package/dist/bundle/chunks/{openrouter-images-R3QMMLPH.js → openrouter-images-NTBP3UUE.js} +1 -1
  59. package/dist/bundle/chunks/{pi-messages-LYJZPRST.js → pi-messages-JD4O7KIP.js} +1 -1
  60. package/dist/bundle/chunks/{runtime-JFLZUNYP.js → runtime-SI76JZNE.js} +1 -1
  61. package/dist/bundle/chunks/{typesafe-system-one-PAYJECQK.js → typesafe-system-one-TTC7YCO3.js} +1 -1
  62. package/dist/bundle/chunks/virtual-modules-ID2GA4GE.js +5 -0
  63. package/dist/bundle/cli-runtime.js +3 -3
  64. package/dist/bundle/flow/assets/contract.json +1 -1
  65. package/dist/bundle/flow/package.json +1 -1
  66. package/dist/bundle/index.js +17 -17
  67. package/dist/bundle/rpc-entry.js +3 -2
  68. package/dist/core/account-reporting.d.ts +109 -0
  69. package/dist/core/account-reporting.d.ts.map +1 -0
  70. package/dist/core/account-reporting.js +328 -0
  71. package/dist/core/account-reporting.js.map +1 -0
  72. package/dist/core/agent-session.d.ts +22 -2
  73. package/dist/core/agent-session.d.ts.map +1 -1
  74. package/dist/core/agent-session.js +131 -0
  75. package/dist/core/agent-session.js.map +1 -1
  76. package/dist/core/anthropic-account-reporting.d.ts +76 -0
  77. package/dist/core/anthropic-account-reporting.d.ts.map +1 -0
  78. package/dist/core/anthropic-account-reporting.js +380 -0
  79. package/dist/core/anthropic-account-reporting.js.map +1 -0
  80. package/dist/core/bedrock-account-reporting.d.ts +82 -0
  81. package/dist/core/bedrock-account-reporting.d.ts.map +1 -0
  82. package/dist/core/bedrock-account-reporting.js +402 -0
  83. package/dist/core/bedrock-account-reporting.js.map +1 -0
  84. package/dist/core/model-runtime.d.ts +17 -0
  85. package/dist/core/model-runtime.d.ts.map +1 -1
  86. package/dist/core/model-runtime.js +64 -10
  87. package/dist/core/model-runtime.js.map +1 -1
  88. package/dist/core/oauth-account-pool.d.ts +4 -0
  89. package/dist/core/oauth-account-pool.d.ts.map +1 -1
  90. package/dist/core/oauth-account-pool.js +10 -3
  91. package/dist/core/oauth-account-pool.js.map +1 -1
  92. package/dist/humain/bedrock-provider/vendor/index.bundle.mjs +353 -29
  93. package/dist/humain/flow-accounts-host.d.ts +120 -0
  94. package/dist/humain/flow-accounts-host.d.ts.map +1 -0
  95. package/dist/humain/flow-accounts-host.js +346 -0
  96. package/dist/humain/flow-accounts-host.js.map +1 -0
  97. package/dist/humain/flow-command.d.ts +28 -0
  98. package/dist/humain/flow-command.d.ts.map +1 -0
  99. package/dist/humain/flow-command.js +226 -0
  100. package/dist/humain/flow-command.js.map +1 -0
  101. package/dist/humain/flow-loader.d.ts +4 -2
  102. package/dist/humain/flow-loader.d.ts.map +1 -1
  103. package/dist/humain/flow-loader.js +120 -91
  104. package/dist/humain/flow-loader.js.map +1 -1
  105. package/dist/humain/node-account-failure.d.ts +18 -0
  106. package/dist/humain/node-account-failure.d.ts.map +1 -0
  107. package/dist/humain/node-account-failure.js +73 -0
  108. package/dist/humain/node-account-failure.js.map +1 -0
  109. package/dist/humain/node-account-fallback.d.ts +85 -0
  110. package/dist/humain/node-account-fallback.d.ts.map +1 -0
  111. package/dist/humain/node-account-fallback.js +175 -0
  112. package/dist/humain/node-account-fallback.js.map +1 -0
  113. package/dist/humain/node-http.d.ts.map +1 -1
  114. package/dist/humain/node-http.js +11 -0
  115. package/dist/humain/node-http.js.map +1 -1
  116. package/dist/humain/node-provider.d.ts +4 -0
  117. package/dist/humain/node-provider.d.ts.map +1 -1
  118. package/dist/humain/node-provider.js +11 -0
  119. package/dist/humain/node-provider.js.map +1 -1
  120. package/dist/index.d.ts +4 -0
  121. package/dist/index.d.ts.map +1 -1
  122. package/dist/index.js.map +1 -1
  123. package/dist/modes/interactive/components/login-dialog.d.ts +2 -0
  124. package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
  125. package/dist/modes/interactive/components/login-dialog.js +5 -0
  126. package/dist/modes/interactive/components/login-dialog.js.map +1 -1
  127. package/dist/modes/interactive/interactive-mode.d.ts +26 -0
  128. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  129. package/dist/modes/interactive/interactive-mode.js +242 -19
  130. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  131. package/docs/flow-profiles.md +57 -5
  132. package/docs/flow.md +130 -45
  133. package/docs/providers.md +37 -0
  134. package/npm-shrinkwrap.json +48 -6
  135. package/package.json +3 -2
  136. package/dist/bundle/chunks/chunk-AKA7HNO3.js +0 -4
  137. package/dist/bundle/chunks/chunk-JYWVRJYG.js +0 -6
  138. package/dist/bundle/chunks/chunk-MEIYGK5O.js +0 -6
  139. package/dist/bundle/chunks/chunk-PYU5BR3Z.js +0 -27
  140. package/dist/bundle/chunks/event-streams-CGCQQL5M.js +0 -2
  141. package/dist/bundle/chunks/host-2ARI7PQ5.js +0 -2
  142. package/dist/bundle/chunks/openai-responses-LNSCERKH.js +0 -23
  143. package/dist/bundle/chunks/virtual-modules-TT2VTOSY.js +0 -5
package/CHANGELOG.md CHANGED
@@ -1,5 +1,49 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.4.10] - 2026-10-13
4
+
5
+ ### Added
6
+
7
+ - Added terminal-only `/flow setup` for provider connections, profile editing, tier and capability model choices, consented live checks, and review before saving. Profile and Node-fallback drafts stay in memory until Save; sign-in and global account changes persist immediately.
8
+ - Added read-only `/flow list` for recent runs in the current checkout, plus `/flow hide` and `/flow show` to control the widget without stopping work. Hidden widgets retain their final snapshot until the next run.
9
+ - Added consent-bound account usage refresh for Codex weekly allowance, Anthropic API rate-limit headers observed in the session, and regional Bedrock CloudWatch invocation and token totals. Reports distinguish unavailable, empty, partial and stale data; they are not billing totals or proof of model access.
10
+ - Added opt-in, ordered HUMAIN Node key fallback for recognized key and limit failures before output or tool execution. Fallback respects endpoint scope, Retry-After and per-key cooldowns; environment-only keys are not fallback targets.
11
+
12
+ ### Changed
13
+
14
+ - Consolidated Flow slash commands under `/flow`: start work with `/flow run <goal>` and use `/flow help [command]` for static help. Old `/flow-*` and `/omsg` names have no aliases; bare `/flow` shows help and unknown subcommands never start work. Internal tools and `flow_*` RPC operations are unchanged.
15
+ - `/flow models` now edits the versioned profile store used by runs, with independent tier and capability primaries, ordered fallbacks and capability effort. Omitted fallbacks inherit; an explicit empty list disables automatic model switching. Failure recovery uses only applicable configured fallbacks. Previewed legacy conversion refuses settings it cannot preserve.
16
+ - All Flow monetary spending thresholds now warn instead of stopping work, including run, role, dispatch, recovery and Sentinel child thresholds. They are not financial safeguards. Spending history remains intact; persistence failures, safety checks and non-monetary limits still stop work where applicable.
17
+
18
+ ### Fixed
19
+
20
+ - Malformed `/flow continue` refusals now emit a terminal RPC settlement instead of leaving hosts waiting. Outcome notices distinguish stopped runs and unavailable checks, and retry choices exclude deterministic safety blocks and ineligible runs.
21
+ - Setup conflict reloads preserve newer unrelated profile settings while reapplying draft model choices. Node key labels are validated before saving.
22
+ - Bedrock sign-in distinguishes bearer API keys from AWS credentials and preserves the selected region with ambient credential resolution. Flow account dialogs honor cancellation.
23
+ - Account reporting isolates concurrent refresh scopes and replaces cancelled in-flight refreshes. Node fallback metadata read failures no longer interrupt agent completion handling.
24
+
25
+ ## [0.4.9] - 2026-10-13
26
+
27
+ ### Added
28
+
29
+ - Added ten historical LARGE Flow eval tasks (five Forge and five HUMAIN Code tasks) with complete reference patches, protected checks, provenance, and base-fail/reference-pass evidence. Eval reports include per-configuration false-pass metrics (PLARGE).
30
+
31
+ ### Changed
32
+
33
+ - SMALL and MEDIUM Flow runs use one implementer followed by deterministic checks, without LLM triage, architects, scouts, leads, independent review, LLM QA, or repair agents. An explicit `SCOPE_GROWTH: large` report can request one gated escalation to LARGE; classified MEDIUM remains visible in telemetry (PSMALL).
34
+ - SMALL and MEDIUM runs with no discovered checks, or only provably unavailable non-passing checks, can succeed with `evidence_status: unverified_checks_unavailable` and a warning, never as verified. No LLM verdict substitutes for a missing check. Real check failures still fail; pre-existing failures remain warnings, and recovery still requires real checks (PSMALL).
35
+
36
+ ### Fixed
37
+
38
+ - Flow process custody tracks owned kernel process generations and observed descendants instead of shared session markers. Native and traced retries require affirmative custody evidence; unresolved owned processes block launches, while unrelated or settled generations do not. Historical reuse requires the complete matching discovered check set to pass with no blocked or present custody (PCUSTODY).
39
+ - Flow scope validation resolves safe directory navigation such as `cd packages/logger/../..` against the filesystem while continuing to block unknown directories, logical/physical symlink disagreement, and foreign writes (PSMALL).
40
+ - Flow verification fails when a deterministic check's process custody is unresolved (replay-blocked, or owned process tree present or unknown), including SMALL runs that would otherwise pass unverified, and never dispatches a review over such a check.
41
+ - OpenAI Completions/Responses and Bedrock preserve sanitized connection, DNS, TLS, and timeout evidence as `provider_unreachable` through sessions, Flow health/failover, RPC, and durable telemetry. Incomplete or missing cost evidence remains unknown and blocks same-route transport replay, transient resume, and lead repair; HTFIX17 failover may still try each other frozen route once (PERR).
42
+
43
+ - HTERR provider diagnostics retain HTTP status and useful denial reasons while keeping displayed errors within 4000 characters, including oversized structured metadata and repeated normalization.
44
+ - HTERR error sanitization redacts credential values in header records, credential-looking object keys and protocol-relative URLs before bounding diagnostics, without retaining raw provider errors in retry-delay failures.
45
+ - OpenAI completions and Responses HTTP 403 failures are terminal for both provider and outer assistant retries, even when retry headers or wrapped gateway messages suggest retrying.
46
+
3
47
  ## [0.4.8] - 2026-10-13
4
48
 
5
49
  ### Fixed
@@ -1,2 +1,2 @@
1
1
  import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url);
2
- import{runAgentMonitorCommand}from"./chunks/chunk-TIAXGIMN.js";import"./chunks/chunk-3E4SMILM.js";import"./chunks/chunk-QMUIATLD.js";import"./chunks/chunk-BHM75BJJ.js";import"./chunks/chunk-JXWJOIH4.js";process.exitCode=await runAgentMonitorCommand(process.env);
2
+ import{runAgentMonitorCommand}from"./chunks/chunk-AUFEF24K.js";import"./chunks/chunk-YJBE3IGR.js";import"./chunks/chunk-QMUIATLD.js";import"./chunks/chunk-BHM75BJJ.js";import"./chunks/chunk-JXWJOIH4.js";process.exitCode=await runAgentMonitorCommand(process.env);
@@ -1,7 +1,7 @@
1
1
  import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url);
2
- import{buildCopilotDynamicHeaders,hasCopilotVisionInput}from"./chunk-JEJQVFWK.js";import{retryProviderRequest}from"./chunk-MEIYGK5O.js";import{adjustMaxTokensForThinking,buildBaseOptions,clampMaxTokensToContext,getJsonSchemaToolParameters,getPiUserAgent,resolveJsonSchemaStrictSampling,transformMessages}from"./chunk-IMR3ZJM5.js";import{hasIncompleteUsage}from"./chunk-YTVFIA3A.js";import{sanitizeSurrogates}from"./chunk-L2ZPNLYD.js";import{createRequestObserver,headersToRecord}from"./chunk-II2442A2.js";
3
- import{ANTHROPIC_FEDERATION_RULE_ID_ENV,ANTHROPIC_IDENTITY_TOKEN_FILE_ENV,ANTHROPIC_ORGANIZATION_ID_ENV,ANTHROPIC_SERVICE_ACCOUNT_ID_ENV,ANTHROPIC_WORKSPACE_ID_ENV}from"./chunk-KQM7ZGL6.js";import{getProviderEnvValue}from"./chunk-FACBDLFU.js";import{parseJsonWithRepair,parseStreamingJson,parseStreamingJsonWhileStreaming}from"./chunk-GVVRXZHN.js";import{calculateCost,getCurrentTools,getInitialSystemMessage,getSystemMessageText,renderSystemMessageUpdate,resolveTranscript}from"./chunk-WPLW452J.js";
4
- import{AssistantMessageEventStream,appendAssistantMessageDiagnostic}from"./chunk-YURQPD6Y.js";import"./chunk-AKA7HNO3.js";import{Anthropic}from"./chunk-BKJU56SM.js";import"./chunk-JXWJOIH4.js";function resolveCacheRetention(cacheRetention,env){return cacheRetention||(getProviderEnvValue("HUMAIN_TERMINAL_CACHE_RETENTION",env)==="long"||getProviderEnvValue("PI_CACHE_RETENTION",env)==="long"?"long":"short")}function getCacheControl(model,cacheRetention,env){let retention=resolveCacheRetention(cacheRetention,env);if(retention==="none")return{retention};let ttl=retention==="long"&&getAnthropicCompat(model).supportsLongCacheRetention?"1h":void 0;return{retention,cacheControl:{type:"ephemera\
2
+ import{buildCopilotDynamicHeaders,hasCopilotVisionInput}from"./chunk-JEJQVFWK.js";import{retryProviderRequest}from"./chunk-Z33NNMNB.js";import"./chunk-MVYV6MJY.js";import{adjustMaxTokensForThinking,buildBaseOptions,clampMaxTokensToContext,getJsonSchemaToolParameters,getPiUserAgent,resolveJsonSchemaStrictSampling,transformMessages}from"./chunk-5XD3DHYL.js";import{hasIncompleteUsage}from"./chunk-YTVFIA3A.js";import{sanitizeSurrogates}from"./chunk-L2ZPNLYD.js";import{
3
+ createRequestObserver,headersToRecord}from"./chunk-5CDES42D.js";import{ANTHROPIC_FEDERATION_RULE_ID_ENV,ANTHROPIC_IDENTITY_TOKEN_FILE_ENV,ANTHROPIC_ORGANIZATION_ID_ENV,ANTHROPIC_SERVICE_ACCOUNT_ID_ENV,ANTHROPIC_WORKSPACE_ID_ENV}from"./chunk-KQM7ZGL6.js";import{getProviderEnvValue}from"./chunk-FACBDLFU.js";import{parseJsonWithRepair,parseStreamingJson,parseStreamingJsonWhileStreaming}from"./chunk-GVVRXZHN.js";import{calculateCost,getCurrentTools,getInitialSystemMessage,getSystemMessageText,
4
+ renderSystemMessageUpdate,resolveTranscript}from"./chunk-DZ5C66IU.js";import{AssistantMessageEventStream}from"./chunk-RYC5BYVE.js";import{appendAssistantMessageDiagnostic}from"./chunk-VEYTRNQC.js";import{Anthropic}from"./chunk-BKJU56SM.js";import"./chunk-JXWJOIH4.js";function resolveCacheRetention(cacheRetention,env){return cacheRetention||(getProviderEnvValue("HUMAIN_TERMINAL_CACHE_RETENTION",env)==="long"||getProviderEnvValue("PI_CACHE_RETENTION",env)==="long"?"long":"short")}function getCacheControl(model,cacheRetention,env){let retention=resolveCacheRetention(cacheRetention,env);if(retention==="none")return{retention};let ttl=retention==="long"&&getAnthropicCompat(model).supportsLongCacheRetention?"1h":void 0;return{retention,cacheControl:{type:"ephemera\
5
5
  l",...ttl&&{ttl}}}}var claudeCodeVersion="2.1.280",claudeCodeTools=["Read","Write","Edit","Bash","Grep","Glob","AskUserQuestion","EnterPlanMode","ExitPlanMode","KillShell","NotebookEdit","Skill","Task","TaskOutput","TodoWrite","WebFetch","WebSearch"],ccToolLookup=new Map(claudeCodeTools.map(t=>[t.toLowerCase(),t])),toClaudeCodeName=name=>ccToolLookup.get(name.toLowerCase())??name,fromClaudeCodeName=(name,tools)=>{if(tools&&tools.length>0){let lowerName=name.toLowerCase(),matchedTool=tools.find(tool=>tool.
6
6
  name.toLowerCase()===lowerName);if(matchedTool)return matchedTool.name}return name};function convertContentBlocks(content){if(!content.some(c=>c.type==="image"))return sanitizeSurrogates(content.map(c=>c.text).join(`
7
7
  `));let blocks=content.map(block=>block.type==="text"?{type:"text",text:sanitizeSurrogates(block.text)}:{type:"image",source:{type:"base64",media_type:block.mimeType,data:block.data}});return blocks.some(b=>b.type==="text")||blocks.unshift({type:"text",text:"(see attached image)"}),blocks}var FINE_GRAINED_TOOL_STREAMING_BETA="fine-grained-tool-streaming-2025-05-14",INTERLEAVED_THINKING_BETA="interleaved-thinking-2025-05-14",SERVER_SIDE_FALLBACK_BETA="server-side-fallback-2026-07-01",MID_CONVERSATION_OUTPUT_CONFIG_BETA="\
@@ -1,6 +1,6 @@
1
1
  import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url);
2
- import{convertResponsesMessages,convertResponsesTools,processResponsesStream}from"./chunk-2W5PWUPO.js";import{clampOpenAIPromptCacheKey}from"./chunk-PRRNXB7S.js";import{AzureOpenAI}from"./chunk-UW4GMZL3.js";import{formatProviderError,normalizeProviderError}from"./chunk-JYWVRJYG.js";import{retryProviderRequest}from"./chunk-MEIYGK5O.js";import"./chunk-PJACZCIR.js";import{buildBaseOptions,createGrammarToolInputProperties,getPiUserAgent,resolveSamplingParams}from"./chunk-IMR3ZJM5.js";
3
- import"./chunk-YTVFIA3A.js";import"./chunk-L2ZPNLYD.js";import{createRequestObserver,headersToRecord,observeFetch}from"./chunk-II2442A2.js";import{resolveAzureConfig,resolveDeploymentName}from"./chunk-CIA6V3BP.js";import"./chunk-FACBDLFU.js";import"./chunk-GVVRXZHN.js";import{clampThinkingLevel,getDeclaredTools,resolveTranscript,resolveTranscriptTools}from"./chunk-WPLW452J.js";import{AssistantMessageEventStream}from"./chunk-YURQPD6Y.js";import"./chunk-AKA7HNO3.js";
2
+ import{convertResponsesMessages,convertResponsesTools,processResponsesStream}from"./chunk-EDKZRYWJ.js";import{clampOpenAIPromptCacheKey}from"./chunk-PRRNXB7S.js";import{AzureOpenAI}from"./chunk-UW4GMZL3.js";import{retryProviderRequest}from"./chunk-Z33NNMNB.js";import{formatProviderError,normalizeProviderError}from"./chunk-MVYV6MJY.js";import"./chunk-PJACZCIR.js";import{buildBaseOptions,createGrammarToolInputProperties,getPiUserAgent,resolveSamplingParams}from"./chunk-5XD3DHYL.js";
3
+ import"./chunk-YTVFIA3A.js";import"./chunk-L2ZPNLYD.js";import{createRequestObserver,headersToRecord,observeFetch}from"./chunk-5CDES42D.js";import{resolveAzureConfig,resolveDeploymentName}from"./chunk-CIA6V3BP.js";import"./chunk-FACBDLFU.js";import"./chunk-GVVRXZHN.js";import{clampThinkingLevel,getDeclaredTools,resolveTranscript,resolveTranscriptTools}from"./chunk-DZ5C66IU.js";import{AssistantMessageEventStream}from"./chunk-RYC5BYVE.js";import"./chunk-VEYTRNQC.js";
4
4
  import"./chunk-JXWJOIH4.js";var AZURE_TOOL_CALL_PROVIDERS=new Set(["openai","openai-codex","opencode","azure"]),OPENAI_RESPONSES_MIN_OUTPUT_TOKENS=16;function formatAzureOpenAIError(error){return formatProviderError(normalizeProviderError(error),"Azure OpenAI API error")}var stream=(model,context,options)=>{let stream2=new AssistantMessageEventStream,normalizedContext=resolveTranscript(context,model.compat?.supportsMidConvoSystemMessages);return(async()=>{let deploymentName=resolveDeploymentName(model,options),output={role:"\
5
5
  assistant",content:[],api:"azure-openai-responses",provider:model.provider,model:model.id,usage:{usageIncomplete:!0,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{let apiKey=options?.apiKey;if(!apiKey)throw new Error(`No API key for provider: ${model.provider}`);let observe=createRequestObserver(options,{api:model.api,provider:model.provider,model:model.id,operation:"chat"}),client=createClient(
6
6
  model,apiKey,options,observeFetch(options?.fetch,observe)),grammarToolInputProperties=createGrammarToolInputProperties(getDeclaredTools(normalizedContext.messages),model.compat?.supportsOpenAIGrammarTools??!1),params=buildParams(model,normalizedContext,options,deploymentName,grammarToolInputProperties),nextParams=await options?.onPayload?.(params,model);nextParams!==void 0&&(params=nextParams);let requestOptions={...options?.signal?{signal:options.signal}:{},...options?.timeoutMs!==void 0?{timeout:options.