@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,153 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { createReadStream, createWriteStream, existsSync } from "node:fs";
|
|
3
|
+
import { mkdir, readdir, readFile, rename, rm, rmdir, stat, writeFile } from "node:fs/promises";
|
|
4
|
+
import { homedir } from "node:os";
|
|
5
|
+
import { dirname, join } from "node:path";
|
|
6
|
+
import { Readable } from "node:stream";
|
|
7
|
+
import { pipeline } from "node:stream/promises";
|
|
8
|
+
/**
|
|
9
|
+
* MLX's models on this computer: a folder per model, as Hugging Face names it
|
|
10
|
+
* (`mlx-community/Qwen3-4B-4bit`), shared by every app of engenty. Only weights as safetensors and
|
|
11
|
+
* the files beside them are taken, never code.
|
|
12
|
+
*/
|
|
13
|
+
const HUB = "https://huggingface.co";
|
|
14
|
+
/** Where the models are for this process: MLX_MODELS, else a folder of engenty's. */
|
|
15
|
+
export function mlxFolder(env = process.env) {
|
|
16
|
+
return env.MLX_MODELS?.trim() || join(homedir(), ".engenty", "models", "mlx");
|
|
17
|
+
}
|
|
18
|
+
/** A model as Hugging Face names it: `organization/name`. */
|
|
19
|
+
const NAME = /^[\w-][\w.-]*\/[\w-][\w.-]*$/;
|
|
20
|
+
export function modelFolder(root, model) {
|
|
21
|
+
if (!NAME.test(model)) {
|
|
22
|
+
throw new Error("A model of MLX is named as on Hugging Face: organization/name.");
|
|
23
|
+
}
|
|
24
|
+
return join(root, ...model.split("/"));
|
|
25
|
+
}
|
|
26
|
+
/** Written last: the model is whole. */
|
|
27
|
+
const DONE = ".engenty.json";
|
|
28
|
+
const FILE = /\.(safetensors|json|jinja|txt|model)$/;
|
|
29
|
+
/** The models in the folder, each with what it can do. */
|
|
30
|
+
export async function mlxModels(root, loaded) {
|
|
31
|
+
const models = [];
|
|
32
|
+
for (const org of await readdir(root).catch(() => [])) {
|
|
33
|
+
for (const name of await readdir(join(root, org)).catch(() => [])) {
|
|
34
|
+
const dir = join(root, org, name);
|
|
35
|
+
const done = await readFile(join(dir, DONE), "utf8").catch(() => null);
|
|
36
|
+
if (!done) {
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
const { size, sha } = JSON.parse(done);
|
|
40
|
+
const { tools, vision, thinking, quantization } = await traits(dir);
|
|
41
|
+
models.push({
|
|
42
|
+
name: `${org}/${name}`,
|
|
43
|
+
size,
|
|
44
|
+
digest: sha,
|
|
45
|
+
capabilities: [
|
|
46
|
+
"completion",
|
|
47
|
+
...(tools ? ["tools"] : []),
|
|
48
|
+
...(vision ? ["vision"] : []),
|
|
49
|
+
...(thinking ? ["thinking"] : []),
|
|
50
|
+
],
|
|
51
|
+
completion: true,
|
|
52
|
+
tools,
|
|
53
|
+
vision,
|
|
54
|
+
thinking,
|
|
55
|
+
runner: "mlx",
|
|
56
|
+
quantization,
|
|
57
|
+
running: loaded === dir,
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return models;
|
|
62
|
+
}
|
|
63
|
+
/** What a model can do, as its own files say: the chat template and the configuration. */
|
|
64
|
+
async function traits(dir) {
|
|
65
|
+
const json = async (file) => JSON.parse(await readFile(join(dir, file), "utf8").catch(() => "{}"));
|
|
66
|
+
const [config, tokenizer] = await Promise.all([
|
|
67
|
+
json("config.json"),
|
|
68
|
+
json("tokenizer_config.json"),
|
|
69
|
+
]);
|
|
70
|
+
const template = (await readFile(join(dir, "chat_template.jinja"), "utf8").catch(() => null)) ??
|
|
71
|
+
JSON.stringify(tokenizer.chat_template ?? (await json("chat_template.json")).chat_template ?? "");
|
|
72
|
+
const bits = config.quantization?.bits;
|
|
73
|
+
return {
|
|
74
|
+
tools: /\btools\b/.test(template),
|
|
75
|
+
vision: "vision_config" in config && existsSync(join(dir, "preprocessor_config.json")),
|
|
76
|
+
thinking: /enable_thinking/.test(template),
|
|
77
|
+
quantization: bits ? `${bits}bit` : null,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
async function sha256(file) {
|
|
81
|
+
const hash = createHash("sha256");
|
|
82
|
+
await pipeline(createReadStream(file), hash);
|
|
83
|
+
return hash.digest("hex");
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Downloads a model from Hugging Face. A download that broke off goes on where it stopped; each
|
|
87
|
+
* weights file is checked against the hash Hugging Face names.
|
|
88
|
+
*/
|
|
89
|
+
export async function downloadModel(root, model, onProgress, { fetch: doFetch = fetch, signal, hub = HUB, } = {}) {
|
|
90
|
+
const dir = modelFolder(root, model);
|
|
91
|
+
const res = await doFetch(`${hub}/api/models/${model}?blobs=true`, { signal });
|
|
92
|
+
if (!res.ok) {
|
|
93
|
+
throw new Error(res.status === 401 || res.status === 404
|
|
94
|
+
? `Hugging Face has no open model ${model}.`
|
|
95
|
+
: `Hugging Face answered ${res.status}.`);
|
|
96
|
+
}
|
|
97
|
+
const info = (await res.json());
|
|
98
|
+
const files = (info.siblings ?? []).filter((f) => FILE.test(f.rfilename) && !f.rfilename.includes(".."));
|
|
99
|
+
if (!files.some((f) => f.rfilename.endsWith(".safetensors"))) {
|
|
100
|
+
throw new Error(`${model} has no weights MLX can read.`);
|
|
101
|
+
}
|
|
102
|
+
const total = files.reduce((sum, f) => sum + (f.size ?? 0), 0);
|
|
103
|
+
let before = 0;
|
|
104
|
+
let told = 0;
|
|
105
|
+
for (const file of files) {
|
|
106
|
+
const target = join(dir, ...file.rfilename.split("/"));
|
|
107
|
+
const part = `${target}.part`;
|
|
108
|
+
await mkdir(dirname(target), { recursive: true });
|
|
109
|
+
const there = await stat(target).catch(() => null);
|
|
110
|
+
if (!(there && there.size === file.size)) {
|
|
111
|
+
const have = (await stat(part).catch(() => null))?.size ?? 0;
|
|
112
|
+
let at = have;
|
|
113
|
+
if (file.size === undefined || have < file.size) {
|
|
114
|
+
const got = await doFetch(`${hub}/${model}/resolve/${info.sha ?? "main"}/${file.rfilename}`, { signal, ...(have ? { headers: { range: `bytes=${have}-` } } : {}) });
|
|
115
|
+
if (!(got.ok && got.body)) {
|
|
116
|
+
throw new Error(`Hugging Face answered ${got.status}.`);
|
|
117
|
+
}
|
|
118
|
+
const goesOn = have > 0 && got.status === 206;
|
|
119
|
+
at = goesOn ? have : 0;
|
|
120
|
+
const body = Readable.fromWeb(got.body);
|
|
121
|
+
body.on("data", (bytes) => {
|
|
122
|
+
at += bytes.length;
|
|
123
|
+
if (Date.now() - told > 250) {
|
|
124
|
+
told = Date.now();
|
|
125
|
+
onProgress(before + at, total);
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
await pipeline(body, createWriteStream(part, { flags: goesOn ? "a" : "w" }), { signal });
|
|
129
|
+
}
|
|
130
|
+
const size = (await stat(part)).size;
|
|
131
|
+
const hash = file.lfs?.sha256;
|
|
132
|
+
if ((file.size !== undefined && size !== file.size) ||
|
|
133
|
+
(hash && (await sha256(part)) !== hash)) {
|
|
134
|
+
await rm(part, { force: true });
|
|
135
|
+
throw new Error(`${file.rfilename} arrived damaged. Try again.`);
|
|
136
|
+
}
|
|
137
|
+
await rename(part, target);
|
|
138
|
+
}
|
|
139
|
+
before += file.size ?? 0;
|
|
140
|
+
onProgress(before, total);
|
|
141
|
+
}
|
|
142
|
+
await writeFile(join(dir, DONE), JSON.stringify({ sha: info.sha ?? "", size: total }));
|
|
143
|
+
}
|
|
144
|
+
/** Removes a model and what its folder held. */
|
|
145
|
+
export async function removeModel(root, model) {
|
|
146
|
+
const dir = modelFolder(root, model);
|
|
147
|
+
if (!existsSync(dir)) {
|
|
148
|
+
throw new Error(`There is no model ${model}.`);
|
|
149
|
+
}
|
|
150
|
+
await rm(dir, { recursive: true });
|
|
151
|
+
// The organization's folder goes with its last model.
|
|
152
|
+
await rmdir(dirname(dir)).catch(() => undefined);
|
|
153
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ollama on a computer, through its own API (`/api/…`): whether it runs, the models it holds and
|
|
3
|
+
* what each can do, which of them fits the computer's memory, and downloads.
|
|
4
|
+
*/
|
|
5
|
+
import { type InstalledModel, type ServerOptions } from "../servers/server.js";
|
|
6
|
+
/** Where Ollama answers when nothing names another address. */
|
|
7
|
+
export declare const OLLAMA_DEFAULT = "http://127.0.0.1:11434";
|
|
8
|
+
/**
|
|
9
|
+
* Ollama's root address, from either way it is given: a root as OLLAMA_HOST names it
|
|
10
|
+
* (`http://127.0.0.1:11434`, also `127.0.0.1:11434` or `localhost`), or the OpenAI-compatible
|
|
11
|
+
* address as OLLAMA_URL names it (`http://127.0.0.1:11434/v1`). An address without a scheme is
|
|
12
|
+
* http, and without a port too it is on Ollama's port.
|
|
13
|
+
*/
|
|
14
|
+
export declare function ollamaRoot(url: string): string;
|
|
15
|
+
/** Where Ollama answers for this process: OLLAMA_URL (a root or `…/v1`), else Ollama's default. */
|
|
16
|
+
export declare function ollamaAddress(env?: NodeJS.ProcessEnv): string;
|
|
17
|
+
export interface OllamaState {
|
|
18
|
+
/** The version of the Ollama that answers; null where none does. */
|
|
19
|
+
version: string | null;
|
|
20
|
+
/** The names of the models it holds; empty where it does not answer. */
|
|
21
|
+
models: string[];
|
|
22
|
+
}
|
|
23
|
+
/** Whether Ollama answers at `url`, and the models it holds. */
|
|
24
|
+
export declare function ollamaState(url: string, options?: ServerOptions): Promise<OllamaState>;
|
|
25
|
+
/**
|
|
26
|
+
* The models of the Ollama at `url`, each with what it can do and whether it is in memory.
|
|
27
|
+
* Ollama describes them all at once; a model it does not describe in time has no capabilities.
|
|
28
|
+
* Empty where Ollama does not answer.
|
|
29
|
+
*/
|
|
30
|
+
export declare function installedModels(url: string, options?: ServerOptions): Promise<InstalledModel[]>;
|
|
31
|
+
/**
|
|
32
|
+
* Pulls a model into the Ollama at `url`; `onProgress` hears the bytes so far and in all as they
|
|
33
|
+
* come, summed over the model's parts. Rejects with Ollama's own reason.
|
|
34
|
+
*/
|
|
35
|
+
export declare function pullModel(url: string, model: string, onProgress: (done: number, total: number) => void, options?: ServerOptions & {
|
|
36
|
+
signal?: AbortSignal;
|
|
37
|
+
}): Promise<void>;
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ollama on a computer, through its own API (`/api/…`): whether it runs, the models it holds and
|
|
3
|
+
* what each can do, which of them fits the computer's memory, and downloads.
|
|
4
|
+
*/
|
|
5
|
+
import { getJson } from "../servers/server.js";
|
|
6
|
+
/** Where Ollama answers when nothing names another address. */
|
|
7
|
+
export const OLLAMA_DEFAULT = "http://127.0.0.1:11434";
|
|
8
|
+
/** Ollama's own port, for an address given without one. */
|
|
9
|
+
const OLLAMA_PORT = "11434";
|
|
10
|
+
/**
|
|
11
|
+
* Ollama's root address, from either way it is given: a root as OLLAMA_HOST names it
|
|
12
|
+
* (`http://127.0.0.1:11434`, also `127.0.0.1:11434` or `localhost`), or the OpenAI-compatible
|
|
13
|
+
* address as OLLAMA_URL names it (`http://127.0.0.1:11434/v1`). An address without a scheme is
|
|
14
|
+
* http, and without a port too it is on Ollama's port.
|
|
15
|
+
*/
|
|
16
|
+
export function ollamaRoot(url) {
|
|
17
|
+
const root = url.trim().replace(/\/+$/, "").replace(/\/v1$/, "");
|
|
18
|
+
if (!root || /^[a-z][a-z0-9+.-]*:\/\//i.test(root)) {
|
|
19
|
+
return root;
|
|
20
|
+
}
|
|
21
|
+
try {
|
|
22
|
+
const parsed = new URL(`http://${root}`);
|
|
23
|
+
if (!parsed.port) {
|
|
24
|
+
parsed.port = OLLAMA_PORT;
|
|
25
|
+
}
|
|
26
|
+
return `${parsed.origin}${parsed.pathname}`.replace(/\/+$/, "");
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
return `http://${root}`;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
/** Where Ollama answers for this process: OLLAMA_URL (a root or `…/v1`), else Ollama's default. */
|
|
33
|
+
export function ollamaAddress(env = process.env) {
|
|
34
|
+
return ollamaRoot(env.OLLAMA_URL || OLLAMA_DEFAULT);
|
|
35
|
+
}
|
|
36
|
+
/** Whether Ollama answers at `url`, and the models it holds. */
|
|
37
|
+
export async function ollamaState(url, options = {}) {
|
|
38
|
+
const doFetch = options.fetch ?? fetch;
|
|
39
|
+
const root = ollamaRoot(url);
|
|
40
|
+
const version = (await getJson(doFetch, `${root}/api/version`))?.version ?? null;
|
|
41
|
+
const tags = version
|
|
42
|
+
? await getJson(doFetch, `${root}/api/tags`)
|
|
43
|
+
: null;
|
|
44
|
+
return { version, models: (tags?.models ?? []).map((m) => m.name) };
|
|
45
|
+
}
|
|
46
|
+
/** What `/api/show` said about a model, by its digest: it does not change while the digest stays. */
|
|
47
|
+
const shown = new Map();
|
|
48
|
+
/**
|
|
49
|
+
* The models of the Ollama at `url`, each with what it can do and whether it is in memory.
|
|
50
|
+
* Ollama describes them all at once; a model it does not describe in time has no capabilities.
|
|
51
|
+
* Empty where Ollama does not answer.
|
|
52
|
+
*/
|
|
53
|
+
export async function installedModels(url, options = {}) {
|
|
54
|
+
const doFetch = options.fetch ?? fetch;
|
|
55
|
+
const root = ollamaRoot(url);
|
|
56
|
+
const [tags, ps] = await Promise.all([
|
|
57
|
+
getJson(doFetch, `${root}/api/tags`),
|
|
58
|
+
getJson(doFetch, `${root}/api/ps`),
|
|
59
|
+
]);
|
|
60
|
+
const running = new Set((ps?.models ?? []).map((m) => m.name));
|
|
61
|
+
return Promise.all((tags?.models ?? []).map(async (m) => {
|
|
62
|
+
let show = shown.get(m.digest);
|
|
63
|
+
if (!show) {
|
|
64
|
+
const answer = await getJson(doFetch, `${root}/api/show`, {
|
|
65
|
+
method: "POST",
|
|
66
|
+
headers: { "content-type": "application/json" },
|
|
67
|
+
body: JSON.stringify({ model: m.name }),
|
|
68
|
+
}, 5000);
|
|
69
|
+
show = answer ?? {};
|
|
70
|
+
if (answer) {
|
|
71
|
+
shown.set(m.digest, answer);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
const capabilities = show.capabilities ?? [];
|
|
75
|
+
return {
|
|
76
|
+
name: m.name,
|
|
77
|
+
size: m.size,
|
|
78
|
+
digest: m.digest,
|
|
79
|
+
capabilities,
|
|
80
|
+
completion: capabilities.includes("completion"),
|
|
81
|
+
tools: capabilities.includes("tools"),
|
|
82
|
+
vision: capabilities.includes("vision"),
|
|
83
|
+
thinking: capabilities.includes("thinking"),
|
|
84
|
+
runner: show.details?.runner || null,
|
|
85
|
+
quantization: show.details?.quantization_level || null,
|
|
86
|
+
running: running.has(m.name),
|
|
87
|
+
};
|
|
88
|
+
}));
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Pulls a model into the Ollama at `url`; `onProgress` hears the bytes so far and in all as they
|
|
92
|
+
* come, summed over the model's parts. Rejects with Ollama's own reason.
|
|
93
|
+
*/
|
|
94
|
+
export async function pullModel(url, model, onProgress, options = {}) {
|
|
95
|
+
const doFetch = options.fetch ?? fetch;
|
|
96
|
+
const res = await doFetch(`${ollamaRoot(url)}/api/pull`, {
|
|
97
|
+
method: "POST",
|
|
98
|
+
headers: { "content-type": "application/json" },
|
|
99
|
+
body: JSON.stringify({ model, stream: true }),
|
|
100
|
+
signal: options.signal,
|
|
101
|
+
});
|
|
102
|
+
if (!(res.ok && res.body)) {
|
|
103
|
+
throw new Error(`Ollama answered ${res.status}. ${await res.text().catch(() => "")}`.trim());
|
|
104
|
+
}
|
|
105
|
+
// Each part of the model reports on its own; the sum is the download.
|
|
106
|
+
const parts = new Map();
|
|
107
|
+
const reader = res.body.getReader();
|
|
108
|
+
const decoder = new TextDecoder();
|
|
109
|
+
let pending = "";
|
|
110
|
+
let finished = false;
|
|
111
|
+
const read = (line) => {
|
|
112
|
+
if (!line.trim()) {
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
const event = JSON.parse(line);
|
|
116
|
+
if (event.error) {
|
|
117
|
+
throw new Error(event.error);
|
|
118
|
+
}
|
|
119
|
+
if (event.digest && event.total) {
|
|
120
|
+
parts.set(event.digest, { total: event.total, completed: event.completed ?? 0 });
|
|
121
|
+
let sum = 0;
|
|
122
|
+
let all = 0;
|
|
123
|
+
for (const part of parts.values()) {
|
|
124
|
+
sum += part.completed;
|
|
125
|
+
all += part.total;
|
|
126
|
+
}
|
|
127
|
+
onProgress(sum, all);
|
|
128
|
+
}
|
|
129
|
+
finished ||= event.status === "success";
|
|
130
|
+
};
|
|
131
|
+
for (;;) {
|
|
132
|
+
const { done, value } = await reader.read();
|
|
133
|
+
if (done) {
|
|
134
|
+
break;
|
|
135
|
+
}
|
|
136
|
+
pending += decoder.decode(value, { stream: true });
|
|
137
|
+
const lines = pending.split("\n");
|
|
138
|
+
pending = lines.pop() ?? "";
|
|
139
|
+
for (const line of lines) {
|
|
140
|
+
read(line);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
read(pending);
|
|
144
|
+
if (!finished) {
|
|
145
|
+
throw new Error("The download broke off.");
|
|
146
|
+
}
|
|
147
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { installedModels, OLLAMA_DEFAULT, type OllamaState, ollamaAddress, ollamaRoot, ollamaState, pullModel, } from "./api.js";
|
|
2
|
+
export { base64Of, type CallOptions, type ChatModel, type GenerateResult, generateFrom, type OllamaSetup, ollamaMessages, ollamaModel, type StreamPart, type StreamResult, } from "./model.js";
|
|
3
|
+
export { ollama } from "./server.js";
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { LanguageModel } from "ai";
|
|
2
|
+
/**
|
|
3
|
+
* A model of Ollama as an AI SDK language model, on Ollama's own chat API (`/api/chat`). The
|
|
4
|
+
* OpenAI-compatible API cannot set the context length, and Ollama then cuts a long conversation
|
|
5
|
+
* without saying so; here the caller sets it.
|
|
6
|
+
*/
|
|
7
|
+
/** The AI SDK's language model, version 3. */
|
|
8
|
+
export type ChatModel = Extract<LanguageModel, {
|
|
9
|
+
specificationVersion: "v3";
|
|
10
|
+
}>;
|
|
11
|
+
export type CallOptions = Parameters<ChatModel["doStream"]>[0];
|
|
12
|
+
export type StreamResult = Awaited<ReturnType<ChatModel["doStream"]>>;
|
|
13
|
+
export type StreamPart = StreamResult["stream"] extends ReadableStream<infer P> ? P : never;
|
|
14
|
+
export type GenerateResult = Awaited<ReturnType<ChatModel["doGenerate"]>>;
|
|
15
|
+
export interface OllamaSetup {
|
|
16
|
+
/** Who answers, as the AI SDK names it. Default: `ollama`. */
|
|
17
|
+
provider?: string;
|
|
18
|
+
/** Ollama's address: its root, or the OpenAI-compatible `…/v1`. */
|
|
19
|
+
url: string;
|
|
20
|
+
model: string;
|
|
21
|
+
/** Tokens the model reads at most (`num_ctx`); left out, Ollama's default. */
|
|
22
|
+
context?: number;
|
|
23
|
+
/** Whether the model gets the call's tools. Without them it only talks. Default: true. */
|
|
24
|
+
tools?: boolean;
|
|
25
|
+
/** Whether the model thinks before it answers; left out, Ollama decides. What it thinks is not part of the answer. */
|
|
26
|
+
thinking?: boolean;
|
|
27
|
+
fetch?: typeof fetch;
|
|
28
|
+
}
|
|
29
|
+
interface OllamaMessage {
|
|
30
|
+
role: "system" | "user" | "assistant" | "tool";
|
|
31
|
+
content: string;
|
|
32
|
+
/** Pictures of the message, base64. */
|
|
33
|
+
images?: string[];
|
|
34
|
+
tool_calls?: {
|
|
35
|
+
function: {
|
|
36
|
+
name: string;
|
|
37
|
+
arguments: unknown;
|
|
38
|
+
};
|
|
39
|
+
}[];
|
|
40
|
+
tool_name?: string;
|
|
41
|
+
}
|
|
42
|
+
/** A file part's bytes as base64, however the AI SDK hands them over. */
|
|
43
|
+
export declare function base64Of(data: unknown): string | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* The AI SDK's prompt as Ollama's messages. Pictures go along with the newest message of the
|
|
46
|
+
* person and what tools showed after it; an older message names its pictures instead, so they
|
|
47
|
+
* are not sent again each turn.
|
|
48
|
+
*/
|
|
49
|
+
export declare function ollamaMessages(prompt: CallOptions["prompt"]): OllamaMessage[];
|
|
50
|
+
/** A model of the Ollama at `setup.url`, streaming its answer, its tool calls and the usage. */
|
|
51
|
+
export declare function ollamaModel(setup: OllamaSetup): ChatModel;
|
|
52
|
+
/** A whole answer from a model that streams. */
|
|
53
|
+
export declare function generateFrom(doStream: (options: CallOptions) => Promise<StreamResult>, options: CallOptions): Promise<GenerateResult>;
|
|
54
|
+
export {};
|