@engenty/wizards-runtime 0.20.5 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/apps/runtime/dist/agents/studio-assistant.js +7 -3
- package/apps/runtime/dist/agents/subscription.js +20 -25
- package/apps/runtime/dist/app.js +4 -1
- package/apps/runtime/dist/cli/clients.js +6 -24
- package/apps/runtime/dist/cli/connect.js +2 -1
- package/apps/runtime/dist/cli/environment.js +3 -0
- package/apps/runtime/dist/cli/machine.js +1 -70
- package/apps/runtime/dist/cli/main.js +2 -1
- package/apps/runtime/dist/cli/ollama.js +7 -254
- package/apps/runtime/dist/cli/setup.js +12 -9
- package/apps/runtime/dist/decision-model.js +1 -4
- package/apps/runtime/dist/docs/dev/licensing.md +20 -9
- package/apps/runtime/dist/docs/user-guide/command-line.md +5 -2
- package/apps/runtime/dist/elements/outside.js +2 -1
- package/apps/runtime/dist/engine/code-step.js +1 -1
- package/apps/runtime/dist/engine/decide.js +2 -2
- package/apps/runtime/dist/engine/device.js +3 -2
- package/apps/runtime/dist/engine/input.js +1 -1
- package/apps/runtime/dist/engine/runner.js +1 -1
- package/apps/runtime/dist/engine/steps.js +27 -8
- package/apps/runtime/dist/engine/surface.js +1 -1
- package/apps/runtime/dist/engine/template.js +1 -1
- package/apps/runtime/dist/env.js +1 -0
- package/apps/runtime/dist/harness/apple.js +4 -3
- package/apps/runtime/dist/harness/clients.js +117 -0
- package/apps/runtime/dist/harness/index.js +32 -87
- package/apps/runtime/dist/harness/model.js +32 -270
- package/apps/runtime/dist/harness/prompt.js +6 -120
- package/apps/runtime/dist/harness/types.js +5 -3
- package/apps/runtime/dist/local-call.js +6 -0
- package/apps/runtime/dist/local-models.js +53 -177
- package/apps/runtime/dist/mcp/bridge.js +12 -55
- package/apps/runtime/dist/mcp/elements.js +39 -4
- package/apps/runtime/dist/mcp/handler.js +12 -0
- package/apps/runtime/dist/mcp/run-pages.js +238 -0
- package/apps/runtime/dist/mcp/run-tasks.js +157 -0
- package/apps/runtime/dist/mcp/runs.js +129 -0
- package/apps/runtime/dist/mcp/tools.js +4 -95
- package/apps/runtime/dist/models.js +82 -32
- package/apps/runtime/dist/motion-graphics/step.js +2 -2
- package/apps/runtime/dist/prompts/mcp.md +4 -1
- package/apps/runtime/dist/render/downloads.js +1 -1
- package/apps/runtime/dist/render/shaped.js +1 -1
- package/apps/runtime/dist/routes/model-setup.js +77 -0
- package/apps/runtime/dist/routes/studio.js +8 -251
- package/apps/runtime/dist/services/space-categories.js +1 -1
- package/apps/runtime/dist/services/work-ai.js +11 -5
- package/apps/runtime/dist/texts.js +4 -6
- package/apps/runtime/dist/tools/connections.js +3 -0
- package/apps/runtime/dist/tools/harness.js +124 -0
- package/apps/web/dist/assets/AboutDialog-BSdAA4Wi.js +1 -0
- package/apps/web/dist/assets/{BlockEditor-CgjXTWly.js → BlockEditor-0noqMcAl.js} +1 -1
- package/apps/web/dist/assets/Bundle-Ctrq7lHH.js +1 -0
- package/apps/web/dist/assets/CapabilitiesPage-CZlVhBmU.js +2 -0
- package/apps/web/dist/assets/ChangelogDialog-BLCYV4jT.js +1 -0
- package/apps/web/dist/assets/{CodeEditor-2LyHbSre.js → CodeEditor-CpRn9BZq.js} +1 -1
- package/apps/web/dist/assets/ConnectorsSection-B4rRDlFo.js +1 -0
- package/apps/web/dist/assets/EditorPage-CXN-_zzG.js +3 -0
- package/apps/web/dist/assets/FlowPreview-DjQvcWxs.js +1 -0
- package/apps/web/dist/assets/LangSwitch-BuzsLp16.js +1 -0
- package/apps/web/dist/assets/LocalModels-BDfP2v5-.js +1 -0
- package/apps/web/dist/assets/Marketplace-4baBNzEc.js +2 -0
- package/apps/web/dist/assets/NewWizardChannels-B_xHm-bI.js +1 -0
- package/apps/web/dist/assets/NewWizardPage-BmZAY4zi.js +7 -0
- package/apps/web/dist/assets/OnboardingPage-fZq3WiTk.js +1 -0
- package/apps/web/dist/assets/ProtocolSection-v9wIxisg.js +1 -0
- package/apps/web/dist/assets/PublicRunner-BCh0VzAT.js +1 -0
- package/apps/web/dist/assets/{ReadOnly-CbvEK0rz.js → ReadOnly-13stkvNz.js} +1 -1
- package/apps/web/dist/assets/Results-4gmguYzH.js +1 -0
- package/apps/web/dist/assets/RunDrawer-CeEldWRn.js +1 -0
- package/apps/web/dist/assets/SettingsPage-BsKRRlfP.js +2 -0
- package/apps/web/dist/assets/SetupPage-FgA5Kl8z.js +1 -0
- package/apps/web/dist/assets/SharePage-BlBW4oxl.js +1 -0
- package/apps/web/dist/assets/SkillEditor-9QSskfmY.js +1 -0
- package/apps/web/dist/assets/Skills-DdUAyNhR.js +9 -0
- package/apps/web/dist/assets/SpacePage-CHkNPuqt.js +2 -0
- package/apps/web/dist/assets/StudioHome-BwPD-inc.js +1 -0
- package/apps/web/dist/assets/TableEditor-Du1DhbEC.js +7 -0
- package/apps/web/dist/assets/UpdateCheck-DPr9NXq_.js +2 -0
- package/apps/web/dist/assets/brand-DY3lzrOd.js +2 -0
- package/apps/web/dist/assets/changelog-BSdb22c3.js +1 -0
- package/apps/web/dist/assets/code-editor-Bep_LzQ5.js +2 -0
- package/apps/web/dist/assets/host-DiZQ_uws.js +1 -0
- package/apps/web/dist/assets/host-Dw-sMUSd.js +54 -0
- package/apps/web/dist/assets/i18n-DVrYWJaj.js +55 -0
- package/apps/web/dist/assets/index-C2gxK14s.css +1 -0
- package/apps/web/dist/assets/index-lQ4JYHYQ.js +102 -0
- package/apps/web/dist/assets/oss-credits-BHy69wkx.js +1 -0
- package/apps/web/dist/assets/{read-aloud-CRFt5q6k.js → read-aloud-CBycd8TA.js} +1 -1
- package/apps/web/dist/assets/{session-RDdtfee2.js → session-BYLtgklo.js} +1 -1
- package/apps/web/dist/assets/terminal-DmGdMags.js +16 -0
- package/apps/web/dist/assets/texts-ClKS2xhh.js +1 -0
- package/apps/web/dist/assets/theme-DFDOMsVo.js +14 -0
- package/apps/web/dist/assets/ui-CW2I3ecu.js +1 -0
- package/apps/web/dist/assets/ui-DfVpZYIW.js +16 -0
- package/apps/web/dist/assets/{useMutation-BSffqL6W.js → useMutation-BnkuLlQC.js} +1 -1
- package/apps/web/dist/assets/viewers-C6FfRwG1.js +2 -0
- package/apps/web/dist/index.html +18 -16
- package/apps/web/dist/mcp/flow.html +129 -129
- package/bin/bot-tunnel.mjs +375 -0
- package/bin/bot.mjs +494 -69
- package/node_modules/@engenty/{wizards-shared → chatviews}/dist/calc.js +1 -1
- package/node_modules/@engenty/chatviews/dist/chat/a2ui.d.ts +48 -0
- package/node_modules/@engenty/chatviews/dist/chat/a2ui.js +514 -0
- package/node_modules/@engenty/chatviews/dist/chat/check.d.ts +18 -0
- package/node_modules/@engenty/chatviews/dist/chat/check.js +97 -0
- package/node_modules/@engenty/chatviews/dist/chat/index.d.ts +3 -0
- package/node_modules/@engenty/chatviews/dist/chat/index.js +4 -0
- package/node_modules/@engenty/chatviews/dist/chat/library.d.ts +39 -0
- package/node_modules/@engenty/chatviews/dist/chat/library.js +314 -0
- package/node_modules/@engenty/{wizards-shared → chatviews}/dist/numbers.js +1 -1
- package/node_modules/@engenty/chatviews/dist/react/chat.d.ts +33 -0
- package/node_modules/@engenty/chatviews/dist/react/chat.js +150 -0
- package/node_modules/@engenty/chatviews/dist/react/field-looks.d.ts +39 -0
- package/node_modules/@engenty/chatviews/dist/react/field-looks.js +47 -0
- package/node_modules/@engenty/chatviews/dist/react/markdown.d.ts +5 -0
- package/node_modules/@engenty/chatviews/dist/react/markdown.js +11 -0
- package/node_modules/@engenty/chatviews/dist/react/no-devtools.d.ts +0 -0
- package/node_modules/@engenty/chatviews/dist/react/no-devtools.js +8 -0
- package/node_modules/@engenty/chatviews/dist/react/surface.d.ts +39 -0
- package/node_modules/@engenty/chatviews/dist/react/surface.js +552 -0
- package/node_modules/@engenty/chatviews/dist/react/texts.d.ts +39 -0
- package/node_modules/@engenty/chatviews/dist/react/texts.js +42 -0
- package/node_modules/@engenty/chatviews/dist/react/ui.d.ts +112 -0
- package/node_modules/@engenty/chatviews/dist/react/ui.js +212 -0
- package/node_modules/@engenty/{wizards-shared → chatviews}/dist/shape.js +1 -1
- package/node_modules/@engenty/{wizards-shared → chatviews}/dist/surface.js +1 -1
- package/node_modules/@engenty/chatviews/package.json +19 -0
- package/node_modules/@engenty/decision-model/dist/client.d.ts +76 -0
- package/node_modules/@engenty/decision-model/dist/client.js +188 -0
- package/node_modules/@engenty/decision-model/dist/index.d.ts +6 -0
- package/node_modules/@engenty/decision-model/dist/index.js +5 -0
- package/node_modules/@engenty/decision-model/dist/local.d.ts +11 -0
- package/node_modules/@engenty/decision-model/dist/local.js +116 -0
- package/node_modules/@engenty/decision-model/dist/resolve.d.ts +26 -0
- package/node_modules/@engenty/decision-model/dist/resolve.js +53 -0
- package/node_modules/@engenty/decision-model/dist/types.d.ts +80 -0
- package/node_modules/@engenty/decision-model/dist/types.js +6 -0
- package/node_modules/@engenty/decision-model/dist/validate.d.ts +9 -0
- package/node_modules/@engenty/decision-model/dist/validate.js +50 -0
- package/node_modules/@engenty/decision-model/dist/ways.d.ts +42 -0
- package/node_modules/@engenty/decision-model/dist/ways.js +72 -0
- package/node_modules/@engenty/decision-model/package.json +9 -0
- package/node_modules/@engenty/local-models/dist/bridge/index.d.ts +54 -0
- package/node_modules/@engenty/local-models/dist/bridge/index.js +117 -0
- package/node_modules/@engenty/local-models/dist/clients/antigravity.d.ts +37 -0
- package/{apps/runtime/dist/harness → node_modules/@engenty/local-models/dist/clients}/antigravity.js +72 -17
- package/node_modules/@engenty/local-models/dist/clients/chat.d.ts +89 -0
- package/node_modules/@engenty/local-models/dist/clients/chat.js +22 -0
- package/node_modules/@engenty/local-models/dist/clients/claude.d.ts +32 -0
- package/node_modules/@engenty/local-models/dist/clients/claude.js +239 -0
- package/node_modules/@engenty/local-models/dist/clients/client.d.ts +31 -0
- package/node_modules/@engenty/local-models/dist/clients/client.js +2 -0
- package/node_modules/@engenty/local-models/dist/clients/codex.d.ts +35 -0
- package/node_modules/@engenty/local-models/dist/clients/codex.js +254 -0
- package/node_modules/@engenty/local-models/dist/clients/cursor.d.ts +35 -0
- package/node_modules/@engenty/local-models/dist/clients/cursor.js +192 -0
- package/node_modules/@engenty/local-models/dist/clients/detect.d.ts +18 -0
- package/node_modules/@engenty/local-models/dist/clients/detect.js +34 -0
- package/node_modules/@engenty/local-models/dist/clients/env.d.ts +66 -0
- package/{apps/runtime/dist/harness → node_modules/@engenty/local-models/dist/clients}/env.js +62 -31
- package/node_modules/@engenty/local-models/dist/clients/failure.d.ts +26 -0
- package/node_modules/@engenty/local-models/dist/clients/failure.js +35 -0
- package/node_modules/@engenty/local-models/dist/clients/index.d.ts +15 -0
- package/node_modules/@engenty/local-models/dist/clients/index.js +18 -0
- package/node_modules/@engenty/local-models/dist/clients/model.d.ts +129 -0
- package/node_modules/@engenty/local-models/dist/clients/model.js +225 -0
- package/node_modules/@engenty/local-models/dist/clients/prompt.d.ts +36 -0
- package/node_modules/@engenty/local-models/dist/clients/prompt.js +123 -0
- package/node_modules/@engenty/local-models/dist/clients/run.d.ts +15 -0
- package/node_modules/@engenty/local-models/dist/clients/run.js +41 -0
- package/node_modules/@engenty/local-models/dist/index.d.ts +4 -0
- package/node_modules/@engenty/local-models/dist/index.js +4 -0
- package/node_modules/@engenty/local-models/dist/lmstudio/api.d.ts +49 -0
- package/node_modules/@engenty/local-models/dist/lmstudio/api.js +101 -0
- package/node_modules/@engenty/local-models/dist/lmstudio/index.d.ts +3 -0
- package/node_modules/@engenty/local-models/dist/lmstudio/index.js +3 -0
- package/node_modules/@engenty/local-models/dist/lmstudio/load.d.ts +12 -0
- package/node_modules/@engenty/local-models/dist/lmstudio/load.js +100 -0
- package/node_modules/@engenty/local-models/dist/lmstudio/server.d.ts +3 -0
- package/node_modules/@engenty/local-models/dist/lmstudio/server.js +29 -0
- package/node_modules/@engenty/local-models/dist/mlx/helper.d.ts +54 -0
- package/node_modules/@engenty/local-models/dist/mlx/helper.js +149 -0
- package/node_modules/@engenty/local-models/dist/mlx/index.d.ts +3 -0
- package/node_modules/@engenty/local-models/dist/mlx/index.js +3 -0
- package/node_modules/@engenty/local-models/dist/mlx/server.d.ts +19 -0
- package/node_modules/@engenty/local-models/dist/mlx/server.js +82 -0
- package/node_modules/@engenty/local-models/dist/mlx/store.d.ts +16 -0
- package/node_modules/@engenty/local-models/dist/mlx/store.js +153 -0
- package/node_modules/@engenty/local-models/dist/ollama/api.d.ts +37 -0
- package/node_modules/@engenty/local-models/dist/ollama/api.js +147 -0
- package/node_modules/@engenty/local-models/dist/ollama/index.d.ts +3 -0
- package/node_modules/@engenty/local-models/dist/ollama/index.js +3 -0
- package/node_modules/@engenty/local-models/dist/ollama/model.d.ts +54 -0
- package/node_modules/@engenty/local-models/dist/ollama/model.js +302 -0
- package/node_modules/@engenty/local-models/dist/ollama/server.d.ts +3 -0
- package/node_modules/@engenty/local-models/dist/ollama/server.js +45 -0
- package/node_modules/@engenty/local-models/dist/probe.d.ts +57 -0
- package/node_modules/@engenty/local-models/dist/probe.js +174 -0
- package/node_modules/@engenty/local-models/dist/servers/index.d.ts +6 -0
- package/node_modules/@engenty/local-models/dist/servers/index.js +12 -0
- package/node_modules/@engenty/local-models/dist/servers/server.d.ts +84 -0
- package/node_modules/@engenty/local-models/dist/servers/server.js +38 -0
- package/node_modules/@engenty/local-models/package.json +16 -0
- package/node_modules/@engenty/model-setup/dist/catalog.d.ts +36 -0
- package/node_modules/@engenty/model-setup/dist/catalog.js +81 -0
- package/node_modules/@engenty/model-setup/dist/index.d.ts +3 -0
- package/node_modules/@engenty/model-setup/dist/index.js +3 -0
- package/node_modules/@engenty/model-setup/dist/offered.d.ts +7 -0
- package/node_modules/@engenty/model-setup/dist/offered.js +64 -0
- package/node_modules/@engenty/model-setup/dist/react/client.d.ts +46 -0
- package/node_modules/@engenty/model-setup/dist/react/client.js +147 -0
- package/node_modules/@engenty/model-setup/dist/react/columns.d.ts +78 -0
- package/node_modules/@engenty/model-setup/dist/react/columns.js +99 -0
- package/node_modules/@engenty/model-setup/dist/react/host.d.ts +31 -0
- package/node_modules/@engenty/model-setup/dist/react/host.js +48 -0
- package/node_modules/@engenty/model-setup/dist/react/index.d.ts +7 -0
- package/node_modules/@engenty/model-setup/dist/react/index.js +7 -0
- package/node_modules/@engenty/model-setup/dist/react/keys.d.ts +48 -0
- package/node_modules/@engenty/model-setup/dist/react/keys.js +74 -0
- package/node_modules/@engenty/model-setup/dist/react/local-models.d.ts +23 -0
- package/node_modules/@engenty/model-setup/dist/react/local-models.js +134 -0
- package/node_modules/@engenty/model-setup/dist/react/servers.d.ts +4 -0
- package/node_modules/@engenty/model-setup/dist/react/servers.js +13 -0
- package/node_modules/@engenty/model-setup/dist/react/terminal.d.ts +13 -0
- package/node_modules/@engenty/model-setup/dist/react/terminal.js +79 -0
- package/node_modules/@engenty/model-setup/dist/react/tone.d.ts +13 -0
- package/node_modules/@engenty/model-setup/dist/react/tone.js +66 -0
- package/node_modules/@engenty/model-setup/dist/server/apps.d.ts +12 -0
- package/node_modules/@engenty/model-setup/dist/server/apps.js +22 -0
- package/node_modules/@engenty/model-setup/dist/server/clients.d.ts +55 -0
- package/node_modules/@engenty/model-setup/dist/server/clients.js +96 -0
- package/node_modules/@engenty/model-setup/dist/server/index.d.ts +8 -0
- package/node_modules/@engenty/model-setup/dist/server/index.js +8 -0
- package/node_modules/@engenty/model-setup/dist/server/install.d.ts +24 -0
- package/node_modules/@engenty/model-setup/dist/server/install.js +68 -0
- package/node_modules/@engenty/model-setup/dist/server/lmstudio.d.ts +9 -0
- package/node_modules/@engenty/model-setup/dist/server/lmstudio.js +52 -0
- package/node_modules/@engenty/model-setup/dist/server/local-models.d.ts +47 -0
- package/node_modules/@engenty/model-setup/dist/server/local-models.js +164 -0
- package/node_modules/@engenty/model-setup/dist/server/models.d.ts +12 -0
- package/node_modules/@engenty/model-setup/dist/server/models.js +16 -0
- package/node_modules/@engenty/model-setup/dist/server/ollama.d.ts +22 -0
- package/node_modules/@engenty/model-setup/dist/server/ollama.js +146 -0
- package/node_modules/@engenty/model-setup/dist/server/routes.d.ts +51 -0
- package/node_modules/@engenty/model-setup/dist/server/routes.js +211 -0
- package/node_modules/@engenty/model-setup/dist/server/server-apps.d.ts +14 -0
- package/node_modules/@engenty/model-setup/dist/server/server-apps.js +24 -0
- package/node_modules/@engenty/model-setup/dist/server/terminal.d.ts +43 -0
- package/node_modules/@engenty/model-setup/dist/server/terminal.js +222 -0
- package/node_modules/@engenty/model-setup/dist/texts.d.ts +222 -0
- package/node_modules/@engenty/model-setup/dist/texts.js +222 -0
- package/node_modules/@engenty/model-setup/dist/types.d.ts +111 -0
- package/node_modules/@engenty/model-setup/dist/types.js +2 -0
- package/node_modules/@engenty/model-setup/package.json +12 -0
- package/node_modules/@engenty/search-index/dist/catalog-lexical.d.ts +14 -0
- package/node_modules/@engenty/search-index/dist/catalog-lexical.js +165 -0
- package/node_modules/@engenty/search-index/dist/catalog-rank.d.ts +33 -0
- package/node_modules/@engenty/search-index/dist/catalog-rank.js +99 -0
- package/node_modules/@engenty/search-index/dist/catalog-search.d.ts +40 -0
- package/node_modules/@engenty/search-index/dist/catalog-search.js +161 -0
- package/node_modules/@engenty/search-index/dist/chunks.d.ts +17 -0
- package/node_modules/@engenty/search-index/dist/chunks.js +164 -0
- package/node_modules/@engenty/search-index/dist/contracts.d.ts +135 -0
- package/node_modules/@engenty/search-index/dist/contracts.js +9 -0
- package/node_modules/@engenty/search-index/dist/embedder.d.ts +31 -0
- package/node_modules/@engenty/search-index/dist/embedder.js +82 -0
- package/node_modules/@engenty/search-index/dist/embedders/gemini.d.ts +11 -0
- package/node_modules/@engenty/search-index/dist/embedders/gemini.js +54 -0
- package/node_modules/@engenty/search-index/dist/embedders/index.d.ts +5 -0
- package/node_modules/@engenty/search-index/dist/embedders/index.js +5 -0
- package/node_modules/@engenty/search-index/dist/embedders/ollama.d.ts +12 -0
- package/node_modules/@engenty/search-index/dist/embedders/ollama.js +43 -0
- package/node_modules/@engenty/search-index/dist/embedders/openai.d.ts +11 -0
- package/node_modules/@engenty/search-index/dist/embedders/openai.js +36 -0
- package/node_modules/@engenty/search-index/dist/embedders/shared.d.ts +5 -0
- package/node_modules/@engenty/search-index/dist/embedders/shared.js +26 -0
- package/node_modules/@engenty/search-index/dist/embedders/ways.d.ts +16 -0
- package/node_modules/@engenty/search-index/dist/embedders/ways.js +90 -0
- package/node_modules/@engenty/search-index/dist/index.d.ts +10 -0
- package/node_modules/@engenty/search-index/dist/index.js +10 -0
- package/node_modules/@engenty/search-index/dist/payload.d.ts +13 -0
- package/node_modules/@engenty/search-index/dist/payload.js +51 -0
- package/node_modules/@engenty/search-index/dist/registry.d.ts +25 -0
- package/node_modules/@engenty/search-index/dist/registry.js +56 -0
- package/node_modules/@engenty/search-index/dist/scoring.d.ts +10 -0
- package/node_modules/@engenty/search-index/dist/scoring.js +45 -0
- package/node_modules/@engenty/search-index/dist/strategy.d.ts +6 -0
- package/node_modules/@engenty/search-index/dist/strategy.js +25 -0
- package/node_modules/@engenty/search-index/package.json +10 -0
- package/node_modules/@engenty/tool-harness/dist/harness.d.ts +70 -0
- package/node_modules/@engenty/tool-harness/dist/harness.js +170 -0
- package/node_modules/@engenty/tool-harness/dist/index.d.ts +5 -0
- package/node_modules/@engenty/tool-harness/dist/index.js +5 -0
- package/node_modules/@engenty/tool-harness/dist/judge.d.ts +8 -0
- package/node_modules/@engenty/tool-harness/dist/judge.js +39 -0
- package/node_modules/@engenty/tool-harness/dist/levels.d.ts +18 -0
- package/node_modules/@engenty/tool-harness/dist/levels.js +47 -0
- package/node_modules/@engenty/tool-harness/dist/model.d.ts +6 -0
- package/node_modules/@engenty/tool-harness/dist/model.js +60 -0
- package/node_modules/@engenty/tool-harness/dist/schema.d.ts +26 -0
- package/node_modules/@engenty/tool-harness/dist/schema.js +57 -0
- package/node_modules/@engenty/tool-harness/package.json +9 -0
- package/node_modules/@engenty/wizards-shared/dist/catalog-prompt.js +2 -1
- package/node_modules/@engenty/wizards-shared/dist/definition.d.ts +10 -10
- package/node_modules/@engenty/wizards-shared/dist/definition.js +4 -4
- package/node_modules/@engenty/wizards-shared/dist/run-schema.js +1 -1
- package/node_modules/@engenty/wizards-shared/dist/run.d.ts +3 -1
- package/node_modules/@engenty/wizards-shared/dist/run.js +4 -0
- package/node_modules/@engenty/wizards-shared/dist/store.js +2 -1
- package/node_modules/@engenty/wizards-shared/dist/wizard-agents.d.ts +1 -1
- package/node_modules/@engenty/wizards-shared/dist/wizard-agents.js +1 -1
- package/node_modules/@engenty/wizards-shared/dist/wizard-text.js +2 -2
- package/package.json +13 -1
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin/plugin.json +1 -1
- package/apps/runtime/dist/agents/chat-clients.js +0 -344
- package/apps/runtime/dist/harness/claude.js +0 -141
- package/apps/runtime/dist/harness/codex.js +0 -222
- package/apps/runtime/dist/harness/cursor.js +0 -89
- package/apps/runtime/dist/harness/terminal.js +0 -201
- package/apps/web/dist/assets/AboutDialog-DM_2-iLP.js +0 -1
- package/apps/web/dist/assets/Bundle-C0u5HUZL.js +0 -1
- package/apps/web/dist/assets/CapabilitiesPage-DxRUERr-.js +0 -2
- package/apps/web/dist/assets/ChangelogDialog-Cyn3LAch.js +0 -1
- package/apps/web/dist/assets/ConnectorsSection-BYOrwccO.js +0 -1
- package/apps/web/dist/assets/EditorPage-BFUQzJpN.js +0 -3
- package/apps/web/dist/assets/FlowPreview-BXf4EKjU.js +0 -1
- package/apps/web/dist/assets/LangSwitch-BLB7dDce.js +0 -1
- package/apps/web/dist/assets/Marketplace-B3NoH5Va.js +0 -2
- package/apps/web/dist/assets/NewWizardChannels-DhmYe2C8.js +0 -1
- package/apps/web/dist/assets/NewWizardPage-MGKJVDp2.js +0 -7
- package/apps/web/dist/assets/OnboardingPage-RawpCO9J.js +0 -1
- package/apps/web/dist/assets/ProtocolSection-B1MshkAx.js +0 -1
- package/apps/web/dist/assets/PublicRunner-COatyxMi.js +0 -1
- package/apps/web/dist/assets/Results-DI4EHtkh.js +0 -1
- package/apps/web/dist/assets/RunDrawer-xXcbQ9wP.js +0 -1
- package/apps/web/dist/assets/SettingsPage-BcqqYDqw.js +0 -2
- package/apps/web/dist/assets/SetupPage-DG3fJ6fk.js +0 -1
- package/apps/web/dist/assets/SharePage-Drntg_oj.js +0 -1
- package/apps/web/dist/assets/SkillEditor-Ca_bzmjD.js +0 -1
- package/apps/web/dist/assets/Skills-BcgxuD15.js +0 -9
- package/apps/web/dist/assets/SpacePage-CzQAEQj8.js +0 -2
- package/apps/web/dist/assets/StudioHome-DWTDTslp.js +0 -1
- package/apps/web/dist/assets/TableEditor-DirMDIGk.js +0 -7
- package/apps/web/dist/assets/UpdateCheck-C6GlE6Am.js +0 -2
- package/apps/web/dist/assets/brand-BIT7AumL.js +0 -2
- package/apps/web/dist/assets/changelog-CMovB3yB.js +0 -1
- package/apps/web/dist/assets/code-editor-CufyaUFC.js +0 -2
- package/apps/web/dist/assets/host-DNvnJXoi.js +0 -69
- package/apps/web/dist/assets/i18n-WXeVnv7i.js +0 -55
- package/apps/web/dist/assets/index-D1iL3986.css +0 -1
- package/apps/web/dist/assets/index-DOq0CvXM.js +0 -102
- package/apps/web/dist/assets/oss-credits-C4SGbRkz.js +0 -1
- package/apps/web/dist/assets/theme-23bNrOQh.js +0 -14
- package/apps/web/dist/assets/ui-DkEhb2Rt.js +0 -16
- package/apps/web/dist/assets/viewers-CmGDpBjn.js +0 -2
- /package/apps/web/dist/assets/{host-BrP-ENHg.css → terminal-BrP-ENHg.css} +0 -0
- /package/node_modules/@engenty/{wizards-shared → chatviews}/dist/calc.d.ts +0 -0
- /package/node_modules/@engenty/{wizards-shared → chatviews}/dist/numbers.d.ts +0 -0
- /package/node_modules/@engenty/{wizards-shared → chatviews}/dist/shape.d.ts +0 -0
- /package/node_modules/@engenty/{wizards-shared → chatviews}/dist/surface.d.ts +0 -0
|
@@ -1,222 +0,0 @@
|
|
|
1
|
-
import { existsSync, readdirSync, readFileSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
2
|
-
import { homedir } from "node:os";
|
|
3
|
-
import { join } from "node:path";
|
|
4
|
-
import { note } from "@engenty/wizards-shared/run";
|
|
5
|
-
import { prompt } from "../prompts.js";
|
|
6
|
-
import { probeVersion, resolveEnv, run } from "./env.js";
|
|
7
|
-
import { failureOf, HarnessImageModel, HarnessModel, runClient, } from "./model.js";
|
|
8
|
-
/**
|
|
9
|
-
* Codex: `codex exec` answers on the ChatGPT sign-in kept in CODEX_HOME. The person's own
|
|
10
|
-
* config is left out so none of their MCP servers start for a call; tools go over MCP through
|
|
11
|
-
* a config override; structured output is validated by the client (`--output-schema`).
|
|
12
|
-
*/
|
|
13
|
-
export const CODEX_BIN = process.env.CODEX_BIN?.trim() || "codex";
|
|
14
|
-
/**
|
|
15
|
-
* Models a ChatGPT sign-in runs (checked 2026-10-04): Luna for small calls, Sol as the
|
|
16
|
-
* workhorse, Astra for the hardest work. A binding `codex/<model>` names another;
|
|
17
|
-
* `codex/default` = the model the client picks itself.
|
|
18
|
-
*/
|
|
19
|
-
const CLASSES = {
|
|
20
|
-
classifier: "gpt-6-luna",
|
|
21
|
-
low: "gpt-6.1-sol",
|
|
22
|
-
standard: "gpt-6.1-sol",
|
|
23
|
-
high: "gpt-6-astra",
|
|
24
|
-
};
|
|
25
|
-
const spec = {
|
|
26
|
-
id: "codex",
|
|
27
|
-
passThrough: /^CODEX_HOME$/,
|
|
28
|
-
keyVars: [],
|
|
29
|
-
async auth(env) {
|
|
30
|
-
try {
|
|
31
|
-
const { stdout, stderr } = await run(CODEX_BIN, ["login", "status"], {
|
|
32
|
-
timeout: 15_000,
|
|
33
|
-
env,
|
|
34
|
-
});
|
|
35
|
-
const text = `${stdout}\n${stderr}`;
|
|
36
|
-
if (/not logged in/i.test(text)) {
|
|
37
|
-
return "none";
|
|
38
|
-
}
|
|
39
|
-
if (/api key/i.test(text)) {
|
|
40
|
-
return "api_key";
|
|
41
|
-
}
|
|
42
|
-
return /logged in/i.test(text) ? "subscription" : "none";
|
|
43
|
-
}
|
|
44
|
-
catch {
|
|
45
|
-
return "none";
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
};
|
|
49
|
-
/** The events of one run as the model call wants them: the last agent message and the usage. */
|
|
50
|
-
export function codexAnswer(stdout) {
|
|
51
|
-
let text = null;
|
|
52
|
-
let usage;
|
|
53
|
-
let failure = null;
|
|
54
|
-
let sessionId;
|
|
55
|
-
for (const line of stdout.split("\n")) {
|
|
56
|
-
let event;
|
|
57
|
-
try {
|
|
58
|
-
event = JSON.parse(line);
|
|
59
|
-
}
|
|
60
|
-
catch {
|
|
61
|
-
continue;
|
|
62
|
-
}
|
|
63
|
-
if (event.type === "thread.started") {
|
|
64
|
-
sessionId = event.thread_id;
|
|
65
|
-
}
|
|
66
|
-
else if (event.type === "item.completed" && event.item?.type === "agent_message") {
|
|
67
|
-
text = event.item.text ?? "";
|
|
68
|
-
}
|
|
69
|
-
else if (event.type === "turn.completed") {
|
|
70
|
-
const u = event.usage ?? {};
|
|
71
|
-
usage = {
|
|
72
|
-
input: u.input_tokens ?? 0,
|
|
73
|
-
cacheRead: u.cached_input_tokens ?? 0,
|
|
74
|
-
cacheWrite: u.cache_write_input_tokens ?? 0,
|
|
75
|
-
output: u.output_tokens ?? 0,
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
else if (event.type === "turn.failed" || event.type === "error") {
|
|
79
|
-
failure =
|
|
80
|
-
typeof event.error === "string"
|
|
81
|
-
? event.error
|
|
82
|
-
: (event.error?.message ?? event.message ?? "error");
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
return {
|
|
86
|
-
answer: text === null ? null : { text, usage, sessionId },
|
|
87
|
-
failure,
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
class CodexModel extends HarnessModel {
|
|
91
|
-
provider = "codex";
|
|
92
|
-
nativeSchema = true;
|
|
93
|
-
async invoke(call) {
|
|
94
|
-
const args = [
|
|
95
|
-
"exec",
|
|
96
|
-
"-",
|
|
97
|
-
"--json",
|
|
98
|
-
"--ephemeral",
|
|
99
|
-
"--skip-git-repo-check",
|
|
100
|
-
"--ignore-user-config",
|
|
101
|
-
"-s",
|
|
102
|
-
"read-only",
|
|
103
|
-
"-C",
|
|
104
|
-
call.dir,
|
|
105
|
-
"-c",
|
|
106
|
-
'approval_policy="never"',
|
|
107
|
-
"-c",
|
|
108
|
-
`web_search="${call.webSearch ? "live" : "disabled"}"`,
|
|
109
|
-
];
|
|
110
|
-
if (this.modelId !== "default") {
|
|
111
|
-
args.push("-m", this.modelId);
|
|
112
|
-
}
|
|
113
|
-
if (call.effort) {
|
|
114
|
-
args.push("-c", `model_reasoning_effort="${call.effort}"`);
|
|
115
|
-
}
|
|
116
|
-
if (call.system) {
|
|
117
|
-
// A JSON string is a TOML basic string: the instructions travel as one config value.
|
|
118
|
-
args.push("-c", `developer_instructions=${JSON.stringify(call.system)}`);
|
|
119
|
-
}
|
|
120
|
-
if (call.bridgeUrl) {
|
|
121
|
-
args.push("-c", `mcp_servers.step.url="${call.bridgeUrl}"`, "-c", "mcp_servers.step.startup_timeout_sec=30", "-c", "mcp_servers.step.tool_timeout_sec=600",
|
|
122
|
-
// The tools are this runtime's own: they run without the client asking anyone.
|
|
123
|
-
"-c", 'mcp_servers.step.default_tools_approval_mode="approve"');
|
|
124
|
-
}
|
|
125
|
-
if (call.schema) {
|
|
126
|
-
const file = join(call.dir, "schema.json");
|
|
127
|
-
writeFileSync(file, JSON.stringify(call.schema));
|
|
128
|
-
args.push("--output-schema", file);
|
|
129
|
-
}
|
|
130
|
-
const { stdout, stderr, code } = await runClient(CODEX_BIN, args, {
|
|
131
|
-
cwd: call.dir,
|
|
132
|
-
env: (await resolveEnv(spec)).env,
|
|
133
|
-
signal: call.signal,
|
|
134
|
-
stdin: call.prompt,
|
|
135
|
-
});
|
|
136
|
-
const { answer, failure } = codexAnswer(stdout);
|
|
137
|
-
if (failure || !answer) {
|
|
138
|
-
throw failureOf(this.harness, failure ?? stderr.trim() ?? `exit ${code}`);
|
|
139
|
-
}
|
|
140
|
-
return answer;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* Images: `codex exec` with the built-in image tool, the reference photos attached with `-i`.
|
|
145
|
-
* Codex keeps what it made under CODEX_HOME/generated_images/<thread>; the file is read from
|
|
146
|
-
* there and that folder removed. `codex/image` runs the tool on the standard model.
|
|
147
|
-
*/
|
|
148
|
-
class CodexImageModel extends HarnessImageModel {
|
|
149
|
-
provider = "codex";
|
|
150
|
-
async invoke(call) {
|
|
151
|
-
const request = [
|
|
152
|
-
call.prompt,
|
|
153
|
-
call.files.length ? prompt("services", "harness.codex_image.edit") : "",
|
|
154
|
-
call.aspectRatio ? `Aspect ratio: ${call.aspectRatio}.` : "",
|
|
155
|
-
prompt("services", "harness.codex_image.once"),
|
|
156
|
-
]
|
|
157
|
-
.filter(Boolean)
|
|
158
|
-
.join("\n\n");
|
|
159
|
-
const args = [
|
|
160
|
-
"exec",
|
|
161
|
-
"-",
|
|
162
|
-
"--json",
|
|
163
|
-
"--ephemeral",
|
|
164
|
-
"--skip-git-repo-check",
|
|
165
|
-
"--ignore-user-config",
|
|
166
|
-
"-s",
|
|
167
|
-
"read-only",
|
|
168
|
-
"-C",
|
|
169
|
-
call.dir,
|
|
170
|
-
"-c",
|
|
171
|
-
'approval_policy="never"',
|
|
172
|
-
"-c",
|
|
173
|
-
'web_search="disabled"',
|
|
174
|
-
"-m",
|
|
175
|
-
this.modelId === "image" ? CLASSES.low : this.modelId,
|
|
176
|
-
];
|
|
177
|
-
for (const file of call.files) {
|
|
178
|
-
args.push("-i", file);
|
|
179
|
-
}
|
|
180
|
-
const { env } = await resolveEnv(spec);
|
|
181
|
-
const { stdout, stderr, code } = await runClient(CODEX_BIN, args, {
|
|
182
|
-
cwd: call.dir,
|
|
183
|
-
env,
|
|
184
|
-
signal: call.signal,
|
|
185
|
-
stdin: request,
|
|
186
|
-
});
|
|
187
|
-
const { answer, failure } = codexAnswer(stdout);
|
|
188
|
-
if (failure || !answer?.sessionId) {
|
|
189
|
-
throw failureOf(this.harness, failure ?? stderr.trim() ?? `exit ${code}`);
|
|
190
|
-
}
|
|
191
|
-
const folder = join(env.CODEX_HOME?.trim() || join(homedir(), ".codex"), "generated_images", answer.sessionId);
|
|
192
|
-
try {
|
|
193
|
-
const made = existsSync(folder)
|
|
194
|
-
? readdirSync(folder)
|
|
195
|
-
.filter((f) => /\.(png|jpe?g|webp)$/i.test(f))
|
|
196
|
-
.map((f) => join(folder, f))
|
|
197
|
-
.sort((a, b) => statSync(b).mtimeMs - statSync(a).mtimeMs)
|
|
198
|
-
: [];
|
|
199
|
-
if (!made[0]) {
|
|
200
|
-
throw new Error(`Codex made no image: ${answer.text.slice(0, 300)}`);
|
|
201
|
-
}
|
|
202
|
-
return new Uint8Array(readFileSync(made[0]));
|
|
203
|
-
}
|
|
204
|
-
finally {
|
|
205
|
-
rmSync(folder, { recursive: true, force: true });
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
export const codex = {
|
|
210
|
-
...spec,
|
|
211
|
-
name: "Codex",
|
|
212
|
-
bin: CODEX_BIN,
|
|
213
|
-
classes: CLASSES,
|
|
214
|
-
version: (env) => probeVersion(CODEX_BIN, env, (stdout) => {
|
|
215
|
-
const words = stdout.trim().split(/\s+/);
|
|
216
|
-
return words[words.length - 1] || null;
|
|
217
|
-
}),
|
|
218
|
-
login: { args: ["login"], interactive: false },
|
|
219
|
-
model: (alias, effort) => new CodexModel(codex, alias || "default", effort),
|
|
220
|
-
image: { alias: "image", model: (alias) => new CodexImageModel(codex, alias || "image") },
|
|
221
|
-
exhausted: note("chatgptAccountCodexSigned"),
|
|
222
|
-
};
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import { mkdirSync, writeFileSync } from "node:fs";
|
|
2
|
-
import { join } from "node:path";
|
|
3
|
-
import { probeVersion, resolveEnv, run } from "./env.js";
|
|
4
|
-
import { failureOf, HarnessModel, lastJson, runClient, } from "./model.js";
|
|
5
|
-
/**
|
|
6
|
-
* Cursor Agent: `cursor-agent -p` answers on the Cursor sign-in. The call's folder is its
|
|
7
|
-
* workspace: the instructions as AGENTS.md, the tools as an MCP server in .cursor/mcp.json.
|
|
8
|
-
* The answer is asked for as JSON where a schema is wanted.
|
|
9
|
-
*/
|
|
10
|
-
export const CURSOR_BIN = process.env.CURSOR_AGENT_BIN?.trim() || "cursor-agent";
|
|
11
|
-
/** "auto" = the model the client picks itself; a binding `cursor/<model>` names one. */
|
|
12
|
-
const CLASSES = {
|
|
13
|
-
classifier: "auto",
|
|
14
|
-
low: "auto",
|
|
15
|
-
standard: "auto",
|
|
16
|
-
high: "auto",
|
|
17
|
-
};
|
|
18
|
-
/** The escape sequences a terminal app draws with. */
|
|
19
|
-
const ANSI = new RegExp(`${String.fromCharCode(27)}\\[[0-9;]*[A-Za-z]`, "g");
|
|
20
|
-
const spec = {
|
|
21
|
-
id: "cursor",
|
|
22
|
-
passThrough: /^CURSOR_API_KEY$/,
|
|
23
|
-
keyVars: ["CURSOR_API_KEY"],
|
|
24
|
-
async auth(env) {
|
|
25
|
-
try {
|
|
26
|
-
const { stdout, stderr } = await run(CURSOR_BIN, ["status"], { timeout: 15_000, env });
|
|
27
|
-
// The client draws on the terminal even here: the control sequences are taken out.
|
|
28
|
-
const text = `${stdout}\n${stderr}`.replace(ANSI, "");
|
|
29
|
-
if (/not logged in/i.test(text) || !/logged in/i.test(text)) {
|
|
30
|
-
return "none";
|
|
31
|
-
}
|
|
32
|
-
return env.CURSOR_API_KEY ? "api_key" : "subscription";
|
|
33
|
-
}
|
|
34
|
-
catch {
|
|
35
|
-
return "none";
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
};
|
|
39
|
-
class CursorModel extends HarnessModel {
|
|
40
|
-
provider = "cursor-agent";
|
|
41
|
-
async invoke(call) {
|
|
42
|
-
if (call.system) {
|
|
43
|
-
writeFileSync(join(call.dir, "AGENTS.md"), call.system);
|
|
44
|
-
}
|
|
45
|
-
if (call.bridgeUrl) {
|
|
46
|
-
mkdirSync(join(call.dir, ".cursor"), { recursive: true });
|
|
47
|
-
writeFileSync(join(call.dir, ".cursor", "mcp.json"), JSON.stringify({ mcpServers: { step: { url: call.bridgeUrl } } }));
|
|
48
|
-
// The call's tools are all on the bridge: the client runs no commands and writes no files.
|
|
49
|
-
writeFileSync(join(call.dir, ".cursor", "cli.json"), JSON.stringify({
|
|
50
|
-
permissions: { allow: ["Mcp(step:*)"], deny: ["Shell(*)", "Write(**)"] },
|
|
51
|
-
}));
|
|
52
|
-
}
|
|
53
|
-
const args = ["-p", "--output-format", "json", "--workspace", call.dir, "--approve-mcps"];
|
|
54
|
-
if (this.modelId !== "auto") {
|
|
55
|
-
args.push("--model", this.modelId);
|
|
56
|
-
}
|
|
57
|
-
if (!call.bridgeUrl) {
|
|
58
|
-
// Nothing to work through: the client answers, it does not edit.
|
|
59
|
-
args.push("--mode", "ask");
|
|
60
|
-
}
|
|
61
|
-
const { stdout, stderr, code } = await runClient(CURSOR_BIN, args, {
|
|
62
|
-
cwd: call.dir,
|
|
63
|
-
env: (await resolveEnv(spec)).env,
|
|
64
|
-
signal: call.signal,
|
|
65
|
-
stdin: call.prompt,
|
|
66
|
-
});
|
|
67
|
-
const event = lastJson(stdout);
|
|
68
|
-
if (!event) {
|
|
69
|
-
throw failureOf(this.harness, stderr.trim() || `exit ${code}`);
|
|
70
|
-
}
|
|
71
|
-
if (event.is_error) {
|
|
72
|
-
throw failureOf(this.harness, String(event.result ?? "error"));
|
|
73
|
-
}
|
|
74
|
-
return {
|
|
75
|
-
text: typeof event.result === "string" ? event.result : JSON.stringify(event.result ?? ""),
|
|
76
|
-
sessionId: event.session_id,
|
|
77
|
-
meta: { durationMs: event.duration_ms ?? 0 },
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
export const cursor = {
|
|
82
|
-
...spec,
|
|
83
|
-
name: "Cursor Agent",
|
|
84
|
-
bin: CURSOR_BIN,
|
|
85
|
-
classes: CLASSES,
|
|
86
|
-
version: (env) => probeVersion(CURSOR_BIN, env, (stdout) => stdout.trim().split("\n").pop()?.trim() || null),
|
|
87
|
-
login: { args: ["login"], interactive: false },
|
|
88
|
-
model: (alias, effort) => new CursorModel(cursor, alias || "auto", effort),
|
|
89
|
-
};
|
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
import { accessSync, chmodSync, constants } from "node:fs";
|
|
2
|
-
import { createRequire } from "node:module";
|
|
3
|
-
import { note } from "@engenty/wizards-shared/run";
|
|
4
|
-
import { nanoid } from "nanoid";
|
|
5
|
-
import { ServiceError } from "../services/errors.js";
|
|
6
|
-
const BUFFER = 200_000;
|
|
7
|
-
/** A session nobody looks at is ended after this long. */
|
|
8
|
-
const IDLE_MS = 20 * 60_000;
|
|
9
|
-
/** An ended session is kept this long for a page to read its last lines. */
|
|
10
|
-
const LINGER_MS = 5 * 60_000;
|
|
11
|
-
const sessions = new Map();
|
|
12
|
-
/**
|
|
13
|
-
* @lydell/node-pty: node-pty with its binaries built for every platform it supports (Linux too),
|
|
14
|
-
* one package per platform, so nothing compiles at install. On macOS it forks through a helper
|
|
15
|
-
* that must be executable; a copy that lost the bit gets it back.
|
|
16
|
-
*/
|
|
17
|
-
const PTY = "@lydell/node-pty";
|
|
18
|
-
function ensureHelper() {
|
|
19
|
-
if (process.platform !== "darwin") {
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
try {
|
|
23
|
-
const entry = createRequire(import.meta.url).resolve(PTY);
|
|
24
|
-
const helper = createRequire(entry).resolve(`${PTY}-${process.platform}-${process.arch}/spawn-helper`);
|
|
25
|
-
try {
|
|
26
|
-
accessSync(helper, constants.X_OK);
|
|
27
|
-
}
|
|
28
|
-
catch {
|
|
29
|
-
chmodSync(helper, 0o755);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
catch {
|
|
33
|
-
// Not installed, or not ours to change: spawning tells.
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
async function ptyModule() {
|
|
37
|
-
try {
|
|
38
|
-
ensureHelper();
|
|
39
|
-
const mod = (await import("@lydell/node-pty"));
|
|
40
|
-
const spawn = mod.spawn ?? mod.default?.spawn;
|
|
41
|
-
if (!spawn) {
|
|
42
|
-
throw new Error(`${PTY} has no spawn`);
|
|
43
|
-
}
|
|
44
|
-
return { spawn };
|
|
45
|
-
}
|
|
46
|
-
catch {
|
|
47
|
-
throw new ServiceError("refused", note("builtTerminalNotAvailable"));
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
function emit(session, event) {
|
|
51
|
-
for (const listener of session.listeners) {
|
|
52
|
-
listener(event);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
function forget(session) {
|
|
56
|
-
if (session.poll) {
|
|
57
|
-
clearInterval(session.poll);
|
|
58
|
-
}
|
|
59
|
-
if (session.reaper) {
|
|
60
|
-
clearTimeout(session.reaper);
|
|
61
|
-
}
|
|
62
|
-
sessions.delete(session.id);
|
|
63
|
-
}
|
|
64
|
-
function rearm(session) {
|
|
65
|
-
if (session.reaper) {
|
|
66
|
-
clearTimeout(session.reaper);
|
|
67
|
-
}
|
|
68
|
-
session.reaper = setTimeout(() => {
|
|
69
|
-
if (session.listeners.size) {
|
|
70
|
-
rearm(session);
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
if (!session.exit) {
|
|
74
|
-
session.pty.kill();
|
|
75
|
-
}
|
|
76
|
-
forget(session);
|
|
77
|
-
}, session.exit ? LINGER_MS : IDLE_MS);
|
|
78
|
-
session.reaper.unref();
|
|
79
|
-
}
|
|
80
|
-
/** Starts a command in a new terminal; the id names it to the page. */
|
|
81
|
-
export async function openTerminal(opts) {
|
|
82
|
-
const { spawn } = await ptyModule();
|
|
83
|
-
const id = nanoid(16);
|
|
84
|
-
let pty;
|
|
85
|
-
try {
|
|
86
|
-
pty = spawn(opts.bin, opts.args, {
|
|
87
|
-
name: "xterm-256color",
|
|
88
|
-
cols: opts.cols ?? 100,
|
|
89
|
-
rows: opts.rows ?? 28,
|
|
90
|
-
cwd: opts.cwd,
|
|
91
|
-
env: opts.env,
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
catch (err) {
|
|
95
|
-
throw new ServiceError("refused", note("commandNotStarted", { detail: err.message }));
|
|
96
|
-
}
|
|
97
|
-
const session = {
|
|
98
|
-
id,
|
|
99
|
-
pty,
|
|
100
|
-
buffer: "",
|
|
101
|
-
listeners: new Set(),
|
|
102
|
-
exit: null,
|
|
103
|
-
done: false,
|
|
104
|
-
poll: null,
|
|
105
|
-
reaper: null,
|
|
106
|
-
};
|
|
107
|
-
sessions.set(id, session);
|
|
108
|
-
pty.onData((data) => {
|
|
109
|
-
session.buffer = (session.buffer + data).slice(-BUFFER);
|
|
110
|
-
emit(session, { type: "data", data });
|
|
111
|
-
});
|
|
112
|
-
pty.onExit(({ exitCode }) => {
|
|
113
|
-
session.exit = { code: exitCode };
|
|
114
|
-
if (session.poll) {
|
|
115
|
-
clearInterval(session.poll);
|
|
116
|
-
session.poll = null;
|
|
117
|
-
}
|
|
118
|
-
emit(session, { type: "exit", code: exitCode });
|
|
119
|
-
rearm(session);
|
|
120
|
-
});
|
|
121
|
-
if (opts.until) {
|
|
122
|
-
const until = opts.until;
|
|
123
|
-
let asking = false;
|
|
124
|
-
session.poll = setInterval(() => {
|
|
125
|
-
if (asking || session.done) {
|
|
126
|
-
return;
|
|
127
|
-
}
|
|
128
|
-
asking = true;
|
|
129
|
-
void until()
|
|
130
|
-
.then((ok) => {
|
|
131
|
-
if (ok && !session.done) {
|
|
132
|
-
session.done = true;
|
|
133
|
-
emit(session, { type: "done" });
|
|
134
|
-
opts.onDone?.();
|
|
135
|
-
if (!session.exit) {
|
|
136
|
-
// The command did its job; an app that stays open is ended for the person.
|
|
137
|
-
setTimeout(() => {
|
|
138
|
-
if (!session.exit) {
|
|
139
|
-
session.pty.kill();
|
|
140
|
-
}
|
|
141
|
-
}, 1500).unref();
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
})
|
|
145
|
-
.catch(() => undefined)
|
|
146
|
-
.finally(() => {
|
|
147
|
-
asking = false;
|
|
148
|
-
});
|
|
149
|
-
}, 3000);
|
|
150
|
-
}
|
|
151
|
-
rearm(session);
|
|
152
|
-
return id;
|
|
153
|
-
}
|
|
154
|
-
function sessionOf(id) {
|
|
155
|
-
const session = sessions.get(id);
|
|
156
|
-
if (!session) {
|
|
157
|
-
throw new ServiceError("not_found", note("terminalNoLongerExists"));
|
|
158
|
-
}
|
|
159
|
-
return session;
|
|
160
|
-
}
|
|
161
|
-
/** Follows a terminal: what it printed so far, then everything new, then its end. */
|
|
162
|
-
export function subscribeTerminal(id, listener) {
|
|
163
|
-
const session = sessionOf(id);
|
|
164
|
-
if (session.buffer) {
|
|
165
|
-
listener({ type: "data", data: session.buffer });
|
|
166
|
-
}
|
|
167
|
-
if (session.done) {
|
|
168
|
-
listener({ type: "done" });
|
|
169
|
-
}
|
|
170
|
-
if (session.exit) {
|
|
171
|
-
listener({ type: "exit", code: session.exit.code });
|
|
172
|
-
}
|
|
173
|
-
session.listeners.add(listener);
|
|
174
|
-
rearm(session);
|
|
175
|
-
return () => {
|
|
176
|
-
session.listeners.delete(listener);
|
|
177
|
-
rearm(session);
|
|
178
|
-
};
|
|
179
|
-
}
|
|
180
|
-
export function writeTerminal(id, data) {
|
|
181
|
-
const session = sessionOf(id);
|
|
182
|
-
if (!session.exit) {
|
|
183
|
-
session.pty.write(data);
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
export function resizeTerminal(id, cols, rows) {
|
|
187
|
-
const session = sessionOf(id);
|
|
188
|
-
if (!session.exit && cols > 0 && rows > 0) {
|
|
189
|
-
session.pty.resize(Math.min(cols, 500), Math.min(rows, 200));
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
export function closeTerminal(id) {
|
|
193
|
-
const session = sessions.get(id);
|
|
194
|
-
if (!session) {
|
|
195
|
-
return;
|
|
196
|
-
}
|
|
197
|
-
if (!session.exit) {
|
|
198
|
-
session.pty.kill();
|
|
199
|
-
}
|
|
200
|
-
forget(session);
|
|
201
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{cn as t,dn as n,gn as r,ln as i,tr as a,un as o,xn as s,yn as c}from"./ui-DkEhb2Rt.js";import{c as l,n as u}from"./marked.esm-BfGIZK7F.js";import{n as d,t as f}from"./jsx-runtime-C3cWAN_r.js";import{t as p}from"./logo-xL-sneZz.js";import{s as m}from"./i18n-WXeVnv7i.js";import{g as h,h as g,m as _,t as v,u as y}from"./UpdateCheck-C6GlE6Am.js";import{ReleaseNotes as b,loadReleases as x,releaseDate as S,releaseLabel as C}from"./ChangelogDialog-Cyn3LAch.js";import{t as w}from"./preload-helper-Cj7BV335.js";var T=e(d(),1),E=[{name:`engenty wizards`,description:`credit.engenty-wizards`,homepage:`https://github.com/engenty/wizards`,license:`FSL-1.1-MIT`},{name:`engenty`,description:`credit.engenty`,homepage:`https://github.com/engenty/engenty`,license:`FSL-1.1-MIT`}],D=[{name:`Mastra`,description:`credit.mastra`,homepage:`https://github.com/mastra-ai/mastra`,license:`Apache-2.0`},{name:`AI SDK`,description:`credit.ai-sdk`,homepage:`https://github.com/vercel/ai`,license:`Apache-2.0`},{name:`Model Context Protocol`,description:`credit.model-context-protocol`,homepage:`https://github.com/modelcontextprotocol/typescript-sdk`,license:`MIT`},{name:`Hono`,description:`credit.hono`,homepage:`https://github.com/honojs/hono`,license:`MIT`},{name:`Drizzle ORM`,description:`credit.drizzle-orm`,homepage:`https://github.com/drizzle-team/drizzle-orm`,license:`Apache-2.0`},{name:`libSQL`,description:`credit.libsql`,homepage:`https://github.com/tursodatabase/libsql`,license:`MIT`},{name:`Playwright`,description:`credit.playwright`,homepage:`https://github.com/microsoft/playwright`,license:`Apache-2.0`},{name:`React`,description:`credit.react`,homepage:`https://github.com/facebook/react`,license:`MIT`},{name:`Vite`,description:`credit.vite`,homepage:`https://github.com/vitejs/vite`,license:`MIT`},{name:`Tailwind CSS`,description:`credit.tailwind-css`,homepage:`https://github.com/tailwindlabs/tailwindcss`,license:`MIT`},{name:`React Flow`,description:`credit.react-flow`,homepage:`https://github.com/xyflow/xyflow`,license:`MIT`},{name:`TanStack Query`,description:`credit.tanstack-query`,homepage:`https://github.com/TanStack/query`,license:`MIT`},{name:`xterm.js`,description:`credit.xterm-js`,homepage:`https://github.com/xtermjs/xterm.js`,license:`MIT`},{name:`Lucide`,description:`credit.lucide`,homepage:`https://github.com/lucide-icons/lucide`,license:`ISC`},{name:`Geist & Geist Mono`,description:`credit.geist-geist-mono`,homepage:`https://github.com/vercel/geist-font`,license:`OFL-1.1`},{name:`Space Grotesk`,description:`credit.space-grotesk`,homepage:`https://github.com/floriankarsten/space-grotesk`,license:`OFL-1.1`},{name:`git-cliff`,description:`credit.git-cliff`,homepage:`https://github.com/orhun/git-cliff`,license:`MIT OR Apache-2.0`}],O=e(f(),1),k=(e,...t)=>t.some(t=>t?.toLowerCase().includes(e));function A({name:e,homepage:t,version:n,license:r,description:i}){return(0,O.jsxs)(`li`,{className:`py-2.5`,children:[(0,O.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-2.5 gap-y-0.5`,children:[t?(0,O.jsxs)(`a`,{href:t,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1 font-medium text-[0.875rem] text-ink underline-offset-4 hover:underline`,children:[e,(0,O.jsx)(l,{"aria-hidden":!0,className:`size-3 text-ink-4`})]}):(0,O.jsx)(`span`,{className:`font-medium text-[0.875rem] text-ink`,children:e}),n?(0,O.jsx)(`span`,{className:`text-[0.75rem] text-ink-3 tabular-nums`,children:n}):null,(0,O.jsx)(`span`,{className:`text-[0.75rem] text-ink-3`,children:r})]}),i?(0,O.jsx)(`p`,{className:`mt-0.5 text-[0.8125rem] text-ink-3`,children:i}):null]})}function j({title:e,hint:t,children:n}){return(0,O.jsxs)(`section`,{className:`mt-6`,children:[(0,O.jsx)(`h3`,{className:`border-border-soft border-b pb-2 font-display font-semibold text-[1rem]`,children:e}),t?(0,O.jsx)(`p`,{className:`mt-2 text-[0.8125rem] text-ink-3`,children:t}):null,n]})}function M({credits:e}){return(0,O.jsx)(`ul`,{className:`divide-y divide-border-soft`,children:e.map(e=>(0,O.jsx)(A,{name:e.name,homepage:e.homepage,license:e.license,description:m(e.description)},e.name))})}function N({label:e,packages:t}){return(0,O.jsxs)(`div`,{className:`mt-4`,children:[(0,O.jsx)(`h4`,{className:`font-medium text-[0.75rem] text-ink-3 tracking-wide`,children:e}),(0,O.jsx)(`ul`,{className:`divide-y divide-border-soft`,children:t.map(e=>(0,O.jsx)(A,{...e},e.name))})]})}function P({active:e}){let[t,a]=(0,T.useState)(null),[o,s]=(0,T.useState)(``);(0,T.useEffect)(()=>{if(!e||t)return;let n=!1;return w(()=>import(`./oss-credits-C4SGbRkz.js`).then(e=>{n||a(e.default)}),[]),()=>{n=!0}},[e,t]),(0,T.useEffect)(()=>{e||s(``)},[e]);let c=o.trim().toLowerCase(),l=e=>c?e.filter(e=>k(c,e.name,e.license,m(e.description))):e,u=e=>c?e.filter(e=>k(c,e.name,e.license,e.version)):e,d=l(E),f=l(D),p=t?[{id:`shared`,label:m(`about.creditsShared`),packages:u(t.shared)},...t.groups.map(e=>({id:e.id,label:e.label,packages:u(e.packages)}))].filter(e=>e.packages.length>0):[],h=d.length===0&&f.length===0&&p.length===0;return(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`p`,{className:`mb-4 text-[0.875rem] text-ink-3`,children:m(`about.creditsHint`)}),(0,O.jsx)(n,{type:`search`,value:o,placeholder:m(`about.search`),onChange:e=>s(e.target.value)}),d.length>0?(0,O.jsx)(j,{title:m(`about.creditsProduct`),children:(0,O.jsx)(M,{credits:d})}):null,f.length>0?(0,O.jsx)(j,{title:m(`about.creditsBuiltWith`),children:(0,O.jsx)(M,{credits:f})}):null,t===null?(0,O.jsx)(`div`,{className:`flex justify-center py-10 text-ink-3`,children:(0,O.jsx)(r,{})}):p.length>0?(0,O.jsx)(j,{title:m(`about.creditsDeps`),hint:c?void 0:m(`about.creditsDepsHint`),children:p.map(e=>(0,O.jsx)(N,{label:e.label,packages:e.packages},e.id))}):null,t!==null&&h?(0,O.jsx)(i,{children:m(`about.noMatches`)}):null]})}var F=[`new`,`earlier`,`credits`],I=e=>m(e===`new`?`about.tab.new`:e===`earlier`?`about.tab.earlier`:`about.credits`),L=e=>e===1?m(`about.change`):m(`about.changes`,{n:e});function R({me:e,active:t,initialTab:n=`new`}){let i=e?.mode===`local`,{data:o,latest:l}=g(i&&t),[u,d]=(0,T.useState)(null),[f,w]=(0,T.useState)(n);(0,T.useEffect)(()=>w(n),[n]);let E=_(F.indexOf(f)),D=o?.newer&&l?l:h;(0,T.useEffect)(()=>{if(!t)return;let e=!1;return d(null),x(D===`0.20.5`?void 0:D).then(t=>{e||d(t)}),()=>{e=!0}},[t,D]);let k=u?.find(e=>e.version===`v${D}`)??u?.[0]??null,A=u?.filter(e=>e!==k)??[],j=i?o?.kind??null:`cloud`;return(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(`div`,{className:`flex flex-col items-center pt-4 text-center`,children:[(0,O.jsx)(p,{size:96}),(0,O.jsxs)(`div`,{className:`mt-4 font-display font-semibold text-[1.5rem] tracking-tight`,children:[`engenty`,(0,O.jsx)(`span`,{className:`text-ember`,children:`.`}),(0,O.jsx)(`span`,{className:`ml-1.5 font-normal text-ink-3`,children:`wizards`})]}),(0,O.jsxs)(`div`,{className:`mt-1 text-[0.9375rem] text-ink-3 tabular-nums`,children:[m(`about.version`,{v:h}),j?` · ${m(`about.kind.${j}`)}`:``]})]}),i?(0,O.jsx)(`div`,{className:`mt-5`,children:(0,O.jsx)(v,{enabled:t})}):null,(0,O.jsx)(`div`,{className:`mt-6 flex justify-center`,children:(0,O.jsx)(c,{value:f,onChange:w,options:F.map(e=>({id:e,label:I(e)})),label:m(`about.title`)})}),(0,O.jsxs)(`div`,{className:s(`mt-5`,y(E)),children:[f===`new`?u===null?(0,O.jsx)(`div`,{className:`flex justify-center py-6 text-ink-3`,children:(0,O.jsx)(r,{})}):k?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(`h3`,{className:`flex items-baseline gap-3 border-border-soft border-b pb-2 font-display font-semibold text-[1rem]`,children:[C(k),(0,O.jsx)(`span`,{className:`font-normal font-sans text-[0.8125rem] text-ink-3 tabular-nums`,children:S(k)})]}),(0,O.jsx)(`div`,{className:`mt-3`,children:(0,O.jsx)(b,{release:k})})]}):(0,O.jsx)(`p`,{className:`text-[0.875rem] text-ink-3`,children:m(`about.changelogEmpty`)}):null,f===`earlier`?(0,O.jsx)(`div`,{className:`flex flex-col divide-y divide-border-soft`,children:A.map(e=>(0,O.jsxs)(`details`,{className:`group/r py-2`,children:[(0,O.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-baseline gap-3 text-[0.875rem] [&::-webkit-details-marker]:hidden`,children:[(0,O.jsx)(a,{className:`size-3.5 shrink-0 self-center text-ink-4 transition group-open/r:rotate-90`}),(0,O.jsx)(`span`,{className:`font-medium text-ink tabular-nums`,children:C(e)}),(0,O.jsx)(`span`,{className:`text-[0.8125rem] text-ink-3 tabular-nums`,children:S(e)}),(0,O.jsx)(`span`,{className:`ml-auto text-[0.8125rem] text-ink-4`,children:L(e.commits.length)})]}),(0,O.jsx)(`div`,{className:`mt-2 pl-6`,children:(0,O.jsx)(b,{release:e})})]},e.version??`unreleased`))}):null,f===`credits`?(0,O.jsx)(P,{active:!0}):null]},f)]})}function z({open:e,onClose:n,me:r}){return(0,O.jsxs)(t,{open:e,onClose:n,wide:!0,height:`tall`,children:[(0,O.jsx)(`div`,{className:`-mt-2 -mr-2 sticky top-0 z-10 flex h-0 justify-end`,children:(0,O.jsx)(o,{label:m(`common.close`),onClick:n,children:(0,O.jsx)(u,{className:`size-4`})})}),(0,O.jsx)(R,{me:r,active:e})]})}export{z as AboutDialog,R as AboutPanel};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{t}from"./useMutation-BSffqL6W.js";import{$ as n,Nn as r,Sr as i,Z as a,a as o,an as s,fr as c,ni as l,on as u,xn as d}from"./ui-DkEhb2Rt.js";import{c as f}from"./marked.esm-BfGIZK7F.js";import{t as p}from"./scroll-text-DmK2IucJ.js";import{t as m}from"./upload-BZThm-R6.js";import{n as h,t as g}from"./jsx-runtime-C3cWAN_r.js";import{n as _,s as v}from"./i18n-WXeVnv7i.js";import{r as y}from"./Skills-BcgxuD15.js";var b=e(h(),1),x=e(g(),1),S=e=>[`bundles`,e];function C(e,t){return i({queryKey:S(e??``),queryFn:()=>n.get(`/api/studio/spaces/${e}/bundles`),enabled:!!e&&t,select:e=>e.bundles})}var w=e=>e===`claude`?`Claude Code`:`Cursor`;function T(e){let t=e.path?`/${e.path}`:``;return e.kind===`github`?`${e.repo}${t}`:`${e.file}${t}`}function E(e){if(e.kind!==`github`)return null;let t=e.ref||e.path?`/tree/${e.ref??`HEAD`}${e.path?`/${e.path}`:``}`:``;return`https://github.com/${e.repo}${t}`}var D=e=>new Date(e).toLocaleDateString(_,{day:`numeric`,month:`long`}),O=e=>new Intl.ListFormat(_===`en`?`en-GB`:_,{style:`long`,type:`conjunction`}).format(e),k={command:`bundle.its.commands`,agent:`bundle.its.agents`,hook:`bundle.its.hooks`,rule:`bundle.its.rules`};function A(e){let t=Object.keys(k).filter(t=>e.some(e=>e.kind===t));if(e.some(e=>e.kind===`server`)&&t.push(`server`),!t.length)return null;let n=t.map(e=>v(e===`server`?`bundle.its.servers`:k[e]));return v(`bundle.its.unused`,{what:O(n)})}function j(e,t){let n=[];return e.connectors.length===1?n.push(t?v(`bundle.brought.thisConnector`):v(`bundle.brought.connector`,{name:e.connectors[0].name})):e.connectors.length&&n.push(v(`bundle.brought.connectors`,{n:e.connectors.length})),e.skills.length&&n.push(v(e.skills.length===1?`bundle.brought.skill`:`bundle.brought.skills`,{n:e.skills.length})),v(`bundle.brought`,{what:O(n)})}function M(e){let t=l();return()=>Promise.all([t.invalidateQueries({queryKey:S(e)}),t.invalidateQueries({queryKey:a.connectors(e)}),t.invalidateQueries({queryKey:a.skills(e)}),t.invalidateQueries({queryKey:[`space-connections`,e]}),t.invalidateQueries({queryKey:[`skill`]})])}function N({bundle:e,writable:a,onConnector:o}){let c=M(e.spaceId),l=(0,b.useRef)(null),u=`/api/studio/bundles/${encodeURIComponent(e.id)}`,d=i({queryKey:[`bundle-update`,e.id,e.hash],queryFn:()=>n.get(`${u}/update`),enabled:a&&e.origin.kind===`github`,staleTime:3e5,retry:!1}),p=t({mutationFn:e=>{if(e){let t=new FormData;return t.set(`file`,e),n.post(`${u}/update`,t)}return n.post(`${u}/update`,{hash:d.data?.update?.hash})},onSuccess:c}),h=d.data?.update??null,g=h?h.skills.added.length+h.skills.changed.length:0,_=E(e.origin),y=A(e.leftOut);return(0,x.jsxs)(`div`,{className:`flex flex-col gap-1.5 rounded-xl bg-paper-2 p-3.5 sm:px-5`,children:[(0,x.jsx)(`p`,{className:`font-medium text-[0.875rem]`,children:v(`bundle.cameWith`,{name:e.name,client:w(e.format)})}),(0,x.jsx)(`p`,{className:`text-[0.8125rem] text-ink-2`,children:[T(e.origin),e.version?v(`bundle.version`,{version:e.version}):``,v(`bundle.asOf`,{when:D(e.updatedAt)}),j(e,!!o),y??``].filter(Boolean).join(` · `)}),_||a?(0,x.jsxs)(`div`,{className:`mt-1.5 flex flex-wrap items-center gap-2`,children:[_?(0,x.jsxs)(`a`,{href:_,target:`_blank`,rel:`noreferrer`,className:`inline-flex h-8 items-center gap-2 rounded-full bg-card px-3 font-medium text-[0.8125rem] ring-1 ring-border transition hover:bg-accent coarse:h-10`,children:[(0,x.jsx)(f,{className:`size-4`,"aria-hidden":`true`}),` `,v(`bundle.source`)]}):null,a&&h?(0,x.jsxs)(s,{size:`sm`,variant:`secondary`,busy:p.isPending,onClick:()=>p.mutate(null),children:[(0,x.jsx)(r,{className:`size-4`}),g?v(g===1?`bundle.update.skill`:`bundle.update.skills`,{n:g}):v(`bundle.update`)]}):null,a&&e.origin.kind===`upload`?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(s,{size:`sm`,variant:`secondary`,busy:p.isPending,onClick:()=>l.current?.click(),children:[(0,x.jsx)(m,{className:`size-4`}),` `,v(`bundle.update.file`)]}),(0,x.jsx)(`input`,{ref:l,type:`file`,accept:`.zip,.plugin`,className:`hidden`,onChange:e=>{let t=e.target.files?.[0];e.target.value=``,t&&p.mutate(t)}})]}):null]}):null,a&&h?(0,x.jsx)(`p`,{className:`text-[0.8125rem] text-ink-3`,children:P(h)}):null,p.error?(0,x.jsx)(`p`,{className:`text-[0.8125rem] text-rose`,children:p.error.message}):null,p.data?.notTaken.map(e=>(0,x.jsx)(`p`,{className:`text-[0.8125rem] text-rose`,children:v(`bundle.update.notTaken`,{key:e.key,detail:e.detail})},e.key))]})}function P(e){let t=[e.skills.added.length?v(`bundle.update.added`,{names:O(e.skills.added)}):``,e.skills.changed.length?v(`bundle.update.changed`,{names:O(e.skills.changed)}):``,e.skills.removed.length?v(`bundle.update.removed`,{names:O(e.skills.removed)}):``,e.servers.added.length?v(`bundle.update.servers`,{names:O(e.servers.added.map(e=>e.key))}):``,e.servers.removed.length?v(`bundle.update.serversGone`,{names:O(e.servers.removed.map(e=>e.name))}):``].filter(Boolean);return t.length?t.join(` `):v(`bundle.update.only`)}function F({bundle:e,writable:r}){let i=M(e.spaceId),[a,o]=(0,b.useState)(!1),s=t({mutationFn:({id:e,next:t})=>n.patch(`/api/studio/skills/${e}`,{mode:t}),onSuccess:i});if(!e.skills.length)return null;let l=e.skills.filter(e=>e.mode!==`off`),f=e.skills.length-l.length,m=a?e.skills:l;return(0,x.jsxs)(`section`,{className:`flex flex-col gap-2.5`,children:[(0,x.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-2.5 gap-y-1 px-1`,children:[(0,x.jsx)(`h3`,{className:`font-display font-semibold text-base`,children:v(`space.skills`)}),(0,x.jsx)(`span`,{className:`text-[0.8125rem] text-ink-3`,children:v(`bundle.skills.hint`,{n:e.skills.length,on:l.length})})]}),m.length?(0,x.jsx)(u,{className:`flex flex-col divide-y divide-border-soft p-0`,children:m.map(e=>(0,x.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2 px-3 py-2.5 sm:flex-nowrap`,children:[(0,x.jsx)(p,{className:`size-4 shrink-0 text-ink-3`,"aria-hidden":`true`}),(0,x.jsxs)(c,{to:`/capabilities/skills?show=k:${e.id}`,className:`min-w-0 flex-1 rounded-lg max-sm:basis-[calc(100%-2rem)]`,children:[(0,x.jsx)(`span`,{className:d(`font-medium font-mono text-[0.8125rem] hover:underline`,e.mode===`off`&&`text-ink-3`),children:e.name}),(0,x.jsx)(`span`,{className:`mt-0.5 block truncate text-[0.8125rem] text-ink-3`,children:e.description})]}),(0,x.jsx)(y,{value:e.mode,disabled:!r||s.isPending,onChange:t=>s.mutate({id:e.id,next:t})})]},e.id))}):null,s.error?(0,x.jsx)(`p`,{className:`px-1 text-[0.8125rem] text-rose`,children:s.error.message}):null,f&&!a?(0,x.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 px-1 text-[0.8125rem] text-ink-3`,children:[(0,x.jsx)(`span`,{children:v(f===1?`bundle.skills.offOne`:`bundle.skills.off`,{n:f})}),(0,x.jsx)(`button`,{type:`button`,className:`underline hover:text-ink`,onClick:()=>o(!0),children:v(`bundle.skills.showOff`)})]}):null]})}function I(e){let t=[];return e.connectors.length&&t.push(v(e.connectors.length===1?`bundle.part.connector`:`bundle.part.connectors`)),e.connections.length&&t.push(v(e.connections.length===1?`bundle.part.connection`:`bundle.part.connections`)),e.skills.length&&t.push(v(e.skills.length===1?`bundle.part.skill`:`bundle.part.skills`)),O(t)}function L(e,t){let n=[];t.connectors.length&&n.push(v(t.connectors.length===1?`bundle.goes.connector`:`bundle.goes.connectors`,{names:O(t.connectors.map(e=>e.name))})),t.connections.length&&n.push(v(t.connections.length===1?`bundle.goes.connection`:`bundle.goes.connections`,{names:O(t.connections.map(e=>e.name))})),t.skills.length&&n.push(v(t.skills.length===1?`bundle.goes.skill`:`bundle.goes.skills`,{n:t.skills.length}));let r=t.wizards.length?v(t.wizards.length===1?`bundle.goes.wizard`:`bundle.goes.wizards`,{names:O(t.wizards.map(e=>v(`bundle.quoted`,{name:e.title})))}):t.connections.length?v(`bundle.goes.noWizard`):``;return[v(`bundle.removeConfirm`,{name:e,what:O(n)}),r,v(`bundle.removeUndo`)].filter(Boolean).join(` `)}function R(e,r){let i=M(e);return t({mutationFn:async e=>{let t=`/api/studio/bundles/${encodeURIComponent(e.id)}`,r=await n.get(`${t}/removal`);return await o(L(e.name,r),{action:v(`connectors.remove`)})?(await n.del(t),!0):!1},onSuccess:async e=>{e&&(await i(),r?.())}})}function z({bundle:e,onGone:t}){let n=R(e.spaceId,t);return(0,x.jsxs)(`div`,{className:`flex flex-col gap-2 px-1`,children:[(0,x.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2`,children:[(0,x.jsx)(`p`,{className:`min-w-48 flex-1 text-[0.8125rem] text-ink-3`,children:v(`bundle.removeHint`)}),(0,x.jsx)(s,{variant:`danger`,size:`sm`,busy:n.isPending,onClick:()=>n.mutate(e),children:v(`bundle.remove`,{what:I(e)})})]}),n.error?(0,x.jsx)(`p`,{className:`text-[0.8125rem] text-rose`,children:n.error.message}):null]})}export{w as a,C as c,S as i,z as n,T as o,F as r,R as s,N as t};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/SkillEditor-Ca_bzmjD.js","assets/rolldown-runtime-XKyaHtl9.js","assets/ui-DkEhb2Rt.js","assets/jsx-runtime-C3cWAN_r.js","assets/i18n-WXeVnv7i.js","assets/marked.esm-BfGIZK7F.js","assets/preload-helper-Cj7BV335.js","assets/Skills-BcgxuD15.js","assets/useMutation-BSffqL6W.js","assets/plug-CHvl1GhO.js","assets/upload-BZThm-R6.js","assets/code-xml-CdJeig44.js","assets/eye-CG1LzvNI.js","assets/scroll-text-DmK2IucJ.js","assets/session-RDdtfee2.js","assets/code-editor-CufyaUFC.js","assets/dist-Bux-wzFO.js","assets/w3c-keyname-BOAvb0qz.js","assets/Bundle-C0u5HUZL.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{b as t,d as n,u as r}from"./session-RDdtfee2.js";import{Nn as i,On as a,Xn as o,a as s,h as c,l,m as u,qn as d,t as f}from"./host-DNvnJXoi.js";import{n as p,t as m}from"./jsx-runtime-C3cWAN_r.js";import{$ as h,C as g,Sr as _,Z as v,_ as y,an as b,br as x,cn as S,fr as C,gn as w,hn as T,hr as E,jn as D,kn as O,ln as k,mr as A,ni as j,on as M,rr as N,sn as P,tr as ee,vn as te,xn as F,xr as ne,yn as I,yr as re}from"./ui-DkEhb2Rt.js";import{b as ie,y as L}from"./Marketplace-B3NoH5Va.js";import{n as ae,s as R}from"./i18n-WXeVnv7i.js";import{a as oe,c as se,d as ce,f as le,i as ue,m as de,p as fe,r as pe,u as z}from"./UpdateCheck-C6GlE6Am.js";import{c as me,h as he,i as ge,m as _e,o as ve,s as ye}from"./Skills-BcgxuD15.js";import{a as be,n as xe,o as Se,p as Ce,r as we,s as Te,t as Ee}from"./ConnectorsSection-BYOrwccO.js";import{t as B}from"./plug-CHvl1GhO.js";import{t as V}from"./scroll-text-DmK2IucJ.js";import{d as De,i as Oe,u as ke}from"./marked.esm-BfGIZK7F.js";import{t as Ae}from"./useMutation-BSffqL6W.js";import{n as je,r as Me}from"./ProtocolSection-B1MshkAx.js";import{t as Ne}from"./minus-OrLEfDzR.js";import{t as Pe}from"./preload-helper-Cj7BV335.js";var Fe={name:`compass`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z`,key:`9ktpf1`}]]};Fe.node;var Ie=De(Fe),H=e(p(),1),U=e(m(),1),Le=[`discover.example1`,`discover.example2`,`discover.example3`],Re=(e,t)=>t===void 0?[`discover`,e]:[`discover`,e,t];function ze(){let[e,t]=A(),n=e.get(`q`)??``,[r,i]=(0,H.useState)(n);return(0,H.useEffect)(()=>i(e=>e.trim()===n.trim()?e:n),[n]),(0,H.useEffect)(()=>{let e=r.trim();if(e===n.trim())return;let i=setTimeout(()=>t(t=>{let n=new URLSearchParams(t);return e?n.set(`q`,e):n.delete(`q`),n},{replace:!0}),350);return()=>clearTimeout(i)},[r,n,t]),[r,i,n.trim()]}function Be({asked:e,onExample:t}){let{space:i}=r(),a=n(),o=L(`skills`),s=j(),[c,l]=(0,H.useState)(null),u=i?.id??``,d=_({queryKey:Re(u,e),queryFn:()=>h.get(`/api/studio/spaces/${u}/discover?q=${encodeURIComponent(e)}`),enabled:!!u&&e.length>=2,staleTime:6e4}),f=e=>{s.setQueriesData({queryKey:Re(u)},t=>t&&{...t,skills:t.skills.map(t=>t.ref===e?{...t,added:!0}:t)}),s.invalidateQueries({queryKey:v.skills(u)})},p=Ae({mutationFn:e=>h.post(`/api/studio/spaces/${u}/skills/registry`,{ref:e,mode:`demand`}),onSuccess:(e,t)=>f(t)}),m=d.data,g=m?.bundles??[],y={skills:new Set(g.flatMap(e=>e.covers.skills)),connectors:new Set(g.flatMap(e=>e.covers.connectors))},x=(m?.skills??[]).filter(e=>!y.skills.has(e.ref)),C=(m?.connectors??[]).filter(e=>!y.connectors.has(e.domain)),T=m&&!g.length&&!m.skills.length&&!m.connectors.length&&!m.errors.skills&&!m.errors.connectors;return i?(0,U.jsxs)(U.Fragment,{children:[e.length<2?(0,U.jsxs)(`div`,{className:`flex flex-col gap-3 px-1 text-[0.875rem] text-ink-3`,children:[(0,U.jsx)(`p`,{children:R(`discover.start`)}),(0,U.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:Le.map(e=>(0,U.jsxs)(b,{variant:`secondary`,size:`sm`,onClick:()=>t(R(e)),children:[(0,U.jsx)(D,{className:`size-3.5`}),` `,R(e)]},e))})]}):d.error?(0,U.jsx)(`p`,{className:`px-1 text-[0.875rem] text-rose`,children:d.error.message}):m?T?(0,U.jsx)(`p`,{className:`px-1 text-[0.875rem] text-ink-3`,children:R(`discover.none`,{q:e})}):(0,U.jsxs)(U.Fragment,{children:[g.length?(0,U.jsx)(W,{title:R(`discover.bundle.title`),hint:R(`discover.bundle.hint`),count:g.length,empty:``,children:g.map(e=>(0,U.jsx)(Ue,{hit:e,admin:a},e.repo))}):null,o?(0,U.jsx)(W,{title:R(`space.skills`),count:x.length,error:m.errors.skills,empty:R(`discover.groupNone`,{directory:`skills.sh`}),children:x.map(e=>(0,U.jsx)(He,{hit:e,adding:p.isPending&&p.variables===e.ref,failed:p.isError&&p.variables===e.ref?p.error:null,onLook:()=>l(e.ref),onAdd:()=>p.mutate(e.ref)},e.ref))}):null,(0,U.jsx)(W,{title:R(`capabilities.connectors`),count:C.length,error:m.errors.connectors,empty:R(`discover.groupNone`,{directory:`integrations.sh`}),children:C.map(e=>(0,U.jsx)(We,{hit:e,admin:a},e.domain))})]}):(0,U.jsx)(`div`,{className:`flex justify-center py-16`,children:(0,U.jsx)(w,{className:`size-5`})}),(0,U.jsx)(S,{open:c!==null,onClose:()=>l(null),wide:!0,height:`tall`,title:R(`skills.registryTitle`),children:c?(0,U.jsx)(ge,{spaceId:u,skillRef:c,onAdded:()=>{f(c),l(null)}},c):null})]}):null}function W({title:e,hint:t,count:n,error:r,empty:i,children:a}){return(0,U.jsxs)(`section`,{className:`flex flex-col gap-2.5`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-2.5 gap-y-1 px-1`,children:[(0,U.jsx)(`h2`,{className:`font-display font-semibold text-lg leading-tight`,children:e}),t?(0,U.jsx)(`span`,{className:`text-[0.8125rem] text-ink-3`,children:t}):n?(0,U.jsx)(`span`,{className:`text-[0.8125rem] text-ink-3`,children:n}):null]}),r?(0,U.jsx)(`p`,{className:`px-1 text-[0.875rem] text-rose`,children:r}):n?(0,U.jsx)(M,{className:`divide-y divide-border-soft`,children:a}):(0,U.jsx)(`p`,{className:`px-1 text-[0.875rem] text-ink-3`,children:i})]})}function G({icon:e,name:t,mono:n,chip:r,line:i,source:a,error:o,children:s}){return(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2 px-3 py-3 sm:flex-nowrap`,children:[(0,U.jsx)(`span`,{className:`grid size-9 shrink-0 place-items-center rounded-lg bg-paper-2 text-ink-3`,children:(0,U.jsx)(e,{className:`size-4`})}),(0,U.jsxs)(`span`,{className:`min-w-0 flex-1 max-sm:basis-[calc(100%-3.25rem)]`,children:[(0,U.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,U.jsx)(`span`,{className:n?`font-medium font-mono text-[0.8125rem]`:`font-medium`,children:t}),r]}),i?(0,U.jsx)(`span`,{className:`mt-0.5 block truncate text-[0.8125rem] text-ink-2`,children:i}):null,(0,U.jsx)(`span`,{className:`mt-0.5 block truncate text-[0.75rem] text-ink-3`,children:a}),o?(0,U.jsx)(`span`,{className:`mt-1 block text-[0.8125rem] text-rose`,children:o}):null]}),(0,U.jsx)(`span`,{className:`flex shrink-0 items-center gap-2 max-sm:ml-[3.25rem]`,children:s})]})}function Ve(){return(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[0.8125rem] text-moss`,children:[(0,U.jsx)(ke,{className:`size-4`}),` `,R(`capabilities.inSpace`)]})}function He({hit:e,adding:t,failed:n,onLook:r,onAdd:i}){return(0,U.jsxs)(G,{icon:V,name:e.name,mono:!0,chip:e.official?(0,U.jsx)(P,{tone:`live`,icon:(0,U.jsx)(he,{className:`size-3`}),children:R(`skills.official`)}):(0,U.jsx)(P,{tone:`warn`,children:R(`skills.unchecked`)}),error:n?.message,source:[`skills.sh`,e.source,R(`skills.installs`,{n:e.installs.toLocaleString(ae)})].join(` · `),children:[(0,U.jsx)(b,{variant:`ghost`,size:`sm`,onClick:r,children:R(`skills.open`)}),e.added?(0,U.jsx)(Ve,{}):(0,U.jsx)(b,{variant:`secondary`,size:`sm`,busy:t,onClick:i,children:R(`skills.add`)})]})}function Ue({hit:e,admin:t}){let n=x(),r=`https://github.com/${e.repo}`,i=e.covers.skills.length;return(0,U.jsxs)(G,{icon:B,name:e.name,line:e.description||void 0,chip:e.official?(0,U.jsx)(P,{tone:`live`,icon:(0,U.jsx)(he,{className:`size-3`}),children:R(`skills.official`)}):(0,U.jsx)(P,{tone:`warn`,children:R(`skills.unchecked`)}),source:[e.repo,R(`discover.bundle.connector`),R(i===1?`discover.bundle.skill`:`discover.bundle.skills`,{n:i}),R(`discover.bundle.unused`)].join(` · `),children:[(0,U.jsx)(`a`,{href:r,target:`_blank`,rel:`noreferrer`,className:`inline-flex h-8 items-center rounded-full px-3 font-medium text-[0.8125rem] text-ink-2 transition hover:bg-accent hover:text-ink coarse:h-10`,children:R(`skills.open`)}),e.added?(0,U.jsx)(Ve,{}):t?(0,U.jsx)(b,{variant:`secondary`,size:`sm`,onClick:()=>n(`/capabilities/connectors?address=${encodeURIComponent(r)}`),children:R(`discover.setUp`)}):null]})}function We({hit:e,admin:t}){let n=x(),r=e.kinds.map(e=>e===`mcp`?`MCP`:`OpenAPI`);return(0,U.jsx)(G,{icon:B,name:e.name,line:e.description||void 0,source:[`integrations.sh`,e.domain,...r].join(` · `),children:e.setUp?(0,U.jsx)(Ve,{}):t?(0,U.jsx)(b,{variant:`secondary`,size:`sm`,onClick:()=>n(`/capabilities/connectors?setup=${encodeURIComponent(e.domain)}`),children:R(`discover.setUp`)}):null})}var Ge={skills:4,connections:5};function Ke(){let{space:e}=r(),t=n(),i=x(),a=L(`skills`),o=L(`unsetConnectors`),[s,c]=A(),l=s.get(`tab`)===`discover`?`discover`:`space`,[u,d,f]=ze(),p=e?.id??``,m=me(a?e?.id:void 0),h=Te(p),_=Se(p);if(!e)return null;let v=t&&!e.readOnly,y=u.trim().toLowerCase(),b=m.data?.skills??[],S=h.data?.connections??[],w=b.filter(e=>e.mode!==`off`).sort((e,t)=>e.mode===t.mode?0:e.mode===`always`?-1:1),T=y?b.filter(e=>e.name.includes(y)||e.description.toLowerCase().includes(y)):w,E=y?S.filter(e=>`${e.name} ${e.connector?.name??e.connectorId}`.toLowerCase().includes(y)):S,O=be(_.data??[],S,o),j=e=>c(t=>{let n=new URLSearchParams(t);return e===`discover`?n.set(`tab`,`discover`):n.delete(`tab`),n},{replace:!0});return(0,U.jsxs)(`div`,{className:`flex flex-col gap-9 pb-20`,children:[(0,U.jsx)(g,{title:R(`nav.capabilities`),hint:R(`capabilities.overview.hint`),plain:!0,action:(0,U.jsx)(Ye,{entries:[...a&&!m.data?.readOnly?[{icon:V,label:R(`capabilities.overview.addSkill`),hint:R(`capabilities.overview.addSkillHint`),to:`/capabilities/skills`}]:[],...v?[{icon:B,label:R(`capabilities.overview.addConnection`),hint:R(`capabilities.overview.addConnectionHint`),to:`/capabilities/connectors?setup=`}]:[],{icon:Ie,label:R(`capabilities.discover`),hint:R(`capabilities.overview.discoverHint`),to:`/capabilities/overview?tab=discover`}]}),children:(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,U.jsx)(I,{value:l,onChange:j,options:[{id:`space`,label:R(`capabilities.inSpace`)},{id:`discover`,label:R(`capabilities.discover`)}],label:R(`nav.capabilities`)}),(0,U.jsxs)(`form`,{className:`flex h-10 min-w-0 flex-1 basis-60 items-center gap-2 rounded-full border border-input bg-card px-4 focus-within:border-focus focus-within:ring-4 focus-within:ring-focus-glow`,onSubmit:e=>{e.preventDefault(),l===`space`&&y&&!T.length&&!E.length&&j(`discover`)},children:[(0,U.jsx)(D,{className:`size-4 shrink-0 text-ink-3`}),(0,U.jsx)(`input`,{type:`search`,value:u,"aria-label":R(l===`discover`?`discover.searchLabel`:`capabilities.overview.search`),placeholder:R(l===`discover`?`discover.search`:`capabilities.overview.search`),onChange:e=>d(e.target.value),className:`min-w-0 flex-1 bg-transparent text-[0.875rem] text-ink outline-none placeholder:text-ink-4`})]})]})}),(0,U.jsx)(`div`,{className:`flex animate-rise flex-col gap-9`,children:l===`discover`?(0,U.jsx)(Be,{asked:f,onExample:d}):(0,U.jsxs)(U.Fragment,{children:[a?(0,U.jsx)(qe,{icon:V,title:R(`space.skills`),all:b.length,to:`/capabilities/skills`,children:m.error?(0,U.jsx)(`p`,{className:`px-1 text-[0.875rem] text-rose`,children:m.error.message}):T.length?(0,U.jsx)(`div`,{className:`grid gap-2.5 sm:grid-cols-2`,children:T.slice(0,Ge.skills).map(e=>(0,U.jsx)(Je,{skill:e,onOpen:()=>i(`/capabilities/skills?show=k:${e.id}`)},e.id))}):m.isPending?null:(0,U.jsx)(M,{children:(0,U.jsx)(k,{children:y?R(`capabilities.overview.nothing`,{q:u.trim()}):R(`capabilities.overview.noSkills`)})})}):null,(0,U.jsxs)(qe,{icon:B,title:R(`capabilities.connectors`),all:S.length,to:`/capabilities/connectors`,children:[v&&!y?(0,U.jsx)(we,{connections:S,onOpen:e=>i(`/capabilities/connectors?show=${encodeURIComponent(e)}`)}):null,h.error?(0,U.jsx)(`p`,{className:`px-1 text-[0.875rem] text-rose`,children:h.error.message}):E.length?(0,U.jsx)(M,{className:`flex flex-col divide-y divide-border-soft p-0`,children:E.slice(0,Ge.connections).map(e=>(0,U.jsx)(Ee,{connection:e,onOpen:()=>i(`/capabilities/connectors?show=${encodeURIComponent(e.id)}`)},e.id))}):h.isPending?null:(0,U.jsx)(M,{children:(0,U.jsx)(k,{children:y?R(`capabilities.overview.nothing`,{q:u.trim()}):R(`capabilities.overview.noConnections`)})}),O.length&&!y?(0,U.jsxs)(`p`,{className:`px-1 text-[0.8125rem] text-ink-3`,children:[R(`capabilities.connectors.builtin`),`:`,` `,O.map((e,t)=>(0,U.jsxs)(`span`,{children:[t?` · `:null,v&&e.usable?(0,U.jsx)(C,{to:`/capabilities/connectors?setup=${encodeURIComponent(e.id)}`,className:`text-ink-2 hover:text-ink hover:underline`,children:e.name}):(0,U.jsx)(`span`,{className:`text-ink-2`,children:e.name})]},e.id))]}):null]})]})},l)]})}function qe({icon:e,title:t,all:n,to:r,children:i}){return(0,U.jsxs)(`section`,{className:`flex flex-col gap-2.5`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-1`,children:[(0,U.jsxs)(`h3`,{className:`flex items-center gap-2 font-semibold text-[0.9375rem]`,children:[(0,U.jsx)(e,{className:`size-4 text-ember-strong`,"aria-hidden":`true`}),t]}),(0,U.jsxs)(C,{to:r,className:`inline-flex items-center gap-0.5 text-[0.8125rem] text-ink-3 transition hover:text-ink`,children:[R(`capabilities.overview.all`,{n}),(0,U.jsx)(ee,{className:`size-3.5`,"aria-hidden":`true`})]})]}),i]})}function Je({skill:e,onOpen:t}){return(0,U.jsxs)(`button`,{type:`button`,onClick:t,className:`flex min-w-0 flex-col gap-1.5 rounded-xl bg-card px-4 py-3 text-left shadow-soft ring-1 ring-border-soft transition hover:ring-border`,children:[(0,U.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[(0,U.jsx)(`span`,{className:F(`truncate font-medium font-mono text-[0.8125rem]`,e.mode===`off`&&`text-ink-3`),children:e.name}),(0,U.jsx)(P,{tone:e.mode===`always`?`live`:`neutral`,children:R(`skills.mode.${e.mode}`)})]}),(0,U.jsx)(`span`,{className:`line-clamp-2 text-[0.8125rem] text-ink-2`,children:e.description}),(0,U.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 text-[0.75rem] text-ink-3`,children:[(0,U.jsx)(ye,{skill:e}),e.runScripts?R(`capabilities.overview.scripts`):null]})]})}function Ye({entries:e}){let[t,n]=(0,H.useState)(!1),r=(0,H.useRef)(null);return(0,H.useEffect)(()=>{if(!t)return;let e=e=>{r.current?.contains(e.target)||n(!1)},i=e=>e.key===`Escape`&&n(!1);return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,i),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,i)}},[t]),(0,U.jsxs)(`div`,{className:`relative`,ref:r,children:[(0,U.jsxs)(b,{size:`sm`,"aria-haspopup":`menu`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[(0,U.jsx)(Oe,{className:`size-4`}),` `,R(`skills.add`),(0,U.jsx)(N,{className:`-mr-1 size-4`})]}),t?(0,U.jsx)(`div`,{role:`menu`,className:`absolute top-10 right-0 z-50 w-72 animate-rise rounded-xl bg-card p-1.5 shadow-overlay ring-1 ring-border-soft`,children:e.map(e=>(0,U.jsxs)(C,{to:e.to,role:`menuitem`,onClick:()=>n(!1),className:`flex w-full items-start gap-2.5 rounded-lg px-2.5 py-2 text-left transition hover:bg-accent`,children:[(0,U.jsx)(e.icon,{className:`mt-0.5 size-4 shrink-0 text-ink-3`}),(0,U.jsxs)(`span`,{className:`min-w-0`,children:[(0,U.jsx)(`span`,{className:`block font-medium text-[0.875rem]`,children:e.label}),(0,U.jsx)(`span`,{className:`block text-[0.8125rem] text-ink-3`,children:e.hint})]})]},e.to))}):null]})}var K=[`r`,`w`,`x`],Xe=[`guest`,`person`,`role`,`goose`,`wizard`,`plugin`,`agent`],Ze=[`guest`,`person`,`role`,`goose`,`wizard`,`agent`],Qe=[`person`,`role`,`goose`],$e=[`person`,`role`,`agent`],et=[`guest`,`person`,`role`,`wizard`],tt={document:{r:Xe},table:{r:Ze},page:{r:Xe,w:Qe},wizard:{r:$e,x:$e},skill:{r:Ze,x:[`guest`,`person`,`role`,`wizard`,`agent`]},setup:{w:Qe},mount:{r:Ze,w:$e},data:{r:et,w:et},connection:{},mail:{},host:{},sandbox:{}},nt={page:[`w`],setup:[`w`]},q=(e,t,n,r)=>(tt[t][n]?.includes(e)??!1)&&!(e===`role`&&r===`client`&&nt[t]?.includes(n)),rt=[`document`,`page`,`table`,`wizard`,`skill`,`setup`,`data`],it={member:`rights.who.members`,admin:`rights.who.admins`,owner:`rights.who.owners`,client:`rights.who.clients`};function at(e){let t=e.subjectName;switch(e.subjectKind){case`guest`:return{text:R(`rights.who.guests`),many:!0};case`role`:return{text:R(it[e.subjectId??``]??`rights.who.members`),many:!0};case`person`:return{text:t??R(`rights.who.personGone`),many:!1};case`goose`:return{text:t?R(`rights.who.goose`,{name:t}):R(`rights.who.gooseGone`),many:!1};case`wizard`:return{text:e.subjectId===`*`?R(`rights.who.everyWizard`):t===null?R(`rights.who.wizardGone`):R(`rights.who.wizard`,{name:t}),many:!1};case`plugin`:return{text:t?R(`rights.who.plugin`,{name:t}):R(`rights.who.pluginGone`),many:!1};case`agent`:return{text:R(`rights.who.agent`),many:!1}}}var ot={document:`rights.what.all.document`,page:`rights.what.all.page`,table:`rights.what.all.table`,wizard:`rights.what.all.wizard`,skill:`rights.what.all.skill`,mount:`rights.what.all.mount`,data:`rights.what.all.data`},st={document:`rights.what.document`,page:`rights.what.page`,table:`rights.what.table`,wizard:`rights.what.wizard`,skill:`rights.what.skill`,mount:`rights.what.mount`,data:`rights.what.data`},ct={document:`rights.what.gone.document`,page:`rights.what.gone.page`,table:`rights.what.gone.table`,wizard:`rights.what.gone.wizard`,skill:`rights.what.gone.skill`,mount:`rights.what.gone.mount`,data:`rights.what.gone.data`},lt={setup:`rights.what.setup`,connection:`rights.what.connection`,mail:`rights.what.mail`,host:`rights.what.host`,sandbox:`rights.what.sandbox`};function ut(e){let t=e.resourceKind,n=lt[t];if(n)return R(n);if(e.resourceId===`*`)return R(ot[t]);if(e.resourceName===null)return R(ct[t]);let r=t===`page`&&e.folder?`rights.what.folder`:st[t];return R(r,{name:e.resourceName})}var dt={read:`rights.verb.read`,change:`rights.verb.change`,changeGoose:`rights.verb.changeGoose`,see:`rights.verb.see`,seeAi:`rights.verb.seeAi`,start:`rights.verb.start`,startAi:`rights.verb.startAi`,seeStartAi:`rights.verb.seeStartAi`,use:`rights.verb.use`,scripts:`rights.verb.scripts`};function ft(e,t,n,r){let i=e===`agent`||e===`role`&&t===`client`;return{document:{r:`read`},table:{r:`read`},page:{r:`read`,w:e===`goose`?`change`:`changeGoose`},setup:{w:e===`goose`?`change`:`changeGoose`},wizard:{r:i?`see`:`seeAi`,x:i?`start`:`startAi`},skill:{r:`use`,x:`scripts`},mount:{r:`read`,w:`change`},data:{r:`read`,w:`change`}}[n]?.[r]}function pt(e,t){return e.length<2?e[0]??``:`${e.slice(0,-1).join(`, `)} ${R(t)} ${e.at(-1)}`}function J(e,t){let n=e.subjectKind===`role`?e.subjectId:null,r=K.filter(n=>e[n]===t&&q(e.subjectKind,e.resourceKind,n,e.subjectId)).map(t=>ft(e.subjectKind,n,e.resourceKind,t)).filter(e=>!!e);return pt((r.includes(`seeAi`)&&r.includes(`startAi`)?[`seeStartAi`,...r.filter(e=>e!==`seeAi`&&e!==`startAi`)]:r).map(e=>R(dt[e])),t===`deny`?`rights.nor`:`rights.and`)}function Y(e,t=at(e)){let n=ut(e),r=J(e,`allow`),i=J(e,`deny`),a={who:t.text,what:n,n:t.many?2:1};return r&&i?R(`rights.rule.mixed`,{...a,verbs:r,not:i}):r?R(`rights.rule.may`,{...a,verbs:r}):i?R(`rights.rule.mayNot`,{...a,verbs:i}):R(`rights.rule.noEffect`,a)}function mt(e){return[e.resourceKind,e.resourceId,J(e,`allow`),J(e,`deny`)].join(`\0`)}function ht(e){let{text:t}=at(e),n=e.subjectKind===`person`&&e.subjectName||e.subjectKind===`goose`,r=ae===`de`&&(e.subjectKind===`role`||e.subjectKind===`guest`);return n||r?t:t.charAt(0).toLowerCase()+t.slice(1)}function gt(e){let[t,...n]=e;return n.length?Y(t,{text:pt([at(t).text,...n.map(ht)],`rights.and`),many:!0}):Y(t)}var _t={start:`rights.origin.start`,folder:`rights.origin.folder`,mount:`rights.origin.mount`,clients:`rights.origin.clients`,rights:`rights.origin.rights`};function vt(e){return R(_t[e])}function yt(e){let t=encodeURIComponent(e.resourceId);switch(e.origin){case`folder`:return`/space/knowledge?show=p:${t}&audience=1`;case`mount`:return`/space/files?show=m:${t}`;case`clients`:return e.resourceKind===`wizard`?`/space/clients`:`/space/knowledge?show=${e.resourceKind===`table`?`t`:e.resourceKind===`page`?`p`:`f`}:${t}`;default:return null}}var bt=[{kind:`document`,perm:`r`,label:`rights.can.document.r`},{kind:`page`,perm:`r`,label:`rights.can.page.r`},{kind:`table`,perm:`r`,label:`rights.can.table.r`},{kind:`page`,perm:`w`,label:`rights.can.page.w`},{kind:`wizard`,perm:`r`,label:`rights.can.wizard.r`,client:`rights.can.wizard.r.client`},{kind:`wizard`,perm:`x`,label:`rights.can.wizard.x`,client:`rights.can.wizard.x.client`},{kind:`skill`,perm:`r`,label:`rights.can.skill.r`},{kind:`skill`,perm:`x`,label:`rights.can.skill.x`},{kind:`setup`,perm:`w`,label:`rights.can.setup.w`},{kind:`data`,perm:`r`,label:`rights.can.data.r`},{kind:`data`,perm:`w`,label:`rights.can.data.w`}],xt={r:`rights.perm.r`,w:`rights.perm.w`,x:`rights.perm.x`},St={document:`rights.kind.document`,page:`rights.kind.page`,table:`rights.kind.table`,wizard:`rights.kind.wizard`,skill:`rights.kind.skill`,setup:`rights.kind.setup`,data:`rights.kind.data`},Ct=e=>[`rwx-rules`,e],X=(e,t,n,r)=>e.find(e=>e.subjectKind===t.subjectKind&&(e.subjectId??null)===t.subjectId&&e.resourceKind===n&&e.resourceId===r);function wt(){let[e,t]=A(),{space:a}=r(),o=n(),s=L(`clientSpaces`),c=L(`orgSpaces`),l=s&&c,u=j(),d=a?.id??``,f=e.get(`show`),p=f===`ask`||f===`add`?f:null,m=e=>t(e?{show:e}:{},{replace:!0}),v=_({queryKey:Ct(d),queryFn:()=>h.get(`/api/studio/spaces/${d}/rules`),enabled:!!a&&o}),y=_({queryKey:[`rwx-choices`,d],queryFn:()=>h.get(`/api/studio/spaces/${d}/rules/choices`),enabled:!!a&&o&&p!==null}),[x,C]=(0,H.useState)(null),[T,E]=(0,H.useState)(null);if(!(a&&o))return null;let D=v.data?.rules??[],O=a.readOnly,k=async(e,t)=>{E(e),C(null);try{await t(),await u.invalidateQueries({queryKey:Ct(a.id)})}catch(e){C(e.message)}finally{E(null)}},M=`/api/studio/spaces/${a.id}/rules`,N=(e,t,n,r,i)=>{let a=X(D,e,t,n);if(!a)return i?h.post(M,{...e,resourceKind:t,resourceId:n,[r]:i}):Promise.resolve();let o=K.some(e=>e!==r&&a[e]!==null);return i||o?h.patch(`${M}/${a.id}`,{[r]:i}):h.del(`${M}/${a.id}`)};return(0,U.jsxs)(`div`,{className:`flex flex-col gap-9 pb-20`,children:[(0,U.jsx)(g,{title:R(`capabilities.rights`),hint:R(`rights.hint`),action:(0,U.jsxs)(b,{variant:`secondary`,size:`sm`,onClick:()=>m(`ask`),children:[(0,U.jsx)(i,{className:`size-4`}),` `,R(`protocol.ask.title`)]}),plain:!0,children:v.error?(0,U.jsx)(`p`,{className:`text-[0.875rem] text-rose`,children:v.error.message}):v.isPending?(0,U.jsx)(`div`,{className:`flex justify-center py-12`,children:(0,U.jsx)(w,{className:`text-ink-3`})}):(0,U.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,U.jsxs)(`div`,{className:`px-1`,children:[(0,U.jsx)(`h3`,{className:`font-medium text-[0.9375rem] text-ink`,children:R(`rights.start.title`)}),(0,U.jsx)(`p`,{className:`mt-0.5 text-[0.8125rem] text-ink-3`,children:R(`rights.start.hint`)})]}),(0,U.jsx)(`div`,{className:`grid gap-3 lg:grid-cols-2`,children:Tt(l).map(e=>(0,U.jsx)(Et,{group:e,rules:D,locked:O||T!==null,onSet:(t,n,r)=>void k(`${e.id}:${t}:${n}`,()=>N(e.subjects[0],t,`*`,n,r?`allow`:null))},e.id))}),(0,U.jsxs)(`ul`,{className:`flex flex-col gap-1 px-1 text-[0.8125rem] text-ink-3 leading-snug`,children:[(0,U.jsx)(`li`,{children:R(`rights.ai`)}),(0,U.jsx)(`li`,{children:R(`rights.note.goose`)}),(0,U.jsx)(`li`,{children:R(`rights.note.wizard`)})]}),x?(0,U.jsx)(`p`,{className:`px-1 text-[0.875rem] text-rose`,children:x}):null]})}),v.data?(0,U.jsx)(g,{title:R(`rights.exceptions.title`),hint:R(`rights.exceptions.hint`),plain:!0,children:(0,U.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,U.jsx)(kt,{rules:D,locked:O,busy:T,onRemove:e=>void k(e.id,()=>h.del(`${M}/${e.id}`))}),O?null:(0,U.jsx)(`div`,{children:(0,U.jsxs)(b,{variant:`secondary`,size:`sm`,onClick:()=>m(`add`),children:[(0,U.jsx)(Oe,{className:`size-4`}),` `,R(`rights.exceptions.add`)]})})]})}):null,(0,U.jsx)(jt,{spaceId:a.id}),(0,U.jsx)(S,{open:p===`add`,onClose:()=>m(null),wide:!0,title:R(`rights.exceptions.add`),children:(0,U.jsx)(zt,{choices:y.data,rules:D,clients:l,onAdd:async(e,t,n,r,i)=>{await N(e,t,n,r,i),await u.invalidateQueries({queryKey:Ct(a.id)}),m(null)}},String(p===`add`))}),(0,U.jsxs)(S,{open:p===`ask`,onClose:()=>m(null),wide:!0,title:R(`protocol.ask.title`),children:[(0,U.jsx)(`p`,{className:`-mt-2 mb-4 text-[0.875rem] text-ink-3`,children:R(`rights.ask.hint`)}),(0,U.jsx)(Vt,{choices:y.data,spaceId:a.id})]})]})}var Z=e=>({subjectKind:`role`,subjectId:e});function Tt(e){return[{id:`admins`,label:`rights.group.admins`,hint:`rights.group.adminsHint`,subjects:[Z(`admin`),Z(`owner`)],fixed:!0},{id:`members`,label:`rights.group.members`,hint:`rights.group.membersHint`,subjects:[Z(`member`)]},{id:`guests`,label:`rights.group.guests`,hint:`audience.guestsHint`,subjects:[{subjectKind:`guest`,subjectId:null}]},...e?[{id:`clients`,label:`rights.group.clients`,hint:`audience.clientsHint`,subjects:[Z(`client`)]}]:[]]}function Et({group:e,rules:t,locked:n,onSet:r}){let i=e.subjects[0],a=bt.filter(e=>q(i.subjectKind,e.kind,e.perm,i.subjectId)),o=(n,r)=>{let i=e.subjects.map(e=>X(t,e,n,`*`)?.[r]??null);return i.includes(`deny`)?`deny`:i.every(e=>e===`allow`)?`allow`:null};return(0,U.jsxs)(M,{className:`p-3.5 sm:p-4`,children:[(0,U.jsxs)(`div`,{className:`mb-2.5`,children:[(0,U.jsx)(`h4`,{className:`font-medium text-[0.9375rem] text-ink`,children:R(e.label)}),(0,U.jsx)(`p`,{className:`text-[0.8125rem] text-ink-3 leading-snug`,children:R(e.hint)})]}),(0,U.jsx)(`ul`,{className:`flex flex-col divide-y divide-border-soft`,children:a.map(t=>{let i=o(t.kind,t.perm),a=R(e.id===`clients`&&t.client?t.client:t.label);return(0,U.jsxs)(`li`,{className:`flex min-h-11 items-center justify-between gap-3 py-1.5`,children:[(0,U.jsx)(`span`,{className:F(`min-w-0 text-[0.875rem] leading-snug`,i===`allow`?`text-ink`:`text-ink-3`),children:a}),(0,U.jsxs)(`span`,{className:`flex shrink-0 items-center gap-2`,children:[i===`deny`?(0,U.jsx)(P,{tone:`warn`,title:R(`rights.neverHint`),children:R(`rights.never`)}):null,e.fixed?i===`allow`?(0,U.jsx)(ke,{className:`size-4 text-moss`,"aria-hidden":!0}):(0,U.jsx)(Ne,{className:`size-4 text-ink-4`,"aria-hidden":!0}):(0,U.jsx)(te,{checked:i===`allow`,disabled:n,onChange:e=>r(t.kind,t.perm,e),label:`${R(e.label)}: ${a}`})]})]},`${t.kind}:${t.perm}`)})})]})}var Dt=[`rights`,`folder`,`clients`,`mount`,`start`];function Ot(e){let t=e=>`${e.r}|${e.w}|${e.x}`,n=new Map;for(let r of e){if(r.origin===`start`)continue;if(r.subjectKind===`role`&&r.subjectId===`owner`){let n=X(e,Z(`admin`),r.resourceKind,r.resourceId);if(n&&t(n)===t(r))continue}let i=r.origin===`rights`?r.id:`${r.origin}\u0000${mt(r)}`;n.set(i,[...n.get(i)??[],r])}return[...n.values()].map(e=>({rules:e,sentence:gt(e)})).sort((e,t)=>Dt.indexOf(e.rules[0].origin)-Dt.indexOf(t.rules[0].origin)||e.sentence.localeCompare(t.sentence))}function kt({rules:e,locked:t,busy:n,onRemove:r}){let i=Ot(e);return i.length?(0,U.jsx)(`ul`,{className:`flex flex-col gap-2`,children:i.map(({rules:[e],sentence:i})=>{let a=yt(e);return(0,U.jsxs)(`li`,{className:`flex flex-col gap-2.5 rounded-xl bg-card px-3.5 py-3 ring-1 ring-border-soft sm:flex-row sm:items-center sm:justify-between sm:gap-4`,children:[(0,U.jsxs)(`span`,{className:`grid min-w-0 gap-0.5`,children:[(0,U.jsx)(`span`,{className:`text-[0.9375rem] text-ink leading-snug`,children:i}),(0,U.jsx)(`span`,{className:`text-[0.8125rem] text-ink-3 leading-snug`,children:vt(e.origin)})]}),(0,U.jsx)(`span`,{className:`shrink-0`,children:a?(0,U.jsx)(At,{to:a,children:R(`rights.exceptions.change`)}):t?null:(0,U.jsx)(b,{variant:`quiet`,size:`sm`,busy:n===e.id,disabled:n!==null,onClick:()=>r(e),children:R(`rights.exceptions.remove`)})})]},e.id)})}):(0,U.jsx)(`p`,{className:`px-1 py-4 text-[0.9375rem] text-ink-3`,children:R(`rights.exceptions.empty`)})}function At({to:e,onPaper:t,children:n}){return(0,U.jsx)(C,{to:e,className:F(`inline-flex h-8 items-center rounded-full px-3 font-medium text-[0.8125rem] text-ink transition coarse:h-11 coarse:px-4`,t?`bg-card ring-1 ring-border-soft hover:bg-paper`:`bg-paper-2 hover:bg-paper-3`),children:n})}function jt({spaceId:e}){let t=Te(e).data?.connections,n=t?.filter(Ce).length??0;return(0,U.jsxs)(M,{className:`flex flex-col gap-3 p-3.5 sm:flex-row sm:items-center sm:justify-between sm:gap-4 sm:p-4`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,U.jsx)(B,{className:`mt-0.5 size-4 shrink-0 text-ink-3`}),(0,U.jsxs)(`div`,{className:`grid min-w-0 gap-0.5`,children:[(0,U.jsx)(`h3`,{className:`font-medium text-[0.9375rem] text-ink`,children:R(`rights.connections.title`)}),(0,U.jsxs)(`p`,{className:`text-[0.8125rem] text-ink-3 leading-snug`,children:[R(`rights.connections.hint`),` `,t===void 0?``:t.length===0?R(`rights.connections.none`):`${R(`rights.connections.count`,{n:t.length})} ${n?R(`rights.connections.guests`,{n}):R(`rights.connections.noGuests`)}`]})]})]}),(0,U.jsx)(`span`,{className:`shrink-0`,children:(0,U.jsx)(At,{to:`/capabilities/connectors`,children:R(`rights.connections.open`)})})]})}function Q({label:e,children:t}){return(0,U.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,U.jsx)(`span`,{className:`font-medium text-[0.8125rem] text-ink-2`,children:e}),t]})}function Mt(){return(0,U.jsx)(`div`,{className:`flex justify-center py-12`,children:(0,U.jsx)(w,{className:`text-ink-3`})})}function Nt(e,t){switch(t){case`document`:return e.documents;case`page`:return e.pages;case`table`:return e.tables;case`wizard`:case`data`:return e.wizards;case`skill`:return e.skills;default:return[]}}function Pt(e,t,n){return{resourceKind:t,resourceId:n,resourceName:Nt(e,t).find(e=>e.id===n)?.name??null,folder:t===`page`&&!!e.pages.find(e=>e.id===n)?.folder}}var Ft=(e,t)=>({r:e===`r`?t:null,w:e===`w`?t:null,x:e===`x`?t:null}),It={members:`role`,guests:`guest`,clients:`role`,person:`person`,goose:`goose`,agent:`agent`,wizard:`wizard`,plugin:`plugin`},Lt={members:`rights.who.members`,guests:`rights.who.guests`,clients:`rights.who.clients`,person:`rights.subject.person`,goose:`rights.subject.goose`,agent:`rights.who.agent`,wizard:`rights.subject.wizard`,plugin:`rights.subject.plugin`},Rt=rt;function zt({choices:e,rules:t,clients:n,onAdd:r}){let[i,a]=(0,H.useState)(``),[o,s]=(0,H.useState)(``),[c,l]=(0,H.useState)(`deny`),[u,d]=(0,H.useState)(``),[f,p]=(0,H.useState)(``),[m,h]=(0,H.useState)(``),[g,_]=(0,H.useState)(!1),[v,y]=(0,H.useState)(null);if(!e)return(0,U.jsx)(Mt,{});let x=i?It[i]:null,S=i===`members`||i===`guests`||i===`clients`,C=i===`person`||i===`goose`?e.people:i===`wizard`?e.wizards:i===`plugin`?e.plugins:null,w=x?i===`members`?Z(`member`):i===`clients`?Z(`client`):C?o?{subjectKind:x,subjectId:o}:null:{subjectKind:x,subjectId:null}:null,E=e=>Rt.filter(t=>x&&q(x,t,e,i===`clients`?`client`:null)&&!(S&&t===`setup`)),D=K.filter(e=>E(e).length>0),O=u?E(u):[],k=f===`setup`?`*`:m,A=!!(w&&u&&f&&k),j=w&&u&&f&&k?{...w,subjectName:C?.find(e=>e.id===w.subjectId)?.name??null,...Pt(e,f,k),...Ft(u,c)}:null,M=w&&f&&k?X(t,w,f,k):null,N=async()=>{if(w&&u&&f&&k){_(!0),y(null);try{await r(w,f,k,u,c)}catch(e){y(e.message),_(!1)}}};return(0,U.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,U.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,U.jsx)(Q,{label:R(`rights.add.who`),children:(0,U.jsx)(T,{value:i,onChange:e=>{a(e),s(``),d(``),p(``),h(``)},placeholder:R(`protocol.ask.choose`),options:Object.keys(It).filter(e=>n||e!==`clients`).map(e=>({value:e,label:R(Lt[e])}))})}),C?(0,U.jsx)(Q,{label:R(i===`goose`?`rights.add.whom`:`rights.add.which`),children:(0,U.jsx)(T,{value:o,onChange:s,placeholder:R(`protocol.ask.choose`),options:[...i===`wizard`?[{value:`*`,label:R(`rights.who.everyWizard`)}]:[],...C.map(e=>({value:e.id,label:e.name}))]})}):null,(0,U.jsx)(`div`,{className:`sm:col-span-2`,children:(0,U.jsx)(I,{value:c,onChange:l,label:R(`rights.add.allow`),options:[{id:`deny`,label:R(`rights.add.mayNot`)},{id:`allow`,label:R(`rights.add.may`)}]})}),(0,U.jsx)(Q,{label:R(`rights.add.perm`),children:(0,U.jsx)(T,{value:u,onChange:e=>{d(e),p(``),h(``)},placeholder:R(`protocol.ask.choose`),options:D.map(e=>({value:e,label:R(xt[e])}))})}),(0,U.jsx)(Q,{label:R(`rights.add.kind`),children:(0,U.jsx)(T,{value:f,onChange:e=>{p(e),h(``)},placeholder:R(`protocol.ask.choose`),options:O.map(e=>({value:e,label:R(St[e])}))})}),f&&f!==`setup`?(0,U.jsx)(Q,{label:R(`rights.add.item`),children:(0,U.jsx)(T,{value:m,onChange:h,placeholder:R(`protocol.ask.choose`),options:[...S?[]:[{value:`*`,label:R(`rights.add.every`)}],...Nt(e,f).map(e=>({value:e.id,label:e.name}))]})}):null]}),(0,U.jsx)(`div`,{className:`rounded-xl bg-paper-2 px-4 py-3.5`,children:j?(0,U.jsxs)(`div`,{className:`grid gap-1`,children:[(0,U.jsx)(`p`,{className:`font-medium text-[0.9375rem] text-ink leading-snug`,children:Y(j)}),M?(0,U.jsx)(`p`,{className:`text-[0.8125rem] text-ink-3`,children:R(`rights.add.exists`)}):null]}):(0,U.jsx)(`p`,{className:`text-[0.875rem] text-ink-3`,children:R(S?`rights.add.forAll`:`rights.add.pick`)})}),v?(0,U.jsx)(`p`,{className:`text-[0.875rem] text-rose`,children:v}):null,(0,U.jsx)(`div`,{className:`flex justify-end`,children:(0,U.jsx)(b,{onClick:()=>void N(),disabled:!A,busy:g,children:R(`rights.add.save`)})})]})}var Bt={person:`rights.subject.person`,guest:`rights.subject.guest`,goose:`rights.subject.goose`,agent:`rights.subject.agentFor`,wizard:`rights.subject.wizard`,plugin:`rights.subject.plugin`},$=`guest`;function Vt({choices:e,spaceId:t}){let[n,r]=(0,H.useState)(``),[i,a]=(0,H.useState)(``),[o,s]=(0,H.useState)($),[c,l]=(0,H.useState)(``),[u,d]=(0,H.useState)(``),[f,p]=(0,H.useState)(``),m=n!==``&&n!==`guest`,g=!!(e&&n&&(!m||i)&&c&&u&&(u===`setup`||f)),v=_({queryKey:[`rwx-ask`,t,n,i,o,c,u,f],queryFn:()=>{let e=new URLSearchParams({who:n,resource:u,perm:c});return m&&e.set(`id`,i),n===`wizard`&&o!==$&&e.set(`for`,o),u!==`setup`&&e.set(`resourceId`,f),h.get(`/api/studio/spaces/${t}/rules/ask?${e}`)},enabled:g});if(!e)return(0,U.jsx)(Mt,{});let y=n===`person`||n===`goose`||n===`agent`?e.people:n===`wizard`?e.wizards:n===`plugin`?e.plugins:null,b=e=>rt.filter(t=>n&&q(n,t,e)),x=K.filter(e=>b(e).length>0),S=c?b(c):[],E=y?.find(e=>e.id===i)?.name??``,D=e.people.find(e=>e.id===o)?.name??``,O=n===`guest`?R(`protocol.who.guest`):n===`goose`?R(`rights.who.goose`,{name:E}):n===`agent`?R(`rights.who.agentFor`,{name:E}):n===`wizard`?o===$?R(`rights.who.runGuest`,{name:E}):R(`rights.who.runFor`,{name:E,person:D}):n===`plugin`?R(`rights.who.pluginJob`,{name:E}):E;return(0,U.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,U.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,U.jsx)(Q,{label:R(`rights.add.who`),children:(0,U.jsx)(T,{value:n,onChange:e=>{r(e),a(``),l(``),d(``),p(``)},placeholder:R(`protocol.ask.choose`),options:Object.keys(Bt).map(e=>({value:e,label:R(Bt[e])}))})}),y?(0,U.jsx)(Q,{label:R(n===`goose`||n===`agent`?`rights.add.whom`:`rights.add.which`),children:(0,U.jsx)(T,{value:i,onChange:a,placeholder:R(`protocol.ask.choose`),options:y.map(e=>({value:e.id,label:e.name}))})}):null,n===`wizard`?(0,U.jsx)(Q,{label:R(`rights.ask.runFor`),children:(0,U.jsx)(T,{value:o,onChange:s,options:[{value:$,label:R(`rights.subject.guest`)},...e.people.map(e=>({value:e.id,label:e.name}))]})}):null,(0,U.jsx)(Q,{label:R(`rights.add.perm`),children:(0,U.jsx)(T,{value:c,onChange:e=>{l(e),d(``),p(``)},placeholder:R(`protocol.ask.choose`),options:x.map(e=>({value:e,label:R(xt[e])}))})}),(0,U.jsx)(Q,{label:R(`rights.add.kind`),children:(0,U.jsx)(T,{value:u,onChange:e=>{d(e),p(``)},placeholder:R(`protocol.ask.choose`),options:S.map(e=>({value:e,label:R(St[e])}))})}),u&&u!==`setup`?(0,U.jsx)(Q,{label:R(`rights.add.item`),children:(0,U.jsx)(T,{value:f,onChange:p,placeholder:R(`protocol.ask.choose`),options:Nt(e,u).map(e=>({value:e.id,label:e.name}))})}):null]}),(0,U.jsx)(`div`,{className:`rounded-xl bg-paper-2 px-4 py-3.5`,children:g&&n&&c&&u?v.error?(0,U.jsx)(`p`,{className:`text-[0.875rem] text-rose`,children:v.error.message}):v.data?(0,U.jsx)(Ht,{answer:v.data,job:n===`plugin`,sentence:Y({subjectKind:n,subjectId:m?i:null,subjectName:E||null,...Pt(e,u,u===`setup`?`*`:f),...Ft(c,v.data.ok?`allow`:`deny`)},{text:O,many:!1})}):(0,U.jsx)(w,{className:`size-4 text-ink-3`}):(0,U.jsx)(`p`,{className:`text-[0.875rem] text-ink-3`,children:R(`rights.ask.pick`)})}),(0,U.jsx)(`p`,{className:`text-[0.8125rem] text-ink-3`,children:(0,U.jsx)(C,{to:`/capabilities/protocol?show=ask`,className:`underline underline-offset-2`,children:R(`rights.ask.connections`)})})]})}function Ht({answer:e,sentence:t,job:n}){let r=e.ok?_e:Me,i=e.rule?yt(e.rule):null;return(0,U.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,U.jsx)(r,{className:F(`mt-1 size-4 shrink-0`,e.ok?`text-moss`:`text-rose`)}),(0,U.jsxs)(`div`,{className:`grid min-w-0 gap-1.5`,children:[(0,U.jsx)(`p`,{className:`font-medium text-[0.9375rem] text-ink leading-snug`,children:t}),e.rule?(0,U.jsxs)(`p`,{className:`text-[0.8125rem] text-ink-3 leading-snug`,children:[R(`rights.ask.decided`,{rule:Y(e.rule)}),` `,vt(e.rule.origin)]}):(0,U.jsx)(`p`,{className:`text-[0.8125rem] text-ink-3 leading-snug`,children:R(e.ok&&n?`rights.ask.runtime`:`rights.ask.noRule`)}),i?(0,U.jsx)(`div`,{children:(0,U.jsx)(At,{to:i,onPaper:!0,children:R(`rights.exceptions.change`)})}):null]})]})}var Ut=(0,H.lazy)(()=>Pe(()=>import(`./SkillEditor-Ca_bzmjD.js`).then(e=>({default:e.SkillEditor})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18])));function Wt(){let[e,t]=A(),{space:n}=r(),i=s(),{narrow:a}=fe(),o=e.get(`show`),c=o?.startsWith(`k:`)?o:null,d=me(n?.id),p=l(`skills`,i).filter(e=>e.plugin);ce(d.data?.skills.find(e=>`k:${e.id}`===c)?.name??null),(0,H.useEffect)(()=>{a||u().scrollTo({top:0})},[a,c]);let m=e=>a?t({show:e}):t(e===`all`?{}:{show:e},{replace:!0});return(0,U.jsx)(U.Fragment,{children:n?(0,U.jsx)(`div`,{className:`flex flex-col gap-9 pb-20`,children:c?(0,U.jsx)(H.Suspense,{fallback:null,children:(0,U.jsx)(Ut,{skillId:c.slice(2),onGone:()=>m(`all`),onOpen:m,filesFirst:!0},c)}):d.data?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(ve,{spaceId:n.id,data:d.data,onOpen:m,heading:R(`capabilities.inSpace`)}),p.flatMap(e=>e.sections).map(e=>i.spaceSections.find(t=>t.id===e.id)).filter(e=>e!==void 0).map(e=>(0,U.jsx)(y,{id:e.id,children:(0,U.jsx)(g,{title:e.label(),hint:e.hint?.(),plain:!0,children:(0,U.jsx)(f,{of:e,children:(0,U.jsx)(e.component,{})})})},e.serial))]}):d.error?(0,U.jsx)(`p`,{className:`text-[0.875rem] text-rose`,children:d.error.message}):null}):null})}var Gt=[{id:`overview`,label:`capabilities.overview`,icon:d,element:Ke,menu:!1},{id:`skills`,label:`space.skills`,icon:V,element:Wt,feature:`skills`,menu:!1},{id:`connectors`,label:`capabilities.connectors`,icon:B,element:xe,menu:!1},{id:`protocol`,label:`capabilities.protocol`,icon:O,element:je,menu:!1},{id:`rights`,label:`capabilities.rights`,icon:o,element:wt,feature:`broker`,admins:!0,menu:!1}];function Kt(e,t){return Gt.filter(n=>n.element&&(!n.feature||e(n.feature))&&(!n.admins||t))}function qt(){let[e,t]=(0,H.useState)(null);return(0,H.useEffect)(()=>{let e=u(),n=()=>t(e.clientHeight);n();let r=new ResizeObserver(n);return r.observe(e),()=>r.disconnect()},[]),e}function Jt(){let e=L(`capabilities`),i=ie(),{section:o}=ne(),[s]=A(),l=x(),u=re(),{space:d,loading:f}=r(),p=le(),[m,h]=(0,H.useState)(null),[g,_]=(0,H.useState)(null),[v,y]=(0,H.useState)(null),b=Kt(e=>t(i,e),n()),S=b.find(e=>e.id===o),C=me(b.some(e=>e.id===`skills`)?d?.id:void 0),w=Te(d?.id??``),T={skills:C.data?.skills.length,connectors:w.data?.connections.length},D=b.map(e=>({id:e.id,label:R(e.label),icon:e.icon,to:e.menu===!1&&p?`/capabilities/${e.id}?show=page`:`/capabilities/${e.id}`,count:T[e.id]})),O=D.find(e=>e.id===S?.id),j=s.get(`show`)||s.has(`setup`)?2:1,M=S&&S.menu!==!1&&v!==S.id?1:0,N=de(M),P=de(j),ee=(0,H.useMemo)(()=>({slot:m,narrow:p,setDetail:_}),[m,p]),te=qt();if(c([{label:R(`nav.capabilities`),to:`/capabilities`},...O?[{label:O.label,to:O.to}]:[],...O&&g?[{label:g}]:[]]),!e)return(0,U.jsx)(E,{to:`/`,replace:!0});if(o===`discover`){let e=new URLSearchParams(u.search);return e.set(`tab`,`discover`),(0,U.jsx)(E,{to:{pathname:`/capabilities/overview`,search:`?${e}`},replace:!0})}if(!S&&b[0])return(0,U.jsx)(E,{to:{pathname:`/capabilities/${b[0].id}`,search:u.search},replace:!0});let I=S?.element;return(0,U.jsx)(se.Provider,{value:ee,children:(0,U.jsx)(`div`,{className:`animate-rise`,children:(0,U.jsxs)(`div`,{className:`grid gap-6 md:grid-cols-[10.5rem_minmax(0,1fr)] md:gap-5 lg:grid-cols-[15rem_minmax(0,1fr)] lg:gap-10`,children:[(0,U.jsxs)(`aside`,{className:F(`menu-scroll min-w-0 md:sticky md:top-6 md:self-start md:overflow-y-auto md:overscroll-contain`,p&&j===2&&`hidden`,p&&P===`back`&&z(`back`)),style:!p&&te?{maxHeight:te-48,paddingBottom:`var(--assistant-dock, 0px)`}:void 0,children:[(0,U.jsx)(ue,{title:R(`nav.capabilities`),open:M===1?O??null:null,onBack:b.length>1?()=>y(S?.id??null):void 0,root:{icon:a,label:R(`nav.capabilities`),onOpen:()=>l(p?`/capabilities/overview?show=page`:`/capabilities/overview`),current:S?.id===`overview`}}),(0,U.jsx)(`div`,{className:F(z(N)),children:M===0?(0,U.jsx)(oe,{entries:D.filter(e=>e.id!==`overview`),current:O,onPick:e=>{y(null),S?.menu===!1&&l(e.to)}}):(0,U.jsx)(`div`,{ref:h})},M)]}),(0,U.jsxs)(`div`,{className:F(`min-w-0`,p&&j<2&&`hidden`,p&&P===`deeper`&&z(`deeper`)),children:[p&&O?(0,U.jsx)(`div`,{className:`mb-3`,children:(0,U.jsx)(pe,{label:O.label,onBack:()=>l(O.to)})}):null,I?(0,U.jsx)(I,{}):null,d||f?null:(0,U.jsx)(k,{children:R(`settings.noSpace`)})]})]})})})}export{Jt as CapabilitiesPage};
|