openclaw-multi-auto 1.3.6 → 1.3.8

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.
Files changed (328) hide show
  1. package/dist/{audio-preflight-5FEeDooz.js → audio-preflight-DDBLZBdb.js} +4 -4
  2. package/dist/{audio-transcription-runner-B-UvoDjZ.js → audio-transcription-runner-DZbSWT9E.js} +1 -1
  3. package/dist/build-info.json +3 -3
  4. package/dist/canvas-host/a2ui/.bundle.hash +1 -1
  5. package/dist/{chrome-D45SyhQL.js → chrome-CMU2WVFh.js} +8 -8
  6. package/dist/{deliver-B9cys0EZ.js → deliver-BXVcFIHL.js} +1 -1
  7. package/dist/{deliver-runtime-DhaQJ0pI.js → deliver-runtime-DTaIS-1i.js} +3 -3
  8. package/dist/{deps-send-whatsapp.runtime-DvTL2tzN.js → deps-send-whatsapp.runtime-CIZqFAqb.js} +7 -7
  9. package/dist/extensionAPI.js +6 -6
  10. package/dist/{image-DAOPwVXi.js → image-BCVLo0qw.js} +1 -1
  11. package/dist/{image-runtime-wlCLVvVv.js → image-runtime-DtCKpMPZ.js} +3 -3
  12. package/dist/{pi-embedded-DYU79yGe.js → pi-embedded-CgQ_W6Xs.js} +24 -24
  13. package/dist/{pi-embedded-helpers-uTRAmQ4n.js → pi-embedded-helpers-CwuBTKza.js} +3 -3
  14. package/dist/plugin-sdk/{accounts-DyFCXtHv.js → accounts-BslAlVYS.js} +2 -2
  15. package/dist/plugin-sdk/{accounts-BJAXxY46.js → accounts-C3m65--E.js} +2 -2
  16. package/dist/plugin-sdk/{accounts-C1j7HSL0.js → accounts-CNCCkdEF.js} +3 -3
  17. package/dist/plugin-sdk/{active-listener-CftX5jLD.js → active-listener-CkPnMUkB.js} +2 -2
  18. package/dist/plugin-sdk/{api-key-rotation-8nyyt1kx.js → api-key-rotation-BXnNsojA.js} +2 -2
  19. package/dist/plugin-sdk/{audio-preflight-C_aSAPR1.js → audio-preflight-CtO4fFvp.js} +26 -26
  20. package/dist/plugin-sdk/{audio-transcription-runner-CB53F7_7.js → audio-transcription-runner-DnxvOS1-.js} +11 -11
  21. package/dist/plugin-sdk/{audit-membership-runtime-BXndI4LG.js → audit-membership-runtime-BpfoSk8M.js} +2 -2
  22. package/dist/plugin-sdk/{channel-activity-C5y8AgAV.js → channel-activity-WJYxcJ3S.js} +3 -3
  23. package/dist/plugin-sdk/{channel-web-DBTRO03V.js → channel-web-dO5k3ubM.js} +18 -18
  24. package/dist/plugin-sdk/{chrome-f00sZkDX.js → chrome-CjNTuJML.js} +6 -6
  25. package/dist/plugin-sdk/{commands-registry-BJ_NxG2F.js → commands-registry-CdYjoI0i.js} +4 -4
  26. package/dist/plugin-sdk/{common-Cf27Jwxu.js → common-oYc5vPFl.js} +2 -2
  27. package/dist/plugin-sdk/{config-CHQrpx-Q.js → config-B1z-UxQ3.js} +7 -7
  28. package/dist/plugin-sdk/{deliver-DNEuetST.js → deliver-D5_6T567.js} +10 -10
  29. package/dist/plugin-sdk/deliver-runtime-C5dgvvga.js +32 -0
  30. package/dist/plugin-sdk/deps-send-discord.runtime-Dg4N7PHJ.js +23 -0
  31. package/dist/plugin-sdk/deps-send-imessage.runtime-0OEwzMQm.js +22 -0
  32. package/dist/plugin-sdk/deps-send-signal.runtime-BM1jRt3G.js +21 -0
  33. package/dist/plugin-sdk/deps-send-slack.runtime-1E3BYRdF.js +19 -0
  34. package/dist/plugin-sdk/deps-send-telegram.runtime-DNCxIflA.js +24 -0
  35. package/dist/plugin-sdk/deps-send-whatsapp.runtime-OLwr-9c8.js +57 -0
  36. package/dist/plugin-sdk/{diagnostic-LYUUmjJ5.js → diagnostic-Bxxu0ig-.js} +2 -2
  37. package/dist/plugin-sdk/{errors-CtMWwS2Z.js → errors-B3cHyZZA.js} +1 -1
  38. package/dist/plugin-sdk/{fetch-guard-CxYB5Kg6.js → fetch-guard-Dcgod0tg.js} +2 -2
  39. package/dist/plugin-sdk/{fs-safe-DtfhxbrI.js → fs-safe-BaKqI3G4.js} +3 -3
  40. package/dist/plugin-sdk/{image-BwjYjRHx.js → image-B2mQW9Rb.js} +6 -6
  41. package/dist/plugin-sdk/{image-ops-BnZKcbd6.js → image-ops-Cbzr4U9l.js} +2 -2
  42. package/dist/plugin-sdk/image-runtime-BFm45j49.js +25 -0
  43. package/dist/plugin-sdk/{ir-Z4hX67TJ.js → ir-ZEmrTr4J.js} +7 -7
  44. package/dist/plugin-sdk/{local-roots-KhjQw04O.js → local-roots-CIPRxA-4.js} +4 -4
  45. package/dist/plugin-sdk/{logger-DHIIvMxj.js → logger-CvPFVOgT.js} +2 -2
  46. package/dist/plugin-sdk/{login-C31642Ld.js → login-CCTew9bt.js} +4 -4
  47. package/dist/plugin-sdk/{login-qr--y2SG_Ue.js → login-qr-BI3Vi_wJ.js} +5 -5
  48. package/dist/plugin-sdk/{manager-2UZBMCc7.js → manager-BEoYPn7R.js} +8 -8
  49. package/dist/plugin-sdk/manager-runtime-DxclHQ4U.js +15 -0
  50. package/dist/plugin-sdk/{outbound-Ba0QUI5h.js → outbound-ByOw1K6W.js} +5 -5
  51. package/dist/plugin-sdk/{outbound-attachment-B1Laso-8.js → outbound-attachment-BzVhxRRw.js} +2 -2
  52. package/dist/plugin-sdk/{path-alias-guards-C7Vm5DZ1.js → path-alias-guards-sWayacde.js} +1 -1
  53. package/dist/plugin-sdk/{paths-DopV9PQG.js → paths-Dpg3qxcl.js} +1 -1
  54. package/dist/plugin-sdk/{pi-embedded-helpers-DnA_OCzP.js → pi-embedded-helpers-DIxXkGJf.js} +16 -16
  55. package/dist/plugin-sdk/{pi-model-discovery-DdPqXk8f.js → pi-model-discovery-DM_2uFtj.js} +1 -1
  56. package/dist/plugin-sdk/pi-model-discovery-runtime-BuzvkvNR.js +8 -0
  57. package/dist/plugin-sdk/{pi-tools.before-tool-call.runtime-DxFHiLUE.js → pi-tools.before-tool-call.runtime-w1dqL_ty.js} +4 -4
  58. package/dist/plugin-sdk/{plugins-CbCt4osF.js → plugins-C4USiH29.js} +4 -4
  59. package/dist/plugin-sdk/{proxy-env-C63mMdas.js → proxy-env-ET-rp8eg.js} +1 -1
  60. package/dist/plugin-sdk/{proxy-fetch-Ch95c_Y2.js → proxy-fetch-uDXGKG3Z.js} +1 -1
  61. package/dist/plugin-sdk/{pw-ai-DpJk62D4.js → pw-ai-CyOt3RDA.js} +9 -9
  62. package/dist/plugin-sdk/{qmd-manager-Ca-iSfEE.js → qmd-manager-BySdoVR7.js} +7 -7
  63. package/dist/plugin-sdk/{query-expansion-B_Xe41Ab.js → query-expansion-C6uS-7lj.js} +4 -4
  64. package/dist/plugin-sdk/{redact-hp9TOulW.js → redact-Bvxt1T_Q.js} +1 -1
  65. package/dist/plugin-sdk/{reply-CovBlFea.js → reply-CTCSeQqW.js} +73 -73
  66. package/dist/plugin-sdk/{resolve-outbound-target-BbrHgyUk.js → resolve-outbound-target-Bw8YNANu.js} +2 -2
  67. package/dist/plugin-sdk/{run-with-concurrency-BR1DXa8T.js → run-with-concurrency-C_KCHwvf.js} +1 -1
  68. package/dist/plugin-sdk/runtime-whatsapp-login.runtime-BxgRDkhc.js +10 -0
  69. package/dist/plugin-sdk/runtime-whatsapp-outbound.runtime-elOqrkfg.js +19 -0
  70. package/dist/plugin-sdk/{send-BvAtLLPl.js → send-BZ6nYFZr.js} +5 -5
  71. package/dist/plugin-sdk/{send-BTztm3D2.js → send-C0w6xP2x.js} +6 -6
  72. package/dist/plugin-sdk/{send-CWJUuG0i.js → send-CFf-1V89.js} +8 -8
  73. package/dist/plugin-sdk/{send-EcglC4cG.js → send-CY-Qfwia.js} +7 -7
  74. package/dist/plugin-sdk/{send-BXpXBwM_.js → send-qPyNGSe4.js} +13 -13
  75. package/dist/plugin-sdk/{session-k256LJZT.js → session-COrvpvUQ.js} +3 -3
  76. package/dist/plugin-sdk/signal.js +2 -2
  77. package/dist/plugin-sdk/{skill-commands-DoRqLzxm.js → skill-commands-DZqhtmiv.js} +4 -4
  78. package/dist/plugin-sdk/{skills-QudILG6e.js → skills-Cw_vXEJb.js} +6 -6
  79. package/dist/plugin-sdk/slash-commands.runtime-D67JLweo.js +13 -0
  80. package/dist/plugin-sdk/slash-dispatch.runtime-DvcpvCJ0.js +52 -0
  81. package/dist/plugin-sdk/slash-skill-commands.runtime-BM1x3azR.js +16 -0
  82. package/dist/plugin-sdk/{store-BbDQw3g6.js → store-CMHj6IIw.js} +2 -2
  83. package/dist/plugin-sdk/subagent-registry-runtime-1lbDyRzz.js +52 -0
  84. package/dist/plugin-sdk/{tables-BhvloMKN.js → tables-CSqrHsKL.js} +1 -1
  85. package/dist/plugin-sdk/{thinking-URzkT-3p.js → thinking-DOnsR_A8.js} +7 -7
  86. package/dist/plugin-sdk/{tokens-B1PW5Ayy.js → tokens-BDr0Z9o3.js} +1 -1
  87. package/dist/plugin-sdk/{tool-images-xpqbP6RR.js → tool-images-eEfOVkzf.js} +2 -2
  88. package/dist/plugin-sdk/web-BLyT64pW.js +56 -0
  89. package/dist/plugin-sdk/{whatsapp-actions-RcZ6vp61.js → whatsapp-actions-xcleMoMv.js} +17 -17
  90. package/dist/plugin-sdk/whatsapp.js +50 -50
  91. package/dist/{pw-ai-GcYO6HPE.js → pw-ai-CmphSzHx.js} +1 -1
  92. package/dist/{slash-dispatch.runtime-Dh053pQK.js → slash-dispatch.runtime-131yup2e.js} +6 -6
  93. package/dist/{subagent-registry-runtime-DSi5mnCQ.js → subagent-registry-runtime-DbSf_Je6.js} +6 -6
  94. package/dist/{web-1hWJDzNA.js → web-MR9d7KyB.js} +6 -6
  95. package/package.json +5 -2
  96. package/scripts/create-instance.sh +44 -19
  97. package/scripts/install-maca.sh +39 -28
  98. package/scripts/npm_publish.sh +8 -6
  99. package/ui/index.html +16 -0
  100. package/ui/node_modules/.bin/jiti +21 -0
  101. package/ui/node_modules/.bin/lessc +21 -0
  102. package/ui/node_modules/.bin/marked +21 -0
  103. package/ui/node_modules/.bin/playwright +21 -0
  104. package/ui/node_modules/.bin/sass +21 -0
  105. package/ui/node_modules/.bin/tsx +21 -0
  106. package/ui/node_modules/.bin/vite +21 -0
  107. package/ui/node_modules/.bin/vitest +21 -0
  108. package/ui/node_modules/.bin/yaml +21 -0
  109. package/ui/package.json +27 -0
  110. package/ui/public/apple-touch-icon.png +0 -0
  111. package/ui/public/favicon-32.png +0 -0
  112. package/ui/public/favicon.ico +0 -0
  113. package/ui/public/favicon.svg +22 -0
  114. package/ui/src/css.d.ts +1 -0
  115. package/ui/src/i18n/index.ts +3 -0
  116. package/ui/src/i18n/lib/lit-controller.ts +22 -0
  117. package/ui/src/i18n/lib/registry.ts +64 -0
  118. package/ui/src/i18n/lib/translate.ts +123 -0
  119. package/ui/src/i18n/lib/types.ts +9 -0
  120. package/ui/src/i18n/locales/de.ts +129 -0
  121. package/ui/src/i18n/locales/en.ts +337 -0
  122. package/ui/src/i18n/locales/pt-BR.ts +128 -0
  123. package/ui/src/i18n/locales/zh-CN.ts +330 -0
  124. package/ui/src/i18n/locales/zh-TW.ts +125 -0
  125. package/ui/src/i18n/test/translate.test.ts +56 -0
  126. package/ui/src/main.ts +2 -0
  127. package/ui/src/styles/base.css +385 -0
  128. package/ui/src/styles/chat/grouped.css +300 -0
  129. package/ui/src/styles/chat/layout.css +481 -0
  130. package/ui/src/styles/chat/sidebar.css +117 -0
  131. package/ui/src/styles/chat/text.css +146 -0
  132. package/ui/src/styles/chat/tool-cards.css +202 -0
  133. package/ui/src/styles/chat.css +5 -0
  134. package/ui/src/styles/components.css +2612 -0
  135. package/ui/src/styles/config.css +1658 -0
  136. package/ui/src/styles/layout.css +621 -0
  137. package/ui/src/styles/layout.mobile.css +374 -0
  138. package/ui/src/styles.css +5 -0
  139. package/ui/src/ui/__screenshots__/config-form.browser.test.ts/config-form-renderer-flags-unsupported-unions-1.png +0 -0
  140. package/ui/src/ui/__screenshots__/config-form.browser.test.ts/config-form-renderer-renders-inputs-and-patches-values-1.png +0 -0
  141. package/ui/src/ui/__screenshots__/config-form.browser.test.ts/config-form-renderer-renders-union-literals-as-select-options-1.png +0 -0
  142. package/ui/src/ui/__screenshots__/navigation.browser.test.ts/control-UI-routing-auto-scrolls-chat-history-to-the-latest-message-1.png +0 -0
  143. package/ui/src/ui/app-channels.ts +279 -0
  144. package/ui/src/ui/app-chat.ts +266 -0
  145. package/ui/src/ui/app-defaults.ts +50 -0
  146. package/ui/src/ui/app-events.ts +5 -0
  147. package/ui/src/ui/app-gateway.node.test.ts +229 -0
  148. package/ui/src/ui/app-gateway.ts +349 -0
  149. package/ui/src/ui/app-lifecycle.node.test.ts +44 -0
  150. package/ui/src/ui/app-lifecycle.ts +109 -0
  151. package/ui/src/ui/app-polling.ts +69 -0
  152. package/ui/src/ui/app-render-usage-tab.ts +273 -0
  153. package/ui/src/ui/app-render.helpers.node.test.ts +286 -0
  154. package/ui/src/ui/app-render.helpers.ts +574 -0
  155. package/ui/src/ui/app-render.ts +1168 -0
  156. package/ui/src/ui/app-scroll.test.ts +275 -0
  157. package/ui/src/ui/app-scroll.ts +179 -0
  158. package/ui/src/ui/app-settings.test.ts +70 -0
  159. package/ui/src/ui/app-settings.ts +440 -0
  160. package/ui/src/ui/app-tool-stream.node.test.ts +139 -0
  161. package/ui/src/ui/app-tool-stream.ts +455 -0
  162. package/ui/src/ui/app-view-state.ts +321 -0
  163. package/ui/src/ui/app.ts +621 -0
  164. package/ui/src/ui/assistant-identity.ts +23 -0
  165. package/ui/src/ui/chat/constants.ts +12 -0
  166. package/ui/src/ui/chat/copy-as-markdown.ts +97 -0
  167. package/ui/src/ui/chat/grouped-render.ts +287 -0
  168. package/ui/src/ui/chat/message-extract.test.ts +64 -0
  169. package/ui/src/ui/chat/message-extract.ts +122 -0
  170. package/ui/src/ui/chat/message-normalizer.test.ts +179 -0
  171. package/ui/src/ui/chat/message-normalizer.ts +101 -0
  172. package/ui/src/ui/chat/tool-cards.ts +156 -0
  173. package/ui/src/ui/chat/tool-helpers.test.ts +141 -0
  174. package/ui/src/ui/chat/tool-helpers.ts +37 -0
  175. package/ui/src/ui/chat-event-reload.test.ts +47 -0
  176. package/ui/src/ui/chat-event-reload.ts +16 -0
  177. package/ui/src/ui/chat-markdown.browser.test.ts +37 -0
  178. package/ui/src/ui/components/resizable-divider.ts +110 -0
  179. package/ui/src/ui/config-form.browser.test.ts +443 -0
  180. package/ui/src/ui/controllers/agent-files.ts +126 -0
  181. package/ui/src/ui/controllers/agent-identity.ts +59 -0
  182. package/ui/src/ui/controllers/agent-skills.ts +33 -0
  183. package/ui/src/ui/controllers/agents.test.ts +61 -0
  184. package/ui/src/ui/controllers/agents.ts +64 -0
  185. package/ui/src/ui/controllers/assistant-identity.ts +34 -0
  186. package/ui/src/ui/controllers/channels.ts +94 -0
  187. package/ui/src/ui/controllers/channels.types.ts +15 -0
  188. package/ui/src/ui/controllers/chat.test.ts +568 -0
  189. package/ui/src/ui/controllers/chat.ts +318 -0
  190. package/ui/src/ui/controllers/config/form-coerce.ts +160 -0
  191. package/ui/src/ui/controllers/config/form-utils.node.test.ts +455 -0
  192. package/ui/src/ui/controllers/config/form-utils.ts +90 -0
  193. package/ui/src/ui/controllers/config.test.ts +289 -0
  194. package/ui/src/ui/controllers/config.ts +219 -0
  195. package/ui/src/ui/controllers/control-ui-bootstrap.test.ts +82 -0
  196. package/ui/src/ui/controllers/control-ui-bootstrap.ts +49 -0
  197. package/ui/src/ui/controllers/cron-filters.test.ts +81 -0
  198. package/ui/src/ui/controllers/cron.test.ts +1070 -0
  199. package/ui/src/ui/controllers/cron.ts +921 -0
  200. package/ui/src/ui/controllers/debug.ts +60 -0
  201. package/ui/src/ui/controllers/devices.ts +159 -0
  202. package/ui/src/ui/controllers/exec-approval.ts +100 -0
  203. package/ui/src/ui/controllers/exec-approvals.ts +170 -0
  204. package/ui/src/ui/controllers/logs.ts +147 -0
  205. package/ui/src/ui/controllers/nodes.ts +32 -0
  206. package/ui/src/ui/controllers/presence.ts +37 -0
  207. package/ui/src/ui/controllers/sessions.test.ts +104 -0
  208. package/ui/src/ui/controllers/sessions.ts +127 -0
  209. package/ui/src/ui/controllers/skills.ts +157 -0
  210. package/ui/src/ui/controllers/usage.node.test.ts +181 -0
  211. package/ui/src/ui/controllers/usage.ts +315 -0
  212. package/ui/src/ui/data/moonshot-kimi-k2.ts +45 -0
  213. package/ui/src/ui/device-auth.ts +73 -0
  214. package/ui/src/ui/device-identity.ts +112 -0
  215. package/ui/src/ui/external-link.test.ts +18 -0
  216. package/ui/src/ui/external-link.ts +19 -0
  217. package/ui/src/ui/focus-mode.browser.test.ts +39 -0
  218. package/ui/src/ui/format.test.ts +101 -0
  219. package/ui/src/ui/format.ts +60 -0
  220. package/ui/src/ui/gateway.ts +360 -0
  221. package/ui/src/ui/icons.ts +256 -0
  222. package/ui/src/ui/markdown.test.ts +85 -0
  223. package/ui/src/ui/markdown.ts +139 -0
  224. package/ui/src/ui/navigation.browser.test.ts +188 -0
  225. package/ui/src/ui/navigation.test.ts +189 -0
  226. package/ui/src/ui/navigation.ts +165 -0
  227. package/ui/src/ui/open-external-url.test.ts +108 -0
  228. package/ui/src/ui/open-external-url.ts +73 -0
  229. package/ui/src/ui/presenter.ts +85 -0
  230. package/ui/src/ui/storage.node.test.ts +63 -0
  231. package/ui/src/ui/storage.ts +99 -0
  232. package/ui/src/ui/test-helpers/app-mount.ts +27 -0
  233. package/ui/src/ui/text-direction.test.ts +24 -0
  234. package/ui/src/ui/text-direction.ts +30 -0
  235. package/ui/src/ui/theme-transition.ts +109 -0
  236. package/ui/src/ui/theme.ts +16 -0
  237. package/ui/src/ui/tool-display.ts +159 -0
  238. package/ui/src/ui/types/chat-types.ts +44 -0
  239. package/ui/src/ui/types.ts +627 -0
  240. package/ui/src/ui/ui-types.ts +54 -0
  241. package/ui/src/ui/usage-helpers.node.test.ts +43 -0
  242. package/ui/src/ui/usage-helpers.ts +321 -0
  243. package/ui/src/ui/usage-types.ts +22 -0
  244. package/ui/src/ui/uuid.test.ts +41 -0
  245. package/ui/src/ui/uuid.ts +57 -0
  246. package/ui/src/ui/views/agents-panels-status-files.ts +461 -0
  247. package/ui/src/ui/views/agents-panels-tools-skills.browser.test.ts +102 -0
  248. package/ui/src/ui/views/agents-panels-tools-skills.ts +537 -0
  249. package/ui/src/ui/views/agents-utils.test.ts +100 -0
  250. package/ui/src/ui/views/agents-utils.ts +502 -0
  251. package/ui/src/ui/views/agents.ts +499 -0
  252. package/ui/src/ui/views/channel-config-extras.ts +49 -0
  253. package/ui/src/ui/views/channels.config.ts +155 -0
  254. package/ui/src/ui/views/channels.discord.ts +65 -0
  255. package/ui/src/ui/views/channels.googlechat.ts +79 -0
  256. package/ui/src/ui/views/channels.imessage.ts +65 -0
  257. package/ui/src/ui/views/channels.nostr-profile-form.ts +321 -0
  258. package/ui/src/ui/views/channels.nostr.ts +237 -0
  259. package/ui/src/ui/views/channels.shared.ts +38 -0
  260. package/ui/src/ui/views/channels.signal.ts +69 -0
  261. package/ui/src/ui/views/channels.slack.ts +65 -0
  262. package/ui/src/ui/views/channels.telegram.ts +120 -0
  263. package/ui/src/ui/views/channels.ts +325 -0
  264. package/ui/src/ui/views/channels.types.ts +62 -0
  265. package/ui/src/ui/views/channels.whatsapp.ts +118 -0
  266. package/ui/src/ui/views/chat-image-open.browser.test.ts +70 -0
  267. package/ui/src/ui/views/chat.test.ts +227 -0
  268. package/ui/src/ui/views/chat.ts +616 -0
  269. package/ui/src/ui/views/config-form.analyze.ts +267 -0
  270. package/ui/src/ui/views/config-form.node.ts +1073 -0
  271. package/ui/src/ui/views/config-form.render.ts +478 -0
  272. package/ui/src/ui/views/config-form.search.node.test.ts +69 -0
  273. package/ui/src/ui/views/config-form.shared.ts +96 -0
  274. package/ui/src/ui/views/config-form.ts +4 -0
  275. package/ui/src/ui/views/config-search.node.test.ts +50 -0
  276. package/ui/src/ui/views/config-search.ts +92 -0
  277. package/ui/src/ui/views/config.browser.test.ts +233 -0
  278. package/ui/src/ui/views/config.ts +820 -0
  279. package/ui/src/ui/views/cron.test.ts +741 -0
  280. package/ui/src/ui/views/cron.ts +1758 -0
  281. package/ui/src/ui/views/debug.ts +151 -0
  282. package/ui/src/ui/views/exec-approval.ts +89 -0
  283. package/ui/src/ui/views/gateway-url-confirmation.ts +40 -0
  284. package/ui/src/ui/views/instances.ts +89 -0
  285. package/ui/src/ui/views/logs.ts +155 -0
  286. package/ui/src/ui/views/markdown-sidebar.ts +40 -0
  287. package/ui/src/ui/views/nodes-exec-approvals.ts +617 -0
  288. package/ui/src/ui/views/nodes-shared.ts +67 -0
  289. package/ui/src/ui/views/nodes.ts +485 -0
  290. package/ui/src/ui/views/overview-hints.ts +16 -0
  291. package/ui/src/ui/views/overview.node.test.ts +39 -0
  292. package/ui/src/ui/views/overview.ts +361 -0
  293. package/ui/src/ui/views/sessions.test.ts +81 -0
  294. package/ui/src/ui/views/sessions.ts +321 -0
  295. package/ui/src/ui/views/skills-grouping.ts +40 -0
  296. package/ui/src/ui/views/skills-shared.ts +52 -0
  297. package/ui/src/ui/views/skills.ts +192 -0
  298. package/ui/src/ui/views/usage-metrics.ts +578 -0
  299. package/ui/src/ui/views/usage-query.ts +277 -0
  300. package/ui/src/ui/views/usage-render-details.test.ts +136 -0
  301. package/ui/src/ui/views/usage-render-details.ts +1083 -0
  302. package/ui/src/ui/views/usage-render-overview.ts +796 -0
  303. package/ui/src/ui/views/usage-styles/usageStyles-part1.ts +701 -0
  304. package/ui/src/ui/views/usage-styles/usageStyles-part2.ts +702 -0
  305. package/ui/src/ui/views/usage-styles/usageStyles-part3.ts +551 -0
  306. package/ui/src/ui/views/usage.ts +836 -0
  307. package/ui/src/ui/views/usageStyles.ts +5 -0
  308. package/ui/src/ui/views/usageTypes.ts +105 -0
  309. package/ui/vite.config.ts +43 -0
  310. package/ui/vitest.config.ts +15 -0
  311. package/ui/vitest.node.config.ts +10 -0
  312. package/dist/plugin-sdk/deliver-runtime-BFdqklJM.js +0 -32
  313. package/dist/plugin-sdk/deps-send-discord.runtime-DuqpYwU0.js +0 -23
  314. package/dist/plugin-sdk/deps-send-imessage.runtime-CZ2rS8Lb.js +0 -22
  315. package/dist/plugin-sdk/deps-send-signal.runtime-BdqiWhIh.js +0 -21
  316. package/dist/plugin-sdk/deps-send-slack.runtime-04s36qiC.js +0 -19
  317. package/dist/plugin-sdk/deps-send-telegram.runtime-LE5tkPvr.js +0 -24
  318. package/dist/plugin-sdk/deps-send-whatsapp.runtime-Bz57lobC.js +0 -57
  319. package/dist/plugin-sdk/image-runtime-B8twoubs.js +0 -25
  320. package/dist/plugin-sdk/manager-runtime-CMeLwose.js +0 -15
  321. package/dist/plugin-sdk/pi-model-discovery-runtime-D8CJhtJY.js +0 -8
  322. package/dist/plugin-sdk/runtime-whatsapp-login.runtime-SkO91TZH.js +0 -10
  323. package/dist/plugin-sdk/runtime-whatsapp-outbound.runtime-B0VWK5hm.js +0 -19
  324. package/dist/plugin-sdk/slash-commands.runtime-DS6vCNSL.js +0 -13
  325. package/dist/plugin-sdk/slash-dispatch.runtime-BXrxb2wd.js +0 -52
  326. package/dist/plugin-sdk/slash-skill-commands.runtime-Bd6qQ2oT.js +0 -16
  327. package/dist/plugin-sdk/subagent-registry-runtime-1uwQbuXj.js +0 -52
  328. package/dist/plugin-sdk/web-B74yhL2N.js +0 -56
@@ -0,0 +1,820 @@
1
+ import { html, nothing } from "lit";
2
+ import type { ConfigUiHints } from "../types.ts";
3
+ import { hintForPath, humanize, schemaType, type JsonSchema } from "./config-form.shared.ts";
4
+ import { analyzeConfigSchema, renderConfigForm, SECTION_META } from "./config-form.ts";
5
+ import { getTagFilters, replaceTagFilters } from "./config-search.ts";
6
+
7
+ export type ConfigProps = {
8
+ raw: string;
9
+ originalRaw: string;
10
+ valid: boolean | null;
11
+ issues: unknown[];
12
+ loading: boolean;
13
+ saving: boolean;
14
+ applying: boolean;
15
+ updating: boolean;
16
+ connected: boolean;
17
+ schema: unknown;
18
+ schemaLoading: boolean;
19
+ uiHints: ConfigUiHints;
20
+ formMode: "form" | "raw";
21
+ formValue: Record<string, unknown> | null;
22
+ originalValue: Record<string, unknown> | null;
23
+ searchQuery: string;
24
+ activeSection: string | null;
25
+ activeSubsection: string | null;
26
+ onRawChange: (next: string) => void;
27
+ onFormModeChange: (mode: "form" | "raw") => void;
28
+ onFormPatch: (path: Array<string | number>, value: unknown) => void;
29
+ onSearchChange: (query: string) => void;
30
+ onSectionChange: (section: string | null) => void;
31
+ onSubsectionChange: (section: string | null) => void;
32
+ onReload: () => void;
33
+ onSave: () => void;
34
+ onApply: () => void;
35
+ onUpdate: () => void;
36
+ };
37
+
38
+ const TAG_SEARCH_PRESETS = [
39
+ "security",
40
+ "auth",
41
+ "network",
42
+ "access",
43
+ "privacy",
44
+ "observability",
45
+ "performance",
46
+ "reliability",
47
+ "storage",
48
+ "models",
49
+ "media",
50
+ "automation",
51
+ "channels",
52
+ "tools",
53
+ "advanced",
54
+ ] as const;
55
+
56
+ // SVG Icons for sidebar (Lucide-style)
57
+ const sidebarIcons = {
58
+ all: html`
59
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
60
+ <rect x="3" y="3" width="7" height="7"></rect>
61
+ <rect x="14" y="3" width="7" height="7"></rect>
62
+ <rect x="14" y="14" width="7" height="7"></rect>
63
+ <rect x="3" y="14" width="7" height="7"></rect>
64
+ </svg>
65
+ `,
66
+ env: html`
67
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
68
+ <circle cx="12" cy="12" r="3"></circle>
69
+ <path
70
+ d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"
71
+ ></path>
72
+ </svg>
73
+ `,
74
+ update: html`
75
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
76
+ <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path>
77
+ <polyline points="7 10 12 15 17 10"></polyline>
78
+ <line x1="12" y1="15" x2="12" y2="3"></line>
79
+ </svg>
80
+ `,
81
+ agents: html`
82
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
83
+ <path
84
+ d="M12 2a2 2 0 0 1 2 2c0 .74-.4 1.39-1 1.73V7h1a7 7 0 0 1 7 7h1a1 1 0 0 1 1 1v3a1 1 0 0 1-1 1h-1v1a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-1H2a1 1 0 0 1-1-1v-3a1 1 0 0 1 1-1h1a7 7 0 0 1 7-7h1V5.73c-.6-.34-1-.99-1-1.73a2 2 0 0 1 2-2z"
85
+ ></path>
86
+ <circle cx="8" cy="14" r="1"></circle>
87
+ <circle cx="16" cy="14" r="1"></circle>
88
+ </svg>
89
+ `,
90
+ auth: html`
91
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
92
+ <rect x="3" y="11" width="18" height="11" rx="2" ry="2"></rect>
93
+ <path d="M7 11V7a5 5 0 0 1 10 0v4"></path>
94
+ </svg>
95
+ `,
96
+ channels: html`
97
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
98
+ <path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"></path>
99
+ </svg>
100
+ `,
101
+ messages: html`
102
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
103
+ <path d="M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z"></path>
104
+ <polyline points="22,6 12,13 2,6"></polyline>
105
+ </svg>
106
+ `,
107
+ commands: html`
108
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
109
+ <polyline points="4 17 10 11 4 5"></polyline>
110
+ <line x1="12" y1="19" x2="20" y2="19"></line>
111
+ </svg>
112
+ `,
113
+ hooks: html`
114
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
115
+ <path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path>
116
+ <path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path>
117
+ </svg>
118
+ `,
119
+ skills: html`
120
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
121
+ <polygon
122
+ points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"
123
+ ></polygon>
124
+ </svg>
125
+ `,
126
+ tools: html`
127
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
128
+ <path
129
+ d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"
130
+ ></path>
131
+ </svg>
132
+ `,
133
+ gateway: html`
134
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
135
+ <circle cx="12" cy="12" r="10"></circle>
136
+ <line x1="2" y1="12" x2="22" y2="12"></line>
137
+ <path
138
+ d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"
139
+ ></path>
140
+ </svg>
141
+ `,
142
+ wizard: html`
143
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
144
+ <path d="M15 4V2"></path>
145
+ <path d="M15 16v-2"></path>
146
+ <path d="M8 9h2"></path>
147
+ <path d="M20 9h2"></path>
148
+ <path d="M17.8 11.8 19 13"></path>
149
+ <path d="M15 9h0"></path>
150
+ <path d="M17.8 6.2 19 5"></path>
151
+ <path d="m3 21 9-9"></path>
152
+ <path d="M12.2 6.2 11 5"></path>
153
+ </svg>
154
+ `,
155
+ // Additional sections
156
+ meta: html`
157
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
158
+ <path d="M12 20h9"></path>
159
+ <path d="M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z"></path>
160
+ </svg>
161
+ `,
162
+ logging: html`
163
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
164
+ <path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path>
165
+ <polyline points="14 2 14 8 20 8"></polyline>
166
+ <line x1="16" y1="13" x2="8" y2="13"></line>
167
+ <line x1="16" y1="17" x2="8" y2="17"></line>
168
+ <polyline points="10 9 9 9 8 9"></polyline>
169
+ </svg>
170
+ `,
171
+ browser: html`
172
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
173
+ <circle cx="12" cy="12" r="10"></circle>
174
+ <circle cx="12" cy="12" r="4"></circle>
175
+ <line x1="21.17" y1="8" x2="12" y2="8"></line>
176
+ <line x1="3.95" y1="6.06" x2="8.54" y2="14"></line>
177
+ <line x1="10.88" y1="21.94" x2="15.46" y2="14"></line>
178
+ </svg>
179
+ `,
180
+ ui: html`
181
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
182
+ <rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect>
183
+ <line x1="3" y1="9" x2="21" y2="9"></line>
184
+ <line x1="9" y1="21" x2="9" y2="9"></line>
185
+ </svg>
186
+ `,
187
+ models: html`
188
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
189
+ <path
190
+ d="M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"
191
+ ></path>
192
+ <polyline points="3.27 6.96 12 12.01 20.73 6.96"></polyline>
193
+ <line x1="12" y1="22.08" x2="12" y2="12"></line>
194
+ </svg>
195
+ `,
196
+ bindings: html`
197
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
198
+ <rect x="2" y="2" width="20" height="8" rx="2" ry="2"></rect>
199
+ <rect x="2" y="14" width="20" height="8" rx="2" ry="2"></rect>
200
+ <line x1="6" y1="6" x2="6.01" y2="6"></line>
201
+ <line x1="6" y1="18" x2="6.01" y2="18"></line>
202
+ </svg>
203
+ `,
204
+ broadcast: html`
205
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
206
+ <path d="M4.9 19.1C1 15.2 1 8.8 4.9 4.9"></path>
207
+ <path d="M7.8 16.2c-2.3-2.3-2.3-6.1 0-8.5"></path>
208
+ <circle cx="12" cy="12" r="2"></circle>
209
+ <path d="M16.2 7.8c2.3 2.3 2.3 6.1 0 8.5"></path>
210
+ <path d="M19.1 4.9C23 8.8 23 15.1 19.1 19"></path>
211
+ </svg>
212
+ `,
213
+ audio: html`
214
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
215
+ <path d="M9 18V5l12-2v13"></path>
216
+ <circle cx="6" cy="18" r="3"></circle>
217
+ <circle cx="18" cy="16" r="3"></circle>
218
+ </svg>
219
+ `,
220
+ session: html`
221
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
222
+ <path d="M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"></path>
223
+ <circle cx="9" cy="7" r="4"></circle>
224
+ <path d="M23 21v-2a4 4 0 0 0-3-3.87"></path>
225
+ <path d="M16 3.13a4 4 0 0 1 0 7.75"></path>
226
+ </svg>
227
+ `,
228
+ cron: html`
229
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
230
+ <circle cx="12" cy="12" r="10"></circle>
231
+ <polyline points="12 6 12 12 16 14"></polyline>
232
+ </svg>
233
+ `,
234
+ web: html`
235
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
236
+ <circle cx="12" cy="12" r="10"></circle>
237
+ <line x1="2" y1="12" x2="22" y2="12"></line>
238
+ <path
239
+ d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"
240
+ ></path>
241
+ </svg>
242
+ `,
243
+ discovery: html`
244
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
245
+ <circle cx="11" cy="11" r="8"></circle>
246
+ <line x1="21" y1="21" x2="16.65" y2="16.65"></line>
247
+ </svg>
248
+ `,
249
+ canvasHost: html`
250
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
251
+ <rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect>
252
+ <circle cx="8.5" cy="8.5" r="1.5"></circle>
253
+ <polyline points="21 15 16 10 5 21"></polyline>
254
+ </svg>
255
+ `,
256
+ talk: html`
257
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
258
+ <path d="M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z"></path>
259
+ <path d="M19 10v2a7 7 0 0 1-14 0v-2"></path>
260
+ <line x1="12" y1="19" x2="12" y2="23"></line>
261
+ <line x1="8" y1="23" x2="16" y2="23"></line>
262
+ </svg>
263
+ `,
264
+ plugins: html`
265
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
266
+ <path d="M12 2v6"></path>
267
+ <path d="m4.93 10.93 4.24 4.24"></path>
268
+ <path d="M2 12h6"></path>
269
+ <path d="m4.93 13.07 4.24-4.24"></path>
270
+ <path d="M12 22v-6"></path>
271
+ <path d="m19.07 13.07-4.24-4.24"></path>
272
+ <path d="M22 12h-6"></path>
273
+ <path d="m19.07 10.93-4.24 4.24"></path>
274
+ </svg>
275
+ `,
276
+ default: html`
277
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
278
+ <path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path>
279
+ <polyline points="14 2 14 8 20 8"></polyline>
280
+ </svg>
281
+ `,
282
+ };
283
+
284
+ // Section definitions
285
+ const SECTIONS: Array<{ key: string; label: string }> = [
286
+ { key: "env", label: "Environment" },
287
+ { key: "update", label: "Updates" },
288
+ { key: "agents", label: "Agents" },
289
+ { key: "auth", label: "Authentication" },
290
+ { key: "channels", label: "Channels" },
291
+ { key: "messages", label: "Messages" },
292
+ { key: "commands", label: "Commands" },
293
+ { key: "hooks", label: "Hooks" },
294
+ { key: "skills", label: "Skills" },
295
+ { key: "tools", label: "Tools" },
296
+ { key: "gateway", label: "Gateway" },
297
+ { key: "wizard", label: "Setup Wizard" },
298
+ ];
299
+
300
+ type SubsectionEntry = {
301
+ key: string;
302
+ label: string;
303
+ description?: string;
304
+ order: number;
305
+ };
306
+
307
+ const ALL_SUBSECTION = "__all__";
308
+
309
+ function getSectionIcon(key: string) {
310
+ return sidebarIcons[key as keyof typeof sidebarIcons] ?? sidebarIcons.default;
311
+ }
312
+
313
+ function resolveSectionMeta(
314
+ key: string,
315
+ schema?: JsonSchema,
316
+ ): {
317
+ label: string;
318
+ description?: string;
319
+ } {
320
+ const meta = SECTION_META[key];
321
+ if (meta) {
322
+ return meta;
323
+ }
324
+ return {
325
+ label: schema?.title ?? humanize(key),
326
+ description: schema?.description ?? "",
327
+ };
328
+ }
329
+
330
+ function resolveSubsections(params: {
331
+ key: string;
332
+ schema: JsonSchema | undefined;
333
+ uiHints: ConfigUiHints;
334
+ }): SubsectionEntry[] {
335
+ const { key, schema, uiHints } = params;
336
+ if (!schema || schemaType(schema) !== "object" || !schema.properties) {
337
+ return [];
338
+ }
339
+ const entries = Object.entries(schema.properties).map(([subKey, node]) => {
340
+ const hint = hintForPath([key, subKey], uiHints);
341
+ const label = hint?.label ?? node.title ?? humanize(subKey);
342
+ const description = hint?.help ?? node.description ?? "";
343
+ const order = hint?.order ?? 50;
344
+ return { key: subKey, label, description, order };
345
+ });
346
+ entries.sort((a, b) => (a.order !== b.order ? a.order - b.order : a.key.localeCompare(b.key)));
347
+ return entries;
348
+ }
349
+
350
+ function computeDiff(
351
+ original: Record<string, unknown> | null,
352
+ current: Record<string, unknown> | null,
353
+ ): Array<{ path: string; from: unknown; to: unknown }> {
354
+ if (!original || !current) {
355
+ return [];
356
+ }
357
+ const changes: Array<{ path: string; from: unknown; to: unknown }> = [];
358
+
359
+ function compare(orig: unknown, curr: unknown, path: string) {
360
+ if (orig === curr) {
361
+ return;
362
+ }
363
+ if (typeof orig !== typeof curr) {
364
+ changes.push({ path, from: orig, to: curr });
365
+ return;
366
+ }
367
+ if (typeof orig !== "object" || orig === null || curr === null) {
368
+ if (orig !== curr) {
369
+ changes.push({ path, from: orig, to: curr });
370
+ }
371
+ return;
372
+ }
373
+ if (Array.isArray(orig) && Array.isArray(curr)) {
374
+ if (JSON.stringify(orig) !== JSON.stringify(curr)) {
375
+ changes.push({ path, from: orig, to: curr });
376
+ }
377
+ return;
378
+ }
379
+ const origObj = orig as Record<string, unknown>;
380
+ const currObj = curr as Record<string, unknown>;
381
+ const allKeys = new Set([...Object.keys(origObj), ...Object.keys(currObj)]);
382
+ for (const key of allKeys) {
383
+ compare(origObj[key], currObj[key], path ? `${path}.${key}` : key);
384
+ }
385
+ }
386
+
387
+ compare(original, current, "");
388
+ return changes;
389
+ }
390
+
391
+ function truncateValue(value: unknown, maxLen = 40): string {
392
+ let str: string;
393
+ try {
394
+ const json = JSON.stringify(value);
395
+ str = json ?? String(value);
396
+ } catch {
397
+ str = String(value);
398
+ }
399
+ if (str.length <= maxLen) {
400
+ return str;
401
+ }
402
+ return str.slice(0, maxLen - 3) + "...";
403
+ }
404
+
405
+ export function renderConfig(props: ConfigProps) {
406
+ const validity = props.valid == null ? "unknown" : props.valid ? "valid" : "invalid";
407
+ const analysis = analyzeConfigSchema(props.schema);
408
+ const formUnsafe = analysis.schema ? analysis.unsupportedPaths.length > 0 : false;
409
+
410
+ // Get available sections from schema
411
+ const schemaProps = analysis.schema?.properties ?? {};
412
+ const availableSections = SECTIONS.filter((s) => s.key in schemaProps);
413
+
414
+ // Add any sections in schema but not in our list
415
+ const knownKeys = new Set(SECTIONS.map((s) => s.key));
416
+ const extraSections = Object.keys(schemaProps)
417
+ .filter((k) => !knownKeys.has(k))
418
+ .map((k) => ({ key: k, label: k.charAt(0).toUpperCase() + k.slice(1) }));
419
+
420
+ const allSections = [...availableSections, ...extraSections];
421
+
422
+ const activeSectionSchema =
423
+ props.activeSection && analysis.schema && schemaType(analysis.schema) === "object"
424
+ ? analysis.schema.properties?.[props.activeSection]
425
+ : undefined;
426
+ const activeSectionMeta = props.activeSection
427
+ ? resolveSectionMeta(props.activeSection, activeSectionSchema)
428
+ : null;
429
+ const subsections = props.activeSection
430
+ ? resolveSubsections({
431
+ key: props.activeSection,
432
+ schema: activeSectionSchema,
433
+ uiHints: props.uiHints,
434
+ })
435
+ : [];
436
+ const allowSubnav =
437
+ props.formMode === "form" && Boolean(props.activeSection) && subsections.length > 0;
438
+ const isAllSubsection = props.activeSubsection === ALL_SUBSECTION;
439
+ const effectiveSubsection = props.searchQuery
440
+ ? null
441
+ : isAllSubsection
442
+ ? null
443
+ : (props.activeSubsection ?? subsections[0]?.key ?? null);
444
+
445
+ // Compute diff for showing changes (works for both form and raw modes)
446
+ const diff = props.formMode === "form" ? computeDiff(props.originalValue, props.formValue) : [];
447
+ const hasRawChanges = props.formMode === "raw" && props.raw !== props.originalRaw;
448
+ const hasChanges = props.formMode === "form" ? diff.length > 0 : hasRawChanges;
449
+
450
+ // Save/apply buttons require actual changes to be enabled.
451
+ // Note: formUnsafe warns about unsupported schema paths but shouldn't block saving.
452
+ const canSaveForm = Boolean(props.formValue) && !props.loading && Boolean(analysis.schema);
453
+ const canSave =
454
+ props.connected &&
455
+ !props.saving &&
456
+ hasChanges &&
457
+ (props.formMode === "raw" ? true : canSaveForm);
458
+ const canApply =
459
+ props.connected &&
460
+ !props.applying &&
461
+ !props.updating &&
462
+ hasChanges &&
463
+ (props.formMode === "raw" ? true : canSaveForm);
464
+ const canUpdate = props.connected && !props.applying && !props.updating;
465
+ const selectedTags = new Set(getTagFilters(props.searchQuery));
466
+
467
+ return html`
468
+ <div class="config-layout">
469
+ <!-- Sidebar -->
470
+ <aside class="config-sidebar">
471
+ <div class="config-sidebar__header">
472
+ <div class="config-sidebar__title">Settings</div>
473
+ <span
474
+ class="pill pill--sm ${
475
+ validity === "valid" ? "pill--ok" : validity === "invalid" ? "pill--danger" : ""
476
+ }"
477
+ >${validity}</span
478
+ >
479
+ </div>
480
+
481
+ <!-- Search -->
482
+ <div class="config-search">
483
+ <div class="config-search__input-row">
484
+ <svg
485
+ class="config-search__icon"
486
+ viewBox="0 0 24 24"
487
+ fill="none"
488
+ stroke="currentColor"
489
+ stroke-width="2"
490
+ >
491
+ <circle cx="11" cy="11" r="8"></circle>
492
+ <path d="M21 21l-4.35-4.35"></path>
493
+ </svg>
494
+ <input
495
+ type="text"
496
+ class="config-search__input"
497
+ placeholder="Search settings..."
498
+ .value=${props.searchQuery}
499
+ @input=${(e: Event) => props.onSearchChange((e.target as HTMLInputElement).value)}
500
+ />
501
+ ${
502
+ props.searchQuery
503
+ ? html`
504
+ <button
505
+ class="config-search__clear"
506
+ @click=${() => props.onSearchChange("")}
507
+ >
508
+ ×
509
+ </button>
510
+ `
511
+ : nothing
512
+ }
513
+ </div>
514
+ <div class="config-search__hint">
515
+ <span class="config-search__hint-label" id="config-tag-filter-label">Tag filters:</span>
516
+ <details class="config-search__tag-picker">
517
+ <summary class="config-search__tag-trigger" aria-labelledby="config-tag-filter-label">
518
+ ${
519
+ selectedTags.size === 0
520
+ ? html`
521
+ <span class="config-search__tag-placeholder">Add tags</span>
522
+ `
523
+ : html`
524
+ <div class="config-search__tag-chips">
525
+ ${Array.from(selectedTags)
526
+ .slice(0, 2)
527
+ .map(
528
+ (tag) =>
529
+ html`<span class="config-search__tag-chip">tag:${tag}</span>`,
530
+ )}
531
+ ${
532
+ selectedTags.size > 2
533
+ ? html`
534
+ <span class="config-search__tag-chip config-search__tag-chip--count"
535
+ >+${selectedTags.size - 2}</span
536
+ >
537
+ `
538
+ : nothing
539
+ }
540
+ </div>
541
+ `
542
+ }
543
+ <span class="config-search__tag-caret" aria-hidden="true">▾</span>
544
+ </summary>
545
+ <div class="config-search__tag-menu">
546
+ ${TAG_SEARCH_PRESETS.map((tag) => {
547
+ const active = selectedTags.has(tag);
548
+ return html`
549
+ <button
550
+ type="button"
551
+ class="config-search__tag-option ${active ? "active" : ""}"
552
+ data-tag="${tag}"
553
+ aria-pressed=${active ? "true" : "false"}
554
+ @click=${() => {
555
+ const nextTags = active
556
+ ? Array.from(selectedTags).filter((value) => value !== tag)
557
+ : [...selectedTags, tag];
558
+ props.onSearchChange(replaceTagFilters(props.searchQuery, nextTags));
559
+ }}
560
+ >
561
+ tag:${tag}
562
+ </button>
563
+ `;
564
+ })}
565
+ </div>
566
+ </details>
567
+ </div>
568
+ </div>
569
+
570
+ <!-- Section nav -->
571
+ <nav class="config-nav">
572
+ <button
573
+ class="config-nav__item ${props.activeSection === null ? "active" : ""}"
574
+ @click=${() => props.onSectionChange(null)}
575
+ >
576
+ <span class="config-nav__icon">${sidebarIcons.all}</span>
577
+ <span class="config-nav__label">All Settings</span>
578
+ </button>
579
+ ${allSections.map(
580
+ (section) => html`
581
+ <button
582
+ class="config-nav__item ${props.activeSection === section.key ? "active" : ""}"
583
+ @click=${() => props.onSectionChange(section.key)}
584
+ >
585
+ <span class="config-nav__icon"
586
+ >${getSectionIcon(section.key)}</span
587
+ >
588
+ <span class="config-nav__label">${section.label}</span>
589
+ </button>
590
+ `,
591
+ )}
592
+ </nav>
593
+
594
+ <!-- Mode toggle at bottom -->
595
+ <div class="config-sidebar__footer">
596
+ <div class="config-mode-toggle">
597
+ <button
598
+ class="config-mode-toggle__btn ${props.formMode === "form" ? "active" : ""}"
599
+ ?disabled=${props.schemaLoading || !props.schema}
600
+ @click=${() => props.onFormModeChange("form")}
601
+ >
602
+ Form
603
+ </button>
604
+ <button
605
+ class="config-mode-toggle__btn ${props.formMode === "raw" ? "active" : ""}"
606
+ @click=${() => props.onFormModeChange("raw")}
607
+ >
608
+ Raw
609
+ </button>
610
+ </div>
611
+ </div>
612
+ </aside>
613
+
614
+ <!-- Main content -->
615
+ <main class="config-main">
616
+ <!-- Action bar -->
617
+ <div class="config-actions">
618
+ <div class="config-actions__left">
619
+ ${
620
+ hasChanges
621
+ ? html`
622
+ <span class="config-changes-badge"
623
+ >${
624
+ props.formMode === "raw"
625
+ ? "Unsaved changes"
626
+ : `${diff.length} unsaved change${diff.length !== 1 ? "s" : ""}`
627
+ }</span
628
+ >
629
+ `
630
+ : html`
631
+ <span class="config-status muted">No changes</span>
632
+ `
633
+ }
634
+ </div>
635
+ <div class="config-actions__right">
636
+ <button
637
+ class="btn btn--sm"
638
+ ?disabled=${props.loading}
639
+ @click=${props.onReload}
640
+ >
641
+ ${props.loading ? "Loading…" : "Reload"}
642
+ </button>
643
+ <button
644
+ class="btn btn--sm primary"
645
+ ?disabled=${!canSave}
646
+ @click=${props.onSave}
647
+ >
648
+ ${props.saving ? "Saving…" : "Save"}
649
+ </button>
650
+ <button
651
+ class="btn btn--sm"
652
+ ?disabled=${!canApply}
653
+ @click=${props.onApply}
654
+ >
655
+ ${props.applying ? "Applying…" : "Apply"}
656
+ </button>
657
+ <button
658
+ class="btn btn--sm"
659
+ ?disabled=${!canUpdate}
660
+ @click=${props.onUpdate}
661
+ >
662
+ ${props.updating ? "Updating…" : "Update"}
663
+ </button>
664
+ </div>
665
+ </div>
666
+
667
+ <!-- Diff panel (form mode only - raw mode doesn't have granular diff) -->
668
+ ${
669
+ hasChanges && props.formMode === "form"
670
+ ? html`
671
+ <details class="config-diff">
672
+ <summary class="config-diff__summary">
673
+ <span
674
+ >View ${diff.length} pending
675
+ change${diff.length !== 1 ? "s" : ""}</span
676
+ >
677
+ <svg
678
+ class="config-diff__chevron"
679
+ viewBox="0 0 24 24"
680
+ fill="none"
681
+ stroke="currentColor"
682
+ stroke-width="2"
683
+ >
684
+ <polyline points="6 9 12 15 18 9"></polyline>
685
+ </svg>
686
+ </summary>
687
+ <div class="config-diff__content">
688
+ ${diff.map(
689
+ (change) => html`
690
+ <div class="config-diff__item">
691
+ <div class="config-diff__path">${change.path}</div>
692
+ <div class="config-diff__values">
693
+ <span class="config-diff__from"
694
+ >${truncateValue(change.from)}</span
695
+ >
696
+ <span class="config-diff__arrow">→</span>
697
+ <span class="config-diff__to"
698
+ >${truncateValue(change.to)}</span
699
+ >
700
+ </div>
701
+ </div>
702
+ `,
703
+ )}
704
+ </div>
705
+ </details>
706
+ `
707
+ : nothing
708
+ }
709
+ ${
710
+ activeSectionMeta && props.formMode === "form"
711
+ ? html`
712
+ <div class="config-section-hero">
713
+ <div class="config-section-hero__icon">
714
+ ${getSectionIcon(props.activeSection ?? "")}
715
+ </div>
716
+ <div class="config-section-hero__text">
717
+ <div class="config-section-hero__title">
718
+ ${activeSectionMeta.label}
719
+ </div>
720
+ ${
721
+ activeSectionMeta.description
722
+ ? html`<div class="config-section-hero__desc">
723
+ ${activeSectionMeta.description}
724
+ </div>`
725
+ : nothing
726
+ }
727
+ </div>
728
+ </div>
729
+ `
730
+ : nothing
731
+ }
732
+ ${
733
+ allowSubnav
734
+ ? html`
735
+ <div class="config-subnav">
736
+ <button
737
+ class="config-subnav__item ${effectiveSubsection === null ? "active" : ""}"
738
+ @click=${() => props.onSubsectionChange(ALL_SUBSECTION)}
739
+ >
740
+ All
741
+ </button>
742
+ ${subsections.map(
743
+ (entry) => html`
744
+ <button
745
+ class="config-subnav__item ${
746
+ effectiveSubsection === entry.key ? "active" : ""
747
+ }"
748
+ title=${entry.description || entry.label}
749
+ @click=${() => props.onSubsectionChange(entry.key)}
750
+ >
751
+ ${entry.label}
752
+ </button>
753
+ `,
754
+ )}
755
+ </div>
756
+ `
757
+ : nothing
758
+ }
759
+
760
+ <!-- Form content -->
761
+ <div class="config-content">
762
+ ${
763
+ props.formMode === "form"
764
+ ? html`
765
+ ${
766
+ props.schemaLoading
767
+ ? html`
768
+ <div class="config-loading">
769
+ <div class="config-loading__spinner"></div>
770
+ <span>Loading schema…</span>
771
+ </div>
772
+ `
773
+ : renderConfigForm({
774
+ schema: analysis.schema,
775
+ uiHints: props.uiHints,
776
+ value: props.formValue,
777
+ disabled: props.loading || !props.formValue,
778
+ unsupportedPaths: analysis.unsupportedPaths,
779
+ onPatch: props.onFormPatch,
780
+ searchQuery: props.searchQuery,
781
+ activeSection: props.activeSection,
782
+ activeSubsection: effectiveSubsection,
783
+ })
784
+ }
785
+ ${
786
+ formUnsafe
787
+ ? html`
788
+ <div class="callout danger" style="margin-top: 12px">
789
+ Form view can't safely edit some fields. Use Raw to avoid losing config entries.
790
+ </div>
791
+ `
792
+ : nothing
793
+ }
794
+ `
795
+ : html`
796
+ <label class="field config-raw-field">
797
+ <span>Raw JSON5</span>
798
+ <textarea
799
+ .value=${props.raw}
800
+ @input=${(e: Event) =>
801
+ props.onRawChange((e.target as HTMLTextAreaElement).value)}
802
+ ></textarea>
803
+ </label>
804
+ `
805
+ }
806
+ </div>
807
+
808
+ ${
809
+ props.issues.length > 0
810
+ ? html`<div class="callout danger" style="margin-top: 12px;">
811
+ <pre class="code-block">
812
+ ${JSON.stringify(props.issues, null, 2)}</pre
813
+ >
814
+ </div>`
815
+ : nothing
816
+ }
817
+ </main>
818
+ </div>
819
+ `;
820
+ }