@fased/fased 0.1.55 → 0.1.56

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 (453) hide show
  1. package/config/capability-catalog.json +12 -0
  2. package/dist/acp/client.js +2 -2
  3. package/dist/acp/secret-file.js +2 -2
  4. package/dist/agents/agent-scope.js +2 -2
  5. package/dist/agents/apply-patch.js +8 -8
  6. package/dist/agents/auth-profiles/paths.js +2 -2
  7. package/dist/agents/auth-profiles/store.js +2 -2
  8. package/dist/agents/authenticated-model-catalog.js +3 -2
  9. package/dist/agents/bash-tools.exec-host-node.js +1 -1
  10. package/dist/agents/bash-tools.exec.js +1 -1
  11. package/dist/agents/bash-tools.shared.js +2 -2
  12. package/dist/agents/cli-credentials.js +4 -4
  13. package/dist/agents/copilot-dynamic-headers.js +37 -0
  14. package/dist/agents/current-model-catalog.js +6 -3
  15. package/dist/agents/docs-path.js +3 -3
  16. package/dist/agents/embedded-pi-mcp.js +4 -4
  17. package/dist/agents/identity-avatar.js +3 -3
  18. package/dist/agents/identity-file.js +2 -2
  19. package/dist/agents/model-catalog-source.js +2 -2
  20. package/dist/agents/model-catalog.js +1 -1
  21. package/dist/agents/model-metadata.js +34 -6
  22. package/dist/agents/openai-codex-app-server.js +499 -0
  23. package/dist/agents/pi-embedded-runner/compact.js +3 -3
  24. package/dist/agents/pi-embedded-runner/extra-params.js +159 -95
  25. package/dist/agents/pi-embedded-runner/model.js +62 -1
  26. package/dist/agents/pi-embedded-runner/moonshot-stream-wrappers.js +46 -0
  27. package/dist/agents/pi-embedded-runner/openai-stream-wrappers.js +221 -0
  28. package/dist/agents/pi-embedded-runner/run/attempt.js +6 -4
  29. package/dist/agents/pi-embedded-runner/run.js +5 -2
  30. package/dist/agents/pi-embedded-runner/utils.js +1 -1
  31. package/dist/agents/pi-embedded-runner.js +1 -1
  32. package/dist/agents/pi-embedded-subscribe.raw-stream.js +3 -3
  33. package/dist/agents/pi-extensions/compaction-safeguard.js +3 -3
  34. package/dist/agents/pi-model-discovery.js +6 -6
  35. package/dist/agents/pi-project-settings.js +3 -3
  36. package/dist/agents/pi-tools.js +2 -2
  37. package/dist/agents/sandbox/fs-bridge.js +2 -2
  38. package/dist/agents/session-dirs.js +4 -4
  39. package/dist/agents/session-write-lock.js +13 -13
  40. package/dist/agents/shell-utils.js +5 -5
  41. package/dist/agents/skills/bundled-dir.js +4 -4
  42. package/dist/agents/skills/local-loader.js +6 -6
  43. package/dist/agents/skills/plugin-skills.js +2 -2
  44. package/dist/agents/skills/workspace.js +13 -13
  45. package/dist/agents/skills-install-download.js +7 -7
  46. package/dist/agents/skills-install-plan.js +2 -2
  47. package/dist/agents/skills-install.js +2 -2
  48. package/dist/agents/skills-status.js +2 -2
  49. package/dist/agents/subagent-depth.js +2 -2
  50. package/dist/agents/system-prompt-params.js +2 -2
  51. package/dist/agents/tools/discord-actions-messaging.js +1 -1
  52. package/dist/agents/tools/message-tool.js +1 -1
  53. package/dist/agents/tools/session-status-tool.js +3 -3
  54. package/dist/agents/tools/slack-actions.js +1 -1
  55. package/dist/agents/tools/tts-tool.js +1 -1
  56. package/dist/agents/workspace.js +22 -22
  57. package/dist/auto-reply/reply/agent-runner-execution.js +2 -2
  58. package/dist/auto-reply/reply/agent-runner.js +2 -2
  59. package/dist/auto-reply/reply/commands-export-session.js +7 -7
  60. package/dist/auto-reply/reply/commands-models.js +1 -1
  61. package/dist/auto-reply/reply/directive-handling.impl.js +4 -1
  62. package/dist/auto-reply/reply/dispatch-acp.js +1 -1
  63. package/dist/auto-reply/reply/dispatch-from-config.js +1 -1
  64. package/dist/auto-reply/reply/get-reply-run.js +20 -2
  65. package/dist/auto-reply/reply/model-selection.js +1 -1
  66. package/dist/auto-reply/reply/post-compaction-audit.js +3 -3
  67. package/dist/auto-reply/reply/post-compaction-context.js +3 -3
  68. package/dist/auto-reply/reply/session-reset-model.js +1 -1
  69. package/dist/auto-reply/reply/session.js +3 -3
  70. package/dist/auto-reply/skill-commands.js +3 -3
  71. package/dist/auto-reply/status.js +7 -7
  72. package/dist/auto-reply/thinking.js +1 -1
  73. package/dist/brand.js +1 -1
  74. package/dist/browser/cdp.helpers.js +2 -2
  75. package/dist/browser/chrome.executables.js +3 -3
  76. package/dist/browser/chrome.js +5 -5
  77. package/dist/browser/chrome.profile-decoration.js +6 -6
  78. package/dist/browser/extension-relay.js +7 -7
  79. package/dist/browser/profiles-service.js +2 -2
  80. package/dist/browser/server-context.js +2 -2
  81. package/dist/browser/trash.js +4 -4
  82. package/dist/build-info.json +3 -3
  83. package/dist/canvas-host/a2ui/.bundle.hash +1 -1
  84. package/dist/canvas-host/server.js +4 -4
  85. package/dist/capabilities/catalog.js +3 -3
  86. package/dist/channels/plugins/catalog.js +3 -3
  87. package/dist/cli/browser-cli-extension.js +6 -6
  88. package/dist/cli/command-format.js +2 -2
  89. package/dist/cli/cron-cli/register.cron-add.js +1 -1
  90. package/dist/cli/cron-cli/register.cron-simple.js +2 -2
  91. package/dist/cli/dns-cli.js +9 -9
  92. package/dist/cli/gateway-cli/dev.js +5 -5
  93. package/dist/cli/gateway-cli/run.js +2 -2
  94. package/dist/cli/hooks-cli.js +5 -5
  95. package/dist/cli/lightweight/gateway-runtime-probe.js +2 -2
  96. package/dist/cli/memory-cli.js +7 -7
  97. package/dist/cli/nodes-media-utils.js +2 -2
  98. package/dist/cli/plugins-cli.js +2 -2
  99. package/dist/cli/program/register.agent.js +1 -1
  100. package/dist/cli/secrets-cli.js +3 -3
  101. package/dist/cli/windows-argv.js +2 -2
  102. package/dist/commands/agent.js +22 -3
  103. package/dist/commands/dashboard-link.js +3 -3
  104. package/dist/commands/doctor-config-flow.js +1 -1
  105. package/dist/commands/doctor-install.js +5 -5
  106. package/dist/commands/doctor-memory-search.js +2 -2
  107. package/dist/commands/doctor-platform-notes.js +2 -2
  108. package/dist/commands/doctor-sandbox.js +2 -2
  109. package/dist/commands/doctor-state-integrity.js +23 -23
  110. package/dist/commands/doctor-workspace.js +3 -3
  111. package/dist/commands/doctor.js +3 -3
  112. package/dist/commands/hosted-dashboard-probe.js +3 -3
  113. package/dist/commands/managed-up.js +2 -2
  114. package/dist/commands/model-picker.js +4 -3
  115. package/dist/commands/models/list.probe.js +1 -1
  116. package/dist/commands/models/list.registry.js +3 -2
  117. package/dist/commands/models/list.status-command.js +2 -2
  118. package/dist/commands/onboard-auth.credentials.js +3 -3
  119. package/dist/commands/onboarding/plugin-install.js +2 -2
  120. package/dist/commands/openai-codex-model-default.js +3 -2
  121. package/dist/commands/sessions-cleanup.js +2 -2
  122. package/dist/commands/signal-install.js +6 -6
  123. package/dist/commands/status-all/channels.js +2 -2
  124. package/dist/commands/wallet.js +47 -47
  125. package/dist/config/cache-utils.js +2 -2
  126. package/dist/config/includes.js +5 -5
  127. package/dist/config/io.js +2 -2
  128. package/dist/config/paths.js +3 -3
  129. package/dist/config/sat-runtime-ids.js +3 -3
  130. package/dist/config/sessions/disk-budget.js +6 -6
  131. package/dist/config/sessions/paths.js +2 -2
  132. package/dist/config/sessions/store.js +17 -17
  133. package/dist/config/sessions/transcript.js +4 -4
  134. package/dist/config/talk.js +2 -2
  135. package/dist/config/zod-schema.agent-defaults.js +4 -2
  136. package/dist/config/zod-schema.agent-runtime.js +4 -2
  137. package/dist/config/zod-schema.core.js +4 -2
  138. package/dist/control-ui/assets/{app-D2RaTXoV.js → app-D7TXyNRi.js} +390 -383
  139. package/dist/control-ui/assets/chat-model-ref-Djkv93yn.js +2 -0
  140. package/dist/control-ui/assets/{index-D2nC6I-9.js → index-BmSBom-w.js} +3 -3
  141. package/dist/control-ui/assets/{providers-CyjiG5Jw.js → providers-Cc89iMdx.js} +3 -3
  142. package/dist/control-ui/index.html +1 -1
  143. package/dist/control-ui/version.json +1 -1
  144. package/dist/cron/isolated-agent/run.js +6 -2
  145. package/dist/cron/service/jobs.js +11 -1
  146. package/dist/cron/service/store.js +2 -2
  147. package/dist/cron/store.js +6 -6
  148. package/dist/daemon/systemd-system.js +5 -5
  149. package/dist/discord/monitor/gateway-plugin.js +2 -2
  150. package/dist/discord/monitor/thread-bindings.state.js +2 -2
  151. package/dist/discord/voice/manager.js +1 -1
  152. package/dist/extensions/sat-mining/src/sat-bond-layout.js +9 -9
  153. package/dist/gateway/client.js +4 -4
  154. package/dist/gateway/control-ui-boot-check.js +6 -6
  155. package/dist/gateway/control-ui-login.js +7 -7
  156. package/dist/gateway/control-ui.js +9 -9
  157. package/dist/gateway/hooks-mapping.js +4 -4
  158. package/dist/gateway/protocol/schema/agents-models-skills.js +63 -4
  159. package/dist/gateway/server-discovery.js +2 -2
  160. package/dist/gateway/server-http.js +4 -4
  161. package/dist/gateway/server-methods/chat.js +3 -3
  162. package/dist/gateway/server-methods/models.js +4 -3
  163. package/dist/gateway/server-methods/sessions.js +8 -8
  164. package/dist/gateway/server-methods/tts.js +2 -2
  165. package/dist/gateway/server-methods/usage.js +2 -2
  166. package/dist/gateway/server-model-catalog.js +1 -1
  167. package/dist/gateway/server.impl.js +3 -3
  168. package/dist/gateway/session-compaction-checkpoints.js +4 -4
  169. package/dist/gateway/session-utils.fs.js +24 -24
  170. package/dist/gateway/session-utils.js +6 -6
  171. package/dist/gateway/sessions-patch.js +27 -24
  172. package/dist/hooks/bundled-dir.js +4 -4
  173. package/dist/hooks/gmail-setup-utils.js +6 -6
  174. package/dist/hooks/import-url.js +2 -2
  175. package/dist/hooks/loader.js +4 -4
  176. package/dist/hooks/workspace.js +7 -7
  177. package/dist/infra/archive.js +17 -17
  178. package/dist/infra/boundary-file-read.js +2 -2
  179. package/dist/infra/boundary-path.js +15 -15
  180. package/dist/infra/brew.js +2 -2
  181. package/dist/infra/control-ui-assets.js +14 -14
  182. package/dist/infra/device-auth-store.js +8 -8
  183. package/dist/infra/device-identity.js +8 -8
  184. package/dist/infra/dotenv.js +2 -2
  185. package/dist/infra/exec-approvals.js +8 -8
  186. package/dist/infra/exec-command-resolution.js +4 -4
  187. package/dist/infra/exec-safe-bin-trust.js +2 -2
  188. package/dist/infra/fased-root.js +5 -5
  189. package/dist/infra/fs-safe.js +14 -14
  190. package/dist/infra/gateway-lock.js +11 -11
  191. package/dist/infra/git-commit.js +5 -5
  192. package/dist/infra/git-root.js +4 -4
  193. package/dist/infra/hosted-runtime-artifact.js +3 -3
  194. package/dist/infra/is-main.js +2 -2
  195. package/dist/infra/json-file.js +7 -7
  196. package/dist/infra/outbound/delivery-queue.js +16 -16
  197. package/dist/infra/path-env.js +3 -3
  198. package/dist/infra/ports-lsof.js +4 -4
  199. package/dist/infra/provider-usage.auth.js +3 -3
  200. package/dist/infra/safe-open-sync.js +2 -2
  201. package/dist/infra/session-cost-usage.js +9 -9
  202. package/dist/infra/shell-env.js +2 -2
  203. package/dist/infra/state-migrations.fs.js +6 -6
  204. package/dist/infra/state-migrations.js +23 -23
  205. package/dist/infra/tmp-fased-dir.js +6 -6
  206. package/dist/infra/widearea-dns.js +3 -3
  207. package/dist/infra/wsl.js +2 -2
  208. package/dist/light-update-status.js +11 -11
  209. package/dist/line/accounts.js +2 -2
  210. package/dist/line/download.js +2 -2
  211. package/dist/logging/config.js +3 -3
  212. package/dist/logging/logger.js +7 -7
  213. package/dist/managed/federation.js +3 -3
  214. package/dist/managed/tunnel.js +3 -3
  215. package/dist/media/store.js +13 -13
  216. package/dist/media-understanding/runner.js +3 -3
  217. package/dist/memory/embeddings.js +2 -2
  218. package/dist/memory/internal.js +10 -10
  219. package/dist/memory/manager-sync-ops.js +7 -7
  220. package/dist/memory/repair-executor.js +17 -17
  221. package/dist/node-host/invoke-system-run-plan.js +8 -8
  222. package/dist/node-host/invoke.js +2 -2
  223. package/dist/node-host/runner.js +3 -3
  224. package/dist/pairing/pairing-store.js +3 -3
  225. package/dist/plugin-sdk/{accounts-CeRNo5Ae.js → accounts-DzWlKv1U.js} +1 -1
  226. package/dist/plugin-sdk/{actions-OMRHtXPj.js → actions-BplQVLL6.js} +4 -4
  227. package/dist/plugin-sdk/{active-listener-BlIkS3iR.js → active-listener-x4MLhYUw.js} +1 -1
  228. package/dist/plugin-sdk/{allow-list-BYeKk0Sy.js → allow-list-DyAxs4yw.js} +1 -1
  229. package/dist/plugin-sdk/{audio-preflight-B2n3a2Tj.js → audio-preflight-G8h3Sn8_.js} +43 -47
  230. package/dist/plugin-sdk/{audit-Ppg6dR_b.js → audit-CWknklvI.js} +1 -1
  231. package/dist/plugin-sdk/{channel-access-af8dWWRv.js → channel-access-a9Dnfw7-.js} +1 -1
  232. package/dist/plugin-sdk/{channel-access-configure-B6IAGlE0.js → channel-access-configure-CD4QDN5E.js} +1 -1
  233. package/dist/plugin-sdk/{channel-adapters.discord-IOZP8Cv5.js → channel-adapters.discord-BS4S4Svh.js} +1 -1
  234. package/dist/plugin-sdk/channel-plugin-common.d.ts +3 -3
  235. package/dist/plugin-sdk/channel-plugin-common.js +4 -4
  236. package/dist/plugin-sdk/{chunk-CD76Byie.js → chunk-B8EZkwiT.js} +1 -1
  237. package/dist/plugin-sdk/{chunk-items-Bu19zrYH.js → chunk-items-CEPklxGe.js} +1 -1
  238. package/dist/plugin-sdk/command-status.d.ts +2 -2
  239. package/dist/plugin-sdk/command-status.js +43 -47
  240. package/dist/plugin-sdk/{commands-registry-DgS55tNj.js → commands-registry-BfEa4tFA.js} +2 -2
  241. package/dist/plugin-sdk/{common-CWvfeiX0.js → common-CbfckC19.js} +1 -1
  242. package/dist/plugin-sdk/{config-CYDETqcF.js → config-Bt5GhnA-.js} +29 -15
  243. package/dist/plugin-sdk/{config-schema-CQ4EVcQG.js → config-schema-B9DKr6J5.js} +95877 -81287
  244. package/dist/plugin-sdk/device-pair.d.ts +1 -1
  245. package/dist/plugin-sdk/device-pair.js +2 -3
  246. package/dist/plugin-sdk/{diagnostic-Dfn1iERm.js → diagnostic-DLL_zekv.js} +3 -3
  247. package/dist/plugin-sdk/{directory-live-DatqU-eS.js → directory-live-CSuYxdwk.js} +1 -1
  248. package/dist/plugin-sdk/{directory-live-ClwN5KKq.js → directory-live-Dw7ZgC9_.js} +1 -1
  249. package/dist/plugin-sdk/discord.d.ts +5 -5
  250. package/dist/plugin-sdk/discord.js +31 -32
  251. package/dist/plugin-sdk/{draft-stream-controls-D4Tb_iS_.js → draft-stream-controls-BqchW1vi.js} +1 -1
  252. package/dist/plugin-sdk/{fetch-guard-BuYrl6q2.js → fetch-guard-CeG6u6ld.js} +1 -1
  253. package/dist/plugin-sdk/{filesystem-manager-B9DDPgfU.js → filesystem-manager-BGGGrkiN.js} +2 -2
  254. package/dist/plugin-sdk/{fs-safe-BG-VzVkL.js → fs-safe-xBqok6yR.js} +1 -1
  255. package/dist/plugin-sdk/{group-mentions-BxDgHCgj.d.ts → group-mentions-BHRff6j8.d.ts} +1 -1
  256. package/dist/plugin-sdk/{guilds-BeT3iHHJ.js → guilds-CDhRIX57.js} +1 -1
  257. package/dist/plugin-sdk/{handle-action-B75UVKxF.js → handle-action-DbzZFYnG.js} +24 -25
  258. package/dist/plugin-sdk/{helpers-BuEwju6y.js → helpers-CluGKuIV.js} +1 -1
  259. package/dist/plugin-sdk/{image-ops-C66HPeAZ.js → image-ops-CUaLtIFj.js} +1 -1
  260. package/dist/plugin-sdk/index.d.ts +7 -7
  261. package/dist/plugin-sdk/index.js +47 -51
  262. package/dist/plugin-sdk/json-store.js +6 -6
  263. package/dist/plugin-sdk/{login-Amr2DpKU.js → login-DJuHYDiK.js} +3 -3
  264. package/dist/plugin-sdk/{login-qr-DMQNEi9m.js → login-qr-CbHL5ayf.js} +3 -3
  265. package/dist/plugin-sdk/{manager-Bvpq49BI.js → manager-oHAvZCT3.js} +7 -7
  266. package/dist/plugin-sdk/{markdown-tables-DmQ7oXOm.js → markdown-tables-Mkx7k92Y.js} +1 -1
  267. package/dist/plugin-sdk/{media-ByLQbEwJ.js → media-CA8sTmVE.js} +4 -4
  268. package/dist/plugin-sdk/{monitor-K_u6daGa.js → monitor-CZrN9pev.js} +51 -55
  269. package/dist/plugin-sdk/{monitor-S_7LrvSj.js → monitor-CmwGqNyV.js} +61 -65
  270. package/dist/plugin-sdk/{openresponses-http-BrDJUZXR.js → openresponses-http-CWOd4war.js} +43 -47
  271. package/dist/plugin-sdk/{optional-runtime-dependency-CbYjAC2b.js → optional-runtime-dependency-DKmk9PZa.js} +1 -1
  272. package/dist/plugin-sdk/{outbound-BuDafBBI.js → outbound-0oN9IfNw.js} +9 -9
  273. package/dist/plugin-sdk/{outbound-attachment-DmZmUqFP.js → outbound-attachment-DdVkqUzE.js} +2 -2
  274. package/dist/plugin-sdk/{pairing-message-D0-UWGFJ.d.ts → pairing-message-BMkkS038.d.ts} +2 -2
  275. package/dist/plugin-sdk/{pairing-message-e4D4eBDA.js → pairing-message-ClqhfCUk.js} +1 -1
  276. package/dist/plugin-sdk/{pairing-store-T3IGoGZg.js → pairing-store-B01mCSct.js} +2 -2
  277. package/dist/plugin-sdk/{pi-model-discovery-DvAG_Png.js → pi-model-discovery-Buz0JC1Y.js} +1 -1
  278. package/dist/plugin-sdk/{pi-model-discovery-runtime-NjkUgjIf.js → pi-model-discovery-runtime-DuwuoteY.js} +2 -2
  279. package/dist/plugin-sdk/{probe-Cyb-DGA3.js → probe--7xtfzMm.js} +3 -3
  280. package/dist/plugin-sdk/{probe-Dlk0Jxpw.js → probe-BFroeK3g.js} +1 -1
  281. package/dist/plugin-sdk/{probe-D8JAILir.js → probe-l_whvGLY.js} +1 -1
  282. package/dist/plugin-sdk/{resolve-channels-zEnvugag.js → probe-xY3Ky0Tx.js} +3 -4
  283. package/dist/plugin-sdk/provider-web-search-config-contract.d.ts +2 -2
  284. package/dist/plugin-sdk/{pw-ai-D7eW43DL.js → pw-ai-B0domrii.js} +6 -8
  285. package/dist/plugin-sdk/{qmd-manager-DCUE21Kj.js → qmd-manager-CFFeM4Fl.js} +3 -3
  286. package/dist/plugin-sdk/{query-expansion-Zr9qQixm.js → query-expansion-CAI2kKLQ.js} +1 -1
  287. package/dist/plugin-sdk/{replies-BMIPmEoP.js → replies-1macZ1mZ.js} +4 -4
  288. package/dist/plugin-sdk/{resolve-channels-ChWKWtA9.js → resolve-channels-87LZrFk_.js} +2 -2
  289. package/dist/plugin-sdk/resolve-channels-CwB2_019.js +4 -0
  290. package/dist/plugin-sdk/{resolve-outbound-target-CXCqUUPV.js → resolve-outbound-target-BdH6LUoW.js} +2 -2
  291. package/dist/plugin-sdk/{resolve-route-DJN-SUSt.js → resolve-route-CkNIKKEW.js} +1 -1
  292. package/dist/plugin-sdk/{resolve-users-BTvjQuui.js → resolve-users-Cxb5wpAQ.js} +1 -1
  293. package/dist/plugin-sdk/{resolve-users-CTzoruIZ.js → resolve-users-V6dHh_2B.js} +2 -2
  294. package/dist/plugin-sdk/{retry-policy-CY1qY6d7.js → retry-policy-9ybIh4Fq.js} +1 -1
  295. package/dist/plugin-sdk/{runtime-CgOkQe0w.js → runtime-Dy420wBu.js} +3 -3
  296. package/dist/plugin-sdk/{runtime-dependency-DvdRNMvs.js → runtime-dependency-CIw9t7-k.js} +123 -15
  297. package/dist/plugin-sdk/{sandbox-paths-lj7_EVuA.js → sandbox-paths-w64tYl0v.js} +1 -1
  298. package/dist/plugin-sdk/sat-runtime.d.ts +3 -3
  299. package/dist/plugin-sdk/sat-runtime.js +44 -10
  300. package/dist/plugin-sdk/{send-BAz22RZr.js → send-2VcOMTN5.js} +9 -9
  301. package/dist/plugin-sdk/{send-2ITqny2W.js → send-BQUtCJFW.js} +10 -10
  302. package/dist/plugin-sdk/{send-Cr-dj6S-.js → send-DPJIIYAs.js} +6 -6
  303. package/dist/plugin-sdk/{send-BG3RWyil.js → send-Dqes9tdU.js} +13 -13
  304. package/dist/plugin-sdk/{send-eTxqFFsw.js → send-J4JWKP62.js} +8 -8
  305. package/dist/plugin-sdk/{session-C8nJmmVE.js → session-C_n2S5ub.js} +3 -3
  306. package/dist/plugin-sdk/{skill-commands-Rm5by9S8.js → skill-commands-B7wx9ax8.js} +102 -102
  307. package/dist/plugin-sdk/{slack-xvIVvyEM.js → slack-BouRQG-W.js} +64 -68
  308. package/dist/plugin-sdk/{slack-actions-BNIALJTA.js → slack-actions-CasHVtiq.js} +20 -21
  309. package/dist/plugin-sdk/slack.d.ts +5 -5
  310. package/dist/plugin-sdk/slack.js +13 -13
  311. package/dist/plugin-sdk/{ssrf-BZG8Ztod.js → ssrf-fG4UHKBw.js} +180 -2
  312. package/dist/plugin-sdk/{sticker-cache-D3oDiu2u.js → sticker-cache-BvGEUas3.js} +3 -3
  313. package/dist/plugin-sdk/{tables-DS5L7lCA.js → tables-CjlQJV4r.js} +2 -2
  314. package/dist/plugin-sdk/{device-pairing-D2Yq-_U6.js → tailscale-status-DwpNdO3Z.js} +104 -2
  315. package/dist/plugin-sdk/{targets-D6lUomJc.js → targets-QfP164Dh.js} +2 -2
  316. package/dist/plugin-sdk/{telegram-actions-MSFkDn0m.js → telegram-actions-CwYjV6Db.js} +48 -52
  317. package/dist/plugin-sdk/telegram.d.ts +5 -5
  318. package/dist/plugin-sdk/telegram.js +11 -11
  319. package/dist/plugin-sdk/{thread-bindings.lifecycle-Ry6Vcgw3.js → thread-bindings.lifecycle-DU4iX_Jr.js} +3 -3
  320. package/dist/plugin-sdk/{thread-bindings.state-C0stmvNk.js → thread-bindings.state-BgYWFjNF.js} +2 -2
  321. package/dist/plugin-sdk/{tmp-fased-dir-D91GExk4.d.ts → tmp-fased-dir-BdFQvrvw.d.ts} +2 -2
  322. package/dist/plugin-sdk/{types-DVTIpopt.d.ts → types-BYDL6dQj.d.ts} +2 -2
  323. package/dist/plugin-sdk/{types-DKvBJHfH.d.ts → types-CLIvQaVg.d.ts} +26 -1
  324. package/dist/plugin-sdk/{types-BzadOItY.d.ts → types-DyhXnYUr.d.ts} +1 -1
  325. package/dist/plugin-sdk/{types.plugin-BiHPaDTF.d.ts → types.plugin-_fbu40Re.d.ts} +7 -5
  326. package/dist/plugin-sdk/{web-DRNJxHXA.js → web-D0yENDve.js} +52 -56
  327. package/dist/plugin-sdk/{whatsapp-actions-BDXZF2R5.js → whatsapp-actions-BT2nPLyo.js} +18 -19
  328. package/dist/plugin-sdk/{whatsapp-heartbeat-CKgmwCGr.js → whatsapp-heartbeat-CiABSZ6G.js} +2 -2
  329. package/dist/plugin-sdk/whatsapp.d.ts +5 -5
  330. package/dist/plugin-sdk/whatsapp.js +14 -14
  331. package/dist/plugin-sdk/{wsl-Biw7Mj39.js → wsl-B_ojyEtC.js} +53 -53
  332. package/dist/plugins/bundled-dir.js +3 -3
  333. package/dist/plugins/discovery.js +11 -11
  334. package/dist/plugins/loader.js +13 -13
  335. package/dist/plugins/manifest-registry.js +2 -2
  336. package/dist/plugins/manifest.js +4 -4
  337. package/dist/plugins/path-safety.js +3 -3
  338. package/dist/plugins/runtime/index.js +1 -1
  339. package/dist/plugins/status-cache.js +9 -9
  340. package/dist/plugins/update.js +3 -3
  341. package/dist/plugins/web-search-install-catalog.js +3 -3
  342. package/dist/providers/github-copilot-model-discovery.js +51 -0
  343. package/dist/providers/openai-codex-model-discovery.js +166 -0
  344. package/dist/providers/refresh.js +116 -34
  345. package/dist/providers/registry.js +2 -2
  346. package/dist/providers/runtime-model-catalog.js +97 -28
  347. package/dist/secrets/apply.js +16 -16
  348. package/dist/secrets/audit.js +11 -11
  349. package/dist/secrets/shared.js +9 -9
  350. package/dist/security/scan-paths.js +2 -2
  351. package/dist/shared/config-eval.js +2 -2
  352. package/dist/shared/model-thinking.js +13 -2
  353. package/dist/shared/pid-alive.js +2 -2
  354. package/dist/tasks/standing-orders.js +5 -5
  355. package/dist/tasks/task-flow-registry.js +5 -5
  356. package/dist/tasks/task-registry.js +5 -5
  357. package/dist/tasks/workflow-definitions.js +6 -6
  358. package/dist/telegram/bot-message-context.js +1 -1
  359. package/dist/telegram/token.js +5 -5
  360. package/dist/utils.js +5 -5
  361. package/dist/wallet/local-socket-signer-broker.js +16 -16
  362. package/dist/wallet/providers/embedded-keystore-adapter.js +5 -5
  363. package/dist/wallet/providers/local-socket-signer-adapter.js +2 -2
  364. package/dist/wallet/wallet-approval-auth.js +5 -5
  365. package/dist/wallet/wallet-audit-log.js +5 -5
  366. package/dist/wallet/wallet-custody.js +21 -21
  367. package/dist/wallet/wallet-inbound-events.js +5 -5
  368. package/dist/wallet/wallet-observability.js +5 -5
  369. package/dist/wallet/wallet-policy.js +9 -9
  370. package/dist/wallet/wallet-provider-registry.js +7 -7
  371. package/dist/wallet/wallet-runtime-config.js +3 -3
  372. package/dist/wallet/wallet-secrets-store.js +22 -22
  373. package/dist/wallet/wallet-send-approvals.js +5 -5
  374. package/dist/wallet/wallet-settlement-links.js +5 -5
  375. package/dist/web/accounts.js +3 -3
  376. package/dist/web/auth-store.js +18 -18
  377. package/dist/web/session.js +4 -4
  378. package/dist/wizard/host-security-capability.js +2 -2
  379. package/dist/wizard/onboarding.host-security.js +7 -7
  380. package/dist/wizard/onboarding.js +7 -7
  381. package/dist/wizard/onboarding.wallet.js +44 -44
  382. package/extensions/acpx/package.json +1 -1
  383. package/extensions/bluebubbles/package.json +1 -1
  384. package/extensions/copilot-proxy/package.json +1 -1
  385. package/extensions/diagnostics-otel/package.json +1 -1
  386. package/extensions/fased-federation/package.json +1 -1
  387. package/extensions/google-gemini-cli-auth/package.json +1 -1
  388. package/extensions/imessage/package.json +1 -1
  389. package/extensions/irc/package.json +1 -1
  390. package/extensions/line/package.json +1 -1
  391. package/extensions/llm-task/package.json +1 -1
  392. package/extensions/lobster/package.json +1 -1
  393. package/extensions/matrix/CHANGELOG.md +6 -0
  394. package/extensions/matrix/package.json +1 -1
  395. package/extensions/mattermost/package.json +1 -1
  396. package/extensions/memory-core/package.json +2 -2
  397. package/extensions/memory-lancedb/package.json +1 -1
  398. package/extensions/minimax-portal-auth/package.json +1 -1
  399. package/extensions/msteams/CHANGELOG.md +6 -0
  400. package/extensions/msteams/package.json +1 -1
  401. package/extensions/nextcloud-talk/package.json +1 -1
  402. package/extensions/nostr/CHANGELOG.md +6 -0
  403. package/extensions/nostr/package.json +1 -1
  404. package/extensions/open-prose/package.json +1 -1
  405. package/extensions/sat-mining/package.json +1 -1
  406. package/extensions/signal/package.json +1 -1
  407. package/extensions/synology-chat/package.json +1 -1
  408. package/extensions/tlon/package.json +1 -1
  409. package/extensions/twitch/CHANGELOG.md +6 -0
  410. package/extensions/twitch/package.json +1 -1
  411. package/extensions/voice-call/CHANGELOG.md +6 -0
  412. package/extensions/voice-call/package.json +1 -1
  413. package/extensions/zalo/CHANGELOG.md +6 -0
  414. package/extensions/zalo/package.json +1 -1
  415. package/extensions/zalouser/CHANGELOG.md +6 -0
  416. package/extensions/zalouser/package.json +1 -1
  417. package/package.json +2 -1
  418. package/dist/control-ui/assets/chat-model-ref-BZFblCeY.js +0 -2
  419. package/dist/plugin-sdk/ip-C70a-YlD.js +0 -181
  420. package/dist/plugin-sdk/tailscale-status-ClsquRGs.js +0 -104
  421. package/dist/plugin-sdk/wallet-status-f0HagNeO.js +0 -11947
  422. package/dist/plugin-sdk/ws-CocpWGhl.js +0 -114
  423. /package/dist/plugin-sdk/{blocks-input-Dcitfh7h.js → blocks-input-Bg-8S2pl.js} +0 -0
  424. /package/dist/plugin-sdk/{channel-activity-Cg1xRoc2.js → channel-activity-DBDMQ3yI.js} +0 -0
  425. /package/dist/plugin-sdk/{channel-core-BOkyXXLa.js → channel-core-CFRs8LPy.js} +0 -0
  426. /package/dist/plugin-sdk/{client-D2N7hqVu.js → client-pI228AVT.js} +0 -0
  427. /package/dist/plugin-sdk/{command-poll-backoff-NAePk3eL.js → command-poll-backoff-yJU83wEq.js} +0 -0
  428. /package/dist/plugin-sdk/{date-time-CE3Uer3C.js → date-time-uUevHscU.js} +0 -0
  429. /package/dist/plugin-sdk/{diagnostic-session-state-HO94DMou.js → diagnostic-session-state-DqgfGYqZ.js} +0 -0
  430. /package/dist/plugin-sdk/{draft-stream-loop-CKyHn8IX.js → draft-stream-loop-CrOPfV3F.js} +0 -0
  431. /package/dist/plugin-sdk/{fetch-Cu-ahkie.js → fetch-BtmoPIlf.js} +0 -0
  432. /package/dist/plugin-sdk/{gateway-registry-DFsoY6C0.js → gateway-registry-DZDsqicG.js} +0 -0
  433. /package/dist/plugin-sdk/{inbound-context-BFnIdcqI.js → inbound-context-DrAcXE0y.js} +0 -0
  434. /package/dist/plugin-sdk/{internal-qo16nNU1.js → internal-CG_nHo-2.js} +0 -0
  435. /package/dist/plugin-sdk/{memory-search-C3C0bD2H.js → memory-search-VFll-AIb.js} +0 -0
  436. /package/dist/plugin-sdk/{pairing-token-N_6Jbt1L.js → pairing-token-Cs3BRKc0.js} +0 -0
  437. /package/dist/plugin-sdk/{path-alias-guards-Dg3gU-MA.js → path-alias-guards-BJZD5JMJ.js} +0 -0
  438. /package/dist/plugin-sdk/{polls-DQrR-qT3.js → polls-DKQXVfJp.js} +0 -0
  439. /package/dist/plugin-sdk/{proxy-7xs_rsnV.js → proxy-DWpYcsvR.js} +0 -0
  440. /package/dist/plugin-sdk/{qmd-scope-D1sSG_Rx.js → qmd-scope-CdX34VCV.js} +0 -0
  441. /package/dist/plugin-sdk/{redact-identifier-Q3tkvxhm.js → redact-identifier-Lt7t3l7S.js} +0 -0
  442. /package/dist/plugin-sdk/{redact-sensitive-url-dPvnFFsK.js → redact-sensitive-url-g-ukZjwA.js} +0 -0
  443. /package/dist/plugin-sdk/{render-Bwu_WxwA.js → render-e7fENCYH.js} +0 -0
  444. /package/dist/plugin-sdk/{reply-prefix-Bqzm6DC1.js → reply-prefix-ClpxvL_w.js} +0 -0
  445. /package/dist/plugin-sdk/{reply-reference-BkbK_DWT.js → reply-reference-Bqk-7HXE.js} +0 -0
  446. /package/dist/plugin-sdk/{secure-random-Bl-AVLVb.js → secure-random-BIkG-k4s.js} +0 -0
  447. /package/dist/plugin-sdk/{shared-clhhbWN3.js → shared-CBgp_GBw.js} +0 -0
  448. /package/dist/plugin-sdk/{target-errors-C_SVKoEv.js → target-errors-Ckufe179.js} +0 -0
  449. /package/dist/plugin-sdk/{targets-BDvvnlph.js → targets-CoMJ1ry1.js} +0 -0
  450. /package/dist/plugin-sdk/{tokens-BvtlOzVP.js → tokens-BbnqfVuu.js} +0 -0
  451. /package/dist/plugin-sdk/{tool-loop-detection-CWphm1k_.js → tool-loop-detection-Bp8bPJLs.js} +0 -0
  452. /package/dist/plugin-sdk/{ui-e020ouhJ.js → ui-Be8cLHIS.js} +0 -0
  453. /package/dist/plugin-sdk/{with-timeout-BYrRAYFV.js → with-timeout-ckWB8rTo.js} +0 -0
@@ -1,5 +1,14 @@
1
+ import { resolveFasedAgentAgentDir } from "../agent-paths.js";
2
+ import { ensureAuthProfileStore } from "../auth-profiles/store.js";
3
+ import { listProfilesForProvider } from "../auth-profiles/profiles.js";
4
+ import { resolveApiKeyForProfile } from "../auth-profiles/oauth.js";
5
+ import "../auth-profiles.js";
6
+ import { createOpenAICodexAppServerStreamFn } from "../openai-codex-app-server.js";
1
7
  import { log } from "./logger.js";
8
+ import { createMoonshotThinkingWrapper, resolveMoonshotThinkingType } from "./moonshot-stream-wrappers.js";
9
+ import { createOpenAIResponsesContextManagementWrapper } from "./openai-stream-wrappers.js";
2
10
  import { streamSimple } from "@mariozechner/pi-ai/compat";
11
+ import WebSocket$1 from "ws";
3
12
 
4
13
  //#region src/agents/pi-embedded-runner/extra-params.ts
5
14
  const OPENROUTER_APP_HEADERS = {
@@ -8,8 +17,6 @@ const OPENROUTER_APP_HEADERS = {
8
17
  };
9
18
  const ANTHROPIC_CONTEXT_1M_BETA = "context-1m-2025-08-07";
10
19
  const ANTHROPIC_1M_MODEL_PREFIXES = ["claude-opus-4", "claude-sonnet-4"];
11
- const OPENAI_RESPONSES_APIS = new Set(["openai-responses"]);
12
- const OPENAI_RESPONSES_PROVIDERS = new Set(["openai"]);
13
20
  const defaultProviderRuntimeDeps = {
14
21
  prepareProviderExtraParams: ({ context }) => context.extraParams,
15
22
  wrapProviderStreamFn: ({ context }) => context.streamFn
@@ -21,6 +28,30 @@ function sanitizeExtraParams(input) {
21
28
  }
22
29
  return Object.fromEntries(Object.entries(input).filter(([key, value]) => value !== undefined && key !== "__proto__" && key !== "constructor" && key !== "prototype"));
23
30
  }
31
+ function normalizeExtraParamAliases(input) {
32
+ const normalized = sanitizeExtraParams(input);
33
+ if (Object.hasOwn(normalized, "parallelToolCalls")) {
34
+ normalized.parallel_tool_calls = normalized.parallelToolCalls;
35
+ delete normalized.parallelToolCalls;
36
+ }
37
+ if (Object.hasOwn(normalized, "textVerbosity")) {
38
+ normalized.text_verbosity = normalized.textVerbosity;
39
+ delete normalized.textVerbosity;
40
+ }
41
+ return normalized;
42
+ }
43
+ function defaultExtraParams(provider, modelId) {
44
+ const normalizedProvider = provider.trim().toLowerCase();
45
+ const normalizedModel = modelId.trim().toLowerCase();
46
+ if (normalizedProvider === "openai" && /^gpt-5(?:\.|$|-)/.test(normalizedModel)) {
47
+ return {
48
+ parallel_tool_calls: true,
49
+ text_verbosity: "low",
50
+ openaiWsWarmup: true
51
+ };
52
+ }
53
+ return {};
54
+ }
24
55
  const testing = {
25
56
  setProviderRuntimeDepsForTest(deps) {
26
57
  providerRuntimeDeps.prepareProviderExtraParams = deps?.prepareProviderExtraParams ?? defaultProviderRuntimeDeps.prepareProviderExtraParams;
@@ -37,18 +68,35 @@ const testing = {
37
68
  *
38
69
  * @internal Exported for testing only
39
70
  */
40
- function resolveExtraParams(params) {
71
+ function resolveConfiguredExtraParams(params) {
41
72
  const modelKey = `${params.provider}/${params.modelId}`;
42
73
  const modelConfig = params.cfg?.agents?.defaults?.models?.[modelKey];
43
- const globalParams = modelConfig?.params ? { ...modelConfig.params } : undefined;
44
- const agentParams = params.agentId && params.cfg?.agents?.list ? params.cfg.agents.list.find((agent) => agent.id === params.agentId)?.params : undefined;
45
- if (!globalParams && !agentParams) {
74
+ const globalParams = modelConfig?.params ? normalizeExtraParamAliases(modelConfig.params) : undefined;
75
+ const rawAgentParams = params.agentId && params.cfg?.agents?.list ? params.cfg.agents.list.find((agent) => agent.id === params.agentId)?.params : undefined;
76
+ const agentParams = rawAgentParams ? normalizeExtraParamAliases(rawAgentParams) : undefined;
77
+ const defaults = defaultExtraParams(params.provider, params.modelId);
78
+ if (Object.keys(defaults).length === 0 && !globalParams && !agentParams) {
46
79
  return undefined;
47
80
  }
48
- return Object.assign({}, globalParams, agentParams);
81
+ return Object.assign({}, defaults, globalParams, agentParams);
82
+ }
83
+ function resolveExtraParams(params) {
84
+ const configured = resolveConfiguredExtraParams(params);
85
+ const prepared = providerRuntimeDeps.prepareProviderExtraParams({
86
+ provider: params.provider,
87
+ modelId: params.modelId,
88
+ config: params.cfg,
89
+ context: {
90
+ config: params.cfg,
91
+ provider: params.provider,
92
+ modelId: params.modelId,
93
+ extraParams: configured
94
+ }
95
+ });
96
+ return prepared ?? configured;
49
97
  }
50
98
  function resolvePreparedExtraParams(params) {
51
- const extraParams = resolveExtraParams({
99
+ const extraParams = resolveConfiguredExtraParams({
52
100
  cfg: params.cfg,
53
101
  provider: params.provider,
54
102
  modelId: params.modelId,
@@ -56,7 +104,7 @@ function resolvePreparedExtraParams(params) {
56
104
  });
57
105
  const merged = {
58
106
  ...sanitizeExtraParams(extraParams),
59
- ...sanitizeExtraParams(params.extraParamsOverride)
107
+ ...normalizeExtraParamAliases(params.extraParamsOverride)
60
108
  };
61
109
  const prepared = providerRuntimeDeps.prepareProviderExtraParams({
62
110
  provider: params.provider,
@@ -101,10 +149,6 @@ function resolveAgentTransportOverride(params) {
101
149
  * Defaults to "short" for direct Anthropic when not explicitly configured.
102
150
  */
103
151
  function resolveCacheRetention(extraParams, provider) {
104
- const isAnthropicDirect = provider === "anthropic";
105
- if (!isAnthropicDirect) {
106
- return undefined;
107
- }
108
152
  const newVal = extraParams?.cacheRetention;
109
153
  if (newVal === "none" || newVal === "short" || newVal === "long") {
110
154
  return newVal;
@@ -116,10 +160,7 @@ function resolveCacheRetention(extraParams, provider) {
116
160
  if (legacy === "1h") {
117
161
  return "long";
118
162
  }
119
- if (!isAnthropicDirect) {
120
- return undefined;
121
- }
122
- return "short";
163
+ return provider === "anthropic" ? "short" : undefined;
123
164
  }
124
165
  function createStreamFnWithExtraParams(baseStreamFn, extraParams, provider) {
125
166
  if (!extraParams || Object.keys(extraParams).length === 0) {
@@ -132,6 +173,9 @@ function createStreamFnWithExtraParams(baseStreamFn, extraParams, provider) {
132
173
  if (typeof extraParams.maxTokens === "number") {
133
174
  streamParams.maxTokens = extraParams.maxTokens;
134
175
  }
176
+ if (typeof extraParams.openaiWsWarmup === "boolean") {
177
+ streamParams.openaiWsWarmup = extraParams.openaiWsWarmup;
178
+ }
135
179
  const transport = extraParams.transport;
136
180
  if (transport === "sse" || transport === "websocket" || transport === "auto") {
137
181
  streamParams.transport = transport;
@@ -167,6 +211,36 @@ function createStreamFnWithExtraParams(baseStreamFn, extraParams, provider) {
167
211
  };
168
212
  return wrappedStreamFn;
169
213
  }
214
+ function createParallelToolCallsWrapper(baseStreamFn, value) {
215
+ if (value === undefined || value === null) {
216
+ return undefined;
217
+ }
218
+ if (typeof value !== "boolean") {
219
+ const rendered = typeof value === "string" || typeof value === "number" || typeof value === "bigint" ? String(value) : JSON.stringify(value) ?? typeof value;
220
+ log.warn(`ignoring invalid parallel_tool_calls param: ${rendered}`);
221
+ return undefined;
222
+ }
223
+ const underlying = baseStreamFn ?? streamSimple;
224
+ return (model, context, options) => {
225
+ const supported = model.api === "openai-completions" || model.api === "openai-responses" || model.api === "azure-openai-responses";
226
+ if (!supported) {
227
+ return underlying(model, context, options);
228
+ }
229
+ const originalOnPayload = options?.onPayload;
230
+ return underlying(model, context, {
231
+ ...options,
232
+ onPayload: (payload) => {
233
+ if (payload && typeof payload === "object") {
234
+ payload.parallel_tool_calls = value;
235
+ }
236
+ return originalOnPayload?.(payload);
237
+ }
238
+ });
239
+ };
240
+ }
241
+ function isOllamaKimiCloudModel(provider, modelId) {
242
+ return provider === "ollama" && /^kimi(?:[-:]|$)/i.test(modelId) && /:cloud$/i.test(modelId);
243
+ }
170
244
  function isDirectOpenAIBaseUrl(baseUrl) {
171
245
  if (typeof baseUrl !== "string" || !baseUrl.trim()) {
172
246
  return false;
@@ -179,21 +253,6 @@ function isDirectOpenAIBaseUrl(baseUrl) {
179
253
  return normalized.includes("api.openai.com") || normalized.includes("chatgpt.com") || normalized.includes(".openai.azure.com");
180
254
  }
181
255
  }
182
- function shouldForceResponsesStore(model) {
183
- if (model.compat?.supportsStore === false) {
184
- return false;
185
- }
186
- if (typeof model.api !== "string" || typeof model.provider !== "string") {
187
- return false;
188
- }
189
- if (!OPENAI_RESPONSES_APIS.has(model.api)) {
190
- return false;
191
- }
192
- if (!OPENAI_RESPONSES_PROVIDERS.has(model.provider)) {
193
- return false;
194
- }
195
- return isDirectOpenAIBaseUrl(model.baseUrl);
196
- }
197
256
  function parsePositiveInteger(value) {
198
257
  if (typeof value === "number" && Number.isFinite(value) && value > 0) {
199
258
  return Math.floor(value);
@@ -298,56 +357,6 @@ function resolveOpenRouterResponseCacheHeaders(params) {
298
357
  }
299
358
  return Object.keys(headers).length > 0 ? headers : undefined;
300
359
  }
301
- function resolveOpenAIResponsesCompactThreshold(model) {
302
- const contextWindow = parsePositiveInteger(model.contextWindow);
303
- if (contextWindow) {
304
- return Math.max(1e3, Math.floor(contextWindow * .7));
305
- }
306
- return 8e4;
307
- }
308
- function shouldEnableOpenAIResponsesServerCompaction(model, extraParams) {
309
- const configured = extraParams?.responsesServerCompaction;
310
- if (configured === false) {
311
- return false;
312
- }
313
- if (!shouldForceResponsesStore(model)) {
314
- return false;
315
- }
316
- if (configured === true) {
317
- return true;
318
- }
319
- return model.provider === "openai";
320
- }
321
- function createOpenAIResponsesContextManagementWrapper(baseStreamFn, extraParams) {
322
- const underlying = baseStreamFn ?? streamSimple;
323
- return (model, context, options) => {
324
- const forceStore = shouldForceResponsesStore(model);
325
- const useServerCompaction = shouldEnableOpenAIResponsesServerCompaction(model, extraParams);
326
- if (!forceStore && !useServerCompaction) {
327
- return underlying(model, context, options);
328
- }
329
- const compactThreshold = parsePositiveInteger(extraParams?.responsesCompactThreshold) ?? resolveOpenAIResponsesCompactThreshold(model);
330
- const originalOnPayload = options?.onPayload;
331
- return underlying(model, context, {
332
- ...options,
333
- onPayload: (payload) => {
334
- if (payload && typeof payload === "object") {
335
- const payloadObj = payload;
336
- if (forceStore) {
337
- payloadObj.store = true;
338
- }
339
- if (useServerCompaction && payloadObj.context_management === undefined) {
340
- payloadObj.context_management = [{
341
- type: "compaction",
342
- compact_threshold: compactThreshold
343
- }];
344
- }
345
- }
346
- originalOnPayload?.(payload);
347
- }
348
- });
349
- };
350
- }
351
360
  function createOpenAIReasoningEffortWrapper(baseStreamFn, reasoningEffort) {
352
361
  const underlying = baseStreamFn ?? streamSimple;
353
362
  return (model, context, options) => {
@@ -374,10 +383,45 @@ function createOpenAIReasoningEffortWrapper(baseStreamFn, reasoningEffort) {
374
383
  }
375
384
  function createCodexDefaultTransportWrapper(baseStreamFn) {
376
385
  const underlying = baseStreamFn ?? streamSimple;
377
- return (model, context, options) => underlying(model, context, {
378
- ...options,
379
- transport: options?.transport ?? "auto"
380
- });
386
+ return (model, context, options) => {
387
+ if (typeof process !== "undefined" && process.versions?.node) {
388
+ globalThis.WebSocket = WebSocket$1;
389
+ }
390
+ return underlying(model, context, {
391
+ ...options,
392
+ transport: options?.transport ?? "auto"
393
+ });
394
+ };
395
+ }
396
+ function usesCodexResponsesLite(model) {
397
+ const candidate = model;
398
+ return candidate.api === "openai-codex-responses" && candidate.compat?.responsesLite === true;
399
+ }
400
+ function createCodexResponsesLiteWrapper(baseStreamFn, params) {
401
+ const underlying = baseStreamFn ?? streamSimple;
402
+ const appServer = createOpenAICodexAppServerStreamFn({ resolveToken: async () => {
403
+ if (params?.resolvedApiKey?.trim()) {
404
+ return params.resolvedApiKey.trim();
405
+ }
406
+ const agentDir = params?.agentDir ?? resolveFasedAgentAgentDir();
407
+ const store = ensureAuthProfileStore(agentDir, { allowKeychainPrompt: false });
408
+ const profileId = listProfilesForProvider(store, "openai-codex")[0];
409
+ if (!profileId) {
410
+ return undefined;
411
+ }
412
+ return (await resolveApiKeyForProfile({
413
+ cfg: params?.cfg ?? {},
414
+ store,
415
+ profileId,
416
+ agentDir
417
+ }))?.apiKey;
418
+ } });
419
+ return (model, context, options) => {
420
+ if (!usesCodexResponsesLite(model)) {
421
+ return underlying(model, context, options);
422
+ }
423
+ return appServer(model, context, options);
424
+ };
381
425
  }
382
426
  function isAnthropic1MModel(modelId) {
383
427
  const normalized = modelId.trim().toLowerCase();
@@ -757,8 +801,8 @@ function createZaiToolStreamWrapper(baseStreamFn, enabled) {
757
801
  *
758
802
  * @internal Exported for testing
759
803
  */
760
- function applyExtraParamsToAgent(agent, cfg, provider, modelId, extraParamsOverride, thinkingLevel, agentId, agentDir, model) {
761
- const extraParams = resolveExtraParams({
804
+ function applyExtraParamsToAgent(agent, cfg, provider, modelId, extraParamsOverride, thinkingLevel, agentId, agentDir, model, resolvedApiKey) {
805
+ const extraParams = resolveConfiguredExtraParams({
762
806
  cfg,
763
807
  provider,
764
808
  modelId,
@@ -766,8 +810,13 @@ function applyExtraParamsToAgent(agent, cfg, provider, modelId, extraParamsOverr
766
810
  });
767
811
  if (provider === "openai-codex") {
768
812
  agent.streamFn = createCodexDefaultTransportWrapper(agent.streamFn);
813
+ agent.streamFn = createCodexResponsesLiteWrapper(agent.streamFn, {
814
+ cfg,
815
+ agentDir,
816
+ resolvedApiKey
817
+ });
769
818
  }
770
- const merged = Object.assign({}, sanitizeExtraParams(extraParams), sanitizeExtraParams(extraParamsOverride));
819
+ const merged = Object.assign({}, sanitizeExtraParams(extraParams), normalizeExtraParamAliases(extraParamsOverride));
771
820
  const preparedProviderExtraParams = providerRuntimeDeps.prepareProviderExtraParams({
772
821
  provider,
773
822
  modelId,
@@ -783,6 +832,7 @@ function applyExtraParamsToAgent(agent, cfg, provider, modelId, extraParamsOverr
783
832
  }
784
833
  });
785
834
  const effectiveProviderExtraParams = preparedProviderExtraParams ?? merged;
835
+ const streamFnBeforeProviderHook = agent.streamFn;
786
836
  const providerWrappedStreamFn = providerRuntimeDeps.wrapProviderStreamFn({
787
837
  provider,
788
838
  config: cfg,
@@ -805,12 +855,17 @@ function applyExtraParamsToAgent(agent, cfg, provider, modelId, extraParamsOverr
805
855
  if (providerWrappedStreamFn) {
806
856
  agent.streamFn = providerWrappedStreamFn;
807
857
  }
808
- const wrappedStreamFn = createStreamFnWithExtraParams(agent.streamFn, merged, provider);
858
+ const providerRuntimeHandled = providerWrappedStreamFn !== undefined && providerWrappedStreamFn !== streamFnBeforeProviderHook;
859
+ const wrappedStreamFn = createStreamFnWithExtraParams(agent.streamFn, effectiveProviderExtraParams, provider);
809
860
  if (wrappedStreamFn) {
810
861
  log.debug(`applying extraParams to agent streamFn for ${provider}/${modelId}`);
811
862
  agent.streamFn = wrappedStreamFn;
812
863
  }
813
- const anthropicBetas = resolveAnthropicBetas(merged, provider, modelId);
864
+ const parallelToolCalls = createParallelToolCallsWrapper(agent.streamFn, effectiveProviderExtraParams.parallel_tool_calls);
865
+ if (parallelToolCalls) {
866
+ agent.streamFn = parallelToolCalls;
867
+ }
868
+ const anthropicBetas = resolveAnthropicBetas(effectiveProviderExtraParams, provider, modelId);
814
869
  if (anthropicBetas?.length) {
815
870
  log.debug(`applying Anthropic beta header for ${provider}/${modelId}: ${anthropicBetas.join(",")}`);
816
871
  agent.streamFn = createAnthropicBetaHeadersWrapper(agent.streamFn, anthropicBetas);
@@ -823,12 +878,21 @@ function applyExtraParamsToAgent(agent, cfg, provider, modelId, extraParamsOverr
823
878
  log.debug(`normalizing thinking=off to thinking=null for SiliconFlow compatibility (${provider}/${modelId})`);
824
879
  agent.streamFn = createSiliconFlowThinkingWrapper(agent.streamFn);
825
880
  }
826
- if (provider === "openrouter") {
881
+ if (provider === "openrouter" && !providerRuntimeHandled) {
827
882
  log.debug(`applying OpenRouter app attribution headers for ${provider}/${modelId}`);
828
883
  const openRouterThinkingLevel = modelId === "auto" ? undefined : thinkingLevel;
829
- agent.streamFn = createOpenRouterWrapper(agent.streamFn, openRouterThinkingLevel, resolveOpenRouterResponseCacheConfig(merged));
884
+ agent.streamFn = createOpenRouterWrapper(agent.streamFn, openRouterThinkingLevel, resolveOpenRouterResponseCacheConfig(effectiveProviderExtraParams));
830
885
  agent.streamFn = createOpenRouterSystemCacheWrapper(agent.streamFn);
831
886
  }
887
+ if (provider === "moonshot" || isOllamaKimiCloudModel(provider, modelId)) {
888
+ const configuredThinking = effectiveProviderExtraParams.thinking;
889
+ const hasPinnedToolChoice = model && typeof model === "object" && "tool_choice" in model && typeof model.tool_choice === "object";
890
+ const thinkingType = hasPinnedToolChoice ? "disabled" : resolveMoonshotThinkingType({
891
+ configuredThinking,
892
+ thinkingLevel
893
+ });
894
+ agent.streamFn = createMoonshotThinkingWrapper(agent.streamFn, thinkingType);
895
+ }
832
896
  if (provider === "zai" || provider === "z-ai") {
833
897
  const toolStreamEnabled = merged?.tool_stream !== false;
834
898
  if (toolStreamEnabled) {
@@ -837,9 +901,9 @@ function applyExtraParamsToAgent(agent, cfg, provider, modelId, extraParamsOverr
837
901
  }
838
902
  }
839
903
  agent.streamFn = createGoogleThinkingPayloadWrapper(agent.streamFn, thinkingLevel);
840
- agent.streamFn = createOpenAIResponsesContextManagementWrapper(agent.streamFn, merged);
904
+ agent.streamFn = createOpenAIResponsesContextManagementWrapper(agent.streamFn, effectiveProviderExtraParams);
841
905
  agent.streamFn = createOpenAIReasoningEffortWrapper(agent.streamFn, thinkingLevel);
842
906
  }
843
907
 
844
908
  //#endregion
845
- export { applyExtraParamsToAgent, resolveExtraParams };
909
+ export { applyExtraParamsToAgent };
@@ -2,9 +2,13 @@ import { isOpenAISignInRuntimeModelSupported } from "../../providers/registry.js
2
2
  import { DEFAULT_CONTEXT_TOKENS } from "../defaults.js";
3
3
  import { isPrivateNetworkBaseUrl } from "../../utils/private-network-url.js";
4
4
  import { resolveFasedAgentAgentDir } from "../agent-paths.js";
5
+ import { ensureAuthProfileStore } from "../auth-profiles/store.js";
6
+ import "../auth-profiles.js";
5
7
  import { normalizeProviderId } from "../model-selection.js";
6
8
  import { discoverAuthStorage, discoverModels } from "../pi-model-discovery.js";
9
+ import { resolveAuthenticatedModelCatalog } from "../authenticated-model-catalog.js";
7
10
  import { buildModelAliasLines } from "../model-alias-lines.js";
11
+ import { loadModelCatalog } from "../model-catalog.js";
8
12
  import { normalizeModelCompat } from "../model-compat.js";
9
13
  import { resolveForwardCompatModel } from "../model-forward-compat.js";
10
14
  import { attachModelProviderRequestTransport, sanitizeConfiguredModelProviderRequest } from "../provider-request-config.js";
@@ -143,6 +147,63 @@ function resolveModel(provider, modelId, agentDir, cfg) {
143
147
  modelRegistry
144
148
  };
145
149
  }
150
+ async function resolveModelForExecution(provider, modelId, agentDir, cfg) {
151
+ const resolvedAgentDir = agentDir ?? resolveFasedAgentAgentDir();
152
+ const fallback = resolveModel(provider, modelId, resolvedAgentDir, cfg);
153
+ if (!cfg) {
154
+ return fallback;
155
+ }
156
+ try {
157
+ const store = ensureAuthProfileStore(resolvedAgentDir, { allowKeychainPrompt: false });
158
+ const catalog = await loadModelCatalog({
159
+ config: cfg,
160
+ includeMetadata: true
161
+ });
162
+ const authenticated = await resolveAuthenticatedModelCatalog({
163
+ cfg,
164
+ store,
165
+ catalog,
166
+ defaultProvider: provider,
167
+ agentDir: resolvedAgentDir
168
+ });
169
+ const normalizedProvider = normalizeProviderId(provider);
170
+ const normalizedModelId = modelId.trim().toLowerCase();
171
+ const entry = authenticated.usableCatalog.find((candidate) => normalizeProviderId(candidate.provider) === normalizedProvider && candidate.id.trim().toLowerCase() === normalizedModelId);
172
+ if (!entry) {
173
+ return fallback;
174
+ }
175
+ const template = fallback.model;
176
+ const model = normalizeModelCompat({
177
+ ...template,
178
+ id: entry.id,
179
+ name: entry.name,
180
+ provider: entry.provider,
181
+ api: entry.api ?? template?.api,
182
+ baseUrl: entry.baseUrl ?? template?.baseUrl,
183
+ reasoning: entry.reasoning ?? template?.reasoning ?? false,
184
+ input: entry.input ?? template?.input ?? ["text"],
185
+ contextWindow: entry.contextWindow ?? template?.contextWindow ?? DEFAULT_CONTEXT_TOKENS,
186
+ maxTokens: entry.maxTokens ?? template?.maxTokens ?? DEFAULT_CONTEXT_TOKENS,
187
+ cost: entry.cost ?? template?.cost ?? {
188
+ input: 0,
189
+ output: 0,
190
+ cacheRead: 0,
191
+ cacheWrite: 0
192
+ },
193
+ compat: {
194
+ ...template?.compat,
195
+ ...entry.compat
196
+ }
197
+ });
198
+ return {
199
+ ...fallback,
200
+ model: attachConfiguredProviderRequest(model, cfg),
201
+ error: undefined
202
+ };
203
+ } catch {
204
+ return fallback;
205
+ }
206
+ }
146
207
  function resolveModelWithRegistry(params) {
147
208
  const normalizedProvider = normalizeProviderId(params.provider);
148
209
  const runtimeModelId = params.modelId.trim();
@@ -174,4 +235,4 @@ function buildUnknownModelError(provider, modelId) {
174
235
  }
175
236
 
176
237
  //#endregion
177
- export { buildInlineProviderModels, buildModelAliasLines, resolveModel, resolveModelWithRegistry };
238
+ export { buildInlineProviderModels, buildModelAliasLines, resolveModel, resolveModelForExecution, resolveModelWithRegistry };
@@ -0,0 +1,46 @@
1
+ import { streamSimple } from "@mariozechner/pi-ai/compat";
2
+
3
+ //#region src/agents/pi-embedded-runner/moonshot-stream-wrappers.ts
4
+ function resolveMoonshotThinkingType(params) {
5
+ if (params.configuredThinking && typeof params.configuredThinking === "object" && !Array.isArray(params.configuredThinking)) {
6
+ const type = params.configuredThinking.type;
7
+ if (type === "enabled" || type === "disabled") {
8
+ return type;
9
+ }
10
+ }
11
+ if (params.configuredThinking === "enabled" || params.configuredThinking === true) {
12
+ return "enabled";
13
+ }
14
+ if (params.configuredThinking === "disabled" || params.configuredThinking === false) {
15
+ return "disabled";
16
+ }
17
+ return params.thinkingLevel && params.thinkingLevel !== "off" ? "enabled" : "disabled";
18
+ }
19
+ function createMoonshotThinkingWrapper(baseStreamFn, thinkingType) {
20
+ const underlying = baseStreamFn ?? streamSimple;
21
+ return (model, context, options) => underlying(model, context, {
22
+ ...options,
23
+ onPayload: (payload) => {
24
+ if (payload && typeof payload === "object") {
25
+ const payloadObj = payload;
26
+ const pinnedToolChoice = payloadObj.tool_choice && typeof payloadObj.tool_choice === "object" && !Array.isArray(payloadObj.tool_choice);
27
+ const effectiveThinkingType = pinnedToolChoice ? "disabled" : thinkingType;
28
+ payloadObj.thinking = { type: effectiveThinkingType };
29
+ if (effectiveThinkingType === "enabled" && (payloadObj.tool_choice === "required" || payloadObj.tool_choice && typeof payloadObj.tool_choice === "object" && !Array.isArray(payloadObj.tool_choice))) {
30
+ if (payloadObj.tool_choice === "required") {
31
+ payloadObj.tool_choice = "auto";
32
+ } else {
33
+ const toolChoice = payloadObj.tool_choice;
34
+ if (toolChoice.type === "any" || toolChoice.type === "auto") {
35
+ payloadObj.tool_choice = "auto";
36
+ }
37
+ }
38
+ }
39
+ }
40
+ return options?.onPayload?.(payload);
41
+ }
42
+ });
43
+ }
44
+
45
+ //#endregion
46
+ export { createMoonshotThinkingWrapper, resolveMoonshotThinkingType };