@engenty/wizards-runtime 0.20.5 → 0.21.0
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/README.md +3 -3
- package/apps/runtime/dist/agents/studio-assistant.js +7 -3
- package/apps/runtime/dist/agents/subscription.js +20 -25
- package/apps/runtime/dist/app.js +4 -1
- package/apps/runtime/dist/cli/clients.js +6 -24
- package/apps/runtime/dist/cli/connect.js +2 -1
- package/apps/runtime/dist/cli/environment.js +3 -0
- package/apps/runtime/dist/cli/machine.js +1 -70
- package/apps/runtime/dist/cli/main.js +2 -1
- package/apps/runtime/dist/cli/ollama.js +7 -254
- package/apps/runtime/dist/cli/setup.js +12 -9
- package/apps/runtime/dist/decision-model.js +1 -4
- package/apps/runtime/dist/docs/dev/licensing.md +20 -9
- package/apps/runtime/dist/docs/user-guide/command-line.md +5 -2
- package/apps/runtime/dist/elements/outside.js +2 -1
- package/apps/runtime/dist/engine/code-step.js +1 -1
- package/apps/runtime/dist/engine/decide.js +2 -2
- package/apps/runtime/dist/engine/device.js +3 -2
- package/apps/runtime/dist/engine/input.js +1 -1
- package/apps/runtime/dist/engine/runner.js +1 -1
- package/apps/runtime/dist/engine/steps.js +27 -8
- package/apps/runtime/dist/engine/surface.js +1 -1
- package/apps/runtime/dist/engine/template.js +1 -1
- package/apps/runtime/dist/env.js +1 -0
- package/apps/runtime/dist/harness/apple.js +4 -3
- package/apps/runtime/dist/harness/clients.js +117 -0
- package/apps/runtime/dist/harness/index.js +32 -87
- package/apps/runtime/dist/harness/model.js +32 -270
- package/apps/runtime/dist/harness/prompt.js +6 -120
- package/apps/runtime/dist/harness/types.js +5 -3
- package/apps/runtime/dist/local-call.js +6 -0
- package/apps/runtime/dist/local-models.js +53 -177
- package/apps/runtime/dist/mcp/bridge.js +12 -55
- package/apps/runtime/dist/mcp/elements.js +39 -4
- package/apps/runtime/dist/mcp/handler.js +12 -0
- package/apps/runtime/dist/mcp/run-pages.js +238 -0
- package/apps/runtime/dist/mcp/run-tasks.js +157 -0
- package/apps/runtime/dist/mcp/runs.js +129 -0
- package/apps/runtime/dist/mcp/tools.js +4 -95
- package/apps/runtime/dist/models.js +82 -32
- package/apps/runtime/dist/motion-graphics/step.js +2 -2
- package/apps/runtime/dist/prompts/mcp.md +4 -1
- package/apps/runtime/dist/render/downloads.js +1 -1
- package/apps/runtime/dist/render/shaped.js +1 -1
- package/apps/runtime/dist/routes/model-setup.js +77 -0
- package/apps/runtime/dist/routes/studio.js +8 -251
- package/apps/runtime/dist/services/space-categories.js +1 -1
- package/apps/runtime/dist/services/work-ai.js +11 -5
- package/apps/runtime/dist/texts.js +4 -6
- package/apps/runtime/dist/tools/connections.js +3 -0
- package/apps/runtime/dist/tools/harness.js +124 -0
- package/apps/web/dist/assets/AboutDialog-BSdAA4Wi.js +1 -0
- package/apps/web/dist/assets/{BlockEditor-CgjXTWly.js → BlockEditor-0noqMcAl.js} +1 -1
- package/apps/web/dist/assets/Bundle-Ctrq7lHH.js +1 -0
- package/apps/web/dist/assets/CapabilitiesPage-CZlVhBmU.js +2 -0
- package/apps/web/dist/assets/ChangelogDialog-BLCYV4jT.js +1 -0
- package/apps/web/dist/assets/{CodeEditor-2LyHbSre.js → CodeEditor-CpRn9BZq.js} +1 -1
- package/apps/web/dist/assets/ConnectorsSection-B4rRDlFo.js +1 -0
- package/apps/web/dist/assets/EditorPage-CXN-_zzG.js +3 -0
- package/apps/web/dist/assets/FlowPreview-DjQvcWxs.js +1 -0
- package/apps/web/dist/assets/LangSwitch-BuzsLp16.js +1 -0
- package/apps/web/dist/assets/LocalModels-BDfP2v5-.js +1 -0
- package/apps/web/dist/assets/Marketplace-4baBNzEc.js +2 -0
- package/apps/web/dist/assets/NewWizardChannels-B_xHm-bI.js +1 -0
- package/apps/web/dist/assets/NewWizardPage-BmZAY4zi.js +7 -0
- package/apps/web/dist/assets/OnboardingPage-fZq3WiTk.js +1 -0
- package/apps/web/dist/assets/ProtocolSection-v9wIxisg.js +1 -0
- package/apps/web/dist/assets/PublicRunner-BCh0VzAT.js +1 -0
- package/apps/web/dist/assets/{ReadOnly-CbvEK0rz.js → ReadOnly-13stkvNz.js} +1 -1
- package/apps/web/dist/assets/Results-4gmguYzH.js +1 -0
- package/apps/web/dist/assets/RunDrawer-CeEldWRn.js +1 -0
- package/apps/web/dist/assets/SettingsPage-BsKRRlfP.js +2 -0
- package/apps/web/dist/assets/SetupPage-FgA5Kl8z.js +1 -0
- package/apps/web/dist/assets/SharePage-BlBW4oxl.js +1 -0
- package/apps/web/dist/assets/SkillEditor-9QSskfmY.js +1 -0
- package/apps/web/dist/assets/Skills-DdUAyNhR.js +9 -0
- package/apps/web/dist/assets/SpacePage-CHkNPuqt.js +2 -0
- package/apps/web/dist/assets/StudioHome-BwPD-inc.js +1 -0
- package/apps/web/dist/assets/TableEditor-Du1DhbEC.js +7 -0
- package/apps/web/dist/assets/UpdateCheck-DPr9NXq_.js +2 -0
- package/apps/web/dist/assets/brand-DY3lzrOd.js +2 -0
- package/apps/web/dist/assets/changelog-BSdb22c3.js +1 -0
- package/apps/web/dist/assets/code-editor-Bep_LzQ5.js +2 -0
- package/apps/web/dist/assets/host-DiZQ_uws.js +1 -0
- package/apps/web/dist/assets/host-Dw-sMUSd.js +54 -0
- package/apps/web/dist/assets/i18n-DVrYWJaj.js +55 -0
- package/apps/web/dist/assets/index-C2gxK14s.css +1 -0
- package/apps/web/dist/assets/index-lQ4JYHYQ.js +102 -0
- package/apps/web/dist/assets/oss-credits-BHy69wkx.js +1 -0
- package/apps/web/dist/assets/{read-aloud-CRFt5q6k.js → read-aloud-CBycd8TA.js} +1 -1
- package/apps/web/dist/assets/{session-RDdtfee2.js → session-BYLtgklo.js} +1 -1
- package/apps/web/dist/assets/terminal-DmGdMags.js +16 -0
- package/apps/web/dist/assets/texts-ClKS2xhh.js +1 -0
- package/apps/web/dist/assets/theme-DFDOMsVo.js +14 -0
- package/apps/web/dist/assets/ui-CW2I3ecu.js +1 -0
- package/apps/web/dist/assets/ui-DfVpZYIW.js +16 -0
- package/apps/web/dist/assets/{useMutation-BSffqL6W.js → useMutation-BnkuLlQC.js} +1 -1
- package/apps/web/dist/assets/viewers-C6FfRwG1.js +2 -0
- package/apps/web/dist/index.html +18 -16
- package/apps/web/dist/mcp/flow.html +129 -129
- package/bin/bot-tunnel.mjs +375 -0
- package/bin/bot.mjs +494 -69
- package/node_modules/@engenty/{wizards-shared → chatviews}/dist/calc.js +1 -1
- package/node_modules/@engenty/chatviews/dist/chat/a2ui.d.ts +48 -0
- package/node_modules/@engenty/chatviews/dist/chat/a2ui.js +514 -0
- package/node_modules/@engenty/chatviews/dist/chat/check.d.ts +18 -0
- package/node_modules/@engenty/chatviews/dist/chat/check.js +97 -0
- package/node_modules/@engenty/chatviews/dist/chat/index.d.ts +3 -0
- package/node_modules/@engenty/chatviews/dist/chat/index.js +4 -0
- package/node_modules/@engenty/chatviews/dist/chat/library.d.ts +39 -0
- package/node_modules/@engenty/chatviews/dist/chat/library.js +314 -0
- package/node_modules/@engenty/{wizards-shared → chatviews}/dist/numbers.js +1 -1
- package/node_modules/@engenty/chatviews/dist/react/chat.d.ts +33 -0
- package/node_modules/@engenty/chatviews/dist/react/chat.js +150 -0
- package/node_modules/@engenty/chatviews/dist/react/field-looks.d.ts +39 -0
- package/node_modules/@engenty/chatviews/dist/react/field-looks.js +47 -0
- package/node_modules/@engenty/chatviews/dist/react/markdown.d.ts +5 -0
- package/node_modules/@engenty/chatviews/dist/react/markdown.js +11 -0
- package/node_modules/@engenty/chatviews/dist/react/no-devtools.d.ts +0 -0
- package/node_modules/@engenty/chatviews/dist/react/no-devtools.js +8 -0
- package/node_modules/@engenty/chatviews/dist/react/surface.d.ts +39 -0
- package/node_modules/@engenty/chatviews/dist/react/surface.js +552 -0
- package/node_modules/@engenty/chatviews/dist/react/texts.d.ts +39 -0
- package/node_modules/@engenty/chatviews/dist/react/texts.js +42 -0
- package/node_modules/@engenty/chatviews/dist/react/ui.d.ts +112 -0
- package/node_modules/@engenty/chatviews/dist/react/ui.js +212 -0
- package/node_modules/@engenty/{wizards-shared → chatviews}/dist/shape.js +1 -1
- package/node_modules/@engenty/{wizards-shared → chatviews}/dist/surface.js +1 -1
- package/node_modules/@engenty/chatviews/package.json +19 -0
- package/node_modules/@engenty/decision-model/dist/client.d.ts +76 -0
- package/node_modules/@engenty/decision-model/dist/client.js +188 -0
- package/node_modules/@engenty/decision-model/dist/index.d.ts +6 -0
- package/node_modules/@engenty/decision-model/dist/index.js +5 -0
- package/node_modules/@engenty/decision-model/dist/local.d.ts +11 -0
- package/node_modules/@engenty/decision-model/dist/local.js +116 -0
- package/node_modules/@engenty/decision-model/dist/resolve.d.ts +26 -0
- package/node_modules/@engenty/decision-model/dist/resolve.js +53 -0
- package/node_modules/@engenty/decision-model/dist/types.d.ts +80 -0
- package/node_modules/@engenty/decision-model/dist/types.js +6 -0
- package/node_modules/@engenty/decision-model/dist/validate.d.ts +9 -0
- package/node_modules/@engenty/decision-model/dist/validate.js +50 -0
- package/node_modules/@engenty/decision-model/dist/ways.d.ts +42 -0
- package/node_modules/@engenty/decision-model/dist/ways.js +72 -0
- package/node_modules/@engenty/decision-model/package.json +9 -0
- package/node_modules/@engenty/local-models/dist/bridge/index.d.ts +54 -0
- package/node_modules/@engenty/local-models/dist/bridge/index.js +117 -0
- package/node_modules/@engenty/local-models/dist/clients/antigravity.d.ts +37 -0
- package/{apps/runtime/dist/harness → node_modules/@engenty/local-models/dist/clients}/antigravity.js +72 -17
- package/node_modules/@engenty/local-models/dist/clients/chat.d.ts +89 -0
- package/node_modules/@engenty/local-models/dist/clients/chat.js +22 -0
- package/node_modules/@engenty/local-models/dist/clients/claude.d.ts +32 -0
- package/node_modules/@engenty/local-models/dist/clients/claude.js +239 -0
- package/node_modules/@engenty/local-models/dist/clients/client.d.ts +31 -0
- package/node_modules/@engenty/local-models/dist/clients/client.js +2 -0
- package/node_modules/@engenty/local-models/dist/clients/codex.d.ts +35 -0
- package/node_modules/@engenty/local-models/dist/clients/codex.js +254 -0
- package/node_modules/@engenty/local-models/dist/clients/cursor.d.ts +35 -0
- package/node_modules/@engenty/local-models/dist/clients/cursor.js +192 -0
- package/node_modules/@engenty/local-models/dist/clients/detect.d.ts +18 -0
- package/node_modules/@engenty/local-models/dist/clients/detect.js +34 -0
- package/node_modules/@engenty/local-models/dist/clients/env.d.ts +66 -0
- package/{apps/runtime/dist/harness → node_modules/@engenty/local-models/dist/clients}/env.js +62 -31
- package/node_modules/@engenty/local-models/dist/clients/failure.d.ts +26 -0
- package/node_modules/@engenty/local-models/dist/clients/failure.js +35 -0
- package/node_modules/@engenty/local-models/dist/clients/index.d.ts +15 -0
- package/node_modules/@engenty/local-models/dist/clients/index.js +18 -0
- package/node_modules/@engenty/local-models/dist/clients/model.d.ts +129 -0
- package/node_modules/@engenty/local-models/dist/clients/model.js +225 -0
- package/node_modules/@engenty/local-models/dist/clients/prompt.d.ts +36 -0
- package/node_modules/@engenty/local-models/dist/clients/prompt.js +123 -0
- package/node_modules/@engenty/local-models/dist/clients/run.d.ts +15 -0
- package/node_modules/@engenty/local-models/dist/clients/run.js +41 -0
- package/node_modules/@engenty/local-models/dist/index.d.ts +4 -0
- package/node_modules/@engenty/local-models/dist/index.js +4 -0
- package/node_modules/@engenty/local-models/dist/lmstudio/api.d.ts +49 -0
- package/node_modules/@engenty/local-models/dist/lmstudio/api.js +101 -0
- package/node_modules/@engenty/local-models/dist/lmstudio/index.d.ts +3 -0
- package/node_modules/@engenty/local-models/dist/lmstudio/index.js +3 -0
- package/node_modules/@engenty/local-models/dist/lmstudio/load.d.ts +12 -0
- package/node_modules/@engenty/local-models/dist/lmstudio/load.js +100 -0
- package/node_modules/@engenty/local-models/dist/lmstudio/server.d.ts +3 -0
- package/node_modules/@engenty/local-models/dist/lmstudio/server.js +29 -0
- package/node_modules/@engenty/local-models/dist/mlx/helper.d.ts +54 -0
- package/node_modules/@engenty/local-models/dist/mlx/helper.js +149 -0
- package/node_modules/@engenty/local-models/dist/mlx/index.d.ts +3 -0
- package/node_modules/@engenty/local-models/dist/mlx/index.js +3 -0
- package/node_modules/@engenty/local-models/dist/mlx/server.d.ts +19 -0
- package/node_modules/@engenty/local-models/dist/mlx/server.js +82 -0
- package/node_modules/@engenty/local-models/dist/mlx/store.d.ts +16 -0
- package/node_modules/@engenty/local-models/dist/mlx/store.js +153 -0
- package/node_modules/@engenty/local-models/dist/ollama/api.d.ts +37 -0
- package/node_modules/@engenty/local-models/dist/ollama/api.js +147 -0
- package/node_modules/@engenty/local-models/dist/ollama/index.d.ts +3 -0
- package/node_modules/@engenty/local-models/dist/ollama/index.js +3 -0
- package/node_modules/@engenty/local-models/dist/ollama/model.d.ts +54 -0
- package/node_modules/@engenty/local-models/dist/ollama/model.js +302 -0
- package/node_modules/@engenty/local-models/dist/ollama/server.d.ts +3 -0
- package/node_modules/@engenty/local-models/dist/ollama/server.js +45 -0
- package/node_modules/@engenty/local-models/dist/probe.d.ts +57 -0
- package/node_modules/@engenty/local-models/dist/probe.js +174 -0
- package/node_modules/@engenty/local-models/dist/servers/index.d.ts +6 -0
- package/node_modules/@engenty/local-models/dist/servers/index.js +12 -0
- package/node_modules/@engenty/local-models/dist/servers/server.d.ts +84 -0
- package/node_modules/@engenty/local-models/dist/servers/server.js +38 -0
- package/node_modules/@engenty/local-models/package.json +16 -0
- package/node_modules/@engenty/model-setup/dist/catalog.d.ts +36 -0
- package/node_modules/@engenty/model-setup/dist/catalog.js +81 -0
- package/node_modules/@engenty/model-setup/dist/index.d.ts +3 -0
- package/node_modules/@engenty/model-setup/dist/index.js +3 -0
- package/node_modules/@engenty/model-setup/dist/offered.d.ts +7 -0
- package/node_modules/@engenty/model-setup/dist/offered.js +64 -0
- package/node_modules/@engenty/model-setup/dist/react/client.d.ts +46 -0
- package/node_modules/@engenty/model-setup/dist/react/client.js +147 -0
- package/node_modules/@engenty/model-setup/dist/react/columns.d.ts +78 -0
- package/node_modules/@engenty/model-setup/dist/react/columns.js +99 -0
- package/node_modules/@engenty/model-setup/dist/react/host.d.ts +31 -0
- package/node_modules/@engenty/model-setup/dist/react/host.js +48 -0
- package/node_modules/@engenty/model-setup/dist/react/index.d.ts +7 -0
- package/node_modules/@engenty/model-setup/dist/react/index.js +7 -0
- package/node_modules/@engenty/model-setup/dist/react/keys.d.ts +48 -0
- package/node_modules/@engenty/model-setup/dist/react/keys.js +74 -0
- package/node_modules/@engenty/model-setup/dist/react/local-models.d.ts +23 -0
- package/node_modules/@engenty/model-setup/dist/react/local-models.js +134 -0
- package/node_modules/@engenty/model-setup/dist/react/servers.d.ts +4 -0
- package/node_modules/@engenty/model-setup/dist/react/servers.js +13 -0
- package/node_modules/@engenty/model-setup/dist/react/terminal.d.ts +13 -0
- package/node_modules/@engenty/model-setup/dist/react/terminal.js +79 -0
- package/node_modules/@engenty/model-setup/dist/react/tone.d.ts +13 -0
- package/node_modules/@engenty/model-setup/dist/react/tone.js +66 -0
- package/node_modules/@engenty/model-setup/dist/server/apps.d.ts +12 -0
- package/node_modules/@engenty/model-setup/dist/server/apps.js +22 -0
- package/node_modules/@engenty/model-setup/dist/server/clients.d.ts +55 -0
- package/node_modules/@engenty/model-setup/dist/server/clients.js +96 -0
- package/node_modules/@engenty/model-setup/dist/server/index.d.ts +8 -0
- package/node_modules/@engenty/model-setup/dist/server/index.js +8 -0
- package/node_modules/@engenty/model-setup/dist/server/install.d.ts +24 -0
- package/node_modules/@engenty/model-setup/dist/server/install.js +68 -0
- package/node_modules/@engenty/model-setup/dist/server/lmstudio.d.ts +9 -0
- package/node_modules/@engenty/model-setup/dist/server/lmstudio.js +52 -0
- package/node_modules/@engenty/model-setup/dist/server/local-models.d.ts +47 -0
- package/node_modules/@engenty/model-setup/dist/server/local-models.js +164 -0
- package/node_modules/@engenty/model-setup/dist/server/models.d.ts +12 -0
- package/node_modules/@engenty/model-setup/dist/server/models.js +16 -0
- package/node_modules/@engenty/model-setup/dist/server/ollama.d.ts +22 -0
- package/node_modules/@engenty/model-setup/dist/server/ollama.js +146 -0
- package/node_modules/@engenty/model-setup/dist/server/routes.d.ts +51 -0
- package/node_modules/@engenty/model-setup/dist/server/routes.js +211 -0
- package/node_modules/@engenty/model-setup/dist/server/server-apps.d.ts +14 -0
- package/node_modules/@engenty/model-setup/dist/server/server-apps.js +24 -0
- package/node_modules/@engenty/model-setup/dist/server/terminal.d.ts +43 -0
- package/node_modules/@engenty/model-setup/dist/server/terminal.js +222 -0
- package/node_modules/@engenty/model-setup/dist/texts.d.ts +222 -0
- package/node_modules/@engenty/model-setup/dist/texts.js +222 -0
- package/node_modules/@engenty/model-setup/dist/types.d.ts +111 -0
- package/node_modules/@engenty/model-setup/dist/types.js +2 -0
- package/node_modules/@engenty/model-setup/package.json +12 -0
- package/node_modules/@engenty/search-index/dist/catalog-lexical.d.ts +14 -0
- package/node_modules/@engenty/search-index/dist/catalog-lexical.js +165 -0
- package/node_modules/@engenty/search-index/dist/catalog-rank.d.ts +33 -0
- package/node_modules/@engenty/search-index/dist/catalog-rank.js +99 -0
- package/node_modules/@engenty/search-index/dist/catalog-search.d.ts +40 -0
- package/node_modules/@engenty/search-index/dist/catalog-search.js +161 -0
- package/node_modules/@engenty/search-index/dist/chunks.d.ts +17 -0
- package/node_modules/@engenty/search-index/dist/chunks.js +164 -0
- package/node_modules/@engenty/search-index/dist/contracts.d.ts +135 -0
- package/node_modules/@engenty/search-index/dist/contracts.js +9 -0
- package/node_modules/@engenty/search-index/dist/embedder.d.ts +31 -0
- package/node_modules/@engenty/search-index/dist/embedder.js +82 -0
- package/node_modules/@engenty/search-index/dist/embedders/gemini.d.ts +11 -0
- package/node_modules/@engenty/search-index/dist/embedders/gemini.js +54 -0
- package/node_modules/@engenty/search-index/dist/embedders/index.d.ts +5 -0
- package/node_modules/@engenty/search-index/dist/embedders/index.js +5 -0
- package/node_modules/@engenty/search-index/dist/embedders/ollama.d.ts +12 -0
- package/node_modules/@engenty/search-index/dist/embedders/ollama.js +43 -0
- package/node_modules/@engenty/search-index/dist/embedders/openai.d.ts +11 -0
- package/node_modules/@engenty/search-index/dist/embedders/openai.js +36 -0
- package/node_modules/@engenty/search-index/dist/embedders/shared.d.ts +5 -0
- package/node_modules/@engenty/search-index/dist/embedders/shared.js +26 -0
- package/node_modules/@engenty/search-index/dist/embedders/ways.d.ts +16 -0
- package/node_modules/@engenty/search-index/dist/embedders/ways.js +90 -0
- package/node_modules/@engenty/search-index/dist/index.d.ts +10 -0
- package/node_modules/@engenty/search-index/dist/index.js +10 -0
- package/node_modules/@engenty/search-index/dist/payload.d.ts +13 -0
- package/node_modules/@engenty/search-index/dist/payload.js +51 -0
- package/node_modules/@engenty/search-index/dist/registry.d.ts +25 -0
- package/node_modules/@engenty/search-index/dist/registry.js +56 -0
- package/node_modules/@engenty/search-index/dist/scoring.d.ts +10 -0
- package/node_modules/@engenty/search-index/dist/scoring.js +45 -0
- package/node_modules/@engenty/search-index/dist/strategy.d.ts +6 -0
- package/node_modules/@engenty/search-index/dist/strategy.js +25 -0
- package/node_modules/@engenty/search-index/package.json +10 -0
- package/node_modules/@engenty/tool-harness/dist/harness.d.ts +70 -0
- package/node_modules/@engenty/tool-harness/dist/harness.js +170 -0
- package/node_modules/@engenty/tool-harness/dist/index.d.ts +5 -0
- package/node_modules/@engenty/tool-harness/dist/index.js +5 -0
- package/node_modules/@engenty/tool-harness/dist/judge.d.ts +8 -0
- package/node_modules/@engenty/tool-harness/dist/judge.js +39 -0
- package/node_modules/@engenty/tool-harness/dist/levels.d.ts +18 -0
- package/node_modules/@engenty/tool-harness/dist/levels.js +47 -0
- package/node_modules/@engenty/tool-harness/dist/model.d.ts +6 -0
- package/node_modules/@engenty/tool-harness/dist/model.js +60 -0
- package/node_modules/@engenty/tool-harness/dist/schema.d.ts +26 -0
- package/node_modules/@engenty/tool-harness/dist/schema.js +57 -0
- package/node_modules/@engenty/tool-harness/package.json +9 -0
- package/node_modules/@engenty/wizards-shared/dist/catalog-prompt.js +2 -1
- package/node_modules/@engenty/wizards-shared/dist/definition.d.ts +10 -10
- package/node_modules/@engenty/wizards-shared/dist/definition.js +4 -4
- package/node_modules/@engenty/wizards-shared/dist/run-schema.js +1 -1
- package/node_modules/@engenty/wizards-shared/dist/run.d.ts +3 -1
- package/node_modules/@engenty/wizards-shared/dist/run.js +4 -0
- package/node_modules/@engenty/wizards-shared/dist/store.js +2 -1
- package/node_modules/@engenty/wizards-shared/dist/wizard-agents.d.ts +1 -1
- package/node_modules/@engenty/wizards-shared/dist/wizard-agents.js +1 -1
- package/node_modules/@engenty/wizards-shared/dist/wizard-text.js +2 -2
- package/package.json +13 -1
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin/plugin.json +1 -1
- package/apps/runtime/dist/agents/chat-clients.js +0 -344
- package/apps/runtime/dist/harness/claude.js +0 -141
- package/apps/runtime/dist/harness/codex.js +0 -222
- package/apps/runtime/dist/harness/cursor.js +0 -89
- package/apps/runtime/dist/harness/terminal.js +0 -201
- package/apps/web/dist/assets/AboutDialog-DM_2-iLP.js +0 -1
- package/apps/web/dist/assets/Bundle-C0u5HUZL.js +0 -1
- package/apps/web/dist/assets/CapabilitiesPage-DxRUERr-.js +0 -2
- package/apps/web/dist/assets/ChangelogDialog-Cyn3LAch.js +0 -1
- package/apps/web/dist/assets/ConnectorsSection-BYOrwccO.js +0 -1
- package/apps/web/dist/assets/EditorPage-BFUQzJpN.js +0 -3
- package/apps/web/dist/assets/FlowPreview-BXf4EKjU.js +0 -1
- package/apps/web/dist/assets/LangSwitch-BLB7dDce.js +0 -1
- package/apps/web/dist/assets/Marketplace-B3NoH5Va.js +0 -2
- package/apps/web/dist/assets/NewWizardChannels-DhmYe2C8.js +0 -1
- package/apps/web/dist/assets/NewWizardPage-MGKJVDp2.js +0 -7
- package/apps/web/dist/assets/OnboardingPage-RawpCO9J.js +0 -1
- package/apps/web/dist/assets/ProtocolSection-B1MshkAx.js +0 -1
- package/apps/web/dist/assets/PublicRunner-COatyxMi.js +0 -1
- package/apps/web/dist/assets/Results-DI4EHtkh.js +0 -1
- package/apps/web/dist/assets/RunDrawer-xXcbQ9wP.js +0 -1
- package/apps/web/dist/assets/SettingsPage-BcqqYDqw.js +0 -2
- package/apps/web/dist/assets/SetupPage-DG3fJ6fk.js +0 -1
- package/apps/web/dist/assets/SharePage-Drntg_oj.js +0 -1
- package/apps/web/dist/assets/SkillEditor-Ca_bzmjD.js +0 -1
- package/apps/web/dist/assets/Skills-BcgxuD15.js +0 -9
- package/apps/web/dist/assets/SpacePage-CzQAEQj8.js +0 -2
- package/apps/web/dist/assets/StudioHome-DWTDTslp.js +0 -1
- package/apps/web/dist/assets/TableEditor-DirMDIGk.js +0 -7
- package/apps/web/dist/assets/UpdateCheck-C6GlE6Am.js +0 -2
- package/apps/web/dist/assets/brand-BIT7AumL.js +0 -2
- package/apps/web/dist/assets/changelog-CMovB3yB.js +0 -1
- package/apps/web/dist/assets/code-editor-CufyaUFC.js +0 -2
- package/apps/web/dist/assets/host-DNvnJXoi.js +0 -69
- package/apps/web/dist/assets/i18n-WXeVnv7i.js +0 -55
- package/apps/web/dist/assets/index-D1iL3986.css +0 -1
- package/apps/web/dist/assets/index-DOq0CvXM.js +0 -102
- package/apps/web/dist/assets/oss-credits-C4SGbRkz.js +0 -1
- package/apps/web/dist/assets/theme-23bNrOQh.js +0 -14
- package/apps/web/dist/assets/ui-DkEhb2Rt.js +0 -16
- package/apps/web/dist/assets/viewers-CmGDpBjn.js +0 -2
- /package/apps/web/dist/assets/{host-BrP-ENHg.css → terminal-BrP-ENHg.css} +0 -0
- /package/node_modules/@engenty/{wizards-shared → chatviews}/dist/calc.d.ts +0 -0
- /package/node_modules/@engenty/{wizards-shared → chatviews}/dist/numbers.d.ts +0 -0
- /package/node_modules/@engenty/{wizards-shared → chatviews}/dist/shape.d.ts +0 -0
- /package/node_modules/@engenty/{wizards-shared → chatviews}/dist/surface.d.ts +0 -0
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
import { issuesIn, parseLine, record } from "./chat.js";
|
|
2
|
+
import { probeVersion, resolveEnv, run } from "./env.js";
|
|
3
|
+
import { clientFailure } from "./failure.js";
|
|
4
|
+
import { ClientModel } from "./model.js";
|
|
5
|
+
import { lastJson, runClient } from "./run.js";
|
|
6
|
+
/**
|
|
7
|
+
* Claude Code: `claude -p` answers on the person's sign-in — the client's keychain, or the key
|
|
8
|
+
* or token their login shell sets. Tools go over MCP; structured output is validated by the
|
|
9
|
+
* client (`--json-schema`); web search is its own tool.
|
|
10
|
+
*/
|
|
11
|
+
export const CLAUDE_BIN = process.env.CLAUDE_BIN?.trim() || "claude";
|
|
12
|
+
const spec = {
|
|
13
|
+
id: "claude",
|
|
14
|
+
passThrough: /^(ANTHROPIC_|CLAUDE_CODE_OAUTH_TOKEN$|CLAUDE_CODE_USE_|CLAUDE_CONFIG_DIR$|AWS_(PROFILE|REGION|DEFAULT_REGION|ACCESS_KEY_ID|SECRET_ACCESS_KEY|SESSION_TOKEN)$|GOOGLE_APPLICATION_CREDENTIALS$|CLOUD_ML_REGION$)/,
|
|
15
|
+
keyVars: ["ANTHROPIC_API_KEY", "ANTHROPIC_AUTH_TOKEN"],
|
|
16
|
+
async auth(env) {
|
|
17
|
+
try {
|
|
18
|
+
const { stdout } = await run(CLAUDE_BIN, ["auth", "status", "--json"], {
|
|
19
|
+
timeout: 15_000,
|
|
20
|
+
env,
|
|
21
|
+
});
|
|
22
|
+
const status = JSON.parse(stdout.trim());
|
|
23
|
+
if (!status.loggedIn) {
|
|
24
|
+
return "none";
|
|
25
|
+
}
|
|
26
|
+
return status.authMethod === "api_key" ? "api_key" : "subscription";
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
return "none";
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
/** The client's result as the model call wants it: text (or the structured output as JSON) and usage. */
|
|
34
|
+
export function claudeAnswer(event) {
|
|
35
|
+
const u = event.usage ?? {};
|
|
36
|
+
const cacheRead = u.cache_read_input_tokens ?? 0;
|
|
37
|
+
const cacheWrite = u.cache_creation_input_tokens ?? 0;
|
|
38
|
+
return {
|
|
39
|
+
text: event.structured_output !== undefined
|
|
40
|
+
? JSON.stringify(event.structured_output)
|
|
41
|
+
: typeof event.result === "string"
|
|
42
|
+
? event.result
|
|
43
|
+
: JSON.stringify(event.result ?? ""),
|
|
44
|
+
usage: {
|
|
45
|
+
input: (u.input_tokens ?? 0) + cacheRead + cacheWrite,
|
|
46
|
+
cacheRead,
|
|
47
|
+
cacheWrite,
|
|
48
|
+
output: u.output_tokens ?? 0,
|
|
49
|
+
},
|
|
50
|
+
meta: { costUsd: event.total_cost_usd ?? 0, turns: event.num_turns ?? 1 },
|
|
51
|
+
sessionId: event.session_id,
|
|
52
|
+
stopReason: event.stop_reason,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
class ClaudeCodeModel extends ClientModel {
|
|
56
|
+
provider = "claude-code";
|
|
57
|
+
nativeSchema = true;
|
|
58
|
+
async invoke(call) {
|
|
59
|
+
const builtin = [];
|
|
60
|
+
if (call.files.length) {
|
|
61
|
+
builtin.push("Read");
|
|
62
|
+
}
|
|
63
|
+
if (call.webSearch) {
|
|
64
|
+
builtin.push("WebSearch");
|
|
65
|
+
}
|
|
66
|
+
const args = [
|
|
67
|
+
"-p",
|
|
68
|
+
"--output-format",
|
|
69
|
+
"json",
|
|
70
|
+
"--model",
|
|
71
|
+
this.modelId,
|
|
72
|
+
"--tools",
|
|
73
|
+
builtin.join(","),
|
|
74
|
+
"--strict-mcp-config",
|
|
75
|
+
"--setting-sources",
|
|
76
|
+
"",
|
|
77
|
+
"--disable-slash-commands",
|
|
78
|
+
"--no-session-persistence",
|
|
79
|
+
];
|
|
80
|
+
if (call.system) {
|
|
81
|
+
args.push("--system-prompt", call.system);
|
|
82
|
+
}
|
|
83
|
+
if (call.effort) {
|
|
84
|
+
args.push("--effort", call.effort);
|
|
85
|
+
}
|
|
86
|
+
if (call.schema) {
|
|
87
|
+
// The CLI checks the schema with no dialects loaded: one that names its own is refused.
|
|
88
|
+
const { $schema: _dialect, ...schema } = call.schema;
|
|
89
|
+
args.push("--json-schema", JSON.stringify(schema));
|
|
90
|
+
}
|
|
91
|
+
if (call.bridgeUrl) {
|
|
92
|
+
args.push("--mcp-config", JSON.stringify({ mcpServers: { step: { type: "http", url: call.bridgeUrl } } }));
|
|
93
|
+
}
|
|
94
|
+
const allowed = [...builtin, ...(call.bridgeUrl ? ["mcp__step"] : [])];
|
|
95
|
+
if (allowed.length) {
|
|
96
|
+
args.push("--allowedTools", allowed.join(","));
|
|
97
|
+
}
|
|
98
|
+
if (call.files.length) {
|
|
99
|
+
args.push("--add-dir", call.dir);
|
|
100
|
+
}
|
|
101
|
+
const { stdout, stderr, code } = await runClient(CLAUDE_BIN, args, {
|
|
102
|
+
cwd: call.dir,
|
|
103
|
+
env: (await resolveEnv(spec)).env,
|
|
104
|
+
signal: call.signal,
|
|
105
|
+
stdin: call.prompt,
|
|
106
|
+
});
|
|
107
|
+
const event = lastJson(stdout);
|
|
108
|
+
if (!event) {
|
|
109
|
+
throw clientFailure(this.client, stderr.trim() || `exit ${code}`);
|
|
110
|
+
}
|
|
111
|
+
if (event.is_error) {
|
|
112
|
+
// A failed run carries no result, only why (subtype) and sometimes what (errors).
|
|
113
|
+
const why = [
|
|
114
|
+
typeof event.result === "string" ? event.result : "",
|
|
115
|
+
event.subtype ?? "",
|
|
116
|
+
...(event.errors ?? []).map((e) => (typeof e === "string" ? e : JSON.stringify(e))),
|
|
117
|
+
event.num_turns ? `after ${event.num_turns} turns` : "",
|
|
118
|
+
].filter(Boolean);
|
|
119
|
+
throw clientFailure(this.client, why.join(" – ") || "error", JSON.stringify(event).slice(0, 2000));
|
|
120
|
+
}
|
|
121
|
+
return claudeAnswer(event);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
export const claude = {
|
|
125
|
+
...spec,
|
|
126
|
+
id: "claude",
|
|
127
|
+
name: "Claude Code",
|
|
128
|
+
bin: CLAUDE_BIN,
|
|
129
|
+
tools: true,
|
|
130
|
+
version: (env) => probeVersion(CLAUDE_BIN, env, (stdout) => stdout.trim().split(/\s+/)[0] || stdout.trim()),
|
|
131
|
+
login: { args: ["auth", "login"], interactive: false },
|
|
132
|
+
model: (alias, options) => new ClaudeCodeModel(claude, alias || "sonnet", options),
|
|
133
|
+
args: (call) => [
|
|
134
|
+
// The message comes on stdin, so pictures can go with it.
|
|
135
|
+
"-p",
|
|
136
|
+
"--input-format",
|
|
137
|
+
"stream-json",
|
|
138
|
+
"--output-format",
|
|
139
|
+
"stream-json",
|
|
140
|
+
"--verbose",
|
|
141
|
+
// Names a tool as it starts and streams the thinking; whole messages still follow.
|
|
142
|
+
"--include-partial-messages",
|
|
143
|
+
// No built-in tools: `--allowedTools` alone would not take them away.
|
|
144
|
+
"--tools",
|
|
145
|
+
"",
|
|
146
|
+
"--strict-mcp-config",
|
|
147
|
+
...(call.mcp
|
|
148
|
+
? ["--mcp-config", call.mcp.configFile ?? "", "--allowedTools", `mcp__${call.mcp.name}`]
|
|
149
|
+
: []),
|
|
150
|
+
"--disable-slash-commands",
|
|
151
|
+
"--setting-sources",
|
|
152
|
+
"",
|
|
153
|
+
"--append-system-prompt",
|
|
154
|
+
call.system,
|
|
155
|
+
...(call.model ? ["--model", call.model] : []),
|
|
156
|
+
...(call.session ? ["--resume", call.session] : []),
|
|
157
|
+
],
|
|
158
|
+
stdin: (call) => `${JSON.stringify({
|
|
159
|
+
type: "user",
|
|
160
|
+
message: {
|
|
161
|
+
role: "user",
|
|
162
|
+
content: [
|
|
163
|
+
{ type: "text", text: call.message },
|
|
164
|
+
...call.images.map((i) => ({
|
|
165
|
+
type: "image",
|
|
166
|
+
source: { type: "base64", media_type: i.mime, data: i.base64 },
|
|
167
|
+
})),
|
|
168
|
+
],
|
|
169
|
+
},
|
|
170
|
+
})}\n`,
|
|
171
|
+
events(line) {
|
|
172
|
+
const event = parseLine(line);
|
|
173
|
+
if (!event) {
|
|
174
|
+
return [];
|
|
175
|
+
}
|
|
176
|
+
if (event.type === "stream_event") {
|
|
177
|
+
const e = event.event ?? {};
|
|
178
|
+
if (e.type === "content_block_start" && e.content_block?.type === "tool_use") {
|
|
179
|
+
return [
|
|
180
|
+
{ kind: "tool", name: String(e.content_block.name ?? ""), args: {}, started: false },
|
|
181
|
+
];
|
|
182
|
+
}
|
|
183
|
+
if (e.type === "content_block_start" && e.content_block?.type === "thinking") {
|
|
184
|
+
return [{ kind: "thinkingStart" }];
|
|
185
|
+
}
|
|
186
|
+
if (e.type === "content_block_delta" && e.delta?.type === "thinking_delta") {
|
|
187
|
+
return [{ kind: "thinking", text: e.delta.thinking ?? "" }];
|
|
188
|
+
}
|
|
189
|
+
if (e.type === "content_block_delta" && e.delta?.type === "text_delta") {
|
|
190
|
+
return [{ kind: "writing", text: String(e.delta.text ?? "") }];
|
|
191
|
+
}
|
|
192
|
+
return [];
|
|
193
|
+
}
|
|
194
|
+
if (event.type === "user") {
|
|
195
|
+
const out = [];
|
|
196
|
+
for (const block of event.message?.content ?? []) {
|
|
197
|
+
if (block.type === "tool_result") {
|
|
198
|
+
const text = Array.isArray(block.content)
|
|
199
|
+
? block.content.find((c) => c.type === "text")?.text
|
|
200
|
+
: block.content;
|
|
201
|
+
out.push({ kind: "toolDone", issues: issuesIn(text) });
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
return out;
|
|
205
|
+
}
|
|
206
|
+
if (event.type === "assistant") {
|
|
207
|
+
const out = [];
|
|
208
|
+
for (const block of event.message?.content ?? []) {
|
|
209
|
+
if (block.type === "text" && block.text) {
|
|
210
|
+
out.push({ kind: "text", text: block.text });
|
|
211
|
+
}
|
|
212
|
+
else if (block.type === "tool_use") {
|
|
213
|
+
out.push({
|
|
214
|
+
kind: "tool",
|
|
215
|
+
name: String(block.name ?? ""),
|
|
216
|
+
args: record(block.input),
|
|
217
|
+
started: true,
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
return out;
|
|
222
|
+
}
|
|
223
|
+
if (event.type === "result") {
|
|
224
|
+
const out = [];
|
|
225
|
+
if (event.session_id) {
|
|
226
|
+
out.push({ kind: "session", id: String(event.session_id) });
|
|
227
|
+
}
|
|
228
|
+
if (event.is_error) {
|
|
229
|
+
out.push({ kind: "failure", detail: String(event.result ?? "error") });
|
|
230
|
+
}
|
|
231
|
+
else if (typeof event.result === "string") {
|
|
232
|
+
out.push({ kind: "result", text: event.result });
|
|
233
|
+
}
|
|
234
|
+
return out;
|
|
235
|
+
}
|
|
236
|
+
return [];
|
|
237
|
+
},
|
|
238
|
+
signedOut: (detail) => /authenticat|log ?in|oauth|credential/i.test(detail),
|
|
239
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { ChatClient } from "./chat.js";
|
|
2
|
+
import type { EnvSpec } from "./env.js";
|
|
3
|
+
import type { ClientMeta } from "./failure.js";
|
|
4
|
+
import type { ClientModel, ClientModelOptions } from "./model.js";
|
|
5
|
+
/** The AI clients a person signs in to with their own subscription. */
|
|
6
|
+
export declare const CLIENT_IDS: readonly ["claude", "codex", "antigravity", "cursor"];
|
|
7
|
+
export type ClientId = (typeof CLIENT_IDS)[number];
|
|
8
|
+
/**
|
|
9
|
+
* An AI client installed on this computer that answers on the person's own subscription or
|
|
10
|
+
* sign-in: how it is found and signed in, how it runs headless as a model, and how it answers a
|
|
11
|
+
* chat turn with the host's MCP server. Nothing of the host's process reaches it: no key of the
|
|
12
|
+
* host's, no session of a parent client.
|
|
13
|
+
*/
|
|
14
|
+
export interface Client extends EnvSpec, ChatClient, ClientMeta {
|
|
15
|
+
id: ClientId;
|
|
16
|
+
bin: string;
|
|
17
|
+
/** It takes the host's MCP server in a chat; without it, it only writes. */
|
|
18
|
+
tools: boolean;
|
|
19
|
+
/** Null: not installed. Throws ProbeUndecided when the probe could not finish on a busy machine. */
|
|
20
|
+
version(env: NodeJS.ProcessEnv): Promise<string | null>;
|
|
21
|
+
/**
|
|
22
|
+
* What a terminal runs to sign the client in. `interactive`: the client's own app opens and the
|
|
23
|
+
* person ends it.
|
|
24
|
+
*/
|
|
25
|
+
login: {
|
|
26
|
+
args: string[];
|
|
27
|
+
interactive: boolean;
|
|
28
|
+
};
|
|
29
|
+
/** The client as a model; `alias` is the model by the client's own name. */
|
|
30
|
+
model(alias: string, options?: ClientModelOptions): ClientModel;
|
|
31
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { Client } from "./client.js";
|
|
2
|
+
import { type ClientAnswer } from "./model.js";
|
|
3
|
+
/**
|
|
4
|
+
* Codex: `codex exec` answers on the ChatGPT sign-in kept in CODEX_HOME. The person's own
|
|
5
|
+
* config is left out so none of their MCP servers start for a call; tools go over MCP through
|
|
6
|
+
* a config override; structured output is validated by the client (`--output-schema`).
|
|
7
|
+
*/
|
|
8
|
+
export declare const CODEX_BIN: string;
|
|
9
|
+
/** One line of `codex exec --json`. */
|
|
10
|
+
export interface CodexEvent {
|
|
11
|
+
type?: string;
|
|
12
|
+
item?: {
|
|
13
|
+
type?: string;
|
|
14
|
+
text?: string;
|
|
15
|
+
};
|
|
16
|
+
usage?: {
|
|
17
|
+
input_tokens?: number;
|
|
18
|
+
cached_input_tokens?: number;
|
|
19
|
+
cache_write_input_tokens?: number;
|
|
20
|
+
output_tokens?: number;
|
|
21
|
+
};
|
|
22
|
+
error?: {
|
|
23
|
+
message?: string;
|
|
24
|
+
} | string;
|
|
25
|
+
message?: string;
|
|
26
|
+
thread_id?: string;
|
|
27
|
+
}
|
|
28
|
+
/** The events of one run as the model call wants them: the last agent message and the usage. */
|
|
29
|
+
export declare function codexAnswer(stdout: string): {
|
|
30
|
+
answer: ClientAnswer | null;
|
|
31
|
+
failure: string | null;
|
|
32
|
+
};
|
|
33
|
+
/** The arguments every headless `codex exec` starts with: read-only, no approvals, nothing of the person's config. */
|
|
34
|
+
export declare function codexExecArgs(dir: string, webSearch: boolean): string[];
|
|
35
|
+
export declare const codex: Client;
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
import { writeFileSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { issuesIn, parseLine, record } from "./chat.js";
|
|
4
|
+
import { probeVersion, resolveEnv, run } from "./env.js";
|
|
5
|
+
import { clientFailure } from "./failure.js";
|
|
6
|
+
import { ClientModel } from "./model.js";
|
|
7
|
+
import { runClient } from "./run.js";
|
|
8
|
+
/**
|
|
9
|
+
* Codex: `codex exec` answers on the ChatGPT sign-in kept in CODEX_HOME. The person's own
|
|
10
|
+
* config is left out so none of their MCP servers start for a call; tools go over MCP through
|
|
11
|
+
* a config override; structured output is validated by the client (`--output-schema`).
|
|
12
|
+
*/
|
|
13
|
+
export const CODEX_BIN = process.env.CODEX_BIN?.trim() || "codex";
|
|
14
|
+
const spec = {
|
|
15
|
+
id: "codex",
|
|
16
|
+
passThrough: /^CODEX_HOME$/,
|
|
17
|
+
keyVars: [],
|
|
18
|
+
async auth(env) {
|
|
19
|
+
try {
|
|
20
|
+
const { stdout, stderr } = await run(CODEX_BIN, ["login", "status"], {
|
|
21
|
+
timeout: 15_000,
|
|
22
|
+
env,
|
|
23
|
+
});
|
|
24
|
+
const text = `${stdout}\n${stderr}`;
|
|
25
|
+
if (/not logged in/i.test(text)) {
|
|
26
|
+
return "none";
|
|
27
|
+
}
|
|
28
|
+
if (/api key/i.test(text)) {
|
|
29
|
+
return "api_key";
|
|
30
|
+
}
|
|
31
|
+
return /logged in/i.test(text) ? "subscription" : "none";
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
return "none";
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
/** The events of one run as the model call wants them: the last agent message and the usage. */
|
|
39
|
+
export function codexAnswer(stdout) {
|
|
40
|
+
let text = null;
|
|
41
|
+
let usage;
|
|
42
|
+
let failure = null;
|
|
43
|
+
let sessionId;
|
|
44
|
+
for (const line of stdout.split("\n")) {
|
|
45
|
+
let event;
|
|
46
|
+
try {
|
|
47
|
+
event = JSON.parse(line);
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
if (event.type === "thread.started") {
|
|
53
|
+
sessionId = event.thread_id;
|
|
54
|
+
}
|
|
55
|
+
else if (event.type === "item.completed" && event.item?.type === "agent_message") {
|
|
56
|
+
text = event.item.text ?? "";
|
|
57
|
+
}
|
|
58
|
+
else if (event.type === "turn.completed") {
|
|
59
|
+
const u = event.usage ?? {};
|
|
60
|
+
usage = {
|
|
61
|
+
input: u.input_tokens ?? 0,
|
|
62
|
+
cacheRead: u.cached_input_tokens ?? 0,
|
|
63
|
+
cacheWrite: u.cache_write_input_tokens ?? 0,
|
|
64
|
+
output: u.output_tokens ?? 0,
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
else if (event.type === "turn.failed" || event.type === "error") {
|
|
68
|
+
failure =
|
|
69
|
+
typeof event.error === "string"
|
|
70
|
+
? event.error
|
|
71
|
+
: (event.error?.message ?? event.message ?? "error");
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return {
|
|
75
|
+
answer: text === null ? null : { text, usage, sessionId },
|
|
76
|
+
failure,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
/** The arguments every headless `codex exec` starts with: read-only, no approvals, nothing of the person's config. */
|
|
80
|
+
export function codexExecArgs(dir, webSearch) {
|
|
81
|
+
return [
|
|
82
|
+
"exec",
|
|
83
|
+
"-",
|
|
84
|
+
"--json",
|
|
85
|
+
"--ephemeral",
|
|
86
|
+
"--skip-git-repo-check",
|
|
87
|
+
"--ignore-user-config",
|
|
88
|
+
"-s",
|
|
89
|
+
"read-only",
|
|
90
|
+
"-C",
|
|
91
|
+
dir,
|
|
92
|
+
"-c",
|
|
93
|
+
'approval_policy="never"',
|
|
94
|
+
"-c",
|
|
95
|
+
`web_search="${webSearch ? "live" : "disabled"}"`,
|
|
96
|
+
];
|
|
97
|
+
}
|
|
98
|
+
class CodexModel extends ClientModel {
|
|
99
|
+
provider = "codex";
|
|
100
|
+
nativeSchema = true;
|
|
101
|
+
async invoke(call) {
|
|
102
|
+
const args = codexExecArgs(call.dir, call.webSearch);
|
|
103
|
+
if (this.modelId !== "default") {
|
|
104
|
+
args.push("-m", this.modelId);
|
|
105
|
+
}
|
|
106
|
+
if (call.effort) {
|
|
107
|
+
args.push("-c", `model_reasoning_effort="${call.effort}"`);
|
|
108
|
+
}
|
|
109
|
+
if (call.system) {
|
|
110
|
+
// A JSON string is a TOML basic string: the instructions travel as one config value.
|
|
111
|
+
args.push("-c", `developer_instructions=${JSON.stringify(call.system)}`);
|
|
112
|
+
}
|
|
113
|
+
if (call.bridgeUrl) {
|
|
114
|
+
args.push("-c", `mcp_servers.step.url="${call.bridgeUrl}"`, "-c", "mcp_servers.step.startup_timeout_sec=30", "-c", "mcp_servers.step.tool_timeout_sec=600",
|
|
115
|
+
// The tools are the host's own: they run without the client asking anyone.
|
|
116
|
+
"-c", 'mcp_servers.step.default_tools_approval_mode="approve"');
|
|
117
|
+
}
|
|
118
|
+
if (call.schema) {
|
|
119
|
+
const file = join(call.dir, "schema.json");
|
|
120
|
+
writeFileSync(file, JSON.stringify(call.schema));
|
|
121
|
+
args.push("--output-schema", file);
|
|
122
|
+
}
|
|
123
|
+
const { stdout, stderr, code } = await runClient(CODEX_BIN, args, {
|
|
124
|
+
cwd: call.dir,
|
|
125
|
+
env: (await resolveEnv(spec)).env,
|
|
126
|
+
signal: call.signal,
|
|
127
|
+
stdin: call.prompt,
|
|
128
|
+
});
|
|
129
|
+
const { answer, failure } = codexAnswer(stdout);
|
|
130
|
+
if (failure || !answer) {
|
|
131
|
+
throw clientFailure(this.client, failure ?? stderr.trim() ?? `exit ${code}`);
|
|
132
|
+
}
|
|
133
|
+
return answer;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
/** The Codex features that bring tools of their own; the chat works through MCP only. */
|
|
137
|
+
const CODEX_TOOLS_OFF = [
|
|
138
|
+
"shell_tool",
|
|
139
|
+
"unified_exec",
|
|
140
|
+
"apps",
|
|
141
|
+
"plugins",
|
|
142
|
+
"browser_use",
|
|
143
|
+
"in_app_browser",
|
|
144
|
+
"computer_use",
|
|
145
|
+
"image_generation",
|
|
146
|
+
"multi_agent",
|
|
147
|
+
"goals",
|
|
148
|
+
"sleep_tool",
|
|
149
|
+
"tool_suggest",
|
|
150
|
+
"skill_search",
|
|
151
|
+
"memories",
|
|
152
|
+
];
|
|
153
|
+
export const codex = {
|
|
154
|
+
...spec,
|
|
155
|
+
id: "codex",
|
|
156
|
+
name: "Codex",
|
|
157
|
+
bin: CODEX_BIN,
|
|
158
|
+
tools: true,
|
|
159
|
+
version: (env) => probeVersion(CODEX_BIN, env, (stdout) => {
|
|
160
|
+
const words = stdout.trim().split(/\s+/);
|
|
161
|
+
return words[words.length - 1] || null;
|
|
162
|
+
}),
|
|
163
|
+
login: { args: ["login"], interactive: false },
|
|
164
|
+
model: (alias, options) => new CodexModel(codex, alias || "default", options),
|
|
165
|
+
args(call) {
|
|
166
|
+
const mcp = call.mcp;
|
|
167
|
+
const options = [
|
|
168
|
+
"--json",
|
|
169
|
+
"--skip-git-repo-check",
|
|
170
|
+
...(call.model ? ["-m", call.model] : []),
|
|
171
|
+
// Only the host's tools: none of the person's own MCP servers start.
|
|
172
|
+
"--ignore-user-config",
|
|
173
|
+
"-c",
|
|
174
|
+
'sandbox_mode="read-only"',
|
|
175
|
+
"-c",
|
|
176
|
+
'approval_policy="never"',
|
|
177
|
+
"-c",
|
|
178
|
+
'web_search="disabled"',
|
|
179
|
+
// `-c features.…` rather than `--disable`: a feature a later Codex drops is only ignored.
|
|
180
|
+
...CODEX_TOOLS_OFF.flatMap((f) => ["-c", `features.${f}=false`]),
|
|
181
|
+
// A JSON string is a TOML basic string: the instructions travel as one config value.
|
|
182
|
+
"-c",
|
|
183
|
+
`developer_instructions=${JSON.stringify(call.system)}`,
|
|
184
|
+
...(mcp
|
|
185
|
+
? [
|
|
186
|
+
"-c",
|
|
187
|
+
`mcp_servers.${mcp.name}.url=${JSON.stringify(mcp.url)}`,
|
|
188
|
+
// The key comes from the environment, not the command line, where any process could read it.
|
|
189
|
+
"-c",
|
|
190
|
+
`mcp_servers.${mcp.name}.bearer_token_env_var="${mcp.keyVar}"`,
|
|
191
|
+
"-c",
|
|
192
|
+
`mcp_servers.${mcp.name}.startup_timeout_sec=30`,
|
|
193
|
+
"-c",
|
|
194
|
+
`mcp_servers.${mcp.name}.tool_timeout_sec=600`,
|
|
195
|
+
// The tools are the host's own: they run without the client asking anyone.
|
|
196
|
+
"-c",
|
|
197
|
+
`mcp_servers.${mcp.name}.default_tools_approval_mode="approve"`,
|
|
198
|
+
]
|
|
199
|
+
: []),
|
|
200
|
+
];
|
|
201
|
+
// `-i` takes several files, so the pictures come last, after the prompt ("-" = stdin).
|
|
202
|
+
const images = call.images.flatMap((i) => ["-i", i.file]);
|
|
203
|
+
return call.session
|
|
204
|
+
? ["exec", "resume", call.session, "-", ...options, ...images]
|
|
205
|
+
: ["exec", "-", ...options, ...images];
|
|
206
|
+
},
|
|
207
|
+
stdin: (call) => call.message,
|
|
208
|
+
events(line) {
|
|
209
|
+
const event = parseLine(line);
|
|
210
|
+
if (!event) {
|
|
211
|
+
return [];
|
|
212
|
+
}
|
|
213
|
+
const item = event.item ?? {};
|
|
214
|
+
if (event.type === "thread.started" && event.thread_id) {
|
|
215
|
+
return [{ kind: "session", id: String(event.thread_id) }];
|
|
216
|
+
}
|
|
217
|
+
if (item.type === "mcp_tool_call" && event.type === "item.started") {
|
|
218
|
+
return [
|
|
219
|
+
{
|
|
220
|
+
kind: "tool",
|
|
221
|
+
name: String(item.tool ?? ""),
|
|
222
|
+
args: record(item.arguments),
|
|
223
|
+
started: true,
|
|
224
|
+
},
|
|
225
|
+
];
|
|
226
|
+
}
|
|
227
|
+
if (item.type === "mcp_tool_call" && event.type === "item.completed") {
|
|
228
|
+
const text = (item.result?.content ?? []).find((c) => c.type === "text");
|
|
229
|
+
return [{ kind: "toolDone", issues: issuesIn(text?.text) }];
|
|
230
|
+
}
|
|
231
|
+
if (event.type === "item.completed" && item.type === "agent_message" && item.text?.trim()) {
|
|
232
|
+
// A message can end in a line break; the turn puts one blank line between messages.
|
|
233
|
+
return [{ kind: "text", text: String(item.text).trim() }];
|
|
234
|
+
}
|
|
235
|
+
if (event.type === "item.completed" && item.type === "reasoning" && item.text) {
|
|
236
|
+
return [
|
|
237
|
+
{ kind: "thinkingStart" },
|
|
238
|
+
{ kind: "thinking", text: String(item.text), whole: true },
|
|
239
|
+
];
|
|
240
|
+
}
|
|
241
|
+
if (event.type === "turn.failed") {
|
|
242
|
+
const error = event.error;
|
|
243
|
+
return [
|
|
244
|
+
{
|
|
245
|
+
kind: "failure",
|
|
246
|
+
detail: typeof error === "string" ? error : String(error?.message ?? "error"),
|
|
247
|
+
},
|
|
248
|
+
];
|
|
249
|
+
}
|
|
250
|
+
// A top-level `error` is often a retry ("Reconnecting... 1/5"); turn.failed ends the turn.
|
|
251
|
+
return [];
|
|
252
|
+
},
|
|
253
|
+
signedOut: (detail) => /\b401\b|unauthori[sz]ed|not logged in|codex login|authenticat|log ?in/i.test(detail),
|
|
254
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { Client } from "./client.js";
|
|
2
|
+
/**
|
|
3
|
+
* Cursor Agent: `cursor-agent -p` answers on the Cursor sign-in. The call's folder is its
|
|
4
|
+
* workspace: the instructions as AGENTS.md, the tools as an MCP server in .cursor/mcp.json.
|
|
5
|
+
* The answer is asked for as JSON where a schema is wanted.
|
|
6
|
+
*/
|
|
7
|
+
export declare const CURSOR_BIN: string;
|
|
8
|
+
/** What the client prints with `--output-format json`. */
|
|
9
|
+
export interface CursorResult {
|
|
10
|
+
type?: string;
|
|
11
|
+
subtype?: string;
|
|
12
|
+
is_error?: boolean;
|
|
13
|
+
result?: unknown;
|
|
14
|
+
session_id?: string;
|
|
15
|
+
duration_ms?: number;
|
|
16
|
+
}
|
|
17
|
+
export declare const cursor: Client;
|
|
18
|
+
/**
|
|
19
|
+
* Cursor Agent's workspace files for a chat: the instructions, the host's MCP server, and the
|
|
20
|
+
* permissions. The CLI also loads the servers of ~/.cursor/mcp.json and `--approve-mcps`
|
|
21
|
+
* approves them all, so each of those is denied by name; a deny wins over an allow.
|
|
22
|
+
*/
|
|
23
|
+
export declare function cursorWorkspace(input: {
|
|
24
|
+
system: string;
|
|
25
|
+
/** The host's MCP server, by the name the client knows it by. */
|
|
26
|
+
mcp: {
|
|
27
|
+
name: string;
|
|
28
|
+
url: string;
|
|
29
|
+
};
|
|
30
|
+
key: string;
|
|
31
|
+
/** The server names in the person's own ~/.cursor/mcp.json. */
|
|
32
|
+
ownServers: string[];
|
|
33
|
+
}): Record<string, string>;
|
|
34
|
+
/** The server names in the person's own ~/.cursor/mcp.json, which a chat's workspace denies. */
|
|
35
|
+
export declare function ownCursorServers(home?: string): string[];
|