@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
|
@@ -1,15 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { join } from "node:path";
|
|
2
|
+
import { setClientFolders } from "@engenty/local-models/clients";
|
|
3
|
+
import { ClientSetup } from "@engenty/model-setup/server";
|
|
3
4
|
import { inherited, runtimePath } from "../cli/environment.js";
|
|
4
5
|
import { layout } from "../cli/home.js";
|
|
5
|
-
import {
|
|
6
|
-
import { antigravity } from "./antigravity.js";
|
|
7
|
-
import { claude } from "./claude.js";
|
|
8
|
-
import { codex } from "./codex.js";
|
|
9
|
-
import { cursor } from "./cursor.js";
|
|
10
|
-
import { forgetEnv, loginShellEnv, ProbeUndecided, resolveEnv } from "./env.js";
|
|
11
|
-
export { HarnessModel, notInstalled, signedOut } from "./model.js";
|
|
6
|
+
import { antigravity, claude, codex, cursor } from "./clients.js";
|
|
12
7
|
export { HARNESS_IDS } from "./types.js";
|
|
8
|
+
/**
|
|
9
|
+
* Where the setup installs clients, whoever started this runtime: npm's prefix (on Windows the
|
|
10
|
+
* prefix itself), and on Windows where Claude Code and Cursor Agent put themselves. A client's
|
|
11
|
+
* environment finds them before the shell's PATH.
|
|
12
|
+
*/
|
|
13
|
+
setClientFolders(() => {
|
|
14
|
+
if (process.platform !== "win32") {
|
|
15
|
+
return [join(layout().clients, "bin")];
|
|
16
|
+
}
|
|
17
|
+
const { USERPROFILE: home, LOCALAPPDATA: local } = process.env;
|
|
18
|
+
return [
|
|
19
|
+
layout().clients,
|
|
20
|
+
...(home ? [join(home, ".local", "bin")] : []),
|
|
21
|
+
...(local ? [join(local, "cursor-agent"), join(local, "agy", "bin")] : []),
|
|
22
|
+
];
|
|
23
|
+
});
|
|
13
24
|
/**
|
|
14
25
|
* The AI clients this runtime can run as a model, in the order the setup offers them. The first
|
|
15
26
|
* one installed is the one the setup recommends.
|
|
@@ -22,86 +33,20 @@ export function harness(id) {
|
|
|
22
33
|
export function isHarnessVendor(vendor) {
|
|
23
34
|
return HARNESSES.some((h) => h.id === vendor);
|
|
24
35
|
}
|
|
25
|
-
|
|
36
|
+
/** The clients as the setup finds, installs and signs them in. */
|
|
37
|
+
export const clientSetup = new ClientSetup({
|
|
38
|
+
clients: HARNESSES,
|
|
39
|
+
folder: () => layout().clients,
|
|
40
|
+
env: (shellPath) => ({
|
|
41
|
+
...inherited(process.env),
|
|
42
|
+
PATH: runtimePath(layout(), shellPath ? { ...process.env, PATH: shellPath } : process.env),
|
|
43
|
+
}),
|
|
44
|
+
});
|
|
26
45
|
/** One client, as it is now; asked again after a minute — it may get installed or signed in meanwhile. */
|
|
27
|
-
export
|
|
28
|
-
|
|
29
|
-
if (!h) {
|
|
30
|
-
return null;
|
|
31
|
-
}
|
|
32
|
-
const hit = detected.get(id);
|
|
33
|
-
if (!force && hit && Date.now() - hit.at < 60_000) {
|
|
34
|
-
return hit.value;
|
|
35
|
-
}
|
|
36
|
-
if (force) {
|
|
37
|
-
// The person may just have signed in or set a key in their shell.
|
|
38
|
-
forgetEnv(id);
|
|
39
|
-
}
|
|
40
|
-
const client = CLIENTS.find((c) => c.id === id);
|
|
41
|
-
let value = {
|
|
42
|
-
id,
|
|
43
|
-
name: h.name,
|
|
44
|
-
install: client ? installCommand(client, layout()) : "",
|
|
45
|
-
app: client ? vendorApp(client) : null,
|
|
46
|
-
version: null,
|
|
47
|
-
auth: "none",
|
|
48
|
-
interactiveLogin: h.login.interactive,
|
|
49
|
-
images: Boolean(h.image),
|
|
50
|
-
};
|
|
51
|
-
try {
|
|
52
|
-
const { env, auth } = await resolveEnv(h);
|
|
53
|
-
const version = await h.version(env);
|
|
54
|
-
if (version) {
|
|
55
|
-
value = { ...value, version, auth };
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
catch (err) {
|
|
59
|
-
if (err instanceof ProbeUndecided && hit?.value.version) {
|
|
60
|
-
// The machine is busy (another client is working): the client was there, it still is.
|
|
61
|
-
value = hit.value;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
detected.set(id, { at: Date.now(), value });
|
|
65
|
-
return value;
|
|
46
|
+
export function detectHarness(id, force = false) {
|
|
47
|
+
return clientSetup.detect(id, force);
|
|
66
48
|
}
|
|
67
49
|
/** Every client this runtime knows, installed or not. */
|
|
68
50
|
export function detectHarnesses(force = false) {
|
|
69
|
-
return
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* What the inline terminal runs to install a client: the command the terminal setup runs, shown
|
|
73
|
-
* first. A client from npm goes into the install's own prefix with the npm of its own Node.
|
|
74
|
-
*/
|
|
75
|
-
export async function installSpec(id) {
|
|
76
|
-
const client = CLIENTS.find((c) => c.id === id);
|
|
77
|
-
if (!client) {
|
|
78
|
-
return null;
|
|
79
|
-
}
|
|
80
|
-
const paths = layout();
|
|
81
|
-
mkdirSync(paths.clients, { recursive: true });
|
|
82
|
-
const shell = await loginShellEnv();
|
|
83
|
-
if (process.platform === "win32") {
|
|
84
|
-
const [bin, ...args] = POWERSHELL;
|
|
85
|
-
const command = installCommand(client, paths);
|
|
86
|
-
return {
|
|
87
|
-
bin,
|
|
88
|
-
args: [...args, `Write-Host "$ ${command.replaceAll('"', '`"')}\`n"; ${command}`],
|
|
89
|
-
env: { ...inherited(process.env), PATH: runtimePath(paths, process.env) },
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
return {
|
|
93
|
-
bin: "bash",
|
|
94
|
-
args: [
|
|
95
|
-
"-c",
|
|
96
|
-
'printf "\\033[2m$ %s\\033[0m\\n\\n" "$1"; set -o pipefail; eval "$1"',
|
|
97
|
-
"install",
|
|
98
|
-
installCommand(client, paths),
|
|
99
|
-
],
|
|
100
|
-
env: {
|
|
101
|
-
...inherited(process.env),
|
|
102
|
-
PATH: runtimePath(paths, { ...process.env, PATH: shell.PATH || process.env.PATH }),
|
|
103
|
-
TERM: "xterm-256color",
|
|
104
|
-
COLORTERM: "truecolor",
|
|
105
|
-
},
|
|
106
|
-
};
|
|
51
|
+
return clientSetup.detectAll(force);
|
|
107
52
|
}
|
|
@@ -1,283 +1,45 @@
|
|
|
1
|
-
import { mkdirSync, rmSync, writeFileSync } from "node:fs";
|
|
2
1
|
import { join } from "node:path";
|
|
2
|
+
import { clientFailure, } from "@engenty/local-models/clients";
|
|
3
3
|
import { note } from "@engenty/wizards-shared/run";
|
|
4
|
-
import spawn from "cross-spawn";
|
|
5
|
-
import { nanoid } from "nanoid";
|
|
6
4
|
import { env } from "../env.js";
|
|
7
5
|
import { openBridge } from "../mcp/bridge.js";
|
|
8
6
|
import { ModelUnavailableError } from "../model-errors.js";
|
|
9
|
-
import {
|
|
10
|
-
const workDir = join(env.dataDir, "harness");
|
|
7
|
+
import { CLIENT_WORDS } from "./prompt.js";
|
|
11
8
|
export const signedOut = (h) => note("clientNotSignedIn", { name: h.name });
|
|
12
9
|
export const notInstalled = (h) => note("clientNotInstalled", { name: h.name });
|
|
13
10
|
export const notServed = (h) => note("clientAccountNotServed", { name: h.name });
|
|
14
11
|
export const exhausted = (h) => h.exhausted ?? note("clientNoCredit", { name: h.name });
|
|
15
|
-
/**
|
|
16
|
-
export function
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
12
|
+
/** A client's failure as the person should read it. */
|
|
13
|
+
export function clientError(h, failure) {
|
|
14
|
+
if (failure.code === "not_installed") {
|
|
15
|
+
return new ModelUnavailableError(notInstalled(h));
|
|
16
|
+
}
|
|
17
|
+
// The client's own words stay in the log: the note sums them up for the person.
|
|
18
|
+
if (failure.raw) {
|
|
19
|
+
console.warn(`[${h.id}] the client failed:`, failure.raw);
|
|
20
|
+
}
|
|
21
|
+
console.warn(`[${h.id}] ${failure.detail.replace(/\s+/g, " ").trim().slice(0, 1500)}`);
|
|
22
|
+
switch (failure.code) {
|
|
23
|
+
case "exhausted":
|
|
24
|
+
return new ModelUnavailableError(exhausted(h));
|
|
25
|
+
case "not_served":
|
|
26
|
+
return new ModelUnavailableError(notServed(h));
|
|
27
|
+
case "signed_out":
|
|
28
|
+
return new ModelUnavailableError(signedOut(h));
|
|
29
|
+
default:
|
|
30
|
+
return failure;
|
|
29
31
|
}
|
|
30
|
-
return new Error(`${h.name}: ${detail}`.slice(0, 500));
|
|
31
32
|
}
|
|
32
|
-
/**
|
|
33
|
-
export function
|
|
34
|
-
return
|
|
35
|
-
const child = spawn(bin, args, {
|
|
36
|
-
cwd: opts.cwd,
|
|
37
|
-
stdio: ["pipe", "pipe", "pipe"],
|
|
38
|
-
signal: opts.signal,
|
|
39
|
-
env: opts.env,
|
|
40
|
-
});
|
|
41
|
-
let stdout = "";
|
|
42
|
-
let stderr = "";
|
|
43
|
-
child.stdout.on("data", (chunk) => {
|
|
44
|
-
stdout += String(chunk);
|
|
45
|
-
});
|
|
46
|
-
child.stderr.on("data", (chunk) => {
|
|
47
|
-
stderr = (stderr + String(chunk)).slice(-4000);
|
|
48
|
-
});
|
|
49
|
-
child.on("error", reject);
|
|
50
|
-
child.on("close", (code) => resolve({ stdout, stderr, code }));
|
|
51
|
-
child.stdin.on("error", () => {
|
|
52
|
-
// The client went away before reading the prompt; `close` reports it.
|
|
53
|
-
});
|
|
54
|
-
child.stdin.end(opts.stdin ?? "");
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
/** The last line of an output that is a JSON object. */
|
|
58
|
-
export function lastJson(stdout) {
|
|
59
|
-
for (const line of stdout.trim().split("\n").reverse()) {
|
|
60
|
-
try {
|
|
61
|
-
const value = JSON.parse(line);
|
|
62
|
-
if (value && typeof value === "object") {
|
|
63
|
-
return value;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
catch {
|
|
67
|
-
// not it
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
return null;
|
|
71
|
-
}
|
|
72
|
-
export class HarnessModel {
|
|
73
|
-
specificationVersion = "v3";
|
|
74
|
-
modelId;
|
|
75
|
-
supportedUrls = {};
|
|
76
|
-
/** Whether the client validates structured output against the schema itself. */
|
|
77
|
-
nativeSchema = false;
|
|
78
|
-
/** Whether the client runs a call's tools (over the bridge); else they are left out, with a warning. */
|
|
79
|
-
usesTools = true;
|
|
80
|
-
/** The same, for whoever builds the call: a step tells such a client no tools exist. */
|
|
81
|
-
get takesTools() {
|
|
82
|
-
return this.usesTools;
|
|
83
|
-
}
|
|
84
|
-
/** Whether the client searches the web with a tool of its own, tools of the call or not. */
|
|
85
|
-
searchesWeb = true;
|
|
86
|
-
effort;
|
|
87
|
-
harness;
|
|
88
|
-
executors = new Map();
|
|
89
|
-
constructor(harness, alias, effort) {
|
|
90
|
-
this.harness = harness;
|
|
91
|
-
this.modelId = alias;
|
|
92
|
-
this.effort = effort;
|
|
93
|
-
}
|
|
94
|
-
/** The tools a call may name, by the names the agent gives them: the client runs them over the bridge. */
|
|
95
|
-
attach(tools) {
|
|
96
|
-
for (const [name, tool] of Object.entries(tools)) {
|
|
97
|
-
const t = tool;
|
|
98
|
-
if (typeof t?.execute === "function") {
|
|
99
|
-
this.executors.set(name, t);
|
|
100
|
-
if (t.id) {
|
|
101
|
-
this.executors.set(t.id, t);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
async doGenerate(options) {
|
|
107
|
-
const dir = join(workDir, nanoid(10));
|
|
108
|
-
mkdirSync(dir, { recursive: true });
|
|
109
|
-
const { system, prompt, files, warnings } = renderPrompt(options.prompt, dir);
|
|
110
|
-
const bridged = [];
|
|
111
|
-
let webSearch = false;
|
|
112
|
-
for (const tool of options.tools ?? []) {
|
|
113
|
-
// The client searches with its own tool; naming `web_search` is what switches it on.
|
|
114
|
-
if (tool.type === "function" && tool.name === "web_search" && this.searchesWeb) {
|
|
115
|
-
webSearch = true;
|
|
116
|
-
continue;
|
|
117
|
-
}
|
|
118
|
-
if (tool.type !== "function" || !this.usesTools) {
|
|
119
|
-
warnings.push({ type: "unsupported", feature: `tool ${tool.name}` });
|
|
120
|
-
continue;
|
|
121
|
-
}
|
|
122
|
-
const executor = this.executors.get(tool.name);
|
|
123
|
-
if (!executor?.execute) {
|
|
124
|
-
warnings.push({
|
|
125
|
-
type: "unsupported",
|
|
126
|
-
feature: `tool ${tool.name}`,
|
|
127
|
-
details: "no executor",
|
|
128
|
-
});
|
|
129
|
-
continue;
|
|
130
|
-
}
|
|
131
|
-
bridged.push({
|
|
132
|
-
name: tool.name,
|
|
133
|
-
description: tool.description,
|
|
134
|
-
inputSchema: tool.inputSchema,
|
|
135
|
-
execute: (input) => executor.execute(input),
|
|
136
|
-
toModelOutput: executor.toModelOutput,
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
for (const key of ["temperature", "topP", "topK", "seed", "stopSequences"]) {
|
|
140
|
-
if (options[key] !== undefined) {
|
|
141
|
-
warnings.push({ type: "unsupported", feature: key });
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
const structured = options.responseFormat?.type === "json";
|
|
145
|
-
const schema = structured && options.responseFormat?.type === "json"
|
|
146
|
-
? (options.responseFormat.schema ?? null)
|
|
147
|
-
: null;
|
|
148
|
-
const bridge = bridged.length ? openBridge(bridged) : null;
|
|
149
|
-
try {
|
|
150
|
-
const answer = await this.invoke({
|
|
151
|
-
dir,
|
|
152
|
-
system: structured && !this.nativeSchema
|
|
153
|
-
? [system, jsonInstruction(schema)].filter(Boolean).join("\n\n")
|
|
154
|
-
: system,
|
|
155
|
-
prompt,
|
|
156
|
-
files,
|
|
157
|
-
bridgeUrl: bridge?.url ?? null,
|
|
158
|
-
schema: this.nativeSchema ? schema : null,
|
|
159
|
-
webSearch,
|
|
160
|
-
effort: this.effort,
|
|
161
|
-
signal: options.abortSignal,
|
|
162
|
-
});
|
|
163
|
-
const u = answer.usage ?? {};
|
|
164
|
-
const cacheRead = u.cacheRead ?? 0;
|
|
165
|
-
const cacheWrite = u.cacheWrite ?? 0;
|
|
166
|
-
const input = u.input ?? 0;
|
|
167
|
-
return {
|
|
168
|
-
content: [
|
|
169
|
-
{
|
|
170
|
-
type: "text",
|
|
171
|
-
text: structured ? JSON.stringify(parseJsonAnswer(answer.text)) : answer.text,
|
|
172
|
-
},
|
|
173
|
-
],
|
|
174
|
-
finishReason: { unified: "stop", raw: answer.stopReason },
|
|
175
|
-
usage: {
|
|
176
|
-
inputTokens: {
|
|
177
|
-
total: input,
|
|
178
|
-
noCache: Math.max(0, input - cacheRead - cacheWrite),
|
|
179
|
-
cacheRead,
|
|
180
|
-
cacheWrite,
|
|
181
|
-
},
|
|
182
|
-
outputTokens: { total: u.output ?? 0, text: u.output ?? 0, reasoning: undefined },
|
|
183
|
-
raw: u,
|
|
184
|
-
},
|
|
185
|
-
providerMetadata: { [this.provider]: answer.meta ?? {} },
|
|
186
|
-
response: { id: answer.sessionId, modelId: this.modelId },
|
|
187
|
-
warnings,
|
|
188
|
-
};
|
|
189
|
-
}
|
|
190
|
-
catch (err) {
|
|
191
|
-
if (err.code === "ENOENT") {
|
|
192
|
-
throw new ModelUnavailableError(notInstalled(this.harness));
|
|
193
|
-
}
|
|
194
|
-
throw err;
|
|
195
|
-
}
|
|
196
|
-
finally {
|
|
197
|
-
bridge?.close();
|
|
198
|
-
rmSync(dir, { recursive: true, force: true });
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
/** The answer as one piece: the client prints it when it is done. */
|
|
202
|
-
async doStream(options) {
|
|
203
|
-
const result = await this.doGenerate(options);
|
|
204
|
-
const text = result.content.find((c) => c.type === "text");
|
|
205
|
-
const parts = [
|
|
206
|
-
{ type: "stream-start", warnings: result.warnings },
|
|
207
|
-
{ type: "response-metadata", ...result.response },
|
|
208
|
-
{ type: "text-start", id: "0" },
|
|
209
|
-
{ type: "text-delta", id: "0", delta: text?.type === "text" ? text.text : "" },
|
|
210
|
-
{ type: "text-end", id: "0" },
|
|
211
|
-
{
|
|
212
|
-
type: "finish",
|
|
213
|
-
usage: result.usage,
|
|
214
|
-
finishReason: result.finishReason,
|
|
215
|
-
providerMetadata: result.providerMetadata,
|
|
216
|
-
},
|
|
217
|
-
];
|
|
218
|
-
return {
|
|
219
|
-
stream: new ReadableStream({
|
|
220
|
-
start(controller) {
|
|
221
|
-
for (const part of parts) {
|
|
222
|
-
controller.enqueue(part);
|
|
223
|
-
}
|
|
224
|
-
controller.close();
|
|
225
|
-
},
|
|
226
|
-
}),
|
|
227
|
-
};
|
|
228
|
-
}
|
|
33
|
+
/** The failure a client reports, as the person should read it. */
|
|
34
|
+
export function failureOf(h, detail) {
|
|
35
|
+
return clientError(h, clientFailure(h, detail));
|
|
229
36
|
}
|
|
230
|
-
/**
|
|
231
|
-
export
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
this.modelId = alias;
|
|
239
|
-
}
|
|
240
|
-
async doGenerate(options) {
|
|
241
|
-
const dir = join(workDir, nanoid(10));
|
|
242
|
-
mkdirSync(dir, { recursive: true });
|
|
243
|
-
const warnings = [];
|
|
244
|
-
const files = [];
|
|
245
|
-
for (const file of options.files ?? []) {
|
|
246
|
-
if (file.type !== "file") {
|
|
247
|
-
warnings.push({ type: "unsupported", feature: "image url" });
|
|
248
|
-
continue;
|
|
249
|
-
}
|
|
250
|
-
const path = join(dir, `ref-${files.length + 1}.${extensionOf(file.mediaType)}`);
|
|
251
|
-
writeFileSync(path, typeof file.data === "string" ? Buffer.from(file.data, "base64") : file.data);
|
|
252
|
-
files.push(path);
|
|
253
|
-
}
|
|
254
|
-
for (const key of ["size", "seed", "mask"]) {
|
|
255
|
-
if (options[key] !== undefined) {
|
|
256
|
-
warnings.push({ type: "unsupported", feature: key });
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
try {
|
|
260
|
-
const image = await this.invoke({
|
|
261
|
-
dir,
|
|
262
|
-
prompt: options.prompt ?? "",
|
|
263
|
-
files,
|
|
264
|
-
aspectRatio: options.aspectRatio,
|
|
265
|
-
signal: options.abortSignal,
|
|
266
|
-
});
|
|
267
|
-
return {
|
|
268
|
-
images: [image],
|
|
269
|
-
warnings,
|
|
270
|
-
response: { timestamp: new Date(), modelId: this.modelId, headers: undefined },
|
|
271
|
-
};
|
|
272
|
-
}
|
|
273
|
-
catch (err) {
|
|
274
|
-
if (err.code === "ENOENT") {
|
|
275
|
-
throw new ModelUnavailableError(notInstalled(this.harness));
|
|
276
|
-
}
|
|
277
|
-
throw err;
|
|
278
|
-
}
|
|
279
|
-
finally {
|
|
280
|
-
rmSync(dir, { recursive: true, force: true });
|
|
281
|
-
}
|
|
282
|
-
}
|
|
37
|
+
/** How the runtime runs a client as a model. */
|
|
38
|
+
export function modelOptions(h) {
|
|
39
|
+
return {
|
|
40
|
+
workDir: join(env.dataDir, "harness"),
|
|
41
|
+
bridge: openBridge,
|
|
42
|
+
words: CLIENT_WORDS,
|
|
43
|
+
error: (failure) => clientError(h, failure),
|
|
44
|
+
};
|
|
283
45
|
}
|
|
@@ -1,121 +1,7 @@
|
|
|
1
|
-
import { writeFileSync } from "node:fs";
|
|
2
|
-
import { join } from "node:path";
|
|
3
1
|
import { prompt } from "../prompts.js";
|
|
4
|
-
/** The
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const sub = mediaType.split("/")[1] ?? "bin";
|
|
11
|
-
return { jpeg: "jpg", "svg+xml": "svg", plain: "txt", markdown: "md" }[sub] ?? sub;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* The conversation as a client takes it: one system prompt and one prompt on stdin. A single
|
|
15
|
-
* user message goes as it is; a longer thread is written out with its speakers, and the client
|
|
16
|
-
* is asked to answer its last message. Attachments are saved to `dir` and named in the prompt.
|
|
17
|
-
*/
|
|
18
|
-
export function renderPrompt(messages, dir) {
|
|
19
|
-
const warnings = [];
|
|
20
|
-
const files = [];
|
|
21
|
-
const system = [];
|
|
22
|
-
const turns = [];
|
|
23
|
-
const saveFile = (input) => {
|
|
24
|
-
// A file's content comes tagged: { type: "data", data } | { type: "url", url } | { type: "text", text }.
|
|
25
|
-
const tagged = input.data;
|
|
26
|
-
const data = tagged && typeof tagged === "object" && typeof tagged.type === "string"
|
|
27
|
-
? tagged.type === "url"
|
|
28
|
-
? tagged.url
|
|
29
|
-
: tagged.type === "text"
|
|
30
|
-
? Buffer.from(tagged.text ?? "", "utf8")
|
|
31
|
-
: tagged.data
|
|
32
|
-
: input.data;
|
|
33
|
-
const part = { ...input, data };
|
|
34
|
-
if (part.data instanceof URL) {
|
|
35
|
-
return `[Attachment at ${part.data.href} (${part.mediaType})]`;
|
|
36
|
-
}
|
|
37
|
-
if (typeof part.data !== "string" && !(part.data instanceof Uint8Array)) {
|
|
38
|
-
warnings.push({ type: "unsupported", feature: "file parts" });
|
|
39
|
-
return `[Attachment: ${part.filename ?? part.mediaType}]`;
|
|
40
|
-
}
|
|
41
|
-
if (!dir) {
|
|
42
|
-
warnings.push({ type: "unsupported", feature: "file parts" });
|
|
43
|
-
return `[Attachment: ${part.filename ?? part.mediaType}]`;
|
|
44
|
-
}
|
|
45
|
-
const path = join(dir, `${files.length + 1}.${extensionOf(part.mediaType, part.filename)}`);
|
|
46
|
-
const bytes = typeof part.data === "string" ? Buffer.from(part.data, "base64") : part.data;
|
|
47
|
-
writeFileSync(path, bytes);
|
|
48
|
-
files.push(path);
|
|
49
|
-
return prompt("services", "harness.attached_file", { path });
|
|
50
|
-
};
|
|
51
|
-
for (const m of messages) {
|
|
52
|
-
if (m.role === "system") {
|
|
53
|
-
system.push(m.content);
|
|
54
|
-
continue;
|
|
55
|
-
}
|
|
56
|
-
const text = m.content
|
|
57
|
-
.map((part) => {
|
|
58
|
-
switch (part.type) {
|
|
59
|
-
case "text":
|
|
60
|
-
return part.text;
|
|
61
|
-
case "file":
|
|
62
|
-
return saveFile(part);
|
|
63
|
-
case "reasoning":
|
|
64
|
-
return "";
|
|
65
|
-
case "tool-call":
|
|
66
|
-
return `[Called ${part.toolName} with ${JSON.stringify(part.input)}]`;
|
|
67
|
-
case "tool-result": {
|
|
68
|
-
const out = part.output;
|
|
69
|
-
const value = out.type === "text" || out.type === "error-text"
|
|
70
|
-
? String(out.value)
|
|
71
|
-
: out.type === "json" || out.type === "error-json"
|
|
72
|
-
? JSON.stringify(out.value)
|
|
73
|
-
: out.type === "execution-denied"
|
|
74
|
-
? `denied${out.reason ? `: ${out.reason}` : ""}`
|
|
75
|
-
: JSON.stringify(out.value ?? out);
|
|
76
|
-
return `[Result of ${part.toolName}: ${value}]`;
|
|
77
|
-
}
|
|
78
|
-
default:
|
|
79
|
-
return "";
|
|
80
|
-
}
|
|
81
|
-
})
|
|
82
|
-
.filter(Boolean)
|
|
83
|
-
.join("\n");
|
|
84
|
-
turns.push({ role: m.role, text });
|
|
85
|
-
}
|
|
86
|
-
const request = turns.length === 1 && turns[0].role === "user"
|
|
87
|
-
? turns[0].text
|
|
88
|
-
: turns
|
|
89
|
-
.map((t) => `${t.role === "user" ? "User" : t.role === "tool" ? "Tool" : "Assistant"}:\n${t.text}`)
|
|
90
|
-
.join("\n\n");
|
|
91
|
-
if (turns.length > 1) {
|
|
92
|
-
system.push(prompt("services", "harness.conversation_note"));
|
|
93
|
-
}
|
|
94
|
-
return { system: system.join("\n\n"), prompt: request, files, warnings };
|
|
95
|
-
}
|
|
96
|
-
/** What a client without a schema option is told so its answer parses. */
|
|
97
|
-
export function jsonInstruction(schema) {
|
|
98
|
-
return prompt("services", "harness.json_instruction", {
|
|
99
|
-
schema: JSON.stringify(schema ?? { type: "object" }),
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
/** A client's answer as JSON: the fences and prose some wrap around it are taken off. */
|
|
103
|
-
export function parseJsonAnswer(text) {
|
|
104
|
-
const trimmed = text.trim();
|
|
105
|
-
const unfenced = trimmed
|
|
106
|
-
.replace(/^\s*```(?:json)?\s*/i, "")
|
|
107
|
-
.replace(/\s*```\s*$/, "")
|
|
108
|
-
.trim();
|
|
109
|
-
try {
|
|
110
|
-
return JSON.parse(unfenced);
|
|
111
|
-
}
|
|
112
|
-
catch {
|
|
113
|
-
// Prose around the value: take the outermost object or array.
|
|
114
|
-
const start = unfenced.search(/[{[]/);
|
|
115
|
-
const end = Math.max(unfenced.lastIndexOf("}"), unfenced.lastIndexOf("]"));
|
|
116
|
-
if (start >= 0 && end > start) {
|
|
117
|
-
return JSON.parse(unfenced.slice(start, end + 1));
|
|
118
|
-
}
|
|
119
|
-
throw new Error("The answer is not JSON.");
|
|
120
|
-
}
|
|
121
|
-
}
|
|
2
|
+
/** The sentences an installed client reads besides a call's messages, from prompts/services.md. */
|
|
3
|
+
export const CLIENT_WORDS = {
|
|
4
|
+
attachedFile: (path) => prompt("services", "harness.attached_file", { path }),
|
|
5
|
+
conversationNote: () => prompt("services", "harness.conversation_note"),
|
|
6
|
+
jsonInstruction: (schema) => prompt("services", "harness.json_instruction", { schema }),
|
|
7
|
+
};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { CLIENT_IDS } from "@engenty/model-setup";
|
|
1
2
|
/**
|
|
2
3
|
* A harness is an AI client installed on this machine — Claude Code, Codex, Antigravity, Cursor
|
|
3
4
|
* Agent — that answers on the person's own subscription or sign-in. The runtime runs it headless
|
|
4
|
-
* as a model (./model.ts) and signs it in through the inline
|
|
5
|
-
* this process reaches it: no key of ours, no session of a
|
|
5
|
+
* as a model (@engenty/local-models/clients, ./model.ts) and signs it in through the inline
|
|
6
|
+
* terminal (@engenty/model-setup). Nothing of this process reaches it: no key of ours, no session of a
|
|
7
|
+
* parent client.
|
|
6
8
|
*/
|
|
7
|
-
export const HARNESS_IDS =
|
|
9
|
+
export const HARNESS_IDS = CLIENT_IDS;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
2
|
+
const calls = new AsyncLocalStorage();
|
|
3
|
+
/** What the call being made now is told. */
|
|
4
|
+
export const localCall = () => calls.getStore() ?? {};
|
|
5
|
+
/** Runs `make`, and the calls of a local model in it with `call`. */
|
|
6
|
+
export const withLocalCall = (call, make) => calls.run(call, make);
|