@fased/fased 0.1.54 → 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.
- package/config/capability-catalog.json +12 -0
- package/dist/acp/client.js +2 -2
- package/dist/acp/secret-file.js +2 -2
- package/dist/agents/agent-scope.js +2 -2
- package/dist/agents/apply-patch.js +8 -8
- package/dist/agents/auth-profiles/paths.js +2 -2
- package/dist/agents/auth-profiles/store.js +2 -2
- package/dist/agents/authenticated-model-catalog.js +28 -0
- package/dist/agents/bash-tools.exec-host-node.js +1 -1
- package/dist/agents/bash-tools.exec.js +1 -1
- package/dist/agents/bash-tools.shared.js +2 -2
- package/dist/agents/cli-credentials.js +4 -4
- package/dist/agents/copilot-dynamic-headers.js +37 -0
- package/dist/agents/current-model-catalog.js +9 -13
- package/dist/agents/docs-path.js +3 -3
- package/dist/agents/embedded-pi-mcp.js +4 -4
- package/dist/agents/identity-avatar.js +3 -3
- package/dist/agents/identity-file.js +2 -2
- package/dist/agents/model-catalog-normalized.js +1 -0
- package/dist/agents/model-catalog-source.js +2 -2
- package/dist/agents/model-catalog.js +1 -1
- package/dist/agents/model-metadata.js +58 -9
- package/dist/agents/openai-codex-app-server.js +499 -0
- package/dist/agents/pi-embedded-runner/compact.js +3 -3
- package/dist/agents/pi-embedded-runner/extra-params.js +168 -79
- 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-embedded-subscribe.raw-stream.js +3 -3
- package/dist/agents/pi-extensions/compaction-safeguard.js +3 -3
- package/dist/agents/pi-model-discovery.js +6 -6
- package/dist/agents/pi-project-settings.js +3 -3
- package/dist/agents/pi-tools.js +2 -2
- package/dist/agents/sandbox/fs-bridge.js +2 -2
- package/dist/agents/session-dirs.js +4 -4
- package/dist/agents/session-write-lock.js +13 -13
- package/dist/agents/shell-utils.js +5 -5
- package/dist/agents/skills/bundled-dir.js +4 -4
- package/dist/agents/skills/local-loader.js +6 -6
- package/dist/agents/skills/plugin-skills.js +2 -2
- package/dist/agents/skills/workspace.js +13 -13
- package/dist/agents/skills-install-download.js +7 -7
- package/dist/agents/skills-install-plan.js +2 -2
- package/dist/agents/skills-install.js +2 -2
- package/dist/agents/skills-status.js +2 -2
- package/dist/agents/subagent-depth.js +2 -2
- package/dist/agents/system-prompt-params.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/agents/workspace.js +22 -22
- package/dist/auto-reply/reply/agent-runner-execution.js +2 -2
- package/dist/auto-reply/reply/agent-runner.js +2 -2
- package/dist/auto-reply/reply/commands-export-session.js +7 -7
- 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/post-compaction-audit.js +3 -3
- package/dist/auto-reply/reply/post-compaction-context.js +3 -3
- package/dist/auto-reply/reply/session-reset-model.js +1 -1
- package/dist/auto-reply/reply/session.js +3 -3
- package/dist/auto-reply/skill-commands.js +3 -3
- package/dist/auto-reply/status.js +7 -7
- 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.executables.js +3 -3
- package/dist/browser/chrome.js +5 -5
- package/dist/browser/chrome.profile-decoration.js +6 -6
- package/dist/browser/extension-relay.js +7 -7
- package/dist/browser/profiles-service.js +2 -2
- package/dist/browser/server-context.js +2 -2
- package/dist/browser/trash.js +4 -4
- package/dist/build-info.json +3 -3
- package/dist/canvas-host/a2ui/.bundle.hash +1 -1
- package/dist/canvas-host/server.js +4 -4
- package/dist/capabilities/catalog.js +3 -3
- package/dist/channels/plugins/catalog.js +3 -3
- package/dist/cli/browser-cli-extension.js +6 -6
- package/dist/cli/command-format.js +2 -2
- package/dist/cli/cron-cli/register.cron-add.js +1 -1
- package/dist/cli/cron-cli/register.cron-simple.js +2 -2
- package/dist/cli/dns-cli.js +9 -9
- package/dist/cli/gateway-cli/dev.js +5 -5
- package/dist/cli/gateway-cli/run.js +2 -2
- package/dist/cli/hooks-cli.js +5 -5
- package/dist/cli/lightweight/gateway-runtime-probe.js +2 -2
- package/dist/cli/memory-cli.js +7 -7
- package/dist/cli/nodes-media-utils.js +2 -2
- package/dist/cli/plugins-cli.js +2 -2
- package/dist/cli/program/register.agent.js +1 -1
- package/dist/cli/providers-cli.js +3 -2
- package/dist/cli/secrets-cli.js +3 -3
- package/dist/cli/windows-argv.js +2 -2
- package/dist/commands/agent.js +22 -3
- package/dist/commands/auth-choice.apply.api-providers.js +3 -8
- package/dist/commands/auth-choice.apply.openai.js +13 -7
- package/dist/commands/auth-choice.model-check.js +1 -2
- package/dist/commands/configure.gateway-auth.js +14 -16
- package/dist/commands/dashboard-link.js +3 -3
- package/dist/commands/doctor-config-flow.js +1 -1
- package/dist/commands/doctor-install.js +5 -5
- package/dist/commands/doctor-memory-search.js +2 -2
- package/dist/commands/doctor-platform-notes.js +2 -2
- package/dist/commands/doctor-sandbox.js +2 -2
- package/dist/commands/doctor-state-integrity.js +23 -23
- package/dist/commands/doctor-workspace.js +3 -3
- package/dist/commands/doctor.js +3 -3
- package/dist/commands/hosted-dashboard-probe.js +3 -3
- package/dist/commands/managed-up.js +2 -2
- package/dist/commands/model-picker.js +27 -8
- package/dist/commands/models/list.probe.js +1 -1
- package/dist/commands/models/list.registry.js +13 -17
- package/dist/commands/models/list.status-command.js +2 -2
- package/dist/commands/onboard-auth.config-core.js +1 -1
- package/dist/commands/onboard-auth.config-litellm.js +21 -21
- package/dist/commands/onboard-auth.credentials.js +3 -4
- package/dist/commands/onboard-auth.js +0 -1
- package/dist/commands/onboarding/plugin-install.js +2 -2
- package/dist/commands/openai-codex-model-default.js +28 -5
- package/dist/commands/sessions-cleanup.js +2 -2
- package/dist/commands/signal-install.js +6 -6
- package/dist/commands/status-all/channels.js +2 -2
- package/dist/commands/wallet.js +47 -47
- package/dist/config/cache-utils.js +2 -2
- package/dist/config/includes.js +5 -5
- package/dist/config/io.js +2 -2
- package/dist/config/paths.js +3 -3
- package/dist/config/sat-runtime-ids.js +3 -3
- package/dist/config/sessions/disk-budget.js +6 -6
- package/dist/config/sessions/paths.js +2 -2
- package/dist/config/sessions/store.js +17 -17
- package/dist/config/sessions/transcript.js +4 -4
- package/dist/config/talk.js +2 -2
- package/dist/config/zod-schema.agent-defaults.js +6 -2
- package/dist/config/zod-schema.agent-runtime.js +6 -2
- package/dist/config/zod-schema.core.js +6 -2
- package/dist/control-ui/assets/{app-BKlu6OKz.js → app-D7TXyNRi.js} +1548 -1540
- package/dist/control-ui/assets/chat-model-ref-Djkv93yn.js +2 -0
- package/dist/control-ui/assets/{index-nrFcGMv-.js → index-BmSBom-w.js} +3 -3
- package/dist/control-ui/assets/{providers-BQFrRqym.js → providers-Cc89iMdx.js} +5 -5
- package/dist/control-ui/index.html +1 -1
- package/dist/control-ui/version.json +1 -0
- package/dist/cron/isolated-agent/run.js +6 -2
- package/dist/cron/service/jobs.js +11 -1
- package/dist/cron/service/store.js +2 -2
- package/dist/cron/store.js +6 -6
- package/dist/daemon/systemd-system.js +5 -5
- package/dist/discord/monitor/gateway-plugin.js +2 -2
- package/dist/discord/monitor/thread-bindings.state.js +2 -2
- package/dist/discord/voice/manager.js +1 -1
- package/dist/extensions/sat-mining/src/sat-bond-layout.js +9 -9
- package/dist/gateway/client.js +4 -4
- package/dist/gateway/control-ui-boot-check.js +6 -6
- package/dist/gateway/control-ui-login.js +7 -7
- package/dist/gateway/control-ui.js +11 -9
- package/dist/gateway/hooks-mapping.js +4 -4
- package/dist/gateway/protocol/schema/agents-models-skills.js +66 -4
- package/dist/gateway/server-discovery.js +2 -2
- package/dist/gateway/server-http.js +4 -4
- package/dist/gateway/server-methods/chat.js +3 -3
- package/dist/gateway/server-methods/models.js +8 -8
- package/dist/gateway/server-methods/sessions.js +8 -8
- package/dist/gateway/server-methods/tts.js +2 -2
- package/dist/gateway/server-methods/usage.js +2 -2
- package/dist/gateway/server-model-catalog.js +3 -0
- package/dist/gateway/server.impl.js +3 -3
- package/dist/gateway/session-compaction-checkpoints.js +4 -4
- package/dist/gateway/session-utils.fs.js +24 -24
- package/dist/gateway/session-utils.js +6 -6
- package/dist/gateway/sessions-patch.js +27 -24
- package/dist/hooks/bundled-dir.js +4 -4
- package/dist/hooks/gmail-setup-utils.js +6 -6
- package/dist/hooks/import-url.js +2 -2
- package/dist/hooks/loader.js +4 -4
- package/dist/hooks/workspace.js +7 -7
- package/dist/infra/archive.js +17 -17
- package/dist/infra/boundary-file-read.js +2 -2
- package/dist/infra/boundary-path.js +15 -15
- package/dist/infra/brew.js +2 -2
- package/dist/infra/control-ui-assets.js +14 -14
- package/dist/infra/device-auth-store.js +8 -8
- package/dist/infra/device-identity.js +8 -8
- package/dist/infra/dotenv.js +2 -2
- package/dist/infra/exec-approvals.js +8 -8
- package/dist/infra/exec-command-resolution.js +4 -4
- package/dist/infra/exec-safe-bin-trust.js +2 -2
- package/dist/infra/fased-root.js +5 -5
- package/dist/infra/fs-safe.js +14 -14
- package/dist/infra/gateway-lock.js +11 -11
- package/dist/infra/git-commit.js +5 -5
- package/dist/infra/git-root.js +4 -4
- package/dist/infra/hosted-runtime-artifact.js +3 -3
- package/dist/infra/is-main.js +2 -2
- package/dist/infra/json-file.js +7 -7
- package/dist/infra/outbound/delivery-queue.js +16 -16
- package/dist/infra/path-env.js +3 -3
- package/dist/infra/ports-lsof.js +4 -4
- package/dist/infra/provider-usage.auth.js +3 -3
- package/dist/infra/safe-open-sync.js +2 -2
- package/dist/infra/session-cost-usage.js +9 -9
- package/dist/infra/shell-env.js +2 -2
- package/dist/infra/state-migrations.fs.js +6 -6
- package/dist/infra/state-migrations.js +23 -23
- package/dist/infra/tmp-fased-dir.js +6 -6
- package/dist/infra/update-runner.js +31 -3
- package/dist/infra/widearea-dns.js +3 -3
- package/dist/infra/wsl.js +2 -2
- package/dist/light-update-status.js +1 -1
- package/dist/line/accounts.js +2 -2
- package/dist/line/download.js +2 -2
- package/dist/logging/config.js +3 -3
- package/dist/logging/logger.js +7 -7
- package/dist/managed/federation.js +3 -3
- package/dist/managed/tunnel.js +3 -3
- package/dist/media/store.js +13 -13
- package/dist/media-understanding/runner.js +3 -3
- package/dist/memory/embeddings.js +2 -2
- package/dist/memory/internal.js +10 -10
- package/dist/memory/inventory.js +19 -2
- package/dist/memory/manager-sync-ops.js +7 -7
- package/dist/memory/repair-executor.js +17 -17
- package/dist/node-host/invoke-system-run-plan.js +8 -8
- package/dist/node-host/invoke.js +2 -2
- package/dist/node-host/runner.js +3 -3
- package/dist/pairing/pairing-store.js +3 -3
- package/dist/plugin-sdk/{accounts-DW9OS5Ll.js → accounts-DzWlKv1U.js} +1 -1
- package/dist/plugin-sdk/{actions-DQUXohRr.js → actions-BplQVLL6.js} +4 -4
- package/dist/plugin-sdk/{active-listener-BZQWZPF7.js → active-listener-x4MLhYUw.js} +1 -1
- package/dist/plugin-sdk/{allow-list-BYeKk0Sy.js → allow-list-DyAxs4yw.js} +1 -1
- package/dist/plugin-sdk/{audio-preflight-t4mmHsI2.js → audio-preflight-G8h3Sn8_.js} +43 -47
- package/dist/plugin-sdk/{audit-BZk_6Buw.js → audit-CWknklvI.js} +1 -1
- package/dist/plugin-sdk/{channel-access-CN5HiWdb.js → channel-access-a9Dnfw7-.js} +1 -1
- package/dist/plugin-sdk/{channel-access-configure-B7Kkvx9K.js → channel-access-configure-CD4QDN5E.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 +4 -4
- package/dist/plugin-sdk/{chunk-B2ffJ-LR.js → chunk-B8EZkwiT.js} +1 -1
- package/dist/plugin-sdk/{chunk-items-jOdkyP53.js → chunk-items-CEPklxGe.js} +1 -1
- package/dist/plugin-sdk/command-status.d.ts +2 -2
- package/dist/plugin-sdk/command-status.js +43 -47
- package/dist/plugin-sdk/{commands-registry-BWb4NcfW.js → commands-registry-BfEa4tFA.js} +2 -2
- package/dist/plugin-sdk/{common-C4XrB73N.js → common-CbfckC19.js} +1 -1
- package/dist/plugin-sdk/{config-rySyVtKs.js → config-Bt5GhnA-.js} +105 -73
- package/dist/plugin-sdk/{config-schema-BaybPPrJ.js → config-schema-B9DKr6J5.js} +96239 -81587
- 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 +5 -5
- package/dist/plugin-sdk/discord.js +31 -32
- 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-BGGGrkiN.js} +2 -2
- package/dist/plugin-sdk/{fs-safe-BG-VzVkL.js → fs-safe-xBqok6yR.js} +1 -1
- package/dist/plugin-sdk/{group-mentions-DLOOve8d.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-CGF-Qnp0.js → handle-action-DbzZFYnG.js} +24 -25
- package/dist/plugin-sdk/{helpers-DgRMfCnT.js → helpers-CluGKuIV.js} +1 -1
- package/dist/plugin-sdk/{image-ops-CcBfoMLW.js → image-ops-CUaLtIFj.js} +1 -1
- package/dist/plugin-sdk/index.d.ts +8 -8
- package/dist/plugin-sdk/index.js +47 -51
- package/dist/plugin-sdk/json-store.js +6 -6
- package/dist/plugin-sdk/{login-DpDQyM7r.js → login-DJuHYDiK.js} +3 -3
- package/dist/plugin-sdk/{login-qr-COaSAPY5.js → login-qr-CbHL5ayf.js} +3 -3
- package/dist/plugin-sdk/{manager-Cqz30lA3.js → manager-oHAvZCT3.js} +7 -7
- package/dist/plugin-sdk/{markdown-tables-BOG5sSQQ.js → markdown-tables-Mkx7k92Y.js} +1 -1
- package/dist/plugin-sdk/{media-Bu-nJpPs.js → media-CA8sTmVE.js} +4 -4
- package/dist/plugin-sdk/{monitor-II_NIq3G.js → monitor-CZrN9pev.js} +51 -55
- package/dist/plugin-sdk/{monitor-DL6oEVo8.js → monitor-CmwGqNyV.js} +61 -65
- package/dist/plugin-sdk/{openresponses-http-vkHBBpGY.js → openresponses-http-CWOd4war.js} +43 -47
- package/dist/plugin-sdk/{optional-runtime-dependency-DEojVNfv.js → optional-runtime-dependency-DKmk9PZa.js} +1 -1
- package/dist/plugin-sdk/{outbound-mf2y6KuY.js → outbound-0oN9IfNw.js} +9 -9
- package/dist/plugin-sdk/{outbound-attachment-ivAHpWnn.js → outbound-attachment-DdVkqUzE.js} +2 -2
- package/dist/plugin-sdk/{pairing-message-CvJ6Qa1Q.d.ts → pairing-message-BMkkS038.d.ts} +2 -2
- package/dist/plugin-sdk/{pairing-message-CqYG12t-.js → pairing-message-ClqhfCUk.js} +1 -1
- package/dist/plugin-sdk/{pairing-store-D-21Sphe.js → pairing-store-B01mCSct.js} +2 -2
- package/dist/plugin-sdk/{pi-model-discovery-B6gD1clF.js → pi-model-discovery-Buz0JC1Y.js} +1 -1
- package/dist/plugin-sdk/{pi-model-discovery-runtime-3yDxS3ro.js → pi-model-discovery-runtime-DuwuoteY.js} +2 -2
- package/dist/plugin-sdk/{probe-Cyb-DGA3.js → probe--7xtfzMm.js} +3 -3
- package/dist/plugin-sdk/{probe-Dlk0Jxpw.js → probe-BFroeK3g.js} +1 -1
- package/dist/plugin-sdk/{probe-D8JAILir.js → probe-l_whvGLY.js} +1 -1
- package/dist/plugin-sdk/{resolve-channels-zEnvugag.js → probe-xY3Ky0Tx.js} +3 -4
- package/dist/plugin-sdk/provider-web-search-config-contract.d.ts +2 -2
- package/dist/plugin-sdk/{pw-ai-CMplwiwf.js → pw-ai-B0domrii.js} +6 -8
- package/dist/plugin-sdk/{qmd-manager-DCUE21Kj.js → qmd-manager-CFFeM4Fl.js} +3 -3
- package/dist/plugin-sdk/{query-expansion-Zr9qQixm.js → query-expansion-CAI2kKLQ.js} +1 -1
- package/dist/plugin-sdk/{replies-wiI4veI7.js → replies-1macZ1mZ.js} +4 -4
- package/dist/plugin-sdk/{resolve-channels-ChWKWtA9.js → resolve-channels-87LZrFk_.js} +2 -2
- package/dist/plugin-sdk/resolve-channels-CwB2_019.js +4 -0
- package/dist/plugin-sdk/{resolve-outbound-target-bm9RUK5q.js → resolve-outbound-target-BdH6LUoW.js} +2 -2
- package/dist/plugin-sdk/{resolve-route-ekGNc6os.js → resolve-route-CkNIKKEW.js} +1 -1
- package/dist/plugin-sdk/{resolve-users-BTvjQuui.js → resolve-users-Cxb5wpAQ.js} +1 -1
- package/dist/plugin-sdk/{resolve-users-CTzoruIZ.js → resolve-users-V6dHh_2B.js} +2 -2
- package/dist/plugin-sdk/{retry-policy-BvlC2SPh.js → retry-policy-9ybIh4Fq.js} +1 -1
- package/dist/plugin-sdk/{runtime-ClSakPxR.js → runtime-Dy420wBu.js} +3 -3
- package/dist/plugin-sdk/{runtime-dependency-yAWxH4El.js → runtime-dependency-CIw9t7-k.js} +123 -15
- package/dist/plugin-sdk/{sandbox-paths-lj7_EVuA.js → sandbox-paths-w64tYl0v.js} +1 -1
- package/dist/plugin-sdk/sat-runtime.d.ts +3 -3
- package/dist/plugin-sdk/sat-runtime.js +44 -10
- package/dist/plugin-sdk/{send-D264hFVb.js → send-2VcOMTN5.js} +9 -9
- package/dist/plugin-sdk/{send-CgyS75Av.js → send-BQUtCJFW.js} +10 -10
- package/dist/plugin-sdk/{send-D58yEeH4.js → send-DPJIIYAs.js} +6 -6
- package/dist/plugin-sdk/{send-C7x6gzSl.js → send-Dqes9tdU.js} +13 -13
- package/dist/plugin-sdk/{send-DrAtUGLM.js → send-J4JWKP62.js} +8 -8
- package/dist/plugin-sdk/{session-DyMtb5YQ.js → session-C_n2S5ub.js} +3 -3
- package/dist/plugin-sdk/{skill-commands-Q80wCyry.js → skill-commands-B7wx9ax8.js} +102 -102
- package/dist/plugin-sdk/{slack-C-I6q3NB.js → slack-BouRQG-W.js} +64 -68
- package/dist/plugin-sdk/{slack-actions-dGE_t_Un.js → slack-actions-CasHVtiq.js} +20 -21
- package/dist/plugin-sdk/slack.d.ts +5 -5
- package/dist/plugin-sdk/slack.js +13 -13
- package/dist/plugin-sdk/{ssrf-BZG8Ztod.js → ssrf-fG4UHKBw.js} +180 -2
- package/dist/plugin-sdk/{sticker-cache-DCrDTYIi.js → sticker-cache-BvGEUas3.js} +3 -3
- package/dist/plugin-sdk/{tables-0mhUOh5v.js → tables-CjlQJV4r.js} +2 -2
- package/dist/plugin-sdk/{device-pairing-D2Yq-_U6.js → tailscale-status-DwpNdO3Z.js} +104 -2
- package/dist/plugin-sdk/{targets-znKHngSk.js → targets-QfP164Dh.js} +2 -2
- package/dist/plugin-sdk/{telegram-actions-GBYY8-x9.js → telegram-actions-CwYjV6Db.js} +48 -52
- package/dist/plugin-sdk/telegram.d.ts +5 -5
- package/dist/plugin-sdk/telegram.js +11 -11
- package/dist/plugin-sdk/{thread-bindings.lifecycle-ClzPBK70.js → thread-bindings.lifecycle-DU4iX_Jr.js} +3 -3
- package/dist/plugin-sdk/{thread-bindings.state-Ha01nmrq.js → thread-bindings.state-BgYWFjNF.js} +2 -2
- package/dist/plugin-sdk/{tmp-fased-dir-C_xfeEN9.d.ts → tmp-fased-dir-BdFQvrvw.d.ts} +2 -2
- package/dist/plugin-sdk/{types-DV5TNhMK.d.ts → types-BYDL6dQj.d.ts} +2 -2
- package/dist/plugin-sdk/{types-BI2njxWJ.d.ts → types-CLIvQaVg.d.ts} +39 -5
- package/dist/plugin-sdk/{types-CBCtqtMn.d.ts → types-DyhXnYUr.d.ts} +1 -1
- package/dist/plugin-sdk/{types.plugin-CvUiB3Kh.d.ts → types.plugin-_fbu40Re.d.ts} +8 -5
- package/dist/plugin-sdk/{web-CJMfhGFY.js → web-D0yENDve.js} +52 -56
- package/dist/plugin-sdk/{whatsapp-actions-0ZbGo5ZV.js → whatsapp-actions-BT2nPLyo.js} +18 -19
- package/dist/plugin-sdk/{whatsapp-heartbeat-DGTsuvQ8.js → whatsapp-heartbeat-CiABSZ6G.js} +2 -2
- package/dist/plugin-sdk/whatsapp.d.ts +5 -5
- package/dist/plugin-sdk/whatsapp.js +14 -14
- package/dist/plugin-sdk/{wsl-D5jDUlms.js → wsl-B_ojyEtC.js} +53 -53
- package/dist/plugins/bundled-dir.js +3 -3
- package/dist/plugins/discovery.js +11 -11
- package/dist/plugins/loader.js +13 -13
- package/dist/plugins/manifest-registry.js +2 -2
- package/dist/plugins/manifest.js +4 -4
- package/dist/plugins/path-safety.js +3 -3
- package/dist/plugins/runtime/index.js +1 -1
- package/dist/plugins/status-cache.js +9 -9
- package/dist/plugins/update.js +3 -3
- package/dist/plugins/web-search-install-catalog.js +3 -3
- package/dist/providers/github-copilot-model-discovery.js +51 -0
- package/dist/providers/litellm-models.js +1 -1
- package/dist/providers/openai-codex-model-discovery.js +166 -0
- package/dist/providers/refresh.js +311 -67
- package/dist/providers/registry.js +16 -6
- package/dist/providers/runtime-model-catalog.js +250 -0
- package/dist/secrets/apply.js +16 -16
- package/dist/secrets/audit.js +11 -11
- package/dist/secrets/shared.js +9 -9
- package/dist/security/scan-paths.js +2 -2
- package/dist/shared/config-eval.js +2 -2
- package/dist/shared/model-thinking.js +54 -4
- package/dist/shared/pid-alive.js +2 -2
- package/dist/tasks/standing-orders.js +5 -5
- package/dist/tasks/task-flow-registry.js +5 -5
- package/dist/tasks/task-registry.js +5 -5
- package/dist/tasks/workflow-definitions.js +6 -6
- package/dist/telegram/bot-message-context.js +1 -1
- package/dist/telegram/token.js +5 -5
- package/dist/utils.js +5 -5
- package/dist/wallet/local-socket-signer-broker.js +16 -16
- package/dist/wallet/providers/embedded-keystore-adapter.js +5 -5
- package/dist/wallet/providers/local-socket-signer-adapter.js +2 -2
- package/dist/wallet/wallet-approval-auth.js +5 -5
- package/dist/wallet/wallet-audit-log.js +5 -5
- package/dist/wallet/wallet-custody.js +21 -21
- package/dist/wallet/wallet-inbound-events.js +5 -5
- package/dist/wallet/wallet-observability.js +5 -5
- package/dist/wallet/wallet-policy.js +9 -9
- package/dist/wallet/wallet-provider-registry.js +7 -7
- package/dist/wallet/wallet-runtime-config.js +3 -3
- package/dist/wallet/wallet-secrets-store.js +22 -22
- package/dist/wallet/wallet-send-approvals.js +5 -5
- package/dist/wallet/wallet-settlement-links.js +5 -5
- package/dist/web/accounts.js +3 -3
- package/dist/web/auth-store.js +18 -18
- package/dist/web/session.js +4 -4
- package/dist/wizard/host-security-capability.js +2 -2
- package/dist/wizard/onboarding.host-security.js +7 -7
- package/dist/wizard/onboarding.js +31 -13
- package/dist/wizard/onboarding.wallet.js +44 -44
- 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-B9sWop67.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-CyovJojz.js +0 -11944
- 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/{memory-search-C3C0bD2H.js → memory-search-VFll-AIb.js} +0 -0
- /package/dist/plugin-sdk/{pairing-token-N_6Jbt1L.js → pairing-token-Cs3BRKc0.js} +0 -0
- /package/dist/plugin-sdk/{path-alias-guards-Dg3gU-MA.js → path-alias-guards-BJZD5JMJ.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-prefix-Bqzm6DC1.js → reply-prefix-ClpxvL_w.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,499 @@
|
|
|
1
|
+
import { resolvePluginInstallDir } from "../plugins/install.js";
|
|
2
|
+
import syncFs from "node:fs";
|
|
3
|
+
import os from "node:os";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import { spawn } from "node:child_process";
|
|
6
|
+
import { createAssistantMessageEventStream } from "@mariozechner/pi-ai/compat";
|
|
7
|
+
import readline from "node:readline";
|
|
8
|
+
|
|
9
|
+
//#region src/agents/openai-codex-app-server.ts
|
|
10
|
+
const OPENAI_CODEX_APP_SERVER_VERSION = "0.144.1";
|
|
11
|
+
const DEFAULT_REQUEST_TIMEOUT_MS = 12e4;
|
|
12
|
+
function isRecord(value) {
|
|
13
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
14
|
+
}
|
|
15
|
+
function decodeJwtPayload(token) {
|
|
16
|
+
const encoded = token.split(".")[1];
|
|
17
|
+
if (!encoded) {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
try {
|
|
21
|
+
const parsed = JSON.parse(Buffer.from(encoded, "base64url").toString("utf8"));
|
|
22
|
+
return isRecord(parsed) ? parsed : null;
|
|
23
|
+
} catch {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
function extractOpenAICodexAccountId(token) {
|
|
28
|
+
const payload = decodeJwtPayload(token);
|
|
29
|
+
const auth = payload?.["https://api.openai.com/auth"];
|
|
30
|
+
if (!isRecord(auth)) {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
const accountId = auth.chatgpt_account_id;
|
|
34
|
+
return typeof accountId === "string" && accountId.trim() ? accountId.trim() : null;
|
|
35
|
+
}
|
|
36
|
+
function stateDir() {
|
|
37
|
+
return process.env.FASED_STATE_DIR?.trim() || path.join(process.env.HOME?.trim() || os.homedir(), ".fased");
|
|
38
|
+
}
|
|
39
|
+
function executableName() {
|
|
40
|
+
return process.platform === "win32" ? "codex.exe" : "codex";
|
|
41
|
+
}
|
|
42
|
+
function codexExecutableCandidates() {
|
|
43
|
+
const configured = process.env.FASED_CODEX_BIN?.trim();
|
|
44
|
+
const componentRoot = resolvePluginInstallDir("openai-runtime");
|
|
45
|
+
const candidates = [
|
|
46
|
+
configured,
|
|
47
|
+
path.join(componentRoot, "node_modules", ".bin", executableName()),
|
|
48
|
+
path.join(componentRoot, "node_modules", "@openai", "codex", "bin", executableName()),
|
|
49
|
+
"codex"
|
|
50
|
+
].filter((value) => Boolean(value));
|
|
51
|
+
return [...new Set(candidates)];
|
|
52
|
+
}
|
|
53
|
+
function resolveOpenAICodexExecutable() {
|
|
54
|
+
for (const candidate of codexExecutableCandidates()) {
|
|
55
|
+
if (candidate === "codex") {
|
|
56
|
+
return candidate;
|
|
57
|
+
}
|
|
58
|
+
try {
|
|
59
|
+
if (syncFs.statSync(candidate).isFile()) {
|
|
60
|
+
return candidate;
|
|
61
|
+
}
|
|
62
|
+
} catch {}
|
|
63
|
+
}
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
function managedCodexHome() {
|
|
67
|
+
const directory = path.join(stateDir(), "runtime", "openai-codex");
|
|
68
|
+
syncFs.mkdirSync(directory, {
|
|
69
|
+
recursive: true,
|
|
70
|
+
mode: 448
|
|
71
|
+
});
|
|
72
|
+
return directory;
|
|
73
|
+
}
|
|
74
|
+
var CodexAppServerClient = class {
|
|
75
|
+
constructor(command) {
|
|
76
|
+
this.pending = new Map();
|
|
77
|
+
this.notificationListeners = new Set();
|
|
78
|
+
this.nextId = 1;
|
|
79
|
+
this.closedError = null;
|
|
80
|
+
this.child = spawn(command, [
|
|
81
|
+
"app-server",
|
|
82
|
+
"--stdio",
|
|
83
|
+
"--disable",
|
|
84
|
+
"shell_tool",
|
|
85
|
+
"--config",
|
|
86
|
+
"web_search=\"disabled\""
|
|
87
|
+
], {
|
|
88
|
+
stdio: [
|
|
89
|
+
"pipe",
|
|
90
|
+
"pipe",
|
|
91
|
+
"pipe"
|
|
92
|
+
],
|
|
93
|
+
env: {
|
|
94
|
+
...process.env,
|
|
95
|
+
CODEX_HOME: managedCodexHome()
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
this.lines = readline.createInterface({ input: this.child.stdout });
|
|
99
|
+
this.lines.on("line", (line) => this.handleLine(line));
|
|
100
|
+
this.child.once("error", (error) => this.closeWithError(error));
|
|
101
|
+
this.child.once("exit", (code, signal) => {
|
|
102
|
+
if (!this.closedError && (code !== 0 || signal)) {
|
|
103
|
+
this.closeWithError(new Error(`OpenAI sign-in runtime exited (code=${String(code)}, signal=${String(signal)})`));
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
onNotification(listener) {
|
|
108
|
+
this.notificationListeners.add(listener);
|
|
109
|
+
return () => this.notificationListeners.delete(listener);
|
|
110
|
+
}
|
|
111
|
+
async request(method, params = {}, timeoutMs = DEFAULT_REQUEST_TIMEOUT_MS) {
|
|
112
|
+
if (this.closedError) {
|
|
113
|
+
throw this.closedError;
|
|
114
|
+
}
|
|
115
|
+
const id = this.nextId++;
|
|
116
|
+
const promise = new Promise((resolve, reject) => {
|
|
117
|
+
const timer = setTimeout(() => {
|
|
118
|
+
this.pending.delete(id);
|
|
119
|
+
reject(new Error(`OpenAI sign-in runtime timed out waiting for ${method}`));
|
|
120
|
+
}, timeoutMs);
|
|
121
|
+
timer.unref?.();
|
|
122
|
+
this.pending.set(id, {
|
|
123
|
+
resolve,
|
|
124
|
+
reject,
|
|
125
|
+
timer
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
this.child.stdin.write(`${JSON.stringify({
|
|
129
|
+
id,
|
|
130
|
+
method,
|
|
131
|
+
params
|
|
132
|
+
})}\n`);
|
|
133
|
+
return await promise;
|
|
134
|
+
}
|
|
135
|
+
respond(id, result) {
|
|
136
|
+
this.child.stdin.write(`${JSON.stringify({
|
|
137
|
+
id,
|
|
138
|
+
result
|
|
139
|
+
})}\n`);
|
|
140
|
+
}
|
|
141
|
+
close() {
|
|
142
|
+
this.lines.close();
|
|
143
|
+
this.child.kill("SIGTERM");
|
|
144
|
+
}
|
|
145
|
+
handleLine(line) {
|
|
146
|
+
let message;
|
|
147
|
+
try {
|
|
148
|
+
message = JSON.parse(line);
|
|
149
|
+
} catch {
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
if (message.id !== undefined && !message.method) {
|
|
153
|
+
const request = this.pending.get(message.id);
|
|
154
|
+
if (!request) {
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
this.pending.delete(message.id);
|
|
158
|
+
clearTimeout(request.timer);
|
|
159
|
+
if (message.error) {
|
|
160
|
+
request.reject(new Error(message.error.message || "OpenAI sign-in runtime request failed"));
|
|
161
|
+
} else {
|
|
162
|
+
request.resolve(message.result);
|
|
163
|
+
}
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
for (const listener of this.notificationListeners) {
|
|
167
|
+
listener(message);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
closeWithError(error) {
|
|
171
|
+
this.closedError = error;
|
|
172
|
+
for (const request of this.pending.values()) {
|
|
173
|
+
clearTimeout(request.timer);
|
|
174
|
+
request.reject(error);
|
|
175
|
+
}
|
|
176
|
+
this.pending.clear();
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
async function initializeClient(client, token) {
|
|
180
|
+
const accountId = extractOpenAICodexAccountId(token);
|
|
181
|
+
if (!accountId) {
|
|
182
|
+
throw new Error("OpenAI sign-in token does not contain a ChatGPT account ID");
|
|
183
|
+
}
|
|
184
|
+
await client.request("initialize", {
|
|
185
|
+
clientInfo: {
|
|
186
|
+
name: "fased",
|
|
187
|
+
title: "Fased Agent",
|
|
188
|
+
version: OPENAI_CODEX_APP_SERVER_VERSION
|
|
189
|
+
},
|
|
190
|
+
capabilities: { experimentalApi: true }
|
|
191
|
+
});
|
|
192
|
+
await client.request("account/login/start", {
|
|
193
|
+
type: "chatgptAuthTokens",
|
|
194
|
+
accessToken: token,
|
|
195
|
+
chatgptAccountId: accountId,
|
|
196
|
+
chatgptPlanType: null
|
|
197
|
+
});
|
|
198
|
+
client.onNotification((message) => {
|
|
199
|
+
if (message.id === undefined || message.method !== "account/chatgptAuthTokens/refresh") {
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
client.respond(message.id, {
|
|
203
|
+
accessToken: token,
|
|
204
|
+
chatgptAccountId: accountId,
|
|
205
|
+
chatgptPlanType: null
|
|
206
|
+
});
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
function parseAppServerModels(value) {
|
|
210
|
+
if (!isRecord(value) || !Array.isArray(value.data)) {
|
|
211
|
+
return [];
|
|
212
|
+
}
|
|
213
|
+
return value.data.flatMap((entry) => {
|
|
214
|
+
if (!isRecord(entry) || typeof entry.id !== "string" || !entry.id.trim()) {
|
|
215
|
+
return [];
|
|
216
|
+
}
|
|
217
|
+
const efforts = Array.isArray(entry.supportedReasoningEfforts) ? entry.supportedReasoningEfforts.flatMap((item) => isRecord(item) && typeof item.reasoningEffort === "string" ? [item.reasoningEffort] : []) : [];
|
|
218
|
+
const modalities = Array.isArray(entry.inputModalities) ? entry.inputModalities.filter((item) => item === "text" || item === "image") : [];
|
|
219
|
+
return [{
|
|
220
|
+
id: entry.id.trim(),
|
|
221
|
+
displayName: typeof entry.displayName === "string" && entry.displayName.trim() ? entry.displayName.trim() : entry.id.trim(),
|
|
222
|
+
...typeof entry.description === "string" && entry.description.trim() ? { description: entry.description.trim() } : {},
|
|
223
|
+
hidden: entry.hidden === true,
|
|
224
|
+
inputModalities: modalities.length > 0 ? modalities : ["text"],
|
|
225
|
+
supportedReasoningEfforts: efforts,
|
|
226
|
+
...typeof entry.defaultReasoningEffort === "string" ? { defaultReasoningEffort: entry.defaultReasoningEffort } : {}
|
|
227
|
+
}];
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
async function listOpenAICodexAppServerModels(params) {
|
|
231
|
+
const executable = params.executable ?? resolveOpenAICodexExecutable();
|
|
232
|
+
if (!executable) {
|
|
233
|
+
throw new Error("OpenAI sign-in runtime is not installed. Run `fased components install openai-runtime`.");
|
|
234
|
+
}
|
|
235
|
+
const client = new CodexAppServerClient(executable);
|
|
236
|
+
try {
|
|
237
|
+
await initializeClient(client, params.token);
|
|
238
|
+
return parseAppServerModels(await client.request("model/list", { includeHidden: false }, 15e3)).filter((model) => !model.hidden);
|
|
239
|
+
} finally {
|
|
240
|
+
client.close();
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
function contentText(content) {
|
|
244
|
+
if (typeof content === "string") {
|
|
245
|
+
return content;
|
|
246
|
+
}
|
|
247
|
+
if (!Array.isArray(content)) {
|
|
248
|
+
return "";
|
|
249
|
+
}
|
|
250
|
+
return content.flatMap((part) => isRecord(part) && part.type === "text" && typeof part.text === "string" ? [part.text] : []).join("\n");
|
|
251
|
+
}
|
|
252
|
+
function renderConversationContext(context) {
|
|
253
|
+
const messages = context.messages;
|
|
254
|
+
const latestUserIndex = messages.findLastIndex((message) => message.role === "user");
|
|
255
|
+
const latest = latestUserIndex >= 0 ? messages[latestUserIndex] : undefined;
|
|
256
|
+
const prior = messages.slice(0, Math.max(0, latestUserIndex));
|
|
257
|
+
const transcript = prior.map((message) => {
|
|
258
|
+
if (message.role === "toolResult") {
|
|
259
|
+
return `Tool ${message.toolName}: ${contentText(message.content)}`;
|
|
260
|
+
}
|
|
261
|
+
return `${message.role === "assistant" ? "Assistant" : "User"}: ${contentText(message.content)}`;
|
|
262
|
+
}).filter((value) => !value.endsWith(": ")).join("\n\n");
|
|
263
|
+
const instructions = [
|
|
264
|
+
context.systemPrompt?.trim(),
|
|
265
|
+
transcript ? `Conversation before the current user message:\n${transcript}` : "",
|
|
266
|
+
"Answer the current user message directly. Fased tools are unavailable in this transport turn."
|
|
267
|
+
].filter(Boolean).join("\n\n");
|
|
268
|
+
return {
|
|
269
|
+
instructions,
|
|
270
|
+
prompt: latest ? contentText(latest.content) : "Continue the conversation."
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
function emptyUsage() {
|
|
274
|
+
return {
|
|
275
|
+
input: 0,
|
|
276
|
+
output: 0,
|
|
277
|
+
cacheRead: 0,
|
|
278
|
+
cacheWrite: 0,
|
|
279
|
+
totalTokens: 0,
|
|
280
|
+
cost: {
|
|
281
|
+
input: 0,
|
|
282
|
+
output: 0,
|
|
283
|
+
cacheRead: 0,
|
|
284
|
+
cacheWrite: 0,
|
|
285
|
+
total: 0
|
|
286
|
+
}
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
function readUsageNumber(value) {
|
|
290
|
+
return typeof value === "number" && Number.isFinite(value) && value >= 0 ? value : 0;
|
|
291
|
+
}
|
|
292
|
+
function parseThreadTokenUsage(value) {
|
|
293
|
+
if (!isRecord(value)) {
|
|
294
|
+
return null;
|
|
295
|
+
}
|
|
296
|
+
const last = isRecord(value.last) ? value.last : null;
|
|
297
|
+
if (!last) {
|
|
298
|
+
return null;
|
|
299
|
+
}
|
|
300
|
+
const input = readUsageNumber(last.inputTokens);
|
|
301
|
+
const output = readUsageNumber(last.outputTokens);
|
|
302
|
+
const cacheRead = readUsageNumber(last.cachedInputTokens);
|
|
303
|
+
const totalTokens = readUsageNumber(last.totalTokens) || input + output;
|
|
304
|
+
return {
|
|
305
|
+
input,
|
|
306
|
+
output,
|
|
307
|
+
cacheRead,
|
|
308
|
+
cacheWrite: 0,
|
|
309
|
+
totalTokens,
|
|
310
|
+
cost: {
|
|
311
|
+
input: 0,
|
|
312
|
+
output: 0,
|
|
313
|
+
cacheRead: 0,
|
|
314
|
+
cacheWrite: 0,
|
|
315
|
+
total: 0
|
|
316
|
+
}
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
function createOpenAICodexAppServerStreamFn(params) {
|
|
320
|
+
return (model, context, options) => {
|
|
321
|
+
const eventStream = createAssistantMessageEventStream();
|
|
322
|
+
const stream = eventStream;
|
|
323
|
+
void (async () => {
|
|
324
|
+
const output = {
|
|
325
|
+
role: "assistant",
|
|
326
|
+
content: [],
|
|
327
|
+
api: model.api,
|
|
328
|
+
provider: model.provider,
|
|
329
|
+
model: model.id,
|
|
330
|
+
usage: emptyUsage(),
|
|
331
|
+
stopReason: "stop",
|
|
332
|
+
timestamp: Date.now()
|
|
333
|
+
};
|
|
334
|
+
let client;
|
|
335
|
+
try {
|
|
336
|
+
const token = options?.apiKey?.trim() || (await params?.resolveToken?.())?.trim();
|
|
337
|
+
if (!token) {
|
|
338
|
+
throw new Error("OpenAI ChatGPT sign-in is required");
|
|
339
|
+
}
|
|
340
|
+
const executable = resolveOpenAICodexExecutable();
|
|
341
|
+
if (!executable) {
|
|
342
|
+
throw new Error("OpenAI sign-in runtime is not installed. Run `fased components install openai-runtime`.");
|
|
343
|
+
}
|
|
344
|
+
client = new CodexAppServerClient(executable);
|
|
345
|
+
await initializeClient(client, token);
|
|
346
|
+
const { instructions, prompt } = renderConversationContext(context);
|
|
347
|
+
const started = await client.request("thread/start", {
|
|
348
|
+
model: model.id,
|
|
349
|
+
cwd: process.cwd(),
|
|
350
|
+
approvalPolicy: "never",
|
|
351
|
+
sandbox: "read-only",
|
|
352
|
+
ephemeral: true,
|
|
353
|
+
baseInstructions: instructions,
|
|
354
|
+
config: {
|
|
355
|
+
web_search: "disabled",
|
|
356
|
+
features: { shell_tool: false }
|
|
357
|
+
}
|
|
358
|
+
});
|
|
359
|
+
const thread = isRecord(started.thread) ? started.thread : null;
|
|
360
|
+
const threadId = typeof thread?.id === "string" ? thread.id : "";
|
|
361
|
+
if (!threadId) {
|
|
362
|
+
throw new Error("OpenAI sign-in runtime did not create a thread");
|
|
363
|
+
}
|
|
364
|
+
let text = "";
|
|
365
|
+
let settled = false;
|
|
366
|
+
let settle;
|
|
367
|
+
let reject;
|
|
368
|
+
const completed = new Promise((resolve, rejectPromise) => {
|
|
369
|
+
settle = resolve;
|
|
370
|
+
reject = rejectPromise;
|
|
371
|
+
});
|
|
372
|
+
stream.push({
|
|
373
|
+
type: "start",
|
|
374
|
+
partial: output
|
|
375
|
+
});
|
|
376
|
+
const unsubscribe = client.onNotification((message) => {
|
|
377
|
+
if (message.id !== undefined && message.method) {
|
|
378
|
+
client?.respond(message.id, {
|
|
379
|
+
contentItems: [{
|
|
380
|
+
type: "inputText",
|
|
381
|
+
text: "Tool unavailable in this Fased turn."
|
|
382
|
+
}],
|
|
383
|
+
success: false
|
|
384
|
+
});
|
|
385
|
+
return;
|
|
386
|
+
}
|
|
387
|
+
if (message.method === "item/agentMessage/delta") {
|
|
388
|
+
const delta = typeof message.params?.delta === "string" ? message.params.delta : "";
|
|
389
|
+
if (!delta) {
|
|
390
|
+
return;
|
|
391
|
+
}
|
|
392
|
+
if (text.length === 0) {
|
|
393
|
+
output.content = [{
|
|
394
|
+
type: "text",
|
|
395
|
+
text: ""
|
|
396
|
+
}];
|
|
397
|
+
stream.push({
|
|
398
|
+
type: "text_start",
|
|
399
|
+
contentIndex: 0,
|
|
400
|
+
partial: output
|
|
401
|
+
});
|
|
402
|
+
}
|
|
403
|
+
text += delta;
|
|
404
|
+
output.content[0] = {
|
|
405
|
+
type: "text",
|
|
406
|
+
text
|
|
407
|
+
};
|
|
408
|
+
stream.push({
|
|
409
|
+
type: "text_delta",
|
|
410
|
+
contentIndex: 0,
|
|
411
|
+
delta,
|
|
412
|
+
partial: output
|
|
413
|
+
});
|
|
414
|
+
return;
|
|
415
|
+
}
|
|
416
|
+
if (message.method === "thread/tokenUsage/updated") {
|
|
417
|
+
const usage = parseThreadTokenUsage(message.params?.tokenUsage);
|
|
418
|
+
if (usage) {
|
|
419
|
+
output.usage = usage;
|
|
420
|
+
}
|
|
421
|
+
return;
|
|
422
|
+
}
|
|
423
|
+
if (message.method !== "turn/completed" || settled) {
|
|
424
|
+
return;
|
|
425
|
+
}
|
|
426
|
+
const turn = isRecord(message.params?.turn) ? message.params.turn : null;
|
|
427
|
+
settled = true;
|
|
428
|
+
if (turn?.status === "completed") {
|
|
429
|
+
settle();
|
|
430
|
+
} else {
|
|
431
|
+
const error = isRecord(turn?.error) ? turn.error : null;
|
|
432
|
+
const status = typeof turn?.status === "string" ? turn.status : "unknown";
|
|
433
|
+
reject(new Error(typeof error?.message === "string" ? error.message : `OpenAI sign-in turn ended with status ${status}`));
|
|
434
|
+
}
|
|
435
|
+
});
|
|
436
|
+
await client.request("turn/start", {
|
|
437
|
+
threadId,
|
|
438
|
+
input: [{
|
|
439
|
+
type: "text",
|
|
440
|
+
text: prompt,
|
|
441
|
+
text_elements: []
|
|
442
|
+
}],
|
|
443
|
+
...options?.reasoning ? { effort: options.reasoning } : {}
|
|
444
|
+
});
|
|
445
|
+
const abort = () => reject(new Error("Request was aborted"));
|
|
446
|
+
options?.signal?.addEventListener("abort", abort, { once: true });
|
|
447
|
+
try {
|
|
448
|
+
await Promise.race([completed, new Promise((_, rejectTimeout) => {
|
|
449
|
+
const timer = setTimeout(() => rejectTimeout(new Error("OpenAI sign-in turn timed out")), DEFAULT_REQUEST_TIMEOUT_MS);
|
|
450
|
+
timer.unref?.();
|
|
451
|
+
})]);
|
|
452
|
+
} finally {
|
|
453
|
+
options?.signal?.removeEventListener("abort", abort);
|
|
454
|
+
unsubscribe();
|
|
455
|
+
}
|
|
456
|
+
if (text.length > 0) {
|
|
457
|
+
stream.push({
|
|
458
|
+
type: "text_end",
|
|
459
|
+
contentIndex: 0,
|
|
460
|
+
content: text,
|
|
461
|
+
partial: output
|
|
462
|
+
});
|
|
463
|
+
}
|
|
464
|
+
stream.push({
|
|
465
|
+
type: "done",
|
|
466
|
+
reason: "stop",
|
|
467
|
+
message: output
|
|
468
|
+
});
|
|
469
|
+
stream.end();
|
|
470
|
+
} catch (error) {
|
|
471
|
+
const failed = {
|
|
472
|
+
...output,
|
|
473
|
+
stopReason: options?.signal?.aborted ? "aborted" : "error",
|
|
474
|
+
errorMessage: error instanceof Error ? error.message : String(error)
|
|
475
|
+
};
|
|
476
|
+
stream.push({
|
|
477
|
+
type: "error",
|
|
478
|
+
reason: failed.stopReason,
|
|
479
|
+
error: failed
|
|
480
|
+
});
|
|
481
|
+
stream.end();
|
|
482
|
+
} finally {
|
|
483
|
+
client?.close();
|
|
484
|
+
}
|
|
485
|
+
})();
|
|
486
|
+
return eventStream;
|
|
487
|
+
};
|
|
488
|
+
}
|
|
489
|
+
function isOpenAICodexAppServerModel(model) {
|
|
490
|
+
return model.provider === "openai-codex" && model.compat?.responsesLite === true;
|
|
491
|
+
}
|
|
492
|
+
const testing = {
|
|
493
|
+
parseAppServerModels,
|
|
494
|
+
parseThreadTokenUsage,
|
|
495
|
+
renderConversationContext
|
|
496
|
+
};
|
|
497
|
+
|
|
498
|
+
//#endregion
|
|
499
|
+
export { createOpenAICodexAppServerStreamFn, listOpenAICodexAppServerModels };
|
|
@@ -20,12 +20,12 @@ 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
22
|
import { buildModelAliasLines } from "../model-alias-lines.js";
|
|
23
|
-
import {
|
|
23
|
+
import { formatUserTime, resolveUserTimeFormat, resolveUserTimezone } from "../date-time.js";
|
|
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);
|