@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,48 @@
|
|
|
1
|
+
import { type Surface } from "../surface.js";
|
|
2
|
+
/**
|
|
3
|
+
* A view as A2UI v1.0 (a2ui.org): one `createSurface` message with its components and data, for
|
|
4
|
+
* an agent or a host that speaks A2UI rather than OpenUI Lang. It is a snapshot of what the view
|
|
5
|
+
* shows: every value is worked out (A2UI renderers know neither our calc nor our functions), a
|
|
6
|
+
* repeat is drawn once per entry. A Form's answers are bound into the data model and come back
|
|
7
|
+
* with its send button's action.
|
|
8
|
+
*
|
|
9
|
+
* Two catalogs: `basic` (the default) writes A2UI's basic catalog, which every A2UI renderer
|
|
10
|
+
* draws, and our components it doesn't have become text; `engenty:core` keeps every component
|
|
11
|
+
* ours, for a renderer that loaded our catalog (`engentyCoreCatalog`).
|
|
12
|
+
*/
|
|
13
|
+
export declare const A2UI_BASIC_CATALOG = "https://a2ui.org/specification/v1_0/catalogs/basic/catalog.json";
|
|
14
|
+
export declare const ENGENTY_CORE_CATALOG = "https://engenty.ai/schema/chatviews/engenty-core-1.json";
|
|
15
|
+
export type A2uiComponent = {
|
|
16
|
+
id: string;
|
|
17
|
+
component: string;
|
|
18
|
+
} & Record<string, unknown>;
|
|
19
|
+
export interface A2uiSurface {
|
|
20
|
+
version: "1.0";
|
|
21
|
+
createSurface: {
|
|
22
|
+
surfaceId: string;
|
|
23
|
+
catalogId: string;
|
|
24
|
+
components: A2uiComponent[];
|
|
25
|
+
dataModel?: Record<string, unknown>;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export interface A2uiOptions {
|
|
29
|
+
surfaceId: string;
|
|
30
|
+
/** `basic` (default): A2UI's basic catalog; `engenty:core`: our components. */
|
|
31
|
+
catalog?: "basic" | "engenty:core";
|
|
32
|
+
/** Where a file of the space is read, by its id; without it, files are named, not shown. */
|
|
33
|
+
assetUrl?: (id: string) => string;
|
|
34
|
+
/** Where a Ref's `open` leads. */
|
|
35
|
+
href?: (open: string) => string | null;
|
|
36
|
+
/** The language numbers are written in (an authored surface's `as`). */
|
|
37
|
+
locale?: string;
|
|
38
|
+
}
|
|
39
|
+
/** A program a model wrote, as A2UI; one `checkView` refuses is refused here too. */
|
|
40
|
+
export declare function programToA2ui(program: string, options: A2uiOptions): A2uiSurface;
|
|
41
|
+
/** An authored surface with its data (a run's result view), as A2UI. */
|
|
42
|
+
export declare function surfaceToA2ui(surface: Surface, options: A2uiOptions): A2uiSurface;
|
|
43
|
+
/**
|
|
44
|
+
* Our catalog as an A2UI v1.0 catalog document (`catalog_definition.json`), for a renderer that
|
|
45
|
+
* draws `engenty:core`: the chat library's components, the props that hold components as ids.
|
|
46
|
+
* Served at `ENGENTY_CORE_CATALOG` (apps/docs/public/schema/chatviews/engenty-core-1.json).
|
|
47
|
+
*/
|
|
48
|
+
export declare function engentyCoreCatalog(): Record<string, unknown>;
|
|
@@ -0,0 +1,514 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
import { evaluateElementProps } from "@openuidev/lang-core";
|
|
3
|
+
import { bound } from "../surface.js";
|
|
4
|
+
import { checkView } from "./check.js";
|
|
5
|
+
import { CHAT_FUNCTIONS, chatLibrarySpec } from "./library.js";
|
|
6
|
+
/**
|
|
7
|
+
* A view as A2UI v1.0 (a2ui.org): one `createSurface` message with its components and data, for
|
|
8
|
+
* an agent or a host that speaks A2UI rather than OpenUI Lang. It is a snapshot of what the view
|
|
9
|
+
* shows: every value is worked out (A2UI renderers know neither our calc nor our functions), a
|
|
10
|
+
* repeat is drawn once per entry. A Form's answers are bound into the data model and come back
|
|
11
|
+
* with its send button's action.
|
|
12
|
+
*
|
|
13
|
+
* Two catalogs: `basic` (the default) writes A2UI's basic catalog, which every A2UI renderer
|
|
14
|
+
* draws, and our components it doesn't have become text; `engenty:core` keeps every component
|
|
15
|
+
* ours, for a renderer that loaded our catalog (`engentyCoreCatalog`).
|
|
16
|
+
*/
|
|
17
|
+
export const A2UI_BASIC_CATALOG = "https://a2ui.org/specification/v1_0/catalogs/basic/catalog.json";
|
|
18
|
+
export const ENGENTY_CORE_CATALOG = "https://engenty.ai/schema/chatviews/engenty-core-1.json";
|
|
19
|
+
const isDrawn = (v) => Boolean(v &&
|
|
20
|
+
typeof v === "object" &&
|
|
21
|
+
typeof v.component === "string" &&
|
|
22
|
+
"props" in v);
|
|
23
|
+
const str = (v) => (v === undefined || v === null ? "" : String(v));
|
|
24
|
+
// --- from a program -------------------------------------------------------------------------
|
|
25
|
+
const runtimeFunctions = () => {
|
|
26
|
+
const schema = chatLibrarySpec.toJSONSchema();
|
|
27
|
+
return Object.fromEntries(CHAT_FUNCTIONS.map((f) => [f.name, { ...(schema.functions?.[f.name] ?? {}), fn: f.fn }]));
|
|
28
|
+
};
|
|
29
|
+
function fromElement(node) {
|
|
30
|
+
const evaluated = evaluateElementProps(node, {
|
|
31
|
+
ctx: {
|
|
32
|
+
getState: () => undefined,
|
|
33
|
+
resolveRef: () => undefined,
|
|
34
|
+
functions: runtimeFunctions(),
|
|
35
|
+
},
|
|
36
|
+
library: chatLibrarySpec,
|
|
37
|
+
store: null,
|
|
38
|
+
});
|
|
39
|
+
const walk = (v) => {
|
|
40
|
+
if (v && typeof v === "object" && v.type === "element") {
|
|
41
|
+
return fromElement(v);
|
|
42
|
+
}
|
|
43
|
+
if (Array.isArray(v)) {
|
|
44
|
+
return v.map(walk);
|
|
45
|
+
}
|
|
46
|
+
if (v && typeof v === "object") {
|
|
47
|
+
return Object.fromEntries(Object.entries(v).map(([k, x]) => [k, walk(x)]));
|
|
48
|
+
}
|
|
49
|
+
return v;
|
|
50
|
+
};
|
|
51
|
+
return { component: node.typeName, props: walk(evaluated.props) };
|
|
52
|
+
}
|
|
53
|
+
// --- from an authored surface ----------------------------------------------------------------
|
|
54
|
+
function fromSurface(surface, locale) {
|
|
55
|
+
const byId = new Map(surface.components.map((c) => [c.id, c]));
|
|
56
|
+
const draw = (id, row, depth) => {
|
|
57
|
+
const c = byId.get(id);
|
|
58
|
+
if (!c || depth > 40) {
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
const props = {};
|
|
62
|
+
for (const [key, value] of Object.entries(c)) {
|
|
63
|
+
if (key === "id" || key === "component" || key === "children") {
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
props[key] = bound(value, surface.data, row, locale);
|
|
67
|
+
}
|
|
68
|
+
const kids = c.children;
|
|
69
|
+
if (Array.isArray(kids)) {
|
|
70
|
+
props.children = kids.map((k) => draw(k, row, depth + 1)).filter(Boolean);
|
|
71
|
+
}
|
|
72
|
+
else if (kids) {
|
|
73
|
+
const items = bound({ path: kids.path }, surface.data, row, locale);
|
|
74
|
+
props.children = (Array.isArray(items) ? items : [])
|
|
75
|
+
.map((item) => draw(kids.componentId, item, depth + 1))
|
|
76
|
+
.filter(Boolean);
|
|
77
|
+
}
|
|
78
|
+
if (Array.isArray(props.tabs)) {
|
|
79
|
+
props.tabs = props.tabs.map((tab) => {
|
|
80
|
+
const t = tab;
|
|
81
|
+
return { ...t, child: typeof t.child === "string" ? draw(t.child, row, depth + 1) : null };
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
if (c.component === "Form") {
|
|
85
|
+
props.form = c.id;
|
|
86
|
+
}
|
|
87
|
+
return { component: c.component, props };
|
|
88
|
+
};
|
|
89
|
+
return draw("root", undefined, 0);
|
|
90
|
+
}
|
|
91
|
+
// --- writing A2UI ----------------------------------------------------------------------------
|
|
92
|
+
class Writer {
|
|
93
|
+
options;
|
|
94
|
+
components = [];
|
|
95
|
+
data = {};
|
|
96
|
+
#n = 0;
|
|
97
|
+
constructor(options) {
|
|
98
|
+
this.options = options;
|
|
99
|
+
}
|
|
100
|
+
id() {
|
|
101
|
+
const id = this.#n === 0 ? "root" : `c${this.#n}`;
|
|
102
|
+
this.#n += 1;
|
|
103
|
+
return id;
|
|
104
|
+
}
|
|
105
|
+
add(component, props, id = this.id()) {
|
|
106
|
+
this.components.push({ id, component, ...props });
|
|
107
|
+
return id;
|
|
108
|
+
}
|
|
109
|
+
text(text, variant = "body") {
|
|
110
|
+
return this.add("Text", { text, variant });
|
|
111
|
+
}
|
|
112
|
+
column(ids, id = this.id()) {
|
|
113
|
+
return this.add("Column", { children: ids }, id);
|
|
114
|
+
}
|
|
115
|
+
file(id) {
|
|
116
|
+
const s = str(id);
|
|
117
|
+
return s && this.options.assetUrl ? this.options.assetUrl(s.replace(/^f:/, "")) : null;
|
|
118
|
+
}
|
|
119
|
+
/** Our component kept as it is, with what it holds as ids. */
|
|
120
|
+
core(d) {
|
|
121
|
+
const id = this.id();
|
|
122
|
+
const holds = (v) => isDrawn(v)
|
|
123
|
+
? this.core(v)
|
|
124
|
+
: Array.isArray(v)
|
|
125
|
+
? v.map(holds)
|
|
126
|
+
: v && typeof v === "object"
|
|
127
|
+
? Object.fromEntries(Object.entries(v).map(([k, x]) => [k, holds(x)]))
|
|
128
|
+
: v;
|
|
129
|
+
// A Form's name for its answers is A2UI's data model, which our components don't take.
|
|
130
|
+
const { form: _form, ...own } = d.props;
|
|
131
|
+
const props = holds(d.component === "Form" ? own : d.props);
|
|
132
|
+
this.components.push({ id, component: d.component, ...props });
|
|
133
|
+
return id;
|
|
134
|
+
}
|
|
135
|
+
/** Our component in A2UI's basic catalog. */
|
|
136
|
+
basic(d) {
|
|
137
|
+
const p = d.props;
|
|
138
|
+
const kids = () => (Array.isArray(p.children) ? p.children.filter(isDrawn) : []);
|
|
139
|
+
const id = this.id();
|
|
140
|
+
const many = (ids) => this.column(ids, id);
|
|
141
|
+
const rows = (v) => (Array.isArray(v) ? v : []);
|
|
142
|
+
const cell = (item, key) => item && typeof item === "object" ? item[key] : item;
|
|
143
|
+
switch (d.component) {
|
|
144
|
+
case "Column":
|
|
145
|
+
case "Group":
|
|
146
|
+
return many(kids().map((k) => this.basic(k)));
|
|
147
|
+
case "List":
|
|
148
|
+
return this.add("List", { children: kids().map((k) => this.basic(k)) }, id);
|
|
149
|
+
case "Grid":
|
|
150
|
+
case "Actions":
|
|
151
|
+
return this.add("Row", { children: kids().map((k) => this.basic(k)) }, id);
|
|
152
|
+
case "Text": {
|
|
153
|
+
const v = str(p.variant);
|
|
154
|
+
const heading = v === "h3" ? "### " : v === "h4" ? "#### " : "";
|
|
155
|
+
return this.add("Text", { text: `${heading}${str(p.text)}`, variant: v === "muted" ? "caption" : "body" }, id);
|
|
156
|
+
}
|
|
157
|
+
case "Markdown":
|
|
158
|
+
return this.add("Text", { text: str(p.text), variant: "body" }, id);
|
|
159
|
+
case "Badge":
|
|
160
|
+
return this.add("Text", { text: str(p.label), variant: "caption" }, id);
|
|
161
|
+
case "Row": {
|
|
162
|
+
const lines = [this.text(`**${str(p.title)}**`)];
|
|
163
|
+
const under = [p.subtitle, p.meta, p.badge].map(str).filter(Boolean).join(" · ");
|
|
164
|
+
if (under) {
|
|
165
|
+
lines.push(this.text(under, "caption"));
|
|
166
|
+
}
|
|
167
|
+
return many(lines);
|
|
168
|
+
}
|
|
169
|
+
case "DetailGrid":
|
|
170
|
+
return this.add("Text", {
|
|
171
|
+
text: rows(p.rows)
|
|
172
|
+
.map((r) => `**${str(r.label)}:** ${str(r.value)}`)
|
|
173
|
+
.join(" \n"),
|
|
174
|
+
}, id);
|
|
175
|
+
case "Metric": {
|
|
176
|
+
const lines = [this.text(str(p.label), "caption"), this.text(`### ${str(p.value)}`)];
|
|
177
|
+
if (str(p.caption)) {
|
|
178
|
+
lines.push(this.text(str(p.caption), "caption"));
|
|
179
|
+
}
|
|
180
|
+
return many(lines);
|
|
181
|
+
}
|
|
182
|
+
case "Table": {
|
|
183
|
+
const all = rows(p.rows);
|
|
184
|
+
const columns = Array.isArray(p.columns)
|
|
185
|
+
? p.columns
|
|
186
|
+
: Object.keys(all[0] ?? {}).map((key) => ({ key, label: key }));
|
|
187
|
+
const line = (cells) => `| ${cells.map((c) => c.replace(/\|/g, "\\|")).join(" | ")} |`;
|
|
188
|
+
const table = [
|
|
189
|
+
line(columns.map((c) => str(c.label ?? c.key))),
|
|
190
|
+
line(columns.map(() => "---")),
|
|
191
|
+
...all.map((r) => line(columns.map((c) => str(r[c.key])))),
|
|
192
|
+
];
|
|
193
|
+
return this.add("Text", { text: table.join("\n") }, id);
|
|
194
|
+
}
|
|
195
|
+
case "BarChart":
|
|
196
|
+
case "LineChart":
|
|
197
|
+
case "DonutChart": {
|
|
198
|
+
const points = rows(p.points ?? p.slices);
|
|
199
|
+
const label = str(p.labelKey) || "label";
|
|
200
|
+
const value = str(p.valueKey) || "value";
|
|
201
|
+
const list = points.map((r) => `- ${str(r[label])}: ${str(r[value])}`).join("\n");
|
|
202
|
+
return this.add("Text", { text: [p.title ? `**${str(p.title)}**` : "", list].filter(Boolean).join("\n\n") }, id);
|
|
203
|
+
}
|
|
204
|
+
case "Callout":
|
|
205
|
+
return this.add("Card", {
|
|
206
|
+
child: this.text([p.title ? `**${str(p.title)}**` : "", str(p.text)].filter(Boolean).join("\n\n")),
|
|
207
|
+
}, id);
|
|
208
|
+
case "Chips": {
|
|
209
|
+
const key = str(p.labelKey);
|
|
210
|
+
return this.add("Text", {
|
|
211
|
+
text: rows(p.items)
|
|
212
|
+
.map((i) => str(key ? cell(i, key) : i))
|
|
213
|
+
.join(" · "),
|
|
214
|
+
}, id);
|
|
215
|
+
}
|
|
216
|
+
case "Steps": {
|
|
217
|
+
const key = str(p.textKey) || "text";
|
|
218
|
+
return this.add("Text", {
|
|
219
|
+
text: rows(p.items)
|
|
220
|
+
.map((i, n) => `${n + 1}. ${str(cell(i, key))}`)
|
|
221
|
+
.join("\n"),
|
|
222
|
+
}, id);
|
|
223
|
+
}
|
|
224
|
+
case "Checklist": {
|
|
225
|
+
const key = str(p.labelKey) || "label";
|
|
226
|
+
return this.add("Text", {
|
|
227
|
+
text: rows(p.items)
|
|
228
|
+
.map((i) => `- ${str(cell(i, key))}`)
|
|
229
|
+
.join("\n"),
|
|
230
|
+
}, id);
|
|
231
|
+
}
|
|
232
|
+
case "Sources": {
|
|
233
|
+
const titleKey = str(p.titleKey) || "title";
|
|
234
|
+
const urlKey = str(p.urlKey) || "url";
|
|
235
|
+
const links = rows(p.items).map((i) => {
|
|
236
|
+
const url = str(cell(i, urlKey));
|
|
237
|
+
return /^https?:\/\//.test(url)
|
|
238
|
+
? `[${str(cell(i, titleKey))}](${url})`
|
|
239
|
+
: str(cell(i, titleKey));
|
|
240
|
+
});
|
|
241
|
+
return this.add("Text", { text: links.join(" · "), variant: "caption" }, id);
|
|
242
|
+
}
|
|
243
|
+
case "Tabs":
|
|
244
|
+
return this.add("Tabs", {
|
|
245
|
+
tabs: rows(p.tabs).map((t) => ({
|
|
246
|
+
title: str(t.label),
|
|
247
|
+
child: isDrawn(t.child) ? this.basic(t.child) : this.text(""),
|
|
248
|
+
})),
|
|
249
|
+
}, id);
|
|
250
|
+
case "Card":
|
|
251
|
+
case "Fold": {
|
|
252
|
+
const lines = [];
|
|
253
|
+
if (str(p.eyebrow)) {
|
|
254
|
+
lines.push(this.text(str(p.eyebrow), "caption"));
|
|
255
|
+
}
|
|
256
|
+
lines.push(this.text(`**${str(p.title)}**`));
|
|
257
|
+
if (str(p.subtitle)) {
|
|
258
|
+
lines.push(this.text(str(p.subtitle), "caption"));
|
|
259
|
+
}
|
|
260
|
+
const image = this.file(p.image);
|
|
261
|
+
if (image) {
|
|
262
|
+
lines.push(this.add("Image", { url: image }));
|
|
263
|
+
}
|
|
264
|
+
lines.push(...kids().map((k) => this.basic(k)));
|
|
265
|
+
return d.component === "Card"
|
|
266
|
+
? this.add("Card", { child: this.column(lines) }, id)
|
|
267
|
+
: many(lines);
|
|
268
|
+
}
|
|
269
|
+
case "Image": {
|
|
270
|
+
const url = this.file(p.src);
|
|
271
|
+
return url
|
|
272
|
+
? this.add("Image", { url, ...(p.alt ? { description: str(p.alt) } : {}) }, id)
|
|
273
|
+
: this.add("Text", { text: str(p.alt), variant: "caption" }, id);
|
|
274
|
+
}
|
|
275
|
+
case "Gallery": {
|
|
276
|
+
const key = str(p.srcKey);
|
|
277
|
+
const urls = rows(p.items)
|
|
278
|
+
.map((i) => this.file(key ? cell(i, key) : i))
|
|
279
|
+
.filter((u) => Boolean(u));
|
|
280
|
+
return this.add("Row", { children: urls.map((url) => this.add("Image", { url })) }, id);
|
|
281
|
+
}
|
|
282
|
+
case "Video":
|
|
283
|
+
case "Audio": {
|
|
284
|
+
const url = this.file(p.src);
|
|
285
|
+
return url
|
|
286
|
+
? this.add(d.component === "Video" ? "Video" : "AudioPlayer", { url }, id)
|
|
287
|
+
: this.add("Text", { text: str(p.title), variant: "caption" }, id);
|
|
288
|
+
}
|
|
289
|
+
case "File": {
|
|
290
|
+
const url = this.file(p.file);
|
|
291
|
+
return this.add("Text", { text: url ? `[${str(p.name)}](${url})` : str(p.name) }, id);
|
|
292
|
+
}
|
|
293
|
+
case "Ref":
|
|
294
|
+
case "Link": {
|
|
295
|
+
const href = p.open && this.options.href ? this.options.href(str(p.open)) : null;
|
|
296
|
+
return this.add("Text", { text: href ? `[${str(p.title)}](${href})` : str(p.title) }, id);
|
|
297
|
+
}
|
|
298
|
+
case "Button":
|
|
299
|
+
return this.add("Button", { child: this.text(str(p.label)), action: { event: buttonEvent(p) } }, id);
|
|
300
|
+
case "Form":
|
|
301
|
+
return this.form(d, id);
|
|
302
|
+
case "Choice":
|
|
303
|
+
case "Toggle":
|
|
304
|
+
case "Slider":
|
|
305
|
+
return this.add("Text", { text: str(p.label ?? p.state) }, id);
|
|
306
|
+
}
|
|
307
|
+
return this.add("Text", { text: "" }, id);
|
|
308
|
+
}
|
|
309
|
+
/** A Form: its Fields bound into the data model under the form's name, and its send button. */
|
|
310
|
+
form(d, id) {
|
|
311
|
+
const name = str(d.props.form) || "form";
|
|
312
|
+
const values = {};
|
|
313
|
+
const lines = [];
|
|
314
|
+
if (str(d.props.title)) {
|
|
315
|
+
lines.push(this.text(`**${str(d.props.title)}**`));
|
|
316
|
+
}
|
|
317
|
+
for (const f of (Array.isArray(d.props.children) ? d.props.children : []).filter(isDrawn)) {
|
|
318
|
+
const p = f.props;
|
|
319
|
+
const field = str(p.name);
|
|
320
|
+
const path = `/${name}/${field}`;
|
|
321
|
+
const label = str(p.label) || field;
|
|
322
|
+
const options = (Array.isArray(p.options) ? p.options : []).map((o) => ({
|
|
323
|
+
label: str(o),
|
|
324
|
+
value: str(o),
|
|
325
|
+
}));
|
|
326
|
+
switch (str(p.kind)) {
|
|
327
|
+
case "select":
|
|
328
|
+
case "multiselect":
|
|
329
|
+
values[field] = Array.isArray(p.value) ? p.value.map(str) : p.value ? [str(p.value)] : [];
|
|
330
|
+
lines.push(this.add("ChoicePicker", {
|
|
331
|
+
label,
|
|
332
|
+
options,
|
|
333
|
+
value: { "@path": path },
|
|
334
|
+
variant: p.kind === "select" ? "mutuallyExclusive" : "multipleSelection",
|
|
335
|
+
}));
|
|
336
|
+
break;
|
|
337
|
+
case "toggle":
|
|
338
|
+
values[field] = p.value === true;
|
|
339
|
+
lines.push(this.add("CheckBox", { label, value: { "@path": path } }));
|
|
340
|
+
break;
|
|
341
|
+
case "date":
|
|
342
|
+
values[field] = str(p.value);
|
|
343
|
+
lines.push(this.add("DateTimeInput", { label, value: { "@path": path }, enableDate: true }));
|
|
344
|
+
break;
|
|
345
|
+
default:
|
|
346
|
+
values[field] = p.value === undefined ? "" : str(p.value);
|
|
347
|
+
lines.push(this.add("TextField", {
|
|
348
|
+
label,
|
|
349
|
+
value: { "@path": path },
|
|
350
|
+
variant: p.kind === "textarea" ? "longText" : p.kind === "number" ? "number" : "shortText",
|
|
351
|
+
}));
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
this.data[name] = values;
|
|
355
|
+
lines.push(this.add("Button", {
|
|
356
|
+
child: this.text(str(d.props.submit) || "Send"),
|
|
357
|
+
variant: "primary",
|
|
358
|
+
action: {
|
|
359
|
+
event: { name: "submit", context: { form: name, values: { "@path": `/${name}` } } },
|
|
360
|
+
},
|
|
361
|
+
}));
|
|
362
|
+
return this.column(lines, id);
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
/** A button's action as an A2UI event: ask the assistant, open a thing or a page. */
|
|
366
|
+
function buttonEvent(p) {
|
|
367
|
+
const action = p.action;
|
|
368
|
+
if (typeof action === "string") {
|
|
369
|
+
// An authored surface: regenerate, open, ask.
|
|
370
|
+
return {
|
|
371
|
+
name: action,
|
|
372
|
+
context: action === "ask" ? { message: str(p.prompt) || str(p.label) } : { target: str(p.target) },
|
|
373
|
+
};
|
|
374
|
+
}
|
|
375
|
+
const steps = action?.steps ?? [];
|
|
376
|
+
const step = steps[0] ?? action ?? {};
|
|
377
|
+
switch (step.type) {
|
|
378
|
+
case "continue_conversation":
|
|
379
|
+
return {
|
|
380
|
+
name: "ask",
|
|
381
|
+
context: {
|
|
382
|
+
message: str(step.message) || str(p.label),
|
|
383
|
+
...(step.context ? { context: step.context } : {}),
|
|
384
|
+
},
|
|
385
|
+
};
|
|
386
|
+
case "open_url":
|
|
387
|
+
return { name: "open_url", context: { url: str(step.url) } };
|
|
388
|
+
default:
|
|
389
|
+
return {
|
|
390
|
+
name: str(step.name ?? step.type) || "ask",
|
|
391
|
+
context: step.params ?? {},
|
|
392
|
+
};
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
function written(root, options) {
|
|
396
|
+
const writer = new Writer(options);
|
|
397
|
+
const core = options.catalog === "engenty:core";
|
|
398
|
+
if (root) {
|
|
399
|
+
if (core) {
|
|
400
|
+
writer.core(root);
|
|
401
|
+
}
|
|
402
|
+
else {
|
|
403
|
+
writer.basic(root);
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
else {
|
|
407
|
+
writer.add("Column", { children: [] });
|
|
408
|
+
}
|
|
409
|
+
return {
|
|
410
|
+
version: "1.0",
|
|
411
|
+
createSurface: {
|
|
412
|
+
surfaceId: options.surfaceId,
|
|
413
|
+
catalogId: core ? ENGENTY_CORE_CATALOG : A2UI_BASIC_CATALOG,
|
|
414
|
+
components: writer.components,
|
|
415
|
+
...(Object.keys(writer.data).length ? { dataModel: writer.data } : {}),
|
|
416
|
+
},
|
|
417
|
+
};
|
|
418
|
+
}
|
|
419
|
+
/** A program a model wrote, as A2UI; one `checkView` refuses is refused here too. */
|
|
420
|
+
export function programToA2ui(program, options) {
|
|
421
|
+
const check = checkView(program);
|
|
422
|
+
if (check.issues.length || !check.parsed?.root) {
|
|
423
|
+
throw new Error(`The view can't be written as A2UI: ${check.issues.join(" ")}`);
|
|
424
|
+
}
|
|
425
|
+
const root = fromElement(check.parsed.root);
|
|
426
|
+
if (root.component === "Form" || JSON.stringify(root).includes('"component":"Form"')) {
|
|
427
|
+
markForms(root);
|
|
428
|
+
}
|
|
429
|
+
return written(root, options);
|
|
430
|
+
}
|
|
431
|
+
/** A program's Forms get a name for their answers in the data model. */
|
|
432
|
+
function markForms(d) {
|
|
433
|
+
let n = 0;
|
|
434
|
+
const walk = (v) => {
|
|
435
|
+
if (isDrawn(v)) {
|
|
436
|
+
if (v.component === "Form") {
|
|
437
|
+
v.props.form = n === 0 ? "form" : `form${n}`;
|
|
438
|
+
n += 1;
|
|
439
|
+
}
|
|
440
|
+
Object.values(v.props).forEach(walk);
|
|
441
|
+
}
|
|
442
|
+
else if (Array.isArray(v)) {
|
|
443
|
+
v.forEach(walk);
|
|
444
|
+
}
|
|
445
|
+
else if (v && typeof v === "object") {
|
|
446
|
+
Object.values(v).forEach(walk);
|
|
447
|
+
}
|
|
448
|
+
};
|
|
449
|
+
walk(d);
|
|
450
|
+
}
|
|
451
|
+
/** An authored surface with its data (a run's result view), as A2UI. */
|
|
452
|
+
export function surfaceToA2ui(surface, options) {
|
|
453
|
+
return written(fromSurface(surface, options.locale), options);
|
|
454
|
+
}
|
|
455
|
+
/** A prop that holds components: in A2UI, their ids. */
|
|
456
|
+
function withIds(schema) {
|
|
457
|
+
const items = schema.items;
|
|
458
|
+
if (schema.type === "array" && items && Object.keys(items).length === 0) {
|
|
459
|
+
return { $ref: "common_types.json#/$defs/ChildList", description: schema.description };
|
|
460
|
+
}
|
|
461
|
+
if (schema.type === "array" && items?.type === "object") {
|
|
462
|
+
return { ...schema, items: withIds(items) };
|
|
463
|
+
}
|
|
464
|
+
if (schema.type === "object" && schema.properties) {
|
|
465
|
+
const props = schema.properties;
|
|
466
|
+
return {
|
|
467
|
+
...schema,
|
|
468
|
+
properties: Object.fromEntries(Object.entries(props).map(([k, v]) => [
|
|
469
|
+
k,
|
|
470
|
+
k === "child" ? { $ref: "common_types.json#/$defs/ComponentId" } : withIds(v),
|
|
471
|
+
])),
|
|
472
|
+
};
|
|
473
|
+
}
|
|
474
|
+
return schema;
|
|
475
|
+
}
|
|
476
|
+
/**
|
|
477
|
+
* Our catalog as an A2UI v1.0 catalog document (`catalog_definition.json`), for a renderer that
|
|
478
|
+
* draws `engenty:core`: the chat library's components, the props that hold components as ids.
|
|
479
|
+
* Served at `ENGENTY_CORE_CATALOG` (apps/docs/public/schema/chatviews/engenty-core-1.json).
|
|
480
|
+
*/
|
|
481
|
+
export function engentyCoreCatalog() {
|
|
482
|
+
const library = chatLibrarySpec.toJSONSchema();
|
|
483
|
+
const components = Object.fromEntries(Object.entries(library.$defs).map(([name, def]) => {
|
|
484
|
+
const props = (def.properties ?? {});
|
|
485
|
+
return [
|
|
486
|
+
name,
|
|
487
|
+
{
|
|
488
|
+
type: "object",
|
|
489
|
+
description: def.description,
|
|
490
|
+
allOf: [{ $ref: "common_types.json#/$defs/ComponentCommon" }],
|
|
491
|
+
properties: {
|
|
492
|
+
component: { const: name },
|
|
493
|
+
...Object.fromEntries(Object.entries(props).map(([k, v]) => [k, withIds(v)])),
|
|
494
|
+
},
|
|
495
|
+
required: ["component", ...(def.required ?? [])],
|
|
496
|
+
unevaluatedProperties: false,
|
|
497
|
+
},
|
|
498
|
+
];
|
|
499
|
+
}));
|
|
500
|
+
return {
|
|
501
|
+
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
502
|
+
$id: ENGENTY_CORE_CATALOG,
|
|
503
|
+
catalogId: ENGENTY_CORE_CATALOG,
|
|
504
|
+
protocolVersion: "1.0",
|
|
505
|
+
title: "engenty:core",
|
|
506
|
+
description: "The views of engenty wizards and wizards.bot (@engenty/chatviews): their components with what they show worked out.",
|
|
507
|
+
components,
|
|
508
|
+
functions: {},
|
|
509
|
+
$defs: {
|
|
510
|
+
anyComponent: { oneOf: Object.keys(components).map((n) => ({ $ref: `#/components/${n}` })) },
|
|
511
|
+
anyFunction: false,
|
|
512
|
+
},
|
|
513
|
+
};
|
|
514
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type ParseResult } from "@openuidev/lang-core";
|
|
2
|
+
/** The most a view's program may weigh. */
|
|
3
|
+
export declare const VIEW_MAX_BYTES: number;
|
|
4
|
+
export interface ViewCheck {
|
|
5
|
+
/** What is wrong, worded for the model that wrote it; empty when the view may be shown. */
|
|
6
|
+
issues: string[];
|
|
7
|
+
/** Whether the view waits for the person: a Form, or a button that asks the assistant. */
|
|
8
|
+
asks: boolean;
|
|
9
|
+
/** The parsed program, for a host that walks it (the A2UI adapter). */
|
|
10
|
+
parsed: ParseResult | null;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Whether a program a model wrote may be shown in a chat, checked before it is stored: OpenUI's
|
|
14
|
+
* parser forgives (it drops and defaults what it can't read), so whatever it would drop is an
|
|
15
|
+
* issue here, and what is shown later is what was checked. No `Query` or `Mutation` (they would
|
|
16
|
+
* run tools from the device without the home's approval), files of the space only.
|
|
17
|
+
*/
|
|
18
|
+
export declare function checkView(program: string): ViewCheck;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
import { createParser } from "@openuidev/lang-core";
|
|
3
|
+
import { chatLibrarySpec } from "./library.js";
|
|
4
|
+
/** The most a view's program may weigh. */
|
|
5
|
+
export const VIEW_MAX_BYTES = 64 * 1024;
|
|
6
|
+
/** The props that name a file: the space's own only, never an address on the web. */
|
|
7
|
+
const FILE_PROPS = {
|
|
8
|
+
Row: ["image"],
|
|
9
|
+
Card: ["image"],
|
|
10
|
+
Image: ["src"],
|
|
11
|
+
File: ["file"],
|
|
12
|
+
};
|
|
13
|
+
const isElement = (v) => Boolean(v && typeof v === "object" && v.type === "element");
|
|
14
|
+
/** Every element of a tree, the root first. */
|
|
15
|
+
function elements(node) {
|
|
16
|
+
const out = [];
|
|
17
|
+
const walk = (v) => {
|
|
18
|
+
if (isElement(v)) {
|
|
19
|
+
out.push(v);
|
|
20
|
+
Object.values(v.props).forEach(walk);
|
|
21
|
+
}
|
|
22
|
+
else if (Array.isArray(v)) {
|
|
23
|
+
v.forEach(walk);
|
|
24
|
+
}
|
|
25
|
+
else if (v && typeof v === "object") {
|
|
26
|
+
Object.values(v).forEach(walk);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
walk(node);
|
|
30
|
+
return out;
|
|
31
|
+
}
|
|
32
|
+
/** An action a button holds, as the parser leaves it: a ToAssistant step somewhere inside. */
|
|
33
|
+
function asksTheAssistant(v) {
|
|
34
|
+
const seen = JSON.stringify(v ?? null);
|
|
35
|
+
return seen.includes('"ToAssistant"') || seen.includes('"continue_conversation"');
|
|
36
|
+
}
|
|
37
|
+
const parser = () => createParser(chatLibrarySpec.toJSONSchema(), chatLibrarySpec.root);
|
|
38
|
+
/**
|
|
39
|
+
* Whether a program a model wrote may be shown in a chat, checked before it is stored: OpenUI's
|
|
40
|
+
* parser forgives (it drops and defaults what it can't read), so whatever it would drop is an
|
|
41
|
+
* issue here, and what is shown later is what was checked. No `Query` or `Mutation` (they would
|
|
42
|
+
* run tools from the device without the home's approval), files of the space only.
|
|
43
|
+
*/
|
|
44
|
+
export function checkView(program) {
|
|
45
|
+
const issues = [];
|
|
46
|
+
const bytes = new TextEncoder().encode(program).length;
|
|
47
|
+
if (bytes > VIEW_MAX_BYTES) {
|
|
48
|
+
return {
|
|
49
|
+
issues: [
|
|
50
|
+
`The view is ${bytes} bytes, more than ${VIEW_MAX_BYTES}: show fewer rows or less text.`,
|
|
51
|
+
],
|
|
52
|
+
asks: false,
|
|
53
|
+
parsed: null,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
const parsed = parser().parse(program);
|
|
57
|
+
const { meta } = parsed;
|
|
58
|
+
if (!parsed.root) {
|
|
59
|
+
issues.push("A view needs a root: `root = Column([...])`.");
|
|
60
|
+
}
|
|
61
|
+
if (meta.incomplete) {
|
|
62
|
+
issues.push("The view ends in the middle of a statement.");
|
|
63
|
+
}
|
|
64
|
+
for (const error of meta.errors) {
|
|
65
|
+
if (error.severity !== "warning") {
|
|
66
|
+
issues.push(`${error.statementId ? `${error.statementId}: ` : ""}${error.message}${error.path ? ` (${error.component}${error.path})` : ""}`);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
for (const name of meta.unresolved) {
|
|
70
|
+
issues.push(`"${name}" is used but never defined.`);
|
|
71
|
+
}
|
|
72
|
+
for (const name of meta.orphaned) {
|
|
73
|
+
issues.push(`"${name}" is defined but nothing shows it: put it into its parent's children.`);
|
|
74
|
+
}
|
|
75
|
+
if (parsed.queryStatements.length || parsed.mutationStatements.length) {
|
|
76
|
+
issues.push("A view in a chat has no Query or Mutation: write what you found into it.");
|
|
77
|
+
}
|
|
78
|
+
if (Object.keys(parsed.stateDeclarations).length) {
|
|
79
|
+
issues.push("A view in a chat has no $variables: a Field keeps what the person types.");
|
|
80
|
+
}
|
|
81
|
+
const all = parsed.root ? elements(parsed.root) : [];
|
|
82
|
+
for (const node of all) {
|
|
83
|
+
for (const prop of FILE_PROPS[node.typeName] ?? []) {
|
|
84
|
+
const v = node.props[prop];
|
|
85
|
+
if (typeof v === "string" && /^(https?:|data:|\/\/)/i.test(v.trim())) {
|
|
86
|
+
issues.push(`${node.statementId ?? node.typeName}: ${prop} is a file of the space (its id), never an address on the web.`);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
const forms = all.filter((n) => n.typeName === "Form");
|
|
91
|
+
if (forms.length > 1) {
|
|
92
|
+
issues.push("A view holds at most one Form.");
|
|
93
|
+
}
|
|
94
|
+
const asks = forms.length > 0 ||
|
|
95
|
+
all.some((n) => n.typeName === "Button" && asksTheAssistant(n.props.action));
|
|
96
|
+
return { issues, asks, parsed };
|
|
97
|
+
}
|