micro-models-agent 2.16.0 → 2.17.1

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 (427) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/dist/assets/app.js +1 -314
  3. package/dist/assets/hljs.js +5 -1244
  4. package/dist/assets/index.html +11 -0
  5. package/dist/assets/js/api.js +1 -28
  6. package/dist/assets/js/core/menus.js +1 -0
  7. package/dist/assets/js/core/store/feed.js +1 -0
  8. package/dist/assets/js/core/store/index.js +1 -0
  9. package/dist/assets/js/core/store/session.js +1 -0
  10. package/dist/assets/js/core/store/settings.js +1 -0
  11. package/dist/assets/js/core/store/tabs.js +1 -0
  12. package/dist/assets/js/dialog.js +1 -105
  13. package/dist/assets/js/dom.js +1 -178
  14. package/dist/assets/js/feed/core.js +1 -0
  15. package/dist/assets/js/feed/history.js +1 -0
  16. package/dist/assets/js/feed/plan.js +1 -0
  17. package/dist/assets/js/feed/question.js +3 -0
  18. package/dist/assets/js/feed/sidebar.js +1 -0
  19. package/dist/assets/js/feed/stream.js +1 -0
  20. package/dist/assets/js/feed/turn.js +5 -0
  21. package/dist/assets/js/feed.js +1 -1211
  22. package/dist/assets/js/format.js +2 -122
  23. package/dist/assets/js/i18n.js +1 -46
  24. package/dist/assets/js/rail.js +1 -114
  25. package/dist/assets/js/session/cmdk.js +1 -0
  26. package/dist/assets/js/session/composer.js +1 -0
  27. package/dist/assets/js/session/sessions-menu.js +1 -0
  28. package/dist/assets/js/session/tabs.js +1 -0
  29. package/dist/assets/js/settings/controls.js +1 -0
  30. package/dist/assets/js/settings/editors.js +1 -0
  31. package/dist/assets/js/settings/form.js +1 -0
  32. package/dist/assets/js/settings/modal.js +1 -0
  33. package/dist/assets/js/settings/panels.js +1 -0
  34. package/dist/assets/js/settings/providers.js +1 -0
  35. package/dist/assets/js/settings/search.js +1 -0
  36. package/dist/assets/js/settings/subdialog.js +1 -0
  37. package/dist/assets/js/settings/write.js +1 -0
  38. package/dist/assets/js/settings.js +1 -1914
  39. package/dist/assets/js/sidebar/core.js +1 -0
  40. package/dist/assets/js/sidebar/lsp.js +2 -0
  41. package/dist/assets/js/sidebar/map.js +1 -0
  42. package/dist/assets/js/sidebar/state.js +1 -0
  43. package/dist/assets/js/sidebar/trace.js +5 -0
  44. package/dist/assets/js/sidebar.js +1 -705
  45. package/dist/assets/js/store.js +1 -82
  46. package/dist/assets/js/subdialog.js +1 -0
  47. package/dist/assets/md.js +1 -277
  48. package/dist/assets/setup.js +3 -816
  49. package/dist/assets/smd.js +29 -1665
  50. package/dist/assets/styles.css +1 -1592
  51. package/dist/certification/certifications.json +1 -494
  52. package/dist/i18n/en.json +1 -1851
  53. package/dist/i18n/ru.json +1 -1854
  54. package/dist/main.js +815 -55797
  55. package/dist/modules/browser/bridge-server.mjs +2 -252
  56. package/package.json +10 -5
  57. package/dist/assets/js/settings-controls.js +0 -452
  58. package/dist/assets/js/tabs.js +0 -867
  59. package/dist/cli/cache-line.js +0 -31
  60. package/dist/cli/command-suggest.js +0 -39
  61. package/dist/cli/commands.js +0 -781
  62. package/dist/cli/completer.js +0 -268
  63. package/dist/cli/index.js +0 -3
  64. package/dist/cli/json-payload.js +0 -32
  65. package/dist/cli/main.js +0 -346
  66. package/dist/cli/onboarding-commands.js +0 -126
  67. package/dist/cli/plugin-commands.js +0 -38
  68. package/dist/cli/relaunch.js +0 -40
  69. package/dist/cli/repl-commands-lsp.js +0 -75
  70. package/dist/cli/repl-commands-skills.js +0 -105
  71. package/dist/cli/repl-commands.js +0 -1218
  72. package/dist/cli/repl.js +0 -1238
  73. package/dist/cli/run-result.js +0 -38
  74. package/dist/cli/security-commands.js +0 -177
  75. package/dist/cli/setup-order.js +0 -6
  76. package/dist/cli/setup-prompt.js +0 -50
  77. package/dist/cli/setup.js +0 -161
  78. package/dist/cli/web-command.js +0 -98
  79. package/dist/config/budget.js +0 -48
  80. package/dist/config/config.js +0 -345
  81. package/dist/config/defaults.js +0 -197
  82. package/dist/config/domains.js +0 -135
  83. package/dist/config/env.js +0 -46
  84. package/dist/config/experts.js +0 -17
  85. package/dist/config/index.js +0 -5
  86. package/dist/config/paths.js +0 -56
  87. package/dist/config/redact.js +0 -44
  88. package/dist/config/registry-extra.js +0 -334
  89. package/dist/config/registry.js +0 -584
  90. package/dist/config/security.js +0 -212
  91. package/dist/config/timeouts.js +0 -74
  92. package/dist/config/types.js +0 -1
  93. package/dist/config/utils.js +0 -57
  94. package/dist/core/agent/artifact-progress.js +0 -59
  95. package/dist/core/agent/artifact-resolve.js +0 -79
  96. package/dist/core/agent/audit-gate.js +0 -53
  97. package/dist/core/agent/compaction.js +0 -89
  98. package/dist/core/agent/constants.js +0 -90
  99. package/dist/core/agent/context-log.js +0 -454
  100. package/dist/core/agent/context-renderer.js +0 -45
  101. package/dist/core/agent/critic-gate.js +0 -132
  102. package/dist/core/agent/hallucination-gate.js +0 -197
  103. package/dist/core/agent/loop-state.js +0 -68
  104. package/dist/core/agent/prefix-monitor.js +0 -101
  105. package/dist/core/agent/reasoning-resolver.js +0 -65
  106. package/dist/core/agent/token-tracker.js +0 -99
  107. package/dist/core/agent/tool-batch.js +0 -312
  108. package/dist/core/agent/tool-images.js +0 -18
  109. package/dist/core/agent/tool-output.js +0 -116
  110. package/dist/core/agent/tool-pairing.js +0 -60
  111. package/dist/core/agent-moe.js +0 -248
  112. package/dist/core/agent.js +0 -1299
  113. package/dist/core/bootstrap/agent-phase.js +0 -66
  114. package/dist/core/bootstrap/config-phase.js +0 -86
  115. package/dist/core/bootstrap/modules-phase.js +0 -269
  116. package/dist/core/bootstrap/provider-phase.js +0 -183
  117. package/dist/core/bootstrap/session-phase.js +0 -204
  118. package/dist/core/bootstrap/state.js +0 -94
  119. package/dist/core/bootstrap/workspace-phase.js +0 -115
  120. package/dist/core/bootstrap.js +0 -112
  121. package/dist/core/crash-handler.js +0 -62
  122. package/dist/core/environment.js +0 -224
  123. package/dist/core/host-plan.js +0 -43
  124. package/dist/core/host.js +0 -23
  125. package/dist/core/index.js +0 -3
  126. package/dist/core/prompt-builder.js +0 -95
  127. package/dist/core/prompt-overflow.js +0 -306
  128. package/dist/core/session-logger.js +0 -375
  129. package/dist/core/system-prompt.js +0 -117
  130. package/dist/core/types.js +0 -1
  131. package/dist/core/version.js +0 -28
  132. package/dist/core/web-host.js +0 -34
  133. package/dist/core/workspace.js +0 -80
  134. package/dist/i18n/index.js +0 -80
  135. package/dist/index.js +0 -30
  136. package/dist/llm/cache-usage.js +0 -76
  137. package/dist/llm/image-utils.js +0 -138
  138. package/dist/llm/index.js +0 -4
  139. package/dist/llm/llm-errors.js +0 -50
  140. package/dist/llm/model-loader.js +0 -86
  141. package/dist/llm/models-dev.js +0 -121
  142. package/dist/llm/openai-compat.js +0 -756
  143. package/dist/llm/orchestrator.js +0 -294
  144. package/dist/llm/provider-budget.js +0 -68
  145. package/dist/llm/provider-context.js +0 -233
  146. package/dist/llm/provider.js +0 -9
  147. package/dist/llm/response.js +0 -44
  148. package/dist/llm/stream-state.js +0 -26
  149. package/dist/llm/token-counter.js +0 -83
  150. package/dist/llm/types.js +0 -1
  151. package/dist/logger/app-logger.js +0 -212
  152. package/dist/logger/file-log.js +0 -160
  153. package/dist/logger/index.js +0 -2
  154. package/dist/migration/backup.js +0 -56
  155. package/dist/migration/detect.js +0 -61
  156. package/dist/migration/index.js +0 -3
  157. package/dist/modules/artifacts/store.js +0 -62
  158. package/dist/modules/browser/actions.js +0 -79
  159. package/dist/modules/browser/bridge-client.js +0 -203
  160. package/dist/modules/browser/bridge-path.js +0 -10
  161. package/dist/modules/browser/console-buffer.js +0 -37
  162. package/dist/modules/browser/cookie-store.js +0 -29
  163. package/dist/modules/browser/driver-types.js +0 -1
  164. package/dist/modules/browser/driver.js +0 -186
  165. package/dist/modules/browser/index.js +0 -9
  166. package/dist/modules/browser/module.js +0 -30
  167. package/dist/modules/browser/session.js +0 -322
  168. package/dist/modules/browser/snapshot.js +0 -154
  169. package/dist/modules/browser/types.js +0 -13
  170. package/dist/modules/certification/cli.js +0 -264
  171. package/dist/modules/certification/fact-checker.js +0 -90
  172. package/dist/modules/certification/loader.js +0 -127
  173. package/dist/modules/certification/manifest.js +0 -231
  174. package/dist/modules/certification/runner.js +0 -233
  175. package/dist/modules/certification/scenarios.js +0 -586
  176. package/dist/modules/certification/syntax-scenarios.js +0 -50
  177. package/dist/modules/certification/types.js +0 -1
  178. package/dist/modules/context/chunk-query.js +0 -122
  179. package/dist/modules/context/fact-extractor.js +0 -170
  180. package/dist/modules/context/history.js +0 -15
  181. package/dist/modules/context/index.js +0 -2
  182. package/dist/modules/context/manager.js +0 -482
  183. package/dist/modules/critic/client.js +0 -176
  184. package/dist/modules/critic/evidence.js +0 -81
  185. package/dist/modules/critic/provider.js +0 -45
  186. package/dist/modules/critic/tools.js +0 -78
  187. package/dist/modules/critic/types.js +0 -1
  188. package/dist/modules/execution/audit-runners.js +0 -206
  189. package/dist/modules/execution/auditor.js +0 -222
  190. package/dist/modules/execution/execution-plugin.js +0 -478
  191. package/dist/modules/execution/index.js +0 -8
  192. package/dist/modules/execution/input-from.js +0 -70
  193. package/dist/modules/execution/module.js +0 -891
  194. package/dist/modules/execution/moe-executor.js +0 -443
  195. package/dist/modules/execution/plan-actions.js +0 -642
  196. package/dist/modules/execution/plan-checks.js +0 -35
  197. package/dist/modules/execution/plan-coverage.js +0 -71
  198. package/dist/modules/execution/plan-persister.js +0 -46
  199. package/dist/modules/execution/plan-steps.js +0 -31
  200. package/dist/modules/execution/plan-store.js +0 -274
  201. package/dist/modules/execution/plan-tool.js +0 -249
  202. package/dist/modules/execution/plan-validator.js +0 -197
  203. package/dist/modules/execution/planner.js +0 -103
  204. package/dist/modules/execution/stuck-detector.js +0 -834
  205. package/dist/modules/execution/tracker.js +0 -92
  206. package/dist/modules/execution/transient-error.js +0 -30
  207. package/dist/modules/execution/types.js +0 -1
  208. package/dist/modules/execution/verifier.js +0 -343
  209. package/dist/modules/execution/windows-commands.js +0 -52
  210. package/dist/modules/hallucination/artifact-claim.js +0 -93
  211. package/dist/modules/hallucination/confidence.js +0 -81
  212. package/dist/modules/hallucination/consistency.js +0 -37
  213. package/dist/modules/hallucination/detector.js +0 -57
  214. package/dist/modules/hallucination/factual.js +0 -205
  215. package/dist/modules/hallucination/index.js +0 -6
  216. package/dist/modules/hallucination/js-identifiers.js +0 -261
  217. package/dist/modules/hallucination/llm-judge.js +0 -116
  218. package/dist/modules/hallucination/success-claim.js +0 -59
  219. package/dist/modules/index.js +0 -5
  220. package/dist/modules/indexer/cache.js +0 -88
  221. package/dist/modules/indexer/index.js +0 -4
  222. package/dist/modules/indexer/map-command.js +0 -33
  223. package/dist/modules/indexer/map-select.js +0 -87
  224. package/dist/modules/indexer/module.js +0 -293
  225. package/dist/modules/indexer/project-profile.js +0 -184
  226. package/dist/modules/indexer/symbols.js +0 -189
  227. package/dist/modules/indexer/walker.js +0 -285
  228. package/dist/modules/lsp/check-tool.js +0 -61
  229. package/dist/modules/lsp/client.js +0 -406
  230. package/dist/modules/lsp/command.js +0 -53
  231. package/dist/modules/lsp/config.js +0 -189
  232. package/dist/modules/lsp/index.js +0 -4
  233. package/dist/modules/lsp/module.js +0 -295
  234. package/dist/modules/lsp/probe.js +0 -86
  235. package/dist/modules/lsp/project-root.js +0 -69
  236. package/dist/modules/lsp/startup-check.js +0 -154
  237. package/dist/modules/lsp/types.js +0 -1
  238. package/dist/modules/mcp/client.js +0 -445
  239. package/dist/modules/mcp/index.js +0 -4
  240. package/dist/modules/mcp/module.js +0 -295
  241. package/dist/modules/mcp/registry.js +0 -20
  242. package/dist/modules/memory/index.js +0 -2
  243. package/dist/modules/memory/module.js +0 -101
  244. package/dist/modules/memory/search.js +0 -45
  245. package/dist/modules/memory/store.js +0 -107
  246. package/dist/modules/onboarding/init.js +0 -47
  247. package/dist/modules/onboarding/meet.js +0 -30
  248. package/dist/modules/onboarding/mode.js +0 -30
  249. package/dist/modules/onboarding/prompts.js +0 -43
  250. package/dist/modules/pipelines/engine.js +0 -70
  251. package/dist/modules/pipelines/index.js +0 -4
  252. package/dist/modules/pipelines/parser.js +0 -59
  253. package/dist/modules/pipelines/template.js +0 -18
  254. package/dist/modules/plugins/builtin/lint-on-write.js +0 -377
  255. package/dist/modules/plugins/builtin/notify.js +0 -11
  256. package/dist/modules/plugins/index.js +0 -2
  257. package/dist/modules/plugins/loader.js +0 -85
  258. package/dist/modules/plugins/manager.js +0 -244
  259. package/dist/modules/plugins/types.js +0 -1
  260. package/dist/modules/pricing/index.js +0 -70
  261. package/dist/modules/pricing/prices.js +0 -147
  262. package/dist/modules/processes/detect.js +0 -34
  263. package/dist/modules/processes/index.js +0 -4
  264. package/dist/modules/processes/kill-tree.js +0 -52
  265. package/dist/modules/processes/registry.js +0 -294
  266. package/dist/modules/processes/runner.js +0 -23
  267. package/dist/modules/providers/cache.js +0 -23
  268. package/dist/modules/providers/capabilities.js +0 -28
  269. package/dist/modules/providers/create.js +0 -21
  270. package/dist/modules/providers/factory.js +0 -28
  271. package/dist/modules/providers/fallback.js +0 -81
  272. package/dist/modules/providers/health.js +0 -47
  273. package/dist/modules/providers/index.js +0 -6
  274. package/dist/modules/providers/manager.js +0 -207
  275. package/dist/modules/providers/naming.js +0 -15
  276. package/dist/modules/providers/preflight.js +0 -71
  277. package/dist/modules/providers/presets.js +0 -232
  278. package/dist/modules/providers/registry.js +0 -27
  279. package/dist/modules/providers/types.js +0 -1
  280. package/dist/modules/reasoning/policy.js +0 -42
  281. package/dist/modules/reasoning/probe.js +0 -116
  282. package/dist/modules/registry.js +0 -48
  283. package/dist/modules/security/audit-log.js +0 -119
  284. package/dist/modules/security/audit-notifier.js +0 -267
  285. package/dist/modules/security/command-validator.js +0 -272
  286. package/dist/modules/security/content-scanner.js +0 -53
  287. package/dist/modules/security/data-sanitizer.js +0 -82
  288. package/dist/modules/security/encryption.js +0 -216
  289. package/dist/modules/security/index.js +0 -15
  290. package/dist/modules/security/network-validator.js +0 -236
  291. package/dist/modules/security/path-validator.js +0 -261
  292. package/dist/modules/security/protected-paths.js +0 -73
  293. package/dist/modules/security/rate-limiter.js +0 -98
  294. package/dist/modules/security/security-policies.js +0 -499
  295. package/dist/modules/security/session-encryption.js +0 -182
  296. package/dist/modules/security/session-isolation.js +0 -75
  297. package/dist/modules/session/auto-name.js +0 -63
  298. package/dist/modules/session/export.js +0 -98
  299. package/dist/modules/session/index.js +0 -4
  300. package/dist/modules/session/manager.js +0 -234
  301. package/dist/modules/session/module.js +0 -33
  302. package/dist/modules/session/store.js +0 -295
  303. package/dist/modules/session/types.js +0 -1
  304. package/dist/modules/setup/answers.js +0 -35
  305. package/dist/modules/setup/apply.js +0 -79
  306. package/dist/modules/setup/discovery.js +0 -72
  307. package/dist/modules/skills/index.js +0 -3
  308. package/dist/modules/skills/loader.js +0 -86
  309. package/dist/modules/skills/matcher.js +0 -27
  310. package/dist/modules/skills/module.js +0 -141
  311. package/dist/modules/types.js +0 -1
  312. package/dist/modules/updater/changelog-reader.js +0 -93
  313. package/dist/modules/updater/checker.js +0 -101
  314. package/dist/modules/updater/dev-detect.js +0 -18
  315. package/dist/modules/updater/index.js +0 -4
  316. package/dist/modules/updater/module.js +0 -129
  317. package/dist/modules/user-profile/compressor.js +0 -18
  318. package/dist/modules/user-profile/index.js +0 -2
  319. package/dist/modules/user-profile/profile.js +0 -77
  320. package/dist/modules/webui/answer-api.js +0 -29
  321. package/dist/modules/webui/assets.js +0 -50
  322. package/dist/modules/webui/body.js +0 -21
  323. package/dist/modules/webui/commands-settings.js +0 -209
  324. package/dist/modules/webui/commands-shared.js +0 -60
  325. package/dist/modules/webui/commands.js +0 -174
  326. package/dist/modules/webui/config-api.js +0 -134
  327. package/dist/modules/webui/file-api.js +0 -202
  328. package/dist/modules/webui/forward.js +0 -159
  329. package/dist/modules/webui/history-api.js +0 -112
  330. package/dist/modules/webui/host-state.js +0 -60
  331. package/dist/modules/webui/i18n-api.js +0 -9
  332. package/dist/modules/webui/limits.js +0 -6
  333. package/dist/modules/webui/log-forward.js +0 -20
  334. package/dist/modules/webui/memory-commands.js +0 -64
  335. package/dist/modules/webui/model-cache.js +0 -18
  336. package/dist/modules/webui/module.js +0 -148
  337. package/dist/modules/webui/persist.js +0 -24
  338. package/dist/modules/webui/prompt-io.js +0 -97
  339. package/dist/modules/webui/providers-api.js +0 -337
  340. package/dist/modules/webui/providers-view.js +0 -56
  341. package/dist/modules/webui/reasoning-view.js +0 -15
  342. package/dist/modules/webui/run-agent.js +0 -81
  343. package/dist/modules/webui/server.js +0 -284
  344. package/dist/modules/webui/sessions-api.js +0 -178
  345. package/dist/modules/webui/settings-api.js +0 -561
  346. package/dist/modules/webui/setup-api.js +0 -201
  347. package/dist/modules/webui/state.js +0 -74
  348. package/dist/modules/webui/util.js +0 -261
  349. package/dist/output/bus.js +0 -37
  350. package/dist/output/channel.js +0 -285
  351. package/dist/output/format.js +0 -15
  352. package/dist/output/index.js +0 -8
  353. package/dist/output/json-sink.js +0 -24
  354. package/dist/output/machine.js +0 -9
  355. package/dist/output/session-sink.js +0 -27
  356. package/dist/output/types.js +0 -1
  357. package/dist/tools/approve.js +0 -41
  358. package/dist/tools/attach-image.js +0 -102
  359. package/dist/tools/auto-fixer.js +0 -180
  360. package/dist/tools/auto-tags.js +0 -83
  361. package/dist/tools/bash.js +0 -649
  362. package/dist/tools/browser.js +0 -160
  363. package/dist/tools/chunk-query.js +0 -112
  364. package/dist/tools/create-dir.js +0 -60
  365. package/dist/tools/delete-file.js +0 -67
  366. package/dist/tools/download-file.js +0 -142
  367. package/dist/tools/edit-file.js +0 -136
  368. package/dist/tools/enable-tools.js +0 -59
  369. package/dist/tools/executor.js +0 -304
  370. package/dist/tools/file-info.js +0 -49
  371. package/dist/tools/filter-tools.js +0 -17
  372. package/dist/tools/glob-tool.js +0 -37
  373. package/dist/tools/grep-tool.js +0 -142
  374. package/dist/tools/hidden-tools-block.js +0 -37
  375. package/dist/tools/index.js +0 -88
  376. package/dist/tools/list-dir.js +0 -53
  377. package/dist/tools/load-skill.js +0 -51
  378. package/dist/tools/mcp-call.js +0 -80
  379. package/dist/tools/meet-done.js +0 -14
  380. package/dist/tools/move-file.js +0 -94
  381. package/dist/tools/path-utils.js +0 -108
  382. package/dist/tools/pipeline-run.js +0 -167
  383. package/dist/tools/preview.js +0 -2
  384. package/dist/tools/process-ids.js +0 -31
  385. package/dist/tools/process-kill.js +0 -33
  386. package/dist/tools/process-list.js +0 -38
  387. package/dist/tools/process-log.js +0 -49
  388. package/dist/tools/process-wait.js +0 -63
  389. package/dist/tools/prompt-io.js +0 -29
  390. package/dist/tools/question.js +0 -288
  391. package/dist/tools/read-file.js +0 -200
  392. package/dist/tools/recall.js +0 -124
  393. package/dist/tools/registry.js +0 -48
  394. package/dist/tools/remember.js +0 -72
  395. package/dist/tools/scope-check.js +0 -32
  396. package/dist/tools/scope-request.js +0 -96
  397. package/dist/tools/search-history.js +0 -88
  398. package/dist/tools/session-info.js +0 -46
  399. package/dist/tools/set-thinking.js +0 -75
  400. package/dist/tools/subagent.js +0 -257
  401. package/dist/tools/syntax-validator.js +0 -379
  402. package/dist/tools/types.js +0 -1
  403. package/dist/tools/user-input.js +0 -134
  404. package/dist/tools/web-browse.js +0 -93
  405. package/dist/tools/web-fetch.js +0 -108
  406. package/dist/tools/web-search.js +0 -107
  407. package/dist/tools/write-file.js +0 -128
  408. package/dist/ui/action-log.js +0 -13
  409. package/dist/ui/box.js +0 -78
  410. package/dist/ui/colors.js +0 -6
  411. package/dist/ui/diff.js +0 -189
  412. package/dist/ui/index.js +0 -7
  413. package/dist/ui/line-editor.js +0 -1083
  414. package/dist/ui/line-math.js +0 -98
  415. package/dist/ui/md-formatter.js +0 -322
  416. package/dist/ui/output.js +0 -19
  417. package/dist/ui/plan-view.js +0 -109
  418. package/dist/ui/renderer.js +0 -589
  419. package/dist/ui/spinner.js +0 -91
  420. package/dist/ui/table.js +0 -142
  421. package/dist/ui/theme.js +0 -143
  422. package/dist/utils/child-run.js +0 -20
  423. package/dist/utils/error.js +0 -4
  424. package/dist/utils/index.js +0 -6
  425. package/dist/utils/retry.js +0 -17
  426. package/dist/utils/sleep.js +0 -23
  427. package/dist/utils/truncate.js +0 -9
package/CHANGELOG.md CHANGED
@@ -4,16 +4,44 @@ All notable changes to Micro Models Agent (MMA) will be documented in this file.
4
4
 
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/), and this project adheres to [Semantic Versioning](https://semver.org/).
6
6
 
7
+ ## [2.17.0] - 2026-10-02
8
+
9
+ ### Added
10
+
11
+ - **`/lsp doctor`** (`src/cli/repl-commands-lsp.ts`, `src/modules/lsp/diagnose.ts`): per-server diagnosis — applicability, whether the binary is on PATH, whether npx would be used, a real `spawn+initialize` probe, and a **classified reason** (`ok` / `disabled` / `not-applicable` / `binary-missing` / `offline` / `network` / `timeout` / `spawn-failed` / `server-error` / `deadline`) with an actionable hint. Answers "why is LSP dead" instead of leaving it in `app.jsonl`. `LspModule.diagnose(baseDir)` + `diagnoseLspServers`.
12
+ - **Offline mode `MMA_LSP_OFFLINE=1`** (`src/modules/lsp/resolve.ts`, `client.ts`, `config/env.ts`): never invoke npx; only PATH binaries are used, and a server that would need npx fails fast with a clear `offline: <binary> not found in PATH (MMA_LSP_OFFLINE)` message.
13
+ - **Classified failure hints** (`src/modules/lsp/module.ts`): a failed check appends one `hint:` line under `[LSP check failed]` (binary missing / network / offline / spawn / timeout) so the model falls back to the project's own build/test instead of blindly retrying.
14
+ - **`resolve.ts`** — extracted npx→global-binary resolution (`findOnPath`, `resolveNpxLaunch`) shared by the client and the doctor.
15
+ - **Docs**: `docs/agents/tools.md` "LSP in locked-down networks" (PATH binaries, `lsp.servers.<lang>` overrides, registry mirror via `env`, `MMA_LSP_OFFLINE`, classes table).
16
+
7
17
  ## [Unreleased]
8
18
 
19
+ ## [2.17.1] - 2026-10-04
20
+
21
+ ### Changed
22
+
23
+ - **npm package build optimized (internal)**: the CLI bundle externalizes its dependencies (`bun build --packages external`) and the whole `dist` is minified with esbuild (`scripts/optimize-dist.ts`; no source maps, identifier mangling) — package **8.17 MB → 1.73 MB**, `main.js` **7.68 MB → 1.11 MB**. `build:prod` now cleans `dist` first (portable `scripts/clean.ts`), the frontend build skips empty type-only outputs, and nothing is downloaded at runtime (all deps ship via `npm install`). `token-counter.ts` switches to `js-tiktoken/lite` + `cl100k_base` (~1.1 MB vs ~5.6 MB) and `estimateTokens` is recalibrated for cl100k. Spec: `docs/specs/2026-10-04-npm-build-optimization-design.md`.
24
+
25
+ - **WebUI frontend migrated to TypeScript (internal)**: every first-party browser module under `src/modules/webui/assets` is now `.ts` (`app.ts`, `md.ts`, `setup.ts`, `js/**/*.ts`) checked with `strict: true` via a new `tsconfig.frontend.json` (`typecheck:frontend`, added to `quality`); the backend `tsconfig.json` excludes `assets/**`. `loadAssets()` transpiles `.ts` on the fly with `Bun.Transpiler` (dev/tests, no build step), while `scripts/build-frontend.ts` emits ready `.js` into `dist/assets` for `build:prod` (same file names and module graph). `allowJs` remains only for the vendored `smd.js`. No SSE/REST/session/config/plugin/URL contract change. Spec: `docs/specs/2026-10-04-webui-frontend-ts-design.md`; plan: `docs/plans/2026-10-04-webui-frontend-ts.md`.
26
+
27
+ - **Web turns always use a per-session runner** (`src/modules/webui/turns.ts`, `module.ts`, `server.ts`, `state.ts`, `session-pool.ts`): the legacy single-agent bridge path (`hasFactory()` branches, global-FIFO drain, `drainQueueTurn`, `submitLegacy`) is removed. Every `POST /api/message` requires a session and a runner factory (`503 no_session` / `503 no_runner`), runs in that session's slot with per-session queueing, and reuses the same runner path as the parallel executor. SSE is delivered to **every** client (one browser window = several tabs; a background session must stream live); tab routing is client-side (`feedForEvent` by `sessionId`), and `broadcast` no longer auto-stamps `activeSessionId`. The main agent stays for CLI/REPL and host commands/plugins (`Host.submit` is unsupported in web). Tests: `tests/webui-server.test.ts`, `tests/webui-auth.test.ts`, `tests/webui-sse-routing.test.ts`.
28
+
29
+ - **WebUI frontend modularized (phases 5-6, internal)**: largest `assets/js` files split by seam behind barrels - `feed.js` → `feed/{core,sidebar,stream,turn,history,plan,question}.js`, `tabs.js` → `session/{tabs,composer,sessions-menu,cmdk}.js`, `settings.js` → `settings/{write,panels,providers,modal,subdialog,search,form}.js`. Mutual hub↔sibling calls are broken with injected operations (`initComposer`/`initSessionsMenu`/`initCmdk`, `setWriteHooks` for the `postConfig` funnel) so the import graph stays acyclic. The `S` god-object is split into `core/store/{index,feed,tabs,settings,session}.js` slices and removed (consumers import the domain slice). No SSE/REST/session/config/plugin contract change; frontend graph guards (`tests/webui-boundaries.test.ts`, `tests/webui-frontend-graph.test.ts`) plus `bun build app.js` and a JS `tsc` static check gate every split. Plan: `docs/plans/2026-10-02-webui-modularization.md`.
30
+
9
31
  ### Added
10
32
 
33
+ - **LSP setup controls: global toggles + manual-install hints** (`src/modules/lsp/{types,resolve,client,module,probe,startup-check,diagnose}.ts`, `src/config/registry-extra.ts`, `src/modules/webui/{state,module,host-state}.ts`, `src/modules/webui/lsp/lsp-api.ts`, `src/modules/webui/settings/config-api.ts`, `src/cli/repl-commands-lsp.ts`, `assets/js/sidebar/lsp.js`, `assets/js/subdialog.js`, `assets/js/settings/{controls,panels}.js`): the LSP sidebar gains an info button opening a **pop-up** with toggles for **LSP enabled** (`lsp.enabled`) and **offline mode** (`lsp.offline`, only globally installed binaries - env `MMA_LSP_OFFLINE` still overrides) plus per-server **manual install commands** derived from the diagnosis (`npm i -g <packages>`, `rustup component add rust-analyzer`, `go install .../gopls@latest`), shown only for applicable/problem servers. Both toggles are registry keys (work in `/config` and Settings -> Plugins LSP) and hot-apply through `LspModule.setEnabled/setOffline` (no restart); `/lsp doctor` prints the same install commands. Tests: `tests/lsp-module.test.ts`, `tests/modules/lsp/{diagnose,resolve}.test.ts`, `tests/webui-config.test.ts`.
34
+
11
35
  - **Web UI incoming message queue** (`src/modules/webui/state.ts`, `util.ts`, `forward.ts`, `module.ts`, `server.ts`, `run-agent.ts`, `assets/js/tabs.js`): a message sent mid-turn no longer dies on `409 busy` — it queues (`202 {queued: n}`, cap `MAX_QUEUE_LENGTH = 5`, overflow `429 queue_full`) and runs as the next turn on `turn_end`, in order. Drain reuses the single-flight submit path; the queue clears on server stop; `GET /api/state` and SSE `state` carry `queueLen`. The composer stays editable during a turn with a `↳ queued · position N` receipt (`web.input.queued/queue_full`, en+ru; dead `web.input.busy` removed). Docs: `docs/agents/modules.md`. Tests: `tests/webui-server.test.ts`, `tests/webui-auth.test.ts`.
12
36
 
13
37
  - **Web Trace: diagnostics coverage + full model text** (`src/modules/webui/log-api.ts`, `sessions-api.ts`, `forward.ts`, `state.ts`, `module.ts`, `assets/app.js`, `assets/js/sidebar.js`): Trace shows status rows (SSE `meta`), warn/error logs (SSE `log`, minus info-diagnostic chatter), draft retractions, and index start/done/error — plus critic/MoE/compaction/context-probe/usage/audit/claim-retry/output pulled incrementally from `session.jsonl` on every `turn_end` via the new `GET /api/sessions/:id/log` (`?types=&since=&limit=`, field whitelist, secret scrub, no new producers). `turn_end` carries a server `turnSeq`; text details show the full turn text (honest 20K cap instead of a 4K tail slice) with session/turn and a session-log provenance footer (assistant count, iterations, model/tokens). Git ops stay inside `bash` rows (prefix heuristics too fragile). i18n `web.sidebar.trace_*/detail_*` (en+ru). Tests: `tests/webui-log.test.ts`, e2e `web-boot` (Trace panel + index lifecycle).
14
38
 
15
39
  ### Fixed
16
40
 
41
+ - **Web feed crashed at turn end after the store-slice migration** (`assets/js/feed/{core,stream,turn}.js`): the imported `feed` state slice was shadowed by the local `feed` DOM element inside the stream/turn handlers, so `onTurnEnd` threw `TypeError: Cannot read properties of undefined (reading 'forEach')` (and stream/run bookkeeping wrote onto the DOM node). The slice import is now aliased `feedState`. Also made the Playwright e2e harness **hermetic by default** (dummy provider points at a dead port, never a lived-in local LM Studio) and refreshed stale e2e scenarios (select-based provider form, MCP toggle seed, image attach via the real file chooser, reasoning option labels). `bun run test:e2e`: 9 files / 31 tests green.
42
+
43
+ - **Web project-map watcher is now armed** (`src/modules/webui/index-watcher.ts`, `module.ts`, `host-state.ts`): the Map sidebar permanently showed **stale** in `mma web` because the indexer's file watcher was started only by the indexer plugin's `onSessionStart`, which fires from the main agent's `run()` — and web turns run in per-session runners whose plugin manager deliberately excludes the `indexer` plugin. The long-lived web host now owns the shared watcher (`attachIndexWatcher` on `startWebUi`, detached on `stop()`), so the map auto-rebuilds on file changes and **Re-index** no longer looks inert. Tests: `tests/webui-index-watcher.test.ts`.
44
+ - **Web reload no longer replays the system prompt into the chat** (`src/modules/webui/history-api.ts`): `GET /api/sessions/:id/history` mapped `session.jsonl` `system` entries (the `slog.logSystem` copy of the system prompt) and `context` snapshots ("context snapshot at session start") into the transcript, so a page reload painted the whole system prompt as a `sysline` above the conversation. Both types are now dropped like the other internal diagnostics (still available in Trace via `GET /api/sessions/:id/log`); the message-history fallback skips `role: "system"` too. Tests: `tests/webui-history.test.ts`.
17
45
  - **Web file list is always expanded with full root-relative links** (`src/modules/webui/assets/js/feed.js`, `styles.css`): consecutive file rows no longer collapse into an expandable `│ N files` group (its chevron toggle failed to open) — every file tool renders its own `◇ <label> · <full-path-link> [copy] <status>` line, and the link text is the full workspace-relative path (`displayPathFromRoot`, absolute paths stripped by the workspace prefix) instead of basename + dim tail. Consecutive file/action rows are compact (`~4px` via `margin-top: -7px` compensating the `11px` feed gap, `line-height: 1.35`). Group CSS/JS removed. Tests: `tests/webui-assets.test.ts`, `tests/e2e/web-filecard.e2e-test.ts`.
18
46
  - **Web transcript edges and answer separation** (`src/modules/webui/assets/styles.css`): scroll edge fades are glued exactly to the transcript edges — vertical breathing moved from the scroller to `.feed` (sticky pseudos are constrained to the padding-free content box, previously leaving a gap under the header and above the composer) and hidden fades take zero flow space (`-33px` margins neutralizing height + flex gap). Finished assistant answers carry a quiet accent rail (`.feed > .md/.ans`, `border-left: 2px solid var(--accent)`, mirroring the user block) so the result reads instantly apart from the dim tool/think process. Tests: `tests/webui-assets.test.ts`.
19
47
  - **Success-claim no longer vetoed by plan-bookkeeping failures** (`src/modules/hallucination/success-claim.ts`): `checkSuccessClaim` ignores `plan`/`plan_step`/`todo` evidences — their failures police the agent's own notebook (covered by the final audit), never task outcome. Lived-in case (ses_mupgenhq_75f66l, qwen3.5-9b): an honest "tests passed" was retracted over a stale `re-plan` error ("Длина checks должна совпадать"), forcing a same-substance re-answer after the task was done. Tests: `tests/hallucination-success-claim.test.ts`.
@@ -21,6 +49,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/), and this
21
49
  - **Web UI boot was dead on 2.15.0** (`src/modules/webui/assets/js/settings.js`): a stray `}` in `setStaleBar` pushed `return` to top level (`Uncaught SyntaxError: Illegal return statement`), killing the whole `app.js` import graph — blank page, no feed, selectors stuck at `–`. One-line brace fix.
22
50
  - **Web e2e boot smoke** (`tests/e2e/web-boot.e2e-test.ts`): `mma web` boots in a real Chromium with zero console/page errors (live session tab, chrome skeleton, settings modal) and every served JS module in the live `/app.js` import graph answers 200; `web-helpers.launch` now names collected console errors when the feed never boots, so the next broken module fails with its `SyntaxError` in the message instead of a bare timeout.
23
51
 
52
+ ## [2.16.1] - 2026-10-01
53
+
54
+ ### Added
55
+
56
+ - **Smooth streamed-text cascade** (`src/modules/webui/assets/js/feed.js`, `md.js`, `styles.css`): live markdown chunks are buffered and flushed once per animation frame (`requestAnimationFrame`, multi-feed safe) instead of write+scroll per SSE event, and each streamed text run renders in a `span.tk` with a short opacity-only `tkIn` fade (staggered `(n%4)*20ms`, `.15s`). History render and code blocks skip the animation; killed by `prefers-reduced-motion`.
57
+
24
58
  ## [2.16.0] - 2026-10-01
25
59
 
26
60
  ### Added
@@ -1,314 +1 @@
1
- import { msgs, inp, connStatus, setIcon, icon } from "./js/dom.js";
2
- import { api, token } from "./js/api.js";
3
- import { I18N, t, loadI18n } from "./js/i18n.js";
4
- import { S, hooks } from "./js/store.js";
5
- import {
6
- onText, onReasoning, onMeta, onPhase, onToolStart, onToolEnd,
7
- onTurnEnd, onErrorEvent, onCommandOutput, onLog, onPlan, onQuestion,
8
- onRetract,
9
- showEmptyFeed, renderPlan, renderUsage, renderEnvironment, renderWorkspace,
10
- feedHasContent, loadHistory,
11
- } from "./js/feed.js";
12
- import {
13
- openTab, updateTabName, renderSessionsDropdown, reflectBusy, loadSessions,
14
- loadCommands,
15
- } from "./js/tabs.js";
16
- import {
17
- renderSelectors, renderSettings, loadConfig, loadModels, loadProviders,
18
- loadMemory, loadSkills, loadPlugins, applyTheme, currentTheme, applyFontSize, setConnStatus, setStaleBar,
19
- } from "./js/settings.js";
20
- import {
21
- initRail, setPlan as railPlan, railEvent, applyRailI18n,
22
- } from "./js/rail.js";
23
- import {
24
- initSidebar, sidebarSessionChanged, sidebarMapState,
25
- sidebarTraceEvent, sidebarTurnEnd, sidebarBusy, sidebarMapIndicator,
26
- sidebarPullLog,
27
- applySidebarI18n,
28
- } from "./js/sidebar.js";
29
-
30
- document.querySelectorAll("[data-collapse]").forEach((head) => {
31
- const initArrow = head.querySelector(".arrow");
32
- if (initArrow) {
33
- initArrow.textContent = "";
34
- initArrow.appendChild(icon("chevron-down"));
35
- }
36
- head.addEventListener("click", () => {
37
- const body = head.nextElementSibling;
38
- if (!body) return;
39
- const collapsed = body.classList.toggle("collapsed");
40
- head.setAttribute("aria-expanded", collapsed ? "false" : "true");
41
- const arrow = head.querySelector(".arrow");
42
- if (arrow) {
43
- arrow.textContent = "";
44
- arrow.appendChild(icon(collapsed ? "chevron-right" : "chevron-down"));
45
- }
46
- });
47
- });
48
-
49
- // Mobile sidebar: hidden by CSS under 760px, opened as an overlay drawer.
50
- const sidebarBtn = document.getElementById("toggleSidebar");
51
- if (sidebarBtn) {
52
- sidebarBtn.addEventListener("click", () => {
53
- const open = document.body.classList.toggle("sb-open");
54
- sidebarBtn.setAttribute("aria-expanded", open ? "true" : "false");
55
- });
56
- document.addEventListener("keydown", (e) => {
57
- if (e.key !== "Escape" || !document.body.classList.contains("sb-open")) return;
58
- const tag = document.activeElement ? String(document.activeElement.tagName) : "";
59
- if (tag === "TEXTAREA" || tag === "INPUT") return;
60
- document.body.classList.remove("sb-open");
61
- sidebarBtn.setAttribute("aria-expanded", "false");
62
- });
63
- }
64
-
65
- function renderState(snapshot, busy) {
66
- S.state.host = snapshot || {};
67
- S.state.busy = !!busy;
68
- reflectBusy();
69
- const sessionId = S.state.host.sessionId || null;
70
- S.state.activeSessionId = sessionId;
71
- if (sessionId && !S.tabs.some((x) => x.id === sessionId)) {
72
- openTab(sessionId, S.state.host.sessionName || String(sessionId), "session", false);
73
- }
74
- if (sessionId) updateTabName(sessionId, S.state.host.sessionName);
75
- if (!S.tabs.length) showEmptyFeed();
76
- renderPlan(S.state.host.plan);
77
- railPlan(busy && snapshot ? snapshot.plan : null);
78
- renderUsage(S.state.host);
79
- // Late provider auto-detect may change the effective window after boot —
80
- // the snapshot carries it so the topbar follows without a config re-fetch.
81
- if (snapshot && typeof snapshot.contextWindow === "number" && S.state.config &&
82
- S.state.config.contextWindow !== snapshot.contextWindow) {
83
- S.state.config.contextWindow = snapshot.contextWindow;
84
- renderSelectors();
85
- }
86
- renderEnvironment(S.state.host);
87
- sidebarMapState(S.state.host);
88
- sidebarMapIndicator(S.state.host);
89
- sidebarSessionChanged(sessionId);
90
- renderWorkspace(S.state.host);
91
- renderSessionsDropdown();
92
- setStaleBar(!!(snapshot && snapshot.i18nStale));
93
- }
94
-
95
- async function refresh() {
96
- const r = await api("/api/state");
97
- if (!r.ok || !r.data) return;
98
- renderState(r.data.state, r.data.busy);
99
- }
100
-
101
- function resyncAfterReconnect() {
102
- refresh();
103
- const tab = S.tabs.find((x) => x.id === S.activeTabId);
104
- if (tab && tab.kind === "session" && !feedHasContent(tab.feed)) {
105
- tab.historyLoaded = false;
106
- loadHistory(tab);
107
- }
108
- }
109
-
110
- function connectSSE() {
111
- const sseUrl = "/events" + (token ? "?token=" + encodeURIComponent(token) : "");
112
- const es = new EventSource(sseUrl);
113
- let dropped = false;
114
- es.onopen = () => {
115
- if (!dropped) return;
116
- dropped = false;
117
- setConnStatus(false);
118
- resyncAfterReconnect();
119
- };
120
- es.onerror = (e) => {
121
- // A server-sent `event: error` also lands here but carries `data`; only a
122
- // real transport drop has none. Don't flag a live stream as disconnected.
123
- if (e && typeof e.data === "string") return;
124
- dropped = true;
125
- setConnStatus(true);
126
- };
127
- const parse = (e) => {
128
- try {
129
- return JSON.parse(e.data);
130
- } catch (err) {
131
- return null;
132
- }
133
- };
134
- // SSE event → feed handler table. `command`/`state`/`error` need envelope
135
- // checks and stay bespoke below; everything else is `parse → null-guard → call`.
136
- const handlers = [
137
- ["text", (d) => onText(d.chunk || "", d.sessionId)],
138
- ["meta", (d) => onMeta(d.chunk || "", d.sessionId, d.kind)],
139
- ["reasoning", (d) => onReasoning(d.chunk || "", d.sessionId)],
140
- ["phase", (d) => onPhase(d.phase, d.sessionId)],
141
- ["tool_start", onToolStart],
142
- ["tool_end", onToolEnd],
143
- ["plan", onPlan],
144
- ["question", onQuestion],
145
- ["turn_end", (d) => { onTurnEnd(d); sidebarTurnEnd(d.turnSeq); sidebarBusy(false); sidebarPullLog(); }],
146
- ["log", onLog],
147
- ["retract", (d) => onRetract(d.reason || "", d.sessionId)],
148
- ];
149
- for (const [event, fn] of handlers) {
150
- es.addEventListener(event, (e) => {
151
- const d = parse(e);
152
- if (d) fn(d);
153
- });
154
- }
155
- // Activity rail: its own listeners — feed handlers stay untouched.
156
- for (const ev of ["tool_start", "tool_end", "text", "plan"]) {
157
- es.addEventListener(ev, (e) => {
158
- const d = parse(e);
159
- if (!d) return;
160
- if (ev === "plan") railPlan(d);
161
- else railEvent(ev, d.name);
162
- });
163
- }
164
- // Sidebar Trace: live per-session event log. Feed handlers stay untouched.
165
- // Tool/text/phase/plan/question/error stream live; status/log/retract/index
166
- // ride the same SSE bus; critic/MoE/compaction/probe/usage/audit/claim rows
167
- // arrive via the session-log supplement Trace pulls on every turn_end.
168
- for (const ev of ["tool_start", "tool_end", "phase", "plan", "question", "meta", "log", "retract", "index"]) {
169
- es.addEventListener(ev, (e) => { const d = parse(e); if (d) sidebarTraceEvent(ev, d); });
170
- }
171
- es.addEventListener("text", (e) => { const d = parse(e); if (d) sidebarTraceEvent("text", d); });
172
- es.addEventListener("command", (e) => {
173
- const d = parse(e);
174
- if (d && typeof d.text === "string") onCommandOutput(d.text, d.sessionId);
175
- });
176
- es.addEventListener("state", (e) => {
177
- const d = parse(e);
178
- if (d) {
179
- S.state.busy = !!d.busy;
180
- reflectBusy();
181
- sidebarBusy(!!d.busy);
182
- refresh();
183
- if (d.usage && typeof d.usage === "object") {
184
- S.state.host = Object.assign({}, S.state.host, d.usage);
185
- renderUsage(S.state.host);
186
- }
187
- }
188
- });
189
- es.addEventListener("error", (e) => {
190
- if (!e.data) return;
191
- const d = parse(e);
192
- if (d) { onErrorEvent(d); sidebarTraceEvent("error", d); }
193
- });
194
- }
195
-
196
- // Re-apply the dictionary to static chrome after a locale switch. Dynamic
197
- // feeds (tool output, model text) are localized server-side and untouched.
198
- function applyStaticI18n() {
199
- document.documentElement.lang = I18N.locale;
200
- const setText = (id, text) => {
201
- const node = document.getElementById(id);
202
- if (node) node.textContent = text;
203
- };
204
- setText("planHeaderLabel", t("web.sidebar.plan"));
205
- setText("usageHeaderLabel", t("web.sidebar.session") + " · " + t("web.sidebar.usage"));
206
- setText("envHeaderLabel", t("web.sidebar.env"));
207
- setText("settingsTitle", t("web.settings.title"));
208
- setText("sessActiveHeader", t("web.sessions.active"));
209
- setText("sessRecentHeader", t("web.sessions.recent"));
210
- setText("hintEnter", t("web.input.enter"));
211
- setText("hintShift", t("web.input.shift_enter"));
212
- setText("hintEsc", t("web.input.esc"));
213
- setText("hintAttach", t("web.input.attach"));
214
-
215
- // Chrome controls: Lucide icon + label, plus matching title/aria-label.
216
- const controls = {
217
- newChat: ["plus", t("web.topbar.new_chat")],
218
- sessBtn: ["menu", t("web.topbar.all_sessions")],
219
- toggleSidebar: ["panel", t("web.topbar.sidebar")],
220
- openSettings: ["settings", t("web.topbar.settings")],
221
- attachBtn: ["image", t("web.attach.title")],
222
- closeSettings: ["x", t("web.topbar.close")],
223
- sessNew: ["plus", t("web.sessions.new")],
224
- sessRefresh: ["refresh", t("web.sessions.refresh")],
225
- sessPrev: ["chevron-left", t("web.sessbar.prev")],
226
- sessNext: ["chevron-right", t("web.sessbar.next")],
227
- sessClose: ["x", t("web.topbar.close")],
228
- };
229
- Object.keys(controls).forEach((id) => {
230
- const node = document.getElementById(id);
231
- if (!node) return;
232
- const [name, label] = controls[id];
233
- // Text-bearing buttons keep their label; icon-only ones don't add one.
234
- const withLabel = id === "closeSettings" || id === "sessNew" || id === "sessRefresh";
235
- setIcon(node, name, withLabel ? label : null);
236
- node.title = label;
237
- node.setAttribute("aria-label", label);
238
- });
239
- const settingsIcon = document.getElementById("settingsIcon");
240
- if (settingsIcon) setIcon(settingsIcon, "settings", null);
241
- if (inp) {
242
- inp.placeholder = t("web.input.placeholder");
243
- inp.setAttribute("aria-label", t("web.input.placeholder"));
244
- }
245
-
246
- document.querySelectorAll("#setMenu .mi").forEach((mi) => {
247
- const p = mi.dataset.p;
248
- if (p) mi.textContent = t("web.settings." + p);
249
- });
250
- const settingsSearch = document.getElementById("setSearch");
251
- if (settingsSearch) {
252
- settingsSearch.placeholder = t("web.settings.search_placeholder");
253
- settingsSearch.setAttribute("aria-label", t("web.settings.search_placeholder"));
254
- }
255
- document.querySelectorAll(".content-col .panel").forEach((panel) => {
256
- const h3 = panel.querySelector("h3");
257
- const name = panel.id.replace(/^p-/, "");
258
- if (h3 && name) h3.textContent = t("web.settings." + name);
259
- });
260
-
261
- renderSelectors();
262
- renderSessionsDropdown();
263
- applyRailI18n();
264
- applySidebarI18n();
265
- if (msgs.querySelector(".empty")) showEmptyFeed();
266
- if (connStatus && !connStatus.hidden) setConnStatus(true);
267
- setStaleBar(undefined, true);
268
- }
269
-
270
- async function boot() {
271
- // Read the requested session before `showEmptyFeed()` → `syncUrl()` can strip it.
272
- const initialSession = new URLSearchParams(location.search).get("session");
273
- // First-run wizard owns the screen when the server reports a virgin config;
274
- // it reloads the page once setup completes, so skip the chat boot entirely.
275
- if (window.MmaSetup) {
276
- try {
277
- if (await window.MmaSetup.maybeOpen()) return;
278
- } catch (err) {
279
- /* wizard failure must never brick the chat boot */
280
- }
281
- }
282
- await loadI18n();
283
- await loadCommands();
284
- applyTheme(currentTheme());
285
- applyFontSize();
286
- applyStaticI18n();
287
- showEmptyFeed();
288
- renderSelectors();
289
- renderSettings();
290
- await loadConfig();
291
- initRail(S.state.config && S.state.config.ui ? S.state.config.ui.activityRail : undefined);
292
- initSidebar();
293
- applySidebarI18n();
294
- await loadModels();
295
- await loadProviders();
296
- await loadSessions();
297
- await loadMemory();
298
- await loadSkills();
299
- await loadPlugins();
300
- await refresh();
301
- // Restore the session from the URL AFTER the first refresh: `renderState`
302
- // may auto-open the server's active session, and the requested one must win.
303
- if (initialSession) {
304
- const meta = S.state.sessions.find((s) => s.id === initialSession);
305
- if (meta) openTab(initialSession, meta.name || String(initialSession), "session", true);
306
- }
307
- connectSSE();
308
- setInterval(refresh, 2000);
309
- setInterval(loadSessions, 15000);
310
- }
311
-
312
- hooks.applyStaticI18n = applyStaticI18n;
313
-
314
- boot();
1
+ import{msgs as U,inp as m,connStatus as E,setIcon as L,icon as x}from"./js/dom.js";import{api as W,token as T}from"./js/api.js";import{I18N as j,t as o,loadI18n as F}from"./js/i18n.js";import{tabs as u,session as i,settings as f,hooks as h}from"./js/store.js";import{onText as z,onReasoning as D,onMeta as J,onPhase as Q,onToolStart as X,onToolEnd as G,onTurnEnd as K,onErrorEvent as V,onCommandOutput as Y,onLog as Z,onPlan as $,onQuestion as ee,onRetract as te,showEmptyFeed as w,renderPlan as ne,renderUsage as k,renderEnvironment as se,renderWorkspace as oe,feedHasContent as ie,loadHistory as ae}from"./js/feed.js";import{openTab as C,updateTabName as re,renderSessionsDropdown as A,reflectBusy as q,loadSessions as _,loadCommands as de,setTabStatus as p,reconcileTabStatuses as R}from"./js/session/tabs.js";import{renderSelectors as S,renderSettings as ce,loadConfig as le,loadModels as ue,loadProviders as fe,loadMemory as be,loadSkills as pe,loadPlugins as ge,applyTheme as me,currentTheme as he,applyFontSize as we,setConnStatus as I,setStaleBar as B}from"./js/settings.js";import{initRail as Se,setPlan as P,railEvent as Ie,applyRailI18n as ve}from"./js/rail.js";import{initSidebar as ye,sidebarSessionChanged as Ee,sidebarMapState as Le,sidebarTraceEvent as v,sidebarTurnEnd as xe,sidebarBusy as N,sidebarMapIndicator as Te,sidebarPullLog as ke,sidebarSessionId as Ce,setSessionLoading as Ae,sidebarLspState as qe,sidebarLspEvent as _e,applySidebarI18n as M}from"./js/sidebar.js";document.querySelectorAll("[data-collapse]").forEach(n=>{const s=n.querySelector(".arrow");s&&(s.textContent="",s.appendChild(x("chevron-down"))),n.addEventListener("click",()=>{const r=n.nextElementSibling;if(!r)return;const a=r.classList.toggle("collapsed");n.setAttribute("aria-expanded",a?"false":"true");const d=n.querySelector(".arrow");d&&(d.textContent="",d.appendChild(x(a?"chevron-right":"chevron-down")))})});const g=document.getElementById("toggleSidebar");g&&(g.addEventListener("click",()=>{const n=document.body.classList.toggle("sb-open");g.setAttribute("aria-expanded",n?"true":"false")}),document.addEventListener("keydown",n=>{if(n.key!=="Escape"||!document.body.classList.contains("sb-open"))return;const s=document.activeElement?String(document.activeElement.tagName):"";s==="TEXTAREA"||s==="INPUT"||(document.body.classList.remove("sb-open"),g.setAttribute("aria-expanded","false"))}));function H(n,s,r){i.host=n||{},i.busy=!!s,i.runningSessionId=r&&r.runningSessionId||null,i.runningSessionIds=r&&r.runningSessionIds||(i.runningSessionId?[i.runningSessionId]:[]),i.queued=r&&r.queued||{},q(),R();const a=i.host.sessionId||null;i.activeSessionId=a,a&&!u.tabs.some(d=>d.id===a)&&C(a,i.host.sessionName||String(a),"session",!1),a&&re(a,i.host.sessionName),u.tabs.length||w(),ne(i.host.plan),P(s&&n?n.plan:null),k(i.host),n&&typeof n.contextWindow=="number"&&f.config&&f.config.contextWindow!==n.contextWindow&&(f.config.contextWindow=n.contextWindow,S()),se(i.host),Le(i.host),Te(i.host),qe(),Ee(a),oe(i.host),A(),Ae(!1),B(!!(n&&n.i18nStale))}async function b(){const n=u.activeTabId,s=n?"/api/state?session="+encodeURIComponent(n):"/api/state",r=await W(s);!r.ok||!r.data||u.activeTabId===n&&H(r.data.state||{},r.data.busy,r.data)}h.applyState=H,h.refreshState=b;function Re(){b();const n=u.tabs.find(s=>s.id===u.activeTabId);n&&n.kind==="session"&&!ie(n.feed)&&(n.historyLoaded=!1,ae(n))}function Be(){const n="/events"+(T?"?token="+encodeURIComponent(T):""),s=new EventSource(n);let r=!1;s.onopen=()=>{r&&(r=!1,I(!1),Re())},s.onerror=e=>{e&&typeof e.data=="string"||(r=!0,I(!0))};const a=e=>{try{return JSON.parse(e.data)}catch{return null}},d=e=>!e.sessionId||e.sessionId===Ce(),c=[["text",e=>z(e.chunk||"",e.sessionId)],["meta",e=>J(e.chunk||"",e.sessionId,e.kind)],["reasoning",e=>D(e.chunk||"",e.sessionId)],["phase",e=>Q(e.phase,e.sessionId)],["tool_start",X],["tool_end",G],["plan",$],["question",ee],["turn_end",e=>{K(e),d(e)&&(xe(e.turnSeq),N(!1),ke())}],["log",Z],["retract",e=>te(e.reason||"",e.sessionId)]];for(const[e,t]of c)s.addEventListener(e,l=>{const y=a(l);y&&t(y)});for(const e of["tool_start","tool_end","text","plan"])s.addEventListener(e,t=>{const l=a(t);l&&(e==="plan"?P(l):Ie(e,l.name))});for(const e of["text","reasoning","phase","tool_start","plan"])s.addEventListener(e,t=>{const l=a(t);l&&l.sessionId&&p(l.sessionId,"working")});s.addEventListener("question",e=>{const t=a(e);t&&t.sessionId&&p(t.sessionId,"waiting")}),s.addEventListener("turn_end",e=>{const t=a(e);t&&t.sessionId&&p(t.sessionId,t.success===!1?"failed":"idle")});for(const e of["tool_start","tool_end","phase","plan","question","meta","log","retract","index"])s.addEventListener(e,t=>{const l=a(t);l&&d(l)&&v(e,l)});s.addEventListener("text",e=>{const t=a(e);t&&d(t)&&v("text",t)}),s.addEventListener("lsp",e=>{const t=a(e);t&&_e(t)}),s.addEventListener("command",e=>{const t=a(e);t&&typeof t.text=="string"&&Y(t.text,t.sessionId)}),s.addEventListener("state",e=>{const t=a(e);t&&(i.busy=!!t.busy,i.runningSessionId=t.runningSessionId||null,i.runningSessionIds=t.runningSessionIds||(i.runningSessionId?[i.runningSessionId]:[]),i.queued=t.queued||{},q(),R(),N(!!t.busy),b(),t.usage&&typeof t.usage=="object"&&(t.usageSessionId==null||t.usageSessionId===i.activeSessionId)&&(i.host=Object.assign({},i.host,t.usage),k(i.host)))}),s.addEventListener("error",e=>{if(!e.data)return;const t=a(e);t&&(t.sessionId&&p(t.sessionId,"failed"),V(t),v("error",t))})}function O(){document.documentElement.lang=j.locale;const n=(d,c)=>{const e=document.getElementById(d);e&&(e.textContent=c)};n("planHeaderLabel",o("web.sidebar.plan")),n("usageHeaderLabel",o("web.sidebar.session")+" · "+o("web.sidebar.usage")),n("envHeaderLabel",o("web.sidebar.env")),n("settingsTitle",o("web.settings.title")),n("sessActiveHeader",o("web.sessions.active")),n("sessRecentHeader",o("web.sessions.recent")),n("hintEnter",o("web.input.enter")),n("hintShift",o("web.input.shift_enter")),n("hintEsc",o("web.input.esc")),n("hintAttach",o("web.input.attach"));const s={newChat:["plus",o("web.topbar.new_chat")],sessBtn:["menu",o("web.topbar.all_sessions")],toggleSidebar:["panel",o("web.topbar.sidebar")],openSettings:["settings",o("web.topbar.settings")],attachBtn:["image",o("web.attach.title")],closeSettings:["x",o("web.topbar.close")],sessNew:["plus",o("web.sessions.new")],sessRefresh:["refresh",o("web.sessions.refresh")],sessPrev:["chevron-left",o("web.sessbar.prev")],sessNext:["chevron-right",o("web.sessbar.next")],sessClose:["x",o("web.topbar.close")]};Object.keys(s).forEach(d=>{const c=document.getElementById(d);if(!c)return;const[e,t]=s[d];L(c,e,d==="closeSettings"||d==="sessNew"||d==="sessRefresh"?t:null),c.title=t,c.setAttribute("aria-label",t)});const r=document.getElementById("settingsIcon");r&&L(r,"settings",null),m&&(m.placeholder=o("web.input.placeholder"),m.setAttribute("aria-label",o("web.input.placeholder"))),document.querySelectorAll("#setMenu .mi").forEach(d=>{const c=d.dataset.p;c&&(d.textContent=o("web.settings."+c))});const a=document.getElementById("setSearch");a&&(a.setAttribute("placeholder",o("web.settings.search_placeholder")),a.setAttribute("aria-label",o("web.settings.search_placeholder"))),document.querySelectorAll(".content-col .panel").forEach(d=>{const c=d.querySelector("h3"),e=d.id.replace(/^p-/,"");c&&e&&(c.textContent=o("web.settings."+e))}),S(),A(),ve(),M(),U.querySelector(".empty")&&w(),E&&!E.hidden&&I(!0),B(void 0,!0)}async function Pe(){const n=new URLSearchParams(location.search).get("session");if(window.MmaSetup)try{if(await window.MmaSetup.maybeOpen())return}catch{}await F(),await de(),me(he()),we(),O(),w(),S(),ce(),await le(),Se(f.config&&f.config.ui?f.config.ui.activityRail:void 0),ye(),M(),await ue(),await fe(),await _(),await be(),await pe(),await ge();try{await b()}catch(s){console.error("initial refresh failed",s)}if(n){const s=i.sessions.find(r=>r.id===n);s&&C(n,s.name||String(n),"session",!0)}Be(),setInterval(()=>{b().catch(s=>console.error("refresh failed",s))},2e3),setInterval(()=>{_()},15e3)}h.applyStaticI18n=O,Pe();