@rien7/seji 0.0.0-stage → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (413) hide show
  1. package/bin/design-surface.mjs +6 -0
  2. package/bin/postinstall.mjs +19 -0
  3. package/bin/seji.mjs +573 -0
  4. package/dist/agent/host.d.mts +34 -0
  5. package/dist/agent/host.mjs +387 -0
  6. package/dist/agent/messages.d.mts +9 -0
  7. package/dist/agent/messages.mjs +70 -0
  8. package/dist/agent/runtimes.mjs +157 -0
  9. package/dist/cli/app.mjs +321 -0
  10. package/dist/cli/appScan.mjs +284 -0
  11. package/dist/cli/catalog.mjs +78 -0
  12. package/dist/cli/component.mjs +165 -0
  13. package/dist/cli/consolidate.mjs +159 -0
  14. package/dist/cli/cssImport.mjs +68 -0
  15. package/dist/cli/dev.mjs +335 -0
  16. package/dist/cli/doctor.mjs +306 -0
  17. package/dist/cli/init.mjs +338 -0
  18. package/dist/cli/legacyNames.mjs +266 -0
  19. package/dist/cli/migrate.mjs +163 -0
  20. package/dist/cli/prompt.mjs +34 -0
  21. package/dist/cli/propose.mjs +208 -0
  22. package/dist/cli/providers.mjs +344 -0
  23. package/dist/cli/reviewOps.mjs +110 -0
  24. package/dist/cli/semver.mjs +45 -0
  25. package/dist/cli/setup.mjs +357 -0
  26. package/dist/cli/sketches.mjs +47 -0
  27. package/dist/cli/skills.mjs +150 -0
  28. package/dist/cli/snapshot.mjs +107 -0
  29. package/dist/cli/tokenOps.mjs +120 -0
  30. package/dist/cli/types.mjs +191 -0
  31. package/dist/cli/updater.mjs +274 -0
  32. package/dist/components/astIndex.mjs +992 -0
  33. package/dist/components/ops.mjs +1069 -0
  34. package/dist/editor/AgentProposalCard.d.ts +10 -0
  35. package/dist/editor/AgentProposalCard.d.ts.map +1 -0
  36. package/dist/editor/AgentProposalCard.js +31 -0
  37. package/dist/editor/AgentProposalCard.js.map +1 -0
  38. package/dist/editor/App.d.ts +2 -0
  39. package/dist/editor/App.d.ts.map +1 -0
  40. package/dist/editor/App.js +2832 -0
  41. package/dist/editor/App.js.map +1 -0
  42. package/dist/editor/CanvasHud.d.ts +12 -0
  43. package/dist/editor/CanvasHud.d.ts.map +1 -0
  44. package/dist/editor/CanvasHud.js +13 -0
  45. package/dist/editor/CanvasHud.js.map +1 -0
  46. package/dist/editor/CanvasSurface.d.ts +31 -0
  47. package/dist/editor/CanvasSurface.d.ts.map +1 -0
  48. package/dist/editor/CanvasSurface.js +270 -0
  49. package/dist/editor/CanvasSurface.js.map +1 -0
  50. package/dist/editor/CommentPopover.d.ts +17 -0
  51. package/dist/editor/CommentPopover.d.ts.map +1 -0
  52. package/dist/editor/CommentPopover.js +62 -0
  53. package/dist/editor/CommentPopover.js.map +1 -0
  54. package/dist/editor/Comments.d.ts +13 -0
  55. package/dist/editor/Comments.d.ts.map +1 -0
  56. package/dist/editor/Comments.js +41 -0
  57. package/dist/editor/Comments.js.map +1 -0
  58. package/dist/editor/ComponentPage.d.ts +28 -0
  59. package/dist/editor/ComponentPage.d.ts.map +1 -0
  60. package/dist/editor/ComponentPage.js +55 -0
  61. package/dist/editor/ComponentPage.js.map +1 -0
  62. package/dist/editor/ComponentPanel.d.ts +38 -0
  63. package/dist/editor/ComponentPanel.d.ts.map +1 -0
  64. package/dist/editor/ComponentPanel.js +275 -0
  65. package/dist/editor/ComponentPanel.js.map +1 -0
  66. package/dist/editor/Glyph.d.ts +51 -0
  67. package/dist/editor/Glyph.d.ts.map +1 -0
  68. package/dist/editor/Glyph.js +50 -0
  69. package/dist/editor/Glyph.js.map +1 -0
  70. package/dist/editor/History.d.ts +7 -0
  71. package/dist/editor/History.d.ts.map +1 -0
  72. package/dist/editor/History.js +51 -0
  73. package/dist/editor/History.js.map +1 -0
  74. package/dist/editor/Inspector.d.ts +56 -0
  75. package/dist/editor/Inspector.d.ts.map +1 -0
  76. package/dist/editor/Inspector.js +510 -0
  77. package/dist/editor/Inspector.js.map +1 -0
  78. package/dist/editor/LazyMount.d.ts +10 -0
  79. package/dist/editor/LazyMount.d.ts.map +1 -0
  80. package/dist/editor/LazyMount.js +29 -0
  81. package/dist/editor/LazyMount.js.map +1 -0
  82. package/dist/editor/LocaleSwitch.d.ts +3 -0
  83. package/dist/editor/LocaleSwitch.d.ts.map +1 -0
  84. package/dist/editor/LocaleSwitch.js +9 -0
  85. package/dist/editor/LocaleSwitch.js.map +1 -0
  86. package/dist/editor/PreviewFrame.d.ts +10 -0
  87. package/dist/editor/PreviewFrame.d.ts.map +1 -0
  88. package/dist/editor/PreviewFrame.js +22 -0
  89. package/dist/editor/PreviewFrame.js.map +1 -0
  90. package/dist/editor/ProjectIndex.d.ts +12 -0
  91. package/dist/editor/ProjectIndex.d.ts.map +1 -0
  92. package/dist/editor/ProjectIndex.js +43 -0
  93. package/dist/editor/ProjectIndex.js.map +1 -0
  94. package/dist/editor/PromoteComponent.d.ts +28 -0
  95. package/dist/editor/PromoteComponent.d.ts.map +1 -0
  96. package/dist/editor/PromoteComponent.js +33 -0
  97. package/dist/editor/PromoteComponent.js.map +1 -0
  98. package/dist/editor/PromoteForm.d.ts +18 -0
  99. package/dist/editor/PromoteForm.d.ts.map +1 -0
  100. package/dist/editor/PromoteForm.js +35 -0
  101. package/dist/editor/PromoteForm.js.map +1 -0
  102. package/dist/editor/PromoteToken.d.ts +31 -0
  103. package/dist/editor/PromoteToken.d.ts.map +1 -0
  104. package/dist/editor/PromoteToken.js +94 -0
  105. package/dist/editor/PromoteToken.js.map +1 -0
  106. package/dist/editor/StatePreviews.d.ts +28 -0
  107. package/dist/editor/StatePreviews.d.ts.map +1 -0
  108. package/dist/editor/StatePreviews.js +113 -0
  109. package/dist/editor/StatePreviews.js.map +1 -0
  110. package/dist/editor/ValueCombo.d.ts +51 -0
  111. package/dist/editor/ValueCombo.d.ts.map +1 -0
  112. package/dist/editor/ValueCombo.js +260 -0
  113. package/dist/editor/ValueCombo.js.map +1 -0
  114. package/dist/editor/agent/AgentPanel.d.ts +19 -0
  115. package/dist/editor/agent/AgentPanel.d.ts.map +1 -0
  116. package/dist/editor/agent/AgentPanel.js +271 -0
  117. package/dist/editor/agent/AgentPanel.js.map +1 -0
  118. package/dist/editor/agent/Markdown.d.ts +5 -0
  119. package/dist/editor/agent/Markdown.d.ts.map +1 -0
  120. package/dist/editor/agent/Markdown.js +28 -0
  121. package/dist/editor/agent/Markdown.js.map +1 -0
  122. package/dist/editor/agent/agentApi.d.ts +106 -0
  123. package/dist/editor/agent/agentApi.d.ts.map +1 -0
  124. package/dist/editor/agent/agentApi.js +66 -0
  125. package/dist/editor/agent/agentApi.js.map +1 -0
  126. package/dist/editor/agent/toolLines.d.ts +38 -0
  127. package/dist/editor/agent/toolLines.d.ts.map +1 -0
  128. package/dist/editor/agent/toolLines.js +159 -0
  129. package/dist/editor/agent/toolLines.js.map +1 -0
  130. package/dist/editor/agent/useAgent.d.ts +15 -0
  131. package/dist/editor/agent/useAgent.d.ts.map +1 -0
  132. package/dist/editor/agent/useAgent.js +65 -0
  133. package/dist/editor/agent/useAgent.js.map +1 -0
  134. package/dist/editor/api.d.ts +378 -0
  135. package/dist/editor/api.d.ts.map +1 -0
  136. package/dist/editor/api.js +247 -0
  137. package/dist/editor/api.js.map +1 -0
  138. package/dist/editor/camera.d.ts +18 -0
  139. package/dist/editor/camera.d.ts.map +1 -0
  140. package/dist/editor/camera.js +40 -0
  141. package/dist/editor/camera.js.map +1 -0
  142. package/dist/editor/canvas.d.ts +25 -0
  143. package/dist/editor/canvas.d.ts.map +1 -0
  144. package/dist/editor/canvas.js +35 -0
  145. package/dist/editor/canvas.js.map +1 -0
  146. package/dist/editor/changes/ChangesPage.d.ts +25 -0
  147. package/dist/editor/changes/ChangesPage.d.ts.map +1 -0
  148. package/dist/editor/changes/ChangesPage.js +132 -0
  149. package/dist/editor/changes/ChangesPage.js.map +1 -0
  150. package/dist/editor/changes/changeModel.d.ts +25 -0
  151. package/dist/editor/changes/changeModel.d.ts.map +1 -0
  152. package/dist/editor/changes/changeModel.js +81 -0
  153. package/dist/editor/changes/changeModel.js.map +1 -0
  154. package/dist/editor/changes/changeState.d.mts +29 -0
  155. package/dist/editor/changes/changeState.mjs +187 -0
  156. package/dist/editor/chrome/EditorChrome.d.ts +49 -0
  157. package/dist/editor/chrome/EditorChrome.d.ts.map +1 -0
  158. package/dist/editor/chrome/EditorChrome.js +21 -0
  159. package/dist/editor/chrome/EditorChrome.js.map +1 -0
  160. package/dist/editor/drafts.d.ts +46 -0
  161. package/dist/editor/drafts.d.ts.map +1 -0
  162. package/dist/editor/drafts.js +38 -0
  163. package/dist/editor/drafts.js.map +1 -0
  164. package/dist/editor/i18n.d.ts +29 -0
  165. package/dist/editor/i18n.d.ts.map +1 -0
  166. package/dist/editor/i18n.js +2320 -0
  167. package/dist/editor/i18n.js.map +1 -0
  168. package/dist/editor/iconStroke.d.ts +6 -0
  169. package/dist/editor/iconStroke.d.ts.map +1 -0
  170. package/dist/editor/iconStroke.js +6 -0
  171. package/dist/editor/iconStroke.js.map +1 -0
  172. package/dist/editor/main.d.ts +2 -0
  173. package/dist/editor/main.d.ts.map +1 -0
  174. package/dist/editor/main.js +14 -0
  175. package/dist/editor/main.js.map +1 -0
  176. package/dist/editor/model.d.ts +16 -0
  177. package/dist/editor/model.d.ts.map +1 -0
  178. package/dist/editor/model.js +11 -0
  179. package/dist/editor/model.js.map +1 -0
  180. package/dist/editor/reasons.d.ts +44 -0
  181. package/dist/editor/reasons.d.ts.map +1 -0
  182. package/dist/editor/reasons.js +131 -0
  183. package/dist/editor/reasons.js.map +1 -0
  184. package/dist/editor/reviewLifecycle.d.ts +8 -0
  185. package/dist/editor/reviewLifecycle.d.ts.map +1 -0
  186. package/dist/editor/reviewLifecycle.js +21 -0
  187. package/dist/editor/reviewLifecycle.js.map +1 -0
  188. package/dist/editor/styles.css +8737 -0
  189. package/dist/editor/tokenMatch.d.ts +59 -0
  190. package/dist/editor/tokenMatch.d.ts.map +1 -0
  191. package/dist/editor/tokenMatch.js +198 -0
  192. package/dist/editor/tokenMatch.js.map +1 -0
  193. package/dist/editor/tokens/ConsolidatePage.d.ts +16 -0
  194. package/dist/editor/tokens/ConsolidatePage.d.ts.map +1 -0
  195. package/dist/editor/tokens/ConsolidatePage.js +244 -0
  196. package/dist/editor/tokens/ConsolidatePage.js.map +1 -0
  197. package/dist/editor/tokens/TokenActivity.d.ts +18 -0
  198. package/dist/editor/tokens/TokenActivity.d.ts.map +1 -0
  199. package/dist/editor/tokens/TokenActivity.js +18 -0
  200. package/dist/editor/tokens/TokenActivity.js.map +1 -0
  201. package/dist/editor/tokens/TokenDialogs.d.ts +26 -0
  202. package/dist/editor/tokens/TokenDialogs.d.ts.map +1 -0
  203. package/dist/editor/tokens/TokenDialogs.js +119 -0
  204. package/dist/editor/tokens/TokenDialogs.js.map +1 -0
  205. package/dist/editor/tokens/TokenList.d.ts +21 -0
  206. package/dist/editor/tokens/TokenList.d.ts.map +1 -0
  207. package/dist/editor/tokens/TokenList.js +98 -0
  208. package/dist/editor/tokens/TokenList.js.map +1 -0
  209. package/dist/editor/tokens/TokenPage.d.ts +25 -0
  210. package/dist/editor/tokens/TokenPage.d.ts.map +1 -0
  211. package/dist/editor/tokens/TokenPage.js +108 -0
  212. package/dist/editor/tokens/TokenPage.js.map +1 -0
  213. package/dist/editor/tokens/tokenModel.d.ts +35 -0
  214. package/dist/editor/tokens/tokenModel.d.ts.map +1 -0
  215. package/dist/editor/tokens/tokenModel.js +72 -0
  216. package/dist/editor/tokens/tokenModel.js.map +1 -0
  217. package/dist/editor/ui/Button.d.ts +3 -0
  218. package/dist/editor/ui/Button.d.ts.map +1 -0
  219. package/dist/editor/ui/Button.js +6 -0
  220. package/dist/editor/ui/Button.js.map +1 -0
  221. package/dist/editor/ui/CommentBox.d.ts +23 -0
  222. package/dist/editor/ui/CommentBox.d.ts.map +1 -0
  223. package/dist/editor/ui/CommentBox.js +41 -0
  224. package/dist/editor/ui/CommentBox.js.map +1 -0
  225. package/dist/editor/ui/Icon.d.ts +8 -0
  226. package/dist/editor/ui/Icon.d.ts.map +1 -0
  227. package/dist/editor/ui/Icon.js +6 -0
  228. package/dist/editor/ui/Icon.js.map +1 -0
  229. package/dist/editor/ui/IconButton.d.ts +11 -0
  230. package/dist/editor/ui/IconButton.d.ts.map +1 -0
  231. package/dist/editor/ui/IconButton.js +6 -0
  232. package/dist/editor/ui/IconButton.js.map +1 -0
  233. package/dist/editor/ui/NumberInput.d.ts +14 -0
  234. package/dist/editor/ui/NumberInput.d.ts.map +1 -0
  235. package/dist/editor/ui/NumberInput.js +6 -0
  236. package/dist/editor/ui/NumberInput.js.map +1 -0
  237. package/dist/editor/ui/PageLine.d.ts +14 -0
  238. package/dist/editor/ui/PageLine.d.ts.map +1 -0
  239. package/dist/editor/ui/PageLine.js +7 -0
  240. package/dist/editor/ui/PageLine.js.map +1 -0
  241. package/dist/editor/ui/SearchPicker.d.ts +41 -0
  242. package/dist/editor/ui/SearchPicker.d.ts.map +1 -0
  243. package/dist/editor/ui/SearchPicker.js +82 -0
  244. package/dist/editor/ui/SearchPicker.js.map +1 -0
  245. package/dist/editor/ui/Select.d.ts +19 -0
  246. package/dist/editor/ui/Select.d.ts.map +1 -0
  247. package/dist/editor/ui/Select.js +12 -0
  248. package/dist/editor/ui/Select.js.map +1 -0
  249. package/dist/editor/ui/TokenField.d.ts +14 -0
  250. package/dist/editor/ui/TokenField.d.ts.map +1 -0
  251. package/dist/editor/ui/TokenField.js +41 -0
  252. package/dist/editor/ui/TokenField.js.map +1 -0
  253. package/dist/editor/ui/TokenPicker.d.ts +31 -0
  254. package/dist/editor/ui/TokenPicker.d.ts.map +1 -0
  255. package/dist/editor/ui/TokenPicker.js +26 -0
  256. package/dist/editor/ui/TokenPicker.js.map +1 -0
  257. package/dist/editor/useBuildError.d.ts +7 -0
  258. package/dist/editor/useBuildError.d.ts.map +1 -0
  259. package/dist/editor/useBuildError.js +30 -0
  260. package/dist/editor/useBuildError.js.map +1 -0
  261. package/dist/editor/useLatestRequest.d.ts +22 -0
  262. package/dist/editor/useLatestRequest.d.ts.map +1 -0
  263. package/dist/editor/useLatestRequest.js +49 -0
  264. package/dist/editor/useLatestRequest.js.map +1 -0
  265. package/dist/editor-bundle/editor.css +2 -0
  266. package/dist/editor-bundle/editor.js +83 -0
  267. package/dist/editor-ui.d.ts +15 -0
  268. package/dist/editor-ui.d.ts.map +1 -0
  269. package/dist/editor-ui.js +14 -0
  270. package/dist/editor-ui.js.map +1 -0
  271. package/dist/inspector/runtime.d.ts +18 -0
  272. package/dist/inspector/runtime.d.ts.map +1 -0
  273. package/dist/inspector/runtime.js +1280 -0
  274. package/dist/inspector/runtime.js.map +1 -0
  275. package/dist/preview/main.d.ts +3 -0
  276. package/dist/preview/main.d.ts.map +1 -0
  277. package/dist/preview/main.js +320 -0
  278. package/dist/preview/main.js.map +1 -0
  279. package/dist/preview/preview.css +40 -0
  280. package/dist/runtime/index.d.ts +3 -0
  281. package/dist/runtime/index.d.ts.map +1 -0
  282. package/dist/runtime/index.js +2 -0
  283. package/dist/runtime/index.js.map +1 -0
  284. package/dist/shared/buildError.d.mts +27 -0
  285. package/dist/shared/buildError.mjs +141 -0
  286. package/dist/shared/cameraFit.d.mts +16 -0
  287. package/dist/shared/cameraFit.mjs +47 -0
  288. package/dist/shared/canvasLayout.d.mts +13 -0
  289. package/dist/shared/canvasLayout.mjs +171 -0
  290. package/dist/shared/commentShots.d.mts +12 -0
  291. package/dist/shared/commentShots.mjs +53 -0
  292. package/dist/shared/componentExtract.d.mts +43 -0
  293. package/dist/shared/componentExtract.mjs +136 -0
  294. package/dist/shared/componentMeta.d.mts +26 -0
  295. package/dist/shared/componentMeta.mjs +87 -0
  296. package/dist/shared/componentOps.d.mts +70 -0
  297. package/dist/shared/componentOps.mjs +407 -0
  298. package/dist/shared/componentTarget.d.mts +15 -0
  299. package/dist/shared/componentTarget.mjs +58 -0
  300. package/dist/shared/components.d.mts +30 -0
  301. package/dist/shared/components.mjs +106 -0
  302. package/dist/shared/consolidateCategories.d.mts +2 -0
  303. package/dist/shared/consolidateCategories.mjs +6 -0
  304. package/dist/shared/env.d.mts +4 -0
  305. package/dist/shared/env.mjs +18 -0
  306. package/dist/shared/gitChanges.d.mts +2 -0
  307. package/dist/shared/gitChanges.mjs +30 -0
  308. package/dist/shared/oklab.d.mts +6 -0
  309. package/dist/shared/oklab.mjs +56 -0
  310. package/dist/shared/optimizeEntries.d.mts +5 -0
  311. package/dist/shared/optimizeEntries.mjs +24 -0
  312. package/dist/shared/packages.d.mts +11 -0
  313. package/dist/shared/packages.mjs +96 -0
  314. package/dist/shared/projectFiles.d.mts +23 -0
  315. package/dist/shared/projectFiles.mjs +72 -0
  316. package/dist/shared/prompt.d.mts +20 -0
  317. package/dist/shared/prompt.mjs +201 -0
  318. package/dist/shared/proposals.d.mts +11 -0
  319. package/dist/shared/proposals.mjs +42 -0
  320. package/dist/shared/protocol.d.ts +122 -0
  321. package/dist/shared/protocol.d.ts.map +1 -0
  322. package/dist/shared/protocol.js +7 -0
  323. package/dist/shared/protocol.js.map +1 -0
  324. package/dist/shared/reviewArchive.d.mts +4 -0
  325. package/dist/shared/reviewArchive.mjs +19 -0
  326. package/dist/shared/reviewStore.d.mts +30 -0
  327. package/dist/shared/reviewStore.mjs +218 -0
  328. package/dist/shared/reviewVerify.d.mts +21 -0
  329. package/dist/shared/reviewVerify.mjs +158 -0
  330. package/dist/shared/sizeModes.d.mts +15 -0
  331. package/dist/shared/sizeModes.mjs +53 -0
  332. package/dist/shared/sketches.d.mts +10 -0
  333. package/dist/shared/sketches.mjs +64 -0
  334. package/dist/shared/snapshotCheck.d.mts +13 -0
  335. package/dist/shared/snapshotCheck.mjs +81 -0
  336. package/dist/shared/timeout.d.mts +1 -0
  337. package/dist/shared/timeout.mjs +15 -0
  338. package/dist/shared/tokens.d.ts +2 -0
  339. package/dist/shared/tokens.d.ts.map +1 -0
  340. package/dist/shared/tokens.js +2 -0
  341. package/dist/shared/tokens.js.map +1 -0
  342. package/dist/shared/types.d.ts +689 -0
  343. package/dist/shared/types.d.ts.map +1 -0
  344. package/dist/shared/types.js +13 -0
  345. package/dist/shared/types.js.map +1 -0
  346. package/dist/shared/wheelRouting.d.mts +9 -0
  347. package/dist/shared/wheelRouting.mjs +31 -0
  348. package/dist/shared/writeScope.mjs +96 -0
  349. package/dist/snapshots/diff.d.mts +28 -0
  350. package/dist/snapshots/diff.mjs +263 -0
  351. package/dist/snapshots/index.d.mts +110 -0
  352. package/dist/snapshots/index.mjs +638 -0
  353. package/dist/snapshots/render.d.mts +24 -0
  354. package/dist/snapshots/render.mjs +250 -0
  355. package/dist/snapshots/toolOps.d.mts +25 -0
  356. package/dist/snapshots/toolOps.mjs +69 -0
  357. package/dist/tokens/adapters/css.mjs +51 -0
  358. package/dist/tokens/adapters/cssInCode.mjs +314 -0
  359. package/dist/tokens/adapters/oxcShared.mjs +80 -0
  360. package/dist/tokens/adapters/preprocessor.mjs +63 -0
  361. package/dist/tokens/adapters/registry.mjs +53 -0
  362. package/dist/tokens/adapters/tailwindcss.mjs +424 -0
  363. package/dist/tokens/adapters/types.mjs +117 -0
  364. package/dist/tokens/consolidate/index.d.mts +42 -0
  365. package/dist/tokens/consolidate/index.mjs +111 -0
  366. package/dist/tokens/consolidate/normalize.mjs +479 -0
  367. package/dist/tokens/consolidate/plan.mjs +726 -0
  368. package/dist/tokens/consolidate/scan.mjs +928 -0
  369. package/dist/tokens/extract.mjs +441 -0
  370. package/dist/tokens/moduleData.d.mts +14 -0
  371. package/dist/tokens/moduleData.mjs +32 -0
  372. package/dist/tokens/opLock.d.mts +4 -0
  373. package/dist/tokens/opLock.mjs +108 -0
  374. package/dist/tokens/ops.d.mts +71 -0
  375. package/dist/tokens/ops.mjs +1511 -0
  376. package/dist/tokens/pipeline.mjs +813 -0
  377. package/dist/tokens/report.d.mts +47 -0
  378. package/dist/tokens/report.mjs +257 -0
  379. package/dist/tokens/rewrite/code.mjs +172 -0
  380. package/dist/tokens/rewrite/css.mjs +154 -0
  381. package/dist/tokens/rewrite/index.mjs +244 -0
  382. package/dist/tokens/rewrite/tailwind.mjs +288 -0
  383. package/dist/tokens/rewrite/text.mjs +116 -0
  384. package/dist/tokens/rewrite/value.mjs +115 -0
  385. package/dist/tokens/usage.d.mts +97 -0
  386. package/dist/tokens/usage.mjs +680 -0
  387. package/dist/vite/agent.d.ts +21 -0
  388. package/dist/vite/agent.d.ts.map +1 -0
  389. package/dist/vite/agent.js +165 -0
  390. package/dist/vite/agent.js.map +1 -0
  391. package/dist/vite/events.d.ts +27 -0
  392. package/dist/vite/events.d.ts.map +1 -0
  393. package/dist/vite/events.js +156 -0
  394. package/dist/vite/events.js.map +1 -0
  395. package/dist/vite/layout.d.ts +2 -0
  396. package/dist/vite/layout.d.ts.map +1 -0
  397. package/dist/vite/layout.js +4 -0
  398. package/dist/vite/layout.js.map +1 -0
  399. package/dist/vite/plugin.d.ts +40 -0
  400. package/dist/vite/plugin.d.ts.map +1 -0
  401. package/dist/vite/plugin.js +1255 -0
  402. package/dist/vite/plugin.js.map +1 -0
  403. package/dist/vite/requestGuard.d.mts +3 -0
  404. package/dist/vite/requestGuard.mjs +43 -0
  405. package/dist/vite/review.d.ts +11 -0
  406. package/dist/vite/review.d.ts.map +1 -0
  407. package/dist/vite/review.js +283 -0
  408. package/dist/vite/review.js.map +1 -0
  409. package/package.json +104 -4
  410. package/skills/seji/SKILL.md +395 -0
  411. package/skills/seji-authoring/SKILL.md +397 -0
  412. package/skills/seji-tokens/SKILL.md +432 -0
  413. package/README.md +0 -3
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AgentPanel.js","sourceRoot":"","sources":["../../../src/editor/agent/AgentPanel.tsx"],"names":[],"mappings":";AAAA,6FAA6F;AAC7F,6FAA6F;AAC7F,+FAA+F;AAC/F,0FAA0F;AAC1F,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAgC,MAAM,OAAO,CAAA;AAEzE,OAAO,EACL,iBAAiB,EACjB,UAAU,GAMX,MAAM,wBAA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AAiB,QAAQ,EAAE,MAAM,KAAK,UAAU,EAAE,KAAK,EAAE,CAAC,CAAC,YAAY,CAAC,EAAE,OAAO,EAAE,IAAI,YAC/H,KAAC,IAAI,IAAC,IAAI,EAAC,cAAc,EAAC,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,EAAE,GAAI,GAC7C,CACd,CAAC,CAAC,CAAC,CACF,KAAC,UAAU,IAAC,SAAS,EAAC,YAAY,2BAAiB,QAAQ,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,YAAY,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,YAC/H,KAAC,IAAI,IAAC,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,EAAE,GAAI,GAC1B,CACd,IACG,IACF,IACF,IACF,CACP,CAAA;AACH,CAAC","sourcesContent":["// The Agent tab of the right panel (0.5.0): one conversation with the agent on this machine,\n// run by the dev server (agent/host.mjs). Header (agent, status, new conversation), the feed\n// (messages, hand-off cards, replies, tool lines, turn ends), and the composer (Enter to send,\n// Shift+Enter for a new line, Stop while a turn runs; sending waits for the turn to end).\nimport { useEffect, useState, type KeyboardEvent, type Ref } from 'react'\n\nimport {\n groupToolActivity,\n noticeText,\n type SessionView,\n type ToolPart,\n type ViewMessage,\n type ViewPart,\n type ViewTurn,\n} from '@botiverse/oar/observe'\nimport {\n ArrowUpIcon,\n BotIcon,\n CheckIcon,\n ChevronDownIcon,\n ChevronRightIcon,\n CircleAlertIcon,\n CopyIcon,\n FileTextIcon,\n GlobeIcon,\n HourglassIcon,\n LinkIcon,\n ListChecksIcon,\n LoaderCircleIcon,\n PencilIcon,\n PlugIcon,\n RotateCwIcon,\n SearchIcon,\n SquareIcon,\n SquarePenIcon,\n TerminalIcon,\n TriangleAlertIcon,\n WorkflowIcon,\n WrenchIcon,\n XIcon,\n type LucideIcon,\n} from 'lucide-react'\nimport { useStickToBottom } from 'use-stick-to-bottom'\n\nimport { useI18n } from '../i18n'\nimport { Button } from '../ui/Button'\nimport { Icon } from '../ui/Icon'\nimport { IconButton } from '../ui/IconButton'\nimport { Select } from '../ui/Select'\nimport {\n agentDetect,\n agentNew,\n agentSelect,\n agentSend,\n agentStop,\n type AgentEditorContext,\n type AgentHandoff,\n type AgentInfo,\n type AgentInputMeta,\n type AgentState,\n type AgentStatusValue,\n} from './agentApi'\nimport { Markdown } from './Markdown'\nimport { changedFilesOf, handledCountOf, toolLine, type ToolLine } from './toolLines'\nimport type { AgentHandle } from './useAgent'\n\ntype Translate = ReturnType<typeof useI18n>['t']\n\nexport type AgentPanelProps = {\n agent: AgentHandle\n /** The open design (for the \"hand to agent\" suggestion). */\n design: { id: string; title: string } | null\n /** Where the editor is, sent with each message. */\n context: AgentEditorContext | null\n /** Review items waiting for the agent (\"处理待办\"). */\n pendingCount: number\n copied: boolean\n onHandoff: () => void\n onCopy: () => void\n}\n\nconst DEFAULT_OPTION = '__default'\nconst CHOICE_KEY = 'design-surface:agent-choice:'\n\ntype Choice = { model: string | null; effort: string | null }\n\nconst recallChoice = (agent: string): Choice | null => {\n try {\n const raw = window.localStorage.getItem(`${CHOICE_KEY}${agent}`)\n const value = raw ? (JSON.parse(raw) as Partial<Choice>) : null\n return value ? { model: typeof value.model === 'string' ? value.model : null, effort: typeof value.effort === 'string' ? value.effort : null } : null\n } catch {\n return null\n }\n}\n\nconst rememberChoice = (agent: string, choice: Choice) => {\n try {\n if (!choice.model) window.localStorage.removeItem(`${CHOICE_KEY}${agent}`)\n else window.localStorage.setItem(`${CHOICE_KEY}${agent}`, JSON.stringify(choice))\n } catch {\n // private mode: not remembered\n }\n}\n\nconst RUNNING: AgentStatusValue[] = ['starting', 'working', 'stopping']\n\nconst TONE: Record<AgentStatusValue, string> = {\n detecting: 'is-idle',\n none: 'is-danger',\n stopping: 'is-idle',\n starting: 'is-accent',\n working: 'is-accent',\n idle: 'is-idle',\n}\n\nconst BRAND_COLOR: Record<string, string> = { claude: '#d97757', codex: '#18181b', pi: '#7c3aed' }\n\nconst KIND_ICON: Record<ToolLine['kind'], LucideIcon> = {\n read_file: FileTextIcon,\n edit_file: PencilIcon,\n search: SearchIcon,\n run_command: TerminalIcon,\n web: GlobeIcon,\n fetch: LinkIcon,\n subagent: WorkflowIcon,\n mcp: PlugIcon,\n wait: HourglassIcon,\n other: WrenchIcon,\n}\n\nconst shortId = (id: string) => `#${id.replace(/^[^a-z0-9]+/i, '').slice(0, 4)}`\n\nconst seconds = (t: Translate, ms: number) => {\n const total = Math.max(1, Math.round(ms / 1000))\n if (total < 60) return t('agent.seconds', { count: total })\n return t('agent.minutes', { minutes: Math.floor(total / 60), seconds: total % 60 })\n}\n\n/** What the agent got minus the context line (inputs without the panel's record). */\nconst typedText = (input: string) =>\n input\n .split('\\n\\n')\n .filter((block) => !block.startsWith('[seji context]') && !block.startsWith('You are working inside seji'))\n .join('\\n\\n')\n\nfunction Dot({ tone }: { tone: string }) {\n return <span className={`agent-dot ${tone}`} aria-hidden=\"true\" />\n}\n\nfunction Brand({ agent }: { agent: AgentInfo | null }) {\n if (!agent) return null\n if (agent.icon) return <img alt=\"\" className=\"agent-brand\" src={agent.icon} />\n return (\n <span className=\"agent-brand is-letter\" style={{ background: BRAND_COLOR[agent.id] ?? '#71717a' }}>\n {agent.name.slice(0, 1).toUpperCase()}\n </span>\n )\n}\n\nfunction HandoffCard({ handoff, t }: { handoff: AgentHandoff; t: Translate }) {\n return (\n <div className=\"agent-handoff\" data-agent-handoff>\n <div className=\"agent-handoff-title\">\n <Icon icon={ListChecksIcon} size={12} />\n {t('agent.handoff.title', { design: handoff.design, count: handoff.itemIds.length })}\n </div>\n <ul>\n {handoff.itemIds.map((id) => (\n <li key={id} title={id}>\n <code>{shortId(id)}</code>\n </li>\n ))}\n </ul>\n </div>\n )\n}\n\nfunction InputBubble({ message, meta, t }: { message: Extract<ViewMessage, { kind: 'input' }>; meta: AgentInputMeta | undefined; t: Translate }) {\n if (meta?.handoff) return <HandoffCard handoff={meta.handoff} t={t} />\n const text = meta?.text ?? typedText(message.input.input)\n const lost = message.input.state === 'rejected' || message.input.state === 'dropped'\n return (\n <div className={lost ? 'agent-you is-lost' : 'agent-you'} data-agent-input>\n <p>{text}</p>\n {lost ? <small>{t('agent.input.lost')}</small> : null}\n </div>\n )\n}\n\nfunction ToolRow({ line, expanded, onToggle, t }: { line: ToolLine; expanded: boolean; onToggle: () => void; t: Translate }) {\n const icon = line.state === 'running' ? LoaderCircleIcon : line.state === 'failed' ? XIcon : KIND_ICON[line.kind]\n const openable = Boolean(line.detail)\n return (\n <>\n <button\n aria-expanded={openable ? expanded : undefined}\n className={['agent-tool', `is-${line.state}`, expanded ? 'is-open' : ''].filter(Boolean).join(' ')}\n data-agent-tool={line.kind}\n disabled={!openable}\n title={line.target}\n type=\"button\"\n onClick={onToggle}\n >\n {expanded ? <Icon className=\"agent-tool-caret\" icon={ChevronDownIcon} size={12} /> : null}\n <Icon className={line.state === 'running' ? 'agent-tool-icon agent-spin' : 'agent-tool-icon'} icon={icon} size={12} />\n <span className=\"agent-tool-verb\">{t(line.verb)}</span>\n <span className=\"agent-tool-target\">{line.target}</span>\n {line.add !== undefined || line.del !== undefined ? (\n <span className=\"agent-tool-count\">\n <span className=\"is-add\">+{line.add ?? 0}</span> <span className=\"is-del\">−{line.del ?? 0}</span>\n </span>\n ) : line.hits !== undefined ? (\n <span className=\"agent-tool-count\">{t('agent.tool.hits', { count: line.hits })}</span>\n ) : line.state === 'failed' && typeof line.exitCode === 'number' ? (\n <span className=\"agent-tool-count is-del\">{t('agent.tool.exit', { code: line.exitCode })}</span>\n ) : null}\n </button>\n {expanded && line.detail ? (\n <pre className=\"agent-tool-detail\" data-agent-tool-detail>\n {line.detail.kind === 'diff' ? (\n <>\n {line.detail.lines.map((entry, index) => (\n <span className={entry.sign === '+' ? 'is-add' : 'is-del'} key={index}>\n {`${entry.sign} ${entry.text}\\n`}\n </span>\n ))}\n {line.detail.more ? <span>{t('agent.tool.moreLines', { count: line.detail.more })}</span> : null}\n </>\n ) : (\n line.detail.text\n )}\n </pre>\n ) : null}\n </>\n )\n}\n\nconst GROUP_ORDER: ToolLine['kind'][] = ['read_file', 'edit_file', 'run_command', 'search', 'web', 'fetch', 'subagent', 'mcp', 'wait', 'other']\n\n/** A run of tool calls: one summary line, folded by default; open, it is the per-call lines. */\nfunction ToolGroup({\n lines,\n expanded,\n onToggle,\n t,\n}: {\n lines: ToolLine[]\n expanded: Set<string>\n onToggle: (key: string) => void\n t: Translate\n}) {\n const key = `group:${lines[0].callId}`\n const open = expanded.has(key)\n const counts = GROUP_ORDER.map((kind) => [kind, lines.filter((line) => line.kind === kind).length] as const).filter(([, count]) => count)\n const failed = lines.filter((line) => line.state === 'failed').length\n const running = [...lines].reverse().find((line) => line.state === \"running\")\n const summary = [\n t('agent.group.count', { count: lines.length }),\n ...counts.map(([kind, count]) => `${t(`agent.group.${kind}`)} ${count}`),\n failed ? t('agent.group.failed', { count: failed }) : null,\n running ? t('agent.group.now', { step: `${t(running.verb)} ${running.target}`.trim() }) : null,\n ]\n .filter(Boolean)\n .join(' · ')\n return (\n <div className={open ? 'agent-tool-group is-open' : 'agent-tool-group'} data-agent-tool-group={open ? 'open' : 'closed'}>\n <button\n aria-expanded={open}\n className={['agent-tool', 'agent-tool-summary', running ? 'is-running' : failed ? 'is-failed' : ''].filter(Boolean).join(' ')}\n data-agent-tool-summary\n title={summary}\n type=\"button\"\n onClick={() => onToggle(key)}\n >\n <Icon className=\"agent-tool-caret\" icon={open ? ChevronDownIcon : ChevronRightIcon} size={12} />\n {running ? <Icon className=\"agent-tool-icon agent-spin\" icon={LoaderCircleIcon} size={12} /> : null}\n <span className=\"agent-tool-target\">{summary}</span>\n </button>\n {open ? (\n <div className=\"agent-tools\">\n {lines.map((line) => (\n <ToolRow expanded={expanded.has(line.callId)} key={line.callId} line={line} t={t} onToggle={() => onToggle(line.callId)} />\n ))}\n </div>\n ) : null}\n </div>\n )\n}\n\nfunction EndLine({ turn, state, runtimeId, t }: { turn: ViewTurn; state: AgentState; runtimeId: string; t: Translate }) {\n const outcome = turn.outcome\n if (!outcome) return null\n const parts = turn.sections.flatMap((section) => section.parts)\n const timing = state.turns[turn.id]\n const duration = timing ? seconds(t, timing.endedAt - timing.startedAt) : null\n if (outcome.kind === 'aborted') {\n return (\n <div className=\"agent-end is-aborted\" data-agent-end=\"aborted\">\n <Icon icon={SquareIcon} size={10} />\n {[t('agent.end.aborted'), duration].filter(Boolean).join(' · ')}\n </div>\n )\n }\n if (outcome.kind === 'failed') {\n return (\n <div className=\"agent-end is-failed\" data-agent-end=\"failed\" title={outcome.reason}>\n <Icon icon={TriangleAlertIcon} size={12} />\n <span>\n {t('agent.end.failed', { why: t(`agent.failure.${outcome.failure}`, undefined, outcome.failure) })}\n {outcome.reason ? <small>{outcome.reason}</small> : null}\n </span>\n </div>\n )\n }\n const files = changedFilesOf(runtimeId, parts, state.root).length\n const handled = handledCountOf(runtimeId, parts)\n const work =\n files && handled\n ? t('agent.end.filesHandled', { files, handled })\n : files\n ? t('agent.end.files', { count: files })\n : handled\n ? t('agent.end.handled', { count: handled })\n : t('agent.end.nothing')\n return (\n <div className=\"agent-end\" data-agent-end=\"completed\">\n <Icon icon={CheckIcon} size={12} />\n {[t('agent.end.completed'), duration, work].filter(Boolean).join(' · ')}\n </div>\n )\n}\n\nfunction PartView({ part, streaming }: { part: ViewPart; streaming: boolean }) {\n if (part.kind === 'text') {\n return part.text.trim() ? (\n <div className=\"agent-text\">\n <Markdown streaming={streaming} text={part.text} />\n </div>\n ) : null\n }\n if (part.kind === 'notice') return <p className=\"agent-notice\">{noticeText(part.notice)}</p>\n return null\n}\n\nfunction TurnView({\n turn,\n open,\n state,\n runtimeId,\n expanded,\n onToggle,\n t,\n}: {\n turn: ViewTurn | Extract<ViewMessage, { kind: 'activity' }>\n open: boolean\n state: AgentState\n runtimeId: string\n expanded: Set<string>\n onToggle: (callId: string) => void\n t: Translate\n}) {\n const sections = turn.sections\n const lastSection = sections.length - 1\n return (\n <>\n {sections.map((section, sectionIndex) => {\n const segments = groupToolActivity(runtimeId, section.parts)\n const body = segments.map((segment, index) => {\n if (segment.kind === 'tools') {\n const tools = segment.parts.filter((part): part is ToolPart => part.kind === 'tool')\n if (!tools.length) return null\n return (\n <ToolGroup\n expanded={expanded}\n key={`tools-${segment.index}`}\n lines={tools.map((part) => toolLine(runtimeId, part, state.root))}\n t={t}\n onToggle={onToggle}\n />\n )\n }\n const streaming = open && sectionIndex === lastSection && index === segments.length - 1\n return <PartView key={`part-${segment.index}`} part={segment.part} streaming={streaming} />\n })\n return section.agentPath.length ? (\n <div className=\"agent-sub\" key={`${section.sessionId}:${section.agentPath.join('/')}`}>\n <span className=\"agent-sub-label\">{t('agent.subagent')}</span>\n {body}\n </div>\n ) : (\n <div className=\"agent-section\" key={`${section.sessionId}:root`}>\n {body}\n </div>\n )\n })}\n {turn.kind === 'turn' ? <EndLine runtimeId={runtimeId} state={state} t={t} turn={turn} /> : null}\n </>\n )\n}\n\nfunction Feed({\n view,\n state,\n runtimeId,\n t,\n}: {\n view: SessionView\n state: AgentState\n runtimeId: string\n t: Translate\n}) {\n const [expanded, setExpanded] = useState<Set<string>>(() => new Set())\n useEffect(() => setExpanded(new Set()), [state.conversation])\n const toggle = (callId: string) =>\n setExpanded((current) => {\n const next = new Set(current)\n if (next.has(callId)) next.delete(callId)\n else next.add(callId)\n return next\n })\n const working = state.status === 'working' || state.status === 'starting'\n const openTurn = view.openTurn\n return (\n <>\n {view.messages.map((message, index) => {\n if (message.kind === 'input') {\n return <InputBubble key={message.id} message={message} meta={message.input.inputId ? state.inputs[message.input.inputId] : undefined} t={t} />\n }\n if (message.kind === 'notice') {\n return (\n <p className=\"agent-notice\" key={message.id}>\n {noticeText(message.notice)}\n </p>\n )\n }\n return (\n <TurnView\n expanded={expanded}\n key={message.id}\n open={index === openTurn}\n runtimeId={runtimeId}\n state={state}\n t={t}\n turn={message}\n onToggle={toggle}\n />\n )\n })}\n {state.status === 'starting' ? (\n <div className=\"agent-working\">\n <Icon className=\"agent-spin\" icon={LoaderCircleIcon} size={12} />\n {t('agent.starting', { name: state.agents.find((agent) => agent.id === state.agent)?.name ?? '' })}\n </div>\n ) : working ? (\n <div className=\"agent-working\" data-agent-working>\n <Icon className=\"agent-spin\" icon={LoaderCircleIcon} size={12} />\n {t('agent.working')}\n </div>\n ) : null}\n {state.error ? (\n <p className=\"agent-error\" role=\"alert\">\n {t('agent.startFailed', { error: state.error })}\n </p>\n ) : null}\n </>\n )\n}\n\nexport function AgentPanel({\n agent,\n design,\n context,\n pendingCount,\n copied,\n onHandoff,\n onCopy,\n}: AgentPanelProps) {\n const { t } = useI18n()\n const { state, view } = agent\n const [draft, setDraft] = useState('')\n const [actionError, setActionError] = useState<string | null>(null)\n const [busy, setBusy] = useState(false)\n const { scrollRef, contentRef } = useStickToBottom({ initial: 'instant', resize: 'smooth' })\n\n const current = state?.agents.find((entry) => entry.id === state.agent) ?? null\n const runtimeId = current?.classifyAs ?? current?.id ?? 'claude'\n const status: AgentStatusValue = state?.status ?? 'detecting'\n const running = RUNNING.includes(status)\n const empty = !view.messages.length && status !== 'starting' && !state?.error\n\n useEffect(() => {\n setActionError(null)\n }, [state?.conversation])\n\n const fail = (error: unknown) => setActionError(error instanceof Error ? error.message : String(error))\n\n // Model and effort: the agent's own default unless picked; remembered per agent in this browser.\n const modelList = state?.models?.status === 'ok' ? state.models.list : []\n const chosenModel = modelList.find((item) => item.id === state?.model) ?? null\n const choose = (model: string | null, effort: string | null) => {\n if (!state?.agent) return\n rememberChoice(state.agent, { model, effort })\n void agentSelect({ model, effort }).catch(fail)\n }\n // On load and on switching agents (which resets to the default), bring back what was picked.\n useEffect(() => {\n const agentId = state?.agent\n if (!agentId || state?.models?.status !== 'ok') return\n const saved = recallChoice(agentId)\n const model = saved?.model && state.models.list.some((item) => item.id === saved.model) ? saved.model : null\n const levels = state.models.list.find((item) => item.id === model)?.efforts ?? []\n const effort = model && saved?.effort && levels.includes(saved.effort) ? saved.effort : null\n if (model !== (state.model ?? null) || effort !== (state.effort ?? null)) void agentSelect({ agent: agentId, model, effort }).catch(fail)\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [state?.agent, state?.models?.status])\n\n const send = (text = draft) => {\n const typed = text.trim()\n if (!typed || busy || running) return\n setBusy(true)\n setActionError(null)\n agentSend({ text: typed, context })\n .then(() => {\n if (text === draft) setDraft('')\n })\n .catch(fail)\n .finally(() => setBusy(false))\n }\n\n const stop = () => {\n setActionError(null)\n agentStop().catch(fail)\n }\n\n const onKeyDown = (event: KeyboardEvent<HTMLTextAreaElement>) => {\n if (event.key !== 'Enter' || event.shiftKey || event.nativeEvent.isComposing || event.keyCode === 229) return\n event.preventDefault()\n send()\n }\n\n if (!state) {\n return (\n <div className=\"agent-panel\" data-agent-panel=\"loading\">\n <p className=\"panel-empty\">{t('agent.detecting')}</p>\n </div>\n )\n }\n\n if (status === 'none' || status === 'detecting') {\n const detecting = status === 'detecting' || state.detecting\n return (\n <div className=\"agent-panel\" data-agent-panel=\"none\">\n <div className=\"agent-head\">\n <span className=\"agent-state\">\n <Dot tone={detecting ? 'is-idle' : 'is-danger'} />\n {detecting ? t('agent.detecting') : state.needsNode ? t('agent.needsNode', { required: state.needsNode.required }) : t('agent.none')}\n </span>\n <span className=\"agent-spacer\" />\n <IconButton className=\"icon-button agent-head-button\" disabled={detecting} label={t('agent.redetect')} onClick={() => void agentDetect().catch(fail)}>\n <Icon className={detecting ? 'agent-spin' : undefined} icon={RotateCwIcon} size={12} />\n </IconButton>\n </div>\n <div className=\"agent-empty\">\n <span className=\"agent-empty-icon\">\n <Icon icon={TriangleAlertIcon} size={16} />\n </span>\n <p>\n {state.needsNode\n ? t('agent.needsNodeHint', { required: state.needsNode.required, current: state.needsNode.current })\n : t('agent.noneHint')}\n </p>\n <div className=\"agent-suggestions\">\n <Button className=\"button\" data-agent-copy disabled={pendingCount === 0} type=\"button\" onClick={onCopy}>\n <Icon icon={copied ? CheckIcon : CopyIcon} size={12} />\n {copied ? t('topbar.copied') : t('agent.copyFirst', { count: pendingCount })}\n </Button>\n </div>\n {state.problems.length ? <small className=\"agent-problem\">{state.problems[0]}</small> : null}\n </div>\n </div>\n )\n }\n\n const agents = state.agents\n return (\n <div className=\"agent-panel\" data-agent-panel={empty ? 'empty' : 'conversation'} data-agent-status={status}>\n <div className=\"agent-head\">\n <Brand agent={current} />\n <strong className=\"agent-name\">{current?.name}</strong>\n <span className=\"agent-state\" data-agent-state={status}>\n <Dot tone={TONE[status]} />\n {t(`agent.status.${status}`)}\n </span>\n <span className=\"agent-spacer\" />\n <IconButton className=\"icon-button agent-head-button\" data-agent-new label={t('agent.new')} onClick={() => void agentNew().catch(fail)}>\n <Icon icon={SquarePenIcon} size={12} />\n </IconButton>\n </div>\n {empty ? (\n <div className=\"agent-empty\" data-agent-empty>\n <span className=\"agent-empty-icon\">\n <Icon icon={BotIcon} size={16} />\n </span>\n <p>\n {t('agent.emptyUsing', { name: current?.name ?? '' })}\n </p>\n {pendingCount > 0 ? (\n <div className=\"agent-suggestions\">\n {pendingCount > 0 && design ? (\n <Button className=\"button\" data-agent-suggest=\"handoff\" type=\"button\" onClick={onHandoff}>\n <Icon icon={ListChecksIcon} size={12} />\n {t('agent.suggest.handoff', { design: design.id, count: pendingCount })}\n </Button>\n ) : null}\n </div>\n ) : null}\n </div>\n ) : (\n <div className=\"agent-feed\" ref={scrollRef as unknown as Ref<HTMLDivElement>}>\n <div className=\"agent-feed-body\" ref={contentRef as unknown as Ref<HTMLDivElement>}>\n <Feed runtimeId={runtimeId} state={state} t={t} view={view} />\n </div>\n </div>\n )}\n\n <div className=\"agent-composer\">\n {actionError ? (\n <p className=\"agent-error\" role=\"alert\">\n <Icon icon={CircleAlertIcon} size={10} />\n {actionError}\n </p>\n ) : null}\n <div className=\"agent-box\">\n <textarea\n aria-label={t('agent.placeholder')}\n className=\"agent-input\"\n data-agent-input-box\n placeholder={t('agent.placeholder')}\n rows={Math.min(8, Math.max(2, draft.split('\\n').length))}\n value={draft}\n onChange={(event) => setDraft(event.target.value)}\n onKeyDown={onKeyDown}\n />\n <div className=\"agent-toolbar\">\n <div className=\"agent-options\" data-agent-options>\n {agents.length > 1 ? (\n <Select\n className=\"agent-chip agent-picker\"\n label={t('agent.switch')}\n title={t('agent.switch')}\n options={agents.map((entry) => ({ value: entry.id, label: entry.name }))}\n value={state.agent ?? ''}\n onChange={(value) => {\n if (value !== state.agent) void agentSelect({ agent: value }).catch(fail)\n }}\n />\n ) : null}\n <Select\n className=\"agent-chip agent-model\"\n disabled={running || state.models?.status !== 'ok' || !modelList.length}\n label={t('agent.model')}\n title={t('agent.model')}\n options={[{ value: DEFAULT_OPTION, label: state.models?.status === 'loading' ? t('agent.modelLoading') : t('agent.default') }, ...modelList.map((item) => ({ value: item.id, label: item.name }))]}\n value={state.model ?? DEFAULT_OPTION}\n onChange={(value) => choose(value === DEFAULT_OPTION ? null : value, null)}\n />\n {chosenModel?.efforts.length ? (\n <Select\n className=\"agent-chip agent-effort\"\n disabled={running}\n label={t('agent.effort')}\n title={t('agent.effort')}\n options={[\n { value: DEFAULT_OPTION, label: chosenModel.defaultEffort ? t('agent.defaultIs', { value: chosenModel.defaultEffort }) : t('agent.default') },\n ...chosenModel.efforts.map((level) => ({ value: level, label: level })),\n ]}\n value={state.effort ?? DEFAULT_OPTION}\n onChange={(value) => choose(state.model ?? null, value === DEFAULT_OPTION ? null : value)}\n />\n ) : null}\n </div>\n <span className=\"agent-spacer\" />\n {running ? (\n <IconButton className=\"agent-send is-stop\" data-agent-stop disabled={status === 'stopping'} label={t('agent.stop')} onClick={stop}>\n <Icon fill=\"currentColor\" icon={SquareIcon} size={10} />\n </IconButton>\n ) : (\n <IconButton className=\"agent-send\" data-agent-send disabled={!draft.trim() || busy} label={t('agent.send')} onClick={() => send()}>\n <Icon icon={ArrowUpIcon} size={14} />\n </IconButton>\n )}\n </div>\n </div>\n </div>\n </div>\n )\n}\n"]}
@@ -0,0 +1,5 @@
1
+ export declare const Markdown: import("react").NamedExoticComponent<{
2
+ text: string;
3
+ streaming?: boolean;
4
+ }>;
5
+ //# sourceMappingURL=Markdown.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Markdown.d.ts","sourceRoot":"","sources":["../../../src/editor/agent/Markdown.tsx"],"names":[],"mappings":"AAuCA,eAAO,MAAM,QAAQ;UAA+D,MAAM;gBAAc,OAAO;EAS7G,CAAA"}
@@ -0,0 +1,28 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { memo } from 'react';
3
+ import ReactMarkdown from 'react-markdown';
4
+ import remarkGfm from 'remark-gfm';
5
+ import remend from 'remend';
6
+ // The agent's replies: lists, inline code, code blocks (mono, no highlighting), tables and
7
+ // links. Headings read as bold body text, never bigger; images and raw HTML are not shown.
8
+ // While a reply streams, remend closes its unfinished markdown (an open `**`, a half table
9
+ // row) so it does not flash as raw syntax.
10
+ const Heading = ({ children }) => (_jsx("p", { className: "agent-md-heading", children: _jsx("strong", { children: children }) }));
11
+ const components = {
12
+ h1: Heading,
13
+ h2: Heading,
14
+ h3: Heading,
15
+ h4: Heading,
16
+ h5: Heading,
17
+ h6: Heading,
18
+ a: ({ href, children }) => (_jsx("a", { href: href, rel: "noreferrer noopener", target: "_blank", children: children })),
19
+ img: ({ alt }) => (alt ? _jsx("span", { className: "agent-md-image", children: alt }) : null),
20
+ table: ({ children }) => (_jsx("div", { className: "agent-md-table", children: _jsx("table", { children: children }) })),
21
+ pre: ({ children }) => _jsx("pre", { className: "agent-md-pre", children: children }),
22
+ };
23
+ const plugins = [remarkGfm];
24
+ export const Markdown = memo(function Markdown({ text, streaming = false }) {
25
+ const source = streaming ? remend(text) : text;
26
+ return (_jsx("div", { className: "agent-md", children: _jsx(ReactMarkdown, { components: components, remarkPlugins: plugins, skipHtml: true, children: source }) }));
27
+ });
28
+ //# sourceMappingURL=Markdown.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"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,CAAA;AAE3B,MAAM,CAAC,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,QAAQ,CAAC,EAAE,IAAI,EAAE,SAAS,GAAG,KAAK,EAAyC;IAC/G,MAAM,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;IAC9C,OAAO,CACL,cAAK,SAAS,EAAC,UAAU,YACvB,KAAC,aAAa,IAAC,UAAU,EAAE,UAAU,EAAE,aAAa,EAAE,OAAO,EAAE,QAAQ,kBACpE,MAAM,GACO,GACZ,CACP,CAAA;AACH,CAAC,CAAC,CAAA","sourcesContent":["import { memo, type ReactNode } from 'react'\n\nimport ReactMarkdown, { type Components } from 'react-markdown'\nimport remarkGfm from 'remark-gfm'\nimport remend from 'remend'\n\n// The agent's replies: lists, inline code, code blocks (mono, no highlighting), tables and\n// links. Headings read as bold body text, never bigger; images and raw HTML are not shown.\n// While a reply streams, remend closes its unfinished markdown (an open `**`, a half table\n// row) so it does not flash as raw syntax.\nconst Heading = ({ children }: { children?: ReactNode }) => (\n <p className=\"agent-md-heading\">\n <strong>{children}</strong>\n </p>\n)\n\nconst components: Components = {\n h1: Heading,\n h2: Heading,\n h3: Heading,\n h4: Heading,\n h5: Heading,\n h6: Heading,\n a: ({ href, children }) => (\n <a href={href} rel=\"noreferrer noopener\" target=\"_blank\">\n {children}\n </a>\n ),\n img: ({ alt }) => (alt ? <span className=\"agent-md-image\">{alt}</span> : null),\n table: ({ children }) => (\n <div className=\"agent-md-table\">\n <table>{children}</table>\n </div>\n ),\n pre: ({ children }) => <pre className=\"agent-md-pre\">{children}</pre>,\n}\n\nconst plugins = [remarkGfm]\n\nexport const Markdown = memo(function Markdown({ text, streaming = false }: { text: string; streaming?: boolean }) {\n const source = streaming ? remend(text) : text\n return (\n <div className=\"agent-md\">\n <ReactMarkdown components={components} remarkPlugins={plugins} skipHtml>\n {source}\n </ReactMarkdown>\n </div>\n )\n})\n"]}
@@ -0,0 +1,106 @@
1
+ export type AgentInfo = {
2
+ id: string;
3
+ name: string;
4
+ icon: string | null;
5
+ /** The runtime id oar's tool classification knows (the fake agent reads as Claude Code). */
6
+ classifyAs: string;
7
+ version: string | null;
8
+ };
9
+ export type AgentStatusValue = 'detecting' | 'none' | 'stopping' | 'starting' | 'working' | 'idle';
10
+ /** A "hand to agent" message: shown as a card instead of the prompt text. */
11
+ export type AgentHandoff = {
12
+ design: string;
13
+ itemIds: string[];
14
+ batchId?: string;
15
+ };
16
+ export type AgentInputMeta = {
17
+ text: string;
18
+ handoff?: AgentHandoff;
19
+ at: string;
20
+ };
21
+ export type AgentState = {
22
+ conversation: number;
23
+ /** The agent's cwd (the folder holding the design board): tool lines show paths relative to it. */
24
+ root: string;
25
+ detecting: boolean;
26
+ status: AgentStatusValue;
27
+ agent: string | null;
28
+ agents: AgentInfo[];
29
+ problems: string[];
30
+ /** Set when this Node is too old for oar: the panel says so instead of "no agent". */
31
+ needsNode?: {
32
+ required: number;
33
+ current: string;
34
+ };
35
+ session: boolean;
36
+ inputs: Record<string, AgentInputMeta>;
37
+ turns: Record<string, {
38
+ startedAt: number;
39
+ endedAt: number;
40
+ }>;
41
+ error: string | null;
42
+ /** The chosen model and effort; null leaves it to the agent. */
43
+ model?: string | null;
44
+ effort?: string | null;
45
+ /** The current agent's models (listed once per dev server; `none` when it cannot list). */
46
+ models?: {
47
+ status: 'loading' | 'ok' | 'none';
48
+ list: AgentModel[];
49
+ detail?: string | null;
50
+ } | null;
51
+ };
52
+ export type AgentModel = {
53
+ id: string;
54
+ name: string;
55
+ efforts: string[];
56
+ defaultEffort: string | null;
57
+ isDefault: boolean;
58
+ };
59
+ export declare class AgentRequestError extends Error {
60
+ status: number;
61
+ code?: string;
62
+ constructor(message: string, status: number, code?: string);
63
+ }
64
+ /** Where the editor is: sent with each message, told to the agent when it changes. */
65
+ export type AgentEditorContext = {
66
+ design: string;
67
+ page: string | null;
68
+ frame: string | null;
69
+ element: {
70
+ name: string | null;
71
+ source: string | null;
72
+ anchor: string | null;
73
+ text: string | null;
74
+ } | null;
75
+ };
76
+ export type AgentSendInput = {
77
+ text: string;
78
+ handoff?: AgentHandoff;
79
+ context?: AgentEditorContext | null;
80
+ };
81
+ export declare const agentSend: (input: AgentSendInput) => Promise<{
82
+ inputId: string;
83
+ landed: string;
84
+ }>;
85
+ export declare const agentStop: () => Promise<{
86
+ stopped: boolean;
87
+ }>;
88
+ export declare const agentNew: () => Promise<AgentState>;
89
+ /** Switch the agent, model or effort; `null` is the agent's own default. */
90
+ export declare const agentSelect: (input: {
91
+ agent?: string;
92
+ model?: string | null;
93
+ effort?: string | null;
94
+ }) => Promise<AgentState>;
95
+ export declare const agentDetect: () => Promise<AgentState>;
96
+ export type AgentStreamHandlers = {
97
+ /** A (re)connect: the server's conversation number; a fold starts over. */
98
+ onHello: (conversation: number) => void;
99
+ onRecord: (conversation: number, record: unknown) => void;
100
+ onState: (state: AgentState) => void;
101
+ onReset: (conversation: number) => void;
102
+ onError?: () => void;
103
+ };
104
+ /** `GET /__seji/api/agent/events`: hello, the conversation's records so far, then live. */
105
+ export declare function subscribeAgent(handlers: AgentStreamHandlers): () => void;
106
+ //# sourceMappingURL=agentApi.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agentApi.d.ts","sourceRoot":"","sources":["../../../src/editor/agent/agentApi.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,SAAS,GAAG;IACtB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IACnB,4FAA4F;IAC5F,UAAU,EAAE,MAAM,CAAA;IAClB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;CACvB,CAAA;AAED,MAAM,MAAM,gBAAgB,GAAG,WAAW,GAAG,MAAM,GAAG,UAAU,GAAG,UAAU,GAAG,SAAS,GAAG,MAAM,CAAA;AAElG,6EAA6E;AAC7E,MAAM,MA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GAAG,IAAI,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,wBAAsC,CAAA;AAC1I,eAAO,MAAM,WAAW,2BAAmC,CAAA;AAE3D,MAAM,MAAM,mBAAmB,GAAG;IAChC,2EAA2E;IAC3E,OAAO,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,IAAI,CAAA;IACvC,QAAQ,EAAE,CAAC,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,KAAK,IAAI,CAAA;IACzD,OAAO,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAA;IACpC,OAAO,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,IAAI,CAAA;IACvC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;CACrB,CAAA;AAED,2FAA2F;AAC3F,wBAAgB,cAAc,CAAC,QAAQ,EAAE,mBAAmB,GAAG,MAAM,IAAI,CA+BxE"}
@@ -0,0 +1,66 @@
1
+ export class AgentRequestError extends Error {
2
+ status;
3
+ code;
4
+ constructor(message, status, code) {
5
+ super(message);
6
+ this.status = status;
7
+ this.code = code;
8
+ }
9
+ }
10
+ const post = async (action, body = {}) => {
11
+ const response = await fetch(`/__seji/api/agent/${action}`, {
12
+ method: 'POST',
13
+ headers: { 'content-type': 'application/json' },
14
+ body: JSON.stringify(body),
15
+ });
16
+ const json = (await response.json().catch(() => null));
17
+ if (!response.ok) {
18
+ throw new AgentRequestError(json?.error ?? `Agent request failed (${response.status})`, response.status, json?.code);
19
+ }
20
+ return json;
21
+ };
22
+ export const agentSend = (input) => post('send', input);
23
+ export const agentStop = () => post('stop');
24
+ export const agentNew = () => post('new');
25
+ /** Switch the agent, model or effort; `null` is the agent's own default. */
26
+ export const agentSelect = (input) => post('select', input);
27
+ export const agentDetect = () => post('detect');
28
+ /** `GET /__seji/api/agent/events`: hello, the conversation's records so far, then live. */
29
+ export function subscribeAgent(handlers) {
30
+ if (typeof EventSource === 'undefined') {
31
+ handlers.onError?.();
32
+ return () => { };
33
+ }
34
+ const source = new EventSource('/__seji/api/agent/events');
35
+ const parse = (event) => {
36
+ try {
37
+ return JSON.parse(event.data);
38
+ }
39
+ catch {
40
+ return null;
41
+ }
42
+ };
43
+ source.addEventListener('hello', (event) => {
44
+ const data = parse(event);
45
+ if (data)
46
+ handlers.onHello(Number(data.conversation ?? 0));
47
+ });
48
+ source.addEventListener('record', (event) => {
49
+ const data = parse(event);
50
+ if (data)
51
+ handlers.onRecord(Number(data.conversation ?? 0), data.record);
52
+ });
53
+ source.addEventListener('state', (event) => {
54
+ const data = parse(event);
55
+ if (data)
56
+ handlers.onState(data);
57
+ });
58
+ source.addEventListener('reset', (event) => {
59
+ const data = parse(event);
60
+ if (data)
61
+ handlers.onReset(Number(data.conversation ?? 0));
62
+ });
63
+ source.addEventListener('error', () => handlers.onError?.());
64
+ return () => source.close();
65
+ }
66
+ //# sourceMappingURL=agentApi.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agentApi.js","sourceRoot":"","sources":["../../../src/editor/agent/agentApi.ts"],"names":[],"mappings":"AAyDA,MAAM,OAAO,iBAAkB,SAAQ,KAAK;IAC1C,MAAM,CAAQ;IACd,IAAI,CAAS;IACb,YAAY,OAAe,EAAE,MAAc,EAAE,IAAa;QACxD,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;IAClB,CAAC;CACF;AAED,MAAM,IAAI,GAAG,KAAK,EAAK,MAAc,EAAE,OAAgB,EAAE,EAAc,EAAE;IACvE,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,qBAAqB,MAAM,EAAE,EAAE;QAC1D,MAAM,EAAE,MAAM;QACd,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;QAC/C,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;KAC3B,CAAC,CAAA;IACF,MAA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D,OAAO,GAAG,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE,CAAA;AAC7B,CAAC","sourcesContent":["// The editor side of the agent routes (vite/agent.ts): the panel state, the record stream and\n// the controls. The conversation itself is folded in the browser with oar's pure fold\n// (`@botiverse/oar/observe`), from the same records the dev server keeps.\nexport type AgentInfo = {\n id: string\n name: string\n icon: string | null\n /** The runtime id oar's tool classification knows (the fake agent reads as Claude Code). */\n classifyAs: string\n version: string | null\n}\n\nexport type AgentStatusValue = 'detecting' | 'none' | 'stopping' | 'starting' | 'working' | 'idle'\n\n/** A \"hand to agent\" message: shown as a card instead of the prompt text. */\nexport type AgentHandoff = {\n design: string\n itemIds: string[]\n batchId?: string\n}\n\nexport type AgentInputMeta = {\n text: string\n handoff?: AgentHandoff\n at: string\n}\n\nexport type AgentState = {\n conversation: number\n /** The agent's cwd (the folder holding the design board): tool lines show paths relative to it. */\n root: string\n detecting: boolean\n status: AgentStatusValue\n agent: string | null\n agents: AgentInfo[]\n problems: string[]\n /** Set when this Node is too old for oar: the panel says so instead of \"no agent\". */\n needsNode?: { required: number; current: string }\n session: boolean\n inputs: Record<string, AgentInputMeta>\n turns: Record<string, { startedAt: number; endedAt: number }>\n error: string | null\n /** The chosen model and effort; null leaves it to the agent. */\n model?: string | null\n effort?: string | null\n /** The current agent's models (listed once per dev server; `none` when it cannot list). */\n models?: { status: 'loading' | 'ok' | 'none'; list: AgentModel[]; detail?: string | null } | null\n}\n\nexport type AgentModel = {\n id: string\n name: string\n efforts: string[]\n defaultEffort: string | null\n isDefault: boolean\n}\n\nexport class AgentRequestError extends Error {\n status: number\n code?: string\n constructor(message: string, status: number, code?: string) {\n super(message)\n this.status = status\n this.code = code\n }\n}\n\nconst post = async <T>(action: string, body: unknown = {}): Promise<T> => {\n const response = await fetch(`/__seji/api/agent/${action}`, {\n method: 'POST',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify(body),\n })\n const json = (await response.json().catch(() => null)) as ({ error?: string; code?: string } & T) | null\n if (!response.ok) {\n throw new AgentRequestError(json?.error ?? `Agent request failed (${response.status})`, response.status, json?.code)\n }\n return json as T\n}\n\n/** Where the editor is: sent with each message, told to the agent when it changes. */\nexport type AgentEditorContext = {\n design: string\n page: string | null\n frame: string | null\n element: { name: string | null; source: string | null; anchor: string | null; text: string | null } | null\n}\n\nexport type AgentSendInput = {\n text: string\n handoff?: AgentHandoff\n context?: AgentEditorContext | null\n}\n\nexport const agentSend = (input: AgentSendInput) => post<{ inputId: string; landed: string }>('send', input)\nexport const agentStop = () => post<{ stopped: boolean }>('stop')\nexport const agentNew = () => post<AgentState>('new')\n/** Switch the agent, model or effort; `null` is the agent's own default. */\nexport const agentSelect = (input: { agent?: string; model?: string | null; effort?: string | null }) => post<AgentState>('select', input)\nexport const agentDetect = () => post<AgentState>('detect')\n\nexport type AgentStreamHandlers = {\n /** A (re)connect: the server's conversation number; a fold starts over. */\n onHello: (conversation: number) => void\n onRecord: (conversation: number, record: unknown) => void\n onState: (state: AgentState) => void\n onReset: (conversation: number) => void\n onError?: () => void\n}\n\n/** `GET /__seji/api/agent/events`: hello, the conversation's records so far, then live. */\nexport function subscribeAgent(handlers: AgentStreamHandlers): () => void {\n if (typeof EventSource === 'undefined') {\n handlers.onError?.()\n return () => {}\n }\n const source = new EventSource('/__seji/api/agent/events')\n const parse = (event: Event) => {\n try {\n return JSON.parse((event as MessageEvent<string>).data) as Record<string, unknown>\n } catch {\n return null\n }\n }\n source.addEventListener('hello', (event) => {\n const data = parse(event)\n if (data) handlers.onHello(Number(data.conversation ?? 0))\n })\n source.addEventListener('record', (event) => {\n const data = parse(event)\n if (data) handlers.onRecord(Number(data.conversation ?? 0), data.record)\n })\n source.addEventListener('state', (event) => {\n const data = parse(event)\n if (data) handlers.onState(data as unknown as AgentState)\n })\n source.addEventListener('reset', (event) => {\n const data = parse(event)\n if (data) handlers.onReset(Number(data.conversation ?? 0))\n })\n source.addEventListener('error', () => handlers.onError?.())\n return () => source.close()\n}\n"]}
@@ -0,0 +1,38 @@
1
+ import { type ToolActionKind, type ToolPart, type ViewPart } from '@botiverse/oar/observe';
2
+ export type DiffLine = {
3
+ sign: '+' | '-';
4
+ text: string;
5
+ };
6
+ export type ToolLine = {
7
+ callId: string;
8
+ kind: ToolActionKind;
9
+ /** i18n key of the verb ("agent.tool.read"). */
10
+ verb: string;
11
+ target: string;
12
+ /** Search hits, or an edit's added / removed line counts. */
13
+ hits?: number;
14
+ add?: number;
15
+ del?: number;
16
+ exitCode?: number | null;
17
+ detail?: {
18
+ kind: 'diff';
19
+ lines: DiffLine[];
20
+ more: number;
21
+ } | {
22
+ kind: 'text';
23
+ text: string;
24
+ };
25
+ state: ToolPart['result'];
26
+ paths: string[];
27
+ };
28
+ /** `path` relative to the app when it is inside it. */
29
+ export declare function relativePath(path: string, root: string | undefined): string;
30
+ /** The changed lines of one replacement: the lines both sides share at the ends are left out. */
31
+ export declare function replacementDiff(before: string, after: string): DiffLine[];
32
+ /** The line for one tool call. `runtimeId` is the agent's runtime as oar knows it. */
33
+ export declare function toolLine(runtimeId: string, part: ToolPart, root?: string): ToolLine;
34
+ /** The files a turn changed: edit tools' paths and the runtimes' reported file changes. */
35
+ export declare function changedFilesOf(runtimeId: string, parts: readonly ViewPart[], root?: string): string[];
36
+ /** How many review items a turn marked handled (`seji status … resolved`, `reply … --resolve`). */
37
+ export declare function handledCountOf(runtimeId: string, parts: readonly ViewPart[]): number;
38
+ //# sourceMappingURL=toolLines.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toolLines.d.ts","sourceRoot":"","sources":["../../../src/editor/agent/toolLines.ts"],"names":[],"mappings":"AAIA,OAAO,EAAgC,KAAK,cAAc,EAAE,KAAK,QAAQ,EAAE,KAAK,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AAExH,MAAM,MAAM,QAAQ,GAAG;IAAE,IAAI,EAAE,GAAG,GAAG,GAAG,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAA;AAExD,MAAM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,159 @@
1
+ // One line per tool call in the Agent panel: icon, verb, target, a count on the right, and a
2
+ // detail that opens on click (an edit's changed lines, a command's output). oar classifies
3
+ // the call across runtimes (`classifyTool`: Claude's "Bash", Codex's "commandExecution" and
4
+ // Pi's "bash" are all `run_command`); this only words and measures it.
5
+ import { classifyTool, toolResultText } from '@botiverse/oar/observe';
6
+ const VERBS = {
7
+ read_file: 'agent.tool.read',
8
+ edit_file: 'agent.tool.edit',
9
+ search: 'agent.tool.search',
10
+ run_command: 'agent.tool.run',
11
+ web: 'agent.tool.web',
12
+ fetch: 'agent.tool.fetch',
13
+ subagent: 'agent.tool.subagent',
14
+ mcp: 'agent.tool.mcp',
15
+ wait: 'agent.tool.wait',
16
+ other: 'agent.tool.other',
17
+ };
18
+ const MAX_DIFF_LINES = 24;
19
+ const MAX_OUTPUT = 4000;
20
+ /** `path` relative to the app when it is inside it. */
21
+ export function relativePath(path, root) {
22
+ if (!root)
23
+ return path;
24
+ const base = root.endsWith('/') ? root : `${root}/`;
25
+ return path.startsWith(base) ? path.slice(base.length) : path === root ? '.' : path;
26
+ }
27
+ const parseInput = (part) => {
28
+ if (!part.input || part.inputPartial)
29
+ return null;
30
+ try {
31
+ const value = JSON.parse(part.input);
32
+ return value && typeof value === 'object' ? value : null;
33
+ }
34
+ catch {
35
+ return null;
36
+ }
37
+ };
38
+ const lines = (text) => (typeof text === 'string' && text.length ? text.split('\n') : []);
39
+ /** The changed lines of one replacement: the lines both sides share at the ends are left out. */
40
+ export function replacementDiff(before, after) {
41
+ const old = lines(before);
42
+ const next = lines(after);
43
+ let start = 0;
44
+ while (start < old.length && start < next.length && old[start] === next[start])
45
+ start += 1;
46
+ let end = 0;
47
+ while (end < old.length - start && end < next.length - start && old[old.length - 1 - end] === next[next.length - 1 - end])
48
+ end += 1;
49
+ return [
50
+ ...old.slice(start, old.length - end).map((text) => ({ sign: '-', text })),
51
+ ...next.slice(start, next.length - end).map((text) => ({ sign: '+', text })),
52
+ ];
53
+ }
54
+ const editDiff = (input) => {
55
+ if (!input)
56
+ return null;
57
+ if (typeof input.old_string === 'string' && typeof input.new_string === 'string') {
58
+ return replacementDiff(input.old_string, input.new_string);
59
+ }
60
+ if (Array.isArray(input.edits)) {
61
+ return input.edits.flatMap((edit) => edit && typeof edit === 'object' && typeof edit.old_string === 'string'
62
+ ? replacementDiff(String(edit.old_string), String(edit.new_string ?? ''))
63
+ : []);
64
+ }
65
+ if (typeof input.content === 'string')
66
+ return lines(input.content).map((text) => ({ sign: '+', text }));
67
+ return null;
68
+ };
69
+ const hitsOf = (text) => {
70
+ if (!text)
71
+ return undefined;
72
+ const found = /\bFound (\d+)\b/i.exec(text) ?? /\b(\d+) (?:matches|match|files?|results?|occurrences?)\b/i.exec(text);
73
+ if (found)
74
+ return Number(found[1]);
75
+ const count = text.split('\n').filter((line) => line.trim()).length;
76
+ return count || undefined;
77
+ };
78
+ const clip = (text) => (text.length > MAX_OUTPUT ? `…\n${text.slice(-MAX_OUTPUT)}` : text);
79
+ /** The line for one tool call. `runtimeId` is the agent's runtime as oar knows it. */
80
+ export function toolLine(runtimeId, part, root) {
81
+ const action = classifyTool(runtimeId, part.tool, part.inputPartial ? undefined : part.input);
82
+ const input = parseInput(part);
83
+ const resultText = toolResultText(part.content) ?? part.output;
84
+ const paths = (action.paths ?? []).map((path) => relativePath(path, root));
85
+ const line = {
86
+ callId: part.callId,
87
+ kind: action.kind,
88
+ verb: VERBS[action.kind] ?? VERBS.other,
89
+ target: '',
90
+ state: part.result,
91
+ paths,
92
+ ...(part.exitCode !== undefined ? { exitCode: part.exitCode } : {}),
93
+ };
94
+ if (action.kind === 'read_file' || action.kind === 'edit_file') {
95
+ line.target = paths.length > 1 ? `${paths[0]} +${paths.length - 1}` : paths[0] ?? relativePath(action.detail ?? part.tool, root);
96
+ }
97
+ else if (action.kind === 'run_command') {
98
+ line.target = (action.command ?? action.detail ?? part.tool).split('\n')[0];
99
+ }
100
+ else if (action.kind === 'mcp' || action.kind === 'other') {
101
+ line.target = action.detail ? `${part.tool} · ${action.detail}` : part.tool;
102
+ }
103
+ else {
104
+ line.target = action.detail ?? action.description ?? part.tool;
105
+ }
106
+ if (action.kind === 'edit_file') {
107
+ const diff = editDiff(input);
108
+ if (diff?.length) {
109
+ line.add = diff.filter((entry) => entry.sign === '+').length;
110
+ line.del = diff.filter((entry) => entry.sign === '-').length;
111
+ line.detail = { kind: 'diff', lines: diff.slice(0, MAX_DIFF_LINES), more: Math.max(0, diff.length - MAX_DIFF_LINES) };
112
+ }
113
+ else if (resultText)
114
+ line.detail = { kind: 'text', text: clip(resultText) };
115
+ }
116
+ else if (action.kind === 'search') {
117
+ if (part.result === 'ok')
118
+ line.hits = hitsOf(resultText);
119
+ if (resultText)
120
+ line.detail = { kind: 'text', text: clip(resultText) };
121
+ }
122
+ else if (resultText) {
123
+ line.detail = { kind: 'text', text: clip(resultText) };
124
+ }
125
+ return line;
126
+ }
127
+ /** The files a turn changed: edit tools' paths and the runtimes' reported file changes. */
128
+ export function changedFilesOf(runtimeId, parts, root) {
129
+ const files = new Set();
130
+ for (const part of parts) {
131
+ if (part.kind !== 'tool' || part.result === 'failed')
132
+ continue;
133
+ for (const change of part.fileChanges ?? [])
134
+ files.add(relativePath(change.path, root));
135
+ const action = classifyTool(runtimeId, part.tool, part.inputPartial ? undefined : part.input);
136
+ if (action.kind === 'edit_file')
137
+ for (const path of action.paths ?? [])
138
+ files.add(relativePath(path, root));
139
+ }
140
+ return [...files];
141
+ }
142
+ const HANDLED = /\bseji\s+(?:status\s+\S+\s+\S+\s+resolved\b|reply\s+.*--resolve\b)/;
143
+ /** How many review items a turn marked handled (`seji status … resolved`, `reply … --resolve`). */
144
+ export function handledCountOf(runtimeId, parts) {
145
+ let count = 0;
146
+ for (const part of parts) {
147
+ if (part.kind !== 'tool' || part.result !== 'ok')
148
+ continue;
149
+ const action = classifyTool(runtimeId, part.tool, part.inputPartial ? undefined : part.input);
150
+ if (action.kind !== 'run_command')
151
+ continue;
152
+ const command = action.command ?? action.detail ?? '';
153
+ for (const piece of command.split(/&&|;|\n/))
154
+ if (HANDLED.test(piece))
155
+ count += 1;
156
+ }
157
+ return count;
158
+ }
159
+ //# sourceMappingURL=toolLines.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toolLines.js","sourceRoot":"","sources":["../../../src/editor/agent/toolLines.ts"],"names":[],"mappings":"AAAA,6FAA6F;AAC7F,2FAA2F;AAC3F,4FAA4F;AAC5F,uEAAuE;AACvE,OAAO,EAAE,YAAY,EAAE,cAAc,EAAqD,MAAM,wBAAwB,CAAA;AAoBxH,MAAM,KAAK,GAAmC;IAC5C,SAAS,EAAE,iBAAiB;IAC5B,SAAS,EAAE,iBAAiB;IAC5B,MAAM,EAAE,mBAAmB;IAC3B,WAAW,EAAE,gBAAgB;IAC7B,GAAG,EAAE,gBAAgB;IACrB,KAAK,EAAE,kBAAkB;IACzB,QAAQ,EAAE,qBAAqB;IAC/B,GAAG,EAAE,gBAAgB;IACrB,IAAI,EAAE,iBAAiB;IACvB,KAAK,EAAE,kBAAkB;CAC1B,CAAA;AAED,MAAM,cAAc,GAAG,EAAE,CAAA;AACzB,MAAM,UAAU,GAAG,IAAI,CAAA;AAEvB,uDAAuD;AACvD,MAAM,UAAU,YAAY,CAAC,IAAY,EAAE,IAAwB;IACjE,IAAI,CAAC,IAAI;QAAE,OAAO,IAAI,CAAA;IACtB,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,CAAA;IACnD,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAA;AACrF,CAAC;AAED,MAAM,UAAU,GAAG,CAAC,IAAc,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AAED,MAAM,OAAO,GAAG,oEAAoE,CAAA;AAEpF,mGAAmG;AACnG,MAAM,UAAU,cAAc,CAAC,SAAiB,EAAE,KAA0B;IAC1E,IAAI,KAAK,GAAG,CAAC,CAAA;IACb,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,IAAI,CAAC,IAAI,KAAK,MAAM,IAAI,IAAI,CAAC,MAAM,KAAK,IAAI;YAAE,SAAQ;QAC1D,MAAM,MAAM,GAAG,YAAY,CAAC,SAAS,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QAC7F,IAAI,MAAM,CAAC,IAAI,KAAK,aAAa;YAAE,SAAQ;QAC3C,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,MAAM,IAAI,EAAE,CAAA;QACrD,KAAK,MAAM,KAAK,IAAI,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC;YAAE,IAAI,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC;gBAAE,KAAK,IAAI,CAAC,CAAA;IACnF,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC","sourcesContent":["// One line per tool call in the Agent panel: icon, verb, target, a count on the right, and a\n// detail that opens on click (an edit's changed lines, a command's output). oar classifies\n// the call across runtimes (`classifyTool`: Claude's \"Bash\", Codex's \"commandExecution\" and\n// Pi's \"bash\" are all `run_command`); this only words and measures it.\nimport { classifyTool, toolResultText, type ToolActionKind, type ToolPart, type ViewPart } from '@botiverse/oar/observe'\n\nexport type DiffLine = { sign: '+' | '-'; text: string }\n\nexport type ToolLine = {\n callId: string\n kind: ToolActionKind\n /** i18n key of the verb (\"agent.tool.read\"). */\n verb: string\n target: string\n /** Search hits, or an edit's added / removed line counts. */\n hits?: number\n add?: number\n del?: number\n exitCode?: number | null\n detail?: { kind: 'diff'; lines: DiffLine[]; more: number } | { kind: 'text'; text: string }\n state: ToolPart['result']\n paths: string[]\n}\n\nconst VERBS: Record<ToolActionKind, string> = {\n read_file: 'agent.tool.read',\n edit_file: 'agent.tool.edit',\n search: 'agent.tool.search',\n run_command: 'agent.tool.run',\n web: 'agent.tool.web',\n fetch: 'agent.tool.fetch',\n subagent: 'agent.tool.subagent',\n mcp: 'agent.tool.mcp',\n wait: 'agent.tool.wait',\n other: 'agent.tool.other',\n}\n\nconst MAX_DIFF_LINES = 24\nconst MAX_OUTPUT = 4000\n\n/** `path` relative to the app when it is inside it. */\nexport function relativePath(path: string, root: string | undefined) {\n if (!root) return path\n const base = root.endsWith('/') ? root : `${root}/`\n return path.startsWith(base) ? path.slice(base.length) : path === root ? '.' : path\n}\n\nconst parseInput = (part: ToolPart): Record<string, unknown> | null => {\n if (!part.input || part.inputPartial) return null\n try {\n const value = JSON.parse(part.input) as unknown\n return value && typeof value === 'object' ? (value as Record<string, unknown>) : null\n } catch {\n return null\n }\n}\n\nconst lines = (text: unknown) => (typeof text === 'string' && text.length ? text.split('\\n') : [])\n\n/** The changed lines of one replacement: the lines both sides share at the ends are left out. */\nexport function replacementDiff(before: string, after: string): DiffLine[] {\n const old = lines(before)\n const next = lines(after)\n let start = 0\n while (start < old.length && start < next.length && old[start] === next[start]) start += 1\n let end = 0\n while (end < old.length - start && end < next.length - start && old[old.length - 1 - end] === next[next.length - 1 - end]) end += 1\n return [\n ...old.slice(start, old.length - end).map((text) => ({ sign: '-' as const, text })),\n ...next.slice(start, next.length - end).map((text) => ({ sign: '+' as const, text })),\n ]\n}\n\nconst editDiff = (input: Record<string, unknown> | null): DiffLine[] | null => {\n if (!input) return null\n if (typeof input.old_string === 'string' && typeof input.new_string === 'string') {\n return replacementDiff(input.old_string, input.new_string)\n }\n if (Array.isArray(input.edits)) {\n return input.edits.flatMap((edit) =>\n edit && typeof edit === 'object' && typeof (edit as Record<string, unknown>).old_string === 'string'\n ? replacementDiff(String((edit as Record<string, unknown>).old_string), String((edit as Record<string, unknown>).new_string ?? ''))\n : [],\n )\n }\n if (typeof input.content === 'string') return lines(input.content).map((text) => ({ sign: '+' as const, text }))\n return null\n}\n\nconst hitsOf = (text: string | undefined) => {\n if (!text) return undefined\n const found = /\\bFound (\\d+)\\b/i.exec(text) ?? /\\b(\\d+) (?:matches|match|files?|results?|occurrences?)\\b/i.exec(text)\n if (found) return Number(found[1])\n const count = text.split('\\n').filter((line) => line.trim()).length\n return count || undefined\n}\n\nconst clip = (text: string) => (text.length > MAX_OUTPUT ? `…\\n${text.slice(-MAX_OUTPUT)}` : text)\n\n/** The line for one tool call. `runtimeId` is the agent's runtime as oar knows it. */\nexport function toolLine(runtimeId: string, part: ToolPart, root?: string): ToolLine {\n const action = classifyTool(runtimeId, part.tool, part.inputPartial ? undefined : part.input)\n const input = parseInput(part)\n const resultText = toolResultText(part.content) ?? part.output\n const paths = (action.paths ?? []).map((path) => relativePath(path, root))\n const line: ToolLine = {\n callId: part.callId,\n kind: action.kind,\n verb: VERBS[action.kind] ?? VERBS.other,\n target: '',\n state: part.result,\n paths,\n ...(part.exitCode !== undefined ? { exitCode: part.exitCode } : {}),\n }\n if (action.kind === 'read_file' || action.kind === 'edit_file') {\n line.target = paths.length > 1 ? `${paths[0]} +${paths.length - 1}` : paths[0] ?? relativePath(action.detail ?? part.tool, root)\n } else if (action.kind === 'run_command') {\n line.target = (action.command ?? action.detail ?? part.tool).split('\\n')[0]\n } else if (action.kind === 'mcp' || action.kind === 'other') {\n line.target = action.detail ? `${part.tool} · ${action.detail}` : part.tool\n } else {\n line.target = action.detail ?? action.description ?? part.tool\n }\n if (action.kind === 'edit_file') {\n const diff = editDiff(input)\n if (diff?.length) {\n line.add = diff.filter((entry) => entry.sign === '+').length\n line.del = diff.filter((entry) => entry.sign === '-').length\n line.detail = { kind: 'diff', lines: diff.slice(0, MAX_DIFF_LINES), more: Math.max(0, diff.length - MAX_DIFF_LINES) }\n } else if (resultText) line.detail = { kind: 'text', text: clip(resultText) }\n } else if (action.kind === 'search') {\n if (part.result === 'ok') line.hits = hitsOf(resultText)\n if (resultText) line.detail = { kind: 'text', text: clip(resultText) }\n } else if (resultText) {\n line.detail = { kind: 'text', text: clip(resultText) }\n }\n return line\n}\n\n/** The files a turn changed: edit tools' paths and the runtimes' reported file changes. */\nexport function changedFilesOf(runtimeId: string, parts: readonly ViewPart[], root?: string) {\n const files = new Set<string>()\n for (const part of parts) {\n if (part.kind !== 'tool' || part.result === 'failed') continue\n for (const change of part.fileChanges ?? []) files.add(relativePath(change.path, root))\n const action = classifyTool(runtimeId, part.tool, part.inputPartial ? undefined : part.input)\n if (action.kind === 'edit_file') for (const path of action.paths ?? []) files.add(relativePath(path, root))\n }\n return [...files]\n}\n\nconst HANDLED = /\\bseji\\s+(?:status\\s+\\S+\\s+\\S+\\s+resolved\\b|reply\\s+.*--resolve\\b)/\n\n/** How many review items a turn marked handled (`seji status … resolved`, `reply … --resolve`). */\nexport function handledCountOf(runtimeId: string, parts: readonly ViewPart[]) {\n let count = 0\n for (const part of parts) {\n if (part.kind !== 'tool' || part.result !== 'ok') continue\n const action = classifyTool(runtimeId, part.tool, part.inputPartial ? undefined : part.input)\n if (action.kind !== 'run_command') continue\n const command = action.command ?? action.detail ?? ''\n for (const piece of command.split(/&&|;|\\n/)) if (HANDLED.test(piece)) count += 1\n }\n return count\n}\n"]}