@fased/fased 0.1.55 → 0.1.57
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/config/capability-catalog.json +12 -0
- package/dist/agents/authenticated-model-catalog.js +3 -2
- package/dist/agents/bash-tools.exec-host-node.js +1 -1
- package/dist/agents/bash-tools.exec.js +1 -1
- package/dist/agents/copilot-dynamic-headers.js +37 -0
- package/dist/agents/current-model-catalog.js +6 -3
- package/dist/agents/model-catalog-snapshot.js +124 -0
- package/dist/agents/model-catalog-source.js +2 -2
- package/dist/agents/model-catalog.js +1 -1
- package/dist/agents/model-metadata.js +34 -6
- package/dist/agents/openai-codex-app-server.js +524 -0
- package/dist/agents/openai-codex-runtime-component.js +39 -0
- package/dist/agents/pi-embedded-runner/compact.js +3 -3
- package/dist/agents/pi-embedded-runner/extra-params.js +170 -94
- package/dist/agents/pi-embedded-runner/model.js +62 -1
- package/dist/agents/pi-embedded-runner/moonshot-stream-wrappers.js +46 -0
- package/dist/agents/pi-embedded-runner/openai-stream-wrappers.js +221 -0
- package/dist/agents/pi-embedded-runner/run/attempt.js +6 -4
- package/dist/agents/pi-embedded-runner/run.js +5 -2
- package/dist/agents/pi-embedded-runner/utils.js +1 -1
- package/dist/agents/pi-embedded-runner.js +1 -1
- package/dist/agents/pi-tools.js +2 -2
- package/dist/agents/tools/discord-actions-messaging.js +1 -1
- package/dist/agents/tools/message-tool.js +1 -1
- package/dist/agents/tools/session-status-tool.js +3 -3
- package/dist/agents/tools/slack-actions.js +1 -1
- package/dist/agents/tools/tts-tool.js +1 -1
- package/dist/auto-reply/reply/commands-models.js +1 -1
- package/dist/auto-reply/reply/directive-handling.impl.js +4 -1
- package/dist/auto-reply/reply/dispatch-acp.js +1 -1
- package/dist/auto-reply/reply/dispatch-from-config.js +1 -1
- package/dist/auto-reply/reply/get-reply-run.js +20 -2
- package/dist/auto-reply/reply/model-selection.js +1 -1
- package/dist/auto-reply/reply/session-reset-model.js +1 -1
- package/dist/auto-reply/status.js +1 -1
- package/dist/auto-reply/thinking.js +1 -1
- package/dist/brand.js +1 -1
- package/dist/browser/cdp.helpers.js +2 -2
- package/dist/browser/chrome.js +2 -2
- package/dist/browser/extension-relay.js +7 -7
- package/dist/build-info.json +3 -3
- package/dist/canvas-host/a2ui/.bundle.hash +1 -1
- package/dist/capabilities/install.js +43 -0
- package/dist/cli/components-cli.js +9 -31
- package/dist/cli/cron-cli/register.cron-add.js +1 -1
- package/dist/cli/hooks-cli.js +1 -1
- package/dist/cli/plugins-cli.js +3 -3
- package/dist/cli/program/register.agent.js +1 -1
- package/dist/cli/update-cli/update-command.js +50 -12
- package/dist/commands/agent.js +22 -3
- package/dist/commands/auth-choice.apply.openai.js +9 -0
- package/dist/commands/auth-choice.apply.plugin-provider.js +1 -1
- package/dist/commands/doctor-config-flow.js +1 -1
- package/dist/commands/hosted-dashboard-probe.js +3 -3
- package/dist/commands/model-picker.js +4 -3
- package/dist/commands/models/list.probe.js +1 -1
- package/dist/commands/models/list.registry.js +3 -2
- package/dist/commands/models/list.status-command.js +2 -2
- package/dist/commands/onboard-channels.js +1 -1
- package/dist/commands/onboarding/plugin-install.js +2 -2
- package/dist/commands/openai-codex-model-default.js +3 -2
- package/dist/config/zod-schema.agent-defaults.js +4 -2
- package/dist/config/zod-schema.agent-runtime.js +4 -2
- package/dist/config/zod-schema.core.js +4 -2
- package/dist/control-ui/assets/{app-D2RaTXoV.js → app-DltSyY4Y.js} +1723 -1716
- package/dist/control-ui/assets/chat-model-ref-Djkv93yn.js +2 -0
- package/dist/control-ui/assets/{index-D2nC6I-9.js → index-D5JlBp7f.js} +3 -3
- package/dist/control-ui/assets/{providers-CyjiG5Jw.js → providers-Cc89iMdx.js} +3 -3
- package/dist/control-ui/index.html +1 -1
- package/dist/control-ui/version.json +1 -1
- package/dist/cron/isolated-agent/run.js +6 -2
- package/dist/cron/service/jobs.js +11 -1
- package/dist/discord/monitor/gateway-plugin.js +2 -2
- package/dist/discord/voice/manager.js +1 -1
- package/dist/gateway/client.js +4 -4
- package/dist/gateway/protocol/schema/agents-models-skills.js +106 -5
- package/dist/gateway/server-methods/hooks.js +1 -1
- package/dist/gateway/server-methods/models.js +15 -7
- package/dist/gateway/server-methods/plugins-marketplace.js +3 -3
- package/dist/gateway/server-methods/services.js +1 -1
- package/dist/gateway/server-methods/sessions.js +1 -1
- package/dist/gateway/server-methods/tts.js +2 -2
- package/dist/gateway/server-model-catalog.js +1 -1
- package/dist/gateway/sessions-patch.js +27 -24
- package/dist/light-update-status.js +11 -11
- package/dist/plugin-sdk/{accounts-CeRNo5Ae.js → accounts-CmMwe9Dt.js} +1 -1
- package/dist/plugin-sdk/{actions-OMRHtXPj.js → actions-DYViFQiX.js} +4 -4
- package/dist/plugin-sdk/{active-listener-BlIkS3iR.js → active-listener-DVbpcisf.js} +1 -1
- package/dist/plugin-sdk/{agent-scope-BbgPlhtw.js → agent-scope-CCjfjKoO.js} +1 -1
- package/dist/plugin-sdk/{allow-list-BYeKk0Sy.js → allow-list-DyAxs4yw.js} +1 -1
- package/dist/plugin-sdk/{audio-preflight-B2n3a2Tj.js → audio-preflight-D-Mfay8i.js} +44 -48
- package/dist/plugin-sdk/{audit-Ppg6dR_b.js → audit-JImYFOzJ.js} +1 -1
- package/dist/plugin-sdk/{channel-access-configure-B6IAGlE0.js → channel-access-configure-B_qYjml8.js} +1 -1
- package/dist/plugin-sdk/{channel-access-af8dWWRv.js → channel-access-cxCK2mci.js} +1 -1
- package/dist/plugin-sdk/{channel-adapters.discord-IOZP8Cv5.js → channel-adapters.discord-BS4S4Svh.js} +1 -1
- package/dist/plugin-sdk/channel-plugin-common.d.ts +3 -3
- package/dist/plugin-sdk/channel-plugin-common.js +5 -5
- package/dist/plugin-sdk/{chunk-CD76Byie.js → chunk-CF8nvZNj.js} +1 -1
- package/dist/plugin-sdk/{chunk-items-Bu19zrYH.js → chunk-items-yLFoO571.js} +1 -1
- package/dist/plugin-sdk/command-status.d.ts +2 -2
- package/dist/plugin-sdk/command-status.js +44 -48
- package/dist/plugin-sdk/{commands-registry-DgS55tNj.js → commands-registry-CK4KmMG0.js} +2 -2
- package/dist/plugin-sdk/{common-CWvfeiX0.js → common-Cky4hpqr.js} +1 -1
- package/dist/plugin-sdk/{config-CYDETqcF.js → config-Dbxj_jUP.js} +1153 -17
- package/dist/plugin-sdk/{config-schema-CQ4EVcQG.js → config-schema-aKPMn6ML.js} +96084 -81132
- package/dist/plugin-sdk/device-pair.d.ts +1 -1
- package/dist/plugin-sdk/device-pair.js +2 -3
- package/dist/plugin-sdk/{diagnostic-Dfn1iERm.js → diagnostic-DLL_zekv.js} +3 -3
- package/dist/plugin-sdk/{directory-live-DatqU-eS.js → directory-live-CSuYxdwk.js} +1 -1
- package/dist/plugin-sdk/{directory-live-ClwN5KKq.js → directory-live-Dw7ZgC9_.js} +1 -1
- package/dist/plugin-sdk/discord.d.ts +6 -6
- package/dist/plugin-sdk/discord.js +32 -33
- package/dist/plugin-sdk/{draft-stream-controls-D4Tb_iS_.js → draft-stream-controls-BqchW1vi.js} +1 -1
- package/dist/plugin-sdk/{fetch-guard-BuYrl6q2.js → fetch-guard-CeG6u6ld.js} +1 -1
- package/dist/plugin-sdk/{filesystem-manager-B9DDPgfU.js → filesystem-manager-ZoHU8oA7.js} +3 -3
- package/dist/plugin-sdk/{fs-safe-BG-VzVkL.js → fs-safe-g4g7GT02.js} +2 -2
- package/dist/plugin-sdk/{group-mentions-BxDgHCgj.d.ts → group-mentions-BHRff6j8.d.ts} +1 -1
- package/dist/plugin-sdk/{guilds-BeT3iHHJ.js → guilds-CDhRIX57.js} +1 -1
- package/dist/plugin-sdk/{handle-action-B75UVKxF.js → handle-action-BSNDD2Vc.js} +25 -26
- package/dist/plugin-sdk/{helpers-BuEwju6y.js → helpers-CDo2XBSr.js} +1 -1
- package/dist/plugin-sdk/{image-ops-C66HPeAZ.js → image-ops-DbeBxbn4.js} +1 -1
- package/dist/plugin-sdk/index.d.ts +18 -18
- package/dist/plugin-sdk/index.js +48 -52
- package/dist/plugin-sdk/{login-Amr2DpKU.js → login-CWXvFTd8.js} +3 -3
- package/dist/plugin-sdk/{login-qr-DMQNEi9m.js → login-qr-CJB2zjmM.js} +4 -4
- package/dist/plugin-sdk/{manager-Bvpq49BI.js → manager-CbiFFLKS.js} +8 -8
- package/dist/plugin-sdk/{markdown-tables-DmQ7oXOm.js → markdown-tables-Bskt9r8i.js} +1 -1
- package/dist/plugin-sdk/{media-ByLQbEwJ.js → media-B3aAg5rh.js} +5 -5
- package/dist/plugin-sdk/{memory-search-C3C0bD2H.js → memory-search-DTjIMw8J.js} +1 -1
- package/dist/plugin-sdk/{monitor-K_u6daGa.js → monitor-BJs6z7AT.js} +52 -56
- package/dist/plugin-sdk/{monitor-S_7LrvSj.js → monitor-BYGbTI5V.js} +62 -66
- package/dist/plugin-sdk/{openresponses-http-BrDJUZXR.js → openresponses-http-BGCl2dS2.js} +44 -48
- package/dist/plugin-sdk/{optional-runtime-dependency-CbYjAC2b.js → optional-runtime-dependency-BlTVkcAg.js} +1 -1
- package/dist/plugin-sdk/{outbound-BuDafBBI.js → outbound-CIemga5_.js} +9 -9
- package/dist/plugin-sdk/{outbound-attachment-DmZmUqFP.js → outbound-attachment-2RckWqrk.js} +2 -2
- package/dist/plugin-sdk/{pairing-message-D0-UWGFJ.d.ts → pairing-message-C403mq4K.d.ts} +2 -2
- package/dist/plugin-sdk/{pairing-message-e4D4eBDA.js → pairing-message-r-VQfhFB.js} +1 -1
- package/dist/plugin-sdk/{pairing-store-T3IGoGZg.js → pairing-store-uPnLfGgB.js} +2 -2
- package/dist/plugin-sdk/{path-alias-guards-Dg3gU-MA.js → path-alias-guards-DjgDArrp.js} +1 -1
- package/dist/plugin-sdk/{pi-model-discovery-DvAG_Png.js → pi-model-discovery-BpEilAym.js} +1 -1
- package/dist/plugin-sdk/{pi-model-discovery-runtime-NjkUgjIf.js → pi-model-discovery-runtime-DwNdFaz-.js} +3 -3
- package/dist/plugin-sdk/{probe-Dlk0Jxpw.js → probe-BFroeK3g.js} +1 -1
- package/dist/plugin-sdk/{probe-Cyb-DGA3.js → probe-CJb5uR8B.js} +2 -2
- package/dist/plugin-sdk/{probe-D8JAILir.js → probe-l_whvGLY.js} +1 -1
- package/dist/plugin-sdk/provider-web-search-config-contract.d.ts +2 -2
- package/dist/plugin-sdk/{pw-ai-D7eW43DL.js → pw-ai-H7UgunQQ.js} +7 -9
- package/dist/plugin-sdk/{qmd-manager-DCUE21Kj.js → qmd-manager-DSyx77KY.js} +4 -4
- package/dist/plugin-sdk/{query-expansion-Zr9qQixm.js → query-expansion-CAI2kKLQ.js} +1 -1
- package/dist/plugin-sdk/{replies-BMIPmEoP.js → replies-CKMwkH4G.js} +4 -4
- package/dist/plugin-sdk/{reply-prefix-Bqzm6DC1.js → reply-prefix-CeVw7Mn2.js} +1 -1
- package/dist/plugin-sdk/{resolve-channels-ChWKWtA9.js → resolve-channels-87LZrFk_.js} +2 -2
- package/dist/plugin-sdk/{resolve-channels-zEnvugag.js → resolve-channels-_-nV-EK2.js} +1 -1
- package/dist/plugin-sdk/{resolve-outbound-target-CXCqUUPV.js → resolve-outbound-target-B68fSoGi.js} +2 -2
- package/dist/plugin-sdk/{resolve-route-DJN-SUSt.js → resolve-route-B8fOfihG.js} +2 -2
- package/dist/plugin-sdk/{resolve-users-BTvjQuui.js → resolve-users-DN9VQBwv.js} +1 -1
- package/dist/plugin-sdk/{resolve-users-CTzoruIZ.js → resolve-users-V6dHh_2B.js} +2 -2
- package/dist/plugin-sdk/{retry-policy-CY1qY6d7.js → retry-policy-B6GQldxB.js} +1 -1
- package/dist/plugin-sdk/{runtime-dependency-DvdRNMvs.js → runtime-dependency-DlqVSsSs.js} +124 -16
- package/dist/plugin-sdk/{runtime-CgOkQe0w.js → runtime-nVJl3PlS.js} +4 -4
- package/dist/plugin-sdk/{sandbox-paths-lj7_EVuA.js → sandbox-paths-Dx2lUqCu.js} +2 -2
- package/dist/plugin-sdk/sat-runtime.d.ts +3 -3
- package/dist/plugin-sdk/sat-runtime.js +45 -11
- package/dist/plugin-sdk/{send-2ITqny2W.js → send-BCJ4hi3t.js} +10 -10
- package/dist/plugin-sdk/{send-Cr-dj6S-.js → send-BHokB4TR.js} +6 -6
- package/dist/plugin-sdk/{send-BAz22RZr.js → send-CPK_HlYW.js} +9 -9
- package/dist/plugin-sdk/{send-eTxqFFsw.js → send-D3DQOg2a.js} +8 -8
- package/dist/plugin-sdk/{send-BG3RWyil.js → send-hSu1HWms.js} +13 -13
- package/dist/plugin-sdk/{session-C8nJmmVE.js → session-DQ4Dr-mf.js} +3 -3
- package/dist/plugin-sdk/{skill-commands-Rm5by9S8.js → skill-commands-CmdoKLh_.js} +103 -103
- package/dist/plugin-sdk/{slack-xvIVvyEM.js → slack-B70NHpMF.js} +65 -69
- package/dist/plugin-sdk/{slack-actions-BNIALJTA.js → slack-actions-fSmP981b.js} +21 -22
- package/dist/plugin-sdk/slack.d.ts +6 -6
- package/dist/plugin-sdk/slack.js +14 -14
- package/dist/plugin-sdk/{ssrf-BZG8Ztod.js → ssrf-fG4UHKBw.js} +180 -2
- package/dist/plugin-sdk/{sticker-cache-D3oDiu2u.js → sticker-cache-B4dG2sKU.js} +3 -3
- package/dist/plugin-sdk/{tables-DS5L7lCA.js → tables-EX4Hy-a-.js} +2 -2
- package/dist/plugin-sdk/{device-pairing-D2Yq-_U6.js → tailscale-status-DwpNdO3Z.js} +104 -2
- package/dist/plugin-sdk/{targets-D6lUomJc.js → targets-BeGUCGWK.js} +2 -2
- package/dist/plugin-sdk/{telegram-actions-MSFkDn0m.js → telegram-actions-CM8SJgc9.js} +49 -53
- package/dist/plugin-sdk/telegram.d.ts +6 -6
- package/dist/plugin-sdk/telegram.js +12 -12
- package/dist/plugin-sdk/{thread-bindings.lifecycle-Ry6Vcgw3.js → thread-bindings.lifecycle-tHK_1mvp.js} +3 -3
- package/dist/plugin-sdk/{thread-bindings.state-C0stmvNk.js → thread-bindings.state-D7xG1GHu.js} +2 -2
- package/dist/plugin-sdk/{tmp-fased-dir-D91GExk4.d.ts → tmp-fased-dir-Ouj58axY.d.ts} +2 -2
- package/dist/plugin-sdk/{types-DVTIpopt.d.ts → types-B4hj6HgR.d.ts} +2 -2
- package/dist/plugin-sdk/{types-BzadOItY.d.ts → types-DyhXnYUr.d.ts} +1 -1
- package/dist/plugin-sdk/{types-DKvBJHfH.d.ts → types-dWZFX1fk.d.ts} +28 -3
- package/dist/plugin-sdk/{types.plugin-BiHPaDTF.d.ts → types.plugin-_fbu40Re.d.ts} +7 -5
- package/dist/plugin-sdk/{web-DRNJxHXA.js → web-BFolfZ3i.js} +53 -57
- package/dist/plugin-sdk/{whatsapp-actions-BDXZF2R5.js → whatsapp-actions-CYmleHCz.js} +19 -20
- package/dist/plugin-sdk/{whatsapp-heartbeat-CKgmwCGr.js → whatsapp-heartbeat-BEwm4GK3.js} +2 -2
- package/dist/plugin-sdk/whatsapp.d.ts +11 -11
- package/dist/plugin-sdk/whatsapp.js +15 -15
- package/dist/plugin-sdk/{wsl-Biw7Mj39.js → wsl-BtMDzMv5.js} +53 -53
- package/dist/plugin-sdk/{zod-schema.providers-core-CIzCjXH9.d.ts → zod-schema.providers-core-FaYR6KdD.d.ts} +61 -61
- package/dist/plugins/lifecycle.js +1 -1
- package/dist/plugins/manifest-registry.js +26 -0
- package/dist/plugins/manifest.js +2 -0
- package/dist/plugins/marketplace.js +1 -1
- package/dist/plugins/runtime/index.js +1 -1
- package/dist/plugins/update.js +1 -1
- package/dist/providers/github-copilot-model-discovery.js +51 -0
- package/dist/providers/openai-codex-model-discovery.js +176 -0
- package/dist/providers/refresh.js +116 -34
- package/dist/providers/registry.js +2 -2
- package/dist/providers/runtime-model-catalog.js +97 -28
- package/dist/shared/model-thinking.js +13 -2
- package/dist/telegram/bot-message-context.js +1 -1
- package/dist/wizard/onboarding.finalize.js +1 -1
- package/extensions/acpx/package.json +1 -1
- package/extensions/bluebubbles/package.json +1 -1
- package/extensions/copilot-proxy/package.json +1 -1
- package/extensions/diagnostics-otel/package.json +1 -1
- package/extensions/fased-federation/package.json +1 -1
- package/extensions/google-gemini-cli-auth/package.json +1 -1
- package/extensions/imessage/package.json +1 -1
- package/extensions/irc/package.json +1 -1
- package/extensions/line/package.json +1 -1
- package/extensions/llm-task/package.json +1 -1
- package/extensions/lobster/package.json +1 -1
- package/extensions/matrix/CHANGELOG.md +12 -0
- package/extensions/matrix/package.json +1 -1
- package/extensions/mattermost/package.json +1 -1
- package/extensions/memory-core/package.json +2 -2
- package/extensions/memory-lancedb/package.json +1 -1
- package/extensions/minimax-portal-auth/package.json +1 -1
- package/extensions/msteams/CHANGELOG.md +12 -0
- package/extensions/msteams/package.json +1 -1
- package/extensions/nextcloud-talk/package.json +1 -1
- package/extensions/nostr/CHANGELOG.md +12 -0
- package/extensions/nostr/package.json +1 -1
- package/extensions/open-prose/package.json +1 -1
- package/extensions/sat-mining/package.json +1 -1
- package/extensions/signal/package.json +1 -1
- package/extensions/synology-chat/package.json +1 -1
- package/extensions/tlon/package.json +1 -1
- package/extensions/twitch/CHANGELOG.md +12 -0
- package/extensions/twitch/package.json +1 -1
- package/extensions/voice-call/CHANGELOG.md +12 -0
- package/extensions/voice-call/package.json +1 -1
- package/extensions/zalo/CHANGELOG.md +12 -0
- package/extensions/zalo/package.json +1 -1
- package/extensions/zalouser/CHANGELOG.md +12 -0
- package/extensions/zalouser/package.json +1 -1
- package/package.json +2 -1
- package/dist/control-ui/assets/chat-model-ref-BZFblCeY.js +0 -2
- package/dist/plugin-sdk/ip-C70a-YlD.js +0 -181
- package/dist/plugin-sdk/tailscale-status-ClsquRGs.js +0 -104
- package/dist/plugin-sdk/wallet-status-f0HagNeO.js +0 -11947
- package/dist/plugin-sdk/ws-CocpWGhl.js +0 -114
- /package/dist/plugin-sdk/{blocks-input-Dcitfh7h.js → blocks-input-Bg-8S2pl.js} +0 -0
- /package/dist/plugin-sdk/{channel-activity-Cg1xRoc2.js → channel-activity-DBDMQ3yI.js} +0 -0
- /package/dist/plugin-sdk/{channel-core-BOkyXXLa.js → channel-core-CFRs8LPy.js} +0 -0
- /package/dist/plugin-sdk/{client-D2N7hqVu.js → client-pI228AVT.js} +0 -0
- /package/dist/plugin-sdk/{command-poll-backoff-NAePk3eL.js → command-poll-backoff-yJU83wEq.js} +0 -0
- /package/dist/plugin-sdk/{date-time-CE3Uer3C.js → date-time-uUevHscU.js} +0 -0
- /package/dist/plugin-sdk/{diagnostic-session-state-HO94DMou.js → diagnostic-session-state-DqgfGYqZ.js} +0 -0
- /package/dist/plugin-sdk/{draft-stream-loop-CKyHn8IX.js → draft-stream-loop-CrOPfV3F.js} +0 -0
- /package/dist/plugin-sdk/{fetch-Cu-ahkie.js → fetch-BtmoPIlf.js} +0 -0
- /package/dist/plugin-sdk/{gateway-registry-DFsoY6C0.js → gateway-registry-DZDsqicG.js} +0 -0
- /package/dist/plugin-sdk/{inbound-context-BFnIdcqI.js → inbound-context-DrAcXE0y.js} +0 -0
- /package/dist/plugin-sdk/{internal-qo16nNU1.js → internal-CG_nHo-2.js} +0 -0
- /package/dist/plugin-sdk/{pairing-token-N_6Jbt1L.js → pairing-token-Cs3BRKc0.js} +0 -0
- /package/dist/plugin-sdk/{polls-DQrR-qT3.js → polls-DKQXVfJp.js} +0 -0
- /package/dist/plugin-sdk/{proxy-7xs_rsnV.js → proxy-DWpYcsvR.js} +0 -0
- /package/dist/plugin-sdk/{qmd-scope-D1sSG_Rx.js → qmd-scope-CdX34VCV.js} +0 -0
- /package/dist/plugin-sdk/{redact-identifier-Q3tkvxhm.js → redact-identifier-Lt7t3l7S.js} +0 -0
- /package/dist/plugin-sdk/{redact-sensitive-url-dPvnFFsK.js → redact-sensitive-url-g-ukZjwA.js} +0 -0
- /package/dist/plugin-sdk/{render-Bwu_WxwA.js → render-e7fENCYH.js} +0 -0
- /package/dist/plugin-sdk/{reply-reference-BkbK_DWT.js → reply-reference-Bqk-7HXE.js} +0 -0
- /package/dist/plugin-sdk/{secure-random-Bl-AVLVb.js → secure-random-BIkG-k4s.js} +0 -0
- /package/dist/plugin-sdk/{shared-clhhbWN3.js → shared-CBgp_GBw.js} +0 -0
- /package/dist/plugin-sdk/{target-errors-C_SVKoEv.js → target-errors-Ckufe179.js} +0 -0
- /package/dist/plugin-sdk/{targets-BDvvnlph.js → targets-CoMJ1ry1.js} +0 -0
- /package/dist/plugin-sdk/{tokens-BvtlOzVP.js → tokens-BbnqfVuu.js} +0 -0
- /package/dist/plugin-sdk/{tool-loop-detection-CWphm1k_.js → tool-loop-detection-Bp8bPJLs.js} +0 -0
- /package/dist/plugin-sdk/{ui-e020ouhJ.js → ui-Be8cLHIS.js} +0 -0
- /package/dist/plugin-sdk/{with-timeout-BYrRAYFV.js → with-timeout-ckWB8rTo.js} +0 -0
|
@@ -1,5 +1,17 @@
|
|
|
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 { loadConfig, writeConfigFile } from "../../config/io.js";
|
|
5
|
+
import "../../config/config.js";
|
|
6
|
+
import { resolveApiKeyForProfile } from "../auth-profiles/oauth.js";
|
|
7
|
+
import "../auth-profiles.js";
|
|
8
|
+
import { createOpenAICodexAppServerStreamFn } from "../openai-codex-app-server.js";
|
|
9
|
+
import { ensureOpenAICodexRuntimeComponent } from "../openai-codex-runtime-component.js";
|
|
1
10
|
import { log } from "./logger.js";
|
|
11
|
+
import { createMoonshotThinkingWrapper, resolveMoonshotThinkingType } from "./moonshot-stream-wrappers.js";
|
|
12
|
+
import { createOpenAIResponsesContextManagementWrapper } from "./openai-stream-wrappers.js";
|
|
2
13
|
import { streamSimple } from "@mariozechner/pi-ai/compat";
|
|
14
|
+
import WebSocket$1 from "ws";
|
|
3
15
|
|
|
4
16
|
//#region src/agents/pi-embedded-runner/extra-params.ts
|
|
5
17
|
const OPENROUTER_APP_HEADERS = {
|
|
@@ -8,8 +20,6 @@ const OPENROUTER_APP_HEADERS = {
|
|
|
8
20
|
};
|
|
9
21
|
const ANTHROPIC_CONTEXT_1M_BETA = "context-1m-2025-08-07";
|
|
10
22
|
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
23
|
const defaultProviderRuntimeDeps = {
|
|
14
24
|
prepareProviderExtraParams: ({ context }) => context.extraParams,
|
|
15
25
|
wrapProviderStreamFn: ({ context }) => context.streamFn
|
|
@@ -21,6 +31,30 @@ function sanitizeExtraParams(input) {
|
|
|
21
31
|
}
|
|
22
32
|
return Object.fromEntries(Object.entries(input).filter(([key, value]) => value !== undefined && key !== "__proto__" && key !== "constructor" && key !== "prototype"));
|
|
23
33
|
}
|
|
34
|
+
function normalizeExtraParamAliases(input) {
|
|
35
|
+
const normalized = sanitizeExtraParams(input);
|
|
36
|
+
if (Object.hasOwn(normalized, "parallelToolCalls")) {
|
|
37
|
+
normalized.parallel_tool_calls = normalized.parallelToolCalls;
|
|
38
|
+
delete normalized.parallelToolCalls;
|
|
39
|
+
}
|
|
40
|
+
if (Object.hasOwn(normalized, "textVerbosity")) {
|
|
41
|
+
normalized.text_verbosity = normalized.textVerbosity;
|
|
42
|
+
delete normalized.textVerbosity;
|
|
43
|
+
}
|
|
44
|
+
return normalized;
|
|
45
|
+
}
|
|
46
|
+
function defaultExtraParams(provider, modelId) {
|
|
47
|
+
const normalizedProvider = provider.trim().toLowerCase();
|
|
48
|
+
const normalizedModel = modelId.trim().toLowerCase();
|
|
49
|
+
if (normalizedProvider === "openai" && /^gpt-5(?:\.|$|-)/.test(normalizedModel)) {
|
|
50
|
+
return {
|
|
51
|
+
parallel_tool_calls: true,
|
|
52
|
+
text_verbosity: "low",
|
|
53
|
+
openaiWsWarmup: true
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
return {};
|
|
57
|
+
}
|
|
24
58
|
const testing = {
|
|
25
59
|
setProviderRuntimeDepsForTest(deps) {
|
|
26
60
|
providerRuntimeDeps.prepareProviderExtraParams = deps?.prepareProviderExtraParams ?? defaultProviderRuntimeDeps.prepareProviderExtraParams;
|
|
@@ -37,18 +71,35 @@ const testing = {
|
|
|
37
71
|
*
|
|
38
72
|
* @internal Exported for testing only
|
|
39
73
|
*/
|
|
40
|
-
function
|
|
74
|
+
function resolveConfiguredExtraParams(params) {
|
|
41
75
|
const modelKey = `${params.provider}/${params.modelId}`;
|
|
42
76
|
const modelConfig = params.cfg?.agents?.defaults?.models?.[modelKey];
|
|
43
|
-
const globalParams = modelConfig?.params ?
|
|
44
|
-
const
|
|
45
|
-
|
|
77
|
+
const globalParams = modelConfig?.params ? normalizeExtraParamAliases(modelConfig.params) : undefined;
|
|
78
|
+
const rawAgentParams = params.agentId && params.cfg?.agents?.list ? params.cfg.agents.list.find((agent) => agent.id === params.agentId)?.params : undefined;
|
|
79
|
+
const agentParams = rawAgentParams ? normalizeExtraParamAliases(rawAgentParams) : undefined;
|
|
80
|
+
const defaults = defaultExtraParams(params.provider, params.modelId);
|
|
81
|
+
if (Object.keys(defaults).length === 0 && !globalParams && !agentParams) {
|
|
46
82
|
return undefined;
|
|
47
83
|
}
|
|
48
|
-
return Object.assign({}, globalParams, agentParams);
|
|
84
|
+
return Object.assign({}, defaults, globalParams, agentParams);
|
|
85
|
+
}
|
|
86
|
+
function resolveExtraParams(params) {
|
|
87
|
+
const configured = resolveConfiguredExtraParams(params);
|
|
88
|
+
const prepared = providerRuntimeDeps.prepareProviderExtraParams({
|
|
89
|
+
provider: params.provider,
|
|
90
|
+
modelId: params.modelId,
|
|
91
|
+
config: params.cfg,
|
|
92
|
+
context: {
|
|
93
|
+
config: params.cfg,
|
|
94
|
+
provider: params.provider,
|
|
95
|
+
modelId: params.modelId,
|
|
96
|
+
extraParams: configured
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
return prepared ?? configured;
|
|
49
100
|
}
|
|
50
101
|
function resolvePreparedExtraParams(params) {
|
|
51
|
-
const extraParams =
|
|
102
|
+
const extraParams = resolveConfiguredExtraParams({
|
|
52
103
|
cfg: params.cfg,
|
|
53
104
|
provider: params.provider,
|
|
54
105
|
modelId: params.modelId,
|
|
@@ -56,7 +107,7 @@ function resolvePreparedExtraParams(params) {
|
|
|
56
107
|
});
|
|
57
108
|
const merged = {
|
|
58
109
|
...sanitizeExtraParams(extraParams),
|
|
59
|
-
...
|
|
110
|
+
...normalizeExtraParamAliases(params.extraParamsOverride)
|
|
60
111
|
};
|
|
61
112
|
const prepared = providerRuntimeDeps.prepareProviderExtraParams({
|
|
62
113
|
provider: params.provider,
|
|
@@ -101,10 +152,6 @@ function resolveAgentTransportOverride(params) {
|
|
|
101
152
|
* Defaults to "short" for direct Anthropic when not explicitly configured.
|
|
102
153
|
*/
|
|
103
154
|
function resolveCacheRetention(extraParams, provider) {
|
|
104
|
-
const isAnthropicDirect = provider === "anthropic";
|
|
105
|
-
if (!isAnthropicDirect) {
|
|
106
|
-
return undefined;
|
|
107
|
-
}
|
|
108
155
|
const newVal = extraParams?.cacheRetention;
|
|
109
156
|
if (newVal === "none" || newVal === "short" || newVal === "long") {
|
|
110
157
|
return newVal;
|
|
@@ -116,10 +163,7 @@ function resolveCacheRetention(extraParams, provider) {
|
|
|
116
163
|
if (legacy === "1h") {
|
|
117
164
|
return "long";
|
|
118
165
|
}
|
|
119
|
-
|
|
120
|
-
return undefined;
|
|
121
|
-
}
|
|
122
|
-
return "short";
|
|
166
|
+
return provider === "anthropic" ? "short" : undefined;
|
|
123
167
|
}
|
|
124
168
|
function createStreamFnWithExtraParams(baseStreamFn, extraParams, provider) {
|
|
125
169
|
if (!extraParams || Object.keys(extraParams).length === 0) {
|
|
@@ -132,6 +176,9 @@ function createStreamFnWithExtraParams(baseStreamFn, extraParams, provider) {
|
|
|
132
176
|
if (typeof extraParams.maxTokens === "number") {
|
|
133
177
|
streamParams.maxTokens = extraParams.maxTokens;
|
|
134
178
|
}
|
|
179
|
+
if (typeof extraParams.openaiWsWarmup === "boolean") {
|
|
180
|
+
streamParams.openaiWsWarmup = extraParams.openaiWsWarmup;
|
|
181
|
+
}
|
|
135
182
|
const transport = extraParams.transport;
|
|
136
183
|
if (transport === "sse" || transport === "websocket" || transport === "auto") {
|
|
137
184
|
streamParams.transport = transport;
|
|
@@ -167,6 +214,36 @@ function createStreamFnWithExtraParams(baseStreamFn, extraParams, provider) {
|
|
|
167
214
|
};
|
|
168
215
|
return wrappedStreamFn;
|
|
169
216
|
}
|
|
217
|
+
function createParallelToolCallsWrapper(baseStreamFn, value) {
|
|
218
|
+
if (value === undefined || value === null) {
|
|
219
|
+
return undefined;
|
|
220
|
+
}
|
|
221
|
+
if (typeof value !== "boolean") {
|
|
222
|
+
const rendered = typeof value === "string" || typeof value === "number" || typeof value === "bigint" ? String(value) : JSON.stringify(value) ?? typeof value;
|
|
223
|
+
log.warn(`ignoring invalid parallel_tool_calls param: ${rendered}`);
|
|
224
|
+
return undefined;
|
|
225
|
+
}
|
|
226
|
+
const underlying = baseStreamFn ?? streamSimple;
|
|
227
|
+
return (model, context, options) => {
|
|
228
|
+
const supported = model.api === "openai-completions" || model.api === "openai-responses" || model.api === "azure-openai-responses";
|
|
229
|
+
if (!supported) {
|
|
230
|
+
return underlying(model, context, options);
|
|
231
|
+
}
|
|
232
|
+
const originalOnPayload = options?.onPayload;
|
|
233
|
+
return underlying(model, context, {
|
|
234
|
+
...options,
|
|
235
|
+
onPayload: (payload) => {
|
|
236
|
+
if (payload && typeof payload === "object") {
|
|
237
|
+
payload.parallel_tool_calls = value;
|
|
238
|
+
}
|
|
239
|
+
return originalOnPayload?.(payload);
|
|
240
|
+
}
|
|
241
|
+
});
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
function isOllamaKimiCloudModel(provider, modelId) {
|
|
245
|
+
return provider === "ollama" && /^kimi(?:[-:]|$)/i.test(modelId) && /:cloud$/i.test(modelId);
|
|
246
|
+
}
|
|
170
247
|
function isDirectOpenAIBaseUrl(baseUrl) {
|
|
171
248
|
if (typeof baseUrl !== "string" || !baseUrl.trim()) {
|
|
172
249
|
return false;
|
|
@@ -179,21 +256,6 @@ function isDirectOpenAIBaseUrl(baseUrl) {
|
|
|
179
256
|
return normalized.includes("api.openai.com") || normalized.includes("chatgpt.com") || normalized.includes(".openai.azure.com");
|
|
180
257
|
}
|
|
181
258
|
}
|
|
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
259
|
function parsePositiveInteger(value) {
|
|
198
260
|
if (typeof value === "number" && Number.isFinite(value) && value > 0) {
|
|
199
261
|
return Math.floor(value);
|
|
@@ -298,56 +360,6 @@ function resolveOpenRouterResponseCacheHeaders(params) {
|
|
|
298
360
|
}
|
|
299
361
|
return Object.keys(headers).length > 0 ? headers : undefined;
|
|
300
362
|
}
|
|
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
363
|
function createOpenAIReasoningEffortWrapper(baseStreamFn, reasoningEffort) {
|
|
352
364
|
const underlying = baseStreamFn ?? streamSimple;
|
|
353
365
|
return (model, context, options) => {
|
|
@@ -374,10 +386,54 @@ function createOpenAIReasoningEffortWrapper(baseStreamFn, reasoningEffort) {
|
|
|
374
386
|
}
|
|
375
387
|
function createCodexDefaultTransportWrapper(baseStreamFn) {
|
|
376
388
|
const underlying = baseStreamFn ?? streamSimple;
|
|
377
|
-
return (model, context, options) =>
|
|
378
|
-
|
|
379
|
-
|
|
389
|
+
return (model, context, options) => {
|
|
390
|
+
if (typeof process !== "undefined" && process.versions?.node) {
|
|
391
|
+
globalThis.WebSocket = WebSocket$1;
|
|
392
|
+
}
|
|
393
|
+
return underlying(model, context, {
|
|
394
|
+
...options,
|
|
395
|
+
transport: options?.transport ?? "auto"
|
|
396
|
+
});
|
|
397
|
+
};
|
|
398
|
+
}
|
|
399
|
+
function usesCodexResponsesLite(model) {
|
|
400
|
+
const candidate = model;
|
|
401
|
+
return candidate.api === "openai-codex-responses" && candidate.compat?.responsesLite === true;
|
|
402
|
+
}
|
|
403
|
+
function createCodexResponsesLiteWrapper(baseStreamFn, params) {
|
|
404
|
+
const underlying = baseStreamFn ?? streamSimple;
|
|
405
|
+
const appServer = createOpenAICodexAppServerStreamFn({
|
|
406
|
+
resolveExecutable: async () => {
|
|
407
|
+
const runtime = await ensureOpenAICodexRuntimeComponent({ config: params?.cfg ?? loadConfig() });
|
|
408
|
+
if (runtime.installed) {
|
|
409
|
+
await writeConfigFile(runtime.config);
|
|
410
|
+
}
|
|
411
|
+
return runtime.executable;
|
|
412
|
+
},
|
|
413
|
+
resolveToken: async () => {
|
|
414
|
+
if (params?.resolvedApiKey?.trim()) {
|
|
415
|
+
return params.resolvedApiKey.trim();
|
|
416
|
+
}
|
|
417
|
+
const agentDir = params?.agentDir ?? resolveFasedAgentAgentDir();
|
|
418
|
+
const store = ensureAuthProfileStore(agentDir, { allowKeychainPrompt: false });
|
|
419
|
+
const profileId = listProfilesForProvider(store, "openai-codex")[0];
|
|
420
|
+
if (!profileId) {
|
|
421
|
+
return undefined;
|
|
422
|
+
}
|
|
423
|
+
return (await resolveApiKeyForProfile({
|
|
424
|
+
cfg: params?.cfg ?? {},
|
|
425
|
+
store,
|
|
426
|
+
profileId,
|
|
427
|
+
agentDir
|
|
428
|
+
}))?.apiKey;
|
|
429
|
+
}
|
|
380
430
|
});
|
|
431
|
+
return (model, context, options) => {
|
|
432
|
+
if (!usesCodexResponsesLite(model)) {
|
|
433
|
+
return underlying(model, context, options);
|
|
434
|
+
}
|
|
435
|
+
return appServer(model, context, options);
|
|
436
|
+
};
|
|
381
437
|
}
|
|
382
438
|
function isAnthropic1MModel(modelId) {
|
|
383
439
|
const normalized = modelId.trim().toLowerCase();
|
|
@@ -757,8 +813,8 @@ function createZaiToolStreamWrapper(baseStreamFn, enabled) {
|
|
|
757
813
|
*
|
|
758
814
|
* @internal Exported for testing
|
|
759
815
|
*/
|
|
760
|
-
function applyExtraParamsToAgent(agent, cfg, provider, modelId, extraParamsOverride, thinkingLevel, agentId, agentDir, model) {
|
|
761
|
-
const extraParams =
|
|
816
|
+
function applyExtraParamsToAgent(agent, cfg, provider, modelId, extraParamsOverride, thinkingLevel, agentId, agentDir, model, resolvedApiKey) {
|
|
817
|
+
const extraParams = resolveConfiguredExtraParams({
|
|
762
818
|
cfg,
|
|
763
819
|
provider,
|
|
764
820
|
modelId,
|
|
@@ -766,8 +822,13 @@ function applyExtraParamsToAgent(agent, cfg, provider, modelId, extraParamsOverr
|
|
|
766
822
|
});
|
|
767
823
|
if (provider === "openai-codex") {
|
|
768
824
|
agent.streamFn = createCodexDefaultTransportWrapper(agent.streamFn);
|
|
825
|
+
agent.streamFn = createCodexResponsesLiteWrapper(agent.streamFn, {
|
|
826
|
+
cfg,
|
|
827
|
+
agentDir,
|
|
828
|
+
resolvedApiKey
|
|
829
|
+
});
|
|
769
830
|
}
|
|
770
|
-
const merged = Object.assign({}, sanitizeExtraParams(extraParams),
|
|
831
|
+
const merged = Object.assign({}, sanitizeExtraParams(extraParams), normalizeExtraParamAliases(extraParamsOverride));
|
|
771
832
|
const preparedProviderExtraParams = providerRuntimeDeps.prepareProviderExtraParams({
|
|
772
833
|
provider,
|
|
773
834
|
modelId,
|
|
@@ -783,6 +844,7 @@ function applyExtraParamsToAgent(agent, cfg, provider, modelId, extraParamsOverr
|
|
|
783
844
|
}
|
|
784
845
|
});
|
|
785
846
|
const effectiveProviderExtraParams = preparedProviderExtraParams ?? merged;
|
|
847
|
+
const streamFnBeforeProviderHook = agent.streamFn;
|
|
786
848
|
const providerWrappedStreamFn = providerRuntimeDeps.wrapProviderStreamFn({
|
|
787
849
|
provider,
|
|
788
850
|
config: cfg,
|
|
@@ -805,12 +867,17 @@ function applyExtraParamsToAgent(agent, cfg, provider, modelId, extraParamsOverr
|
|
|
805
867
|
if (providerWrappedStreamFn) {
|
|
806
868
|
agent.streamFn = providerWrappedStreamFn;
|
|
807
869
|
}
|
|
808
|
-
const
|
|
870
|
+
const providerRuntimeHandled = providerWrappedStreamFn !== undefined && providerWrappedStreamFn !== streamFnBeforeProviderHook;
|
|
871
|
+
const wrappedStreamFn = createStreamFnWithExtraParams(agent.streamFn, effectiveProviderExtraParams, provider);
|
|
809
872
|
if (wrappedStreamFn) {
|
|
810
873
|
log.debug(`applying extraParams to agent streamFn for ${provider}/${modelId}`);
|
|
811
874
|
agent.streamFn = wrappedStreamFn;
|
|
812
875
|
}
|
|
813
|
-
const
|
|
876
|
+
const parallelToolCalls = createParallelToolCallsWrapper(agent.streamFn, effectiveProviderExtraParams.parallel_tool_calls);
|
|
877
|
+
if (parallelToolCalls) {
|
|
878
|
+
agent.streamFn = parallelToolCalls;
|
|
879
|
+
}
|
|
880
|
+
const anthropicBetas = resolveAnthropicBetas(effectiveProviderExtraParams, provider, modelId);
|
|
814
881
|
if (anthropicBetas?.length) {
|
|
815
882
|
log.debug(`applying Anthropic beta header for ${provider}/${modelId}: ${anthropicBetas.join(",")}`);
|
|
816
883
|
agent.streamFn = createAnthropicBetaHeadersWrapper(agent.streamFn, anthropicBetas);
|
|
@@ -823,12 +890,21 @@ function applyExtraParamsToAgent(agent, cfg, provider, modelId, extraParamsOverr
|
|
|
823
890
|
log.debug(`normalizing thinking=off to thinking=null for SiliconFlow compatibility (${provider}/${modelId})`);
|
|
824
891
|
agent.streamFn = createSiliconFlowThinkingWrapper(agent.streamFn);
|
|
825
892
|
}
|
|
826
|
-
if (provider === "openrouter") {
|
|
893
|
+
if (provider === "openrouter" && !providerRuntimeHandled) {
|
|
827
894
|
log.debug(`applying OpenRouter app attribution headers for ${provider}/${modelId}`);
|
|
828
895
|
const openRouterThinkingLevel = modelId === "auto" ? undefined : thinkingLevel;
|
|
829
|
-
agent.streamFn = createOpenRouterWrapper(agent.streamFn, openRouterThinkingLevel, resolveOpenRouterResponseCacheConfig(
|
|
896
|
+
agent.streamFn = createOpenRouterWrapper(agent.streamFn, openRouterThinkingLevel, resolveOpenRouterResponseCacheConfig(effectiveProviderExtraParams));
|
|
830
897
|
agent.streamFn = createOpenRouterSystemCacheWrapper(agent.streamFn);
|
|
831
898
|
}
|
|
899
|
+
if (provider === "moonshot" || isOllamaKimiCloudModel(provider, modelId)) {
|
|
900
|
+
const configuredThinking = effectiveProviderExtraParams.thinking;
|
|
901
|
+
const hasPinnedToolChoice = model && typeof model === "object" && "tool_choice" in model && typeof model.tool_choice === "object";
|
|
902
|
+
const thinkingType = hasPinnedToolChoice ? "disabled" : resolveMoonshotThinkingType({
|
|
903
|
+
configuredThinking,
|
|
904
|
+
thinkingLevel
|
|
905
|
+
});
|
|
906
|
+
agent.streamFn = createMoonshotThinkingWrapper(agent.streamFn, thinkingType);
|
|
907
|
+
}
|
|
832
908
|
if (provider === "zai" || provider === "z-ai") {
|
|
833
909
|
const toolStreamEnabled = merged?.tool_stream !== false;
|
|
834
910
|
if (toolStreamEnabled) {
|
|
@@ -837,9 +913,9 @@ function applyExtraParamsToAgent(agent, cfg, provider, modelId, extraParamsOverr
|
|
|
837
913
|
}
|
|
838
914
|
}
|
|
839
915
|
agent.streamFn = createGoogleThinkingPayloadWrapper(agent.streamFn, thinkingLevel);
|
|
840
|
-
agent.streamFn = createOpenAIResponsesContextManagementWrapper(agent.streamFn,
|
|
916
|
+
agent.streamFn = createOpenAIResponsesContextManagementWrapper(agent.streamFn, effectiveProviderExtraParams);
|
|
841
917
|
agent.streamFn = createOpenAIReasoningEffortWrapper(agent.streamFn, thinkingLevel);
|
|
842
918
|
}
|
|
843
919
|
|
|
844
920
|
//#endregion
|
|
845
|
-
export { applyExtraParamsToAgent
|
|
921
|
+
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 };
|