micro-models-agent 2.16.1 → 2.17.2

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 (428) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/README.md +8 -3
  3. package/dist/assets/app.js +1 -314
  4. package/dist/assets/hljs.js +5 -1244
  5. package/dist/assets/index.html +11 -0
  6. package/dist/assets/js/api.js +1 -28
  7. package/dist/assets/js/core/menus.js +1 -0
  8. package/dist/assets/js/core/store/feed.js +1 -0
  9. package/dist/assets/js/core/store/index.js +1 -0
  10. package/dist/assets/js/core/store/session.js +1 -0
  11. package/dist/assets/js/core/store/settings.js +1 -0
  12. package/dist/assets/js/core/store/tabs.js +1 -0
  13. package/dist/assets/js/dialog.js +1 -105
  14. package/dist/assets/js/dom.js +1 -178
  15. package/dist/assets/js/feed/core.js +1 -0
  16. package/dist/assets/js/feed/history.js +1 -0
  17. package/dist/assets/js/feed/plan.js +1 -0
  18. package/dist/assets/js/feed/question.js +3 -0
  19. package/dist/assets/js/feed/sidebar.js +1 -0
  20. package/dist/assets/js/feed/stream.js +1 -0
  21. package/dist/assets/js/feed/turn.js +5 -0
  22. package/dist/assets/js/feed.js +1 -1250
  23. package/dist/assets/js/format.js +2 -122
  24. package/dist/assets/js/i18n.js +1 -46
  25. package/dist/assets/js/rail.js +1 -114
  26. package/dist/assets/js/session/cmdk.js +1 -0
  27. package/dist/assets/js/session/composer.js +1 -0
  28. package/dist/assets/js/session/sessions-menu.js +1 -0
  29. package/dist/assets/js/session/tabs.js +1 -0
  30. package/dist/assets/js/settings/controls.js +1 -0
  31. package/dist/assets/js/settings/editors.js +1 -0
  32. package/dist/assets/js/settings/form.js +1 -0
  33. package/dist/assets/js/settings/modal.js +1 -0
  34. package/dist/assets/js/settings/panels.js +1 -0
  35. package/dist/assets/js/settings/providers.js +1 -0
  36. package/dist/assets/js/settings/search.js +1 -0
  37. package/dist/assets/js/settings/subdialog.js +1 -0
  38. package/dist/assets/js/settings/write.js +1 -0
  39. package/dist/assets/js/settings.js +1 -1914
  40. package/dist/assets/js/sidebar/core.js +1 -0
  41. package/dist/assets/js/sidebar/lsp.js +2 -0
  42. package/dist/assets/js/sidebar/map.js +1 -0
  43. package/dist/assets/js/sidebar/state.js +1 -0
  44. package/dist/assets/js/sidebar/trace.js +5 -0
  45. package/dist/assets/js/sidebar.js +1 -705
  46. package/dist/assets/js/store.js +1 -82
  47. package/dist/assets/js/subdialog.js +1 -0
  48. package/dist/assets/md.js +1 -291
  49. package/dist/assets/setup.js +3 -816
  50. package/dist/assets/smd.js +29 -1665
  51. package/dist/assets/styles.css +1 -1598
  52. package/dist/certification/certifications.json +1 -494
  53. package/dist/i18n/en.json +1 -1851
  54. package/dist/i18n/ru.json +1 -1854
  55. package/dist/main.js +815 -55797
  56. package/dist/modules/browser/bridge-server.mjs +2 -252
  57. package/package.json +10 -5
  58. package/dist/assets/js/settings-controls.js +0 -452
  59. package/dist/assets/js/tabs.js +0 -867
  60. package/dist/cli/cache-line.js +0 -31
  61. package/dist/cli/command-suggest.js +0 -39
  62. package/dist/cli/commands.js +0 -781
  63. package/dist/cli/completer.js +0 -268
  64. package/dist/cli/index.js +0 -3
  65. package/dist/cli/json-payload.js +0 -32
  66. package/dist/cli/main.js +0 -346
  67. package/dist/cli/onboarding-commands.js +0 -126
  68. package/dist/cli/plugin-commands.js +0 -38
  69. package/dist/cli/relaunch.js +0 -40
  70. package/dist/cli/repl-commands-lsp.js +0 -75
  71. package/dist/cli/repl-commands-skills.js +0 -105
  72. package/dist/cli/repl-commands.js +0 -1218
  73. package/dist/cli/repl.js +0 -1238
  74. package/dist/cli/run-result.js +0 -38
  75. package/dist/cli/security-commands.js +0 -177
  76. package/dist/cli/setup-order.js +0 -6
  77. package/dist/cli/setup-prompt.js +0 -50
  78. package/dist/cli/setup.js +0 -161
  79. package/dist/cli/web-command.js +0 -98
  80. package/dist/config/budget.js +0 -48
  81. package/dist/config/config.js +0 -345
  82. package/dist/config/defaults.js +0 -197
  83. package/dist/config/domains.js +0 -135
  84. package/dist/config/env.js +0 -46
  85. package/dist/config/experts.js +0 -17
  86. package/dist/config/index.js +0 -5
  87. package/dist/config/paths.js +0 -56
  88. package/dist/config/redact.js +0 -44
  89. package/dist/config/registry-extra.js +0 -334
  90. package/dist/config/registry.js +0 -584
  91. package/dist/config/security.js +0 -212
  92. package/dist/config/timeouts.js +0 -74
  93. package/dist/config/types.js +0 -1
  94. package/dist/config/utils.js +0 -57
  95. package/dist/core/agent/artifact-progress.js +0 -59
  96. package/dist/core/agent/artifact-resolve.js +0 -79
  97. package/dist/core/agent/audit-gate.js +0 -53
  98. package/dist/core/agent/compaction.js +0 -89
  99. package/dist/core/agent/constants.js +0 -90
  100. package/dist/core/agent/context-log.js +0 -454
  101. package/dist/core/agent/context-renderer.js +0 -45
  102. package/dist/core/agent/critic-gate.js +0 -132
  103. package/dist/core/agent/hallucination-gate.js +0 -197
  104. package/dist/core/agent/loop-state.js +0 -68
  105. package/dist/core/agent/prefix-monitor.js +0 -101
  106. package/dist/core/agent/reasoning-resolver.js +0 -65
  107. package/dist/core/agent/token-tracker.js +0 -99
  108. package/dist/core/agent/tool-batch.js +0 -312
  109. package/dist/core/agent/tool-images.js +0 -18
  110. package/dist/core/agent/tool-output.js +0 -116
  111. package/dist/core/agent/tool-pairing.js +0 -60
  112. package/dist/core/agent-moe.js +0 -248
  113. package/dist/core/agent.js +0 -1299
  114. package/dist/core/bootstrap/agent-phase.js +0 -66
  115. package/dist/core/bootstrap/config-phase.js +0 -86
  116. package/dist/core/bootstrap/modules-phase.js +0 -269
  117. package/dist/core/bootstrap/provider-phase.js +0 -183
  118. package/dist/core/bootstrap/session-phase.js +0 -204
  119. package/dist/core/bootstrap/state.js +0 -94
  120. package/dist/core/bootstrap/workspace-phase.js +0 -115
  121. package/dist/core/bootstrap.js +0 -112
  122. package/dist/core/crash-handler.js +0 -62
  123. package/dist/core/environment.js +0 -224
  124. package/dist/core/host-plan.js +0 -43
  125. package/dist/core/host.js +0 -23
  126. package/dist/core/index.js +0 -3
  127. package/dist/core/prompt-builder.js +0 -95
  128. package/dist/core/prompt-overflow.js +0 -306
  129. package/dist/core/session-logger.js +0 -375
  130. package/dist/core/system-prompt.js +0 -117
  131. package/dist/core/types.js +0 -1
  132. package/dist/core/version.js +0 -28
  133. package/dist/core/web-host.js +0 -34
  134. package/dist/core/workspace.js +0 -80
  135. package/dist/i18n/index.js +0 -80
  136. package/dist/index.js +0 -30
  137. package/dist/llm/cache-usage.js +0 -76
  138. package/dist/llm/image-utils.js +0 -138
  139. package/dist/llm/index.js +0 -4
  140. package/dist/llm/llm-errors.js +0 -50
  141. package/dist/llm/model-loader.js +0 -86
  142. package/dist/llm/models-dev.js +0 -121
  143. package/dist/llm/openai-compat.js +0 -756
  144. package/dist/llm/orchestrator.js +0 -294
  145. package/dist/llm/provider-budget.js +0 -68
  146. package/dist/llm/provider-context.js +0 -233
  147. package/dist/llm/provider.js +0 -9
  148. package/dist/llm/response.js +0 -44
  149. package/dist/llm/stream-state.js +0 -26
  150. package/dist/llm/token-counter.js +0 -83
  151. package/dist/llm/types.js +0 -1
  152. package/dist/logger/app-logger.js +0 -212
  153. package/dist/logger/file-log.js +0 -160
  154. package/dist/logger/index.js +0 -2
  155. package/dist/migration/backup.js +0 -56
  156. package/dist/migration/detect.js +0 -61
  157. package/dist/migration/index.js +0 -3
  158. package/dist/modules/artifacts/store.js +0 -62
  159. package/dist/modules/browser/actions.js +0 -79
  160. package/dist/modules/browser/bridge-client.js +0 -203
  161. package/dist/modules/browser/bridge-path.js +0 -10
  162. package/dist/modules/browser/console-buffer.js +0 -37
  163. package/dist/modules/browser/cookie-store.js +0 -29
  164. package/dist/modules/browser/driver-types.js +0 -1
  165. package/dist/modules/browser/driver.js +0 -186
  166. package/dist/modules/browser/index.js +0 -9
  167. package/dist/modules/browser/module.js +0 -30
  168. package/dist/modules/browser/session.js +0 -322
  169. package/dist/modules/browser/snapshot.js +0 -154
  170. package/dist/modules/browser/types.js +0 -13
  171. package/dist/modules/certification/cli.js +0 -264
  172. package/dist/modules/certification/fact-checker.js +0 -90
  173. package/dist/modules/certification/loader.js +0 -127
  174. package/dist/modules/certification/manifest.js +0 -231
  175. package/dist/modules/certification/runner.js +0 -233
  176. package/dist/modules/certification/scenarios.js +0 -586
  177. package/dist/modules/certification/syntax-scenarios.js +0 -50
  178. package/dist/modules/certification/types.js +0 -1
  179. package/dist/modules/context/chunk-query.js +0 -122
  180. package/dist/modules/context/fact-extractor.js +0 -170
  181. package/dist/modules/context/history.js +0 -15
  182. package/dist/modules/context/index.js +0 -2
  183. package/dist/modules/context/manager.js +0 -482
  184. package/dist/modules/critic/client.js +0 -176
  185. package/dist/modules/critic/evidence.js +0 -81
  186. package/dist/modules/critic/provider.js +0 -45
  187. package/dist/modules/critic/tools.js +0 -78
  188. package/dist/modules/critic/types.js +0 -1
  189. package/dist/modules/execution/audit-runners.js +0 -206
  190. package/dist/modules/execution/auditor.js +0 -222
  191. package/dist/modules/execution/execution-plugin.js +0 -478
  192. package/dist/modules/execution/index.js +0 -8
  193. package/dist/modules/execution/input-from.js +0 -70
  194. package/dist/modules/execution/module.js +0 -891
  195. package/dist/modules/execution/moe-executor.js +0 -443
  196. package/dist/modules/execution/plan-actions.js +0 -642
  197. package/dist/modules/execution/plan-checks.js +0 -35
  198. package/dist/modules/execution/plan-coverage.js +0 -71
  199. package/dist/modules/execution/plan-persister.js +0 -46
  200. package/dist/modules/execution/plan-steps.js +0 -31
  201. package/dist/modules/execution/plan-store.js +0 -274
  202. package/dist/modules/execution/plan-tool.js +0 -249
  203. package/dist/modules/execution/plan-validator.js +0 -197
  204. package/dist/modules/execution/planner.js +0 -103
  205. package/dist/modules/execution/stuck-detector.js +0 -834
  206. package/dist/modules/execution/tracker.js +0 -92
  207. package/dist/modules/execution/transient-error.js +0 -30
  208. package/dist/modules/execution/types.js +0 -1
  209. package/dist/modules/execution/verifier.js +0 -343
  210. package/dist/modules/execution/windows-commands.js +0 -52
  211. package/dist/modules/hallucination/artifact-claim.js +0 -93
  212. package/dist/modules/hallucination/confidence.js +0 -81
  213. package/dist/modules/hallucination/consistency.js +0 -37
  214. package/dist/modules/hallucination/detector.js +0 -57
  215. package/dist/modules/hallucination/factual.js +0 -205
  216. package/dist/modules/hallucination/index.js +0 -6
  217. package/dist/modules/hallucination/js-identifiers.js +0 -261
  218. package/dist/modules/hallucination/llm-judge.js +0 -116
  219. package/dist/modules/hallucination/success-claim.js +0 -59
  220. package/dist/modules/index.js +0 -5
  221. package/dist/modules/indexer/cache.js +0 -88
  222. package/dist/modules/indexer/index.js +0 -4
  223. package/dist/modules/indexer/map-command.js +0 -33
  224. package/dist/modules/indexer/map-select.js +0 -87
  225. package/dist/modules/indexer/module.js +0 -293
  226. package/dist/modules/indexer/project-profile.js +0 -184
  227. package/dist/modules/indexer/symbols.js +0 -189
  228. package/dist/modules/indexer/walker.js +0 -285
  229. package/dist/modules/lsp/check-tool.js +0 -61
  230. package/dist/modules/lsp/client.js +0 -406
  231. package/dist/modules/lsp/command.js +0 -53
  232. package/dist/modules/lsp/config.js +0 -189
  233. package/dist/modules/lsp/index.js +0 -4
  234. package/dist/modules/lsp/module.js +0 -295
  235. package/dist/modules/lsp/probe.js +0 -86
  236. package/dist/modules/lsp/project-root.js +0 -69
  237. package/dist/modules/lsp/startup-check.js +0 -154
  238. package/dist/modules/lsp/types.js +0 -1
  239. package/dist/modules/mcp/client.js +0 -445
  240. package/dist/modules/mcp/index.js +0 -4
  241. package/dist/modules/mcp/module.js +0 -295
  242. package/dist/modules/mcp/registry.js +0 -20
  243. package/dist/modules/memory/index.js +0 -2
  244. package/dist/modules/memory/module.js +0 -101
  245. package/dist/modules/memory/search.js +0 -45
  246. package/dist/modules/memory/store.js +0 -107
  247. package/dist/modules/onboarding/init.js +0 -47
  248. package/dist/modules/onboarding/meet.js +0 -30
  249. package/dist/modules/onboarding/mode.js +0 -30
  250. package/dist/modules/onboarding/prompts.js +0 -43
  251. package/dist/modules/pipelines/engine.js +0 -70
  252. package/dist/modules/pipelines/index.js +0 -4
  253. package/dist/modules/pipelines/parser.js +0 -59
  254. package/dist/modules/pipelines/template.js +0 -18
  255. package/dist/modules/plugins/builtin/lint-on-write.js +0 -377
  256. package/dist/modules/plugins/builtin/notify.js +0 -11
  257. package/dist/modules/plugins/index.js +0 -2
  258. package/dist/modules/plugins/loader.js +0 -85
  259. package/dist/modules/plugins/manager.js +0 -244
  260. package/dist/modules/plugins/types.js +0 -1
  261. package/dist/modules/pricing/index.js +0 -70
  262. package/dist/modules/pricing/prices.js +0 -147
  263. package/dist/modules/processes/detect.js +0 -34
  264. package/dist/modules/processes/index.js +0 -4
  265. package/dist/modules/processes/kill-tree.js +0 -52
  266. package/dist/modules/processes/registry.js +0 -294
  267. package/dist/modules/processes/runner.js +0 -23
  268. package/dist/modules/providers/cache.js +0 -23
  269. package/dist/modules/providers/capabilities.js +0 -28
  270. package/dist/modules/providers/create.js +0 -21
  271. package/dist/modules/providers/factory.js +0 -28
  272. package/dist/modules/providers/fallback.js +0 -81
  273. package/dist/modules/providers/health.js +0 -47
  274. package/dist/modules/providers/index.js +0 -6
  275. package/dist/modules/providers/manager.js +0 -207
  276. package/dist/modules/providers/naming.js +0 -15
  277. package/dist/modules/providers/preflight.js +0 -71
  278. package/dist/modules/providers/presets.js +0 -232
  279. package/dist/modules/providers/registry.js +0 -27
  280. package/dist/modules/providers/types.js +0 -1
  281. package/dist/modules/reasoning/policy.js +0 -42
  282. package/dist/modules/reasoning/probe.js +0 -116
  283. package/dist/modules/registry.js +0 -48
  284. package/dist/modules/security/audit-log.js +0 -119
  285. package/dist/modules/security/audit-notifier.js +0 -267
  286. package/dist/modules/security/command-validator.js +0 -272
  287. package/dist/modules/security/content-scanner.js +0 -53
  288. package/dist/modules/security/data-sanitizer.js +0 -82
  289. package/dist/modules/security/encryption.js +0 -216
  290. package/dist/modules/security/index.js +0 -15
  291. package/dist/modules/security/network-validator.js +0 -236
  292. package/dist/modules/security/path-validator.js +0 -261
  293. package/dist/modules/security/protected-paths.js +0 -73
  294. package/dist/modules/security/rate-limiter.js +0 -98
  295. package/dist/modules/security/security-policies.js +0 -499
  296. package/dist/modules/security/session-encryption.js +0 -182
  297. package/dist/modules/security/session-isolation.js +0 -75
  298. package/dist/modules/session/auto-name.js +0 -63
  299. package/dist/modules/session/export.js +0 -98
  300. package/dist/modules/session/index.js +0 -4
  301. package/dist/modules/session/manager.js +0 -234
  302. package/dist/modules/session/module.js +0 -33
  303. package/dist/modules/session/store.js +0 -295
  304. package/dist/modules/session/types.js +0 -1
  305. package/dist/modules/setup/answers.js +0 -35
  306. package/dist/modules/setup/apply.js +0 -79
  307. package/dist/modules/setup/discovery.js +0 -72
  308. package/dist/modules/skills/index.js +0 -3
  309. package/dist/modules/skills/loader.js +0 -86
  310. package/dist/modules/skills/matcher.js +0 -27
  311. package/dist/modules/skills/module.js +0 -141
  312. package/dist/modules/types.js +0 -1
  313. package/dist/modules/updater/changelog-reader.js +0 -93
  314. package/dist/modules/updater/checker.js +0 -101
  315. package/dist/modules/updater/dev-detect.js +0 -18
  316. package/dist/modules/updater/index.js +0 -4
  317. package/dist/modules/updater/module.js +0 -129
  318. package/dist/modules/user-profile/compressor.js +0 -18
  319. package/dist/modules/user-profile/index.js +0 -2
  320. package/dist/modules/user-profile/profile.js +0 -77
  321. package/dist/modules/webui/answer-api.js +0 -29
  322. package/dist/modules/webui/assets.js +0 -50
  323. package/dist/modules/webui/body.js +0 -21
  324. package/dist/modules/webui/commands-settings.js +0 -209
  325. package/dist/modules/webui/commands-shared.js +0 -60
  326. package/dist/modules/webui/commands.js +0 -174
  327. package/dist/modules/webui/config-api.js +0 -134
  328. package/dist/modules/webui/file-api.js +0 -202
  329. package/dist/modules/webui/forward.js +0 -159
  330. package/dist/modules/webui/history-api.js +0 -112
  331. package/dist/modules/webui/host-state.js +0 -60
  332. package/dist/modules/webui/i18n-api.js +0 -9
  333. package/dist/modules/webui/limits.js +0 -6
  334. package/dist/modules/webui/log-forward.js +0 -20
  335. package/dist/modules/webui/memory-commands.js +0 -64
  336. package/dist/modules/webui/model-cache.js +0 -18
  337. package/dist/modules/webui/module.js +0 -148
  338. package/dist/modules/webui/persist.js +0 -24
  339. package/dist/modules/webui/prompt-io.js +0 -97
  340. package/dist/modules/webui/providers-api.js +0 -337
  341. package/dist/modules/webui/providers-view.js +0 -56
  342. package/dist/modules/webui/reasoning-view.js +0 -15
  343. package/dist/modules/webui/run-agent.js +0 -81
  344. package/dist/modules/webui/server.js +0 -284
  345. package/dist/modules/webui/sessions-api.js +0 -178
  346. package/dist/modules/webui/settings-api.js +0 -561
  347. package/dist/modules/webui/setup-api.js +0 -201
  348. package/dist/modules/webui/state.js +0 -74
  349. package/dist/modules/webui/util.js +0 -261
  350. package/dist/output/bus.js +0 -37
  351. package/dist/output/channel.js +0 -285
  352. package/dist/output/format.js +0 -15
  353. package/dist/output/index.js +0 -8
  354. package/dist/output/json-sink.js +0 -24
  355. package/dist/output/machine.js +0 -9
  356. package/dist/output/session-sink.js +0 -27
  357. package/dist/output/types.js +0 -1
  358. package/dist/tools/approve.js +0 -41
  359. package/dist/tools/attach-image.js +0 -102
  360. package/dist/tools/auto-fixer.js +0 -180
  361. package/dist/tools/auto-tags.js +0 -83
  362. package/dist/tools/bash.js +0 -649
  363. package/dist/tools/browser.js +0 -160
  364. package/dist/tools/chunk-query.js +0 -112
  365. package/dist/tools/create-dir.js +0 -60
  366. package/dist/tools/delete-file.js +0 -67
  367. package/dist/tools/download-file.js +0 -142
  368. package/dist/tools/edit-file.js +0 -136
  369. package/dist/tools/enable-tools.js +0 -59
  370. package/dist/tools/executor.js +0 -304
  371. package/dist/tools/file-info.js +0 -49
  372. package/dist/tools/filter-tools.js +0 -17
  373. package/dist/tools/glob-tool.js +0 -37
  374. package/dist/tools/grep-tool.js +0 -142
  375. package/dist/tools/hidden-tools-block.js +0 -37
  376. package/dist/tools/index.js +0 -88
  377. package/dist/tools/list-dir.js +0 -53
  378. package/dist/tools/load-skill.js +0 -51
  379. package/dist/tools/mcp-call.js +0 -80
  380. package/dist/tools/meet-done.js +0 -14
  381. package/dist/tools/move-file.js +0 -94
  382. package/dist/tools/path-utils.js +0 -108
  383. package/dist/tools/pipeline-run.js +0 -167
  384. package/dist/tools/preview.js +0 -2
  385. package/dist/tools/process-ids.js +0 -31
  386. package/dist/tools/process-kill.js +0 -33
  387. package/dist/tools/process-list.js +0 -38
  388. package/dist/tools/process-log.js +0 -49
  389. package/dist/tools/process-wait.js +0 -63
  390. package/dist/tools/prompt-io.js +0 -29
  391. package/dist/tools/question.js +0 -288
  392. package/dist/tools/read-file.js +0 -200
  393. package/dist/tools/recall.js +0 -124
  394. package/dist/tools/registry.js +0 -48
  395. package/dist/tools/remember.js +0 -72
  396. package/dist/tools/scope-check.js +0 -32
  397. package/dist/tools/scope-request.js +0 -96
  398. package/dist/tools/search-history.js +0 -88
  399. package/dist/tools/session-info.js +0 -46
  400. package/dist/tools/set-thinking.js +0 -75
  401. package/dist/tools/subagent.js +0 -257
  402. package/dist/tools/syntax-validator.js +0 -379
  403. package/dist/tools/types.js +0 -1
  404. package/dist/tools/user-input.js +0 -134
  405. package/dist/tools/web-browse.js +0 -93
  406. package/dist/tools/web-fetch.js +0 -108
  407. package/dist/tools/web-search.js +0 -107
  408. package/dist/tools/write-file.js +0 -128
  409. package/dist/ui/action-log.js +0 -13
  410. package/dist/ui/box.js +0 -78
  411. package/dist/ui/colors.js +0 -6
  412. package/dist/ui/diff.js +0 -189
  413. package/dist/ui/index.js +0 -7
  414. package/dist/ui/line-editor.js +0 -1083
  415. package/dist/ui/line-math.js +0 -98
  416. package/dist/ui/md-formatter.js +0 -322
  417. package/dist/ui/output.js +0 -19
  418. package/dist/ui/plan-view.js +0 -109
  419. package/dist/ui/renderer.js +0 -589
  420. package/dist/ui/spinner.js +0 -91
  421. package/dist/ui/table.js +0 -142
  422. package/dist/ui/theme.js +0 -143
  423. package/dist/utils/child-run.js +0 -20
  424. package/dist/utils/error.js +0 -4
  425. package/dist/utils/index.js +0 -6
  426. package/dist/utils/retry.js +0 -17
  427. package/dist/utils/sleep.js +0 -23
  428. package/dist/utils/truncate.js +0 -9
@@ -56,6 +56,7 @@
56
56
  </div>
57
57
  <div class="rl-track" id="railTrack" data-mode="scan">
58
58
  <div class="rl-fill" id="railFill"></div>
59
+ <div class="rl-notches" id="railNotches"></div>
59
60
  <div class="rl-scan"></div>
60
61
  </div>
61
62
  <div class="rail-l2" aria-hidden="true">
@@ -111,6 +112,10 @@
111
112
  <span class="sb-ico" data-icon="trace" aria-hidden="true"></span>
112
113
  <span class="sb-dot" aria-hidden="true"></span>
113
114
  </button>
115
+ <button class="sb-tab" type="button" role="tab" data-tab="lsp" aria-selected="false" aria-controls="pane-lsp" title="LSP">
116
+ <span class="sb-ico" data-icon="lsp" aria-hidden="true"></span>
117
+ <span class="sb-dot" aria-hidden="true"></span>
118
+ </button>
114
119
  </div>
115
120
  <div class="sb-name" id="sbName"><span class="sb-ico" data-icon="session" aria-hidden="true"></span><span id="sbNameText">Session</span></div>
116
121
 
@@ -142,6 +147,12 @@
142
147
  <div class="detail-b" id="detailBody"></div>
143
148
  </div>
144
149
  </div>
150
+
151
+ <div class="sb-pane" id="pane-lsp" role="tabpanel" data-pane="lsp" hidden>
152
+ <div class="sec map-sec">
153
+ <div class="sec-body" id="lspBody"></div>
154
+ </div>
155
+ </div>
145
156
  </div>
146
157
  </div>
147
158
 
@@ -1,28 +1 @@
1
- // REST helper for the `mma web` frontend. The `?token=` query carries auth
2
- // for non-loopback binds (EventSource and fetch share it); same-origin POSTs
3
- // additionally rely on the `mma_web_auth` cookie the server sets.
4
-
5
- export const token = new URLSearchParams(location.search).get("token") || "";
6
-
7
- export async function api(path, opts = {}) {
8
- const headers = Object.assign({}, opts.headers || {});
9
- if (opts.body !== undefined) headers["content-type"] = "application/json";
10
- if (token) headers["x-mma-token"] = token;
11
- let res;
12
- try {
13
- res = await fetch(path, {
14
- method: opts.method || "GET",
15
- headers,
16
- body: opts.body !== undefined ? JSON.stringify(opts.body) : undefined,
17
- });
18
- } catch (err) {
19
- return { ok: false, status: 0, data: null };
20
- }
21
- let data = null;
22
- try {
23
- data = await res.json();
24
- } catch (err) {
25
- data = null;
26
- }
27
- return { ok: res.ok, status: res.status, data };
28
- }
1
+ export const token=new URLSearchParams(location.search).get("token")||"";export async function api(o,t={}){const n=Object.assign({},t.headers||{});t.body!==void 0&&(n["content-type"]="application/json"),token&&(n["x-mma-token"]=token);let e;try{e=await fetch(o,{method:t.method||"GET",headers:n,body:t.body!==void 0?JSON.stringify(t.body):void 0})}catch{return{ok:!1,status:0,data:null}}let a=null;try{a=await e.json()}catch{a=null}return{ok:e.ok,status:e.status,data:a}}
@@ -0,0 +1 @@
1
+ const o=document.getElementById("sessDD"),n=document.getElementById("sessBtn");let s=null;export function setSessionCloseHook(e){s=e}export function setSessOpen(e){o&&o.classList.toggle("open",!!e),n&&n.setAttribute("aria-expanded",e?"true":"false"),!e&&s&&s()}export function closeAllMenus(){document.querySelectorAll("[data-sel]").forEach(e=>{e.classList.remove("open");const t=e.querySelector("button");t&&t.setAttribute("aria-expanded","false")}),setSessOpen(!1)}
@@ -0,0 +1 @@
1
+ export const feed={curText:null,curMd:null,turnMd:"",turnRoots:[],curThink:null,lastPlanSig:null,lastUsageSig:null,lastEnvSig:null,runCount:0,runFails:0,runReconOnly:!0,runNodes:[],runDuration:0,busyTimer:null,pendingArgs:new Map,toolNodes:new Map};
@@ -0,0 +1 @@
1
+ import{feed as s}from"./feed.js";import{tabs as c}from"./tabs.js";import{settings as f}from"./settings.js";import{session as i}from"./session.js";export{s as feed,c as tabs,f as settings,i as session};export const THEME_KEY="mma-theme",MAX_IMAGES=3,MAX_IMAGE_BYTES=6*1024*1024,hooks={applyStaticI18n:null};export function setPath(r,n,p){const t=n.split(".");let o=r;for(let e=0;e<t.length-1;e++)(o[t[e]]==null||typeof o[t[e]]!="object")&&(o[t[e]]={}),o=o[t[e]];o[t[t.length-1]]=p}export function getPath(r,n){const p=n.split(".");let t=r;for(const o of p){if(t==null||typeof t!="object")return;t=t[o]}return t}
@@ -0,0 +1 @@
1
+ export const session={sessions:[],host:{},busy:!1,activeSessionId:null,runningSessionId:null,runningSessionIds:[],queued:{},sessionsError:null,reasoning:void 0};
@@ -0,0 +1 @@
1
+ export const settings={config:null,registry:[],webToken:null,models:[],memory:void 0,skills:void 0,pluginsData:void 0,providers:void 0,providerPresets:[],providerForm:null,mcpForm:null,lspForm:null,lsp:void 0};
@@ -0,0 +1 @@
1
+ export const tabs={tabs:[],activeTabId:null,liveTabId:null,newSeq:0,attachments:[],attachErrTimer:null};
@@ -1,105 +1 @@
1
- // Chrome primitives: save toast + generic confirmation dialog.
2
- // Leaf module (dom + i18n only) so tabs and settings can both use it.
3
- import { saveIndicator } from "./dom.js";
4
- import { t } from "./i18n.js";
5
-
6
- let indicatorTimer = null;
7
- const indicatorQueue = [];
8
- let indicatorShowing = false;
9
-
10
- function showNextIndicator() {
11
- if (!saveIndicator) return;
12
- const next = indicatorQueue.shift();
13
- if (next === undefined) {
14
- indicatorShowing = false;
15
- return;
16
- }
17
- indicatorShowing = true;
18
- saveIndicator.textContent = next.msg;
19
- saveIndicator.classList.toggle("fail", !!next.fail);
20
- saveIndicator.classList.add("show");
21
- clearTimeout(indicatorTimer);
22
- indicatorTimer = setTimeout(() => {
23
- saveIndicator.classList.remove("show");
24
- // Brief gap so a repeated message visibly re-appears instead of blending.
25
- setTimeout(showNextIndicator, 150);
26
- }, 2400);
27
- }
28
-
29
- // Save toast. Overlapping messages queue (cap 3) instead of overwriting —
30
- // a single message behaves exactly as before (2.4s, then hide).
31
- export function setIndicator(msg, fail) {
32
- if (!saveIndicator) return;
33
- indicatorQueue.push({ msg, fail });
34
- if (indicatorQueue.length > 3) indicatorQueue.splice(0, indicatorQueue.length - 3);
35
- if (!indicatorShowing) showNextIndicator();
36
- }
37
-
38
- // Keep Tab cycling inside an open overlay dialog (focus trap). The confirm
39
- // dialog keeps its own two-button variant below — it always traps, even with
40
- // a single visible action.
41
- export function trapTab(container, e) {
42
- if (e.key !== "Tab") return;
43
- const items = Array.from(
44
- container.querySelectorAll('button:not([disabled]), [href], input:not([disabled]), select, textarea, [tabindex]:not([tabindex="-1"])'),
45
- ).filter((node) => node.offsetParent !== null);
46
- if (!items.length) return;
47
- const first = items[0];
48
- const last = items[items.length - 1];
49
- if (e.shiftKey && document.activeElement === first) {
50
- e.preventDefault();
51
- last.focus();
52
- } else if (!e.shiftKey && document.activeElement === last) {
53
- e.preventDefault();
54
- first.focus();
55
- }
56
- }
57
-
58
- export const confirmOverlay = document.getElementById("confirmOverlay");
59
- const confirmTitle = document.getElementById("confirmTitle");
60
- const confirmMsg = document.getElementById("confirmMsg");
61
- const confirmAccept = document.getElementById("confirmAccept");
62
- const confirmCancel = document.getElementById("confirmCancel");
63
- let confirmOnAccept = null;
64
- let confirmReturnFocus = null;
65
-
66
- export function openConfirm(opts) {
67
- if (!confirmOverlay) return;
68
- confirmReturnFocus = document.activeElement;
69
- confirmTitle.textContent = opts.title || "";
70
- confirmMsg.textContent = opts.body || "";
71
- confirmAccept.textContent = opts.acceptLabel || t("web.sessions.delete");
72
- confirmCancel.textContent = opts.cancelLabel || t("web.action.cancel");
73
- confirmOnAccept = opts.onAccept || null;
74
- confirmOverlay.classList.add("open");
75
- setTimeout(() => confirmCancel.focus(), 0);
76
- }
77
-
78
- export function closeConfirm() {
79
- if (!confirmOverlay || !confirmOverlay.classList.contains("open")) return;
80
- confirmOverlay.classList.remove("open");
81
- confirmOnAccept = null;
82
- if (confirmReturnFocus && confirmReturnFocus.focus) confirmReturnFocus.focus();
83
- confirmReturnFocus = null;
84
- }
85
-
86
- if (confirmOverlay) {
87
- confirmCancel.addEventListener("click", closeConfirm);
88
- confirmAccept.addEventListener("click", () => {
89
- const fn = confirmOnAccept;
90
- closeConfirm();
91
- if (fn) fn();
92
- });
93
- confirmOverlay.addEventListener("click", (e) => {
94
- // Keep clicks inside the dialog from reaching the global handler, so the
95
- // sessions dropdown stays open behind it.
96
- e.stopPropagation();
97
- if (e.target === confirmOverlay) closeConfirm();
98
- });
99
- // Keep Tab between the two actions while the dialog is open.
100
- confirmOverlay.addEventListener("keydown", (e) => {
101
- if (e.key !== "Tab") return;
102
- e.preventDefault();
103
- (document.activeElement === confirmAccept ? confirmCancel : confirmAccept).focus();
104
- });
105
- }
1
+ import{saveIndicator as n}from"./dom.js";import{t as m}from"./i18n.js";let d=null;const o=[];let s=!1;function p(){if(!n)return;const e=o.shift();if(e===void 0){s=!1;return}s=!0,n.textContent=e.msg,n.classList.toggle("fail",!!e.fail),n.classList.add("show"),clearTimeout(d),d=setTimeout(()=>{n.classList.remove("show"),setTimeout(p,150)},2400)}export function setIndicator(e,t){n&&(o.push({msg:e,fail:t}),o.length>3&&o.splice(0,o.length-3),s||p())}export function trapTab(e,t){if(t.key!=="Tab")return;const c=Array.from(e.querySelectorAll('button:not([disabled]), [href], input:not([disabled]), select, textarea, [tabindex]:not([tabindex="-1"])')).filter(g=>g.offsetParent!==null);if(!c.length)return;const a=c[0],u=c[c.length-1];t.shiftKey&&document.activeElement===a?(t.preventDefault(),u.focus()):!t.shiftKey&&document.activeElement===u&&(t.preventDefault(),a.focus())}export const confirmOverlay=document.getElementById("confirmOverlay");const v=document.getElementById("confirmTitle"),x=document.getElementById("confirmMsg"),r=document.getElementById("confirmAccept"),l=document.getElementById("confirmCancel");let f=null,i=null;export function openConfirm(e){confirmOverlay&&(i=document.activeElement,v.textContent=e.title||"",x.textContent=e.body||"",r.textContent=e.acceptLabel||m("web.sessions.delete"),l.textContent=e.cancelLabel||m("web.action.cancel"),f=e.onAccept||null,confirmOverlay.classList.add("open"),setTimeout(()=>l.focus(),0))}export function closeConfirm(){!confirmOverlay||!confirmOverlay.classList.contains("open")||(confirmOverlay.classList.remove("open"),f=null,i&&i.focus&&i.focus(),i=null)}confirmOverlay&&(l.addEventListener("click",closeConfirm),r.addEventListener("click",()=>{const e=f;closeConfirm(),e&&e()}),confirmOverlay.addEventListener("click",e=>{e.stopPropagation(),e.target===confirmOverlay&&closeConfirm()}),confirmOverlay.addEventListener("keydown",e=>{e.key==="Tab"&&(e.preventDefault(),(document.activeElement===r?l:r).focus())}));
@@ -1,178 +1 @@
1
- // DOM refs + tiny element builders for the `mma web` frontend.
2
- // No dependencies: every other module builds on these.
3
-
4
- export const msgs = document.getElementById("msgs");
5
- export const inp = document.getElementById("inp");
6
- export const tabstripEl = document.getElementById("tabstrip");
7
- export const planEl = document.getElementById("plan");
8
- export const planCountEl = document.getElementById("planCount");
9
- export const usageEl = document.getElementById("usage");
10
- export const envEl = document.getElementById("env");
11
- export const wsLine = document.getElementById("wsLine");
12
- export const saveIndicator = document.getElementById("saveIndicator");
13
- export const attachStrip = document.getElementById("attachStrip");
14
- export const attachErr = document.getElementById("attachErr");
15
- export const imgPicker = document.getElementById("imgPicker");
16
- export const connStatus = document.getElementById("connStatus");
17
- export const staleBar = document.getElementById("staleBar");
18
- export const liveEl = document.getElementById("live");
19
- export const sendBtn = document.getElementById("sendBtn");
20
-
21
- // Announce a short status line to assistive tech (turn end, warnings/errors).
22
- // Clearing first forces repeats to be re-announced.
23
- export function announce(text) {
24
- if (!liveEl || !text) return;
25
- liveEl.textContent = "";
26
- setTimeout(() => {
27
- liveEl.textContent = text;
28
- }, 30);
29
- }
30
-
31
- export function el(tag, cls, text) {
32
- const node = document.createElement(tag);
33
- if (cls) node.className = cls;
34
- if (text != null) node.textContent = text;
35
- return node;
36
- }
37
-
38
- // --- Lucide icons (MIT), inlined: chrome only. Chat status glyphs (◇ ✓ ✗ ✦ ⟡ …)
39
- // stay textual per docs/design/ui/STYLE.md; icons replace emoji/gear chrome.
40
- export const SVG_NS = "http://www.w3.org/2000/svg";
41
- export const ICONS = {
42
- plus: [["path", { d: "M5 12h14" }], ["path", { d: "M12 5v14" }]],
43
- menu: [
44
- ["line", { x1: 4, y1: 6, x2: 20, y2: 6 }],
45
- ["line", { x1: 4, y1: 12, x2: 20, y2: 12 }],
46
- ["line", { x1: 4, y1: 18, x2: 20, y2: 18 }],
47
- ],
48
- settings: [
49
- ["path", { d: "M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z" }],
50
- ["circle", { cx: 12, cy: 12, r: 3 }],
51
- ],
52
- image: [
53
- ["rect", { width: 18, height: 18, x: 3, y: 3, rx: 2, ry: 2 }],
54
- ["circle", { cx: 9, cy: 9, r: 2 }],
55
- ["path", { d: "m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21" }],
56
- ],
57
- x: [["path", { d: "M18 6 6 18" }], ["path", { d: "m6 6 12 12" }]],
58
- trash: [
59
- ["path", { d: "M3 6h18" }],
60
- ["path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6" }],
61
- ["path", { d: "M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" }],
62
- ["line", { x1: 10, y1: 11, x2: 10, y2: 17 }],
63
- ["line", { x1: 14, y1: 11, x2: 14, y2: 17 }],
64
- ],
65
- refresh: [
66
- ["path", { d: "M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8" }],
67
- ["path", { d: "M21 3v5h-5" }],
68
- ["path", { d: "M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16" }],
69
- ["path", { d: "M8 21H3v-5" }],
70
- ],
71
- "chevron-down": [["path", { d: "m6 9 6 6 6-6" }]],
72
- "chevron-left": [["path", { d: "m15 18-6-6 6-6" }]],
73
- "chevron-right": [["path", { d: "m9 18 6-6-6-6" }]],
74
- search: [
75
- ["circle", { cx: 11, cy: 11, r: 8 }],
76
- ["path", { d: "m21 21-4.3-4.3" }],
77
- ],
78
- "list-checks": [
79
- ["path", { d: "m3 17 2 2 4-4" }],
80
- ["path", { d: "m3 7 2 2 4-4" }],
81
- ["path", { d: "M13 6h8" }],
82
- ["path", { d: "M13 12h8" }],
83
- ["path", { d: "M13 18h8" }],
84
- ],
85
- map: [
86
- ["path", { d: "M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z" }],
87
- ["path", { d: "M15 5.764v15" }],
88
- ["path", { d: "M9 3.236v15" }],
89
- ],
90
- activity: [
91
- ["path", { d: "M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2" }],
92
- ],
93
- "arrow-up": [["path", { d: "M12 19V5" }], ["path", { d: "m5 12 7-7 7 7" }]],
94
- panel: [
95
- ["rect", { width: 18, height: 18, x: 3, y: 3, rx: 2, ry: 2 }],
96
- ["line", { x1: 15, y1: 3, x2: 15, y2: 21 }],
97
- ],
98
- square: [["rect", { width: 14, height: 14, x: 5, y: 5, rx: 2 }]],
99
- copy: [
100
- ["rect", { width: 14, height: 14, x: 8, y: 8, rx: 2, ry: 2 }],
101
- ["path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" }],
102
- ],
103
- check: [["path", { d: "M20 6 9 17l-5-5" }]],
104
- };
105
-
106
- export function icon(name, cls) {
107
- const svg = document.createElementNS(SVG_NS, "svg");
108
- svg.setAttribute("viewBox", "0 0 24 24");
109
- svg.setAttribute("fill", "none");
110
- svg.setAttribute("stroke", "currentColor");
111
- svg.setAttribute("stroke-width", "2");
112
- svg.setAttribute("stroke-linecap", "round");
113
- svg.setAttribute("stroke-linejoin", "round");
114
- svg.setAttribute("aria-hidden", "true");
115
- svg.setAttribute("focusable", "false");
116
- svg.setAttribute("class", "svg-icon" + (cls ? " " + cls : ""));
117
- (ICONS[name] || []).forEach(([tag, attrs]) => {
118
- const child = document.createElementNS(SVG_NS, tag);
119
- Object.keys(attrs).forEach((k) => child.setAttribute(k, String(attrs[k])));
120
- svg.appendChild(child);
121
- });
122
- return svg;
123
- }
124
-
125
- // Replace a node's contents with an icon + optional label, keeping it a real
126
- // control. Returns the label node so callers can preserve text-only updates.
127
- export function setIcon(button, name, label) {
128
- if (!button) return null;
129
- button.textContent = "";
130
- button.appendChild(icon(name));
131
- if (label != null) button.appendChild(el("span", "", label));
132
- return button;
133
- }
134
-
135
- // Accessible on/off switch (`role=switch`). `onFlip(next)` runs on click; the
136
- // switch flips itself only when `onFlip` returns truthy — async callers that
137
- // re-render instead (MCP list) return nothing and keep server truth.
138
- export function makeToggle(on, onFlip) {
139
- const b = el("button", "toggle" + (on ? " on" : ""));
140
- b.type = "button";
141
- b.setAttribute("role", "switch");
142
- b.setAttribute("aria-checked", on ? "true" : "false");
143
- b.addEventListener("click", () => {
144
- const next = !b.classList.contains("on");
145
- if (onFlip(next)) {
146
- b.classList.toggle("on", next);
147
- b.setAttribute("aria-checked", next ? "true" : "false");
148
- }
149
- });
150
- return b;
151
- }
152
-
153
- // Text action control (`edit`, `forget`, `add`, …) as a focusable <button>.
154
- export function link(label, cls, onClick) {
155
- const b = el("button", "linkbtn" + (cls ? " " + cls : ""), label);
156
- b.type = "button";
157
- b.addEventListener("click", onClick);
158
- return b;
159
- }
160
-
161
- // Render raw memory text (`- **date** -- **pattern:** body`) as safe DOM nodes:
162
- // `**…**` spans become <b>, everything else stays a text node. Never uses
163
- // innerHTML, so untrusted/model-written content cannot inject markup.
164
- export function inlineTextNodes(text) {
165
- const frag = document.createDocumentFragment();
166
- const raw = String(text == null ? "" : text).replace(/^-\s*/, "");
167
- raw.split("**").forEach((part, i) => {
168
- if (part === "") return;
169
- if (i % 2 === 1) {
170
- const b = document.createElement("b");
171
- b.textContent = part;
172
- frag.appendChild(b);
173
- } else {
174
- frag.appendChild(document.createTextNode(part));
175
- }
176
- });
177
- return frag;
178
- }
1
+ export const msgs=document.getElementById("msgs"),inp=document.getElementById("inp"),tabstripEl=document.getElementById("tabstrip"),planEl=document.getElementById("plan"),planCountEl=document.getElementById("planCount"),usageEl=document.getElementById("usage"),envEl=document.getElementById("env"),wsLine=document.getElementById("wsLine"),saveIndicator=document.getElementById("saveIndicator"),attachStrip=document.getElementById("attachStrip"),attachErr=document.getElementById("attachErr"),imgPicker=document.getElementById("imgPicker"),connStatus=document.getElementById("connStatus"),staleBar=document.getElementById("staleBar"),liveEl=document.getElementById("live"),sendBtn=document.getElementById("sendBtn");export function announce(e){!liveEl||!e||(liveEl.textContent="",setTimeout(()=>{liveEl.textContent=e},30))}export function el(e,a,t){const n=document.createElement(e);return a&&(n.className=a),t!=null&&(n.textContent=String(t)),n}export const SVG_NS="http://www.w3.org/2000/svg",ICONS={plus:[["path",{d:"M5 12h14"}],["path",{d:"M12 5v14"}]],menu:[["line",{x1:4,y1:6,x2:20,y2:6}],["line",{x1:4,y1:12,x2:20,y2:12}],["line",{x1:4,y1:18,x2:20,y2:18}]],settings:[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"}],["circle",{cx:12,cy:12,r:3}]],image:[["rect",{width:18,height:18,x:3,y:3,rx:2,ry:2}],["circle",{cx:9,cy:9,r:2}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"}]],x:[["path",{d:"M18 6 6 18"}],["path",{d:"m6 6 12 12"}]],trash:[["path",{d:"M3 6h18"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"}],["line",{x1:10,y1:11,x2:10,y2:17}],["line",{x1:14,y1:11,x2:14,y2:17}]],refresh:[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"}],["path",{d:"M21 3v5h-5"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"}],["path",{d:"M8 21H3v-5"}]],"chevron-down":[["path",{d:"m6 9 6 6 6-6"}]],"chevron-left":[["path",{d:"m15 18-6-6 6-6"}]],"chevron-right":[["path",{d:"m9 18 6-6-6-6"}]],search:[["circle",{cx:11,cy:11,r:8}],["path",{d:"m21 21-4.3-4.3"}]],"list-checks":[["path",{d:"m3 17 2 2 4-4"}],["path",{d:"m3 7 2 2 4-4"}],["path",{d:"M13 6h8"}],["path",{d:"M13 12h8"}],["path",{d:"M13 18h8"}]],map:[["path",{d:"M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z"}],["path",{d:"M15 5.764v15"}],["path",{d:"M9 3.236v15"}]],activity:[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2"}]],"arrow-up":[["path",{d:"M12 19V5"}],["path",{d:"m5 12 7-7 7 7"}]],panel:[["rect",{width:18,height:18,x:3,y:3,rx:2,ry:2}],["line",{x1:15,y1:3,x2:15,y2:21}]],square:[["rect",{width:14,height:14,x:5,y:5,rx:2}]],copy:[["rect",{width:14,height:14,x:8,y:8,rx:2,ry:2}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"}]],check:[["path",{d:"M20 6 9 17l-5-5"}]],info:[["circle",{cx:12,cy:12,r:10}],["path",{d:"M12 16v-4"}],["path",{d:"M12 8h.01"}]],stethoscope:[["path",{d:"M11 2v2"}],["path",{d:"M5 2v2"}],["path",{d:"M5 3H4a2 2 0 0 0-2 2v4a6 6 0 0 0 12 0V5a2 2 0 0 0-2-2h-1"}],["path",{d:"M8 15a6 6 0 0 0 12 0v-3"}],["circle",{cx:20,cy:10,r:2}]]};export function icon(e,a){const t=document.createElementNS(SVG_NS,"svg");return t.setAttribute("viewBox","0 0 24 24"),t.setAttribute("fill","none"),t.setAttribute("stroke","currentColor"),t.setAttribute("stroke-width","2"),t.setAttribute("stroke-linecap","round"),t.setAttribute("stroke-linejoin","round"),t.setAttribute("aria-hidden","true"),t.setAttribute("focusable","false"),t.setAttribute("class","svg-icon"+(a?" "+a:"")),(ICONS[e]||[]).forEach(([n,r])=>{const c=document.createElementNS(SVG_NS,n);Object.keys(r).forEach(o=>c.setAttribute(o,String(r[o]))),t.appendChild(c)}),t}export function setIcon(e,a,t){return e?(e.textContent="",e.appendChild(icon(a)),t!=null&&e.appendChild(el("span","",t)),e):null}export function makeToggle(e,a){const t=el("button","toggle"+(e?" on":""));return t.type="button",t.setAttribute("role","switch"),t.setAttribute("aria-checked",e?"true":"false"),t.addEventListener("click",()=>{const n=!t.classList.contains("on");a(n)&&(t.classList.toggle("on",n),t.setAttribute("aria-checked",n?"true":"false"))}),t}export function link(e,a,t){const n=el("button","linkbtn"+(a?" "+a:""),e);return n.type="button",n.addEventListener("click",t),n}export function inlineTextNodes(e){const a=document.createDocumentFragment();return String(e??"").replace(/^-\s*/,"").split("**").forEach((n,r)=>{if(n!=="")if(r%2===1){const c=document.createElement("b");c.textContent=n,a.appendChild(c)}else a.appendChild(document.createTextNode(n))}),a}
@@ -0,0 +1 @@
1
+ import{msgs as s,el as i,setIcon as C}from"../dom.js";import{t as l,pluralCount as w}from"../i18n.js";import{feed as o,tabs as a}from"../store.js";import{formatMs as x,verbosity as T}from"../format.js";import{copyText as v}from"../../md.js";export function mdOpts(t){return{copyLabel:l("web.code.copy"),copiedLabel:l("web.code.copied"),copyFailedLabel:l("web.code.copy_failed"),animate:t===!0}}export function buildThinkBlock(t,e){const n=i("div","think"+(e===!1?"":" live")),r=i("button","think-h");r.type="button",r.setAttribute("aria-expanded","false"),r.appendChild(i("span","g","✦")),r.appendChild(i("span","lab",l("web.action.thinking"))),t&&r.appendChild(i("span","dur",""));const d=i("span","tog");C(d,"chevron-right",l("web.action.show")),r.appendChild(d);const p=i("div","think-body hidden");return n.appendChild(r),n.appendChild(p),{wrap:n,head:r,body:p}}export function copyAction(t,e){const n=i("button","act-btn",l(e));return n.type="button",n.addEventListener("click",()=>{v(t).then(r=>{n.textContent=r?"✓ "+l("web.code.copied"):"⚠ "+l("web.code.copy_failed"),window.setTimeout(()=>{n.textContent=l(e)},1400)})}),n}export function appendActionsRow(t,e,n){const r=String(e??""),d=String(n??"");if(!t||!r.trim()&&!d.trim())return;const p=i("div","msg-actions");r.trim()&&p.appendChild(copyAction(r,"web.msg.copy")),d.trim()&&p.appendChild(copyAction(d,"web.msg.copy_md")),appendTo(t,p)}export function insertAfter(t,e){t&&t.parentNode?t.parentNode.insertBefore(e,t.nextSibling):appendTo(liveFeed(),e)}function b(){const t=i("div","empty");return t.appendChild(i("span","g","✦")),t.appendChild(document.createTextNode(" "+l("web.empty.title"))),t.appendChild(document.createElement("br")),t.appendChild(i("span","hint",l("web.empty.hint"))),t}export function makeFeed(){const t=i("div","feed");return t.appendChild(b()),t}export function showEmptyFeed(){s.replaceChildren(b()),u=!0,f(),syncUrl()}export function clearFeed(t){if(!t)return;t.replaceChildren(b()),u=!0,f();const e=a.tabs.find(n=>n.feed===t);e&&(e.planCard=null),t===activeFeed()&&scroll()}export function activeFeed(){const t=a.tabs.find(e=>e.id===a.activeTabId);return t?t.feed:null}export function liveFeed(){const t=a.tabs.find(e=>e.id===a.liveTabId)||a.tabs.find(e=>e.id===a.activeTabId);return t?t.feed:null}export function feedForEvent(t){if(t){const e=a.tabs.find(n=>n.id===t);if(e)return e.feed}return liveFeed()}function h(){return s.scrollHeight-s.scrollTop-s.clientHeight<140}let u=!0;export function scroll(t){t||u||h()?(s.scrollTop=s.scrollHeight,u=!0,f()):m()}export function scrollToBottom(t){if(u=!0,f(),t&&typeof s.scrollTo=="function")try{s.scrollTo({top:s.scrollHeight,behavior:"smooth"});return}catch{}s.scrollTop=s.scrollHeight}export function isFollowing(){return u}export function feedHasContent(t){return!!t.querySelector(".u, .md, .ans, .code, .act, .think, .metaln, .errline, .sysline, .detail")}export function syncUrl(){const t=new URL(location.href),e=a.tabs.find(n=>n.id===a.activeTabId);e&&e.kind==="session"?t.searchParams.set("session",e.id):t.searchParams.delete("session"),history.replaceState(null,"",t)}let c=null;function g(){if(c)return c;const t=document.querySelector(".chat");return t?(c=i("button","to-latest"),c.type="button",c.hidden=!0,c.addEventListener("click",()=>scrollToBottom(!0)),t.appendChild(c),c):null}function m(){const t=g();t&&(t.textContent="↓ "+l("web.scroll.latest"),t.hidden=!1,s.classList.add("unfollowed"))}function f(){c&&(c.hidden=!0),s.classList.remove("unfollowed")}s.addEventListener("scroll",()=>{const t=h();u=t,s.classList.toggle("scrolled",s.scrollTop>24),t?f():liveFeed()&&feedHasContent(liveFeed())&&m()});export function appendTo(t,e){return t&&(t.appendChild(e),t===activeFeed()&&scroll()),e}export function clearEmpty(t){const e=t&&t.querySelector(".empty");e&&e.remove()}export function clearBusy(t){if(o.busyTimer&&(clearInterval(o.busyTimer),o.busyTimer=null),t=t||liveFeed(),!t)return;const e=t.querySelector(".busy");e&&e.remove()}export function showBusy(t){if(t=t||liveFeed(),!t||o.curMd||o.curThink||(clearEmpty(t),t.querySelector(".busy")))return;o.busyTimer&&(clearInterval(o.busyTimer),o.busyTimer=null);const e=i("div","busy");e.appendChild(i("span","spin","✦")),e.appendChild(i("span","lab",l("web.action.thinking")));const n=i("span","busytime","· 0s");e.appendChild(n),e.appendChild(i("span","","· "+l("web.input.esc"))),appendTo(t,e);const r=Date.now();o.busyTimer=setInterval(()=>{if(!e.parentNode){clearInterval(o.busyTimer),o.busyTimer=null;return}n.textContent="· "+Math.round((Date.now()-r)/1e3)+"s"},1e3)}export function flushRun(){if(o.runCount<=0){y();return}if(T()==="quiet"&&o.runReconOnly&&o.runFails===0&&o.runCount>1){const t=o.runNodes.slice();t.forEach(r=>r.classList.add("fold-out")),window.setTimeout(()=>t.forEach(r=>r.remove()),160);const e=i("div","grouped");e.appendChild(i("span","pipe","│"));const n=x(o.runDuration);e.appendChild(document.createTextNode(" "+w("web.action.actions",o.runCount)+" ✓"+(n?" · "+n:""))),appendTo(liveFeed(),e)}y()}function y(){o.runCount=0,o.runFails=0,o.runReconOnly=!0,o.runNodes=[],o.runDuration=0}
@@ -0,0 +1 @@
1
+ import{el as s}from"../dom.js";import{t as l}from"../i18n.js";import{categoryOf as p,labelOf as c,argText as h,formatMs as u}from"../format.js";import{renderMarkdown as C}from"../../md.js";import{api as m}from"../api.js";import{feedHasContent as r,clearEmpty as g,scrollToBottom as f,activeFeed as k,liveFeed as x,mdOpts as v,buildThinkBlock as w,appendActionsRow as I}from"./core.js";function L(e,o){const a=String(o??"");if(!a.trim())return;const i=C(e,a,v());I(e,i.innerText||i.textContent||"",a)}function T(e,o){const{wrap:a,body:i}=w(!1,!1);i.textContent=o==null?"":String(o),e.appendChild(a)}function A(e,o,a){const i=s("div","act "+p(o.name));i.appendChild(s("span","g","◇")),i.appendChild(s("span","lab",c(o.name)));const d=h(o.args);d&&(i.appendChild(s("span","sep","·")),i.appendChild(s("span","args",d)));const t=s("span","ok","");i.appendChild(t),e.appendChild(i),o.toolCallId&&a.set(o.toolCallId,t)}function H(e,o,a){const i=u(o.duration),d=(o.success?" ✓":" ✗")+(i?" "+i:""),t=o.toolCallId?a.get(o.toolCallId):null;if(t){t.textContent=d,o.success||t.classList.add("fail"),a.delete(o.toolCallId);return}const n=s("div","act "+p(o.tool));n.appendChild(s("span","g","↳")),n.appendChild(s("span","lab",c(o.tool))),n.appendChild(s("span","ok"+(o.success?"":" fail"),d)),e.appendChild(n)}function F(e,o){const a=new Map;o.forEach(i=>{if(!(!i||typeof i.kind!="string"))switch(i.kind){case"user":e.appendChild(s("div","u",i.text||""));break;case"assistant":L(e,i.text||"");break;case"reasoning":T(e,i.text||"");break;case"tool_call":A(e,i,a);break;case"tool_result":H(e,i,a);break;case"plan":i.text&&e.appendChild(s("div","sysline","▸ "+i.text));break;case"context":i.text&&e.appendChild(s("div","detail","↳ "+i.text));break;case"error":e.appendChild(s("div","errline","✗ "+(i.text||"")));break;case"system":i.text&&e.appendChild(s("div","sysline",i.text));break}})}export async function loadHistory(e){if(!e||e.historyLoaded||e.historyLoading)return{gone:!!e.dead};e.historyLoading=!0;const o=s("div","detail",l("web.history.loading"));r(e.feed)||(g(e.feed),e.feed.appendChild(o));const a=await m("/api/sessions/"+encodeURIComponent(e.id)+"/history");if(e.historyLoading=!1,o.remove(),e.historyLoaded=!0,e.historyFailed=!1,!a.ok||!a.data||!Array.isArray(a.data.history))return a.status===404?{gone:!0}:(e.historyFailed=!0,r(e.feed)||e.feed.appendChild(s("div","detail",l("web.history.unavailable"))),{gone:!1});r(e.feed)||(F(e.feed,a.data.history),a.data.history.length||e.feed.appendChild(s("div","detail",l("web.history.empty"))),e.feed===k()?f():e.feed===x()&&f())}
@@ -0,0 +1 @@
1
+ import{planEl as p,planCountEl as f,el as r}from"../dom.js";import{I18N as b,t as x,pluralCount as y}from"../i18n.js";import{feed as u,tabs as v}from"../store.js";import{feedForEvent as E,clearEmpty as I,appendTo as S,activeFeed as k,scroll as A}from"./core.js";function h(t,e){const s=t.status==="done"?"done":t.status==="failed"?"fail":e?"cur":"",n=t.status==="done"?"✓ ":t.status==="failed"?"✗ ":e?"▸ ":"○ ";return{status:s,glyph:n}}export function renderPlan(t){const e=JSON.stringify([t,b.locale]);if(e===u.lastPlanSig)return;if(u.lastPlanSig=e,p.textContent="",!t||!Array.isArray(t.steps)||!t.steps.length){f.textContent="",p.appendChild(r("div","kv dim",x("web.plan.none")));return}const s=t.steps.filter(o=>o.status==="done").length,n=t.steps.length,a=n?Math.round(s/n*100):0;f.textContent=s+" / "+n;const i=r("div","plan-bar"),l=r("span","pbar"),d=r("i");d.style.width=a+"%",l.appendChild(d),i.appendChild(l),i.appendChild(r("span","",a+"%")),p.appendChild(i),t.steps.forEach((o,c)=>{const C=c===t.currentIndex&&o.status!=="done"&&o.status!=="failed",{status:g,glyph:m}=h(o,C);p.appendChild(r("div",("plan-step "+g).trim(),m+o.text))})}export function onPlan(t){const e=E(t&&t.sessionId);if(!e||!t||!Array.isArray(t.steps)||!t.steps.length)return;I(e);const s=v.tabs.find(l=>l.feed===e);let n=s?s.planCard:null;(!n||n.parentNode!==e)&&(n=r("div","planblock"),S(e,n),s&&(s.planCard=n)),n.textContent="";const a=t.steps.length,i=typeof t.currentIndex=="number"?t.currentIndex:-1;n.appendChild(r("div","ph2","◇ "+y("web.plan.heading",a))),t.steps.forEach((l,d)=>{const{status:o,glyph:c}=h(l,d===i);n.appendChild(r("div",("st "+o).trim(),c+l.text))}),e===k()&&A()}
@@ -0,0 +1,3 @@
1
+ import{el as u,link as k}from"../dom.js";import{t as a}from"../i18n.js";import{api as v}from"../api.js";import{feedForEvent as C,clearEmpty as g,appendTo as q,activeFeed as h,scroll as w}from"./core.js";function y(e){const n=String(e).split(`
2
+ `),i=n[n.length-1];return/^\s*\?/.test(i)?String(e):(n[n.length-1]="? "+i,n.join(`
3
+ `))}function A(e,n,i){const t=u("div","q");t.appendChild(u("div","qtext",n));let s=!1;return{block:t,feed:e,settle:(f,b)=>{s||(s=!0,t.classList.add("answered"),t.textContent="",t.appendChild(u("div","qtext",n)),t.appendChild(u("div","qans","↳ "+(String(f||"").trim()||a("web.question.answered")))),v("/api/answer",{method:"POST",body:{id:i,value:b}}),e===h()&&w())},isAnswered:()=>s}}function x(e,n){const i=u("div","qcustom"),t=u("input","qinput");return t.type="text",t.placeholder=n,t.setAttribute("aria-label",n),t.addEventListener("keydown",s=>{if(!(s.isComposing||s.keyCode===229)&&s.key==="Enter"){s.preventDefault();const r=t.value.trim();r&&e.settle(r,r)}}),i.appendChild(t),i.appendChild(k(a("web.question.custom_send"),"",()=>{const s=t.value.trim();s&&e.settle(s,s)})),e.feed===h()&&setTimeout(()=>t.focus(),0),i}function E(e,n,i){const t=!!n.multiple,s=!!n.allowCustom,r=i.map(o=>({label:String(o),raw:null}));s&&r.push({label:a("web.question.custom"),raw:-1});const f=o=>r[o].raw!=null?r[o].raw:o,b=u("div","opts"),p=[];let d=null;r.forEach((o,c)=>{const l=u("button","qopt",c+1+". "+o.label);l.type="button",l.setAttribute("aria-checked","false"),l.addEventListener("click",()=>{if(!e.isAnswered())if(t){const m=p.indexOf(c);m===-1?(p.push(c),l.classList.add("on"),l.setAttribute("aria-checked","true")):(p.splice(m,1),l.classList.remove("on"),l.setAttribute("aria-checked","false")),d&&(d.disabled=p.length===0)}else l.setAttribute("aria-checked","true"),e.settle(o.label,[f(c)])}),b.appendChild(l)}),e.block.appendChild(b),t&&(e.block.appendChild(u("div","qmulti-hint",a("web.question.multi_hint"))),d=u("button","qsend",a("web.question.send")),d.type="button",d.disabled=!0,d.addEventListener("click",()=>{if(e.isAnswered()||!p.length)return;const o=p.slice().sort((c,l)=>c-l);e.settle(o.map(c=>r[c].label).join(", "),o.map(f))}),e.block.appendChild(d))}export function onQuestion(e){if(!e||typeof e.text!="string")return;const n=C(e.sessionId);if(!n)return;g(n);const i=A(n,y(e.text),e.id),t=Array.isArray(e.options)?e.options:[];e.kind==="choice"&&t.length?E(i,e,t):i.block.appendChild(x(i,a("web.question.placeholder"))),q(n,i.block),n===h()&&w()}
@@ -0,0 +1 @@
1
+ import{usageEl as l,envEl as v,wsLine as g,el as i,icon as y}from"../dom.js";import{I18N as k,t as a,pluralCount as x}from"../i18n.js";import{feed as w,settings as S}from"../store.js";import{fmtTokens as m}from"../format.js";import{copyText as U}from"../../md.js";function u(e,n,o){const t=i("div","kv");return t.appendChild(i("span","",e)),t.appendChild(i("b",o||"",n)),t}function E(e,n,o){const t=i("div","bar segbar"),s=e.contextBreakdown;if(!s||typeof s.window!="number"||s.window<=0){const d=i("i");return d.style.width=Math.min(100,Math.round(n/o*100))+"%",t.appendChild(d),t}const c=Math.max(s.window,s.used+s.reserve),r=[["seg-system",s.system],["seg-tools",s.tools],["seg-history",s.history],["seg-reserve",s.reserve],["seg-free",s.free]];for(const[d,p]of r){if(!p||p<=0)continue;const b=i("i",d);b.style.width=p/c*100+"%",t.appendChild(b)}return t}function L(e){const n=i("div","seglegend"),o=e.contextBreakdown;if(!o)return n;const t=[["seg-system","web.usage.part_system",o.system],["seg-tools","web.usage.part_tools",o.tools],["seg-history","web.usage.part_history",o.history],["seg-reserve","web.usage.part_reserve",o.reserve],["seg-free","web.usage.part_free",o.free]];for(const[s,c,r]of t){if(!r||r<=0)continue;const d=i("span","segl-item");d.appendChild(i("i","segl-dot "+s)),d.appendChild(i("span","segl-label",a(c))),d.appendChild(i("b","",m(r))),n.appendChild(d)}return n}function M(e){const n=i("div","kv");n.appendChild(i("span","",a("web.usage.session")));const o=i("span","kv-val");if(!e)o.appendChild(i("b","","—"));else{o.appendChild(i("b","",e));const t=i("button","copy-btn");t.type="button",t.title=a("web.usage.copy_id"),t.setAttribute("aria-label",a("web.usage.copy_id")),t.appendChild(y("copy")),t.addEventListener("click",()=>{U(e).then(s=>{t.replaceChildren(y(s?"check":"copy")),setTimeout(()=>t.replaceChildren(y("copy")),1500)})}),o.appendChild(t)}return n.appendChild(o),n}export function renderUsage(e){const n=S.config||{},o=JSON.stringify([e.sessionId,e.model,e.contextUsed,e.contextLimit,e.cacheHitRate,e.costUsd,e.compactionCount,e.contextQuality,e.contextProbe,e.contextBreakdown,n.model,n.contextWindow,k.locale]);if(o===w.lastUsageSig)return;w.lastUsageSig=o,l.textContent="";const t=e.sessionId?String(e.sessionId):"";l.appendChild(M(t)),l.appendChild(u(a("web.usage.model"),e.model||n.model||"—"));const s=typeof e.contextUsed=="number"?e.contextUsed:null,c=typeof e.contextLimit=="number"?e.contextLimit:n.contextWindow||null;l.appendChild(u(a("web.usage.context"),s!=null&&c?m(s)+" / "+m(c):"—")),s!=null&&c&&(l.appendChild(E(e,s,c)),l.appendChild(L(e)));const r=typeof e.cacheHitRate=="number"?e.cacheHitRate:null;l.appendChild(u(a("web.usage.cache"),r!=null?Math.round(r*100)+"%":"—",r!=null?"":"dim")),l.appendChild(u(a("web.usage.cost"),typeof e.costUsd=="number"?"$"+e.costUsd.toFixed(4):"—")),l.appendChild(u(a("web.usage.compactions"),"⟳ "+(e.compactionCount||0),e.compactionCount?"wn":"dim"));const d=typeof e.contextQuality=="number"?e.contextQuality:null;l.appendChild(u(a("web.usage.quality"),d!=null?Math.round(d)+"%":"—",d!=null?"":"dim"));let p="—",b="dim";const f=e.contextProbe;if(f&&typeof f.actual=="number"){const h=m(f.actual),C=e.contextLimit||n.contextWindow||null;C&&f.actual<C?(p=a("web.usage.probe_low",{actual:h,configured:m(C)}),b="wn"):(p=a("web.usage.probe_loaded",{actual:h}),b="")}l.appendChild(u(a("web.usage.probe"),p,b))}export function renderWorkspace(e){const n=e.workspace||"";if(g.dataset.ws===n||(g.dataset.ws=n,g.textContent="",g.hidden=!n,!n))return;g.appendChild(i("span","ws-k",a("web.env.dir")));const o=i("span","ws-v",n);o.title=n,g.appendChild(o)}function _(e,n){const o=i("div","env-item");return o.appendChild(i("div","env-k",e)),n.forEach(t=>{const s=i("div","env-v",t);s.title=t,o.appendChild(s)}),o}export function renderEnvironment(e){const n=!!(e.instructions&&e.instructions.disabled),o=e.instructions&&!n?e.instructions.files||[]:[],t=e.projectMap||null,s=JSON.stringify([n,o,t,k.locale]);s!==w.lastEnvSig&&(w.lastEnvSig=s,v.textContent="",v.appendChild(_(a("web.env.agents"),n?[a("web.env.agents_disabled")]:o.length?o:[a("web.env.agents_none")])),v.appendChild(_(a("web.env.map"),t&&t.indexed?[[x("web.env.files",t.files),x("web.env.symbols",t.symbols),x("web.env.tokens",t.tokens)].join(" · ")]:[a("web.env.map_not_indexed")])))}
@@ -0,0 +1 @@
1
+ import{msgs as g,el as w,setIcon as k}from"../dom.js";import{t as v}from"../i18n.js";import{feed as t}from"../store.js";import{verbosity as y}from"../format.js";import{mountMarkdown as b}from"../../md.js";import{activeFeed as l,feedForEvent as d,clearBusy as f,clearEmpty as x,flushRun as M,showBusy as R,appendTo as m,scroll as a,mdOpts as A,buildThinkBlock as F}from"./core.js";let s="",c=null,p=!1;function h(){if(p=!1,!s||!t.curMd){s="",c=null;return}const n=s,o=c;s="",c=null,t.curMd.write(n),o&&o===l()&&a()}function L(){p||(p=!0,typeof window<"u"&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame(h):h())}export function finishMd(){h(),t.curMd&&(t.curMd.root.classList.remove("streaming"),t.curMd.end(),t.curMd=null),t.curText=null}export function onText(n,o){const e=d(o);f(e),e&&(x(e),t.curThink&&finishThink(),t.curText==null&&(M(),t.curText="",t.curMd=b(e,A(!0)),t.curMd.root.classList.add("streaming"),t.turnRoots.push(t.curMd.root)),t.curText+=n,t.turnMd+=n,c&&c!==e&&h(),c=e,s+=n,L())}export function finishThink(){if(t.curThink&&(t.curThink.wrap&&t.curThink.wrap.classList.remove("live"),t.curThink.startedAt)){const n=t.curThink.head.querySelector(".dur");n&&(n.textContent="· "+((Date.now()-t.curThink.startedAt)/1e3).toFixed(1)+"s")}t.curThink=null}export function onReasoning(n,o){const e=d(o);if(f(e),!!e){if(x(e),finishMd(),!t.curThink){M();const{wrap:r,head:i,body:u}=F(!0);m(e,r),t.curThink={wrap:r,head:i,body:u,startedAt:Date.now()}}t.curThink.body.textContent+=n,e===l()&&a()}}export function onMeta(n,o,e){if(e==="tool"&&y()==="quiet")return;const r=d(o);f(r);const i=(n||"").trim();if(!r||!i)return;x(r),finishMd();const u=i.indexOf("⚠")!==-1||i.indexOf("✗")!==-1;m(r,w("div",u?"metaln warn":"metaln",i)),r===l()&&a()}export function onRetract(n,o){const e=d(o);if(!e)return;f(e);const r=t.curMd?t.curMd.root:null,i=!!r||t.curText!=null&&t.curText!=="",u=t.curText?t.curText.length:0;if(finishMd(),finishThink(),r){const T=t.turnRoots.indexOf(r);T!==-1&&t.turnRoots.splice(T,1),r.remove()}u>0&&(t.turnMd=t.turnMd.slice(0,Math.max(0,t.turnMd.length-u))),i&&(n&&m(e,w("div","metaln",n)),e===l()&&a())}export function onPhase(n,o){const e=d(o);n==="thinking"?R(e):f(e)}g.addEventListener("click",n=>{const e=n.target.closest(".think-h");if(!e)return;const r=e.nextElementSibling;if(!r)return;const i=r.classList.toggle("hidden");e.setAttribute("aria-expanded",i?"false":"true");const u=e.querySelector(".tog");u&&k(u,i?"chevron-right":"chevron-down",v(i?"web.action.show":"web.action.hide"))});
@@ -0,0 +1,5 @@
1
+ import{el as r,icon as w,announce as g}from"../dom.js";import{t as u,pluralCount as k}from"../i18n.js";import{feed as c,tabs as A,session as C}from"../store.js";import{FILE_TOOLS as x,OPENABLE_TOOLS as F,IMAGE_TOOLS as B,LINK_TOOLS as U,categoryOf as v,labelOf as O,argText as q,formatMs as L,verbosity as b,firstOutputLine as I}from"../format.js";import{copyText as P}from"../../md.js";import{activeFeed as S,liveFeed as j,feedForEvent as h,clearBusy as T,clearEmpty as N,appendTo as a,insertAfter as E,appendActionsRow as D,flushRun as $}from"./core.js";import{finishMd as _,finishThink as M}from"./stream.js";export function onToolStart(e){const n=h(e.sessionId);if(T(n),!n)return;N(n),_(),M(),c.pendingArgs.set(e.toolCallId,e.args||{});const t=r("div","act "+v(e.name));t.appendChild(r("span","g","◇")),t.appendChild(r("span","lab",O(e.name)));const s=q(e.args);s&&(t.appendChild(r("span","sep","·")),t.appendChild(r("span","args",s)));const i=r("span","ok","");t.appendChild(i),t.classList.add("running"),a(n,t),c.toolNodes.set(e.toolCallId,{status:i,line:t}),v(e.name)!=="recon"&&(c.runReconOnly=!1),c.runCount++}function R(e,n){if(typeof n!="string"||!n)return;const t=r("div","toolout"),s=r("div","code");if(s.textContent=n,t.appendChild(s),n.length>600||n.split(`
2
+ `).length>12){t.classList.add("collapsed");const p="▸ "+k("web.tool.output",n.length),l=r("span","more",p);l.addEventListener("click",()=>{const f=t.classList.toggle("collapsed");l.textContent=f?p:"▾ "+u("web.tool.collapse")}),t.appendChild(l)}const o=e&&e.parentNode?null:j();e&&e.parentNode?e.parentNode.insertBefore(t,e.nextSibling):a(o,t)}function G(e){if(typeof e!="string"||!e)return null;try{const n=new URL(e,location.href);if(n.protocol==="http:"||n.protocol==="https:"||n.protocol==="file:")return n.href}catch{return null}return null}function K(e){const n=String(e??"").replace(/\\/g,"/");try{const t=C&&C.host&&C.host.workspace?String(C.host.workspace).replace(/\\/g,"/").replace(/\/+$/,""):"";if(t&&(n===t||n.indexOf(t+"/")===0)){const s=n===t?"":n.slice(t.length+1);if(s)return s}}catch{}return n}function m(e,n,t,s){const i=h(t);if(!i)return null;if(x.indexOf(e)!==-1){const o=n.path||n.file||n.dir;if(!o)return null;const p=K(o),l=r("div","filerow "+v(e));if(l.appendChild(r("span","g","◇")),l.appendChild(r("span","lab",O(e))),l.appendChild(r("span","sep"," · ")),F.indexOf(e)!==-1){const d=r("a","path",p||String(o));d.href="/api/file?path="+encodeURIComponent(String(o)),d.target="_blank",d.rel="noopener noreferrer",d.title=u("web.card.open_title")+" · "+String(o),l.appendChild(d)}else{const d=r("span","tail",p||String(o));d.title=String(o),l.appendChild(d)}const f=r("button","copy-btn");return f.type="button",f.title=u("web.card.copy_title"),f.setAttribute("aria-label",u("web.card.copy_title")),f.appendChild(w("copy")),f.addEventListener("click",()=>{P(String(o)).then(d=>{if(f.replaceChildren(w(d?"check":"copy")),!d){const y=l.querySelector(".st");y&&(y.textContent=" ⚠")}window.setTimeout(()=>f.replaceChildren(w("copy")),1400)})}),l.appendChild(f),l.appendChild(r("span","st",s===!1?" ✗":s===!0?" ✓":"")),s===!1&&(l.dataset.fail="1"),/\.drawio(\.xml)?$/i.test(String(o))&&b()==="verbose"&&l.appendChild(r("span","detail","↳ "+u("web.card.drawio_hint"))),a(i,l),l}if(U.indexOf(e)!==-1&&n.url){const o=r("div","linkline");o.appendChild(document.createTextNode("↳ "));const p=G(n.url);if(p){const l=r("a","",n.url);l.href=p,l.target="_blank",l.rel="noopener noreferrer",o.appendChild(l);try{const f=new URL(p).hostname;f&&o.appendChild(r("span","dom"," · "+f))}catch{}}else o.appendChild(r("span","",n.url));return a(i,o),o}if(B.indexOf(e)!==-1){const o=r("div","imgcard");return o.appendChild(r("div","ph","◧ "+u("web.card.screenshot"))),o.appendChild(r("div","cap",e==="attach_image"?u("web.card.attached_image"):u("web.card.browser_viewport"))),a(i,o),o}return null}export function onToolEnd(e){const n=c.toolNodes.get(e.toolCallId),t=n?n.line:null;if(n){n.line.classList.remove("running");const o=L(e.durationMs);n.status.textContent=e.success?" ✓"+(o?" "+o:""):" ✗"+(o?" "+o:""),e.success||(n.status.classList.add("fail"),c.runFails++,c.runReconOnly=!1)}c.toolNodes.delete(e.toolCallId);const s=c.pendingArgs.get(e.toolCallId)||{};c.pendingArgs.delete(e.toolCallId);const i=s.path||s.file||s.dir;if(x.indexOf(e.name)!==-1&&i){if(t&&t.parentNode&&t.remove(),b()==="quiet"){if(e.success){const p=m(e.name,s,e.sessionId,e.success);p&&c.runNodes.push(p),c.runDuration+=typeof e.durationMs=="number"?e.durationMs:0}else{const p=m(e.name,s,e.sessionId,e.success),l=I(e.output);l&&E(p||t,r("div","detail","↳ "+l)),p&&c.runNodes.push(p)}return}const o=m(e.name,s,e.sessionId,e.success);R(o||t,e.output);return}if(b()==="quiet"){if(e.success){t&&c.runNodes.push(t);const o=m(e.name,s,e.sessionId,e.success);o&&c.runNodes.push(o),c.runDuration+=typeof e.durationMs=="number"?e.durationMs:0}else{const o=I(e.output);o&&E(t,r("div","detail","↳ "+o))}return}e.success&&m(e.name,s,e.sessionId,e.success),R(t,e.output)}export function onTurnEnd(e){C.busy=!1;const n=h(e.sessionId);T(n),M(),_(),$(),c.toolNodes.forEach(i=>{i&&i.line&&n&&i.line.parentNode===n&&i.line.classList.remove("running")});const t=A.tabs.find(i=>i.id===e.sessionId);if(t&&(t.planCard=null),!n){resetTurnText();return}if(e.success===!1)e.interrupted?(a(n,r("div","warnline","⚠ "+u("web.turn.stopped"))),g(u("web.turn.stopped"))):(a(n,r("div","errline","✗ "+u("web.turn.failed"))),g(u("web.turn.failed")));else{const i=[];typeof e.toolCalls=="number"&&e.toolCalls>0&&i.push(u("web.turn.tools",{count:e.toolCalls})),typeof e.durationMs=="number"&&i.push(L(e.durationMs)),i.length&&a(n,r("div","metric","⟡ "+i.join(" · "))),g(u("web.turn.end",{count:e.toolCalls||0}))}const s=c.turnRoots.map(i=>i.innerText||i.textContent||"").join(`
3
+
4
+ `);D(n,s,c.turnMd),resetTurnText()}export function resetTurnText(){c.turnMd="",c.turnRoots=[]}export function onErrorEvent(e){if(!e||!e.error)return;const n=h(e.sessionId);n&&a(n,r("div","errline","✗ "+e.error)),g(String(e.error))}export function onCommandOutput(e,n){const t=h(n)||S();t&&(N(t),String(e).split(`
5
+ `).forEach(s=>a(t,r("div","cmdout",s))))}export function onLog(e){if(!e||typeof e.text!="string"||!e.text||e.diagnostic&&b()!=="verbose")return;const n=h(e.sessionId)||S();if(!n)return;const t=e.level,s=t==="error"?"errline":t==="warn"?"warnline":"detail",i=t==="error"?"✗ ":t==="warn"?"⚠ ":"↳ ",o=r("div",s);o.textContent=i+e.text,a(n,o),(t==="error"||t==="warn")&&g(e.text)}