@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
|
@@ -0,0 +1,524 @@
|
|
|
1
|
+
import { resolveFasedAgentPackageRootSync } from "../infra/fased-root.js";
|
|
2
|
+
import { resolvePluginInstallDir } from "../plugins/install.js";
|
|
3
|
+
import fs from "node:fs";
|
|
4
|
+
import os from "node:os";
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
import { spawn } from "node:child_process";
|
|
7
|
+
import { createAssistantMessageEventStream } from "@mariozechner/pi-ai/compat";
|
|
8
|
+
import readline from "node:readline";
|
|
9
|
+
|
|
10
|
+
//#region src/agents/openai-codex-app-server.ts
|
|
11
|
+
const OPENAI_CODEX_APP_SERVER_VERSION = "0.144.1";
|
|
12
|
+
const DEFAULT_REQUEST_TIMEOUT_MS = 12e4;
|
|
13
|
+
function isRecord(value) {
|
|
14
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
15
|
+
}
|
|
16
|
+
function decodeJwtPayload(token) {
|
|
17
|
+
const encoded = token.split(".")[1];
|
|
18
|
+
if (!encoded) {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
try {
|
|
22
|
+
const parsed = JSON.parse(Buffer.from(encoded, "base64url").toString("utf8"));
|
|
23
|
+
return isRecord(parsed) ? parsed : null;
|
|
24
|
+
} catch {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
function extractOpenAICodexAccountId(token) {
|
|
29
|
+
const payload = decodeJwtPayload(token);
|
|
30
|
+
const auth = payload?.["https://api.openai.com/auth"];
|
|
31
|
+
if (!isRecord(auth)) {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
const accountId = auth.chatgpt_account_id;
|
|
35
|
+
return typeof accountId === "string" && accountId.trim() ? accountId.trim() : null;
|
|
36
|
+
}
|
|
37
|
+
function stateDir() {
|
|
38
|
+
return process.env.FASED_STATE_DIR?.trim() || path.join(process.env.HOME?.trim() || os.homedir(), ".fased");
|
|
39
|
+
}
|
|
40
|
+
function executableName() {
|
|
41
|
+
return process.platform === "win32" ? "codex.exe" : "codex";
|
|
42
|
+
}
|
|
43
|
+
function codexExecutableCandidates() {
|
|
44
|
+
const configured = process.env.FASED_CODEX_BIN?.trim();
|
|
45
|
+
const componentRoot = resolvePluginInstallDir("openai-runtime");
|
|
46
|
+
const packageRoot = resolveFasedAgentPackageRootSync({
|
|
47
|
+
moduleUrl: import.meta.url,
|
|
48
|
+
argv1: process.argv[1],
|
|
49
|
+
cwd: process.cwd()
|
|
50
|
+
});
|
|
51
|
+
const candidates = [
|
|
52
|
+
configured,
|
|
53
|
+
path.join(componentRoot, "node_modules", ".bin", executableName()),
|
|
54
|
+
path.join(componentRoot, "node_modules", "@openai", "codex", "bin", executableName()),
|
|
55
|
+
packageRoot ? path.join(packageRoot, "extensions", "runtime-openai", "node_modules", ".bin", executableName()) : undefined
|
|
56
|
+
].filter((value) => Boolean(value));
|
|
57
|
+
return [...new Set(candidates)];
|
|
58
|
+
}
|
|
59
|
+
function resolveOpenAICodexExecutable() {
|
|
60
|
+
const explicitlyConfigured = process.env.FASED_CODEX_BIN?.trim();
|
|
61
|
+
for (const candidate of codexExecutableCandidates()) {
|
|
62
|
+
try {
|
|
63
|
+
if (!fs.statSync(candidate).isFile()) {
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
if (explicitlyConfigured && candidate === explicitlyConfigured) {
|
|
67
|
+
return candidate;
|
|
68
|
+
}
|
|
69
|
+
const resolved = fs.realpathSync(candidate);
|
|
70
|
+
let current = path.dirname(resolved);
|
|
71
|
+
for (let depth = 0; depth < 6; depth += 1) {
|
|
72
|
+
try {
|
|
73
|
+
const parsed = JSON.parse(fs.readFileSync(path.join(current, "package.json"), "utf8"));
|
|
74
|
+
if (parsed.name === "@openai/codex") {
|
|
75
|
+
if (parsed.version === OPENAI_CODEX_APP_SERVER_VERSION) {
|
|
76
|
+
return candidate;
|
|
77
|
+
}
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
80
|
+
} catch {}
|
|
81
|
+
const parent = path.dirname(current);
|
|
82
|
+
if (parent === current) {
|
|
83
|
+
break;
|
|
84
|
+
}
|
|
85
|
+
current = parent;
|
|
86
|
+
}
|
|
87
|
+
} catch {}
|
|
88
|
+
}
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
function managedCodexHome() {
|
|
92
|
+
const directory = path.join(stateDir(), "runtime", "openai-codex");
|
|
93
|
+
fs.mkdirSync(directory, {
|
|
94
|
+
recursive: true,
|
|
95
|
+
mode: 448
|
|
96
|
+
});
|
|
97
|
+
return directory;
|
|
98
|
+
}
|
|
99
|
+
var CodexAppServerClient = class {
|
|
100
|
+
constructor(command) {
|
|
101
|
+
this.pending = new Map();
|
|
102
|
+
this.notificationListeners = new Set();
|
|
103
|
+
this.nextId = 1;
|
|
104
|
+
this.closedError = null;
|
|
105
|
+
this.child = spawn(command, [
|
|
106
|
+
"app-server",
|
|
107
|
+
"--stdio",
|
|
108
|
+
"--disable",
|
|
109
|
+
"shell_tool",
|
|
110
|
+
"--config",
|
|
111
|
+
"web_search=\"disabled\""
|
|
112
|
+
], {
|
|
113
|
+
stdio: [
|
|
114
|
+
"pipe",
|
|
115
|
+
"pipe",
|
|
116
|
+
"pipe"
|
|
117
|
+
],
|
|
118
|
+
env: {
|
|
119
|
+
...process.env,
|
|
120
|
+
CODEX_HOME: managedCodexHome()
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
this.lines = readline.createInterface({ input: this.child.stdout });
|
|
124
|
+
this.lines.on("line", (line) => this.handleLine(line));
|
|
125
|
+
this.child.once("error", (error) => this.closeWithError(error));
|
|
126
|
+
this.child.once("exit", (code, signal) => {
|
|
127
|
+
if (!this.closedError && (code !== 0 || signal)) {
|
|
128
|
+
this.closeWithError(new Error(`OpenAI sign-in runtime exited (code=${String(code)}, signal=${String(signal)})`));
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
onNotification(listener) {
|
|
133
|
+
this.notificationListeners.add(listener);
|
|
134
|
+
return () => this.notificationListeners.delete(listener);
|
|
135
|
+
}
|
|
136
|
+
async request(method, params = {}, timeoutMs = DEFAULT_REQUEST_TIMEOUT_MS) {
|
|
137
|
+
if (this.closedError) {
|
|
138
|
+
throw this.closedError;
|
|
139
|
+
}
|
|
140
|
+
const id = this.nextId++;
|
|
141
|
+
const promise = new Promise((resolve, reject) => {
|
|
142
|
+
const timer = setTimeout(() => {
|
|
143
|
+
this.pending.delete(id);
|
|
144
|
+
reject(new Error(`OpenAI sign-in runtime timed out waiting for ${method}`));
|
|
145
|
+
}, timeoutMs);
|
|
146
|
+
timer.unref?.();
|
|
147
|
+
this.pending.set(id, {
|
|
148
|
+
resolve,
|
|
149
|
+
reject,
|
|
150
|
+
timer
|
|
151
|
+
});
|
|
152
|
+
});
|
|
153
|
+
this.child.stdin.write(`${JSON.stringify({
|
|
154
|
+
id,
|
|
155
|
+
method,
|
|
156
|
+
params
|
|
157
|
+
})}\n`);
|
|
158
|
+
return await promise;
|
|
159
|
+
}
|
|
160
|
+
respond(id, result) {
|
|
161
|
+
this.child.stdin.write(`${JSON.stringify({
|
|
162
|
+
id,
|
|
163
|
+
result
|
|
164
|
+
})}\n`);
|
|
165
|
+
}
|
|
166
|
+
close() {
|
|
167
|
+
this.lines.close();
|
|
168
|
+
this.child.kill("SIGTERM");
|
|
169
|
+
}
|
|
170
|
+
handleLine(line) {
|
|
171
|
+
let message;
|
|
172
|
+
try {
|
|
173
|
+
message = JSON.parse(line);
|
|
174
|
+
} catch {
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
if (message.id !== undefined && !message.method) {
|
|
178
|
+
const request = this.pending.get(message.id);
|
|
179
|
+
if (!request) {
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
this.pending.delete(message.id);
|
|
183
|
+
clearTimeout(request.timer);
|
|
184
|
+
if (message.error) {
|
|
185
|
+
request.reject(new Error(message.error.message || "OpenAI sign-in runtime request failed"));
|
|
186
|
+
} else {
|
|
187
|
+
request.resolve(message.result);
|
|
188
|
+
}
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
for (const listener of this.notificationListeners) {
|
|
192
|
+
listener(message);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
closeWithError(error) {
|
|
196
|
+
this.closedError = error;
|
|
197
|
+
for (const request of this.pending.values()) {
|
|
198
|
+
clearTimeout(request.timer);
|
|
199
|
+
request.reject(error);
|
|
200
|
+
}
|
|
201
|
+
this.pending.clear();
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
async function initializeClient(client, token) {
|
|
205
|
+
const accountId = extractOpenAICodexAccountId(token);
|
|
206
|
+
if (!accountId) {
|
|
207
|
+
throw new Error("OpenAI sign-in token does not contain a ChatGPT account ID");
|
|
208
|
+
}
|
|
209
|
+
await client.request("initialize", {
|
|
210
|
+
clientInfo: {
|
|
211
|
+
name: "fased",
|
|
212
|
+
title: "Fased Agent",
|
|
213
|
+
version: OPENAI_CODEX_APP_SERVER_VERSION
|
|
214
|
+
},
|
|
215
|
+
capabilities: { experimentalApi: true }
|
|
216
|
+
});
|
|
217
|
+
await client.request("account/login/start", {
|
|
218
|
+
type: "chatgptAuthTokens",
|
|
219
|
+
accessToken: token,
|
|
220
|
+
chatgptAccountId: accountId,
|
|
221
|
+
chatgptPlanType: null
|
|
222
|
+
});
|
|
223
|
+
client.onNotification((message) => {
|
|
224
|
+
if (message.id === undefined || message.method !== "account/chatgptAuthTokens/refresh") {
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
client.respond(message.id, {
|
|
228
|
+
accessToken: token,
|
|
229
|
+
chatgptAccountId: accountId,
|
|
230
|
+
chatgptPlanType: null
|
|
231
|
+
});
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
function parseAppServerModels(value) {
|
|
235
|
+
if (!isRecord(value) || !Array.isArray(value.data)) {
|
|
236
|
+
return [];
|
|
237
|
+
}
|
|
238
|
+
return value.data.flatMap((entry) => {
|
|
239
|
+
if (!isRecord(entry) || typeof entry.id !== "string" || !entry.id.trim()) {
|
|
240
|
+
return [];
|
|
241
|
+
}
|
|
242
|
+
const efforts = Array.isArray(entry.supportedReasoningEfforts) ? entry.supportedReasoningEfforts.flatMap((item) => isRecord(item) && typeof item.reasoningEffort === "string" ? [item.reasoningEffort] : []) : [];
|
|
243
|
+
const modalities = Array.isArray(entry.inputModalities) ? entry.inputModalities.filter((item) => item === "text" || item === "image") : [];
|
|
244
|
+
return [{
|
|
245
|
+
id: entry.id.trim(),
|
|
246
|
+
displayName: typeof entry.displayName === "string" && entry.displayName.trim() ? entry.displayName.trim() : entry.id.trim(),
|
|
247
|
+
...typeof entry.description === "string" && entry.description.trim() ? { description: entry.description.trim() } : {},
|
|
248
|
+
hidden: entry.hidden === true,
|
|
249
|
+
inputModalities: modalities.length > 0 ? modalities : ["text"],
|
|
250
|
+
supportedReasoningEfforts: efforts,
|
|
251
|
+
...typeof entry.defaultReasoningEffort === "string" ? { defaultReasoningEffort: entry.defaultReasoningEffort } : {}
|
|
252
|
+
}];
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
async function listOpenAICodexAppServerModels(params) {
|
|
256
|
+
const executable = params.executable ?? (params.resolveExecutable ? await params.resolveExecutable() : resolveOpenAICodexExecutable());
|
|
257
|
+
if (!executable) {
|
|
258
|
+
throw new Error("OpenAI sign-in runtime is not installed. Run `fased components install openai-runtime`.");
|
|
259
|
+
}
|
|
260
|
+
const client = new CodexAppServerClient(executable);
|
|
261
|
+
try {
|
|
262
|
+
await initializeClient(client, params.token);
|
|
263
|
+
return parseAppServerModels(await client.request("model/list", { includeHidden: false }, 15e3)).filter((model) => !model.hidden);
|
|
264
|
+
} finally {
|
|
265
|
+
client.close();
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
function contentText(content) {
|
|
269
|
+
if (typeof content === "string") {
|
|
270
|
+
return content;
|
|
271
|
+
}
|
|
272
|
+
if (!Array.isArray(content)) {
|
|
273
|
+
return "";
|
|
274
|
+
}
|
|
275
|
+
return content.flatMap((part) => isRecord(part) && part.type === "text" && typeof part.text === "string" ? [part.text] : []).join("\n");
|
|
276
|
+
}
|
|
277
|
+
function renderConversationContext(context) {
|
|
278
|
+
const messages = context.messages;
|
|
279
|
+
const latestUserIndex = messages.findLastIndex((message) => message.role === "user");
|
|
280
|
+
const latest = latestUserIndex >= 0 ? messages[latestUserIndex] : undefined;
|
|
281
|
+
const prior = messages.slice(0, Math.max(0, latestUserIndex));
|
|
282
|
+
const transcript = prior.map((message) => {
|
|
283
|
+
if (message.role === "toolResult") {
|
|
284
|
+
return `Tool ${message.toolName}: ${contentText(message.content)}`;
|
|
285
|
+
}
|
|
286
|
+
return `${message.role === "assistant" ? "Assistant" : "User"}: ${contentText(message.content)}`;
|
|
287
|
+
}).filter((value) => !value.endsWith(": ")).join("\n\n");
|
|
288
|
+
const instructions = [
|
|
289
|
+
context.systemPrompt?.trim(),
|
|
290
|
+
transcript ? `Conversation before the current user message:\n${transcript}` : "",
|
|
291
|
+
"Answer the current user message directly. Fased tools are unavailable in this transport turn."
|
|
292
|
+
].filter(Boolean).join("\n\n");
|
|
293
|
+
return {
|
|
294
|
+
instructions,
|
|
295
|
+
prompt: latest ? contentText(latest.content) : "Continue the conversation."
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
function emptyUsage() {
|
|
299
|
+
return {
|
|
300
|
+
input: 0,
|
|
301
|
+
output: 0,
|
|
302
|
+
cacheRead: 0,
|
|
303
|
+
cacheWrite: 0,
|
|
304
|
+
totalTokens: 0,
|
|
305
|
+
cost: {
|
|
306
|
+
input: 0,
|
|
307
|
+
output: 0,
|
|
308
|
+
cacheRead: 0,
|
|
309
|
+
cacheWrite: 0,
|
|
310
|
+
total: 0
|
|
311
|
+
}
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
function readUsageNumber(value) {
|
|
315
|
+
return typeof value === "number" && Number.isFinite(value) && value >= 0 ? value : 0;
|
|
316
|
+
}
|
|
317
|
+
function parseThreadTokenUsage(value) {
|
|
318
|
+
if (!isRecord(value)) {
|
|
319
|
+
return null;
|
|
320
|
+
}
|
|
321
|
+
const last = isRecord(value.last) ? value.last : null;
|
|
322
|
+
if (!last) {
|
|
323
|
+
return null;
|
|
324
|
+
}
|
|
325
|
+
const input = readUsageNumber(last.inputTokens);
|
|
326
|
+
const output = readUsageNumber(last.outputTokens);
|
|
327
|
+
const cacheRead = readUsageNumber(last.cachedInputTokens);
|
|
328
|
+
const totalTokens = readUsageNumber(last.totalTokens) || input + output;
|
|
329
|
+
return {
|
|
330
|
+
input,
|
|
331
|
+
output,
|
|
332
|
+
cacheRead,
|
|
333
|
+
cacheWrite: 0,
|
|
334
|
+
totalTokens,
|
|
335
|
+
cost: {
|
|
336
|
+
input: 0,
|
|
337
|
+
output: 0,
|
|
338
|
+
cacheRead: 0,
|
|
339
|
+
cacheWrite: 0,
|
|
340
|
+
total: 0
|
|
341
|
+
}
|
|
342
|
+
};
|
|
343
|
+
}
|
|
344
|
+
function createOpenAICodexAppServerStreamFn(params) {
|
|
345
|
+
return (model, context, options) => {
|
|
346
|
+
const eventStream = createAssistantMessageEventStream();
|
|
347
|
+
const stream = eventStream;
|
|
348
|
+
void (async () => {
|
|
349
|
+
const output = {
|
|
350
|
+
role: "assistant",
|
|
351
|
+
content: [],
|
|
352
|
+
api: model.api,
|
|
353
|
+
provider: model.provider,
|
|
354
|
+
model: model.id,
|
|
355
|
+
usage: emptyUsage(),
|
|
356
|
+
stopReason: "stop",
|
|
357
|
+
timestamp: Date.now()
|
|
358
|
+
};
|
|
359
|
+
let client;
|
|
360
|
+
try {
|
|
361
|
+
const token = options?.apiKey?.trim() || (await params?.resolveToken?.())?.trim();
|
|
362
|
+
if (!token) {
|
|
363
|
+
throw new Error("OpenAI ChatGPT sign-in is required");
|
|
364
|
+
}
|
|
365
|
+
const executable = params?.resolveExecutable ? await params.resolveExecutable() : resolveOpenAICodexExecutable();
|
|
366
|
+
if (!executable) {
|
|
367
|
+
throw new Error("OpenAI sign-in runtime is not installed. Run `fased components install openai-runtime`.");
|
|
368
|
+
}
|
|
369
|
+
client = new CodexAppServerClient(executable);
|
|
370
|
+
await initializeClient(client, token);
|
|
371
|
+
const { instructions, prompt } = renderConversationContext(context);
|
|
372
|
+
const started = await client.request("thread/start", {
|
|
373
|
+
model: model.id,
|
|
374
|
+
cwd: process.cwd(),
|
|
375
|
+
approvalPolicy: "never",
|
|
376
|
+
sandbox: "read-only",
|
|
377
|
+
ephemeral: true,
|
|
378
|
+
baseInstructions: instructions,
|
|
379
|
+
config: {
|
|
380
|
+
web_search: "disabled",
|
|
381
|
+
features: { shell_tool: false }
|
|
382
|
+
}
|
|
383
|
+
});
|
|
384
|
+
const thread = isRecord(started.thread) ? started.thread : null;
|
|
385
|
+
const threadId = typeof thread?.id === "string" ? thread.id : "";
|
|
386
|
+
if (!threadId) {
|
|
387
|
+
throw new Error("OpenAI sign-in runtime did not create a thread");
|
|
388
|
+
}
|
|
389
|
+
let text = "";
|
|
390
|
+
let settled = false;
|
|
391
|
+
let settle;
|
|
392
|
+
let reject;
|
|
393
|
+
const completed = new Promise((resolve, rejectPromise) => {
|
|
394
|
+
settle = resolve;
|
|
395
|
+
reject = rejectPromise;
|
|
396
|
+
});
|
|
397
|
+
stream.push({
|
|
398
|
+
type: "start",
|
|
399
|
+
partial: output
|
|
400
|
+
});
|
|
401
|
+
const unsubscribe = client.onNotification((message) => {
|
|
402
|
+
if (message.id !== undefined && message.method) {
|
|
403
|
+
client?.respond(message.id, {
|
|
404
|
+
contentItems: [{
|
|
405
|
+
type: "inputText",
|
|
406
|
+
text: "Tool unavailable in this Fased turn."
|
|
407
|
+
}],
|
|
408
|
+
success: false
|
|
409
|
+
});
|
|
410
|
+
return;
|
|
411
|
+
}
|
|
412
|
+
if (message.method === "item/agentMessage/delta") {
|
|
413
|
+
const delta = typeof message.params?.delta === "string" ? message.params.delta : "";
|
|
414
|
+
if (!delta) {
|
|
415
|
+
return;
|
|
416
|
+
}
|
|
417
|
+
if (text.length === 0) {
|
|
418
|
+
output.content = [{
|
|
419
|
+
type: "text",
|
|
420
|
+
text: ""
|
|
421
|
+
}];
|
|
422
|
+
stream.push({
|
|
423
|
+
type: "text_start",
|
|
424
|
+
contentIndex: 0,
|
|
425
|
+
partial: output
|
|
426
|
+
});
|
|
427
|
+
}
|
|
428
|
+
text += delta;
|
|
429
|
+
output.content[0] = {
|
|
430
|
+
type: "text",
|
|
431
|
+
text
|
|
432
|
+
};
|
|
433
|
+
stream.push({
|
|
434
|
+
type: "text_delta",
|
|
435
|
+
contentIndex: 0,
|
|
436
|
+
delta,
|
|
437
|
+
partial: output
|
|
438
|
+
});
|
|
439
|
+
return;
|
|
440
|
+
}
|
|
441
|
+
if (message.method === "thread/tokenUsage/updated") {
|
|
442
|
+
const usage = parseThreadTokenUsage(message.params?.tokenUsage);
|
|
443
|
+
if (usage) {
|
|
444
|
+
output.usage = usage;
|
|
445
|
+
}
|
|
446
|
+
return;
|
|
447
|
+
}
|
|
448
|
+
if (message.method !== "turn/completed" || settled) {
|
|
449
|
+
return;
|
|
450
|
+
}
|
|
451
|
+
const turn = isRecord(message.params?.turn) ? message.params.turn : null;
|
|
452
|
+
settled = true;
|
|
453
|
+
if (turn?.status === "completed") {
|
|
454
|
+
settle();
|
|
455
|
+
} else {
|
|
456
|
+
const error = isRecord(turn?.error) ? turn.error : null;
|
|
457
|
+
const status = typeof turn?.status === "string" ? turn.status : "unknown";
|
|
458
|
+
reject(new Error(typeof error?.message === "string" ? error.message : `OpenAI sign-in turn ended with status ${status}`));
|
|
459
|
+
}
|
|
460
|
+
});
|
|
461
|
+
await client.request("turn/start", {
|
|
462
|
+
threadId,
|
|
463
|
+
input: [{
|
|
464
|
+
type: "text",
|
|
465
|
+
text: prompt,
|
|
466
|
+
text_elements: []
|
|
467
|
+
}],
|
|
468
|
+
...options?.reasoning ? { effort: options.reasoning } : {}
|
|
469
|
+
});
|
|
470
|
+
const abort = () => reject(new Error("Request was aborted"));
|
|
471
|
+
options?.signal?.addEventListener("abort", abort, { once: true });
|
|
472
|
+
try {
|
|
473
|
+
await Promise.race([completed, new Promise((_, rejectTimeout) => {
|
|
474
|
+
const timer = setTimeout(() => rejectTimeout(new Error("OpenAI sign-in turn timed out")), DEFAULT_REQUEST_TIMEOUT_MS);
|
|
475
|
+
timer.unref?.();
|
|
476
|
+
})]);
|
|
477
|
+
} finally {
|
|
478
|
+
options?.signal?.removeEventListener("abort", abort);
|
|
479
|
+
unsubscribe();
|
|
480
|
+
}
|
|
481
|
+
if (text.length > 0) {
|
|
482
|
+
stream.push({
|
|
483
|
+
type: "text_end",
|
|
484
|
+
contentIndex: 0,
|
|
485
|
+
content: text,
|
|
486
|
+
partial: output
|
|
487
|
+
});
|
|
488
|
+
}
|
|
489
|
+
stream.push({
|
|
490
|
+
type: "done",
|
|
491
|
+
reason: "stop",
|
|
492
|
+
message: output
|
|
493
|
+
});
|
|
494
|
+
stream.end();
|
|
495
|
+
} catch (error) {
|
|
496
|
+
const failed = {
|
|
497
|
+
...output,
|
|
498
|
+
stopReason: options?.signal?.aborted ? "aborted" : "error",
|
|
499
|
+
errorMessage: error instanceof Error ? error.message : String(error)
|
|
500
|
+
};
|
|
501
|
+
stream.push({
|
|
502
|
+
type: "error",
|
|
503
|
+
reason: failed.stopReason,
|
|
504
|
+
error: failed
|
|
505
|
+
});
|
|
506
|
+
stream.end();
|
|
507
|
+
} finally {
|
|
508
|
+
client?.close();
|
|
509
|
+
}
|
|
510
|
+
})();
|
|
511
|
+
return eventStream;
|
|
512
|
+
};
|
|
513
|
+
}
|
|
514
|
+
function isOpenAICodexAppServerModel(model) {
|
|
515
|
+
return model.provider === "openai-codex" && model.compat?.responsesLite === true;
|
|
516
|
+
}
|
|
517
|
+
const testing = {
|
|
518
|
+
parseAppServerModels,
|
|
519
|
+
parseThreadTokenUsage,
|
|
520
|
+
renderConversationContext
|
|
521
|
+
};
|
|
522
|
+
|
|
523
|
+
//#endregion
|
|
524
|
+
export { createOpenAICodexAppServerStreamFn, listOpenAICodexAppServerModels, resolveOpenAICodexExecutable };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { VERSION } from "../version.js";
|
|
2
|
+
import { resolveOpenAICodexExecutable } from "./openai-codex-app-server.js";
|
|
3
|
+
import { installCapabilityComponent } from "../capabilities/install.js";
|
|
4
|
+
|
|
5
|
+
//#region src/agents/openai-codex-runtime-component.ts
|
|
6
|
+
const OPENAI_RUNTIME_COMPONENT_ID = "openai-runtime";
|
|
7
|
+
function hasConfiguredOpenAICodexProfile(config) {
|
|
8
|
+
return Object.values(config.auth?.profiles ?? {}).some((profile) => profile?.provider === "openai-codex");
|
|
9
|
+
}
|
|
10
|
+
async function ensureOpenAICodexRuntimeComponent(params) {
|
|
11
|
+
const resolveExecutable = params.resolveExecutable ?? resolveOpenAICodexExecutable;
|
|
12
|
+
const existing = resolveExecutable();
|
|
13
|
+
if (existing) {
|
|
14
|
+
return {
|
|
15
|
+
config: params.config,
|
|
16
|
+
executable: existing,
|
|
17
|
+
installed: false,
|
|
18
|
+
slotWarnings: []
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
const installed = await (params.installComponent ?? installCapabilityComponent)({
|
|
22
|
+
id: OPENAI_RUNTIME_COMPONENT_ID,
|
|
23
|
+
config: params.config,
|
|
24
|
+
packageSpec: `@fased/openai-runtime@${params.version ?? VERSION}`
|
|
25
|
+
});
|
|
26
|
+
const executable = resolveExecutable();
|
|
27
|
+
if (!executable) {
|
|
28
|
+
throw new Error("OpenAI sign-in runtime installation completed without an executable. Run `fased components install openai-runtime` and retry.");
|
|
29
|
+
}
|
|
30
|
+
return {
|
|
31
|
+
config: installed.config,
|
|
32
|
+
executable,
|
|
33
|
+
installed: true,
|
|
34
|
+
slotWarnings: installed.slotWarnings
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
//#endregion
|
|
39
|
+
export { OPENAI_RUNTIME_COMPONENT_ID, ensureOpenAICodexRuntimeComponent, hasConfiguredOpenAICodexProfile };
|
|
@@ -19,13 +19,13 @@ import { enqueueCommandInLane } from "../../process/command-queue.js";
|
|
|
19
19
|
import { resolveSignalReactionLevel } from "../../signal/reaction-level.js";
|
|
20
20
|
import { resolveTelegramInlineButtonsScope } from "../../telegram/inline-buttons.js";
|
|
21
21
|
import { resolveTelegramReactionLevel } from "../../telegram/reaction-level.js";
|
|
22
|
+
import { formatUserTime, resolveUserTimeFormat, resolveUserTimezone } from "../date-time.js";
|
|
22
23
|
import { buildModelAliasLines } from "../model-alias-lines.js";
|
|
23
|
-
import {
|
|
24
|
+
import { resolveModelForExecution } from "./model.js";
|
|
24
25
|
import { buildTtsSystemPromptHint } from "../../tts/tts.js";
|
|
25
26
|
import { isReasoningTagProvider } from "../../utils/provider-utils.js";
|
|
26
27
|
import { makeBootstrapWarn, resolveBootstrapContextForRun } from "../bootstrap-files.js";
|
|
27
28
|
import { listChannelSupportedActions, resolveChannelMessageToolHints } from "../channel-tools.js";
|
|
28
|
-
import { formatUserTime, resolveUserTimeFormat, resolveUserTimezone } from "../date-time.js";
|
|
29
29
|
import { resolveFasedAgentDocsPath } from "../docs-path.js";
|
|
30
30
|
import { createPreparedEmbeddedPiSettingsManager } from "../pi-project-settings.js";
|
|
31
31
|
import { detectRuntimeShell } from "../shell-utils.js";
|
|
@@ -177,7 +177,7 @@ async function compactEmbeddedPiSessionDirect(params) {
|
|
|
177
177
|
};
|
|
178
178
|
const agentDir = params.agentDir ?? resolveFasedAgentAgentDir();
|
|
179
179
|
await ensureFasedAgentModelsJson(params.config, agentDir);
|
|
180
|
-
const { model, error, authStorage, modelRegistry } =
|
|
180
|
+
const { model, error, authStorage, modelRegistry } = await resolveModelForExecution(provider, modelId, agentDir, params.config);
|
|
181
181
|
if (!model) {
|
|
182
182
|
const reason = error ?? `Unknown model: ${provider}/${modelId}`;
|
|
183
183
|
return fail(reason);
|