@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,192 @@
|
|
|
1
|
+
import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { homedir } from "node:os";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
import { issuesIn, parseLine, record } from "./chat.js";
|
|
5
|
+
import { probeVersion, resolveEnv, run } from "./env.js";
|
|
6
|
+
import { clientFailure } from "./failure.js";
|
|
7
|
+
import { ClientModel } from "./model.js";
|
|
8
|
+
import { lastJson, runClient } from "./run.js";
|
|
9
|
+
/**
|
|
10
|
+
* Cursor Agent: `cursor-agent -p` answers on the Cursor sign-in. The call's folder is its
|
|
11
|
+
* workspace: the instructions as AGENTS.md, the tools as an MCP server in .cursor/mcp.json.
|
|
12
|
+
* The answer is asked for as JSON where a schema is wanted.
|
|
13
|
+
*/
|
|
14
|
+
export const CURSOR_BIN = process.env.CURSOR_AGENT_BIN?.trim() || "cursor-agent";
|
|
15
|
+
/** The escape sequences a terminal app draws with. */
|
|
16
|
+
const ANSI = new RegExp(`${String.fromCharCode(27)}\\[[0-9;]*[A-Za-z]`, "g");
|
|
17
|
+
const spec = {
|
|
18
|
+
id: "cursor",
|
|
19
|
+
passThrough: /^CURSOR_API_KEY$/,
|
|
20
|
+
keyVars: ["CURSOR_API_KEY"],
|
|
21
|
+
async auth(env) {
|
|
22
|
+
try {
|
|
23
|
+
const { stdout, stderr } = await run(CURSOR_BIN, ["status"], { timeout: 15_000, env });
|
|
24
|
+
// The client draws on the terminal even here: the control sequences are taken out.
|
|
25
|
+
const text = `${stdout}\n${stderr}`.replace(ANSI, "");
|
|
26
|
+
if (/not logged in/i.test(text) || !/logged in/i.test(text)) {
|
|
27
|
+
return "none";
|
|
28
|
+
}
|
|
29
|
+
return env.CURSOR_API_KEY ? "api_key" : "subscription";
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
return "none";
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
class CursorModel extends ClientModel {
|
|
37
|
+
provider = "cursor-agent";
|
|
38
|
+
async invoke(call) {
|
|
39
|
+
if (call.system) {
|
|
40
|
+
writeFileSync(join(call.dir, "AGENTS.md"), call.system);
|
|
41
|
+
}
|
|
42
|
+
if (call.bridgeUrl) {
|
|
43
|
+
mkdirSync(join(call.dir, ".cursor"), { recursive: true });
|
|
44
|
+
writeFileSync(join(call.dir, ".cursor", "mcp.json"), JSON.stringify({ mcpServers: { step: { url: call.bridgeUrl } } }));
|
|
45
|
+
// The call's tools are all on the bridge: the client runs no commands and writes no files.
|
|
46
|
+
writeFileSync(join(call.dir, ".cursor", "cli.json"), JSON.stringify({
|
|
47
|
+
permissions: { allow: ["Mcp(step:*)"], deny: ["Shell(*)", "Write(**)"] },
|
|
48
|
+
}));
|
|
49
|
+
}
|
|
50
|
+
const args = ["-p", "--output-format", "json", "--workspace", call.dir, "--approve-mcps"];
|
|
51
|
+
if (this.modelId !== "auto") {
|
|
52
|
+
args.push("--model", this.modelId);
|
|
53
|
+
}
|
|
54
|
+
if (!call.bridgeUrl) {
|
|
55
|
+
// Nothing to work through: the client answers, it does not edit.
|
|
56
|
+
args.push("--mode", "ask");
|
|
57
|
+
}
|
|
58
|
+
const { stdout, stderr, code } = await runClient(CURSOR_BIN, args, {
|
|
59
|
+
cwd: call.dir,
|
|
60
|
+
env: (await resolveEnv(spec)).env,
|
|
61
|
+
signal: call.signal,
|
|
62
|
+
stdin: call.prompt,
|
|
63
|
+
});
|
|
64
|
+
const event = lastJson(stdout);
|
|
65
|
+
if (!event) {
|
|
66
|
+
throw clientFailure(this.client, stderr.trim() || `exit ${code}`);
|
|
67
|
+
}
|
|
68
|
+
if (event.is_error) {
|
|
69
|
+
throw clientFailure(this.client, String(event.result ?? "error"));
|
|
70
|
+
}
|
|
71
|
+
return {
|
|
72
|
+
text: typeof event.result === "string" ? event.result : JSON.stringify(event.result ?? ""),
|
|
73
|
+
sessionId: event.session_id,
|
|
74
|
+
meta: { durationMs: event.duration_ms ?? 0 },
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
export const cursor = {
|
|
79
|
+
...spec,
|
|
80
|
+
id: "cursor",
|
|
81
|
+
name: "Cursor Agent",
|
|
82
|
+
bin: CURSOR_BIN,
|
|
83
|
+
tools: true,
|
|
84
|
+
version: (env) => probeVersion(CURSOR_BIN, env, (stdout) => stdout.trim().split("\n").pop()?.trim() || null),
|
|
85
|
+
login: { args: ["login"], interactive: false },
|
|
86
|
+
model: (alias, options) => new CursorModel(cursor, alias || "auto", options),
|
|
87
|
+
// The workspace (call.dir) holds the instructions as AGENTS.md, the MCP server and the
|
|
88
|
+
// permissions in .cursor/: see cursorWorkspace().
|
|
89
|
+
args: (call) => [
|
|
90
|
+
"-p",
|
|
91
|
+
"--output-format",
|
|
92
|
+
"stream-json",
|
|
93
|
+
"--workspace",
|
|
94
|
+
call.dir,
|
|
95
|
+
...(call.mcp ? ["--approve-mcps"] : []),
|
|
96
|
+
...(call.model && call.model !== "auto" ? ["--model", call.model] : []),
|
|
97
|
+
...(call.session ? ["--resume", call.session] : []),
|
|
98
|
+
],
|
|
99
|
+
stdin: (call) => call.message,
|
|
100
|
+
events(line) {
|
|
101
|
+
const event = parseLine(line);
|
|
102
|
+
if (!event) {
|
|
103
|
+
return [];
|
|
104
|
+
}
|
|
105
|
+
const out = [];
|
|
106
|
+
if (event.type === "system" && event.session_id) {
|
|
107
|
+
out.push({ kind: "session", id: String(event.session_id) });
|
|
108
|
+
}
|
|
109
|
+
else if (event.type === "assistant") {
|
|
110
|
+
for (const block of event.message?.content ?? []) {
|
|
111
|
+
if (block.type === "text" && block.text) {
|
|
112
|
+
out.push({ kind: "text", text: block.text });
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
else if (event.type === "tool_call" && event.subtype === "started") {
|
|
117
|
+
const call = record(event.tool_call);
|
|
118
|
+
// The call as its protobuf JSON: { mcpToolCall: { args: { toolName, args, … } } }.
|
|
119
|
+
const mcp = record(record(call.mcpToolCall).args);
|
|
120
|
+
if (mcp.toolName || mcp.name) {
|
|
121
|
+
out.push({
|
|
122
|
+
kind: "tool",
|
|
123
|
+
name: String(mcp.toolName ?? mcp.name),
|
|
124
|
+
args: record(mcp.args),
|
|
125
|
+
started: true,
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
else if (event.type === "tool_call" && event.subtype === "completed") {
|
|
130
|
+
const call = record(record(event.tool_call).mcpToolCall);
|
|
131
|
+
const mcp = record(call.args);
|
|
132
|
+
if (mcp.toolName || mcp.name) {
|
|
133
|
+
const content = record(record(call.result).success).content;
|
|
134
|
+
const first = Array.isArray(content) ? record(content[0]) : {};
|
|
135
|
+
out.push({ kind: "toolDone", issues: issuesIn(record(first.text).text ?? first.text) });
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
else if (event.type === "thinking" && event.subtype === "delta") {
|
|
139
|
+
out.push({ kind: "thinking", text: String(event.text ?? "") });
|
|
140
|
+
}
|
|
141
|
+
else if (event.type === "result") {
|
|
142
|
+
if (event.session_id) {
|
|
143
|
+
out.push({ kind: "session", id: String(event.session_id) });
|
|
144
|
+
}
|
|
145
|
+
if (event.is_error) {
|
|
146
|
+
out.push({ kind: "failure", detail: String(event.result ?? "error") });
|
|
147
|
+
}
|
|
148
|
+
else if (typeof event.result === "string") {
|
|
149
|
+
out.push({ kind: "result", text: event.result });
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
return out;
|
|
153
|
+
},
|
|
154
|
+
signedOut: (detail) => /authenticat|log ?in|CURSOR_API_KEY|unauthori[sz]ed|\b401\b/i.test(detail),
|
|
155
|
+
};
|
|
156
|
+
/**
|
|
157
|
+
* Cursor Agent's workspace files for a chat: the instructions, the host's MCP server, and the
|
|
158
|
+
* permissions. The CLI also loads the servers of ~/.cursor/mcp.json and `--approve-mcps`
|
|
159
|
+
* approves them all, so each of those is denied by name; a deny wins over an allow.
|
|
160
|
+
*/
|
|
161
|
+
export function cursorWorkspace(input) {
|
|
162
|
+
const { name, url } = input.mcp;
|
|
163
|
+
return {
|
|
164
|
+
"AGENTS.md": input.system,
|
|
165
|
+
".cursor/mcp.json": JSON.stringify({
|
|
166
|
+
mcpServers: {
|
|
167
|
+
[name]: { url, headers: { Authorization: `Bearer ${input.key}` } },
|
|
168
|
+
},
|
|
169
|
+
}),
|
|
170
|
+
".cursor/cli.json": JSON.stringify({
|
|
171
|
+
permissions: {
|
|
172
|
+
allow: [`Mcp(${name}:*)`],
|
|
173
|
+
deny: [
|
|
174
|
+
"Shell(*)",
|
|
175
|
+
"Read(**)",
|
|
176
|
+
"Write(**)",
|
|
177
|
+
...input.ownServers.filter((s) => s !== name).map((s) => `Mcp(${s}:*)`),
|
|
178
|
+
],
|
|
179
|
+
},
|
|
180
|
+
}),
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
/** The server names in the person's own ~/.cursor/mcp.json, which a chat's workspace denies. */
|
|
184
|
+
export function ownCursorServers(home = homedir()) {
|
|
185
|
+
try {
|
|
186
|
+
const config = JSON.parse(readFileSync(join(home, ".cursor", "mcp.json"), "utf8"));
|
|
187
|
+
return Object.keys(config.mcpServers ?? {});
|
|
188
|
+
}
|
|
189
|
+
catch {
|
|
190
|
+
return [];
|
|
191
|
+
}
|
|
192
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type ClientAuth, type EnvSpec } from "./env.js";
|
|
2
|
+
/** A client as detection needs it: how it signs in, and its version. */
|
|
3
|
+
export interface Detectable extends EnvSpec {
|
|
4
|
+
/** Null: not installed. Throws ProbeUndecided when the probe could not finish on a busy machine. */
|
|
5
|
+
version(env: NodeJS.ProcessEnv): Promise<string | null>;
|
|
6
|
+
}
|
|
7
|
+
/** A client on this computer as it is now. */
|
|
8
|
+
export interface ClientStatus {
|
|
9
|
+
/** Null: not installed. */
|
|
10
|
+
version: string | null;
|
|
11
|
+
auth: ClientAuth;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Whether a client is installed and signed in, asked again after a minute. `force` asks now and
|
|
15
|
+
* reads the login shell again: the person may just have signed in or set a key. A probe that
|
|
16
|
+
* could not finish on a busy machine keeps what the last look found.
|
|
17
|
+
*/
|
|
18
|
+
export declare function detectClient(client: Detectable, force?: boolean): Promise<ClientStatus>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { forgetEnv, ProbeUndecided, resolveEnv } from "./env.js";
|
|
2
|
+
/** How long a look at a client holds: it may get installed or signed in meanwhile. */
|
|
3
|
+
const FRESH_MS = 60_000;
|
|
4
|
+
const detected = new Map();
|
|
5
|
+
/**
|
|
6
|
+
* Whether a client is installed and signed in, asked again after a minute. `force` asks now and
|
|
7
|
+
* reads the login shell again: the person may just have signed in or set a key. A probe that
|
|
8
|
+
* could not finish on a busy machine keeps what the last look found.
|
|
9
|
+
*/
|
|
10
|
+
export async function detectClient(client, force = false) {
|
|
11
|
+
const hit = detected.get(client.id);
|
|
12
|
+
if (!force && hit && Date.now() - hit.at < FRESH_MS) {
|
|
13
|
+
return hit.value;
|
|
14
|
+
}
|
|
15
|
+
if (force) {
|
|
16
|
+
forgetEnv(client.id);
|
|
17
|
+
}
|
|
18
|
+
let value = { version: null, auth: "none" };
|
|
19
|
+
try {
|
|
20
|
+
const { env, auth } = await resolveEnv(client);
|
|
21
|
+
const version = await client.version(env);
|
|
22
|
+
if (version) {
|
|
23
|
+
value = { version, auth };
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
catch (err) {
|
|
27
|
+
if (err instanceof ProbeUndecided && hit?.value.version) {
|
|
28
|
+
// The machine is busy (another client is working): the client was there, it still is.
|
|
29
|
+
value = hit.value;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
detected.set(client.id, { at: Date.now(), value });
|
|
33
|
+
return value;
|
|
34
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/** How a client is signed in: with the person's subscription, with a key from their shell, or not at all. */
|
|
2
|
+
export type ClientAuth = "subscription" | "api_key" | "none";
|
|
3
|
+
/** What the login shell decides about a client: its environment and its sign-in. */
|
|
4
|
+
export interface EnvSpec {
|
|
5
|
+
id: string;
|
|
6
|
+
/** Variables of the login shell the client may see: how it signs in and where it talks to. */
|
|
7
|
+
passThrough: RegExp;
|
|
8
|
+
/** Of those, the keys and tokens: held back while the client is signed in without them. */
|
|
9
|
+
keyVars: string[];
|
|
10
|
+
auth(env: NodeJS.ProcessEnv): Promise<ClientAuth>;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Runs a file and gives what it printed, like execFile: it rejects when the file is not there,
|
|
14
|
+
* ends with another code than 0, or takes longer than `timeout` (then with `killed` and `signal`
|
|
15
|
+
* set, as execFile does).
|
|
16
|
+
*/
|
|
17
|
+
export declare function run(file: string, args: string[], options?: {
|
|
18
|
+
env?: NodeJS.ProcessEnv;
|
|
19
|
+
cwd?: string;
|
|
20
|
+
timeout?: number;
|
|
21
|
+
}): Promise<{
|
|
22
|
+
stdout: string;
|
|
23
|
+
stderr: string;
|
|
24
|
+
}>;
|
|
25
|
+
/** A version probe that could not finish: the machine is busy, the client may well be there. */
|
|
26
|
+
export declare class ProbeUndecided extends Error {
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* `<bin> --version`, read by `pick`. Null: the client is not there or does not answer. A probe
|
|
30
|
+
* that ran out of time or could not start for want of resources throws ProbeUndecided: a client
|
|
31
|
+
* that starts slowly while another one is busy is still installed.
|
|
32
|
+
*/
|
|
33
|
+
export declare function probeVersion(bin: string, env: NodeJS.ProcessEnv, pick: (stdout: string) => string | null): Promise<string | null>;
|
|
34
|
+
/** The person's login shell, asked once: a desktop app and a bare dev server start without its variables. */
|
|
35
|
+
export declare function loginShellEnv(): Promise<Record<string, string>>;
|
|
36
|
+
/**
|
|
37
|
+
* The environment a client gets: its sign-in as the login shell sets it (else as this process
|
|
38
|
+
* has it), PATH as the shell has it so the client is found from a GUI app too, and nothing else —
|
|
39
|
+
* no key of the host's, no session of a parent client.
|
|
40
|
+
*/
|
|
41
|
+
export declare function clientEnv(shell: Record<string, string | undefined>, own: Record<string, string | undefined>, passThrough: RegExp,
|
|
42
|
+
/** Folders before the shell's PATH: the clients the host installed. */
|
|
43
|
+
first?: string[], platform?: NodeJS.Platform): NodeJS.ProcessEnv;
|
|
44
|
+
/** The environment without the named keys. */
|
|
45
|
+
export declare function stripKeys(env: NodeJS.ProcessEnv, keyVars: string[]): NodeJS.ProcessEnv;
|
|
46
|
+
/**
|
|
47
|
+
* Where the host installs clients, searched before the shell's PATH: a setup that installs a
|
|
48
|
+
* client into a folder of its own names the folder here, once, before any client runs.
|
|
49
|
+
*/
|
|
50
|
+
export declare function setClientFolders(list: () => string[]): void;
|
|
51
|
+
export interface ResolvedEnv {
|
|
52
|
+
env: NodeJS.ProcessEnv;
|
|
53
|
+
auth: ClientAuth;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* The environment a client runs in, decided once: the subscription sign-in comes first — it is
|
|
57
|
+
* what the person installed the client for — so a key the shell sets is held back while the
|
|
58
|
+
* client is signed in without it, and used only where it is the one way in.
|
|
59
|
+
*/
|
|
60
|
+
export declare function resolveEnv(spec: EnvSpec): Promise<ResolvedEnv>;
|
|
61
|
+
/** The environment of a sign-in: the client on its own, without a key of the shell, in a real terminal. */
|
|
62
|
+
export declare function loginEnv(spec: EnvSpec): Promise<NodeJS.ProcessEnv>;
|
|
63
|
+
/** The client's sign-in right now, on its own: asked again and again while the person signs in. */
|
|
64
|
+
export declare function freshAuth(spec: EnvSpec): Promise<ClientAuth>;
|
|
65
|
+
/** Forgets what was decided: the person may just have signed in or changed their shell. */
|
|
66
|
+
export declare function forgetEnv(id?: string): void;
|
package/{apps/runtime/dist/harness → node_modules/@engenty/local-models/dist/clients}/env.js
RENAMED
|
@@ -1,8 +1,45 @@
|
|
|
1
|
-
import { spawn } from "node:child_process";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
|
|
1
|
+
import { spawn as spawnDetached } from "node:child_process";
|
|
2
|
+
// cross-spawn: on Windows a command from npm is a .cmd file, which only cmd.exe starts, with
|
|
3
|
+
// its arguments quoted the way cmd.exe reads them. Elsewhere it is child_process.spawn.
|
|
4
|
+
import spawn from "cross-spawn";
|
|
5
|
+
/**
|
|
6
|
+
* Runs a file and gives what it printed, like execFile: it rejects when the file is not there,
|
|
7
|
+
* ends with another code than 0, or takes longer than `timeout` (then with `killed` and `signal`
|
|
8
|
+
* set, as execFile does).
|
|
9
|
+
*/
|
|
10
|
+
export function run(file, args, options = {}) {
|
|
11
|
+
return new Promise((resolve, reject) => {
|
|
12
|
+
const child = spawn(file, args, {
|
|
13
|
+
env: options.env,
|
|
14
|
+
cwd: options.cwd,
|
|
15
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
16
|
+
timeout: options.timeout,
|
|
17
|
+
});
|
|
18
|
+
let stdout = "";
|
|
19
|
+
let stderr = "";
|
|
20
|
+
child.stdout?.on("data", (chunk) => {
|
|
21
|
+
stdout += chunk.toString("utf8");
|
|
22
|
+
});
|
|
23
|
+
child.stderr?.on("data", (chunk) => {
|
|
24
|
+
stderr += chunk.toString("utf8");
|
|
25
|
+
});
|
|
26
|
+
child.on("error", reject);
|
|
27
|
+
child.on("close", (code, signal) => {
|
|
28
|
+
if (code === 0) {
|
|
29
|
+
resolve({ stdout, stderr });
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
reject(Object.assign(new Error(`${file} ended with ${signal ?? code}`), {
|
|
33
|
+
code,
|
|
34
|
+
signal,
|
|
35
|
+
killed: child.killed,
|
|
36
|
+
stdout,
|
|
37
|
+
stderr,
|
|
38
|
+
}));
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
}
|
|
6
43
|
/** A version probe that could not finish: the machine is busy, the client may well be there. */
|
|
7
44
|
export class ProbeUndecided extends Error {
|
|
8
45
|
}
|
|
@@ -30,16 +67,16 @@ let shellEnv = null;
|
|
|
30
67
|
/** The person's login shell, asked once: a desktop app and a bare dev server start without its variables. */
|
|
31
68
|
export function loginShellEnv() {
|
|
32
69
|
shellEnv ??= new Promise((done) => {
|
|
33
|
-
// Windows has no login shell to ask: the
|
|
70
|
+
// Windows has no login shell to ask: the process's own environment is the person's.
|
|
34
71
|
if (process.platform === "win32") {
|
|
35
72
|
done({});
|
|
36
73
|
return;
|
|
37
74
|
}
|
|
38
75
|
const shell = process.env.SHELL || "/bin/zsh";
|
|
39
|
-
// In a session of its own, away from the terminal
|
|
76
|
+
// In a session of its own, away from the terminal this process runs in: an interactive
|
|
40
77
|
// shell takes over that terminal for its job control and keeps it when it ends, and Ctrl-C
|
|
41
78
|
// then reaches nobody. (execFile cannot do this: it drops `detached`.)
|
|
42
|
-
const child =
|
|
79
|
+
const child = spawnDetached(shell, ["-l", "-i", "-c", "env"], {
|
|
43
80
|
detached: true,
|
|
44
81
|
stdio: ["ignore", "pipe", "ignore"],
|
|
45
82
|
timeout: 10_000,
|
|
@@ -69,13 +106,18 @@ export function loginShellEnv() {
|
|
|
69
106
|
});
|
|
70
107
|
return shellEnv;
|
|
71
108
|
}
|
|
109
|
+
/**
|
|
110
|
+
* What a Windows program needs of the environment to start at all: the system's folders, the
|
|
111
|
+
* user's folders, and how commands are found and run (a .cmd needs ComSpec).
|
|
112
|
+
*/
|
|
113
|
+
const WINDOWS_BASE = /^(SystemRoot|SystemDrive|windir|ComSpec|PATHEXT|TEMP|TMP|USERPROFILE|USERNAME|USERDOMAIN|HOMEDRIVE|HOMEPATH|APPDATA|LOCALAPPDATA|ProgramData|ProgramFiles|ProgramFiles\(x86\)|ProgramW6432|CommonProgramFiles|CommonProgramFiles\(x86\)|CommonProgramW6432|COMPUTERNAME|OS|PROCESSOR_ARCHITECTURE|NUMBER_OF_PROCESSORS)$/i;
|
|
72
114
|
/**
|
|
73
115
|
* The environment a client gets: its sign-in as the login shell sets it (else as this process
|
|
74
116
|
* has it), PATH as the shell has it so the client is found from a GUI app too, and nothing else —
|
|
75
|
-
* no key of
|
|
117
|
+
* no key of the host's, no session of a parent client.
|
|
76
118
|
*/
|
|
77
|
-
export function
|
|
78
|
-
/** Folders before the shell's PATH: the clients the
|
|
119
|
+
export function clientEnv(shell, own, passThrough,
|
|
120
|
+
/** Folders before the shell's PATH: the clients the host installed. */
|
|
79
121
|
first = [], platform = process.platform) {
|
|
80
122
|
const picked = {};
|
|
81
123
|
const source = Object.keys(shell).length ? shell : own;
|
|
@@ -104,11 +146,7 @@ first = [], platform = process.platform) {
|
|
|
104
146
|
TERM: "dumb",
|
|
105
147
|
};
|
|
106
148
|
}
|
|
107
|
-
/**
|
|
108
|
-
* What a Windows program needs of the environment to start at all: the system's folders, the
|
|
109
|
-
* user's folders, and how commands are found and run (a .cmd needs ComSpec).
|
|
110
|
-
*/
|
|
111
|
-
const WINDOWS_BASE = /^(SystemRoot|SystemDrive|windir|ComSpec|PATHEXT|TEMP|TMP|USERPROFILE|USERNAME|USERDOMAIN|HOMEDRIVE|HOMEPATH|APPDATA|LOCALAPPDATA|ProgramData|ProgramFiles|ProgramFiles\(x86\)|ProgramW6432|CommonProgramFiles|CommonProgramFiles\(x86\)|CommonProgramW6432|COMPUTERNAME|OS|PROCESSOR_ARCHITECTURE|NUMBER_OF_PROCESSORS)$/i;
|
|
149
|
+
/** The environment without the named keys. */
|
|
112
150
|
export function stripKeys(env, keyVars) {
|
|
113
151
|
const bare = { ...env };
|
|
114
152
|
for (const key of keyVars) {
|
|
@@ -116,21 +154,14 @@ export function stripKeys(env, keyVars) {
|
|
|
116
154
|
}
|
|
117
155
|
return bare;
|
|
118
156
|
}
|
|
157
|
+
let folders = () => [];
|
|
119
158
|
/**
|
|
120
|
-
* Where the
|
|
121
|
-
*
|
|
159
|
+
* Where the host installs clients, searched before the shell's PATH: a setup that installs a
|
|
160
|
+
* client into a folder of its own names the folder here, once, before any client runs.
|
|
122
161
|
*/
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
}
|
|
127
|
-
const { USERPROFILE: home, LOCALAPPDATA: local } = process.env;
|
|
128
|
-
return [
|
|
129
|
-
layout().clients,
|
|
130
|
-
...(home ? [join(home, ".local", "bin")] : []),
|
|
131
|
-
...(local ? [join(local, "cursor-agent"), join(local, "agy", "bin")] : []),
|
|
132
|
-
];
|
|
133
|
-
};
|
|
162
|
+
export function setClientFolders(list) {
|
|
163
|
+
folders = list;
|
|
164
|
+
}
|
|
134
165
|
const resolved = new Map();
|
|
135
166
|
/**
|
|
136
167
|
* The environment a client runs in, decided once: the subscription sign-in comes first — it is
|
|
@@ -141,7 +172,7 @@ export function resolveEnv(spec) {
|
|
|
141
172
|
let pending = resolved.get(spec.id);
|
|
142
173
|
if (!pending) {
|
|
143
174
|
pending = (async () => {
|
|
144
|
-
const withKey =
|
|
175
|
+
const withKey = clientEnv(await loginShellEnv(), process.env, spec.passThrough, folders());
|
|
145
176
|
const bare = stripKeys(withKey, spec.keyVars);
|
|
146
177
|
const own = await spec.auth(bare);
|
|
147
178
|
if (own !== "none") {
|
|
@@ -161,7 +192,7 @@ export function resolveEnv(spec) {
|
|
|
161
192
|
}
|
|
162
193
|
/** The environment of a sign-in: the client on its own, without a key of the shell, in a real terminal. */
|
|
163
194
|
export async function loginEnv(spec) {
|
|
164
|
-
const bare = stripKeys(
|
|
195
|
+
const bare = stripKeys(clientEnv(await loginShellEnv(), process.env, spec.passThrough, folders()), spec.keyVars);
|
|
165
196
|
return { ...bare, TERM: "xterm-256color", COLORTERM: "truecolor" };
|
|
166
197
|
}
|
|
167
198
|
/** The client's sign-in right now, on its own: asked again and again while the person signs in. */
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/** Who answers, as a failure names it. */
|
|
2
|
+
export interface ClientMeta {
|
|
3
|
+
id: string;
|
|
4
|
+
/** The product name, as the person knows it. */
|
|
5
|
+
name: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Why a client did not answer: its account cannot pay (`exhausted`), the vendor no longer serves
|
|
9
|
+
* that account with this client (`not_served`), it is not signed in (`signed_out`), it is not
|
|
10
|
+
* installed (`not_installed`), or anything else (`failed`). Each host words them itself.
|
|
11
|
+
*/
|
|
12
|
+
export type FailureCode = "exhausted" | "not_served" | "signed_out" | "not_installed" | "failed";
|
|
13
|
+
/** A client's failure, with what the client itself said. */
|
|
14
|
+
export declare class ClientFailure extends Error {
|
|
15
|
+
readonly code: FailureCode;
|
|
16
|
+
readonly client: ClientMeta;
|
|
17
|
+
/** What the client said, as it said it. */
|
|
18
|
+
readonly detail: string;
|
|
19
|
+
/** The client's whole last output, where it says more than `detail`. */
|
|
20
|
+
readonly raw?: string;
|
|
21
|
+
constructor(code: FailureCode, client: ClientMeta, detail: string, raw?: string);
|
|
22
|
+
}
|
|
23
|
+
/** The kind of failure a client's own words describe. */
|
|
24
|
+
export declare function failureCode(detail: string): FailureCode;
|
|
25
|
+
/** The failure a client reports, sorted by what it says. */
|
|
26
|
+
export declare function clientFailure(client: ClientMeta, detail: string, raw?: string): ClientFailure;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/** A client's failure, with what the client itself said. */
|
|
2
|
+
export class ClientFailure extends Error {
|
|
3
|
+
code;
|
|
4
|
+
client;
|
|
5
|
+
/** What the client said, as it said it. */
|
|
6
|
+
detail;
|
|
7
|
+
/** The client's whole last output, where it says more than `detail`. */
|
|
8
|
+
raw;
|
|
9
|
+
constructor(code, client, detail, raw) {
|
|
10
|
+
super(`${client.name}: ${detail}`.slice(0, 500));
|
|
11
|
+
this.code = code;
|
|
12
|
+
this.client = client;
|
|
13
|
+
this.detail = detail;
|
|
14
|
+
this.raw = raw;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
/** The kind of failure a client's own words describe. */
|
|
18
|
+
export function failureCode(detail) {
|
|
19
|
+
if (/credit balance|billing|too low|usage limit|quota|insufficient|rate.?limit|\b429\b/i.test(detail)) {
|
|
20
|
+
return "exhausted";
|
|
21
|
+
}
|
|
22
|
+
// Signed in, but the vendor no longer serves that account with this client: signing in again
|
|
23
|
+
// with the same account changes nothing.
|
|
24
|
+
if (/IneligibleTier|no longer supported|UNSUPPORTED_CLIENT|not eligible/i.test(detail)) {
|
|
25
|
+
return "not_served";
|
|
26
|
+
}
|
|
27
|
+
if (/authenticat|log ?in|logged in|oauth|credential|unauthori[sz]ed|\b401\b|api key/i.test(detail)) {
|
|
28
|
+
return "signed_out";
|
|
29
|
+
}
|
|
30
|
+
return "failed";
|
|
31
|
+
}
|
|
32
|
+
/** The failure a client reports, sorted by what it says. */
|
|
33
|
+
export function clientFailure(client, detail, raw) {
|
|
34
|
+
return new ClientFailure(failureCode(detail), client, detail, raw);
|
|
35
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Client, ClientId } from "./client.js";
|
|
2
|
+
export { AGY_BIN, type AntigravityResult, antigravity, antigravityAnswer, antigravityMessage, withEffort, } from "./antigravity.js";
|
|
3
|
+
export { type ChatCall, type ChatClient, type ChatEvent, type ChatMcp, issuesIn, } from "./chat.js";
|
|
4
|
+
export { CLAUDE_BIN, type ClaudeResult, claude, claudeAnswer } from "./claude.js";
|
|
5
|
+
export { CLIENT_IDS, type Client, type ClientId } from "./client.js";
|
|
6
|
+
export { CODEX_BIN, type CodexEvent, codex, codexAnswer, codexExecArgs } from "./codex.js";
|
|
7
|
+
export { CURSOR_BIN, type CursorResult, cursor, cursorWorkspace, ownCursorServers, } from "./cursor.js";
|
|
8
|
+
export { type ClientStatus, type Detectable, detectClient } from "./detect.js";
|
|
9
|
+
export { type ClientAuth, clientEnv, type EnvSpec, forgetEnv, freshAuth, loginEnv, loginShellEnv, ProbeUndecided, probeVersion, type ResolvedEnv, resolveEnv, run, setClientFolders, stripKeys, } from "./env.js";
|
|
10
|
+
export { ClientFailure, type ClientMeta, clientFailure, type FailureCode, failureCode, } from "./failure.js";
|
|
11
|
+
export { type Bridge, type BridgeTool, type ClientAnswer, type ClientCall, type ClientImageCall, ClientImageModel, ClientModel, type ClientModelOptions, type Effort, } from "./model.js";
|
|
12
|
+
export { DEFAULT_WORDS, extensionOf, jsonInstruction, type PromptWords, parseJsonAnswer, renderPrompt, } from "./prompt.js";
|
|
13
|
+
export { type ClientOutput, lastJson, runClient } from "./run.js";
|
|
14
|
+
/** The clients, by id. */
|
|
15
|
+
export declare const CLIENTS: Record<ClientId, Client>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { antigravity } from "./antigravity.js";
|
|
2
|
+
import { claude } from "./claude.js";
|
|
3
|
+
import { codex } from "./codex.js";
|
|
4
|
+
import { cursor } from "./cursor.js";
|
|
5
|
+
export { AGY_BIN, antigravity, antigravityAnswer, antigravityMessage, withEffort, } from "./antigravity.js";
|
|
6
|
+
export { issuesIn, } from "./chat.js";
|
|
7
|
+
export { CLAUDE_BIN, claude, claudeAnswer } from "./claude.js";
|
|
8
|
+
export { CLIENT_IDS } from "./client.js";
|
|
9
|
+
export { CODEX_BIN, codex, codexAnswer, codexExecArgs } from "./codex.js";
|
|
10
|
+
export { CURSOR_BIN, cursor, cursorWorkspace, ownCursorServers, } from "./cursor.js";
|
|
11
|
+
export { detectClient } from "./detect.js";
|
|
12
|
+
export { clientEnv, forgetEnv, freshAuth, loginEnv, loginShellEnv, ProbeUndecided, probeVersion, resolveEnv, run, setClientFolders, stripKeys, } from "./env.js";
|
|
13
|
+
export { ClientFailure, clientFailure, failureCode, } from "./failure.js";
|
|
14
|
+
export { ClientImageModel, ClientModel, } from "./model.js";
|
|
15
|
+
export { DEFAULT_WORDS, extensionOf, jsonInstruction, parseJsonAnswer, renderPrompt, } from "./prompt.js";
|
|
16
|
+
export { lastJson, runClient } from "./run.js";
|
|
17
|
+
/** The clients, by id. */
|
|
18
|
+
export const CLIENTS = { claude, codex, antigravity, cursor };
|