elanous 0.2.0 → 0.2.5

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 (1249) hide show
  1. package/.env.example +6 -0
  2. package/README.md +17 -15
  3. package/apps/pwa/out/404/index.html +1 -1
  4. package/apps/pwa/out/404.html +1 -1
  5. package/apps/pwa/out/_next/static/chunks/06ef2eba-d1b99ac6d2ea663c.js +1 -0
  6. package/apps/pwa/out/_next/static/chunks/1413-7179a49332db5a80.js +1 -0
  7. package/apps/pwa/out/_next/static/chunks/150-25c277137a9638ab.js +1 -0
  8. package/apps/pwa/out/_next/static/chunks/1640-bc99ec23bbe29d12.js +1 -0
  9. package/apps/pwa/out/_next/static/chunks/1751.50b96ea9c37b49b6.js +1 -0
  10. package/apps/pwa/out/_next/static/chunks/2300-de059d0ab2a16630.js +1 -0
  11. package/apps/pwa/out/_next/static/chunks/2684-05b0a81e75298c16.js +1 -0
  12. package/apps/pwa/out/_next/static/chunks/3026-2ed7e317d9b02102.js +25 -0
  13. package/apps/pwa/out/_next/static/chunks/3611-77496ada38cd6358.js +1 -0
  14. package/apps/pwa/out/_next/static/chunks/3717-68957c4dc9ceec90.js +1 -0
  15. package/apps/pwa/out/_next/static/chunks/3929-46ba9af6f9d895cc.js +1 -0
  16. package/apps/pwa/out/_next/static/chunks/4015-62c5a3744698a8da.js +1 -0
  17. package/apps/pwa/out/_next/static/chunks/4217-3c4317a7905f9eeb.js +1 -0
  18. package/apps/pwa/out/_next/static/chunks/4240-3230f230fae2d7d5.js +1 -0
  19. package/apps/pwa/out/_next/static/chunks/4271-e53e075ebd48593b.js +1 -0
  20. package/apps/pwa/out/_next/static/chunks/4377.3b125fef79576dfd.js +5 -0
  21. package/apps/pwa/out/_next/static/chunks/4440-18bb160d95819f4e.js +1 -0
  22. package/apps/pwa/out/_next/static/chunks/4853-35fdbe6bdbcdc0fc.js +1 -0
  23. package/apps/pwa/out/_next/static/chunks/{2a79f15a-2013e4d421d6df88.js → 4daa2798-1363d725c79f3593.js} +1 -1
  24. package/apps/pwa/out/_next/static/chunks/5007-6a3b30e23ff68a6e.js +1 -0
  25. package/apps/pwa/out/_next/static/chunks/5244-12b424c42070f5ff.js +1 -0
  26. package/apps/pwa/out/_next/static/chunks/5348-bbf838e119661eee.js +1 -0
  27. package/apps/pwa/out/_next/static/chunks/5391-8793f88b03b30161.js +1 -0
  28. package/apps/pwa/out/_next/static/chunks/5611-df00af3e4e4a61bb.js +1 -0
  29. package/apps/pwa/out/_next/static/chunks/5890-dca2321773be829a.js +1 -0
  30. package/apps/pwa/out/_next/static/chunks/6123-37c9dc57ddaa7ab0.js +1 -0
  31. package/apps/pwa/out/_next/static/chunks/6588-b7975304a302ab91.js +1 -0
  32. package/apps/pwa/out/_next/static/chunks/6604-c03961962b6273b6.js +1 -0
  33. package/apps/pwa/out/_next/static/chunks/7109-cf8c87e968e83a65.js +1 -0
  34. package/apps/pwa/out/_next/static/chunks/7178-30f77877525a2efb.js +1 -0
  35. package/apps/pwa/out/_next/static/chunks/7262-871563fc9663730b.js +1 -0
  36. package/apps/pwa/out/_next/static/chunks/7294-f0eeebb92aa93459.js +1 -0
  37. package/apps/pwa/out/_next/static/chunks/7429-881af44deed6958f.js +1 -0
  38. package/apps/pwa/out/_next/static/chunks/{5927.8378481a12cc8044.js → 7527.943753b6ed829f09.js} +1 -1
  39. package/apps/pwa/out/_next/static/chunks/764-a01e858525a190c0.js +1 -0
  40. package/apps/pwa/out/_next/static/chunks/7868-e35d5f7985ecd3f1.js +1 -0
  41. package/apps/pwa/out/_next/static/chunks/8320-51484af7b01fdfa5.js +1 -0
  42. package/apps/pwa/out/_next/static/chunks/{6804.8ed6ab492bc5fc0a.js → 8617.465ca22a319c95b3.js} +1 -1
  43. package/apps/pwa/out/_next/static/chunks/{320-d7013ec072863e5e.js → 8918-482b30ce2a8ebf4c.js} +4 -4
  44. package/apps/pwa/out/_next/static/chunks/9131-52f5fad51cceca04.js +1 -0
  45. package/apps/pwa/out/_next/static/chunks/{2598.814f64e3268634e7.js → 9238.2cd5f47f4bf7a2c3.js} +1 -1
  46. package/apps/pwa/out/_next/static/chunks/9704-3221c102623c8d73.js +1 -0
  47. package/apps/pwa/out/_next/static/chunks/app/_not-found/page-70c404c7bb6d7f0f.js +1 -0
  48. package/apps/pwa/out/_next/static/chunks/app/approvals/page-3ffd80166b1050aa.js +1 -0
  49. package/apps/pwa/out/_next/static/chunks/app/autopilot/page-f89e9a303515a033.js +1 -0
  50. package/apps/pwa/out/_next/static/chunks/app/board/page-4f403cd060442c95.js +1 -0
  51. package/apps/pwa/out/_next/static/chunks/app/botlab/page-0ac5d053f0444d21.js +1 -0
  52. package/apps/pwa/out/_next/static/chunks/app/bots/page-4bcc63e272ae8205.js +1 -0
  53. package/apps/pwa/out/_next/static/chunks/app/chat/page-880734bd07d62882.js +1 -0
  54. package/apps/pwa/out/_next/static/chunks/app/control/page-72bd384898d88955.js +1 -0
  55. package/apps/pwa/out/_next/static/chunks/app/design-check/page-1018bbc9586ecae5.js +1 -0
  56. package/apps/pwa/out/_next/static/chunks/app/editor/page-de86f8c38076dd7b.js +1 -0
  57. package/apps/pwa/out/_next/static/chunks/app/healthz/route-70c404c7bb6d7f0f.js +1 -0
  58. package/apps/pwa/out/_next/static/chunks/app/intake/page-cd6447196d8bafe6.js +1 -0
  59. package/apps/pwa/out/_next/static/chunks/app/layout-e733630c47fa102b.js +1 -0
  60. package/apps/pwa/out/_next/static/chunks/app/live/page-d1c1a8357b161875.js +1 -0
  61. package/apps/pwa/out/_next/static/chunks/app/market/page-60c514128e81d787.js +1 -0
  62. package/apps/pwa/out/_next/static/chunks/app/missions/[id]/page-8b637b7e325e13c1.js +1 -0
  63. package/apps/pwa/out/_next/static/chunks/app/morning/page-bccce0babceae30f.js +1 -0
  64. package/apps/pwa/out/_next/static/chunks/app/not-found-63301d11dbe73836.js +1 -0
  65. package/apps/pwa/out/_next/static/chunks/app/observatory/page-a8cf0dc472060db2.js +1 -0
  66. package/apps/pwa/out/_next/static/chunks/app/page-02fba54881ccfa49.js +1 -0
  67. package/apps/pwa/out/_next/static/chunks/app/reflection/page-d5e8e90f0038f8de.js +1 -0
  68. package/apps/pwa/out/_next/static/chunks/app/scheduler/page-b1ef6824f494466a.js +1 -0
  69. package/apps/pwa/out/_next/static/chunks/app/sessions/page-d589bb0f233b1009.js +1 -0
  70. package/apps/pwa/out/_next/static/chunks/app/settings/devices/page-c9bbaebef4cda059.js +1 -0
  71. package/apps/pwa/out/_next/static/chunks/app/settings/page-3639ce7916b92fed.js +1 -0
  72. package/apps/pwa/out/_next/static/chunks/app/setup/done/page-7450ae7478955653.js +1 -0
  73. package/apps/pwa/out/_next/static/chunks/app/setup/layout-70c404c7bb6d7f0f.js +1 -0
  74. package/apps/pwa/out/_next/static/chunks/app/setup/page-b41ca4abfd618452.js +1 -0
  75. package/apps/pwa/out/_next/static/chunks/app/share/page-b333dd79ebee3fa9.js +1 -0
  76. package/apps/pwa/out/_next/static/chunks/app/showroom/page-8be1227492793655.js +1 -0
  77. package/apps/pwa/out/_next/static/chunks/app/tasks/page-6e03e9371b552e0d.js +1 -0
  78. package/apps/pwa/out/_next/static/chunks/app/term/page-911411e9fca18d03.js +1 -0
  79. package/apps/pwa/out/_next/static/chunks/app/trace/page-792170e649b37088.js +1 -0
  80. package/apps/pwa/out/_next/static/chunks/app/vault/page-c40463466937bc91.js +1 -0
  81. package/apps/pwa/out/_next/static/chunks/app/workflows/chat-ui/page-509c798b80384536.js +1 -0
  82. package/apps/pwa/out/_next/static/chunks/app/workflows/page-1cac2aa21d77c417.js +1 -0
  83. package/apps/pwa/out/_next/static/chunks/app/workspace/page-9626799d9b4a2cd1.js +1 -0
  84. package/apps/pwa/out/_next/static/chunks/app/worktrees/page-84cd419494e16b0f.js +1 -0
  85. package/apps/pwa/out/_next/static/chunks/f6f3850d-7f324c6566002113.js +1 -0
  86. package/apps/pwa/out/_next/static/chunks/framework-361487d2da603917.js +1 -0
  87. package/apps/pwa/out/_next/static/chunks/main-app-607f5beb94cb2e07.js +1 -0
  88. package/apps/pwa/out/_next/static/chunks/main-d0222d219e29dddf.js +1 -0
  89. package/apps/pwa/out/_next/static/chunks/pages/_app-a26980a31126decc.js +1 -0
  90. package/apps/pwa/out/_next/static/chunks/pages/_error-edb2b37decf23e4d.js +1 -0
  91. package/apps/pwa/out/_next/static/chunks/webpack-2bf59c720fe9542c.js +1 -0
  92. package/apps/pwa/out/_next/static/css/eaa74e8bb2f62269.css +1 -0
  93. package/apps/pwa/out/_next/static/ktMqfrBbf8BMGac0jqLrb/_buildManifest.js +1 -0
  94. package/apps/pwa/out/approvals/index.html +1 -0
  95. package/apps/pwa/out/approvals/index.txt +32 -0
  96. package/apps/pwa/out/autopilot/index.html +1 -1
  97. package/apps/pwa/out/autopilot/index.txt +29 -26
  98. package/apps/pwa/out/board/index.html +1 -0
  99. package/apps/pwa/out/board/index.txt +32 -0
  100. package/apps/pwa/out/botlab/index.html +1 -1
  101. package/apps/pwa/out/botlab/index.txt +26 -23
  102. package/apps/pwa/out/bots/index.html +1 -1
  103. package/apps/pwa/out/bots/index.txt +26 -23
  104. package/apps/pwa/out/chat/index.html +1 -2
  105. package/apps/pwa/out/chat/index.txt +26 -23
  106. package/apps/pwa/out/control/index.html +1 -1
  107. package/apps/pwa/out/control/index.txt +29 -26
  108. package/apps/pwa/out/design-check/index.html +1 -1
  109. package/apps/pwa/out/design-check/index.txt +29 -26
  110. package/apps/pwa/out/editor/index.html +1 -0
  111. package/apps/pwa/out/editor/index.txt +33 -0
  112. package/apps/pwa/out/healthz +1 -1
  113. package/apps/pwa/out/icons/elanous-16.png +0 -0
  114. package/apps/pwa/out/icons/elanous-180.png +0 -0
  115. package/apps/pwa/out/icons/elanous-192.png +0 -0
  116. package/apps/pwa/out/icons/elanous-32.png +0 -0
  117. package/apps/pwa/out/icons/elanous-512.png +0 -0
  118. package/apps/pwa/out/index.html +1 -1
  119. package/apps/pwa/out/index.txt +26 -23
  120. package/apps/pwa/out/intake/index.html +1 -1
  121. package/apps/pwa/out/intake/index.txt +29 -26
  122. package/apps/pwa/out/live/index.html +1 -0
  123. package/apps/pwa/out/live/index.txt +32 -0
  124. package/apps/pwa/out/manifest.webmanifest +5 -2
  125. package/apps/pwa/out/market/index.html +1 -0
  126. package/apps/pwa/out/market/index.txt +29 -0
  127. package/apps/pwa/out/missions/placeholder/index.html +1 -1
  128. package/apps/pwa/out/missions/placeholder/index.txt +26 -23
  129. package/apps/pwa/out/morning/index.html +1 -1
  130. package/apps/pwa/out/morning/index.txt +29 -26
  131. package/apps/pwa/out/observatory/index.html +1 -1
  132. package/apps/pwa/out/observatory/index.txt +29 -26
  133. package/apps/pwa/out/reflection/index.html +1 -1
  134. package/apps/pwa/out/reflection/index.txt +27 -24
  135. package/apps/pwa/out/scheduler/index.html +1 -1
  136. package/apps/pwa/out/scheduler/index.txt +29 -26
  137. package/apps/pwa/out/sessions/index.html +1 -1
  138. package/apps/pwa/out/sessions/index.txt +26 -23
  139. package/apps/pwa/out/settings/devices/index.html +1 -1
  140. package/apps/pwa/out/settings/devices/index.txt +29 -26
  141. package/apps/pwa/out/settings/index.html +1 -1
  142. package/apps/pwa/out/settings/index.txt +29 -26
  143. package/apps/pwa/out/setup/done/index.html +1 -1
  144. package/apps/pwa/out/setup/done/index.txt +29 -26
  145. package/apps/pwa/out/setup/index.html +1 -1
  146. package/apps/pwa/out/setup/index.txt +29 -26
  147. package/apps/pwa/out/share/index.html +1 -1
  148. package/apps/pwa/out/share/index.txt +29 -26
  149. package/apps/pwa/out/showroom/index.html +1 -1
  150. package/apps/pwa/out/showroom/index.txt +26 -23
  151. package/apps/pwa/out/sw-strategies.js +44 -0
  152. package/apps/pwa/out/sw.js +6 -44
  153. package/apps/pwa/out/tasks/index.html +1 -1
  154. package/apps/pwa/out/tasks/index.txt +29 -26
  155. package/apps/pwa/out/term/index.html +1 -1
  156. package/apps/pwa/out/term/index.txt +29 -26
  157. package/apps/pwa/out/trace/index.html +1 -0
  158. package/apps/pwa/out/trace/index.txt +32 -0
  159. package/apps/pwa/out/vault/index.html +1 -1
  160. package/apps/pwa/out/vault/index.txt +29 -26
  161. package/apps/pwa/out/workflows/chat-ui/index.html +1 -1
  162. package/apps/pwa/out/workflows/chat-ui/index.txt +29 -26
  163. package/apps/pwa/out/workflows/index.html +1 -1
  164. package/apps/pwa/out/workflows/index.txt +29 -27
  165. package/apps/pwa/out/workspace/index.html +1 -1
  166. package/apps/pwa/out/workspace/index.txt +29 -26
  167. package/apps/pwa/out/worktrees/index.html +1 -1
  168. package/apps/pwa/out/worktrees/index.txt +29 -26
  169. package/catalog/resources.yaml +14 -17
  170. package/docs/design/systems/LICENSE +201 -0
  171. package/docs/design/systems/NOTICE.md +29 -0
  172. package/docs/design/systems/SOURCE.json +291 -0
  173. package/docs/design/systems/application/DESIGN.md +71 -0
  174. package/docs/design/systems/application/manifest.json +54 -0
  175. package/docs/design/systems/application/tokens.css +63 -0
  176. package/docs/design/systems/artistic/DESIGN.md +71 -0
  177. package/docs/design/systems/artistic/manifest.json +54 -0
  178. package/docs/design/systems/artistic/tokens.css +63 -0
  179. package/docs/design/systems/bento/DESIGN.md +71 -0
  180. package/docs/design/systems/bento/manifest.json +54 -0
  181. package/docs/design/systems/bento/tokens.css +63 -0
  182. package/docs/design/systems/bold/DESIGN.md +71 -0
  183. package/docs/design/systems/bold/manifest.json +54 -0
  184. package/docs/design/systems/bold/tokens.css +63 -0
  185. package/docs/design/systems/brutalism/DESIGN.md +71 -0
  186. package/docs/design/systems/brutalism/manifest.json +54 -0
  187. package/docs/design/systems/brutalism/tokens.css +63 -0
  188. package/docs/design/systems/cafe/DESIGN.md +71 -0
  189. package/docs/design/systems/cafe/manifest.json +54 -0
  190. package/docs/design/systems/cafe/tokens.css +63 -0
  191. package/docs/design/systems/claymorphism/DESIGN.md +71 -0
  192. package/docs/design/systems/claymorphism/manifest.json +54 -0
  193. package/docs/design/systems/claymorphism/tokens.css +63 -0
  194. package/docs/design/systems/clean/DESIGN.md +71 -0
  195. package/docs/design/systems/clean/manifest.json +54 -0
  196. package/docs/design/systems/clean/tokens.css +63 -0
  197. package/docs/design/systems/colorful/DESIGN.md +71 -0
  198. package/docs/design/systems/colorful/manifest.json +54 -0
  199. package/docs/design/systems/colorful/tokens.css +63 -0
  200. package/docs/design/systems/contemporary/DESIGN.md +71 -0
  201. package/docs/design/systems/contemporary/manifest.json +54 -0
  202. package/docs/design/systems/contemporary/tokens.css +63 -0
  203. package/docs/design/systems/corporate/DESIGN.md +71 -0
  204. package/docs/design/systems/corporate/manifest.json +54 -0
  205. package/docs/design/systems/corporate/tokens.css +63 -0
  206. package/docs/design/systems/cosmic/DESIGN.md +71 -0
  207. package/docs/design/systems/cosmic/manifest.json +54 -0
  208. package/docs/design/systems/cosmic/tokens.css +63 -0
  209. package/docs/design/systems/creative/DESIGN.md +71 -0
  210. package/docs/design/systems/creative/manifest.json +54 -0
  211. package/docs/design/systems/creative/tokens.css +63 -0
  212. package/docs/design/systems/dashboard/DESIGN.md +71 -0
  213. package/docs/design/systems/dashboard/manifest.json +54 -0
  214. package/docs/design/systems/dashboard/tokens.css +63 -0
  215. package/docs/design/systems/default/DESIGN.md +62 -0
  216. package/docs/design/systems/default/manifest.json +69 -0
  217. package/docs/design/systems/default/tokens.css +200 -0
  218. package/docs/design/systems/dithered/DESIGN.md +71 -0
  219. package/docs/design/systems/dithered/manifest.json +54 -0
  220. package/docs/design/systems/dithered/tokens.css +63 -0
  221. package/docs/design/systems/doodle/DESIGN.md +71 -0
  222. package/docs/design/systems/doodle/manifest.json +54 -0
  223. package/docs/design/systems/doodle/tokens.css +63 -0
  224. package/docs/design/systems/dramatic/DESIGN.md +71 -0
  225. package/docs/design/systems/dramatic/manifest.json +54 -0
  226. package/docs/design/systems/dramatic/tokens.css +63 -0
  227. package/docs/design/systems/editorial/DESIGN.md +71 -0
  228. package/docs/design/systems/editorial/manifest.json +54 -0
  229. package/docs/design/systems/editorial/tokens.css +63 -0
  230. package/docs/design/systems/elegant/DESIGN.md +71 -0
  231. package/docs/design/systems/elegant/manifest.json +54 -0
  232. package/docs/design/systems/elegant/tokens.css +63 -0
  233. package/docs/design/systems/energetic/DESIGN.md +72 -0
  234. package/docs/design/systems/energetic/manifest.json +54 -0
  235. package/docs/design/systems/energetic/tokens.css +63 -0
  236. package/docs/design/systems/enterprise/DESIGN.md +71 -0
  237. package/docs/design/systems/enterprise/manifest.json +54 -0
  238. package/docs/design/systems/enterprise/tokens.css +63 -0
  239. package/docs/design/systems/expressive/DESIGN.md +71 -0
  240. package/docs/design/systems/expressive/manifest.json +54 -0
  241. package/docs/design/systems/expressive/tokens.css +63 -0
  242. package/docs/design/systems/fantasy/DESIGN.md +71 -0
  243. package/docs/design/systems/fantasy/manifest.json +54 -0
  244. package/docs/design/systems/fantasy/tokens.css +63 -0
  245. package/docs/design/systems/flat/DESIGN.md +71 -0
  246. package/docs/design/systems/flat/manifest.json +54 -0
  247. package/docs/design/systems/flat/tokens.css +63 -0
  248. package/docs/design/systems/friendly/DESIGN.md +71 -0
  249. package/docs/design/systems/friendly/manifest.json +54 -0
  250. package/docs/design/systems/friendly/tokens.css +63 -0
  251. package/docs/design/systems/glassmorphism/DESIGN.md +71 -0
  252. package/docs/design/systems/glassmorphism/manifest.json +54 -0
  253. package/docs/design/systems/glassmorphism/tokens.css +63 -0
  254. package/docs/design/systems/gradient/DESIGN.md +71 -0
  255. package/docs/design/systems/gradient/manifest.json +54 -0
  256. package/docs/design/systems/gradient/tokens.css +63 -0
  257. package/docs/design/systems/luxury/DESIGN.md +71 -0
  258. package/docs/design/systems/luxury/manifest.json +54 -0
  259. package/docs/design/systems/luxury/tokens.css +63 -0
  260. package/docs/design/systems/minimal/DESIGN.md +71 -0
  261. package/docs/design/systems/minimal/manifest.json +54 -0
  262. package/docs/design/systems/minimal/tokens.css +63 -0
  263. package/docs/design/systems/modern/DESIGN.md +71 -0
  264. package/docs/design/systems/modern/manifest.json +54 -0
  265. package/docs/design/systems/modern/tokens.css +63 -0
  266. package/docs/design/systems/mono/DESIGN.md +71 -0
  267. package/docs/design/systems/mono/manifest.json +54 -0
  268. package/docs/design/systems/mono/tokens.css +63 -0
  269. package/docs/design/systems/neobrutalism/DESIGN.md +71 -0
  270. package/docs/design/systems/neobrutalism/manifest.json +54 -0
  271. package/docs/design/systems/neobrutalism/tokens.css +63 -0
  272. package/docs/design/systems/neon/DESIGN.md +71 -0
  273. package/docs/design/systems/neon/manifest.json +54 -0
  274. package/docs/design/systems/neon/tokens.css +63 -0
  275. package/docs/design/systems/neumorphism/DESIGN.md +71 -0
  276. package/docs/design/systems/neumorphism/manifest.json +54 -0
  277. package/docs/design/systems/neumorphism/tokens.css +63 -0
  278. package/docs/design/systems/paper/DESIGN.md +71 -0
  279. package/docs/design/systems/paper/manifest.json +54 -0
  280. package/docs/design/systems/paper/tokens.css +63 -0
  281. package/docs/design/systems/perspective/DESIGN.md +71 -0
  282. package/docs/design/systems/perspective/manifest.json +54 -0
  283. package/docs/design/systems/perspective/tokens.css +63 -0
  284. package/docs/design/systems/premium/DESIGN.md +71 -0
  285. package/docs/design/systems/premium/manifest.json +54 -0
  286. package/docs/design/systems/premium/tokens.css +63 -0
  287. package/docs/design/systems/professional/DESIGN.md +71 -0
  288. package/docs/design/systems/professional/manifest.json +54 -0
  289. package/docs/design/systems/professional/tokens.css +63 -0
  290. package/docs/design/systems/publication/DESIGN.md +71 -0
  291. package/docs/design/systems/publication/manifest.json +54 -0
  292. package/docs/design/systems/publication/tokens.css +63 -0
  293. package/docs/design/systems/refined/DESIGN.md +71 -0
  294. package/docs/design/systems/refined/manifest.json +54 -0
  295. package/docs/design/systems/refined/tokens.css +63 -0
  296. package/docs/design/systems/retro/DESIGN.md +71 -0
  297. package/docs/design/systems/retro/manifest.json +54 -0
  298. package/docs/design/systems/retro/tokens.css +63 -0
  299. package/docs/design/systems/shadcn/DESIGN.md +71 -0
  300. package/docs/design/systems/shadcn/manifest.json +54 -0
  301. package/docs/design/systems/shadcn/tokens.css +255 -0
  302. package/docs/design/systems/simple/DESIGN.md +71 -0
  303. package/docs/design/systems/simple/manifest.json +54 -0
  304. package/docs/design/systems/simple/tokens.css +63 -0
  305. package/docs/design/systems/skeumorphism/DESIGN.md +71 -0
  306. package/docs/design/systems/skeumorphism/manifest.json +54 -0
  307. package/docs/design/systems/skeumorphism/tokens.css +63 -0
  308. package/docs/design/systems/sleek/DESIGN.md +71 -0
  309. package/docs/design/systems/sleek/manifest.json +54 -0
  310. package/docs/design/systems/sleek/tokens.css +63 -0
  311. package/docs/design/systems/spacious/DESIGN.md +71 -0
  312. package/docs/design/systems/spacious/manifest.json +54 -0
  313. package/docs/design/systems/spacious/tokens.css +63 -0
  314. package/docs/design/systems/storytelling/DESIGN.md +71 -0
  315. package/docs/design/systems/storytelling/manifest.json +54 -0
  316. package/docs/design/systems/storytelling/tokens.css +63 -0
  317. package/docs/design/systems/tom-modern/DESIGN.md +361 -0
  318. package/docs/design/systems/tom-modern/manifest.json +16 -0
  319. package/docs/design/systems/tom-modern/tokens.css +99 -0
  320. package/docs/design/systems/vibrant/DESIGN.md +71 -0
  321. package/docs/design/systems/vibrant/manifest.json +54 -0
  322. package/docs/design/systems/vibrant/tokens.css +63 -0
  323. package/docs/design/systems/vintage/DESIGN.md +71 -0
  324. package/docs/design/systems/vintage/manifest.json +54 -0
  325. package/docs/design/systems/vintage/tokens.css +63 -0
  326. package/docs/design/systems/warm-editorial/DESIGN.md +65 -0
  327. package/docs/design/systems/warm-editorial/manifest.json +54 -0
  328. package/docs/design/systems/warm-editorial/tokens.css +63 -0
  329. package/docs/goal-context/01-goal-authoring-checks.md +18 -0
  330. package/docs/goal-context/steward-directives-2026-09-28.md +42 -0
  331. package/graphs/catalog/catalog.yaml +615 -0
  332. package/graphs/default-loop.yaml +1 -1
  333. package/graphs/document-loop.yaml +1 -1
  334. package/graphs/examples/stale-draft-digest/digest.ts +26 -0
  335. package/graphs/examples/stale-draft-digest/recipes.yaml +8 -0
  336. package/graphs/examples/stale-draft-digest/stale-draft-digest.yaml +22 -0
  337. package/graphs/heal/heal-loop.yaml +155 -0
  338. package/graphs/heal/recipes.yaml +19 -0
  339. package/graphs/implement-loop.yaml +2 -2
  340. package/graphs/intake/intake-daily.yaml +55 -0
  341. package/graphs/intake/recipes.yaml +16 -0
  342. package/graphs/landing/landing-heal.yaml +22 -0
  343. package/graphs/landing/recipes.yaml +8 -0
  344. package/graphs/launch/launch-head.yaml +66 -0
  345. package/graphs/launch/recipes.yaml +8 -0
  346. package/graphs/operate-loop.yaml +1 -1
  347. package/graphs/ops/docs-publish.yaml +31 -0
  348. package/graphs/ops/recipes.yaml +8 -0
  349. package/graphs/release/recipes.yaml +45 -0
  350. package/graphs/release/release-loop.yaml +45 -0
  351. package/graphs/research-loop.yaml +1 -1
  352. package/graphs/steward/recipes.yaml +12 -0
  353. package/graphs/steward/steward.yaml +45 -0
  354. package/graphs/video/README.md +1 -0
  355. package/graphs/video/broll-line.yaml +54 -0
  356. package/graphs/video/explainer-line.yaml +58 -0
  357. package/package.json +9 -5
  358. package/plugins/job-coach/.agents/plugins/marketplace.json +12 -0
  359. package/plugins/job-coach/.codex-plugin/plugin.json +23 -0
  360. package/plugins/job-coach/.mcp.json +9 -0
  361. package/plugins/job-coach/README.md +32 -0
  362. package/plugins/job-coach/connectors/ncs/server.ts +90 -0
  363. package/plugins/job-coach/examples/interview-sample.md +11 -0
  364. package/plugins/job-coach/graphs/course-links.ts +46 -0
  365. package/plugins/job-coach/graphs/gap-judge.ts +44 -0
  366. package/plugins/job-coach/graphs/recipes.yaml +45 -0
  367. package/plugins/job-coach/graphs/report-enterprise.yaml +28 -0
  368. package/plugins/job-coach/graphs/report.yaml +20 -0
  369. package/plugins/job-coach/graphs/run-step.ts +302 -0
  370. package/plugins/job-coach/plugin.json +26 -0
  371. package/plugins/job-coach/plugin.ts +6 -0
  372. package/plugins/job-coach/skills/career-report/SKILL.md +6 -0
  373. package/plugins/job-coach/skills/enterprise-ai-fit/SKILL.md +8 -0
  374. package/plugins/job-coach/skills/enterprise-competency/SKILL.md +8 -0
  375. package/plugins/job-coach/skills/enterprise-needs/SKILL.md +8 -0
  376. package/plugins/job-coach/skills/enterprise-roadmap/SKILL.md +8 -0
  377. package/plugins/job-coach/skills/enterprise-task-analysis/SKILL.md +8 -0
  378. package/plugins/job-coach/skills/interview-to-profile/SKILL.md +23 -0
  379. package/plugins/job-coach/skills/run-report/SKILL.md +15 -0
  380. package/scripts/backup/elanous-backup.sh +143 -14
  381. package/scripts/backup/elanous-restore.sh +122 -0
  382. package/scripts/build-docs-site.ts +4 -3
  383. package/scripts/ci-daemon-port-gate.ts +164 -0
  384. package/scripts/ci-typecheck-changed.ts +15 -1
  385. package/scripts/cli-json-exit-scan.ts +126 -0
  386. package/scripts/codex-quota-alert-format.ts +52 -0
  387. package/scripts/codex-quota-alert.ts +63 -13
  388. package/scripts/continuation-dogfood.ts +2 -1
  389. package/scripts/coord-channel-watch.sh +28 -9
  390. package/scripts/coord-post.sh +49 -12
  391. package/scripts/coord-tracks.json +6 -5
  392. package/scripts/cron-run.ts +37 -16
  393. package/scripts/daemon-port-baseline.txt +9 -0
  394. package/scripts/design/extract-corpus-bench.ts +469 -0
  395. package/scripts/design/extract-corpus-score.ts +510 -0
  396. package/scripts/design/vendor-open-design-systems.ts +100 -0
  397. package/scripts/docs-lint.ts +1 -1
  398. package/scripts/eval-bot-vs-grok.ts +79 -0
  399. package/scripts/eval-grok-live-baseline.ts +36 -0
  400. package/scripts/fixtures/front-route-corpus.sample.json +17 -0
  401. package/scripts/fleet/node-setup.sh +80 -7
  402. package/scripts/heal/run-role.ts +328 -0
  403. package/scripts/install-role-watch.sh +95 -0
  404. package/scripts/install.ps1 +11 -1
  405. package/scripts/install.sh +81 -9
  406. package/scripts/isolation-hardcode-baseline.txt +1 -1
  407. package/scripts/landing-heal/must-fix-match.ts +63 -0
  408. package/scripts/landing-heal/run-mission.ts +195 -0
  409. package/scripts/lib/front-route-measurement.ts +131 -0
  410. package/scripts/lib/pwa-scenarios/acp-replay.ts +79 -0
  411. package/scripts/lib/pwa-scenarios/cdp-driver.ts +67 -0
  412. package/scripts/lib/pwa-scenarios/runner.ts +200 -0
  413. package/scripts/lib/pwa-scenarios/scenarios.ts +202 -0
  414. package/scripts/lib/tui-sim-keys.ts +42 -0
  415. package/scripts/market/db-check.ts +212 -0
  416. package/scripts/market-posture-cycle.ts +63 -4
  417. package/scripts/measure-front-route-classifier.ts +56 -0
  418. package/scripts/media/ocr-leak-scan.sh +21 -0
  419. package/scripts/nightly-docops.ts +1 -1
  420. package/scripts/ops/channel-bot-token-migrate.ts +146 -0
  421. package/scripts/ops-health-check.ts +15 -3
  422. package/scripts/pty-scenarios/run.ts +272 -0
  423. package/scripts/public-export.ts +2 -3
  424. package/scripts/public-import-pr.ts +80 -6
  425. package/scripts/public-leak-baseline.txt +0 -7
  426. package/scripts/publish-internal-dist.ts +118 -0
  427. package/scripts/pwa-scenarios.ts +106 -0
  428. package/scripts/rebrand-elanous.ts +1 -1
  429. package/scripts/red-sweep-diff.ts +1 -1
  430. package/scripts/release-loop/auto-approve-node.ts +72 -0
  431. package/scripts/release-loop/cutoff.ts +139 -0
  432. package/scripts/release-loop/docs-land-node.ts +65 -0
  433. package/scripts/release-loop/docs-node.ts +172 -0
  434. package/scripts/release-loop/gate-diff.ts +29 -0
  435. package/scripts/release-loop/gate-node.ts +641 -0
  436. package/scripts/release-loop/node-verdict.ts +85 -0
  437. package/scripts/release-loop/prepare-node.ts +31 -0
  438. package/scripts/release-loop/publish-node.ts +61 -0
  439. package/scripts/release-loop/pwa-node-verdict.ts +45 -0
  440. package/scripts/release-loop/pwa-scenarios-node.ts +140 -0
  441. package/scripts/release-loop/release-docs.ts +109 -0
  442. package/scripts/release-loop/test-durations.ts +63 -0
  443. package/scripts/release-loop/tui-node-checks.ts +29 -0
  444. package/scripts/release-loop/tui-sim-node.ts +113 -0
  445. package/scripts/release-loop/upgrade-node.ts +26 -0
  446. package/scripts/release-loop/verify-node.ts +21 -0
  447. package/scripts/release-loop/version-node.ts +147 -0
  448. package/scripts/release-upgrade-check.sh +53 -0
  449. package/scripts/se-mission-prepare.ts +9 -15
  450. package/scripts/test-audit-coverage-per-file.sh +16 -0
  451. package/scripts/test-audit-meaningless.ts +88 -0
  452. package/scripts/test-audit-overlap-and-weak.ts +73 -0
  453. package/scripts/test-deterministic.ts +29 -6
  454. package/scripts/tui-sim.ts +59 -14
  455. package/scripts/uninstall.sh +10 -3
  456. package/scripts/ux/bump-installed.sh +20 -0
  457. package/scripts/ux/lib/cdp.ts +72 -0
  458. package/scripts/ux/record-page.ts +50 -0
  459. package/scripts/video-broll-line.ts +89 -0
  460. package/scripts/waitlist-daily-digest.ts +108 -0
  461. package/scripts/window-landings.sh +1 -1
  462. package/skills/explainer-video/SKILL.md +99 -0
  463. package/skills/explainer-video/engine/brand/elanous-mark-on-dark.svg +1 -0
  464. package/skills/explainer-video/engine/build.mjs +431 -0
  465. package/skills/explainer-video/engine/vo.ts +37 -0
  466. package/skills/explainer-video/examples/elanous-0.2.5/script.json +155 -0
  467. package/skills/motion-broll/LICENSE +25 -0
  468. package/skills/motion-broll/SKILL.md +150 -0
  469. package/skills/motion-broll/SOURCE.md +6 -0
  470. package/skills/motion-broll/engine/base.css +19 -0
  471. package/skills/motion-broll/engine/beats.js +11 -0
  472. package/skills/motion-broll/engine/build.py +21 -0
  473. package/skills/motion-broll/engine/fonts/Geist-Variable.woff2 +0 -0
  474. package/skills/motion-broll/engine/fonts/GeistMono-Medium.woff2 +0 -0
  475. package/skills/motion-broll/engine/fonts/OFL-Geist.txt +92 -0
  476. package/skills/motion-broll/engine/motion.js +146 -0
  477. package/skills/motion-broll/engine/render.js +22 -0
  478. package/skills/motion-broll/examples/opus-aoe2/01-opus-drop.html +41 -0
  479. package/skills/motion-broll/examples/opus-aoe2/02-pip-builds.html +110 -0
  480. package/skills/motion-broll/examples/opus-aoe2/03-effort-slider.html +38 -0
  481. package/skills/motion-broll/examples/opus-aoe2/04-master-prompt.html +56 -0
  482. package/skills/motion-broll/examples/opus-aoe2/05-low-vs-max.html +49 -0
  483. package/skills/motion-broll/examples/opus-aoe2/06-chapter.html +18 -0
  484. package/skills/motion-broll/examples/opus-aoe2/plan.json +14 -0
  485. package/skills/motion-broll/reference/engine-api.md +106 -0
  486. package/skills/motion-broll/scripts/composite.py +14 -0
  487. package/skills/motion-broll/scripts/inspect_video.py +34 -0
  488. package/skills/motion-broll/scripts/make_pages.py +34 -0
  489. package/skills/motion-broll/scripts/setup.sh +16 -0
  490. package/skills/motion-broll/scripts/words.py +13 -0
  491. package/skills/motion-broll/templates/compare.html +135 -0
  492. package/skills/motion-broll/templates/viewer.html +97 -0
  493. package/skills/omni-digest/SKILL.md +260 -0
  494. package/skills/omni-digest/digest.md +197 -0
  495. package/skills/omni-digest/docs/diagrams/noncode-terminal-promotion-path-2026-08-13.mmd +32 -0
  496. package/skills/omni-digest/package-lock.json +558 -0
  497. package/skills/omni-digest/package.json +13 -0
  498. package/skills/omni-digest/scripts/main.ts +404 -0
  499. package/skills/omni-digest/src/delegate.ts +34 -0
  500. package/skills/omni-digest/src/detect.ts +46 -0
  501. package/skills/omni-digest/src/diagram.ts +72 -0
  502. package/skills/omni-digest/src/domain-staging.ts +50 -0
  503. package/skills/omni-digest/src/env.ts +38 -0
  504. package/skills/omni-digest/src/fetch.ts +237 -0
  505. package/skills/omni-digest/src/media.ts +180 -0
  506. package/skills/omni-digest/src/obsidian.ts +69 -0
  507. package/skills/omni-digest/src/ocr.ts +149 -0
  508. package/skills/omni-digest/src/router.ts +60 -0
  509. package/skills/omni-digest/src/summarize.ts +87 -0
  510. package/skills/omni-digest/src/types.ts +124 -0
  511. package/skills/omni-digest/src/util.ts +34 -0
  512. package/skills/omni-digest/src/visual.ts +129 -0
  513. package/skills/omni-digest/src/x-api.ts +151 -0
  514. package/skills/omni-digest/tsconfig.json +13 -0
  515. package/src/a2a/agent-card.ts +29 -0
  516. package/src/a2a/server.ts +173 -0
  517. package/src/acp/auto-persist.ts +3 -6
  518. package/src/acp/backend-registry.ts +6 -10
  519. package/src/acp/channel-browser-shell.ts +1 -535
  520. package/src/acp/client.ts +106 -36
  521. package/src/acp/fs-roots.ts +20 -4
  522. package/src/acp/obsidian-tags.ts +6 -3
  523. package/src/acp/server.ts +189 -32
  524. package/src/agent/nested-agent-env.ts +1 -0
  525. package/src/agent/pty-binding.ts +1 -1
  526. package/src/agent/spawn-embodied-agent-in-vw.ts +5 -336
  527. package/src/agent/subagent-callable.ts +39 -1
  528. package/src/agent-mission/browser-login.ts +241 -0
  529. package/src/agent-mission/capabilities-cli.ts +33 -0
  530. package/src/agent-mission/capability-matrix.ts +31 -0
  531. package/src/agent-mission/capability-readers.ts +79 -0
  532. package/src/agent-mission/capability-types.ts +15 -0
  533. package/src/agent-mission/claude-headless.ts +131 -0
  534. package/src/agent-mission/claude-subscription.ts +57 -0
  535. package/src/agent-mission/doc-guided-install.ts +185 -0
  536. package/src/agent-mission/driver.ts +900 -69
  537. package/src/agent-mission/env-profile.ts +68 -0
  538. package/src/agent-mission/handoff.ts +128 -0
  539. package/src/agent-mission/in-agent-plugin.ts +311 -0
  540. package/src/agent-mission/mission-cli.ts +25 -1
  541. package/src/agent-mission/parse.ts +9 -4
  542. package/src/agent-mission/pr-review-watch.ts +62 -13
  543. package/src/agent-mission/resource-ladder.ts +235 -0
  544. package/src/agent-mission/tool-install.ts +249 -0
  545. package/src/agent-mission/tool-ladder.ts +37 -0
  546. package/src/agent-room/room-builder.ts +6 -600
  547. package/src/agent-substrate/review-intent.ts +43 -1
  548. package/src/auth/acp-token.ts +16 -0
  549. package/src/auth/github-app-token.ts +112 -0
  550. package/src/auth/scope.ts +8 -4
  551. package/src/auth/temp-tokens.ts +131 -0
  552. package/src/auto-research/obsidian-bridge.ts +2 -0
  553. package/src/autopilot/build/integrity-gate.ts +27 -4
  554. package/src/autopilot/build/isolated-instance.ts +2 -1
  555. package/src/autopilot/build/llm-conflict-merge.ts +27 -0
  556. package/src/autopilot/gh-rest-fallback.ts +177 -0
  557. package/src/autopilot/llm-control-brain.ts +54 -12
  558. package/src/autopilot/mission-engine.ts +15 -1
  559. package/src/autopilot/mission-notify.ts +4 -2
  560. package/src/autopilot/mission-origin.ts +5 -5
  561. package/src/autopilot/mission-phase-track.ts +52 -0
  562. package/src/autopilot/mission-tool.ts +1 -1
  563. package/src/autopilot/pr-manager.ts +51 -4
  564. package/src/autopilot/pty-control-loop.ts +94 -2
  565. package/src/autopilot/track-agent.ts +138 -0
  566. package/src/autopilot/track-courier.ts +153 -0
  567. package/src/boot/acp-server.ts +18 -18
  568. package/src/boot/check-same-origin.ts +19 -5
  569. package/src/boot/daemon-multi-llm-runtime.ts +14 -8
  570. package/src/boot/daemon-prompt-turn.ts +2 -0
  571. package/src/boot/daemon-runtime.ts +36 -14
  572. package/src/boot/daemon-tools/index.ts +16 -0
  573. package/src/boot/daemon-tools/self-implement.ts +4 -0
  574. package/src/boot/daemon-tools/types.ts +3 -0
  575. package/src/boot/daemon-tools/web-search.ts +2 -1
  576. package/src/boot/ws-bridge.ts +11 -0
  577. package/src/browser-cdp/chrome-flags.ts +7 -0
  578. package/src/browser-cdp/client.ts +2 -0
  579. package/src/browser-pane/mount.ts +1 -246
  580. package/src/budget/codex-reset-credit-state.ts +15 -0
  581. package/src/budget/fetchers/codex.ts +2 -1
  582. package/src/budget/run-usage-rollup.ts +11 -4
  583. package/src/budget/unified-usage.ts +2 -1
  584. package/src/capture/tui-self-report.ts +10 -0
  585. package/src/channel-bot-token.ts +126 -0
  586. package/src/chat/index.ts +57 -52
  587. package/src/chat/input-text-key.ts +2 -2
  588. package/src/chat/log-scroll-key.ts +12 -0
  589. package/src/chat/mode/manual.ts +2 -4
  590. package/src/chat/pickers/state.ts +10 -27
  591. package/src/chat/search/modal.ts +14 -2
  592. package/src/chat/submit-trace.ts +30 -0
  593. package/src/chat/tool-render/types.ts +1 -1
  594. package/src/chat/turn-typeahead.ts +2 -1
  595. package/src/chat/wrap.ts +6 -8
  596. package/src/cli/__fixtures__/agent-help-before/agent.txt +18 -0
  597. package/src/cli/__fixtures__/agent-help-before/registry.txt +13 -0
  598. package/src/cli/__fixtures__/agent-help-before/root.txt +100 -0
  599. package/src/cli/__fixtures__/agent-help-before/tier.txt +15 -0
  600. package/src/cli/a2a-cli.ts +52 -0
  601. package/src/cli/agent-cli.ts +726 -0
  602. package/src/cli/autopilot-cli.ts +739 -0
  603. package/src/cli/bg-launch.ts +20 -4
  604. package/src/cli/claude-plugin-setup.ts +199 -0
  605. package/src/cli/config-test-sync.ts +94 -10
  606. package/src/cli/connector-cli.ts +204 -0
  607. package/src/cli/control-cli.ts +220 -0
  608. package/src/cli/control-join-cli.ts +142 -0
  609. package/src/cli/decisions-cli.ts +94 -0
  610. package/src/cli/docs-cli.ts +38 -0
  611. package/src/cli/doctor-cli.ts +262 -77
  612. package/src/cli/doctor-distro.ts +17 -1
  613. package/src/cli/doctor-fix.ts +145 -17
  614. package/src/cli/doctor-llm-assist.ts +71 -0
  615. package/src/cli/doctor-private-files.ts +66 -0
  616. package/src/cli/doctor-readiness.ts +23 -28
  617. package/src/cli/fleet-cli.ts +63 -0
  618. package/src/cli/g6a-registration-probe.ts +16 -0
  619. package/src/cli/git-install-plan.ts +51 -0
  620. package/src/cli/hooks-cli.ts +44 -0
  621. package/src/cli/ingest-token-cli.ts +21 -0
  622. package/src/cli/intake-cli.ts +416 -0
  623. package/src/cli/labels-cli.ts +74 -0
  624. package/src/cli/leader-cli.ts +10 -159
  625. package/src/cli/live-cli.ts +48 -0
  626. package/src/cli/llm-detect-cli.ts +130 -0
  627. package/src/cli/logs-cli.ts +231 -7
  628. package/src/cli/machine-cli.ts +38 -0
  629. package/src/cli/mcp-call.ts +52 -13
  630. package/src/cli/mcp-gateway-cli.ts +94 -0
  631. package/src/cli/mcp-login.ts +116 -8
  632. package/src/cli/mcp-reload.ts +20 -3
  633. package/src/cli/nexus-dist.ts +18 -13
  634. package/src/cli/nexus-ios-bind.ts +20 -7
  635. package/src/cli/ops-cli.ts +225 -0
  636. package/src/cli/plugin-cli.ts +201 -0
  637. package/src/cli/pod-cli.ts +83 -0
  638. package/src/cli/port-lease-local.ts +124 -0
  639. package/src/cli/pr-cli.ts +12 -1
  640. package/src/cli/pr-lineage.ts +2 -1
  641. package/src/cli/provider-cli.ts +720 -0
  642. package/src/cli/pty-record-cli.ts +63 -0
  643. package/src/cli/pty-takeover-cli.ts +57 -40
  644. package/src/cli/pty-web-address.ts +52 -0
  645. package/src/cli/publish-cli.ts +44 -0
  646. package/src/cli/pwa-build.ts +18 -12
  647. package/src/cli/pwa-dev.ts +13 -8
  648. package/src/cli/pwa-registry.ts +6 -0
  649. package/src/cli/pwa-share.ts +65 -22
  650. package/src/cli/pwa-show.ts +20 -4
  651. package/src/cli/pwa-start.ts +102 -27
  652. package/src/cli/pwa-test.ts +201 -96
  653. package/src/cli/release-cli.ts +177 -7
  654. package/src/cli/remotes-cli.ts +20 -1
  655. package/src/cli/remotes.ts +2 -1
  656. package/src/cli/repo-cli.ts +315 -36
  657. package/src/cli/research-cli.ts +66 -0
  658. package/src/cli/role-cli.ts +320 -0
  659. package/src/cli/schedule-cli.ts +246 -0
  660. package/src/cli/self-update.ts +103 -12
  661. package/src/cli/setup-cli.ts +64 -2
  662. package/src/cli/shadow-cli.ts +188 -0
  663. package/src/cli/share-auto-mount.ts +12 -8
  664. package/src/cli/start-cli.ts +240 -0
  665. package/src/cli/stdout-flush.ts +8 -0
  666. package/src/cli/storage-cli.ts +334 -0
  667. package/src/cli/tailscale-serve.ts +34 -19
  668. package/src/cli/tasks-cli.ts +176 -0
  669. package/src/cli/test-state-dir-flag.ts +1 -1
  670. package/src/cli/usage-cli.ts +15 -4
  671. package/src/cli/where-cli.ts +22 -55
  672. package/src/code-edit/diff-render.ts +6 -32
  673. package/src/code-edit/source-delta-browser.ts +0 -1
  674. package/src/codex/models.ts +1 -1
  675. package/src/config.ts +8 -13
  676. package/src/connectors/event-ledger.ts +41 -0
  677. package/src/connectors/linear-projector.ts +88 -0
  678. package/src/connectors/linear.ts +143 -0
  679. package/src/connectors/types.ts +19 -0
  680. package/src/control-plane/lease-holder.ts +41 -0
  681. package/src/control-plane/ledger.ts +146 -0
  682. package/src/control-plane/light-member.ts +164 -0
  683. package/src/control-plane/member-tokens.ts +88 -0
  684. package/src/control-plane/member.ts +159 -0
  685. package/src/control-plane/port-lease-heartbeat.ts +101 -0
  686. package/src/control-plane/ports.ts +40 -0
  687. package/src/control-plane/primary.ts +169 -0
  688. package/src/control-plane/server.ts +216 -0
  689. package/src/dashboard/acp-boot.ts +14 -38
  690. package/src/dashboard/assistant-render-state-runtime.ts +2 -2
  691. package/src/dashboard/assistant-sample-runtime.ts +2 -2
  692. package/src/dashboard/auto-compact-runtime.ts +11 -16
  693. package/src/dashboard/browser-help-runtime.ts +2 -3
  694. package/src/dashboard/chat/acp-chat.ts +2 -5
  695. package/src/dashboard/code-edit-post-turn-runtime.ts +1 -2
  696. package/src/dashboard/compact-surface-assembly.ts +0 -14
  697. package/src/dashboard/compact-surface-dispatch.ts +1 -38
  698. package/src/dashboard/compact-surface-inventory.ts +0 -8
  699. package/src/dashboard/compact-surface-runtime.ts +0 -14
  700. package/src/dashboard/context-menu-provider-boot.ts +0 -9
  701. package/src/dashboard/context-window-runtime-boot.ts +0 -37
  702. package/src/dashboard/index.ts +331 -2562
  703. package/src/dashboard/input/chat-main-plain-turn-runtime.ts +0 -6
  704. package/src/dashboard/input/chat-main-slash-command.ts +2 -2
  705. package/src/dashboard/input/dashboard-priority-key-route.ts +1 -43
  706. package/src/dashboard/input/mouse-modal-surface-runtime.ts +1 -5
  707. package/src/dashboard/input/mouse-wiring.ts +2 -3
  708. package/src/dashboard/input/no-provider-reply.ts +13 -0
  709. package/src/dashboard/layout-display-runtime-registration.ts +0 -10
  710. package/src/dashboard/modals/pane-multi.ts +1 -1
  711. package/src/dashboard/replay-preview.ts +1 -1
  712. package/src/dashboard/runtime/approvers.ts +0 -1
  713. package/src/dashboard/runtime/state-snapshot.ts +0 -90
  714. package/src/dashboard/scenario-runtime-boot.ts +16 -16
  715. package/src/dashboard/slash-runtime/dashboard-handlers.ts +134 -1456
  716. package/src/dashboard/slash-runtime/design-pick.ts +96 -0
  717. package/src/dashboard/slash-runtime/help-from-registry.ts +77 -0
  718. package/src/dashboard/slash-runtime/unknown-slash-reply.ts +78 -0
  719. package/src/dashboard/stale-install-check.ts +77 -0
  720. package/src/dashboard/surface-registry-wiring.ts +2 -15
  721. package/src/dashboard/turn-message-runtime.ts +0 -4
  722. package/src/dashboard/turn-preamble.ts +1 -1
  723. package/src/dashboard/turn-stream-formatter.ts +2 -2
  724. package/src/dashboard/turn-stream-runtime.ts +2 -2
  725. package/src/dashboard-pane-context-menu.ts +0 -14
  726. package/src/debug/log.ts +7 -0
  727. package/src/decide/boundary-shadow.ts +131 -0
  728. package/src/decisions/decision-ledger.ts +404 -0
  729. package/src/design/apply-direction.ts +209 -0
  730. package/src/design/css-root-tokens.ts +89 -0
  731. package/src/design/custom-system-create.ts +230 -0
  732. package/src/design/design-directions.ts +61 -41
  733. package/src/design/design-gate.ts +241 -0
  734. package/src/design/design-library.ts +57 -0
  735. package/src/design/design-previews.ts +138 -0
  736. package/src/design/design-systems.ts +61 -0
  737. package/src/design/lint-artifact-run.ts +46 -6
  738. package/src/design/lint-artifact.ts +5 -1
  739. package/src/design/open-design-client.ts +247 -0
  740. package/src/design/system-from-extract.ts +767 -0
  741. package/src/design/system-schema.ts +123 -0
  742. package/src/discord-slash-wire.ts +2 -1
  743. package/src/discord-test-runner.ts +2 -1
  744. package/src/discord-voice-wire.ts +2 -1
  745. package/src/discord.ts +1 -1
  746. package/src/dispatch/opportunistic-launcher.ts +24 -1
  747. package/src/domains/ops-status.ts +35 -2
  748. package/src/domains/outbound-alert.ts +24 -6
  749. package/src/domains/repeated-failure.ts +89 -0
  750. package/src/domains/schedule-manage-tool.ts +28 -8
  751. package/src/domains/schedule-migrate.ts +22 -4
  752. package/src/domains/schedule-registry.ts +88 -33
  753. package/src/domains/schedule-runs.ts +132 -0
  754. package/src/domains/schedule-state.ts +152 -0
  755. package/src/domains/telegram-kind-route.ts +21 -0
  756. package/src/element-registry/address.ts +1 -3
  757. package/src/execution-loop/dispatch-task.ts +139 -0
  758. package/src/execution-loop/gate-decision-summary.ts +29 -0
  759. package/src/execution-loop/gates.ts +197 -0
  760. package/src/git-fs/gh-cli.ts +47 -17
  761. package/src/git-fs/retry.ts +1 -0
  762. package/src/git-fs/runner.ts +1 -0
  763. package/src/git-fs/worktree.ts +6 -5
  764. package/src/github/pr-labels.ts +68 -0
  765. package/src/graph-kinds/installed-plugin-nodes.ts +95 -0
  766. package/src/graph-kinds/plugin-nodes.ts +68 -0
  767. package/src/graph-kinds/registry.ts +118 -0
  768. package/src/graph-runner/graph-cli.ts +103 -0
  769. package/src/graph-runner/graph-notify.ts +220 -0
  770. package/src/graph-runner/graph-tick.ts +119 -0
  771. package/src/graph-runner/release-manifest.ts +93 -0
  772. package/src/graph-runner/runner.ts +487 -0
  773. package/src/grok/credential.ts +158 -5
  774. package/src/grounding/ensure-grounding.ts +131 -0
  775. package/src/grounding/mirror-export.ts +89 -0
  776. package/src/grounding/mirror-manifest.ts +252 -0
  777. package/src/grounding/sources-cli.ts +209 -0
  778. package/src/grounding/sources.ts +333 -0
  779. package/src/grounding/token.ts +121 -0
  780. package/src/harness/harness-cli-command.ts +415 -23
  781. package/src/harness/harness-pod-dispatch.ts +116 -0
  782. package/src/harness/harness-stop.ts +260 -0
  783. package/src/harness/harness-substrate-default.ts +40 -0
  784. package/src/harness/harness-worktrees.ts +1 -1
  785. package/src/harness/harness-write-boundary.ts +2 -0
  786. package/src/harness/llm-decompose.ts +2 -1
  787. package/src/harness/self-send-decide.ts +233 -0
  788. package/src/harness/self-send-target.ts +22 -1
  789. package/src/harness/shell-relay.ts +5 -0
  790. package/src/harness/worktree-branch-prefix.ts +4 -3
  791. package/src/hooks/providers.ts +77 -0
  792. package/src/hooks/queue.ts +73 -0
  793. package/src/hooks/receiver.ts +133 -0
  794. package/src/index.ts +712 -3409
  795. package/src/input-core/dispatcher.ts +1 -1
  796. package/src/input-core/drag-esc-interceptor.ts +1 -1
  797. package/src/instance/current.ts +5 -5
  798. package/src/instance/leader.ts +10 -326
  799. package/src/instance/nexus-run-refusal.ts +27 -92
  800. package/src/instance/project-local-exclude.ts +27 -0
  801. package/src/instance/resolve.ts +46 -175
  802. package/src/intake-plane/capture.ts +14 -1
  803. package/src/intake-plane/check.ts +34 -14
  804. package/src/intake-plane/collect-github.ts +258 -0
  805. package/src/intake-plane/collect-pod.ts +100 -0
  806. package/src/intake-plane/collect-telegram-saved.ts +91 -0
  807. package/src/intake-plane/digest.ts +111 -0
  808. package/src/intake-plane/enrich-plugins.ts +1 -1
  809. package/src/intake-plane/front-classifier.ts +56 -0
  810. package/src/intake-plane/front-route-classifier.ts +80 -0
  811. package/src/intake-plane/front-route-rules.ts +152 -0
  812. package/src/intake-plane/grounding-docs.ts +185 -0
  813. package/src/intake-plane/harness-target.ts +20 -0
  814. package/src/intake-plane/intake-to-tasks.ts +303 -0
  815. package/src/intake-plane/items.ts +247 -0
  816. package/src/intake-plane/link-ledger.ts +27 -0
  817. package/src/intake-plane/route.ts +104 -0
  818. package/src/intake-plane/runtime-callables.ts +3 -1
  819. package/src/intake-plane/sketch-ledger.ts +34 -0
  820. package/src/intake-plane/slash.ts +30 -2
  821. package/src/intake-plane/submit-intake-work.ts +160 -0
  822. package/src/intake-plane/telegram-work.ts +56 -0
  823. package/src/iul/sidebar-shell.ts +0 -165
  824. package/src/launch-head/capability-check.ts +162 -0
  825. package/src/launch-head/launch-head-cli.ts +242 -0
  826. package/src/launch-head/load-balance.ts +81 -0
  827. package/src/live/detail-switch.ts +180 -0
  828. package/src/llm/provider-detect.ts +247 -0
  829. package/src/llm/provider-probe.ts +57 -0
  830. package/src/llm/usable-llm.ts +32 -0
  831. package/src/llm.ts +55 -23
  832. package/src/log-entry.ts +1 -1
  833. package/src/log-pane/attachment-popup.ts +1 -2
  834. package/src/loops/loop-cli.ts +37 -0
  835. package/src/loops/registry.ts +196 -0
  836. package/src/market/official-keys.ts +5 -0
  837. package/src/market/publish.ts +329 -0
  838. package/src/market/signed-index.ts +156 -0
  839. package/src/market/tgz.ts +121 -0
  840. package/src/mcp/client.ts +1 -1
  841. package/src/mcp/mcp-oauth.ts +40 -5
  842. package/src/mcp/server.ts +75 -7
  843. package/src/mcp-gateway/gateway.ts +128 -0
  844. package/src/mcp-gateway/pat-store.ts +124 -0
  845. package/src/mss/logging/log-store.ts +91 -2
  846. package/src/mss/logging/scoped-level.ts +5 -9
  847. package/src/native-tool-catalog.ts +66 -345
  848. package/src/nexus/api/connect-info.ts +23 -25
  849. package/src/nexus/api/context-url.ts +1 -1
  850. package/src/nexus/api/design-check.ts +90 -59
  851. package/src/nexus/api/design-previews-route.ts +182 -0
  852. package/src/nexus/api/design-system-create-route.ts +123 -0
  853. package/src/nexus/api/graph-approvals.ts +125 -0
  854. package/src/nexus/api/graph-kinds.ts +69 -0
  855. package/src/nexus/api/graphs-api.ts +221 -0
  856. package/src/nexus/api/harness-api.ts +31 -2
  857. package/src/nexus/api/health.ts +15 -0
  858. package/src/nexus/api/http-server.ts +328 -43
  859. package/src/nexus/api/image-generate.ts +3 -0
  860. package/src/nexus/api/ingest-token.ts +175 -0
  861. package/src/nexus/api/intake-ledger-api.ts +54 -0
  862. package/src/nexus/api/intake-route.ts +111 -0
  863. package/src/nexus/api/json-response.ts +33 -0
  864. package/src/nexus/api/live-detail.ts +47 -0
  865. package/src/nexus/api/live-shipped.ts +78 -0
  866. package/src/nexus/api/log-fabric.ts +42 -2
  867. package/src/nexus/api/markdown-publish.ts +3 -2
  868. package/src/nexus/api/mcp-http.ts +14 -9
  869. package/src/nexus/api/mcp-oauth-hint.ts +31 -0
  870. package/src/nexus/api/mcp-public-allowlist.ts +33 -0
  871. package/src/nexus/api/merge-approvals-gate.ts +79 -0
  872. package/src/nexus/api/merge-approvals.ts +307 -0
  873. package/src/nexus/api/meta-api.ts +18 -0
  874. package/src/nexus/api/next-fluent-wiring.ts +7 -9
  875. package/src/nexus/api/plugins-credentials-api.ts +47 -0
  876. package/src/nexus/api/plugins-market.ts +209 -0
  877. package/src/nexus/api/pod-credential-api.ts +187 -0
  878. package/src/nexus/api/public-routes.ts +87 -0
  879. package/src/nexus/api/rest-route-paths.ts +15 -0
  880. package/src/nexus/api/schedules-action.ts +12 -3
  881. package/src/nexus/api/schedules-read.ts +228 -0
  882. package/src/nexus/api/sessions-store.ts +8 -2
  883. package/src/nexus/api/setup-answer-priority.ts +130 -0
  884. package/src/nexus/api/setup-channel-bot.ts +56 -0
  885. package/src/nexus/api/setup-child-llm.ts +228 -0
  886. package/src/nexus/api/setup-obsidian-skills.ts +93 -0
  887. package/src/nexus/api/task-cards-api.ts +34 -0
  888. package/src/nexus/api/tasks-create.ts +136 -0
  889. package/src/nexus/api/telegram-trigger-bot.ts +3 -3
  890. package/src/nexus/api/terminals.ts +204 -18
  891. package/src/nexus/api/trace.ts +405 -0
  892. package/src/nexus/api/vault-api.ts +140 -7
  893. package/src/nexus/api/worktrees.ts +18 -2
  894. package/src/nexus/boot/register-mcp-clients.ts +135 -16
  895. package/src/nexus/daemon-endpoint.ts +85 -0
  896. package/src/nexus/default-port.ts +1 -0
  897. package/src/nexus/index.ts +362 -143
  898. package/src/nexus/onboarding/pwa-share-prompt.ts +31 -8
  899. package/src/nexus/onboarding/tailscale-probe.ts +9 -1
  900. package/src/nexus/outbound/router.ts +1 -1
  901. package/src/nexus/setup-status.ts +58 -0
  902. package/src/nexus/supervisor/lock.ts +8 -0
  903. package/src/nexus/webterm/pty.ts +15 -0
  904. package/src/oauth/codex-account-rotation.ts +122 -16
  905. package/src/oauth/codex-account-store.ts +88 -19
  906. package/src/oauth/codex-quota-policy.ts +55 -0
  907. package/src/oauth/store.ts +28 -25
  908. package/src/obsidian/default-vault.ts +17 -0
  909. package/src/obsidian/vault-write-guard.ts +46 -0
  910. package/src/onboarding/help/llm.md +2 -2
  911. package/src/onboarding.ts +27 -4
  912. package/src/panes/alt-skip-predicate.ts +4 -3
  913. package/src/panes/external-terminal-pane.ts +3 -4
  914. package/src/panes/factory.ts +1 -18
  915. package/src/panes/index.ts +1 -5
  916. package/src/panes/pane-cycle.ts +1 -1
  917. package/src/panes/types.ts +1 -1
  918. package/src/platform/env-literal.ts +4 -0
  919. package/src/plugin-hooks/dispatcher.ts +10 -4
  920. package/src/plugins/core/host.ts +108 -4
  921. package/src/plugins/core/manifest.ts +104 -7
  922. package/src/plugins/install/market-fetch.ts +250 -0
  923. package/src/plugins/install/plugin-credentials.ts +106 -0
  924. package/src/plugins/install/plugin-install.ts +518 -0
  925. package/src/policy/claude-subscription-guard.ts +25 -0
  926. package/src/preview/terminal.ts +24 -1
  927. package/src/preview-pane/mount.ts +1 -142
  928. package/src/prompt/references.ts +4 -51
  929. package/src/prompt-library/universal-preamble.ts +8 -2
  930. package/src/pty-shell/pty-control-ipc.ts +57 -3
  931. package/src/pty-shell/pty-mouse.ts +75 -0
  932. package/src/pty-shell/pty-recording.ts +108 -0
  933. package/src/pty-shell/registry.ts +53 -3
  934. package/src/python/resolve-python.ts +1 -1
  935. package/src/release-loop/checklist.ts +191 -0
  936. package/src/release-loop/manifest.ts +65 -0
  937. package/src/release-loop/release-note.ts +177 -0
  938. package/src/roles/lease-cas.ts +52 -0
  939. package/src/roles/machine-name.ts +48 -0
  940. package/src/roles/machine-profile.ts +65 -0
  941. package/src/roles/role-lease-read.ts +81 -0
  942. package/src/roles/role-lease.ts +63 -0
  943. package/src/roles/role-watch.ts +69 -0
  944. package/src/self-dev/ask-launch-flow.ts +39 -22
  945. package/src/self-dev/ask-launch-io.ts +1 -1
  946. package/src/self-dev/dev-cli.ts +290 -159
  947. package/src/self-dev/dev-pipeline.ts +157 -9
  948. package/src/self-dev/draft-sweep.ts +231 -0
  949. package/src/self-dev/draft-triage-rules.ts +42 -0
  950. package/src/self-dev/entrance-baseline.ts +156 -4
  951. package/src/self-dev/fabric-decompose-adapter.ts +10 -0
  952. package/src/self-dev/launch-preflight.ts +1 -1
  953. package/src/self-dev/orchestrate.ts +297 -20
  954. package/src/self-dev/repair-signals.ts +6 -0
  955. package/src/self-dev/run-store.ts +20 -5
  956. package/src/self-dev/run-supervisor.ts +43 -3
  957. package/src/self-implement/abandoned-classification.ts +15 -1
  958. package/src/self-implement/blocked-draft-policy.ts +6 -0
  959. package/src/self-implement/budget-gate.ts +236 -0
  960. package/src/self-implement/child-llm-preference.ts +84 -0
  961. package/src/self-implement/decision-events.ts +57 -0
  962. package/src/self-implement/decision-signal-press.ts +5 -2
  963. package/src/self-implement/dependency-change-gate.ts +90 -0
  964. package/src/self-implement/gate-baseline.ts +35 -2
  965. package/src/self-implement/gate-cli.ts +29 -7
  966. package/src/self-implement/gate-scope.ts +7 -1
  967. package/src/self-implement/goal-author-decompose.ts +22 -4
  968. package/src/self-implement/goal-author.ts +41 -3
  969. package/src/self-implement/goal-boundary.ts +65 -0
  970. package/src/self-implement/goal-clarification-escalation.ts +1 -0
  971. package/src/self-implement/goal-documents-dir.ts +6 -1
  972. package/src/self-implement/goal-execution-records.ts +58 -0
  973. package/src/self-implement/goal-run-store.ts +42 -24
  974. package/src/self-implement/graph-authority.ts +13 -28
  975. package/src/self-implement/graph-catalog.ts +48 -0
  976. package/src/self-implement/graph-run-contract.ts +127 -0
  977. package/src/self-implement/graph-templates.ts +14 -7
  978. package/src/self-implement/graph-yaml.ts +35 -6
  979. package/src/self-implement/harness-policy-gates.ts +42 -0
  980. package/src/self-implement/headless-elanous-driver.ts +30 -6
  981. package/src/self-implement/heal-triage.ts +229 -0
  982. package/src/self-implement/host-regate.ts +244 -0
  983. package/src/self-implement/non-git-consent.ts +23 -0
  984. package/src/self-implement/orchestrator.ts +488 -134
  985. package/src/self-implement/pipeline-shape.ts +1 -1
  986. package/src/self-implement/pr-evidence-artifact.ts +6 -19
  987. package/src/self-implement/prior-draft-findings.ts +128 -0
  988. package/src/self-implement/pwa-import-graph.ts +65 -0
  989. package/src/self-implement/repo-provision.ts +18 -21
  990. package/src/self-implement/report-origin.ts +39 -0
  991. package/src/self-implement/rework-policy.ts +21 -0
  992. package/src/self-implement/run-ledger-compact.ts +438 -0
  993. package/src/self-implement/run-ledger.ts +212 -29
  994. package/src/self-implement/run-report.ts +24 -0
  995. package/src/self-implement/run-status-mapping.ts +2 -0
  996. package/src/self-implement/running-runs.ts +112 -14
  997. package/src/self-implement/scoped-typecheck-config.ts +49 -0
  998. package/src/self-implement/seams.ts +207 -40
  999. package/src/self-implement/self-implement-cli.ts +17 -2
  1000. package/src/self-implement/shadow-repo.ts +350 -0
  1001. package/src/self-implement/supervision-vocabulary.ts +7 -0
  1002. package/src/shell-runner/dispatch.ts +3 -0
  1003. package/src/shell-runner/index.ts +0 -7
  1004. package/src/skills/runner.ts +0 -69
  1005. package/src/skills/tools/agent-room-slash.ts +2 -1
  1006. package/src/skills/tools/agent-room.ts +8 -140
  1007. package/src/skills/tools/agent.ts +5 -3
  1008. package/src/skills/tools/context.ts +5 -140
  1009. package/src/skills/tools/control.ts +4 -188
  1010. package/src/skills/tools/dashboard-slash.ts +3 -11
  1011. package/src/skills/tools/dashboard-state.ts +3 -5
  1012. package/src/skills/tools/dev-harness.ts +45 -2
  1013. package/src/skills/tools/omni-search.ts +29 -1
  1014. package/src/skills/tools/shell.ts +11 -29
  1015. package/src/skills/tools/spawn-coding-agent-headless.ts +6 -9
  1016. package/src/ssh/ssh-picker-modal.ts +1 -1
  1017. package/src/steward/directive.ts +99 -0
  1018. package/src/steward/steward-cards.ts +45 -0
  1019. package/src/steward/triage.ts +239 -0
  1020. package/src/storage/cli-bin.ts +67 -0
  1021. package/src/storage/object-store-visibility.ts +169 -0
  1022. package/src/storage/object-store.ts +452 -0
  1023. package/src/storage/s3.ts +53 -10
  1024. package/src/storage/storage-detect.ts +337 -0
  1025. package/src/surface/address.ts +3 -5
  1026. package/src/surface/index.ts +0 -6
  1027. package/src/surface/llm-tools.ts +1 -2
  1028. package/src/surface/shell-runner-boot.ts +4 -89
  1029. package/src/task-cards/card-cli.ts +64 -0
  1030. package/src/task-cards/card-store.ts +241 -0
  1031. package/src/task-orchestrator/boot.ts +27 -1
  1032. package/src/task-orchestrator/dispatcher.ts +49 -7
  1033. package/src/task-orchestrator/external-fingerprint.ts +10 -0
  1034. package/src/task-orchestrator/external-policy.ts +86 -0
  1035. package/src/task-orchestrator/feedback-loop.ts +4 -2
  1036. package/src/task-orchestrator/graph.ts +18 -1
  1037. package/src/task-orchestrator/runtimes/create.ts +128 -0
  1038. package/src/task-orchestrator/store.ts +78 -18
  1039. package/src/task-orchestrator/surface-registry.ts +5 -2
  1040. package/src/task-orchestrator/surfaces/external-exec.ts +180 -0
  1041. package/src/task-orchestrator/surfaces/idea-approval-pr.ts +118 -0
  1042. package/src/task-orchestrator/surfaces/index.ts +4 -3
  1043. package/src/task-orchestrator/surfaces/pod-account-broker.ts +60 -5
  1044. package/src/task-orchestrator/surfaces/pod-artifact-return.ts +194 -0
  1045. package/src/task-orchestrator/surfaces/pod-command-job.ts +369 -0
  1046. package/src/task-orchestrator/surfaces/pod-ledger-collect.ts +207 -0
  1047. package/src/task-orchestrator/surfaces/pod-pool.ts +128 -12
  1048. package/src/task-orchestrator/surfaces/pod-skills.ts +11 -3
  1049. package/src/task-orchestrator/surfaces/pod-source-bundle.ts +147 -0
  1050. package/src/task-orchestrator/surfaces/pod-source-receive.ts +129 -0
  1051. package/src/task-orchestrator/surfaces/pod-source-spec.ts +77 -0
  1052. package/src/task-orchestrator/surfaces/self-implement-pod.ts +930 -45
  1053. package/src/task-orchestrator/surfaces/self-implement.ts +8 -1
  1054. package/src/task-orchestrator/tox-loop.ts +204 -0
  1055. package/src/task-orchestrator/types.ts +21 -1
  1056. package/src/telegram-commands.ts +8 -0
  1057. package/src/telegram-report.ts +14 -7
  1058. package/src/telegram-run.ts +18 -5
  1059. package/src/telegram.ts +92 -22
  1060. package/src/tool-runtime/acp-session-runtime.ts +28 -7
  1061. package/src/tool-runtime/agent-runtime.ts +1 -0
  1062. package/src/tool-runtime/context-runtime.ts +18 -35
  1063. package/src/tool-runtime/control-runtime.ts +8 -21
  1064. package/src/tool-runtime/dashboard-state-runtime.ts +1 -5
  1065. package/src/tool-runtime/elanous-asana-runtimes.ts +205 -0
  1066. package/src/tool-runtime/elanous-control-runtimes.ts +16 -2
  1067. package/src/tool-runtime/elanous-task-submit-runtime.ts +124 -0
  1068. package/src/tool-runtime/index.ts +4 -1
  1069. package/src/tool-runtime/scenario-runtimes.ts +22 -21
  1070. package/src/tool-runtime/scenario-target-mount.ts +6 -32
  1071. package/src/tool-runtime/types.ts +8 -0
  1072. package/src/tui/chat/attachment-summary.ts +4 -4
  1073. package/src/tui-client/acp-transport-ws-client.ts +72 -5
  1074. package/src/tui-client/headless-core-guard.ts +0 -1
  1075. package/src/tui.ts +11 -7
  1076. package/src/typecheck-ratchet.ts +15 -0
  1077. package/src/ui/hover-presenter.ts +3 -7
  1078. package/src/user-config.ts +453 -190
  1079. package/src/util/spawn-sync-output.ts +15 -0
  1080. package/src/version/code-revision.ts +34 -9
  1081. package/src/version/packed-revision.json +1 -1
  1082. package/src/video-pipeline/broll-agent.ts +102 -0
  1083. package/src/video-pipeline/recipes/broll.ts +263 -0
  1084. package/src/video-pipeline/walk-line.ts +2 -1
  1085. package/src/views/scratch-image-size.ts +10 -0
  1086. package/src/voice/channel-adapters/pwa-voice-adapter.ts +2 -18
  1087. package/src/voice/channel-adapters/telegram-voice-adapter.ts +1 -6
  1088. package/src/voice/voice-tts-singleton.ts +46 -8
  1089. package/src/web-push/vapid-keys.ts +1 -1
  1090. package/src/web-search/free.ts +77 -0
  1091. package/src/web-search/index.ts +7 -5
  1092. package/src/web-terminal/preview-tap-registry.ts +152 -43
  1093. package/src/workflow-runtime/deps-bridge.ts +4 -3
  1094. package/src/workflow-runtime/executor.ts +18 -22
  1095. package/src/workflow-runtime/node-catalog.ts +20 -1
  1096. package/src/workflow-runtime/nodes/bash.ts +1 -0
  1097. package/src/workflow-runtime/nodes/task.ts +74 -0
  1098. package/src/workflow-runtime/nodes/triggers.ts +24 -1
  1099. package/src/workflow-runtime/plugin-kind-node.ts +166 -0
  1100. package/src/workflow-runtime/schema.ts +98 -2
  1101. package/src/workflow-runtime/triggers/webhook-router.ts +43 -3
  1102. package/src/workflow-runtime/triggers/webhook-source.ts +19 -1
  1103. package/src/workflow-runtime/types.ts +76 -5
  1104. package/apps/pwa/out/_next/static/Ksn99fVf2HUWhSyV1-FC8/_buildManifest.js +0 -1
  1105. package/apps/pwa/out/_next/static/chunks/1176-4943bd83b00e53a2.js +0 -25
  1106. package/apps/pwa/out/_next/static/chunks/1380-9c652e1002032c86.js +0 -1
  1107. package/apps/pwa/out/_next/static/chunks/1863-2ea170dfec26b88b.js +0 -1
  1108. package/apps/pwa/out/_next/static/chunks/2091-2d6b7f4f16300f83.js +0 -1
  1109. package/apps/pwa/out/_next/static/chunks/2347-366617ec73babe3b.js +0 -1
  1110. package/apps/pwa/out/_next/static/chunks/3089-e60cc8f5d35ee239.js +0 -1
  1111. package/apps/pwa/out/_next/static/chunks/3158-c77ed9ea34f9cc9f.js +0 -1
  1112. package/apps/pwa/out/_next/static/chunks/3607-f0b5c5ee18fcf56a.js +0 -1
  1113. package/apps/pwa/out/_next/static/chunks/3659-05b2d5d971b42dbc.js +0 -1
  1114. package/apps/pwa/out/_next/static/chunks/3736-b6a7bfdcb8f56ec6.js +0 -1
  1115. package/apps/pwa/out/_next/static/chunks/3839-eebf298e89a7bb77.js +0 -1
  1116. package/apps/pwa/out/_next/static/chunks/4012.832a2824b978e7ee.js +0 -5
  1117. package/apps/pwa/out/_next/static/chunks/4706-d85d7f3345f3ff91.js +0 -1
  1118. package/apps/pwa/out/_next/static/chunks/526-17a6a2e0e6dc4498.js +0 -1
  1119. package/apps/pwa/out/_next/static/chunks/5508-676ac75f2757ad40.js +0 -1
  1120. package/apps/pwa/out/_next/static/chunks/5583-8a0317f4b8e68db9.js +0 -1
  1121. package/apps/pwa/out/_next/static/chunks/6258-b58f722b10e8d31d.js +0 -1
  1122. package/apps/pwa/out/_next/static/chunks/6820-32fd097e6186fdc9.js +0 -1
  1123. package/apps/pwa/out/_next/static/chunks/6852-983db7ca958634b7.js +0 -1
  1124. package/apps/pwa/out/_next/static/chunks/7235-e583e4a015e159b9.js +0 -1
  1125. package/apps/pwa/out/_next/static/chunks/7482-7b417330b24a996a.js +0 -1
  1126. package/apps/pwa/out/_next/static/chunks/7701-99b7d4dedb955bf8.js +0 -1
  1127. package/apps/pwa/out/_next/static/chunks/77f1928d-bd3777589042d3ea.js +0 -1
  1128. package/apps/pwa/out/_next/static/chunks/8366-36956cafc5e33614.js +0 -1
  1129. package/apps/pwa/out/_next/static/chunks/8370-23d0de995be666f8.js +0 -1
  1130. package/apps/pwa/out/_next/static/chunks/8617-307421f3b0e8b2a2.js +0 -1
  1131. package/apps/pwa/out/_next/static/chunks/8837-e45de46a9fedf1f5.js +0 -1
  1132. package/apps/pwa/out/_next/static/chunks/9058-0e8055a5ea3ebdd6.js +0 -1
  1133. package/apps/pwa/out/_next/static/chunks/app/_not-found/page-84b84eca12acada4.js +0 -1
  1134. package/apps/pwa/out/_next/static/chunks/app/autopilot/page-1f23568c29e88f7a.js +0 -1
  1135. package/apps/pwa/out/_next/static/chunks/app/botlab/page-bf6fc9aafd6135a7.js +0 -1
  1136. package/apps/pwa/out/_next/static/chunks/app/bots/page-3f8539ae4b719d2e.js +0 -1
  1137. package/apps/pwa/out/_next/static/chunks/app/chat/page-d2900febb74ecf32.js +0 -1
  1138. package/apps/pwa/out/_next/static/chunks/app/control/page-e82dec647dd79c36.js +0 -1
  1139. package/apps/pwa/out/_next/static/chunks/app/dashboard/page-096ec743a8ee955a.js +0 -1
  1140. package/apps/pwa/out/_next/static/chunks/app/design-check/page-255c2ceded4b3493.js +0 -1
  1141. package/apps/pwa/out/_next/static/chunks/app/healthz/route-84b84eca12acada4.js +0 -1
  1142. package/apps/pwa/out/_next/static/chunks/app/intake/page-2db61b2f9efba61f.js +0 -1
  1143. package/apps/pwa/out/_next/static/chunks/app/layout-e11ee17f221aaa9b.js +0 -1
  1144. package/apps/pwa/out/_next/static/chunks/app/missions/[id]/page-e075974e029ce4c4.js +0 -1
  1145. package/apps/pwa/out/_next/static/chunks/app/morning/page-ec5b68a9af3366a0.js +0 -1
  1146. package/apps/pwa/out/_next/static/chunks/app/not-found-986c177afb4adae6.js +0 -1
  1147. package/apps/pwa/out/_next/static/chunks/app/observatory/page-a72781461af2f2a3.js +0 -1
  1148. package/apps/pwa/out/_next/static/chunks/app/page-92781cbaafc487ad.js +0 -1
  1149. package/apps/pwa/out/_next/static/chunks/app/reflection/page-2c14d2a1f2930f33.js +0 -1
  1150. package/apps/pwa/out/_next/static/chunks/app/scheduler/page-22ee4bf8070b2b4d.js +0 -1
  1151. package/apps/pwa/out/_next/static/chunks/app/sessions/page-9c06e4a8297942a8.js +0 -1
  1152. package/apps/pwa/out/_next/static/chunks/app/settings/devices/page-d0cd32f6d373798f.js +0 -1
  1153. package/apps/pwa/out/_next/static/chunks/app/settings/page-0c1642018d87ebb8.js +0 -1
  1154. package/apps/pwa/out/_next/static/chunks/app/setup/done/page-93e5e97d614df487.js +0 -1
  1155. package/apps/pwa/out/_next/static/chunks/app/setup/layout-84b84eca12acada4.js +0 -1
  1156. package/apps/pwa/out/_next/static/chunks/app/setup/page-b1ce871940d7393e.js +0 -1
  1157. package/apps/pwa/out/_next/static/chunks/app/share/page-ae154addf345febe.js +0 -1
  1158. package/apps/pwa/out/_next/static/chunks/app/showroom/page-90af3aa813d2053c.js +0 -1
  1159. package/apps/pwa/out/_next/static/chunks/app/tasks/page-f3f962fda428a738.js +0 -1
  1160. package/apps/pwa/out/_next/static/chunks/app/term/page-1c1f7cc1d5def06d.js +0 -1
  1161. package/apps/pwa/out/_next/static/chunks/app/vault/page-09d4cbdaaacf06c1.js +0 -1
  1162. package/apps/pwa/out/_next/static/chunks/app/workflows/chat-ui/page-e877b8e8ca90b27f.js +0 -1
  1163. package/apps/pwa/out/_next/static/chunks/app/workflows/page-71d902f463dea526.js +0 -1
  1164. package/apps/pwa/out/_next/static/chunks/app/workspace/page-40ea576cefa25fe6.js +0 -1
  1165. package/apps/pwa/out/_next/static/chunks/app/worktrees/page-a56a3f178c3831f6.js +0 -1
  1166. package/apps/pwa/out/_next/static/chunks/bcc499d1-804a270d878e0842.js +0 -1
  1167. package/apps/pwa/out/_next/static/chunks/framework-b25b7c5501c59b6d.js +0 -1
  1168. package/apps/pwa/out/_next/static/chunks/main-a9ec9da43387afff.js +0 -1
  1169. package/apps/pwa/out/_next/static/chunks/main-app-aa2c05954aaa6754.js +0 -1
  1170. package/apps/pwa/out/_next/static/chunks/pages/_app-bb3768fb4b84aebb.js +0 -1
  1171. package/apps/pwa/out/_next/static/chunks/pages/_error-2820ba75b87b2f5e.js +0 -1
  1172. package/apps/pwa/out/_next/static/chunks/webpack-58c73b145f189b1c.js +0 -1
  1173. package/apps/pwa/out/_next/static/css/effec8adf767aa75.css +0 -1
  1174. package/apps/pwa/out/dashboard/index.html +0 -1
  1175. package/apps/pwa/out/dashboard/index.txt +0 -26
  1176. package/src/acp/resident-shell.ts +0 -244
  1177. package/src/agent/spawn-local-llm-in-vw.ts +0 -240
  1178. package/src/dashboard/agent-spawn-tools-boot.ts +0 -14
  1179. package/src/dashboard/dock-picker-inventory.ts +0 -41
  1180. package/src/dashboard/goal-plan-hud-bridge.ts +0 -112
  1181. package/src/dashboard/hud-mirror.ts +0 -207
  1182. package/src/dashboard/input/mouse-dock-runtime.ts +0 -156
  1183. package/src/dashboard/input/mouse-hover-runtime.ts +0 -46
  1184. package/src/dashboard/input/mouse-pill-context-runtime.ts +0 -74
  1185. package/src/dashboard/input/mouse-workspace-restore-runtime.ts +0 -64
  1186. package/src/dashboard/input/scratch-actions.ts +0 -36
  1187. package/src/dashboard/input/virtual-window-key-router.ts +0 -24
  1188. package/src/dashboard/rich-scratch-viewers.ts +0 -77
  1189. package/src/dashboard/scratch-slash-runtime.ts +0 -36
  1190. package/src/dashboard/scratch-state-runtime.ts +0 -42
  1191. package/src/dashboard/scratch-widget-runtime.ts +0 -37
  1192. package/src/dashboard/sim-shell.ts +0 -313
  1193. package/src/dashboard/virtual-window-control-runtime.ts +0 -57
  1194. package/src/dashboard/virtual-window-help-runtime.ts +0 -113
  1195. package/src/dashboard/virtual-window-input-runtime.ts +0 -99
  1196. package/src/dashboard/virtual-window-mutation-runtime.ts +0 -102
  1197. package/src/dashboard/virtual-window-split-runtime.ts +0 -70
  1198. package/src/dashboard/vw-popup-openers.ts +0 -126
  1199. package/src/dashboard/window-picker-popup.ts +0 -74
  1200. package/src/dashboard/window-slash-runtime.ts +0 -108
  1201. package/src/dashboard/windowing/companion-slash.ts +0 -78
  1202. package/src/dashboard/windowing/fast-switch.ts +0 -138
  1203. package/src/dashboard/windowing/lifecycle.ts +0 -185
  1204. package/src/dashboard/windowing/virtual-windows.ts +0 -259
  1205. package/src/dashboard/windowing/visibility-chord.ts +0 -77
  1206. package/src/iul/resident-vw.ts +0 -55
  1207. package/src/panes/content-adapter.ts +0 -162
  1208. package/src/prompt/vw-reference.ts +0 -153
  1209. package/src/shell-runner/external-terminal-pane.ts +0 -157
  1210. package/src/sim/resident-vw.ts +0 -48
  1211. package/src/skills/tools/spawn-coding-agent-vw.ts +0 -181
  1212. package/src/skills/tools/virtual-windows.ts +0 -632
  1213. package/src/surface/adapters/window-surface-adapter.ts +0 -141
  1214. package/src/tool-runtime/layout-runtimes.ts +0 -81
  1215. package/src/tool-runtime/scenario-window-mount.ts +0 -207
  1216. package/src/views/ui-mode.ts +0 -100
  1217. package/src/virtual-window-context-menu.ts +0 -97
  1218. package/src/virtual-windows/addressing.ts +0 -195
  1219. package/src/virtual-windows/benchmark-preset.ts +0 -119
  1220. package/src/virtual-windows/event-bus.ts +0 -202
  1221. package/src/virtual-windows/layout/apply-planner.ts +0 -189
  1222. package/src/virtual-windows/layout/index.ts +0 -68
  1223. package/src/virtual-windows/layout/layout-commands.ts +0 -186
  1224. package/src/virtual-windows/layout/layout-tools.ts +0 -262
  1225. package/src/virtual-windows/layout/persistence.ts +0 -219
  1226. package/src/virtual-windows/layout/presets.ts +0 -114
  1227. package/src/virtual-windows/layout/restore-planner.ts +0 -223
  1228. package/src/virtual-windows/layout/serializer.ts +0 -197
  1229. package/src/virtual-windows/layout/tree.ts +0 -147
  1230. package/src/virtual-windows/layout/types.ts +0 -63
  1231. package/src/virtual-windows/layout-tree.ts +0 -389
  1232. package/src/virtual-windows/navigation.ts +0 -251
  1233. package/src/virtual-windows/pane-capture.ts +0 -142
  1234. package/src/virtual-windows/pane-content.ts +0 -611
  1235. package/src/virtual-windows/pane-spawner.ts +0 -278
  1236. package/src/virtual-windows/pty-tail-content.ts +0 -291
  1237. package/src/virtual-windows/resident-window.ts +0 -59
  1238. package/src/virtual-windows/secondary-action.ts +0 -25
  1239. package/src/virtual-windows/terminal-slot-content.ts +0 -165
  1240. package/src/virtual-windows/virtual-window.ts +0 -1301
  1241. package/src/virtual-windows/vw-local-input-target-popup.ts +0 -110
  1242. package/src/virtual-windows/vw-rename-modal.ts +0 -77
  1243. package/src/virtual-windows/vw-selector-popup.ts +0 -177
  1244. package/src/virtual-windows/window-registry.ts +0 -519
  1245. package/src/voice/channel-adapters/discord-voice-adapter.ts +0 -202
  1246. package/src/voice/voice-pwa-dispatch.ts +0 -245
  1247. package/src/window-picker-modal.ts +0 -135
  1248. /package/apps/pwa/out/_next/static/{Ksn99fVf2HUWhSyV1-FC8 → ktMqfrBbf8BMGac0jqLrb}/_ssgManifest.js +0 -0
  1249. /package/src/dashboard/{companion-slash-runtime.ts → companion-messages-runtime.ts} +0 -0
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7143],{51442:(e,t,r)=>{Promise.resolve().then(r.bind(r,66577))},63204:()=>{},66577:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>e4});var n=r(54728),a=r(8740),l=r(23270),s=r(438),o=r(72904),i=r(25742),d=r(88116),c=r(90719),u=r(24667),p=r(2400),x=r(98747),m=r(68874),h=r(17342),f=r(11076),g=r(37069),b=r(57900),y=r(1797),v=r(51873),j=r(14084),w=r(49132),k=r(73607),N=r(46226),C=r(25736),T=r(8913);r(36372),r(63204);var S=r(20031);let A=/^\*\/(\d+) \* \* \* \*$/,E=/^0 \*\/(\d+) \* \* \*$/,M=/^(\d+) (\d+) \* \* \*$/,_=/^(\d+) (\d+) \* \* 1-5$/,P=/^(\d+) (\d+) \* \* ([0-6])$/,R=/^(\d+) (\d+) (\d+) \* \*$/,I=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function L(e){return e.toString().padStart(2,"0")}function O(e){let t=e.trim();if(!t)return{text:"(empty expression)",matched:!1};let r=A.exec(t);if(r){let e=Number(r[1]);return{text:"Every ".concat(e," minute").concat(1===e?"":"s"),matched:!0}}let n=E.exec(t);if(n){let e=Number(n[1]);return{text:"Every ".concat(e," hour").concat(1===e?"":"s"),matched:!0}}let a=_.exec(t);if(a)return{text:"Every weekday at ".concat(L(Number(a[2])),":").concat(L(Number(a[1]))),matched:!0};let l=P.exec(t);if(l){let e=I[Number(l[3])];return{text:"Every ".concat(e," at ").concat(L(Number(l[2])),":").concat(L(Number(l[1]))),matched:!0}}let s=M.exec(t);if(s)return{text:"Every day at ".concat(L(Number(s[2])),":").concat(L(Number(s[1]))),matched:!0};let o=R.exec(t);return o?{text:"Day ".concat(Number(o[3])," of every month at ").concat(L(Number(o[2])),":").concat(L(Number(o[1]))),matched:!0}:{text:"Custom: ".concat(t),matched:!1}}let D=[{id:"every-5-min",label:"Every 5 min",expression:"*/5 * * * *"},{id:"every-hour",label:"Hourly",expression:"0 */1 * * *"},{id:"daily-9am",label:"Daily 9am",expression:"0 9 * * *"},{id:"weekdays-9am",label:"Weekdays 9am",expression:"0 9 * * 1-5"},{id:"weekly-mon-9am",label:"Mon 9am",expression:"0 9 * * 1"},{id:"monthly-1st-9am",label:"1st 9am",expression:"0 9 1 * *"}];function z(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return"string"==typeof e?e:t}function W(e){return"string"==typeof e.prompt?"prompt":"string"==typeof e.bash?"bash":"string"==typeof e.skill?"skill":"string"==typeof e.cft?"cft":void 0!==e.approval&&"object"==typeof e.approval&&null!==e.approval?"approval":void 0!==e.if&&"object"==typeof e.if&&null!==e.if&&"string"==typeof e.if.condition?"if":void 0!==e.switch&&"object"==typeof e.switch&&null!==e.switch&&"string"==typeof e.switch.value&&Array.isArray(e.switch.cases)?"switch":void 0!==e.iteration&&"object"==typeof e.iteration&&null!==e.iteration&&"string"==typeof e.iteration.items&&"string"==typeof e.iteration.body?"iteration":void 0!==e.classify&&"object"==typeof e.classify&&null!==e.classify&&"string"==typeof e.classify.input&&Array.isArray(e.classify.classes)?"classify":void 0!==e.extract&&"object"==typeof e.extract&&null!==e.extract&&"string"==typeof e.extract.input&&"object"==typeof e.extract.schema?"extract":void 0!==e.set&&"object"==typeof e.set&&null!==e.set&&"object"==typeof e.set.fields?"set":void 0!==e.filter&&"object"==typeof e.filter&&null!==e.filter&&"string"==typeof e.filter.items&&"string"==typeof e.filter.condition?"filter":void 0!==e.template&&"object"==typeof e.template&&null!==e.template&&"string"==typeof e.template.template?"template":void 0!==e.http&&"object"==typeof e.http&&null!==e.http&&"string"==typeof e.http.url?"http":void 0!==e.scheduleTrigger&&"object"==typeof e.scheduleTrigger&&null!==e.scheduleTrigger&&"string"==typeof e.scheduleTrigger.type?"scheduleTrigger":void 0!==e.webhookTrigger&&"object"==typeof e.webhookTrigger&&null!==e.webhookTrigger&&"string"==typeof e.webhookTrigger.path?"webhookTrigger":void 0!==e.discordTrigger&&"object"==typeof e.discordTrigger&&null!==e.discordTrigger&&"string"==typeof e.discordTrigger.kind?"discordTrigger":void 0!==e.telegramTrigger&&"object"==typeof e.telegramTrigger&&null!==e.telegramTrigger&&"string"==typeof e.telegramTrigger.kind?"telegramTrigger":void 0!==e.manualTrigger&&"object"==typeof e.manualTrigger&&null!==e.manualTrigger?"manualTrigger":void 0!==e.chatTrigger&&"object"==typeof e.chatTrigger&&null!==e.chatTrigger&&"string"==typeof e.chatTrigger.path?"chatTrigger":"unknown"}function G(e){var t;return e?(null!=(t=e.split("\n").find(e=>e.trim().length>0))?t:"").trim().slice(0,64):""}var F=r(94601);function $(e,t){var r;let n=new Set((null!=(r=e.nodes)?r:[]).map(e=>e.id)),a="unknown"===t?"node":t;for(let e=1;e<1e4;e+=1){let t="".concat(a,"-").concat(e);if(!n.has(t))return t}return"".concat(a,"-").concat(Date.now())}function U(e,t,r){var n,a;let l=null!=(n=null==r?void 0:r.id)?n:$(e,t),s=function(e,t){switch(e){case"prompt":return{id:t,prompt:"Describe the desired behaviour…"};case"bash":return{id:t,bash:"echo todo"};case"skill":return{id:t,skill:"omni-digest",arguments:"$ARGUMENTS"};case"cft":return{id:t,cft:"pdca",config:{goal:"TBD",phase:"plan"}};case"approval":return{id:t,approval:{message:"Continue?"}};case"if":return{id:t,if:{condition:"$ARGUMENTS == 'yes'"}};case"switch":return{id:t,switch:{value:"$ARGUMENTS",cases:["a","b"]}};case"iteration":return{id:t,iteration:{items:'["a","b","c"]',body:"echo $index $item"}};case"classify":return{id:t,classify:{input:"$ARGUMENTS",classes:["question","command","other"]}};case"extract":return{id:t,extract:{input:"$ARGUMENTS",schema:{name:"person name",date:"ISO date if present"}}};case"set":return{id:t,set:{fields:{greeting:"Hello $ARGUMENTS"}}};case"filter":return{id:t,filter:{items:'["a","b","c"]',condition:"$item != 'b'"}};case"template":return{id:t,template:{template:"Hello {{ARGUMENTS}}!"}};case"http":return{id:t,http:{method:"GET",url:"https://api.example.com/items",headers:{Accept:"application/json"}}};case"scheduleTrigger":return{id:t,scheduleTrigger:{type:"interval",interval:36e5}};case"webhookTrigger":return{id:t,webhookTrigger:{method:"POST",path:"/hooks/example"}};case"discordTrigger":return{id:t,discordTrigger:{kind:"message"}};case"telegramTrigger":return{id:t,telegramTrigger:{kind:"message"}};case"manualTrigger":return{id:t,manualTrigger:{description:"Run manually"}};case"chatTrigger":return{id:t,chatTrigger:{path:"/chat",sessionMode:"stateless",streaming:!1}};default:return{id:t,bash:"echo placeholder"}}}(t,l);return{...e,nodes:[...null!=(a=e.nodes)?a:[],s]}}function H(e,t){var r;let n=(null!=(r=e.nodes)?r:[]).filter(e=>e.id!==t).map(e=>{let r=Array.isArray(e.depends_on)?e.depends_on.filter(e=>e!==t):void 0;if(void 0===r)return e;if(0===r.length){let{depends_on:t,...r}=e;return r}return{...e,depends_on:r}});return{...e,nodes:n}}function B(e){if(!e._meta||"object"!=typeof e._meta)return e;let t={...e._meta};if(!("layout"in t))return e;if(delete t.layout,0===Object.keys(t).length){let{_meta:t,...r}=e;return r}return{...e,_meta:t}}function K(e){var t;let r={};for(let t of("string"==typeof e.name&&(r.name=e.name),"string"==typeof e.description&&(r.description=e.description),Object.keys(e)))"name"!==t&&"description"!==t&&"nodes"!==t&&(r[t]=e[t]);return r.nodes=null!=(t=e.nodes)?t:[],(0,F.As)(r,{lineWidth:0,defaultStringType:"PLAIN",singleQuote:!1})}function X(e){try{let t=(0,F.parse)(e);if(!t||"object"!=typeof t||!Array.isArray(t.nodes))return null;return t}catch(e){return null}}let Y={running:{dot:"#3b82f6",label:"Running"},done:{dot:"#22c55e",label:"Done"},failed:{dot:"#ef4444",label:"Failed"},skipped:{dot:"#9ca3af",label:"Skipped"},awaiting_approval:{dot:"#f59e0b",label:"Awaiting approval"}},q={all:"\uD83D\uDCE3",modal:"\uD83D\uDDA5",terminal:"⌨",telegram:"\uD83D\uDCF2",discord:"\uD83D\uDCAC",pushcut:"\uD83D\uDD14"};async function J(e){try{let{parse:t}=await Promise.resolve().then(r.bind(r,94601)),n=t(e);if(!n||"object"!=typeof n||!Array.isArray(n.nodes))return null;return n}catch(e){return null}}let V={prompt:"#8b5cf6",bash:"#22c55e",skill:"#f59e0b",cft:"#06b6d4",approval:"#ef4444",if:"#ec4899",switch:"#d946ef",iteration:"#a855f7",classify:"#0ea5e9",extract:"#14b8a6",set:"#84cc16",filter:"#10b981",template:"#f97316",http:"#3b82f6",scheduleTrigger:"#6366f1",webhookTrigger:"#a78bfa",discordTrigger:"#5865f2",telegramTrigger:"#0088cc",manualTrigger:"#64748b",chatTrigger:"#9333ea",unknown:"#9ca3af"};function Q(e){let{yaml:t,definition:r,editable:l,onChangeYaml:s,onNodeClick:o,nodeStatuses:i,nodeIssues:d,cycleNodeIds:c,focusNodeId:u,focusNonce:p,onRun:x}=e,[m,h]=(0,a.useState)(null!=r?r:null),[f,g]=(0,a.useState)(!1),[b,y]=(0,a.useState)([]);(0,a.useEffect)(()=>{if(r){h(r),g(!1);return}let e=!1;return(async()=>{let r=await J(t);e||(h(r),g(null===r))})(),()=>{e=!0}},[t,r]);let v=(0,a.useCallback)(e=>{var r;if(!s)return;let n=null!=(r=X(t))?r:m;if(!n)return;let a=e(n);h(a);try{let e=K(a);s(e)}catch(e){}},[s,m,t]),j=(0,a.useMemo)(()=>{if(!m)return null;try{return function(e,t){let{nodes:r,edges:n}=function(e){var t,r,n,a,l,s,o,i,d,c,u,p;let x=[],m=[],h=new Set;for(let f of null!=(t=e.nodes)?t:[]){let e,t;if(!f||"string"!=typeof f.id||0===f.id.length||h.has(f.id))continue;h.add(f.id);let g=W(f),b="";switch(g){case"prompt":b=G(f.prompt);break;case"bash":b=G(f.bash);break;case"skill":b=String(null!=(r=f.skill)?r:"").slice(0,64);break;case"cft":b=String(null!=(n=f.cft)?n:"").slice(0,64);break;case"approval":{let t=f.approval;b=G(null==t?void 0:t.message),"string"==typeof(null==t?void 0:t.delivery)&&t.delivery.length>0&&(e=t.delivery);break}case"if":{let e=null==(a=f.if)?void 0:a.condition;b="string"==typeof e?e.slice(0,64):"";break}case"switch":{let e=f.switch,t=Array.isArray(null==e?void 0:e.cases)?" → ".concat(e.cases.length," case").concat(1===e.cases.length?"":"s"):"";b="".concat((null!=(l=null==e?void 0:e.value)?l:"").slice(0,40)).concat(t);break}case"iteration":{let e=f.iteration;b="over ".concat((null!=(s=null==e?void 0:e.items)?s:"").slice(0,32));break}case"classify":{let e=f.classify,t=Array.isArray(null==e?void 0:e.classes)?e.classes.length:0;b="".concat(t," class").concat(1===t?"":"es"," from ").concat((null!=(o=null==e?void 0:e.input)?o:"").slice(0,24));break}case"extract":{let e=f.extract,t=(null==e?void 0:e.schema)?Object.keys(e.schema).length:0;b="".concat(t," field").concat(1===t?"":"s"," from ").concat((null!=(i=null==e?void 0:e.input)?i:"").slice(0,24));break}case"set":{let e=f.set,t=(null==e?void 0:e.fields)?Object.keys(e.fields).length:0;b="set ".concat(t," field").concat(1===t?"":"s");break}case"filter":{let e=f.filter;b="filter ".concat((null!=(d=null==e?void 0:e.items)?d:"").slice(0,28)," on ").concat((null!=(c=null==e?void 0:e.condition)?c:"").slice(0,24));break}case"template":{let e=f.template,t=G(null==e?void 0:e.template);b="tpl: ".concat(t.slice(0,56));break}case"http":case"scheduleTrigger":case"webhookTrigger":case"discordTrigger":case"telegramTrigger":case"manualTrigger":case"chatTrigger":b=null!=(u=function(e,t){switch(e){case"scheduleTrigger":return function(e){if(!e)return"⏰ schedule";let t=e.type;if("cron"===t){let t=z(e.cron),r=z(e.timezone),n=O(t),a=!1===e.enabled?" \xb7 disabled":"",l="number"==typeof e.max_runs?" \xb7 max ".concat(e.max_runs," runs"):"";return"⏰ ".concat(n.text).concat(r?" ".concat(r):"").concat(l).concat(a)}if("interval"===t){let t="number"==typeof e.interval?e.interval:0,r=!1===e.enabled?" \xb7 disabled":"";if(t>=36e5&&t%36e5==0){let e=t/36e5;return"⏰ Every ".concat(e," hour").concat(1===e?"":"s").concat(r)}if(t>=6e4&&t%6e4==0){let e=t/6e4;return"⏰ Every ".concat(e," minute").concat(1===e?"":"s").concat(r)}let n=Math.max(1,Math.round(t/1e3));return"⏰ Every ".concat(n,"s").concat(r)}return"⏰ schedule"}(t.scheduleTrigger);case"webhookTrigger":return function(e){if(!e)return"\uD83D\uDD17 webhook";let t=z(e.method,"POST"),r=z(e.path),n=e.auth&&"object"==typeof e.auth?e.auth:null,a=n?" \xb7 ".concat(z(n.type)):"";return"\uD83D\uDD17 ".concat(t," ").concat(r).concat(a)}(t.webhookTrigger);case"http":return function(e){if(!e)return"\uD83C\uDF10 http";let t=z(e.method,"GET"),r=z(e.url),n="number"==typeof e.timeout?" \xb7 ".concat(Math.round(e.timeout/1e3),"s"):"";return"\uD83C\uDF10 ".concat(t," ").concat(r.slice(0,48)).concat(n)}(t.http);case"discordTrigger":return function(e){if(!e)return"\uD83D\uDCAC discord";let t=z(e.kind,"message"),r=[],n=z(e.channel);return n&&r.push("#".concat(n)),z(e.user)&&r.push("@".concat(z(e.user))),z(e.pattern)&&r.push("/".concat(z(e.pattern),"/")),r.push(t),"\uD83D\uDCAC ".concat(r.join(" \xb7 "))}(t.discordTrigger);case"telegramTrigger":var r=t.telegramTrigger;if(!r)return"✈️ telegram";let n=z(r.kind,"message"),a=[];return z(r.chat)&&a.push("@".concat(z(r.chat))),"command"===n&&z(r.command)&&a.push("/".concat(z(r.command))),z(r.user)&&a.push("from:".concat(z(r.user))),z(r.pattern)&&a.push("/".concat(z(r.pattern),"/")),a.push(n),"✈️ ".concat(a.join(" \xb7 "));case"manualTrigger":var l=t.manualTrigger;let s=z(null==l?void 0:l.description);return s?"▶ ".concat(s):"▶ Manual \xb7 explicit run";case"chatTrigger":return function(e){if(!e)return"\uD83D\uDCAD Chat";let t=z(e.path,"/chat"),r="per-session"===e.sessionMode?" \xb7 per-session":"",n=!0===e.streaming?" \xb7 streaming":"";return"\uD83D\uDCAD Chat: ".concat(t).concat(r).concat(n)}(t.chatTrigger);default:return null}}(g,f))?u:"";break;default:b=""}if("if"===g)t=["then","else"];else if("switch"===g){let e=null==(p=f.switch)?void 0:p.cases;Array.isArray(e)&&(t=[...e.filter(e=>"string"==typeof e&&e.length>0),"default"])}for(let r of(x.push({id:f.id,variant:g,label:f.id,preview:b,hasWhen:"string"==typeof f.when&&""!==f.when.trim(),..."string"==typeof f.trigger_rule?{triggerRule:f.trigger_rule}:{},hasToolPolicy:Array.isArray(f.allowed_tools)||Array.isArray(f.denied_tools),...void 0!==e?{approvalDelivery:e}:{},...t?{branches:t}:{}}),Array.isArray(f.depends_on)?f.depends_on:[]))"string"==typeof r&&0!==r.length&&m.push({id:"".concat(r,"->").concat(f.id),source:r,target:f.id})}return{nodes:x,edges:m}}(e),a=function(e){var t,r,n;let a=null!=(t=e.direction)?t:"LR",l=new S.Ay.graphlib.Graph;for(let t of(l.setDefaultEdgeLabel(()=>({})),l.setGraph({rankdir:a,ranksep:null!=(r=e.rankSep)?r:"LR"===a?100:80,nodesep:null!=(n=e.nodeSep)?n:"LR"===a?40:60,marginx:20,marginy:20}),e.nodes))l.setNode(t.id,{width:200,height:64});for(let t of e.edges)l.setEdge(t.source,t.target);S.Ay.layout(l);let s=e.nodes.map(e=>{var t,r,n,a;let s=l.node(e.id),o=(null!=(t=null==s?void 0:s.x)?t:0)-100,i=(null!=(r=null==s?void 0:s.y)?r:0)-32;return{...e,position:{x:o,y:i},width:null!=(n=null==s?void 0:s.width)?n:200,height:null!=(a=null==s?void 0:s.height)?a:64}}),o=0,i=0;for(let e of s)o=Math.max(o,e.position.x+e.width),i=Math.max(i,e.position.y+e.height);return{nodes:s,edges:e.edges,bounds:{width:o,height:i}}}({nodes:r,edges:n}),l=function(e){let t=e._meta;if(!t||"object"!=typeof t)return{};let r=t.layout;if(!r||"object"!=typeof r)return{};let n={};for(let[e,t]of Object.entries(r))t&&"object"==typeof t&&"number"==typeof t.x&&"number"==typeof t.y&&(n[e]={x:t.x,y:t.y});return n}(e);if(0===Object.keys(l).length)return a;let s=0,o=0;return{nodes:a.nodes.map(e=>{let t=l[e.id],r=null!=t?t:e.position,n={...e,position:r};return s=Math.max(s,r.x+e.width),o=Math.max(o,r.y+e.height),n}),edges:a.edges,bounds:{width:s,height:o}}}(m)}catch(e){return null}},[m]),w=(0,a.useMemo)(()=>j?j.nodes.map(e=>{var t,r;let n=null!=(t=null==c?void 0:c.has(e.id))&&t,a=null==d?void 0:d[e.id],l=null==i?void 0:i[e.id],s=(r=null==l?void 0:l.status)?"workflow-node-status workflow-node-status-".concat(r):"workflow-node-status";return{id:e.id,type:"workflow",position:e.position,data:{raw:e,statusEntry:l,issues:a,inCycle:n},className:s,style:{background:"var(--surface, #0f1117)",color:"var(--text-primary, #e5e7eb)",border:n?"2px dashed #ef4444":"1.5px solid ".concat(V[e.variant]),borderRadius:8,padding:0,width:e.width,fontSize:11,textAlign:"left"}}}):[],[j,i,d,c]),k=(0,a.useMemo)(()=>({workflow:el}),[]),N=(0,a.useMemo)(()=>j?j.edges.map(e=>{let t=(null==c?void 0:c.has(e.source))===!0&&c.has(e.target);return{id:e.id,source:e.source,target:e.target,animated:!1,style:t?{stroke:"#ef4444",strokeWidth:2,strokeDasharray:"6 4"}:{stroke:"var(--text-tertiary, #6b7280)",strokeWidth:1.5}}}):[],[j,c]),T=(0,a.useCallback)(e=>{l&&e.source&&e.target&&v(t=>(function(e,t,r){var n;if(t===r)return e;let a=(null!=(n=e.nodes)?n:[]).map(e=>{if(e.id!==r)return e;let n=Array.isArray(e.depends_on)?[...e.depends_on]:[];return n.includes(t)?e:(n.push(t),{...e,depends_on:n})});return{...e,nodes:a}})(t,e.source,e.target))},[l,v]),A=(0,a.useCallback)(e=>{if(!l)return;let t=e.filter(e=>"remove"===e.type);if(t.length>0)return void v(e=>t.reduce((e,t)=>H(e,t.id),e));let r=e.filter(e=>"position"===e.type&&!1===e.dragging&&void 0!==e.position);0!==r.length&&v(e=>r.reduce((e,t)=>(function(e,t,r){var n,a;if(!(null!=(n=e.nodes)?n:[]).find(e=>e.id===t))return e;let l=e._meta&&"object"==typeof e._meta?{...e._meta}:{},s=l.layout&&"object"==typeof l.layout?{...l.layout}:{},o=new Set((null!=(a=e.nodes)?a:[]).map(e=>e.id));for(let e of Object.keys(s))o.has(e)||delete s[e];return s[t]={x:Math.round(r.x),y:Math.round(r.y)},l.layout=s,{...e,_meta:l}})(e,t.id,t.position),e))},[l,v]),E=(0,a.useCallback)(e=>{if(!l)return;let t=e.filter(e=>"remove"===e.type);0!==t.length&&v(e=>t.reduce((e,t)=>{var r;let[n,a]=t.id.split("->");if(!n||!a)return e;let l=(null!=(r=e.nodes)?r:[]).map(e=>{if(e.id!==a||!Array.isArray(e.depends_on))return e;let t=e.depends_on.filter(e=>e!==n);if(t.length===e.depends_on.length)return e;if(0===t.length){let{depends_on:t,...r}=e;return r}return{...e,depends_on:t}});return{...e,nodes:l}},e))},[l,v]),[M,_]=(0,a.useState)(!1),P=(0,a.useCallback)(e=>{v(t=>U(t,e)),_(!1)},[v]);var R,I=(0,a.useMemo)(()=>{if(!l)return[];let e=[];return e.push({key:"n",handler:()=>_(e=>!e)}),e.push({key:"t",shift:!0,alt:!0,handler:()=>v(e=>B(e))}),e.push({key:"Escape",handler:()=>_(!1),preventDefault:!1}),e.push({key:"d",metaOrCtrl:!0,handler:()=>{let e=b[0];e&&v(t=>(function(e,t){var r,n;let a=(null!=(r=e.nodes)?r:[]).find(e=>e.id===t);if(!a)return e;let l=$(e,W(a)),{id:s,depends_on:o,...i}=a,d={...i,id:l};return{...e,nodes:[...null!=(n=e.nodes)?n:[],d]}})(t,e))}}),e.push({key:"F2",handler:()=>{let e=b[0];e&&o&&o(e)}}),x&&e.push({key:"Enter",metaOrCtrl:!0,handler:()=>x()}),e},[l,v,s,o,x,b]),L={enabled:!0===l};let D=null==(R=null==L?void 0:L.enabled)||R;return((0,a.useEffect)(()=>{if(!D||0===I.length)return;let e=e=>{if(!function(e){if(!e||!e.tagName)return!1;let t=e.tagName.toLowerCase();return"input"===t||"textarea"===t||e.isContentEditable}(e.target)){for(let t of I)if(function(e,t){if(e.key.toLowerCase()!==t.key.toLowerCase())return!1;if(e.metaOrCtrl){if(!(t.metaKey||t.ctrlKey))return!1}else if(void 0!==e.meta&&e.meta!==t.metaKey||void 0!==e.ctrl&&e.ctrl!==t.ctrlKey)return!1;return(void 0===e.alt||e.alt===t.altKey)&&(void 0===e.shift||e.shift===t.shiftKey)}(t,e)){!1!==t.preventDefault&&e.preventDefault(),t.handler(e);return}}};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[D,I]),f)?(0,n.jsx)("div",{className:"flex h-full items-center justify-center text-[11px] text-text-tertiary",children:"YAML parse failed — switch to YAML view to fix."}):m?0===w.length?(0,n.jsxs)("div",{className:"relative flex h-full items-center justify-center text-[11px] text-text-tertiary",children:[l&&(0,n.jsx)(Z,{onAdd:e=>v(t=>U(t,e))}),l?"No nodes yet — pick a variant from the palette.":"No nodes yet — switch to YAML view to add one."]}):(0,n.jsxs)("div",{className:"relative h-full w-full",children:[l&&(0,n.jsx)(Z,{onAdd:e=>v(t=>U(t,e))}),l&&(0,n.jsx)(en,{onTidy:()=>v(e=>B(e))}),l&&M&&(0,n.jsx)(ea,{onPick:P,onClose:()=>_(!1)}),(0,n.jsxs)(C.Gc,{nodes:w,edges:N,nodeTypes:k,nodesDraggable:null!=l&&l,nodesConnectable:null!=l&&l,elementsSelectable:null!=l&&l,deleteKeyCode:l?["Backspace","Delete"]:null,onConnect:l?T:void 0,onNodesChange:l?A:void 0,onEdgesChange:l?E:void 0,onNodeClick:o?(e,t)=>o(t.id):void 0,onSelectionChange:e=>{let{nodes:t}=e;return y(t.map(e=>e.id))},proOptions:{hideAttribution:!0},connectionLineComponent:l?ee:void 0,fitView:!0,children:[(0,n.jsx)(C.VS,{variant:C._5.Dots,gap:16,size:1}),(0,n.jsx)(C.H2,{showInteractive:!1}),void 0!==u&&(0,n.jsx)(et,{focusNodeId:null!=u?u:null,focusNonce:null!=p?p:0}),(0,n.jsx)(er,{selectedIds:b})]})]}):(0,n.jsx)("div",{className:"flex h-full items-center justify-center text-[11px] text-text-tertiary",children:"Parsing…"})}function Z(e){let{onAdd:t}=e;return(0,n.jsx)("div",{className:"absolute left-3 top-3 z-10 flex flex-col gap-1 rounded-md border border-border bg-surface-elevated p-1 shadow-md",children:[{v:"prompt",label:"+ prompt"},{v:"bash",label:"+ bash"},{v:"skill",label:"+ skill"},{v:"cft",label:"+ cft"},{v:"approval",label:"+ approval"},{v:"if",label:"+ if"},{v:"switch",label:"+ switch"},{v:"iteration",label:"+ loop"},{v:"classify",label:"+ classify"},{v:"extract",label:"+ extract"},{v:"set",label:"+ set"},{v:"filter",label:"+ filter"},{v:"template",label:"+ template"},{v:"http",label:"+ http"},{v:"scheduleTrigger",label:"+ schedule"},{v:"webhookTrigger",label:"+ webhook"}].map(e=>{let{v:r,label:a}=e;return(0,n.jsx)("button",{type:"button",onClick:()=>t(r),className:"rounded px-2 py-0.5 text-left text-[10px] text-text-tertiary transition-colors hover:bg-surface hover:text-text-primary",style:{minWidth:80},children:a},r)})})}function ee(e){let{fromX:t,fromY:r,toX:a,toY:l}=e;return(0,n.jsxs)("g",{className:"workflow-edge-pending",children:[(0,n.jsx)("path",{d:"M ".concat(t,",").concat(r," C ").concat(t+60,",").concat(r," ").concat(a-60,",").concat(l," ").concat(a,",").concat(l),fill:"none",stroke:"var(--accent, #8b5cf6)",strokeWidth:1.8,strokeDasharray:"4 3"}),(0,n.jsx)("circle",{cx:a,cy:l,r:4,fill:"var(--accent, #8b5cf6)"})]})}function et(e){let{focusNodeId:t,focusNonce:r}=e,n=(0,C.VH)();return(0,a.useEffect)(()=>{if(!t)return;let e=setTimeout(()=>{n.fitView({nodes:[{id:t}],duration:300,padding:.3})},0);return()=>{clearTimeout(e)}},[t,r,n]),null}function er(e){let{selectedIds:t}=e,r=(0,C.VH)(),n=t.join(",");return(0,a.useEffect)(()=>{if(t.length<=1)return;let e=setTimeout(()=>{r.fitView({nodes:t.map(e=>({id:e})),duration:300,padding:.25})},0);return()=>{clearTimeout(e)}},[n,r]),null}function en(e){let{onTidy:t}=e;return(0,n.jsx)("button",{type:"button",onClick:t,title:"Tidy-up auto-layout (Shift+Alt+T)",className:"absolute right-3 top-3 z-10 rounded-md border border-border bg-surface-elevated px-2 py-1 text-[10px] text-text-tertiary shadow-md hover:bg-surface hover:text-text-primary",children:"✨ Tidy"})}function ea(e){let{onPick:t,onClose:r}=e,[l,s]=(0,a.useState)(""),o=[{v:"prompt",label:"prompt",help:"Run an LLM prompt with the run context."},{v:"bash",label:"bash",help:"Run a shell snippet."},{v:"skill",label:"skill",help:"Invoke a registered skill (e.g. omni-digest)."},{v:"cft",label:"cft",help:"Run a CFT (e.g. pdca, swot)."},{v:"approval",label:"approval",help:"Pause for human approval."},{v:"if",label:"if",help:"Branch on a boolean condition (then / else)."},{v:"switch",label:"switch",help:"N-way branch on an expression value."},{v:"iteration",label:"iteration",help:"Run a bash body for each element of an array."},{v:"classify",label:"classify",help:"LLM picks one class label from a list."},{v:"extract",label:"extract",help:"LLM fills a JSON schema from free text."},{v:"set",label:"set",help:"Build a record of derived values."},{v:"filter",label:"filter",help:"Keep array elements where a condition holds."},{v:"template",label:"template",help:"{{var}} substitution into a string template."},{v:"http",label:"http",help:"HTTP request (GET/POST/...). Parsed JSON output."},{v:"scheduleTrigger",label:"schedule",help:"Cron / interval trigger (daemon-side dispatch v2)."},{v:"webhookTrigger",label:"webhook",help:"HTTP entry point (daemon-side dispatch v2)."}].filter(e=>e.label.includes(l.toLowerCase())||e.help.toLowerCase().includes(l.toLowerCase()));return(0,n.jsxs)("div",{className:"absolute right-0 top-0 z-20 flex h-full w-72 flex-col border-l border-border bg-surface-elevated shadow-xl",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between border-b border-border px-3 py-2",children:[(0,n.jsx)("span",{className:"text-xs font-semibold",children:"Add node"}),(0,n.jsx)("button",{type:"button",onClick:r,className:"text-[11px] text-text-tertiary hover:text-text-primary",title:"Close (Esc)",children:"✕"})]}),(0,n.jsx)("div",{className:"border-b border-border px-3 py-2",children:(0,n.jsx)("input",{type:"text",value:l,onChange:e=>s(e.target.value),placeholder:"Search variants…",autoFocus:!0,className:"w-full rounded-md border border-border bg-surface px-2 py-1 text-xs"})}),(0,n.jsxs)("ul",{className:"flex-1 overflow-y-auto px-2 py-2",children:[0===o.length&&(0,n.jsx)("li",{className:"px-2 py-1 text-[11px] text-text-tertiary",children:"No matches."}),o.map(e=>(0,n.jsx)("li",{children:(0,n.jsxs)("button",{type:"button",onClick:()=>t(e.v),className:"flex w-full flex-col items-start gap-0.5 rounded px-2 py-1.5 text-left text-[11px] hover:bg-surface",children:[(0,n.jsx)("span",{className:"inline-block rounded px-1.5 py-0.5 text-[9px] font-semibold uppercase tracking-wider text-white",style:{background:V[e.v]},children:e.label}),(0,n.jsx)("span",{className:"text-text-tertiary",children:e.help})]})},e.v))]})]})}function el(e){let{data:t}=e,{raw:r,statusEntry:a,issues:l}=t,s=(0,C.Pj)(e=>e.transform[2]<.7),o=r.branches;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(C.h7,{type:"target",position:T.yX.Left}),s?(0,n.jsx)(es,{raw:r,statusEntry:a}):function(e,t,r){var a,l,s,o;let i=t?Y[t.status]:null,d=(s=e.approvalDelivery)&&null!=(o=q[s])?o:null,c=t?"Last run: ".concat(null!=(a=null==i?void 0:i.label)?a:t.status)+(void 0!==t.durationMs?" \xb7 ".concat(t.durationMs,"ms"):"")+(t.error?" \xb7 ".concat(t.error):"")+(t.reason?" \xb7 ".concat(t.reason):""):void 0,u=null!=(l=null==r?void 0:r.length)?l:0,p=u>0?"".concat(u," validation issue").concat(1===u?"":"s",":\n")+r.map(e=>"\xb7 ".concat(e.message)).join("\n"):void 0;return(0,n.jsxs)("div",{style:{padding:"6px 8px"},children:[(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:2},children:[(0,n.jsx)("span",{style:{display:"inline-block",padding:"0 5px",borderRadius:3,fontSize:9,fontWeight:600,textTransform:"uppercase",letterSpacing:.4,background:V[e.variant],color:"white"},children:e.variant}),(0,n.jsx)("span",{style:{fontWeight:500,fontSize:11},children:e.id}),i&&(0,n.jsx)("span",{"aria-label":c,title:c,style:{display:"inline-block",width:8,height:8,borderRadius:"50%",background:i.dot,flexShrink:0,boxShadow:(null==t?void 0:t.status)==="running"?"0 0 0 2px ".concat(i.dot,"33"):void 0}}),u>0&&(0,n.jsx)("span",{"aria-label":p,title:p,style:{fontSize:10,color:"#ef4444",fontWeight:700,flexShrink:0},children:"⚠"}),d&&(0,n.jsx)("span",{"aria-label":"delivery: ".concat(e.approvalDelivery),title:"Delivery: ".concat(e.approvalDelivery),style:{fontSize:10,marginLeft:"auto",flexShrink:0},children:d})]}),e.preview&&(0,n.jsx)("div",{style:{fontSize:10,opacity:.75,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:e.preview}),(e.hasWhen||e.triggerRule||e.hasToolPolicy)&&(0,n.jsxs)("div",{style:{display:"flex",gap:4,marginTop:3,fontSize:9,opacity:.7},children:[e.hasWhen&&(0,n.jsx)("span",{children:"when"}),e.triggerRule&&(0,n.jsx)("span",{children:e.triggerRule}),e.hasToolPolicy&&(0,n.jsx)("span",{children:"tools"})]})]})}(r,a,l),o&&o.length>0?o.map((e,t)=>{let r=(t+1)/(o.length+1)*100;return(0,n.jsx)(C.h7,{type:"source",position:T.yX.Right,id:e,style:{top:"".concat(r,"%")},children:(0,n.jsx)("span",{"aria-hidden":!0,style:{position:"absolute",right:14,top:-2,fontSize:8,color:"var(--text-tertiary, #6b7280)",pointerEvents:"none",whiteSpace:"nowrap"},children:e})},e)}):(0,n.jsx)(C.h7,{type:"source",position:T.yX.Right})]})}function es(e){let{raw:t,statusEntry:r}=e,a=r?Y[r.status]:null;return(0,n.jsxs)("div",{style:{padding:"4px 8px",display:"flex",alignItems:"center",gap:6},children:[(0,n.jsx)("span",{style:{display:"inline-block",padding:"0 5px",borderRadius:3,fontSize:9,fontWeight:600,textTransform:"uppercase",letterSpacing:.4,background:V[t.variant],color:"white"},children:t.variant}),(0,n.jsx)("span",{style:{fontSize:11,fontWeight:500},children:t.id}),a&&(0,n.jsx)("span",{style:{display:"inline-block",width:8,height:8,borderRadius:"50%",background:a.dot,marginLeft:"auto"}})]})}T.rN;var eo=r(32235),ei=r(22124),ed=r(24206),ec=r(33303),eu=r(8795);function ep(e){var t;let{result:r,onApply:a,onRefine:l,onCancel:s}=e,o=null!=(t=r.yaml)?t:"";return(0,n.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40 px-4 py-6",role:"dialog","aria-modal":"true",onClick:s,children:(0,n.jsxs)("div",{className:"flex max-h-[80vh] w-full max-w-3xl flex-col gap-3 rounded-lg border border-border bg-surface-elevated p-4 shadow-xl",onClick:e=>e.stopPropagation(),children:[(0,n.jsxs)("header",{className:"flex items-center justify-between",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("span",{className:"rounded bg-surface px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-text-tertiary",children:"Synth preview"}),r.workflowName&&(0,n.jsx)("span",{className:"font-mono text-sm font-medium text-text-primary",children:r.workflowName}),r.repaired&&(0,n.jsx)("span",{className:"rounded-full border border-warning/30 bg-warning/10 px-2 py-0.5 text-[10px] text-warning",children:"self-repaired"})]}),(0,n.jsx)("button",{type:"button",onClick:s,className:"rounded p-1 text-text-tertiary hover:bg-surface hover:text-text-primary","aria-label":"Cancel",children:(0,n.jsx)(eo.A,{className:"h-4 w-4"})})]}),r.triggerSummary&&(0,n.jsxs)("div",{className:"rounded-md border border-accent/30 bg-accent/10 px-3 py-2 text-xs text-accent",children:[(0,n.jsx)("span",{className:"font-medium",children:"Trigger: "}),r.triggerSummary]}),!r.ok&&r.error&&(0,n.jsxs)("div",{className:"flex items-start gap-2 rounded-md border border-error/40 bg-error/10 px-3 py-2 text-xs text-error",children:[(0,n.jsx)(ed.A,{className:"mt-0.5 h-4 w-4 shrink-0"}),(0,n.jsx)("span",{children:r.error})]}),(0,n.jsx)("div",{className:"flex-1 overflow-auto rounded-md border border-border bg-surface",children:(0,n.jsx)("pre",{className:"m-0 whitespace-pre p-3 font-mono text-[11px] leading-relaxed text-text-primary",children:o||"(no yaml — synth failed)"})}),(0,n.jsxs)("footer",{className:"flex items-center justify-between gap-2",children:[(0,n.jsx)("span",{className:"text-[11px] text-text-tertiary",children:"Apply writes the YAML into the editor draft. Save (panel footer) commits to disk."}),(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsxs)("button",{type:"button",onClick:l,className:"flex items-center gap-1 rounded-md border border-border px-3 py-1 text-[11px] text-text-secondary hover:bg-surface",children:[(0,n.jsx)(ec.A,{className:"h-3 w-3"}),"Refine"]}),(0,n.jsx)("button",{type:"button",onClick:s,className:"rounded-md border border-border px-3 py-1 text-[11px] text-text-secondary hover:bg-surface",children:"Cancel"}),(0,n.jsxs)("button",{type:"button",onClick:()=>{o&&a(o,r.workflowName)},disabled:!r.ok||!o,className:"flex items-center gap-1 rounded-md bg-accent px-3 py-1 text-[11px] font-medium text-primary-foreground hover:bg-accent-hover disabled:opacity-50",children:[(0,n.jsx)(eu.A,{className:"h-3 w-3"}),"Apply"]})]})]})]})})}function ex(e){let{currentYaml:t,skills:r,onGenerated:l,onClose:s}=e,[o,i]=(0,a.useState)(""),[d,c]=(0,a.useState)(""),[u,p]=(0,a.useState)(null),x=(0,k.up)(),h=(0,k.hM)(),f=!!(t&&t.trim().length>0),b=x.error instanceof Error?x.error.message:h.error instanceof Error?h.error.message:x.isError||h.isError?"generation failed":null;return(0,n.jsxs)("div",{className:"border-b border-border bg-surface-elevated",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between px-3 py-2",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(m.A,{className:"h-4 w-4 text-accent"}),(0,n.jsx)("span",{className:"text-xs font-medium",children:f?"Refine workflow with AI":"Generate workflow from text"})]}),(0,n.jsx)("button",{type:"button",onClick:s,className:"rounded p-1 text-text-tertiary hover:bg-surface hover:text-text-primary","aria-label":"Close NL prompt",children:(0,n.jsx)(eo.A,{className:"h-3 w-3"})})]}),(0,n.jsxs)("div",{className:"px-3 pb-3",children:[(0,n.jsx)("textarea",{value:o,onChange:e=>i(e.target.value),placeholder:f?'How should this workflow change? e.g. "add a slack notification at the end"':'Describe the workflow. e.g. "Research the latest Apple Silicon benchmarks, summarize, and push to my iPhone."',rows:3,spellCheck:!1,className:"w-full resize-none rounded-md border border-border bg-surface px-2 py-1.5 text-xs leading-snug focus:border-accent focus:outline-none"}),(0,n.jsxs)("div",{className:"mt-2 flex items-center justify-between gap-2",children:[(0,n.jsxs)("select",{value:d,onChange:e=>c(e.target.value),className:"rounded-md border border-border bg-surface px-2 py-1 text-[11px] text-text-secondary focus:border-accent focus:outline-none",title:"LLM provider (default = your user-config)",children:[(0,n.jsx)("option",{value:"",children:"Default provider"}),(0,n.jsx)("option",{value:"anthropic",children:"anthropic"}),(0,n.jsx)("option",{value:"openai",children:"openai"}),(0,n.jsx)("option",{value:"grok",children:"grok"}),(0,n.jsx)("option",{value:"gemini",children:"gemini"}),(0,n.jsx)("option",{value:"local",children:"local"})]}),(0,n.jsxs)("div",{className:"flex items-center gap-1",children:[(0,n.jsx)("button",{type:"button",onClick:()=>{if(!o.trim()||h.isPending)return;let e={intent:o.trim(),preview:!0};f&&t&&(e.context="current yaml:\n".concat(t)),h.mutate(e,{onSuccess:e=>p(e)})},disabled:!o.trim()||h.isPending||x.isPending,className:"flex items-center gap-1 rounded-md border border-accent/40 bg-accent/10 px-3 py-1 text-[11px] font-medium text-accent hover:bg-accent/20 disabled:opacity-50",title:"Trigger-aware synth via R3 native skill (cron \xb7 webhook \xb7 discord \xb7 telegram \xb7 manual \xb7 chat all supported)",children:h.isPending?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(g.A,{className:"h-3 w-3 animate-spin"}),"Synthing…"]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(ei.A,{className:"h-3 w-3"}),"Synth (trigger-aware)"]})}),(0,n.jsx)("button",{type:"button",onClick:()=>{if(!o.trim()||x.isPending)return;let e={prompt:o.trim()};d&&(e.provider=d),r&&r.length>0&&(e.skills=r),f&&t&&(e.currentYaml=t),x.mutate(e,{onSuccess:e=>{l(e)}})},disabled:!o.trim()||x.isPending||h.isPending,className:"flex items-center gap-1 rounded-md bg-accent px-3 py-1 text-[11px] font-medium text-primary-foreground hover:bg-accent-hover disabled:opacity-50",children:x.isPending?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(g.A,{className:"h-3 w-3 animate-spin"}),"Generating…"]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(m.A,{className:"h-3 w-3"}),f?"Refine":"Generate"]})})]})]}),b&&(0,n.jsxs)("div",{className:"mt-2 flex items-start gap-1.5 rounded-md border border-error/40 bg-error/10 px-2 py-1 text-[11px] text-error",children:[(0,n.jsx)(ed.A,{className:"mt-0.5 h-3 w-3 shrink-0"}),(0,n.jsx)("span",{children:b})]}),u&&(0,n.jsx)(ep,{result:u,onApply:(e,t)=>{p(null),l({yaml:e,warnings:[],raw:e,definition:void 0})},onRefine:()=>p(null),onCancel:()=>p(null)}),x.data&&x.data.warnings.length>0&&(0,n.jsx)("ul",{className:"mt-2 max-h-24 overflow-y-auto rounded-md border border-warning/40 bg-warning/10 px-2 py-1 text-[11px] text-warning",children:x.data.warnings.slice(0,5).map((e,t)=>(0,n.jsxs)("li",{className:"flex items-start gap-1",children:[(0,n.jsx)(ed.A,{className:"mt-0.5 h-3 w-3 shrink-0"}),(0,n.jsx)("span",{children:e})]},t))})]})]})}let em={valid:"bg-success/10 text-success border-success/30",warning:"bg-warning/10 text-warning border-warning/30",error:"bg-error/10 text-error border-error/30"};function eh(e){let{variantLabel:t,validationStatus:r=null,validationMessage:a,children:l}=e;return(0,n.jsxs)("div",{className:"rounded-md border border-border bg-surface-elevated",children:[(0,n.jsxs)("header",{className:"flex items-center justify-between border-b border-border px-3 py-2",children:[(0,n.jsx)("span",{className:"rounded bg-surface px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-text-tertiary",children:t}),r&&(0,n.jsx)("span",{className:"rounded-full border px-2 py-0.5 text-[10px] ".concat(em[r]),role:"status",children:null!=a?a:r})]}),(0,n.jsx)("div",{className:"grid grid-cols-1 gap-2 px-3 py-3 md:grid-cols-2",children:l})]})}function ef(e){let{label:t,full:r,hint:a,children:l}=e;return(0,n.jsxs)("label",{className:"flex flex-col gap-1 ".concat(r?"md:col-span-2":""),children:[(0,n.jsx)("span",{className:"text-[10px] uppercase tracking-wide text-text-tertiary",children:t}),l,a&&(0,n.jsx)("span",{className:"text-[10px] text-text-tertiary",children:a})]})}function eg(e){let t=null==e?void 0:e.scheduleTrigger;return t&&"object"==typeof t?{type:"cron"===t.type?"cron":"interval",cron:"string"==typeof t.cron?t.cron:void 0,interval:"number"==typeof t.interval?t.interval:void 0,timezone:"string"==typeof t.timezone?t.timezone:void 0,jitter_seconds:"number"==typeof t.jitter_seconds?t.jitter_seconds:void 0,max_runs:"number"==typeof t.max_runs?t.max_runs:void 0,enabled:"boolean"==typeof t.enabled?t.enabled:void 0}:{type:"interval",interval:36e5}}function eb(e){var t,r,l,s,o,i;let{definition:d,nodeId:c,onChange:u}=e,p=(null!=(t=d.nodes)?t:[]).find(e=>e.id===c),x=eg(p),[m,h]=(0,a.useState)(x.type),[f,g]=(0,a.useState)(null!=(r=x.cron)?r:"0 9 * * *"),[b,y]=(0,a.useState)(String(null!=(l=x.interval)?l:36e5)),[v,j]=(0,a.useState)(null!=(s=x.timezone)?s:"Asia/Seoul"),[w,k]=(0,a.useState)(String(null!=(o=x.jitter_seconds)?o:"")),[N,C]=(0,a.useState)(String(null!=(i=x.max_runs)?i:"")),[T,S]=(0,a.useState)(!1!==x.enabled);(0,a.useEffect)(()=>{let e=eg(p);h(e.type),e.cron&&g(e.cron),"number"==typeof e.interval&&y(String(e.interval)),e.timezone&&j(e.timezone),k("number"==typeof e.jitter_seconds?String(e.jitter_seconds):""),C("number"==typeof e.max_runs?String(e.max_runs):""),S(!1!==e.enabled)},[c,p]);let A=(0,a.useCallback)(()=>{let e=Number(b),t=""===w?void 0:Number(w),r=""===N?void 0:Number(N);return{type:m,cron:"cron"===m?f.trim():void 0,interval:"interval"===m&&Number.isFinite(e)?e:void 0,timezone:v.trim()||void 0,jitter_seconds:Number.isFinite(t)?t:void 0,max_runs:Number.isFinite(r)?r:void 0,enabled:T}},[m,f,b,v,w,N,T]),E=(0,a.useRef)(null);(0,a.useEffect)(()=>{if(p)return E.current&&clearTimeout(E.current),E.current=setTimeout(()=>{u(function(e,t,r){var n;let a={type:r.type};"cron"===r.type&&r.cron&&(a.cron=r.cron),"interval"===r.type&&"number"==typeof r.interval&&(a.interval=r.interval),r.timezone&&(a.timezone=r.timezone),"number"==typeof r.jitter_seconds&&(a.jitter_seconds=r.jitter_seconds),"number"==typeof r.max_runs&&(a.max_runs=r.max_runs),"boolean"==typeof r.enabled&&(a.enabled=r.enabled);let l=(null!=(n=e.nodes)?n:[]).map(e=>e.id===t?{...e,scheduleTrigger:a}:e);return{...e,nodes:l}}(d,c,A()))},500),()=>{E.current&&clearTimeout(E.current)}},[p,c,d,A,u]);let M="cron"===m?O(f):null,_=Number(b)/1e3,P=T&&("cron"!==m||(null==M?void 0:M.matched))?"valid":"warning",R=T?"cron"===m?(null==M?void 0:M.matched)?"cron ok":"custom cron":Number.isFinite(_)&&_>0?"every ".concat(_,"s"):"interval invalid":"disabled";return(0,n.jsxs)(eh,{variantLabel:"Schedule",validationStatus:P,validationMessage:R,children:[(0,n.jsx)(ef,{label:"type",children:(0,n.jsxs)("select",{value:m,onChange:e=>h(e.target.value),className:"w-full rounded-md border border-border bg-surface px-2 py-1 text-xs",children:[(0,n.jsx)("option",{value:"cron",children:"cron"}),(0,n.jsx)("option",{value:"interval",children:"interval"})]})}),(0,n.jsx)(ef,{label:"enabled",children:(0,n.jsxs)("label",{className:"flex items-center gap-2 text-xs",children:[(0,n.jsx)("input",{type:"checkbox",checked:T,onChange:e=>S(e.target.checked)}),(0,n.jsx)("span",{className:"text-text-tertiary",children:T?"on":"off"})]})}),"cron"===m&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(ef,{label:"presets",full:!0,children:(0,n.jsx)("div",{className:"flex flex-wrap gap-1",children:D.map(e=>(0,n.jsx)("button",{type:"button",onClick:()=>g(e.expression),"data-preset":e.id,className:"rounded-md border border-border px-2 py-0.5 font-mono text-[10px] text-text-tertiary hover:bg-surface",children:e.label},e.id))})}),(0,n.jsx)(ef,{label:"cron expression",full:!0,hint:null==M?void 0:M.text,children:(0,n.jsx)("input",{value:f,onChange:e=>g(e.target.value),spellCheck:!1,className:"w-full rounded-md border border-border bg-surface px-2 py-1 font-mono text-xs"})})]}),"interval"===m&&(0,n.jsx)(ef,{label:"interval (ms)",hint:"= ".concat(_||"?","s"),children:(0,n.jsx)("input",{type:"number",min:1e3,value:b,onChange:e=>y(e.target.value),className:"w-full rounded-md border border-border bg-surface px-2 py-1 font-mono text-xs"})}),(0,n.jsx)(ef,{label:"timezone (IANA)",hint:"e.g. Asia/Seoul \xb7 UTC \xb7 America/Los_Angeles",children:(0,n.jsx)("input",{value:v,onChange:e=>j(e.target.value),spellCheck:!1,className:"w-full rounded-md border border-border bg-surface px-2 py-1 font-mono text-xs"})}),(0,n.jsx)(ef,{label:"jitter (seconds \xb7 optional)",children:(0,n.jsx)("input",{type:"number",min:0,value:w,onChange:e=>k(e.target.value),placeholder:"e.g. 30",className:"w-full rounded-md border border-border bg-surface px-2 py-1 font-mono text-xs"})}),(0,n.jsx)(ef,{label:"max runs (optional)",children:(0,n.jsx)("input",{type:"number",min:1,step:1,value:N,onChange:e=>C(e.target.value),placeholder:"unlimited",className:"w-full rounded-md border border-border bg-surface px-2 py-1 font-mono text-xs"})})]})}let ey=["GET","POST","PUT","PATCH","DELETE"];function ev(e){let t=null==e?void 0:e.webhookTrigger;if(!t||"object"!=typeof t)return{method:"POST",path:"/hooks/example",auth:"none"};let r=ey.includes(t.method)?t.method:"POST",n="string"==typeof t.path?t.path:"/hooks/example",a=t.auth&&"object"==typeof t.auth?t.auth:null;return a&&"bearer"===a.type?{method:r,path:n,auth:"bearer",token:"string"==typeof a.token?a.token:""}:a&&"basic"===a.type?{method:r,path:n,auth:"basic",username:"string"==typeof a.username?a.username:"",password:"string"==typeof a.password?a.password:""}:{method:r,path:n,auth:"none"}}function ej(e){var t,r,l,s;let{definition:o,nodeId:i,onChange:d}=e,c=(null!=(t=o.nodes)?t:[]).find(e=>e.id===i),u=ev(c),[p,x]=(0,a.useState)(u.method),[m,h]=(0,a.useState)(u.path),[f,g]=(0,a.useState)(u.auth),[b,y]=(0,a.useState)(null!=(r=u.token)?r:""),[v,j]=(0,a.useState)(null!=(l=u.username)?l:""),[w,k]=(0,a.useState)(null!=(s=u.password)?s:"");(0,a.useEffect)(()=>{var e,t,r;let n=ev(c);x(n.method),h(n.path),g(n.auth),y(null!=(e=n.token)?e:""),j(null!=(t=n.username)?t:""),k(null!=(r=n.password)?r:"")},[i,c]);let N=(0,a.useCallback)(()=>({method:p,path:m,auth:f,token:b,username:v,password:w}),[p,m,f,b,v,w]),C=(0,a.useRef)(null);(0,a.useEffect)(()=>{if(c)return C.current&&clearTimeout(C.current),C.current=setTimeout(()=>{d(function(e,t,r){var n,a,l;let s={method:r.method,path:r.path};"bearer"===r.auth&&r.token?s.auth={type:"bearer",token:r.token}:"basic"===r.auth&&(r.username||r.password)&&(s.auth={type:"basic",username:null!=(n=r.username)?n:"",password:null!=(a=r.password)?a:""});let o=(null!=(l=e.nodes)?l:[]).map(e=>e.id===t?{...e,webhookTrigger:s}:e);return{...e,nodes:o}}(o,i,N()))},500),()=>{C.current&&clearTimeout(C.current)}},[c,i,o,N,d]);let T=m.trim()?m.startsWith("/")?/\s/.test(m)?{ok:!1,message:"no whitespace in path"}:{ok:!0,message:"path ok"}:{ok:!1,message:"path must start with '/'"}:{ok:!1,message:"path required"},S=T.ok?"valid":"error",A="".concat(p," ").concat(m);return(0,n.jsxs)(eh,{variantLabel:"Webhook",validationStatus:S,validationMessage:T.message,children:[(0,n.jsx)(ef,{label:"method",children:(0,n.jsx)("select",{value:p,onChange:e=>x(e.target.value),className:"w-full rounded-md border border-border bg-surface px-2 py-1 text-xs",children:ey.map(e=>(0,n.jsx)("option",{value:e,children:e},e))})}),(0,n.jsx)(ef,{label:"path",hint:"URL: ".concat(A),children:(0,n.jsx)("input",{value:m,onChange:e=>h(e.target.value),placeholder:"/hooks/deploy",spellCheck:!1,className:"w-full rounded-md border border-border bg-surface px-2 py-1 font-mono text-xs"})}),(0,n.jsx)(ef,{label:"auth",full:!0,children:(0,n.jsx)("div",{className:"flex gap-2 text-xs",children:["none","bearer","basic"].map(e=>(0,n.jsxs)("label",{className:"flex items-center gap-1",children:[(0,n.jsx)("input",{type:"radio",name:"webhook-auth",checked:f===e,onChange:()=>g(e)}),(0,n.jsx)("span",{className:"text-text-tertiary",children:e})]},e))})}),"bearer"===f&&(0,n.jsx)(ef,{label:"token",full:!0,children:(0,n.jsx)("input",{type:"password",value:b,onChange:e=>y(e.target.value),placeholder:"bearer token",spellCheck:!1,className:"w-full rounded-md border border-border bg-surface px-2 py-1 font-mono text-xs"})}),"basic"===f&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(ef,{label:"username",children:(0,n.jsx)("input",{value:v,onChange:e=>j(e.target.value),spellCheck:!1,className:"w-full rounded-md border border-border bg-surface px-2 py-1 font-mono text-xs"})}),(0,n.jsx)(ef,{label:"password",children:(0,n.jsx)("input",{type:"password",value:w,onChange:e=>k(e.target.value),spellCheck:!1,className:"w-full rounded-md border border-border bg-surface px-2 py-1 font-mono text-xs"})})]})]})}let ew=["GET","POST","PUT","PATCH","DELETE","HEAD"];function ek(e){let t=null==e?void 0:e.http;if(!t||"object"!=typeof t)return{method:"GET",url:"https://api.example.com/items",headers:[],body:"",auth:"none",timeoutMs:3e4};let r=ew.includes(t.method)?t.method:"GET",n="string"==typeof t.url?t.url:"",a=Object.entries(t.headers&&"object"==typeof t.headers?t.headers:{}).filter(e=>{let[,t]=e;return"string"==typeof t}).map(e=>{let[t,r]=e;return{key:t,value:r}}),l="string"==typeof t.body?t.body:"",s="number"==typeof t.timeout?t.timeout:3e4,o=t.auth&&"object"==typeof t.auth?t.auth:null;return o&&"bearer"===o.type?{method:r,url:n,headers:a,body:l,auth:"bearer",token:"string"==typeof o.token?o.token:"",timeoutMs:s}:o&&"basic"===o.type?{method:r,url:n,headers:a,body:l,auth:"basic",username:"string"==typeof o.username?o.username:"",password:"string"==typeof o.password?o.password:"",timeoutMs:s}:{method:r,url:n,headers:a,body:l,auth:"none",timeoutMs:s}}function eN(e){var t,r,l,s;let{definition:o,nodeId:i,onChange:d}=e,c=(null!=(t=o.nodes)?t:[]).find(e=>e.id===i),u=ek(c),[p,x]=(0,a.useState)(u.method),[m,h]=(0,a.useState)(u.url),[f,g]=(0,a.useState)(u.headers),[b,y]=(0,a.useState)(u.body),[v,j]=(0,a.useState)(u.auth),[w,k]=(0,a.useState)(null!=(r=u.token)?r:""),[N,C]=(0,a.useState)(null!=(l=u.username)?l:""),[T,S]=(0,a.useState)(null!=(s=u.password)?s:""),[A,E]=(0,a.useState)(u.timeoutMs);(0,a.useEffect)(()=>{var e,t,r;let n=ek(c);x(n.method),h(n.url),g(n.headers),y(n.body),j(n.auth),k(null!=(e=n.token)?e:""),C(null!=(t=n.username)?t:""),S(null!=(r=n.password)?r:""),E(n.timeoutMs)},[i,c]);let M=(0,a.useCallback)(()=>({method:p,url:m,headers:f,body:b,auth:v,token:w,username:N,password:T,timeoutMs:A}),[p,m,f,b,v,w,N,T,A]),_=(0,a.useRef)(null);(0,a.useEffect)(()=>{if(c)return _.current&&clearTimeout(_.current),_.current=setTimeout(()=>{d(function(e,t,r){var n,a,l;let s={method:r.method,url:r.url};if(r.headers.length>0){let e={};for(let t of r.headers)t.key.trim()&&(e[t.key.trim()]=t.value);Object.keys(e).length>0&&(s.headers=e)}r.body.trim()&&(s.body=r.body),"bearer"===r.auth&&r.token?s.auth={type:"bearer",token:r.token}:"basic"===r.auth&&(r.username||r.password)&&(s.auth={type:"basic",username:null!=(n=r.username)?n:"",password:null!=(a=r.password)?a:""}),r.timeoutMs&&3e4!==r.timeoutMs&&(s.timeout=r.timeoutMs);let o=(null!=(l=e.nodes)?l:[]).map(e=>e.id===t?{...e,http:s}:e);return{...e,nodes:o}}(o,i,M()))},500),()=>{_.current&&clearTimeout(_.current)}},[c,i,o,M,d]);let P=function(e){if(!e.trim())return{ok:!1,message:"url required"};try{return new URL(e),{ok:!0,message:"url ok"}}catch(e){return{ok:!1,message:"invalid URL"}}}(m),R=P.ok?"valid":"error",I=(e,t,r)=>{g(n=>n.map((n,a)=>a===e?{key:t,value:r}:n))};return(0,n.jsxs)(eh,{variantLabel:"HTTP",validationStatus:R,validationMessage:P.message,children:[(0,n.jsx)(ef,{label:"method",children:(0,n.jsx)("select",{value:p,onChange:e=>x(e.target.value),className:"w-full rounded-md border border-border bg-surface px-2 py-1 text-xs",children:ew.map(e=>(0,n.jsx)("option",{value:e,children:e},e))})}),(0,n.jsx)(ef,{label:"timeout (ms)",hint:"= ".concat(Math.round(A/1e3),"s"),children:(0,n.jsx)("input",{type:"number",min:1e3,max:12e4,step:1e3,value:A,onChange:e=>E(Number(e.target.value)),className:"w-full rounded-md border border-border bg-surface px-2 py-1 font-mono text-xs"})}),(0,n.jsx)(ef,{label:"url",full:!0,hint:"supports $ARGUMENTS variable",children:(0,n.jsx)("input",{value:m,onChange:e=>h(e.target.value),placeholder:"https://api.example.com/items",spellCheck:!1,className:"w-full rounded-md border border-border bg-surface px-2 py-1 font-mono text-xs"})}),(0,n.jsx)(ef,{label:"headers",full:!0,children:(0,n.jsxs)("div",{className:"flex flex-col gap-1",children:[f.map((e,t)=>(0,n.jsxs)("div",{className:"flex gap-1",children:[(0,n.jsx)("input",{value:e.key,onChange:r=>I(t,r.target.value,e.value),placeholder:"Accept",spellCheck:!1,className:"flex-1 rounded-md border border-border bg-surface px-2 py-0.5 font-mono text-[11px]"}),(0,n.jsx)("input",{value:e.value,onChange:r=>I(t,e.key,r.target.value),placeholder:"application/json",spellCheck:!1,className:"flex-1 rounded-md border border-border bg-surface px-2 py-0.5 font-mono text-[11px]"}),(0,n.jsx)("button",{type:"button",onClick:()=>g(e=>e.filter((e,r)=>r!==t)),className:"rounded px-1.5 text-[11px] text-text-tertiary hover:bg-error/10 hover:text-error","aria-label":"Remove header",children:"\xd7"})]},t)),(0,n.jsx)("button",{type:"button",onClick:()=>g(e=>[...e,{key:"",value:""}]),className:"self-start rounded-md border border-border px-2 py-0.5 text-[10px] text-text-tertiary hover:bg-surface",children:"+ header"})]})}),(0,n.jsx)(ef,{label:"body (string)",full:!0,hint:"GET"===p||"HEAD"===p?"usually empty for GET/HEAD":"JSON / raw text",children:(0,n.jsx)("textarea",{value:b,onChange:e=>y(e.target.value),rows:3,spellCheck:!1,className:"w-full resize-none rounded-md border border-border bg-surface px-2 py-1 font-mono text-xs"})}),(0,n.jsx)(ef,{label:"auth",full:!0,children:(0,n.jsx)("div",{className:"flex gap-2 text-xs",children:["none","bearer","basic"].map(e=>(0,n.jsxs)("label",{className:"flex items-center gap-1",children:[(0,n.jsx)("input",{type:"radio",name:"http-auth",checked:v===e,onChange:()=>j(e)}),(0,n.jsx)("span",{className:"text-text-tertiary",children:e})]},e))})}),"bearer"===v&&(0,n.jsx)(ef,{label:"token",full:!0,children:(0,n.jsx)("input",{type:"password",value:w,onChange:e=>k(e.target.value),spellCheck:!1,className:"w-full rounded-md border border-border bg-surface px-2 py-1 font-mono text-xs"})}),"basic"===v&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(ef,{label:"username",children:(0,n.jsx)("input",{value:N,onChange:e=>C(e.target.value),spellCheck:!1,className:"w-full rounded-md border border-border bg-surface px-2 py-1 font-mono text-xs"})}),(0,n.jsx)(ef,{label:"password",children:(0,n.jsx)("input",{type:"password",value:T,onChange:e=>S(e.target.value),spellCheck:!1,className:"w-full rounded-md border border-border bg-surface px-2 py-1 font-mono text-xs"})})]})]})}let eC=["message","mention","reaction"];function eT(e){let t=null==e?void 0:e.discordTrigger;return t&&"object"==typeof t?{kind:eC.includes(t.kind)?t.kind:"message",channel:"string"==typeof t.channel?t.channel:void 0,user:"string"==typeof t.user?t.user:void 0,pattern:"string"==typeof t.pattern?t.pattern:void 0}:{kind:"message"}}function eS(e){if(!e)return{ok:!0,message:"no filter"};try{return new RegExp(e),{ok:!0,message:"pattern ok"}}catch(e){return{ok:!1,message:"invalid regex"}}}function eA(e){var t,r,l,s;let{definition:o,nodeId:i,onChange:d}=e,c=(null!=(t=o.nodes)?t:[]).find(e=>e.id===i),u=eT(c),[p,x]=(0,a.useState)(u.kind),[m,h]=(0,a.useState)(null!=(r=u.channel)?r:""),[f,g]=(0,a.useState)(null!=(l=u.user)?l:""),[b,y]=(0,a.useState)(null!=(s=u.pattern)?s:"");(0,a.useEffect)(()=>{var e,t,r;let n=eT(c);x(n.kind),h(null!=(e=n.channel)?e:""),g(null!=(t=n.user)?t:""),y(null!=(r=n.pattern)?r:"")},[i,c]);let v=(0,a.useCallback)(()=>({kind:p,channel:m,user:f,pattern:b}),[p,m,f,b]),j=(0,a.useRef)(null);(0,a.useEffect)(()=>{if(c)return j.current&&clearTimeout(j.current),j.current=setTimeout(()=>{d(function(e,t,r){var n,a,l,s;let o={kind:r.kind};(null==(n=r.channel)?void 0:n.trim())&&(o.channel=r.channel.trim()),(null==(a=r.user)?void 0:a.trim())&&(o.user=r.user.trim()),(null==(l=r.pattern)?void 0:l.trim())&&(o.pattern=r.pattern.trim());let i=(null!=(s=e.nodes)?s:[]).map(e=>e.id===t?{...e,discordTrigger:o}:e);return{...e,nodes:i}}(o,i,v()))},500),()=>{j.current&&clearTimeout(j.current)}},[c,i,o,v,d]);let w=eS(b),k=[m&&"#".concat(m),f&&"@".concat(f),b&&"/".concat(b,"/")].filter(Boolean).join(" \xb7 "),N=w.ok?"valid":"error",C=w.ok?k||"no filters":w.message;return(0,n.jsxs)(eh,{variantLabel:"Discord",validationStatus:N,validationMessage:C,children:[(0,n.jsx)(ef,{label:"kind",children:(0,n.jsx)("select",{value:p,onChange:e=>x(e.target.value),className:"w-full rounded-md border border-border bg-surface px-2 py-1 text-xs",children:eC.map(e=>(0,n.jsx)("option",{value:e,children:e},e))})}),(0,n.jsx)(ef,{label:"channel (name or id)",hint:"e.g. ops \xb7 1234567890",children:(0,n.jsx)("input",{value:m,onChange:e=>h(e.target.value),placeholder:"ops",spellCheck:!1,className:"w-full rounded-md border border-border bg-surface px-2 py-1 font-mono text-xs"})}),(0,n.jsx)(ef,{label:"user (regex \xb7 optional)",hint:"match by username — e.g. .* \xb7 admin",children:(0,n.jsx)("input",{value:f,onChange:e=>g(e.target.value),placeholder:".*",spellCheck:!1,className:"w-full rounded-md border border-border bg-surface px-2 py-1 font-mono text-xs"})}),(0,n.jsx)(ef,{label:"pattern (regex \xb7 optional)",full:!0,hint:"match message body — e.g. ^배포",children:(0,n.jsx)("input",{value:b,onChange:e=>y(e.target.value),placeholder:"^deploy",spellCheck:!1,className:"w-full rounded-md border border-border bg-surface px-2 py-1 font-mono text-xs"})})]})}let eE=["message","command","callback_query"];function eM(e){let t=null==e?void 0:e.telegramTrigger;return t&&"object"==typeof t?{kind:eE.includes(t.kind)?t.kind:"message",chat:"string"==typeof t.chat?t.chat:void 0,user:"string"==typeof t.user?t.user:void 0,command:"string"==typeof t.command?t.command:void 0,pattern:"string"==typeof t.pattern?t.pattern:void 0}:{kind:"message"}}function e_(e){var t,r,l,s,o;let{definition:i,nodeId:d,onChange:c}=e,u=(null!=(t=i.nodes)?t:[]).find(e=>e.id===d),p=eM(u),[x,m]=(0,a.useState)(p.kind),[h,f]=(0,a.useState)(null!=(r=p.chat)?r:""),[g,b]=(0,a.useState)(null!=(l=p.user)?l:""),[y,v]=(0,a.useState)(null!=(s=p.command)?s:""),[j,w]=(0,a.useState)(null!=(o=p.pattern)?o:"");(0,a.useEffect)(()=>{var e,t,r,n;let a=eM(u);m(a.kind),f(null!=(e=a.chat)?e:""),b(null!=(t=a.user)?t:""),v(null!=(r=a.command)?r:""),w(null!=(n=a.pattern)?n:"")},[d,u]);let k=(0,a.useCallback)(()=>({kind:x,chat:h,user:g,command:y,pattern:j}),[x,h,g,y,j]),N=(0,a.useRef)(null);(0,a.useEffect)(()=>{if(u)return N.current&&clearTimeout(N.current),N.current=setTimeout(()=>{c(function(e,t,r){var n,a,l,s,o;let i={kind:r.kind};(null==(n=r.chat)?void 0:n.trim())&&(i.chat=r.chat.trim()),(null==(a=r.user)?void 0:a.trim())&&(i.user=r.user.trim()),"command"===r.kind&&(null==(l=r.command)?void 0:l.trim())&&(i.command=r.command.trim()),(null==(s=r.pattern)?void 0:s.trim())&&(i.pattern=r.pattern.trim());let d=(null!=(o=e.nodes)?o:[]).map(e=>e.id===t?{...e,telegramTrigger:i}:e);return{...e,nodes:d}}(i,d,k()))},500),()=>{N.current&&clearTimeout(N.current)}},[u,d,i,k,c]);let C=eS(j),T=[h&&"@".concat(h),g&&"from:".concat(g),"command"===x&&y&&"/".concat(y),j&&"/".concat(j,"/")].filter(Boolean).join(" \xb7 "),S=C.ok?"valid":"error",A=C.ok?T||"no filters":C.message;return(0,n.jsxs)(eh,{variantLabel:"Telegram",validationStatus:S,validationMessage:A,children:[(0,n.jsx)(ef,{label:"kind",children:(0,n.jsx)("select",{value:x,onChange:e=>m(e.target.value),className:"w-full rounded-md border border-border bg-surface px-2 py-1 text-xs",children:eE.map(e=>(0,n.jsx)("option",{value:e,children:e},e))})}),(0,n.jsx)(ef,{label:"chat (id or @group)",hint:"e.g. @my_group \xb7 -1001234567890",children:(0,n.jsx)("input",{value:h,onChange:e=>f(e.target.value),placeholder:"@my_group",spellCheck:!1,className:"w-full rounded-md border border-border bg-surface px-2 py-1 font-mono text-xs"})}),"command"===x&&(0,n.jsx)(ef,{label:"command",hint:"match telegram /command (no slash)",full:!0,children:(0,n.jsx)("input",{value:y,onChange:e=>v(e.target.value),placeholder:"summary",spellCheck:!1,className:"w-full rounded-md border border-border bg-surface px-2 py-1 font-mono text-xs"})}),(0,n.jsx)(ef,{label:"user (regex \xb7 optional)",hint:"match by username or id",children:(0,n.jsx)("input",{value:g,onChange:e=>b(e.target.value),placeholder:".*",spellCheck:!1,className:"w-full rounded-md border border-border bg-surface px-2 py-1 font-mono text-xs"})}),(0,n.jsx)(ef,{label:"pattern (regex \xb7 optional)",full:!0,hint:"match message body — e.g. ^배포",children:(0,n.jsx)("input",{value:j,onChange:e=>w(e.target.value),placeholder:"^summarize",spellCheck:!1,className:"w-full rounded-md border border-border bg-surface px-2 py-1 font-mono text-xs"})})]})}function eP(e){let t=null==e?void 0:e.manualTrigger;return t&&"object"==typeof t?{description:"string"==typeof t.description?t.description:void 0}:{}}function eR(e){var t,r;let{definition:l,nodeId:s,onChange:o}=e,i=(null!=(t=l.nodes)?t:[]).find(e=>e.id===s),d=eP(i),[c,u]=(0,a.useState)(null!=(r=d.description)?r:"");(0,a.useEffect)(()=>{var e;u(null!=(e=eP(i).description)?e:"")},[s,i]);let p=(0,a.useCallback)(()=>({description:c}),[c]),x=(0,a.useRef)(null);return(0,a.useEffect)(()=>{if(i)return x.current&&clearTimeout(x.current),x.current=setTimeout(()=>{o(function(e,t,r){var n,a;let l={};(null==(n=r.description)?void 0:n.trim())&&(l.description=r.description.trim());let s=(null!=(a=e.nodes)?a:[]).map(e=>e.id===t?{...e,manualTrigger:l}:e);return{...e,nodes:s}}(l,s,p()))},500),()=>{x.current&&clearTimeout(x.current)}},[i,s,l,p,o]),(0,n.jsxs)(eh,{variantLabel:"Manual",validationStatus:"valid",validationMessage:"explicit run only",children:[(0,n.jsx)(ef,{label:"description (optional)",full:!0,hint:"rendered on the node card \xb7 helps remind future-you why this workflow runs manually",children:(0,n.jsx)("input",{value:c,onChange:e=>u(e.target.value),placeholder:"e.g. Build then deploy on demand",spellCheck:!1,className:"w-full rounded-md border border-border bg-surface px-2 py-1 text-xs"})}),(0,n.jsx)(ef,{label:"behaviour",full:!0,children:(0,n.jsxs)("p",{className:"rounded-md border border-border bg-surface px-2 py-1.5 text-[11px] leading-snug text-text-tertiary",children:["The daemon never auto-subscribes to a Manual trigger. Run it via",(0,n.jsx)("code",{className:"mx-1 rounded bg-surface-elevated px-1 font-mono",children:"elanous wf run <name>"}),"or the PWA ",(0,n.jsx)("span",{className:"font-semibold",children:"▶ Run now"})," button (Group D dry-run)."]})})]})}function eI(e){let t=null==e?void 0:e.chatTrigger;if(!t||"object"!=typeof t)return{path:"/chat",auth:"none",sessionMode:"stateless",streaming:!1};let r="string"==typeof t.path?t.path:"/chat",n=t.auth&&"object"==typeof t.auth?t.auth:null,a=n&&"bearer"===n.type?"bearer":"none",l=n&&"bearer"===n.type&&"string"==typeof n.token?n.token:"";return{path:r,auth:a,token:l,sessionMode:"per-session"===t.sessionMode?"per-session":"stateless",streaming:!0===t.streaming}}function eL(e){var t,r;let{definition:l,nodeId:s,onChange:o}=e,i=(null!=(t=l.nodes)?t:[]).find(e=>e.id===s),d=eI(i),[c,u]=(0,a.useState)(d.path),[p,x]=(0,a.useState)(d.auth),[m,h]=(0,a.useState)(null!=(r=d.token)?r:""),[f,g]=(0,a.useState)(d.sessionMode),[b,y]=(0,a.useState)(d.streaming);(0,a.useEffect)(()=>{var e;let t=eI(i);u(t.path),x(t.auth),h(null!=(e=t.token)?e:""),g(t.sessionMode),y(t.streaming)},[s,i]);let v=(0,a.useCallback)(()=>({path:c,auth:p,token:m,sessionMode:f,streaming:b}),[c,p,m,f,b]),j=(0,a.useRef)(null);(0,a.useEffect)(()=>{if(i)return j.current&&clearTimeout(j.current),j.current=setTimeout(()=>{o(function(e,t,r){var n;let a={path:r.path};"bearer"===r.auth&&r.token&&(a.auth={type:"bearer",token:r.token}),"stateless"!==r.sessionMode&&(a.sessionMode=r.sessionMode),r.streaming&&(a.streaming=!0);let l=(null!=(n=e.nodes)?n:[]).map(e=>e.id===t?{...e,chatTrigger:a}:e);return{...e,nodes:l}}(l,s,v()))},500),()=>{j.current&&clearTimeout(j.current)}},[i,s,l,v,o]);let w=c.trim()?c.startsWith("/")?/\s/.test(c)?{ok:!1,message:"no whitespace in path"}:{ok:!0,message:"path ok"}:{ok:!1,message:"path must start with '/'"}:{ok:!1,message:"path required"},k=w.ok?"valid":"error";return(0,n.jsxs)(eh,{variantLabel:"Chat",validationStatus:k,validationMessage:w.message,children:[(0,n.jsx)(ef,{label:"path",hint:"POST /v1/workflows/<name>".concat(c),children:(0,n.jsx)("input",{value:c,onChange:e=>u(e.target.value),placeholder:"/chat",spellCheck:!1,className:"w-full rounded-md border border-border bg-surface px-2 py-1 font-mono text-xs"})}),(0,n.jsx)(ef,{label:"session mode",children:(0,n.jsxs)("select",{value:f,onChange:e=>g(e.target.value),className:"w-full rounded-md border border-border bg-surface px-2 py-1 text-xs",children:[(0,n.jsx)("option",{value:"stateless",children:"stateless"}),(0,n.jsx)("option",{value:"per-session",children:"per-session"})]})}),(0,n.jsx)(ef,{label:"auth",full:!0,children:(0,n.jsx)("div",{className:"flex gap-2 text-xs",children:["none","bearer"].map(e=>(0,n.jsxs)("label",{className:"flex items-center gap-1",children:[(0,n.jsx)("input",{type:"radio",name:"chat-auth",checked:p===e,onChange:()=>x(e)}),(0,n.jsx)("span",{className:"text-text-tertiary",children:e})]},e))})}),"bearer"===p&&(0,n.jsx)(ef,{label:"token",full:!0,children:(0,n.jsx)("input",{type:"password",value:m,onChange:e=>h(e.target.value),placeholder:"bearer token",spellCheck:!1,className:"w-full rounded-md border border-border bg-surface px-2 py-1 font-mono text-xs"})}),(0,n.jsx)(ef,{label:"streaming response",full:!0,children:(0,n.jsxs)("label",{className:"flex items-center gap-2 text-xs",children:[(0,n.jsx)("input",{type:"checkbox",checked:b,onChange:e=>y(e.target.checked)}),(0,n.jsx)("span",{className:"text-text-tertiary",children:"stream the last-node output as SSE (v2 daemon wire — flag persisted now)"})]})}),(0,n.jsx)(ef,{label:"v2 follow-ups",full:!0,children:(0,n.jsx)("p",{className:"rounded-md border border-border bg-surface px-2 py-1.5 text-[11px] leading-snug text-text-tertiary",children:"v1 = webhook mode minimal. Hosted chat page \xb7 AI memory \xb7 file upload \xb7 multi-response Chat nodes are deferred to v2 (BACKLOG follow-up \xb7 per n8n ChatTrigger 961 LOC reference)."})})]})}function eO(e){var t,r,l,s;let{definition:o,nodeId:i,skills:d,onChange:c,onClose:u,onDelete:p}=e,x=(0,a.useMemo)(()=>{var e,t;return null!=(t=(null!=(e=o.nodes)?e:[]).find(e=>e.id===i))?t:null},[o,i]),m=(0,a.useMemo)(()=>x?W(x):"unknown",[x]),[h,g]=(0,a.useState)(null!=(t=null==x?void 0:x.id)?t:""),[b,y]=(0,a.useState)("string"==typeof(null==x?void 0:x.bash)?x.bash:""),[v,j]=(0,a.useState)("string"==typeof(null==x?void 0:x.prompt)?x.prompt:""),[w,k]=(0,a.useState)("string"==typeof(null==x?void 0:x.skill)?x.skill:""),[N,C]=(0,a.useState)("string"==typeof(null==x?void 0:x.arguments)?x.arguments:""),[T,S]=(0,a.useState)("string"==typeof(null==x?void 0:x.cft)?x.cft:""),A=(null==x?void 0:x.approval)&&"object"==typeof x.approval?x.approval:null,[E,M]=(0,a.useState)(null!=(r=null==A?void 0:A.message)?r:""),[_,P]=(0,a.useState)(null!=(l=null==A?void 0:A.delivery)?l:"modal"),[R,I]=(0,a.useState)("string"==typeof(null==x?void 0:x.when)?x.when:""),[L,O]=(0,a.useState)(Array.isArray(null==x?void 0:x.depends_on)?[...x.depends_on]:[]);(0,a.useEffect)(()=>{var e,t;if(!x)return;g(x.id),y("string"==typeof x.bash?x.bash:""),j("string"==typeof x.prompt?x.prompt:""),k("string"==typeof x.skill?x.skill:""),C("string"==typeof x.arguments?x.arguments:""),S("string"==typeof x.cft?x.cft:"");let r=x.approval&&"object"==typeof x.approval?x.approval:null;M(null!=(e=null==r?void 0:r.message)?e:""),P(null!=(t=null==r?void 0:r.delivery)?t:"modal"),I("string"==typeof x.when?x.when:""),O(Array.isArray(x.depends_on)?[...x.depends_on]:[])},[i,x]);let D=(0,a.useCallback)(()=>{var e,t;if(!x)return{};let r={};if(h!==x.id&&/^[a-z0-9]+(-[a-z0-9]+)*$/.test(h)&&(r.id=h),"bash"===m&&b!==x.bash&&(r.bash=b),"prompt"===m&&v!==x.prompt&&(r.prompt=v),"skill"===m&&(w!==x.skill&&(r.skill=w),N!==(null!=(e=x.arguments)?e:"")&&(r.arguments=N)),"cft"===m&&T!==x.cft&&(r.cft=T),"approval"===m){let e=null!=A?A:{message:"",delivery:"modal"};(E!==e.message||_!==(null!=(t=e.delivery)?t:"modal"))&&(r.approval={message:E,delivery:_})}R!==("string"==typeof x.when?x.when:"")&&(r.when=R.trim()?R:null);let n=Array.isArray(x.depends_on)?x.depends_on:[];return(L.length!==n.length||L.some((e,t)=>n[t]!==e))&&(r.depends_on=L),r},[x,m,A,h,b,v,w,N,T,E,_,R,L]),z=(0,a.useRef)(null);if((0,a.useEffect)(()=>{if(x)return z.current&&clearTimeout(z.current),z.current=setTimeout(()=>{let e=D();if(0===Object.keys(e).length)return;let t=function(e,t,r){var n,a;if(!(null!=(n=e.nodes)?n:[]).find(e=>e.id===t))return e;let l=e,s=t;r.id&&r.id!==t&&(s=(l=function(e,t,r){var n,a;if(t===r||new Set((null!=(n=e.nodes)?n:[]).map(e=>e.id)).has(r))return e;let l=(null!=(a=e.nodes)?a:[]).map(e=>{let n=e;return e.id===t&&(n={...n,id:r}),Array.isArray(n.depends_on)&&(n={...n,depends_on:n.depends_on.map(e=>e===t?r:e)}),n});return{...e,nodes:l}}(e,t,r.id))===e?t:r.id);let o=(null!=(a=l.nodes)?a:[]).map(e=>{if(e.id!==s)return e;let t={...e},n=W(e),a=["bash","prompt","skill","cft","approval"].find(e=>void 0!==r[e]);return a&&a!==n&&"unknown"!==n&&(delete t[n],"skill"===n&&delete t.arguments,"cft"===n&&delete t.config),void 0!==r.bash&&(t.bash=r.bash),void 0!==r.prompt&&(t.prompt=r.prompt),void 0!==r.skill&&(t.skill=r.skill),void 0!==r.arguments&&(t.arguments=r.arguments),void 0!==r.cft&&(t.cft=r.cft),void 0!==r.config&&(t.config=r.config),void 0!==r.approval&&(t.approval=r.approval),null===r.when?delete t.when:"string"==typeof r.when&&(t.when=r.when),void 0!==r.depends_on&&(0===r.depends_on.length?delete t.depends_on:t.depends_on=[...r.depends_on]),t});return{...l,nodes:o}}(o,i,e);t!==o&&c(t)},500),()=>{z.current&&clearTimeout(z.current)}},[x,i,o,D,c]),!x)return(0,n.jsx)("div",{className:"border-t border-border bg-surface-elevated px-3 py-3 text-[11px] text-text-tertiary",children:"Node not found — it may have been deleted."});if("scheduleTrigger"===m||"webhookTrigger"===m||"http"===m||"discordTrigger"===m||"telegramTrigger"===m||"manualTrigger"===m||"chatTrigger"===m)return(0,n.jsxs)("div",{className:"border-t border-border bg-surface-elevated",children:[(0,n.jsxs)("header",{className:"flex items-center justify-between px-3 py-2",children:[(0,n.jsx)("span",{className:"font-mono text-xs text-text-primary",children:i}),(0,n.jsxs)("div",{className:"flex items-center gap-1",children:[(0,n.jsxs)("button",{type:"button",onClick:p,className:"flex items-center gap-1 rounded px-2 py-0.5 text-[11px] text-error hover:bg-error/10",title:"Delete this node",children:[(0,n.jsx)(f.A,{className:"h-3 w-3"}),"Delete"]}),(0,n.jsx)("button",{type:"button",onClick:u,className:"rounded p-1 text-text-tertiary hover:bg-surface","aria-label":"Close node editor",children:(0,n.jsx)(eo.A,{className:"h-3 w-3"})})]})]}),(0,n.jsxs)("div",{className:"px-3 pb-3",children:["scheduleTrigger"===m&&(0,n.jsx)(eb,{definition:o,nodeId:i,onChange:c}),"webhookTrigger"===m&&(0,n.jsx)(ej,{definition:o,nodeId:i,onChange:c}),"http"===m&&(0,n.jsx)(eN,{definition:o,nodeId:i,onChange:c}),"discordTrigger"===m&&(0,n.jsx)(eA,{definition:o,nodeId:i,onChange:c}),"telegramTrigger"===m&&(0,n.jsx)(e_,{definition:o,nodeId:i,onChange:c}),"manualTrigger"===m&&(0,n.jsx)(eR,{definition:o,nodeId:i,onChange:c}),"chatTrigger"===m&&(0,n.jsx)(eL,{definition:o,nodeId:i,onChange:c})]})]});let G=(null!=(s=o.nodes)?s:[]).filter(e=>e.id!==i);return(0,n.jsxs)("div",{className:"border-t border-border bg-surface-elevated",children:[(0,n.jsxs)("header",{className:"flex items-center justify-between px-3 py-2",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("span",{className:"rounded bg-surface px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-text-tertiary",children:m}),(0,n.jsx)("span",{className:"font-mono text-xs text-text-primary",children:i})]}),(0,n.jsxs)("div",{className:"flex items-center gap-1",children:[(0,n.jsxs)("button",{type:"button",onClick:p,className:"flex items-center gap-1 rounded px-2 py-0.5 text-[11px] text-error hover:bg-error/10",title:"Delete this node",children:[(0,n.jsx)(f.A,{className:"h-3 w-3"}),"Delete"]}),(0,n.jsx)("button",{type:"button",onClick:u,className:"rounded p-1 text-text-tertiary hover:bg-surface","aria-label":"Close node editor",children:(0,n.jsx)(eo.A,{className:"h-3 w-3"})})]})]}),(0,n.jsxs)("div",{className:"grid grid-cols-1 gap-2 px-3 pb-3 md:grid-cols-2",children:[(0,n.jsx)(eD,{label:"id",children:(0,n.jsx)("input",{value:h,onChange:e=>g(e.target.value),spellCheck:!1,className:"w-full rounded-md border border-border bg-surface px-2 py-1 font-mono text-xs"})}),(0,n.jsx)(eD,{label:"when (gating expression)",children:(0,n.jsx)("input",{value:R,onChange:e=>I(e.target.value),placeholder:"e.g. \"$prev.output == 'ok'\"",spellCheck:!1,className:"w-full rounded-md border border-border bg-surface px-2 py-1 font-mono text-xs"})}),"bash"===m&&(0,n.jsx)(eD,{label:"bash",full:!0,children:(0,n.jsx)("textarea",{value:b,onChange:e=>y(e.target.value),rows:4,spellCheck:!1,className:"w-full resize-none rounded-md border border-border bg-surface px-2 py-1 font-mono text-xs"})}),"prompt"===m&&(0,n.jsx)(eD,{label:"prompt",full:!0,children:(0,n.jsx)("textarea",{value:v,onChange:e=>j(e.target.value),rows:4,spellCheck:!1,className:"w-full resize-none rounded-md border border-border bg-surface px-2 py-1 text-xs"})}),"skill"===m&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(eD,{label:"skill",children:[(0,n.jsx)("input",{value:w,onChange:e=>k(e.target.value),list:"workflow-skill-options",spellCheck:!1,className:"w-full rounded-md border border-border bg-surface px-2 py-1 font-mono text-xs"}),d&&d.length>0&&(0,n.jsx)("datalist",{id:"workflow-skill-options",children:d.map(e=>(0,n.jsx)("option",{value:e},e))})]}),(0,n.jsx)(eD,{label:"arguments",full:!0,children:(0,n.jsx)("textarea",{value:N,onChange:e=>C(e.target.value),rows:3,spellCheck:!1,className:"w-full resize-none rounded-md border border-border bg-surface px-2 py-1 font-mono text-xs"})})]}),"cft"===m&&(0,n.jsx)(eD,{label:"cft",full:!0,children:(0,n.jsx)("input",{value:T,onChange:e=>S(e.target.value),spellCheck:!1,className:"w-full rounded-md border border-border bg-surface px-2 py-1 font-mono text-xs"})}),"approval"===m&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(eD,{label:"message",full:!0,children:(0,n.jsx)("textarea",{value:E,onChange:e=>M(e.target.value),rows:2,spellCheck:!1,className:"w-full resize-none rounded-md border border-border bg-surface px-2 py-1 text-xs"})}),(0,n.jsx)(eD,{label:"delivery channel",children:(0,n.jsxs)("select",{value:_,onChange:e=>P(e.target.value),className:"w-full rounded-md border border-border bg-surface px-2 py-1 text-xs",children:[(0,n.jsx)("option",{value:"all",children:"all (race)"}),(0,n.jsx)("option",{value:"modal",children:"modal (PWA)"}),(0,n.jsx)("option",{value:"terminal",children:"terminal"}),(0,n.jsx)("option",{value:"telegram",children:"telegram"}),(0,n.jsx)("option",{value:"discord",children:"discord"}),(0,n.jsx)("option",{value:"pushcut",children:"pushcut"})]})})]}),(0,n.jsx)(eD,{label:"depends_on",full:!0,children:(0,n.jsx)(ez,{value:L,options:G.map(e=>e.id),onChange:O})})]})]})}function eD(e){let{label:t,full:r,children:a}=e;return(0,n.jsxs)("label",{className:"flex flex-col gap-1 ".concat(r?"md:col-span-2":""),children:[(0,n.jsx)("span",{className:"text-[10px] uppercase tracking-wide text-text-tertiary",children:t}),a]})}function ez(e){let{value:t,options:r,onChange:a}=e;return 0===r.length?(0,n.jsx)("span",{className:"text-[11px] text-text-tertiary",children:"No other nodes to depend on."}):(0,n.jsx)("div",{className:"flex flex-wrap gap-1",children:r.map(e=>{let r=t.includes(e);return(0,n.jsx)("button",{type:"button",onClick:()=>{t.includes(e)?a(t.filter(t=>t!==e)):a([...t,e])},className:"rounded-md border px-2 py-0.5 font-mono text-[10px] transition-colors ".concat(r?"border-accent bg-accent/15 text-accent":"border-border text-text-tertiary hover:bg-surface"),children:e},e)})})}var eW=r(18142);let eG={running:"Running",orphaned:"Orphaned",done:"Done",failed:"Failed",unknown:"Unknown"},eF={running:"bg-info/10 text-info ring-info/30",orphaned:"bg-text-tertiary/10 text-text-tertiary ring-border",done:"bg-success/10 text-success ring-success/30",failed:"bg-error/10 text-error ring-error/30",unknown:"bg-surface-elevated text-text-tertiary ring-border"};function e$(e){let{onSelect:t,selectedRunId:r,enabled:l}=e,s=(0,k.b_)({enabled:null==l||l}),[o,i]=(0,a.useState)("all"),d=(0,a.useMemo)(()=>{var e,t;let r=null!=(t=null==(e=s.data)?void 0:e.runs)?t:[];return"all"===o?r:r.filter(e=>e.status===o)},[s.data,o]),c=(0,a.useMemo)(()=>{var e,t;let r={all:0,running:0,orphaned:0,done:0,failed:0};for(let n of null!=(t=null==(e=s.data)?void 0:e.runs)?t:[])r.all+=1,n.status in r&&(r[n.status]+=1);return r},[s.data]);return s.isLoading?(0,n.jsxs)("div",{className:"flex h-full items-center justify-center text-[11px] text-text-tertiary",children:[(0,n.jsx)(g.A,{className:"mr-1.5 h-3 w-3 animate-spin"}),"loading runs…"]}):s.error?(0,n.jsxs)("div",{className:"flex h-full items-center justify-center text-[11px] text-error",children:[(0,n.jsx)(h.A,{className:"mr-1.5 h-3 w-3"}),"failed to load runs: ",s.error.message]}):(0,n.jsxs)("div",{className:"flex h-full flex-col",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 border-b border-border px-3 py-2",children:[(0,n.jsx)(x.A,{className:"h-3.5 w-3.5 text-text-tertiary"}),(0,n.jsx)("span",{className:"text-xs font-medium",children:"Recent runs"}),(0,n.jsxs)("span",{className:"text-[10px] text-text-tertiary",children:["(",c.all,")"]}),(0,n.jsx)("div",{className:"ml-auto flex items-center gap-1",children:["all","running","done","failed","orphaned"].map(e=>(0,n.jsx)(eU,{label:"all"===e?"all":eG[e],count:c[e],active:o===e,onClick:()=>i(e)},e))})]}),0===d.length?(0,n.jsx)("div",{className:"flex flex-1 items-center justify-center text-[11px] text-text-tertiary",children:"all"===o?"No runs yet — pick a workflow + click Run to start one.":"No ".concat(eG[o].toLowerCase()," runs.")}):(0,n.jsx)("ul",{className:"flex-1 overflow-y-auto",children:d.map(e=>(0,n.jsx)(eH,{run:e,selected:e.runId===r,onSelect:()=>t(e.runId,e.workflowName)},e.runId))})]})}function eU(e){let{label:t,count:r,active:a,onClick:l}=e;return(0,n.jsxs)("button",{type:"button",onClick:l,className:"rounded-md px-1.5 py-0.5 text-[10px] transition-colors ".concat(a?"bg-primary/15 text-primary ring-1 ring-primary/30":"text-text-tertiary hover:bg-surface-elevated"),children:[t,r>0&&(0,n.jsx)("span",{className:"ml-1 opacity-70",children:r})]})}function eH(e){let{run:t,selected:r,onSelect:a}=e;return(0,n.jsx)("li",{children:(0,n.jsxs)("button",{type:"button",onClick:a,className:"flex w-full items-center gap-2 border-b border-border px-3 py-2 text-left text-[11px] transition-colors hover:bg-surface-elevated ".concat(r?"bg-primary/10":""),children:[(0,n.jsx)(eB,{status:t.status}),(0,n.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col",children:[(0,n.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,n.jsx)(l.A,{className:"h-3 w-3 shrink-0 text-text-tertiary"}),(0,n.jsx)("span",{className:"truncate font-medium",children:t.workflowName})]}),(0,n.jsxs)("div",{className:"flex items-center gap-2 text-[9px] text-text-tertiary",children:[(0,n.jsx)("span",{className:"font-mono",children:t.runId.slice(0,22)}),(0,n.jsx)("span",{children:"\xb7"}),(0,n.jsx)("span",{children:function(e){let t=Date.now()-e;return t<6e4?"".concat(Math.max(1,Math.floor(t/1e3)),"s ago"):t<36e5?"".concat(Math.floor(t/6e4),"m ago"):t<864e5?"".concat(Math.floor(t/36e5),"h ago"):"".concat(Math.floor(t/864e5),"d ago")}(t.startedAt)}),t.arguments&&t.arguments.length>0&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("span",{children:"\xb7"}),(0,n.jsx)("span",{className:"truncate italic",children:t.arguments.slice(0,30)})]})]})]}),(0,n.jsx)("span",{className:"shrink-0 rounded px-1.5 py-0.5 text-[9px] font-medium uppercase ring-1 ".concat(eF[t.status]),children:eG[t.status]})]})})}function eB(e){let{status:t}=e;return"running"===t?(0,n.jsx)(g.A,{className:"h-3.5 w-3.5 shrink-0 animate-spin text-info"}):"done"===t?(0,n.jsx)(w.A,{className:"h-3.5 w-3.5 shrink-0 text-success"}):"failed"===t?(0,n.jsx)(h.A,{className:"h-3.5 w-3.5 shrink-0 text-error"}):"orphaned"===t?(0,n.jsx)(eW.A,{className:"h-3.5 w-3.5 shrink-0 text-text-tertiary"}):(0,n.jsx)("span",{className:"h-3.5 w-3.5 shrink-0 rounded-full bg-text-tertiary/30"})}function eK(e){var t,r;let{runId:l,message:s,onDismiss:o,onResolved:i}=e,[d,c]=(0,a.useState)(""),u=(0,k.Yk)(),p=(0,k.Ux)(),x=u.isPending||p.isPending;(0,a.useEffect)(()=>{let e=e=>{"Escape"!==e.key||x||o()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[x,o]);let m=async()=>{try{await u.mutateAsync({runId:l,response:d.trim()?d:void 0}),null==i||i("approved")}catch(e){}},f=async()=>{try{await p.mutateAsync({runId:l,reason:d.trim()?d:void 0}),null==i||i("rejected")}catch(e){}};return(0,n.jsx)("div",{role:"dialog","aria-modal":"true","aria-labelledby":"approval-modal-title",className:"fixed inset-0 z-50 flex items-end justify-center bg-black/40 backdrop-blur-sm sm:items-center",children:(0,n.jsxs)("div",{className:"w-full max-w-md rounded-t-2xl border border-border bg-surface shadow-xl sm:rounded-lg",children:[(0,n.jsxs)("header",{className:"flex items-center justify-between border-b border-border px-4 py-3",children:[(0,n.jsxs)("h2",{id:"approval-modal-title",className:"flex items-center gap-2 text-sm font-semibold",children:[(0,n.jsx)(h.A,{className:"h-4 w-4 text-warning"}),"Approval needed"]}),(0,n.jsx)("button",{type:"button",onClick:o,disabled:x,"aria-label":"Close approval modal",className:"rounded-md p-1 text-text-tertiary hover:bg-surface-elevated disabled:opacity-50",children:(0,n.jsx)(eo.A,{className:"h-3.5 w-3.5"})})]}),(0,n.jsxs)("div",{className:"space-y-2 px-4 py-3",children:[(0,n.jsxs)("div",{className:"text-[10px] uppercase tracking-wide text-text-tertiary",children:["run \xb7 ",(0,n.jsx)("span",{className:"font-mono",children:l.slice(0,28)})]}),(0,n.jsx)("p",{className:"whitespace-pre-wrap text-[13px] leading-snug",children:s}),(0,n.jsxs)("label",{className:"block pt-2 text-[10px] uppercase tracking-wide text-text-tertiary",children:["Response (optional \xb7 captured into ",(0,n.jsx)("code",{className:"font-mono",children:"$node.output"})," when capture_response: true)"]}),(0,n.jsx)("textarea",{value:d,onChange:e=>c(e.target.value),placeholder:"LGTM / type a reason for rejection / leave empty for bare approval",rows:3,disabled:x,className:"w-full resize-none rounded-md border border-border bg-surface-elevated px-2 py-1.5 font-mono text-[11px] focus:outline-none focus:ring-1 focus:ring-primary disabled:opacity-50"}),(u.error||p.error)&&(0,n.jsx)("p",{className:"text-[11px] text-error",children:(null!=(t=u.error)?t:p.error)instanceof Error?(null!=(r=u.error)?r:p.error).message:"request failed"})]}),(0,n.jsxs)("footer",{className:"flex items-center justify-end gap-2 border-t border-border px-4 py-3",children:[(0,n.jsxs)("button",{type:"button",onClick:f,disabled:x,className:"flex items-center gap-1 rounded-md border border-error/40 px-3 py-1.5 text-[11px] text-error hover:bg-error/10 disabled:opacity-50",children:[p.isPending?(0,n.jsx)(g.A,{className:"h-3 w-3 animate-spin"}):(0,n.jsx)(h.A,{className:"h-3 w-3"}),"Reject"]}),(0,n.jsxs)("button",{type:"button",onClick:m,disabled:x,className:"flex items-center gap-1 rounded-md bg-primary px-3 py-1.5 text-[11px] font-medium text-primary-foreground hover:bg-accent-hover disabled:opacity-50",children:[u.isPending?(0,n.jsx)(g.A,{className:"h-3 w-3 animate-spin"}):(0,n.jsx)(w.A,{className:"h-3 w-3"}),"Approve"]})]})]})})}let eX="elanous.workflows.layout",eY={leftCollapsed:!1,rightCollapsed:!1,canvasOnly:!1,leftWidthPx:240,rightWidthPx:320};function eq(e,t){return Number.isFinite(e)?e<160?160:e>640?640:Math.round(e):t}let eJ={project:"Project",global:"Global",builtin:"Built-in"};function eV(){return(0,N.Qj)()?(0,n.jsx)(eZ,{}):(0,n.jsx)(eQ,{})}function eQ(){return(0,n.jsxs)("div",{className:"flex h-full flex-col items-center justify-center gap-3 px-6 py-10 text-center",children:[(0,n.jsx)(l.A,{className:"h-8 w-8 text-text-tertiary"}),(0,n.jsx)("h2",{className:"text-base font-semibold",children:"Workflows"}),(0,n.jsx)("p",{className:"max-w-md text-sm text-text-tertiary",children:"Daemon 연결이 설정되지 않았습니다. Settings 에서 Base URL 을 입력하면 워크플로우 목록이 표시됩니다."}),(0,n.jsx)("a",{href:"/app/settings/",className:"rounded-md border border-border px-3 py-1 text-sm text-text-primary hover:bg-surface-elevated",children:"Settings"})]})}function eZ(){var e,t,r,v,j,w,N,C,T,S,A,E;let M=(0,k.mP)(),[_,P]=(0,a.useState)(null),[R,I]=(0,a.useState)(""),[L,O]=(0,a.useState)(""),[D,z]=(0,a.useState)(null),[W,G]=(0,a.useState)(!1),[F,$]=(0,a.useState)(""),[U,B]=(0,a.useState)("yaml"),[Y,q]=(0,a.useState)(!1),[J,V]=(0,a.useState)(!1),[Z,ee]=(0,a.useState)(null),[et,er]=(0,a.useState)(null),en=(0,k.j3)(null!=_?_:"",{enabled:!!_&&!W}),ea=(0,k.yM)(),el=(0,k.oE)(),es=(0,k.xd)(),eo=(0,k.XL)(),ei=(0,k.b_)(),ed=(0,a.useMemo)(()=>{var e,t,r;return _&&(null==(e=ei.data)?void 0:e.runs)&&null!=(r=null==(t=function(e,t){let r=null;for(let n of e)n.workflowName===t&&(!r||n.startedAt>r.startedAt)&&(r=n);return r}(ei.data.runs,_))?void 0:t.runId)?r:null},[_,null==(e=ei.data)?void 0:e.runs]),ec=null!=D?D:ed,eu=(0,k.uz)(ec),ep=(0,a.useMemo)(()=>{var e;if(null==(e=eu.data)?void 0:e.events)return function(e){let t={};for(let n of e)if(n.nodeId)switch(n.type){case"node_start":t[n.nodeId]||(t[n.nodeId]={status:"running"});break;case"node_done":{let e=n.result;if(null==e?void 0:e.ok)t[n.nodeId]={status:"done",durationMs:e.durationMs};else{let r={status:"failed"};(null==e?void 0:e.durationMs)!==void 0&&(r.durationMs=e.durationMs),(null==e?void 0:e.error)&&(r.error=e.error),t[n.nodeId]=r}break}case"node_skipped":{let e={status:"skipped"};n.reason&&(e.reason=n.reason),t[n.nodeId]=e;break}case"approval_pending":t[n.nodeId]={status:"awaiting_approval"};break;case"approval_resolved":var r;(null==(r=t[n.nodeId])?void 0:r.status)==="awaiting_approval"&&delete t[n.nodeId]}return t}(eu.data.events)},[null==(t=eu.data)?void 0:t.events]),em=(0,k.zD)();(0,k.Ck)();let eh=(0,a.useMemo)(()=>{var e,t,r;return null!=(r=(null!=(t=null==(e=em.data)?void 0:e.pending)?t:[]).find(e=>e.runId===D))?r:null},[em.data,D]),ef=null!=(T=null==(r=em.data)?void 0:r.pending.length)?T:0,[eg,eb]=(0,a.useState)(new Set);(0,a.useEffect)(()=>{eb(new Set)},[D]),(0,a.useEffect)(()=>{var e;W||(null==(e=en.data)?void 0:e.yaml)!==void 0&&I(en.data.yaml)},[null==(v=en.data)?void 0:v.yaml,W]);let ey=(0,a.useRef)(null);(0,a.useEffect)(()=>{if(!R.trim())return;let e=setTimeout(()=>{var e;null==(e=ey.current)||e.abort();let t=new AbortController;ey.current=t,es.mutateAsync({yaml:R,signal:t.signal}).catch(()=>void 0)},600);return()=>{var t;clearTimeout(e),null==(t=ey.current)||t.abort()}},[R]);let ev=(0,a.useMemo)(()=>{var e,t;let r={project:[],global:[],builtin:[]};for(let n of null!=(t=null==(e=M.data)?void 0:e.workflows)?t:[])r[n.source].push(n);return r},[null==(j=M.data)?void 0:j.workflows]),ej=null==(w=es.data)?void 0:w.validation,ew=ej&&!ej.ok?ej.issues:[],ek=(0,a.useMemo)(()=>R.trim()?X(R):null,[R]),eN=(0,a.useMemo)(()=>{if(ek&&0!==ew.length)return function(e,t){let r={},n=[];for(let a of e){let e=function(e,t){if("string"!=typeof e)return null;let r=/^nodes\[(\d+)\]/.exec(e);if(!r)return null;let n=Number.parseInt(r[1],10);if(!Number.isFinite(n)||n<0)return null;let a=Array.isArray(t.nodes)?t.nodes:[];if(n>=a.length)return null;let l=a[n];return l&&"string"==typeof l.id&&0!==l.id.length?l.id:null}(a.path,t);e?(r[e]||(r[e]=[]),r[e].push(a)):n.push(a)}return{byNodeId:r,rootIssues:n}}(ew,ek).byNodeId},[ek,ew]),eC=(0,a.useMemo)(()=>{if(!ek)return;let e=function(e){var t,r;let n=Array.isArray(e.nodes)?e.nodes:[],a=new Set,l=new Map;for(let e of n)e&&"string"==typeof e.id&&0!==e.id.length&&a.add(e.id);for(let e of n)if(e&&"string"==typeof e.id&&0!==e.id.length)for(let r of Array.isArray(e.depends_on)?e.depends_on:[]){if("string"!=typeof r||0===r.length||!a.has(r))continue;let n=null!=(t=l.get(r))?t:[];n.push(e.id),l.set(r,n)}let s=new Set,o=new Map,i=[];for(let e of a)(null!=(r=o.get(e))?r:0)===0&&function e(t){var r,n;for(let a of(o.set(t,1),i.push(t),null!=(r=l.get(t))?r:[])){let t=null!=(n=o.get(a))?n:0;if(1===t){let e=i.lastIndexOf(a);if(e>=0)for(let t=e;t<i.length;t++)s.add(i[t])}else 0===t&&e(a)}o.set(t,2),i.pop()}(e);return s}(ek);return e.size>0?e:void 0},[ek]),eT=e=>{P(e),G(!1),z(null),ee(null)},eS=async()=>{let e=W?F.trim():_;if(e&&(!W||/^[a-z0-9]+(-[a-z0-9]+)*$/.test(e)))try{await ea.mutateAsync({name:e,body:{yaml:R,scope:"project"}}),G(!1),P(e)}catch(e){}},eA=async()=>{if(_)try{let e=await eo.mutateAsync({name:_,args:L});z(e.runId)}catch(e){}},eE=async()=>{var e,t;if(!_||(null==(e=en.data)?void 0:e.source)==="builtin")return;let r=(null==(t=en.data)?void 0:t.source)==="global"?"global":"project";try{await el.mutateAsync({name:_,scope:r}),P(null),I("")}catch(e){}},eM=(null==(N=en.data)?void 0:N.source)==="builtin",e_=es.isPending?"pending":ej?ej.ok?"ok":"error":"idle",eP=function(){let[e,t]=(0,a.useState)(()=>eY),r=(0,a.useRef)(!1);(0,a.useEffect)(()=>{t(function(){try{var e,t,r;let n=window.localStorage.getItem(eX);if(!n)return{...eY};return(e=JSON.parse(n))&&"object"==typeof e?{leftCollapsed:"boolean"==typeof e.leftCollapsed?e.leftCollapsed:eY.leftCollapsed,rightCollapsed:"boolean"==typeof e.rightCollapsed?e.rightCollapsed:eY.rightCollapsed,canvasOnly:"boolean"==typeof e.canvasOnly?e.canvasOnly:eY.canvasOnly,leftWidthPx:eq(null!=(t=e.leftWidthPx)?t:eY.leftWidthPx,eY.leftWidthPx),rightWidthPx:eq(null!=(r=e.rightWidthPx)?r:eY.rightWidthPx,eY.rightWidthPx)}:{...eY}}catch(e){return{...eY}}}()),r.current=!0},[]),(0,a.useEffect)(()=>{if(r.current)try{window.localStorage.setItem(eX,JSON.stringify(e))}catch(e){}},[e]);let n=(0,a.useCallback)(()=>{t(e=>({...e,leftCollapsed:!e.leftCollapsed}))},[]),l=(0,a.useCallback)(()=>{t(e=>({...e,rightCollapsed:!e.rightCollapsed}))},[]),s=(0,a.useCallback)(()=>{t(e=>({...e,canvasOnly:!e.canvasOnly}))},[]),o=(0,a.useCallback)(e=>{t(t=>({...t,leftWidthPx:eq(e,t.leftWidthPx)}))},[]),i=(0,a.useCallback)(e=>{t(t=>({...t,rightWidthPx:eq(e,t.rightWidthPx)}))},[]),d=(0,a.useCallback)(()=>{t({...eY})},[]);return(0,a.useMemo)(()=>({...e,toggleLeft:n,toggleRight:l,toggleCanvasOnly:s,setLeftWidth:o,setRightWidth:i,reset:d}),[e,n,l,s,o,i,d])}(),eR=!eP.canvasOnly,eI=!eP.canvasOnly,eL=eP.leftCollapsed?40:eP.leftWidthPx,eD=eP.rightCollapsed?40:eP.rightWidthPx;(0,a.useEffect)(()=>{let e=e=>{var t;if("\\"!==e.key||!(e.metaKey||e.ctrlKey))return;let r=e.target,n=null==r||null==(t=r.tagName)?void 0:t.toLowerCase();"input"===n||"textarea"===n||null!=r&&r.isContentEditable||(e.preventDefault(),eP.toggleCanvasOnly())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[eP]);let ez=(0,a.useCallback)((e,t)=>{let r="left"===e?eP.leftWidthPx:eP.rightWidthPx,n="left"===e?eP.setLeftWidth:eP.setRightWidth,a="left"===e?1:-1;try{t.target.setPointerCapture(t.pointerId)}catch(e){}let l=e=>{n(r+a*(e.clientX-t.clientX))},s=()=>{window.removeEventListener("pointermove",l),window.removeEventListener("pointerup",s);try{t.target.releasePointerCapture(t.pointerId)}catch(e){}};window.addEventListener("pointermove",l),window.addEventListener("pointerup",s)},[eP]);return(0,n.jsxs)("div",{className:"flex h-full flex-col",children:[(0,n.jsxs)("header",{className:"flex items-center justify-between border-b border-border px-4 py-3",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(l.A,{className:"h-4 w-4 text-text-tertiary"}),(0,n.jsx)("h1",{className:"text-sm font-semibold",children:"Workflows"}),(0,n.jsxs)("span",{className:"text-xs text-text-tertiary",children:[null!=(S=null==(C=M.data)?void 0:C.workflows.length)?S:0," declared"]})]}),(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("button",{type:"button",onClick:eP.toggleLeft,title:eP.leftCollapsed?"Show workflow list":"Collapse workflow list",className:"flex items-center gap-1 rounded-md border border-border px-2 py-1 text-[11px] text-text-tertiary hover:bg-surface-elevated",children:eP.leftCollapsed?(0,n.jsx)(s.A,{className:"h-3 w-3"}):(0,n.jsx)(o.A,{className:"h-3 w-3"})}),(0,n.jsx)("button",{type:"button",onClick:eP.toggleCanvasOnly,title:eP.canvasOnly?"Exit canvas-only (Cmd+\\)":"Canvas-only mode (Cmd+\\)",className:"flex items-center gap-1 rounded-md border px-2 py-1 text-[11px] transition-colors ".concat(eP.canvasOnly?"border-accent/50 bg-accent/15 text-accent":"border-border text-text-tertiary hover:bg-surface-elevated"),children:eP.canvasOnly?(0,n.jsx)(i.A,{className:"h-3 w-3"}):(0,n.jsx)(d.A,{className:"h-3 w-3"})}),(0,n.jsx)("button",{type:"button",onClick:eP.toggleRight,title:eP.rightCollapsed?"Show run panel":"Collapse run panel",className:"flex items-center gap-1 rounded-md border border-border px-2 py-1 text-[11px] text-text-tertiary hover:bg-surface-elevated",children:eP.rightCollapsed?(0,n.jsx)(c.A,{className:"h-3 w-3"}):(0,n.jsx)(u.A,{className:"h-3 w-3"})}),ef>0&&(0,n.jsxs)("button",{type:"button",onClick:()=>{var e;if(eh&&eg.has(eh.runId))return void(eh&&eb(e=>{let t=new Set(e);return t.delete(eh.runId),t}));let t=null==(e=em.data)?void 0:e.pending[0];t&&t.runId!==D&&z(t.runId)},title:eh&&eg.has(eh.runId)?"Re-open approval modal for this run":"".concat(ef," run(s) waiting on approval — click to view"),className:"relative flex items-center gap-1 rounded-md border border-warning/40 bg-warning/10 px-2 py-1 text-[11px] text-warning hover:bg-warning/20",children:[(0,n.jsx)(p.A,{className:"h-3 w-3"}),(0,n.jsx)("span",{children:ef}),(0,n.jsx)("span",{className:"absolute -right-1 -top-1 h-2 w-2 animate-pulse rounded-full bg-warning ring-2 ring-surface"})]}),(0,n.jsxs)("button",{type:"button",onClick:()=>q(e=>!e),className:"flex items-center gap-1 rounded-md border px-2 py-1 text-[11px] transition-colors ".concat(Y?"border-primary/40 bg-primary/15 text-primary":"border-border text-text-tertiary hover:bg-surface-elevated"),children:[(0,n.jsx)(x.A,{className:"h-3 w-3"}),Y?"Editor":"All runs"]}),(0,n.jsxs)("button",{type:"button",onClick:()=>V(e=>!e),title:J?"Hide AI prompt":"Describe a workflow in plain text",className:"flex items-center gap-1 rounded-md border px-2 py-1 text-[11px] transition-colors ".concat(J?"border-accent/50 bg-accent/15 text-accent":"border-border text-text-tertiary hover:bg-surface-elevated"),children:[(0,n.jsx)(m.A,{className:"h-3 w-3"}),"AI"]}),(0,n.jsx)("button",{type:"button",onClick:()=>{G(!0),P(null),$(""),I("name: my-workflow\ndescription: |\n Use when: …\n Triggers: …\n Does: …\n NOT for: …\n\nprovider: claude\nmodel: sonnet\n\nnodes:\n - id: first\n bash: echo hello\n"),z(null),ee(null)},className:"rounded-md bg-primary px-3 py-1 text-xs font-medium text-primary-foreground hover:bg-accent-hover transition-colors",children:"+ New"})]})]}),(0,n.jsxs)("div",{className:"flex flex-1 overflow-hidden",children:[eR&&(0,n.jsx)("aside",{style:{width:eL},className:"shrink-0 overflow-y-auto border-r border-border",children:eP.leftCollapsed?(0,n.jsx)("button",{type:"button",onClick:eP.toggleLeft,title:"Expand workflow list",className:"flex h-full w-full items-center justify-center text-text-tertiary hover:bg-surface-elevated",children:(0,n.jsx)(s.A,{className:"h-4 w-4"})}):["project","global","builtin"].map(e=>(0,n.jsx)(e0,{label:eJ[e],entries:ev[e],selected:_,onSelect:eT},e))}),eR&&!eP.leftCollapsed&&(0,n.jsx)("div",{role:"separator","aria-orientation":"vertical","aria-label":"Resize workflow list",onPointerDown:e=>ez("left",{clientX:e.clientX,pointerId:e.pointerId,target:e.currentTarget}),className:"w-1 shrink-0 cursor-col-resize bg-transparent hover:bg-accent/30"}),(0,n.jsx)("section",{className:"flex flex-1 flex-col overflow-hidden min-w-0",children:Y?(0,n.jsx)(e$,{selectedRunId:D,onSelect:(e,t)=>{z(e),P(t),G(!1),q(!1)}}):(0,n.jsxs)(n.Fragment,{children:[J&&(0,n.jsx)(ex,{currentYaml:R,onClose:()=>V(!1),onGenerated:e=>{var t;e.yaml&&(I(e.yaml),(null==(t=e.definition)?void 0:t.name)&&(G(!0),P(null),$(e.definition.name),z(null)))}}),W&&(0,n.jsxs)("div",{className:"border-b border-border px-3 py-2",children:[(0,n.jsx)("label",{className:"block text-[10px] uppercase tracking-wide text-text-tertiary",children:"Workflow name (kebab-case)"}),(0,n.jsx)("input",{type:"text",value:F,onChange:e=>$(e.target.value),placeholder:"my-workflow",className:"w-full rounded-md border border-border bg-surface px-2 py-1 text-sm font-mono",autoFocus:!0})]}),!W&&_&&(0,n.jsxs)("div",{className:"flex items-center justify-between border-b border-border px-3 py-2",children:[(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[(0,n.jsx)("span",{className:"text-sm font-medium",children:_}),eM&&(0,n.jsx)("span",{className:"rounded bg-surface-elevated px-1.5 py-0.5 text-[10px] text-text-tertiary",children:"read-only (built-in)"}),(0,n.jsx)(e1,{mode:U,onChange:B})]}),(0,n.jsx)("div",{className:"flex items-center gap-2",children:(0,n.jsx)(e3,{status:e_})})]}),"graph"===U&&R.trim()?(0,n.jsxs)("div",{className:"flex flex-1 flex-col overflow-hidden bg-surface",children:[(0,n.jsx)("div",{className:Z?"flex-1 min-h-[180px] overflow-hidden":"flex-1 overflow-hidden",children:(0,n.jsx)(Q,{yaml:R,editable:!eM,onChangeYaml:I,onNodeClick:eM?void 0:e=>ee(e),nodeStatuses:ep,nodeIssues:eN,cycleNodeIds:eC,focusNodeId:null!=(A=null==et?void 0:et.id)?A:null,focusNonce:null!=(E=null==et?void 0:et.nonce)?E:0,onRun:_&&!W?eA:void 0})}),Z&&!eM&&(()=>{let e=X(R);return e?(0,n.jsx)(eO,{definition:e,nodeId:Z,onChange:e=>I(K(e)),onClose:()=>ee(null),onDelete:()=>{I(K(H(e,Z))),ee(null)}}):null})()]}):(0,n.jsx)("textarea",{value:R,onChange:e=>I(e.target.value),readOnly:eM,placeholder:"Select a workflow on the left or click + New to start",spellCheck:!1,className:"flex-1 resize-none border-0 bg-surface px-3 py-2 font-mono text-xs leading-snug focus:outline-none"}),ew.length>0&&(0,n.jsx)("ul",{className:"max-h-32 overflow-y-auto border-t border-border bg-surface-elevated px-3 py-2 text-[11px]",children:ew.slice(0,8).map((e,t)=>{var r,a;let l=ek&&null!=(a=eN&&(null==(r=Object.entries(eN).find(t=>{let[,r]=t;return r.includes(e)}))?void 0:r[0]))?a:null,s=!!l;return(0,n.jsxs)("li",{className:"flex items-start gap-1.5 text-error ".concat(s?"cursor-pointer hover:bg-surface":""),...s?{onClick:()=>{B("graph"),er(e=>{var t;return{id:l,nonce:(null!=(t=null==e?void 0:e.nonce)?t:0)+1}})},role:"button",tabIndex:0}:{},title:s?'Jump to node "'.concat(l,'"'):void 0,children:[(0,n.jsx)(h.A,{className:"mt-0.5 h-3 w-3 shrink-0"}),(0,n.jsxs)("span",{children:[(0,n.jsx)("span",{className:"font-mono text-text-tertiary",children:e.path||"(root)"})," ",e.message]})]},t)})}),(0,n.jsxs)("footer",{className:"flex items-center justify-end gap-2 border-t border-border px-3 py-2",children:[_&&!eM&&!W&&(0,n.jsxs)("button",{type:"button",onClick:eE,className:"flex items-center gap-1 rounded-md border border-error/40 px-2 py-1 text-[11px] text-error hover:bg-error/10",children:[(0,n.jsx)(f.A,{className:"h-3 w-3"}),"Delete"]}),(0,n.jsxs)("button",{type:"button",onClick:eS,disabled:!_&&!W||eM||ea.isPending,className:"flex items-center gap-1 rounded-md bg-primary px-3 py-1 text-[11px] font-medium text-primary-foreground hover:bg-accent-hover disabled:opacity-50",children:[ea.isPending?(0,n.jsx)(g.A,{className:"h-3 w-3 animate-spin"}):(0,n.jsx)(b.A,{className:"h-3 w-3"}),"Save"]})]})]})}),eI&&!eP.rightCollapsed&&(0,n.jsx)("div",{role:"separator","aria-orientation":"vertical","aria-label":"Resize run panel",onPointerDown:e=>ez("right",{clientX:e.clientX,pointerId:e.pointerId,target:e.currentTarget}),className:"w-1 shrink-0 cursor-col-resize bg-transparent hover:bg-accent/30"}),eI&&(0,n.jsx)("aside",{style:{width:eD},className:"flex shrink-0 flex-col overflow-hidden border-l border-border",children:eP.rightCollapsed?(0,n.jsx)("button",{type:"button",onClick:eP.toggleRight,title:"Expand run panel",className:"flex h-full w-full items-center justify-center text-text-tertiary hover:bg-surface-elevated",children:(0,n.jsx)(c.A,{className:"h-4 w-4"})}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"border-b border-border px-3 py-2",children:[(0,n.jsx)("label",{className:"block text-[10px] uppercase tracking-wide text-text-tertiary",children:"Arguments"}),(0,n.jsx)("input",{type:"text",value:L,onChange:e=>O(e.target.value),placeholder:"passed as $ARGUMENTS",className:"w-full rounded-md border border-border bg-surface px-2 py-1 text-xs"}),(0,n.jsxs)("button",{type:"button",onClick:eA,disabled:!_||W||eo.isPending,className:"mt-2 flex w-full items-center justify-center gap-1 rounded-md bg-accent px-2 py-1.5 text-[11px] font-medium text-primary-foreground hover:bg-accent-hover disabled:opacity-50",children:[eo.isPending?(0,n.jsx)(g.A,{className:"h-3 w-3 animate-spin"}):(0,n.jsx)(y.A,{className:"h-3 w-3"}),"Run"]})]}),(0,n.jsxs)("div",{className:"flex-1 overflow-y-auto px-3 py-2 text-[11px]",children:[!D&&(0,n.jsx)("p",{className:"text-text-tertiary",children:"No active run. Press Run to start."}),D&&eu.data&&(0,n.jsx)(e2,{runId:D,events:eu.data.events,ok:eu.data.ok,outputs:eu.data.outputs})]})]})})]}),eh&&!eg.has(eh.runId)&&(0,n.jsx)(eK,{runId:eh.runId,message:eh.message,onDismiss:()=>eb(e=>{let t=new Set(e);return t.add(eh.runId),t})})]})}function e0(e){let{label:t,entries:r,selected:a,onSelect:l}=e;return 0===r.length?null:(0,n.jsxs)("div",{className:"border-b border-border",children:[(0,n.jsx)("h2",{className:"px-3 py-1.5 text-[10px] font-medium uppercase tracking-wide text-text-tertiary",children:t}),(0,n.jsx)("ul",{children:r.map(e=>(0,n.jsx)("li",{children:(0,n.jsxs)("button",{type:"button",onClick:()=>l(e.name),className:["block w-full px-3 py-1.5 text-left text-xs transition-colors",a===e.name?"bg-accent/15 text-text-primary":"text-text-secondary hover:bg-surface-elevated"].join(" "),title:e.path,children:[(0,n.jsx)("div",{className:"font-medium",children:e.name}),(0,n.jsxs)("div",{className:"truncate text-[10px] text-text-tertiary",children:[e.nodeCount," node",1===e.nodeCount?"":"s"]})]})},e.path))})]})}function e1(e){let{mode:t,onChange:r}=e;return(0,n.jsxs)("div",{className:"flex items-center rounded-md border border-border text-[10px]",children:[(0,n.jsxs)("button",{type:"button",onClick:()=>r("yaml"),className:"flex items-center gap-1 px-2 py-0.5 ".concat("yaml"===t?"bg-surface-elevated text-text-primary":"text-text-tertiary"),children:[(0,n.jsx)(v.A,{className:"h-3 w-3"}),"YAML"]}),(0,n.jsxs)("button",{type:"button",onClick:()=>r("graph"),className:"flex items-center gap-1 px-2 py-0.5 ".concat("graph"===t?"bg-surface-elevated text-text-primary":"text-text-tertiary"),children:[(0,n.jsx)(j.A,{className:"h-3 w-3"}),"Graph"]})]})}function e3(e){let{status:t}=e;return"pending"===t?(0,n.jsxs)("span",{className:"flex items-center gap-1 text-[10px] text-text-tertiary",children:[(0,n.jsx)(g.A,{className:"h-3 w-3 animate-spin"}),"validating"]}):"ok"===t?(0,n.jsxs)("span",{className:"flex items-center gap-1 text-[10px] text-success",children:[(0,n.jsx)(w.A,{className:"h-3 w-3"}),"valid"]}):"error"===t?(0,n.jsxs)("span",{className:"flex items-center gap-1 text-[10px] text-error",children:[(0,n.jsx)(h.A,{className:"h-3 w-3"}),"invalid"]}):null}function e2(e){let{runId:t,events:r,ok:a,outputs:l}=e;return(0,n.jsxs)("div",{className:"space-y-2 font-mono",children:[(0,n.jsxs)("div",{className:"text-[10px] text-text-tertiary",children:["runId: ",t]}),(0,n.jsx)("ul",{className:"space-y-1",children:r.map((e,t)=>{var r,a;return(0,n.jsxs)("li",{className:"flex items-start gap-1.5",children:[(0,n.jsx)("span",{className:"mt-0.5 h-1.5 w-1.5 rounded-full bg-text-tertiary"}),(0,n.jsxs)("span",{className:"break-all",children:[(0,n.jsx)("span",{className:"text-text-tertiary",children:e.type}),e.nodeId&&(0,n.jsx)("span",{className:"ml-1",children:e.nodeId}),e.reason&&(0,n.jsxs)("span",{className:"ml-1 text-text-tertiary",children:["— ",e.reason]}),e.error&&(0,n.jsxs)("span",{className:"ml-1 text-error",children:["— ",e.error]}),(null==(r=e.result)?void 0:r.ok)===!1&&(0,n.jsxs)("span",{className:"ml-1 text-error",children:["— ",null!=(a=e.result.error)?a:"failed"]})]})]},t)})}),!0===a&&(0,n.jsxs)("div",{className:"rounded-md bg-success/10 px-2 py-1 text-[10px] text-success",children:["completed \xb7 ",Object.keys(l).length," node output",1===Object.keys(l).length?"":"s"]}),!1===a&&(0,n.jsx)("div",{className:"rounded-md bg-error/10 px-2 py-1 text-[10px] text-error",children:"failed"}),Object.keys(l).length>0&&(0,n.jsx)(e5,{outputs:l})]})}function e5(e){let{outputs:t}=e;return(0,n.jsxs)("details",{className:"mt-2 rounded-md border border-border bg-surface-elevated",children:[(0,n.jsxs)("summary",{className:"cursor-pointer select-none px-2 py-1 text-[10px] font-semibold text-text-tertiary",children:["Outputs (",Object.keys(t).length,")"]}),(0,n.jsx)("ul",{className:"space-y-1 px-2 pb-2 pt-1 font-mono text-[10px]",children:Object.entries(t).map(e=>{let[t,r]=e;return(0,n.jsxs)("li",{className:"rounded bg-surface px-2 py-1",children:[(0,n.jsx)("div",{className:"text-[9px] uppercase tracking-wide text-text-tertiary",children:t}),(0,n.jsx)("pre",{className:"mt-0.5 max-h-40 overflow-auto whitespace-pre-wrap break-all",children:function(e){if(null==e)return"(no output)";if("string"==typeof e)return e.length>4096?"".concat(e.slice(0,4096),"\n…(truncated \xb7 ").concat(e.length," chars)"):e;try{let t=JSON.stringify(e,null,2);return t.length>4096?"".concat(t.slice(0,4096),"\n…(truncated \xb7 ").concat(t.length," chars)"):t}catch(t){return String(e)}}(r)})]},t)})})]})}function e4(){return(0,n.jsx)(eV,{})}}},e=>{e.O(0,[1441,9991,5508,6852,1176,3607,9096,1380,7358],()=>e(e.s=51442)),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6364],{2565:(e,t,r)=>{"use strict";r.d(t,{U:()=>x});var a=r(54728),n=r(8740),s=r(3839),l=r(96598),i=r(90814);function o(e){let{items:t}=e;return 0===t.length?(0,a.jsx)("div",{className:"rounded-lg border border-dashed border-border p-6 text-center text-sm text-muted-foreground",children:"No control signals matched the current filter."}):(0,a.jsx)("ul",{className:"space-y-2",children:t.map((e,t)=>{var r,n,s,l,i;let o=[(null==(r=e.scope)?void 0:r.surface)&&"surface=".concat(e.scope.surface),(null==(n=e.scope)?void 0:n.channel)&&"channel=".concat(e.scope.channel),(null==(s=e.scope)?void 0:s.sessionId)&&"session=".concat(e.scope.sessionId)].filter(Boolean).join(" \xb7 ")||"unscoped";return(0,a.jsxs)("li",{className:"rounded-lg border border-border bg-card p-3 shadow-sm",children:[(0,a.jsxs)("div",{className:"text-sm font-medium",children:[e.kind," \xb7 ",e.urgency]}),(0,a.jsxs)("div",{className:"mt-0.5 font-mono text-[10px] text-muted-foreground",children:[function(e){let t=Date.now()-new Date(e).getTime();return t<6e4?"just now":t<36e5?"".concat(Math.floor(t/6e4),"m ago"):t<864e5?"".concat(Math.floor(t/36e5),"h ago"):"".concat(Math.floor(t/864e5),"d ago")}(e.createdAt)," \xb7 ",null!=(l=e.source)?l:"unknown"," \xb7 ",o]}),(0,a.jsx)("pre",{className:"mt-2 overflow-x-auto rounded-md bg-muted p-2 text-[11px]",children:JSON.stringify(null!=(i=e.payload)?i:{},null,2)})]},t)})})}let d=["background","quick-pass","normal","priority","critical"];class c{async list(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=new URLSearchParams;Object.entries(e).forEach(e=>{let[r,a]=e;a&&t.set(r,a)});let r=t.toString();return this.client.fetchJson("/v1/control-signals".concat(r?"?".concat(r):""))}emit(e){return this.client.fetchJson("/v1/control-signals",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e)})}constructor(e){this.client=e}}var u=r(25583),m=r(85351);function x(){var e,t,r,x;let{client:h}=(0,s.Q)(),p=(0,n.useMemo)(()=>new c(h),[h]),[f,b]=(0,n.useState)({items:[]}),[g,v]=(0,n.useState)(!1),[j,y]=(0,n.useState)(""),[w,k]=(0,n.useState)(""),[N,C]=(0,n.useState)(""),[I,S]=(0,n.useState)(""),[E,M]=(0,n.useState)(""),[T,R]=(0,n.useState)(""),[D,A]=(0,n.useState)("normal"),[L,P]=(0,n.useState)("operator"),[O,J]=(0,n.useState)(""),[z,q]=(0,n.useState)(""),[U,K]=(0,n.useState)(""),[$,Y]=(0,n.useState)(""),[_,B]=(0,n.useState)(!1),F=(0,n.useCallback)(async()=>{(0,m.cY)("webterm.control.list.refresh",{kind:j,surface:w,minUrgency:N,sessionId:I,limit:E}),v(!0);try{let e=await p.list({kind:j||void 0,surface:w||void 0,minUrgency:N||void 0,sessionId:I||void 0,limit:E||void 0});b(e)}catch(e){u.oR.error("signals list failed: ".concat(e instanceof Error?e.message:e))}finally{v(!1)}},[p,j,w,N,I,E]);(0,n.useEffect)(()=>{F()},[F]);let Q=async e=>{if(e.preventDefault(),!T.trim())return void u.oR.error("kind required");let t={};if($.trim())try{t=JSON.parse($)}catch(e){u.oR.error("payload must be valid JSON");return}let r={kind:T.trim(),urgency:D,source:L.trim()||"operator",mayPreempt:_,payload:t,scope:{...O?{surface:O}:{},...z?{channel:z}:{},...U?{sessionId:U}:{}}};(0,m.cY)("webterm.control.emit",{kind:r.kind,urgency:r.urgency});try{v(!0),await p.emit(r),u.oR.success("signal emitted"),Y(""),await F()}catch(e){u.oR.error("emit failed: ".concat(e instanceof Error?e.message:e))}finally{v(!1)}},V=null!=(e=f.countsByKind)?e:{};return(0,a.jsxs)("div",{className:"mx-auto max-w-5xl space-y-4 p-4",children:[(0,a.jsxs)("header",{className:"space-y-2",children:[(0,a.jsx)("h1",{className:"text-xl font-semibold tracking-tight",children:"Control signals"}),(0,a.jsxs)("div",{className:"flex flex-wrap gap-2 text-[11px] text-muted-foreground",children:[(0,a.jsxs)("span",{className:"rounded-full border border-border px-2 py-0.5",children:["total ",null!=(t=f.total)?t:0]}),(0,a.jsxs)("span",{className:"rounded-full border border-border px-2 py-0.5",children:["latest ",null!=(r=f.latest)?r:"-"]}),Object.entries(V).map(e=>{let[t,r]=e;return(0,a.jsxs)("span",{className:"rounded-full border border-border px-2 py-0.5",children:[t," ",r]},t)})]})]}),(0,a.jsxs)("form",{onSubmit:e=>{e.preventDefault(),F()},className:"flex flex-wrap items-center gap-2 rounded-lg border border-border bg-card p-3 shadow-sm",children:[(0,a.jsx)(i.p,{value:j,onChange:e=>y(e.target.value),placeholder:"kind",className:"flex-1 min-w-[140px]"}),(0,a.jsx)(i.p,{value:w,onChange:e=>k(e.target.value),placeholder:"surface",className:"flex-1 min-w-[140px]"}),(0,a.jsxs)("select",{value:N,onChange:e=>C(e.target.value),className:"h-9 flex-1 min-w-[170px] rounded-md border border-input bg-background px-2 text-sm",children:[(0,a.jsx)("option",{value:"",children:"min urgency (any)"}),d.map(e=>(0,a.jsx)("option",{value:e,children:e},e))]}),(0,a.jsx)(i.p,{value:I,onChange:e=>S(e.target.value),placeholder:"session id",className:"flex-1 min-w-[140px]"}),(0,a.jsx)(i.p,{value:E,onChange:e=>M(e.target.value),placeholder:"limit",type:"number",className:"w-[100px]"}),(0,a.jsx)(l.$,{type:"submit",size:"sm",disabled:g,children:"Filter"})]}),(0,a.jsxs)("form",{onSubmit:Q,className:"space-y-2 rounded-lg border border-border bg-card p-3 shadow-sm",children:[(0,a.jsx)("h2",{className:"text-sm font-semibold",children:"Emit a signal"}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsx)(i.p,{value:T,onChange:e=>R(e.target.value),placeholder:"kind (required)",className:"flex-1 min-w-[140px]"}),(0,a.jsx)("select",{value:D,onChange:e=>{let t=e.target.value;"string"==typeof t&&d.includes(t)&&A(t)},className:"h-9 rounded-md border border-input bg-background px-2 text-sm",children:d.map(e=>(0,a.jsx)("option",{value:e,children:e},e))}),(0,a.jsx)(i.p,{value:L,onChange:e=>P(e.target.value),placeholder:"source",className:"flex-1 min-w-[120px]"}),(0,a.jsx)(i.p,{value:O,onChange:e=>J(e.target.value),placeholder:"scope.surface",className:"flex-1 min-w-[120px]"}),(0,a.jsx)(i.p,{value:z,onChange:e=>q(e.target.value),placeholder:"scope.channel",className:"flex-1 min-w-[120px]"}),(0,a.jsx)(i.p,{value:U,onChange:e=>K(e.target.value),placeholder:"scope.session",className:"flex-1 min-w-[120px]"}),(0,a.jsxs)("label",{className:"flex items-center gap-1.5 text-xs",children:[(0,a.jsx)("input",{type:"checkbox",checked:_,onChange:e=>B(e.target.checked)}),"mayPreempt"]})]}),(0,a.jsx)("textarea",{value:$,onChange:e=>Y(e.target.value),placeholder:'payload JSON (optional, e.g. {"reason":"manual"})',rows:3,className:"w-full resize-y rounded-md border border-input bg-background px-3 py-2 font-mono text-xs"}),(0,a.jsx)(l.$,{type:"submit",size:"sm",disabled:g,children:"Emit"})]}),(0,a.jsx)(o,{items:null!=(x=f.items)?x:[]})]})}},32175:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>W});var a=r(54728),n=r(8740),s=r(49987),l=r(38617),i=r(99461);function o(e){let{id:t,active:r,children:n}=e;return(0,a.jsx)("div",{role:"tabpanel","data-tab-id":t,"data-active":r?"true":"false",className:(0,i.cn)("h-full min-h-0",r?"block":"hidden"),children:n})}var d=r(92347),c=r(29058),u=r(3839),m=r(96598),x=r(90814);function h(e){let{sessions:t,selectedId:r,onOpen:n}=e;return 0===t.length?(0,a.jsx)("div",{className:"rounded-lg border border-dashed border-border p-6 text-center text-sm text-muted-foreground",children:"No intake sessions found."}):(0,a.jsx)("ul",{className:"space-y-2",children:t.map(e=>{var t,s,l;let o=e.intakeId===r;return(0,a.jsx)("li",{children:(0,a.jsxs)("button",{type:"button",onClick:()=>n(e.intakeId),className:(0,i.cn)("w-full rounded-lg border bg-card p-3 text-left shadow-sm transition-colors",o?"border-primary bg-primary/5":"border-border hover:border-primary/40 hover:bg-card/80"),children:[(0,a.jsx)("div",{className:"text-sm font-medium",children:null!=(l=null==(t=e.draft)?void 0:t.title)?l:e.intakeId}),(0,a.jsxs)("div",{className:"mt-0.5 font-mono text-[10px] text-muted-foreground",children:[e.intakeId," \xb7 ",e.state," \xb7 ",function(e){let t=Date.now()-new Date(e).getTime();return t<6e4?"just now":t<36e5?"".concat(Math.floor(t/6e4),"m ago"):t<864e5?"".concat(Math.floor(t/36e5),"h ago"):"".concat(Math.floor(t/864e5),"d ago")}(e.updatedAt)]}),(null==(s=e.draft)?void 0:s.summary)&&(0,a.jsx)("div",{className:"mt-1 text-xs text-foreground/80",children:e.draft.summary}),(0,a.jsxs)("div",{className:"mt-2 flex flex-wrap gap-1",children:[(0,a.jsx)(p,{children:e.source}),(0,a.jsx)(p,{children:e.state}),e.decisionMode&&(0,a.jsx)(p,{children:e.decisionMode})]})]})},e.intakeId)})})}function p(e){let{children:t}=e;return(0,a.jsx)("span",{className:"rounded-full border border-border px-2 py-0.5 text-[10px] uppercase tracking-wider text-muted-foreground",children:t})}var f=r(25583);function b(e){var t,r,n,s,l,i,o,d,c,u,x,h;let{detail:p,view:b,events:v,onAnswer:j,onAction:y,onReplay:w,onRefresh:k,onBack:N}=e,C=null!=(d=null==b||null==(t=b.config)?void 0:t.body)?d:"",I=null!=(c=null==b||null==(r=b.config)?void 0:r.questions)?c:[],S=null!=(u=null==b||null==(n=b.config)?void 0:n.actions)?u:[];return(0,a.jsxs)("section",{className:"space-y-4",children:[(0,a.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,a.jsx)(m.$,{variant:"outline",size:"sm",onClick:N,children:"← List"}),(0,a.jsx)(m.$,{variant:"outline",size:"sm",onClick:k,children:"Refresh"}),(0,a.jsx)(m.$,{variant:"outline",size:"sm",onClick:w,children:"Replay"})]}),(0,a.jsxs)("article",{className:"rounded-lg border border-border bg-card p-4 shadow-sm",children:[(0,a.jsx)("h2",{className:"text-base font-semibold",children:null!=(x=null==b||null==(s=b.chrome)?void 0:s.title)?x:p.intakeId}),(0,a.jsxs)("div",{className:"mt-1 font-mono text-[11px] text-muted-foreground",children:[p.intakeId," \xb7 ",p.state," \xb7 ",p.source]}),C&&(0,a.jsx)("pre",{className:"mt-3 whitespace-pre-wrap break-words text-sm text-foreground/90",children:C})]}),I.map(e=>{var t;return(0,a.jsx)(g,{questionId:e.id,title:e.title,placeholder:null==(t=e.inputType)?void 0:t.placeholder,onSubmit:async t=>{try{await j(e.id,t),f.oR.success("Answer saved")}catch(e){f.oR.error("answer failed: ".concat(e instanceof Error?e.message:e))}}},e.id)}),S.length>0&&(0,a.jsxs)("article",{className:"rounded-lg border border-border bg-card p-4 shadow-sm",children:[(0,a.jsx)("h3",{className:"mb-2 text-sm font-medium",children:"Next actions"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:S.map((e,t)=>(0,a.jsx)(m.$,{size:"sm",variant:0===t?"default":"outline",onClick:async()=>{try{await y(e)}catch(e){f.oR.error("action failed: ".concat(e instanceof Error?e.message:e))}},children:e.label},"".concat(e.label,"-").concat(t)))})]}),(null==(l=p.raw)?void 0:l.text)&&(0,a.jsxs)("article",{className:"rounded-lg border border-border bg-card p-4 shadow-sm",children:[(0,a.jsx)("h3",{className:"mb-2 text-sm font-medium",children:"Raw note"}),(0,a.jsx)("pre",{className:"whitespace-pre-wrap break-words text-sm text-foreground/80",children:p.raw.text})]}),(null!=(h=null==(o=p.raw)||null==(i=o.attachments)?void 0:i.length)?h:0)>0&&(0,a.jsxs)("article",{className:"rounded-lg border border-border bg-card p-4 shadow-sm",children:[(0,a.jsx)("h3",{className:"mb-2 text-sm font-medium",children:"Attachments"}),(0,a.jsx)("ul",{className:"space-y-2",children:p.raw.attachments.map((e,t)=>{var r;return(0,a.jsxs)("li",{className:"rounded-md border border-border bg-background px-3 py-2 text-xs",children:[(0,a.jsx)("div",{className:"font-medium",children:null!=(r=e.name)?r:"(unnamed attachment)"}),(0,a.jsxs)("div",{className:"font-mono text-[10px] text-muted-foreground",children:[e.kind,e.mimeType?" \xb7 ".concat(e.mimeType):""]}),(0,a.jsx)("div",{className:"font-mono text-[10px] text-muted-foreground",children:e.localPath})]},t)})})]}),(0,a.jsxs)("article",{className:"rounded-lg border border-border bg-card p-4 shadow-sm",children:[(0,a.jsx)("h3",{className:"mb-2 text-sm font-medium",children:"Lifecycle"}),0===v.length?(0,a.jsx)("div",{className:"text-xs text-muted-foreground",children:"No intake events recorded."}):(0,a.jsx)("ul",{className:"space-y-2",children:v.map((e,t)=>(0,a.jsxs)("li",{className:"rounded-md border border-border bg-background/60 px-3 py-2",children:[(0,a.jsxs)("div",{className:"font-mono text-[11px] text-muted-foreground",children:[e.kind," \xb7 ",function(e){let t=Date.now()-new Date(e).getTime();return t<6e4?"just now":t<36e5?"".concat(Math.floor(t/6e4),"m ago"):t<864e5?"".concat(Math.floor(t/36e5),"h ago"):"".concat(Math.floor(t/864e5),"d ago")}(e.createdAt)," \xb7 ",e.state]}),void 0!==e.detail&&(0,a.jsx)("pre",{className:"mt-1 whitespace-pre-wrap break-words font-mono text-[10px] text-muted-foreground",children:JSON.stringify(e.detail,null,2)})]},t))})]})]})}function g(e){let{questionId:t,title:r,placeholder:s,onSubmit:l}=e,[i,o]=(0,n.useState)("");return(0,a.jsxs)("form",{className:"space-y-2 rounded-lg border border-border bg-card p-4 shadow-sm",onSubmit:async e=>{e.preventDefault();let t=i.trim();t&&(await l(t),o(""))},children:[(0,a.jsx)("label",{htmlFor:"q-".concat(t),className:"block text-sm",children:r}),(0,a.jsx)(x.p,{id:"q-".concat(t),value:i,onChange:e=>o(e.target.value),placeholder:null!=s?s:"Add the missing context"}),(0,a.jsx)(m.$,{type:"submit",size:"sm",disabled:!i.trim(),children:"Answer"})]})}var v=r(20526),j=r.n(v),y=r(48774);let w=[{value:"review",label:"Review first"},{value:"apply-now",label:"Apply now"},{value:"backlog-only",label:"Backlog only"},{value:"schedule-followup",label:"Schedule follow-up"}];function k(e){let{text:t}=e,{client:r}=(0,u.Q)(),s=(0,n.useMemo)(()=>new y.Yt(r),[r]),[l,i]=(0,n.useState)(null),o=t.trim();if((0,n.useEffect)(()=>{if(o.length<4)return void i(null);let e=!0,t=setTimeout(()=>{s.triagePreview(o).then(t=>{e&&i(t.triage)}).catch(()=>{e&&i(null)})},600);return()=>{e=!1,clearTimeout(t)}},[s,o]),!l)return null;let d=y.NE[l.executionModel];return(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-xs",children:[(0,a.jsx)("span",{className:"text-muted-foreground",children:"이렇게 풀릴 예정:"}),(0,a.jsx)("span",{className:["rounded px-2 py-0.5 ring-1",d.tone].join(" "),children:d.label}),(0,a.jsx)("span",{className:"rounded bg-muted px-1.5 py-0.5 text-muted-foreground ring-1 ring-border",children:"heavy"===l.tier?"무거움":"가벼움"}),(0,a.jsx)("span",{className:"text-muted-foreground",children:l.rationale}),(0,a.jsx)(j(),{href:"/autopilot",className:"ml-auto text-primary hover:underline",children:"리뷰 건너뛰고 바로 미션화 →"})]})}function N(e){let{onSubmit:t,busy:r}=e,[s,l]=(0,n.useState)(""),[i,o]=(0,n.useState)("review"),[d,c]=(0,n.useState)(""),u=async()=>{s.trim()&&(await t(s.trim(),i,"schedule-followup"===i?d.trim():void 0),l(""),c(""))};return(0,a.jsxs)("section",{className:"space-y-3 rounded-lg border border-border bg-card p-4 shadow-sm",children:[(0,a.jsx)("h2",{className:"text-sm font-semibold",children:"Capture a new intake note"}),(0,a.jsx)("textarea",{value:s,onChange:e=>l(e.target.value),placeholder:"- compare two repos\n- investigate image preview bug\n- later maybe absorb this capability",rows:4,className:"w-full resize-y rounded-md border border-input bg-background px-3 py-2 text-sm shadow-xs focus:outline-none focus:ring-2 focus:ring-ring"}),(0,a.jsx)(k,{text:s}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsx)("select",{value:i,onChange:e=>o(e.target.value),className:"h-9 rounded-md border border-input bg-background px-2 text-sm",children:w.map(e=>(0,a.jsx)("option",{value:e.value,children:e.label},e.value))}),(0,a.jsx)(x.p,{value:d,onChange:e=>c(e.target.value),placeholder:"schedule text (when follow-up)",disabled:"schedule-followup"!==i,className:"flex-1 min-w-[200px]"}),(0,a.jsx)(m.$,{onClick:u,disabled:r||!s.trim(),size:"sm",children:"Create intake"})]})]})}class C{async list(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=new URLSearchParams;e.q&&t.set("q",e.q),e.state&&t.set("state",e.state),e.source&&t.set("source",e.source);let r=t.toString();return this.client.fetchJson("/v1/intake".concat(r?"?".concat(r):""))}detail(e){return this.client.fetchJson("/v1/intake/".concat(encodeURIComponent(e)))}reviewView(e){return this.client.fetchJson("/v1/intake/".concat(encodeURIComponent(e),"/review-view"))}events(e){return this.client.fetchJson("/v1/intake/".concat(encodeURIComponent(e),"/events"))}create(e){return this.client.fetchJson("/v1/intake",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e)})}mutate(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.client.fetchJson("/v1/intake/".concat(encodeURIComponent(e),"/").concat(t),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(r)})}constructor(e){this.client=e}}var I=r(85351);let S=["","captured","clarifying","review-ready","proposed","applied","scheduled","archived"],E=["","scratch","telegram","discord","voice","api"];function M(){let{client:e}=(0,u.Q)(),t=(0,n.useMemo)(()=>new C(e),[e]),[r,s]=(0,n.useState)([]),[l,i]=(0,n.useState)(""),[o,d]=(0,n.useState)(""),[c,p]=(0,n.useState)(""),[g,v]=(0,n.useState)(!1),[j,y]=(0,n.useState)(null),[w,k]=(0,n.useState)(null),[M,T]=(0,n.useState)([]),R=(0,n.useCallback)(async()=>{(0,I.cY)("webterm.intake.list.refresh",{q:l,stateFilter:o,sourceFilter:c}),v(!0);try{var e;let r=await t.list({q:l||void 0,state:o||void 0,source:c||void 0});s(null!=(e=r.sessions)?e:[])}catch(e){f.oR.error("intake list failed: ".concat(e instanceof Error?e.message:e))}finally{v(!1)}},[t,l,o,c]),D=(0,n.useCallback)(async e=>{(0,I.cY)("webterm.intake.detail.open",{id:e}),v(!0);try{var r;let[a,n,s]=await Promise.all([t.detail(e),t.reviewView(e),t.events(e)]);y(a),k(n.view),T([...null!=(r=s.events)?r:[]].reverse())}catch(e){f.oR.error("intake open failed: ".concat(e instanceof Error?e.message:e))}finally{v(!1)}},[t]);(0,n.useEffect)(()=>{R()},[R]);let A=async(e,r,a)=>{v(!0);try{let n={text:e};"review"!==r&&(n.mode=r),a&&(n.scheduleText=a);let s=await t.create(n);f.oR.success("captured ".concat(s.intakeId)),await R(),await D(s.intakeId)}catch(e){f.oR.error("create failed: ".concat(e instanceof Error?e.message:e))}finally{v(!1)}},L=async(e,r)=>{j&&(await t.mutate(j.intakeId,"answer",{questionId:e,answer:r}),await D(j.intakeId))},P=async e=>{let r=e.value;if(r&&r.intakeId){switch((0,I.cY)("webterm.intake.action",{kind:r.kind}),r.kind){case"decide-apply-now":await t.mutate(r.intakeId,"decide",{mode:"apply-now"}),await t.mutate(r.intakeId,"apply",{});break;case"decide-backlog-only":await t.mutate(r.intakeId,"decide",{mode:"backlog-only"});break;case"propose":await t.mutate(r.intakeId,"propose",{});break;case"apply":await t.mutate(r.intakeId,"apply",{});break;case"archive":await t.mutate(r.intakeId,"archive",{}),y(null),k(null),T([]),await R();return;case"review":await D(r.intakeId);return}j&&await D(j.intakeId)}};return(0,a.jsxs)("div",{className:"mx-auto max-w-5xl space-y-4 p-4",children:[(0,a.jsxs)("header",{className:"space-y-2",children:[(0,a.jsx)("h1",{className:"text-xl font-semibold tracking-tight",children:"Intake"}),(0,a.jsxs)("form",{onSubmit:e=>{e.preventDefault(),R()},className:"flex flex-wrap items-center gap-2",children:[(0,a.jsx)(x.p,{value:l,onChange:e=>i(e.target.value),placeholder:"Search title \xb7 summary \xb7 raw",className:"flex-1 min-w-[180px]"}),(0,a.jsx)("select",{value:o,onChange:e=>d(e.target.value),className:"h-9 rounded-md border border-input bg-background px-2 text-sm",children:S.map(e=>(0,a.jsx)("option",{value:e,children:e||"All states"},e))}),(0,a.jsx)("select",{value:c,onChange:e=>p(e.target.value),className:"h-9 rounded-md border border-input bg-background px-2 text-sm",children:E.map(e=>(0,a.jsx)("option",{value:e,children:e||"All sources"},e))}),(0,a.jsx)(m.$,{type:"submit",size:"sm",disabled:g,children:"Search"})]})]}),(0,a.jsx)(N,{onSubmit:A,busy:g}),j&&w?(0,a.jsx)(b,{detail:j,view:w,events:M,onAnswer:L,onAction:P,onReplay:async()=>{let e=await t.mutate(j.intakeId,"replay",{});await R(),await D(e.intakeId)},onRefresh:()=>D(j.intakeId),onBack:()=>{y(null),k(null),T([])}}):(0,a.jsx)(h,{sessions:r,onOpen:D})]})}var T=r(18837),R=r(2565),D=r(48366),A=r(90319);function L(e){let{tab:t}=e;switch(t.kind){case"chat":return(0,a.jsx)(d.ChatPanel,{sessionId:t.sessionId,tabId:t.id});case"term":return(0,a.jsx)(c.zV,{});case"intake":return(0,a.jsx)(M,{});case"tasks":return(0,a.jsx)(T.B,{});case"control":return(0,a.jsx)(R.U,{});case"settings":return(0,a.jsx)(D.O,{})}}function P(){return(0,a.jsx)("div",{className:"flex h-full items-center justify-center text-xs text-muted-foreground",children:(0,a.jsx)("span",{children:"(이 탭은 절약 모드 — 클릭 시 복원)"})})}function O(){let{state:e,addTab:t,activateTab:r}=(0,l.hA)(),s=(0,A.ub)(e),i=(0,n.useRef)(null);if((0,n.useEffect)(()=>{if(i.current&&!(s.length<=1))return function(e,t){var r,a;let n=null!=(r=t.minDistance)?r:100,s=null!=(a=t.minVelocity)?a:.3,l=0,i=0,o=0,d=!1,c=null,u=e=>{var r;null!=(r=t.shouldIgnore)&&r.call(t,e.target)||(l=e.clientX,i=e.clientY,o=e.timeStamp,d=!0,c=e.pointerId)},m=e=>{if(!d||e.pointerId!==c)return;d=!1,c=null;let r=e.clientX-l,a=e.clientY-i,u=Math.max(1,e.timeStamp-o),m=Math.abs(r),x=Math.abs(a);m<n||x>=m||m/u<s||t.onSwipe(r<0?"left":"right")},x=()=>{d=!1,c=null};return e.addEventListener("pointerdown",u),e.addEventListener("pointerup",m),e.addEventListener("pointercancel",x),()=>{e.removeEventListener("pointerdown",u),e.removeEventListener("pointerup",m),e.removeEventListener("pointercancel",x)}}(i.current,{shouldIgnore:e=>{if(!(e instanceof HTMLElement))return!1;let t=e.tagName;return!!("INPUT"===t||"TEXTAREA"===t||"SELECT"===t||e.closest(".xterm"))||!!e.isContentEditable},onSwipe:t=>{let a=e.activeId?s.findIndex(t=>t.id===e.activeId):-1;if(a<0)return;let n="left"===t?Math.min(s.length-1,a+1):Math.max(0,a-1);n!==a&&r(s[n].id)}})},[s,e.activeId,r]),0===s.length)return(0,a.jsx)("div",{className:"flex h-full flex-col items-center justify-center gap-4 px-6 text-center",children:(0,a.jsxs)("div",{className:"rounded-lg border border-dashed border-border bg-card px-6 py-8 max-w-md",children:[(0,a.jsx)("h2",{className:"text-base font-semibold tracking-tight",children:"워크스페이스 시작"}),(0,a.jsxs)("p",{className:"mt-2 text-sm text-muted-foreground",children:["상단 strip 의"," ",(0,a.jsx)("span",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-xs",children:"+"})," ","또는 아래 버튼으로 첫 탭을 추가하세요. 비활성 탭은 닫기 전까지 unmount 되지 않아 입력 중 텍스트가 보존됩니다."]}),(0,a.jsxs)("div",{className:"mt-4 flex flex-wrap justify-center gap-2",children:[(0,a.jsx)("button",{type:"button",onClick:()=>t({kind:"chat"}),className:"rounded-md border border-border bg-background px-3 py-1.5 text-sm hover:bg-secondary",children:"+ chat"}),(0,a.jsx)("button",{type:"button",onClick:()=>t({kind:"term"}),className:"rounded-md border border-border bg-background px-3 py-1.5 text-sm hover:bg-secondary",children:"+ terminal"})]})]})});let d=new Set(e.frozenIds);return(0,a.jsx)("div",{ref:i,className:"relative h-full min-h-0 touch-pan-y",children:s.map(t=>(0,a.jsx)(o,{id:t.id,active:e.activeId===t.id,children:d.has(t.id)?(0,a.jsx)(P,{}):(0,a.jsx)(L,{tab:t})},t.id))})}function J(){let e=(0,l.hA)();return(0,n.useEffect)(()=>{let t=t=>{if(!(t.metaKey||t.ctrlKey))return;let r=(0,A.ub)(e.state),a=e.state.activeId?r.findIndex(t=>t.id===e.state.activeId):-1;if(!t.shiftKey&&"t"===t.key.toLowerCase()){t.preventDefault(),e.openPicker({kind:"addNewChat"});return}if(!t.shiftKey&&"w"===t.key.toLowerCase()){t.preventDefault(),e.state.activeId&&r.length>0&&e.closeTab(e.state.activeId);return}if(t.shiftKey&&("]"===t.key||"["===t.key)){if(t.preventDefault(),r.length<=1||a<0)return;let n="]"===t.key?(a+1)%r.length:(a-1+r.length)%r.length;e.activateTab(r[n].id);return}if(!t.shiftKey&&/^[1-9]$/.test(t.key)){t.preventDefault();let a=parseInt(t.key,10)-1;if(a>=r.length)return;e.activateTab(r[a].id);return}};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[e]),null}var z=r(32235),q=r(76835);let U=(0,r(3720).A)("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]);var K=r(11076),$=r(75261),Y=r(72547),_=r(67388),B=r(42767);function F(e){var t;let{open:r,session:s,onCancel:l,onConfirm:i,busy:o}=e;if((0,n.useEffect)(()=>{if(!r)return;let e=e=>{"Escape"===e.key&&l()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[r,l]),!r||!s)return null;let d=null!=(t=s.lastMsgPreview)?t:"(empty session)";return(0,a.jsx)("div",{role:"alertdialog","aria-modal":"true",className:"fixed inset-0 z-[60] flex items-center justify-center bg-black/40",onClick:l,children:(0,a.jsxs)("div",{onClick:e=>e.stopPropagation(),className:"w-[min(420px,calc(100vw-2rem))] rounded-lg border border-border bg-card p-5 shadow-lg",children:[(0,a.jsxs)("div",{className:"flex items-start gap-3",children:[(0,a.jsx)(K.A,{className:"mt-0.5 h-5 w-5 shrink-0 text-rose-500","aria-hidden":!0}),(0,a.jsxs)("div",{className:"min-w-0 space-y-2",children:[(0,a.jsx)("h2",{className:"text-base font-semibold",children:"세션 잊기"}),(0,a.jsxs)("p",{className:"truncate font-mono text-xs text-muted-foreground",children:['"',d,'"']}),(0,a.jsxs)("p",{className:"text-xs text-muted-foreground",children:[s.origin&&(0,a.jsx)("span",{className:"rounded bg-muted px-1.5 py-0.5 font-mono uppercase mr-1.5",children:s.origin}),s.msgCount," 메시지"]}),(0,a.jsx)("p",{className:"text-sm",children:"이 세션을 daemon 에서 영구 삭제합니다. 다른 디바이스 (cli/tg/dc) 에서 이 세션을 보고 있으면 unknown_session 으로 빠집니다."})]})]}),(0,a.jsxs)("div",{className:"mt-4 flex justify-end gap-2",children:[(0,a.jsx)("button",{type:"button",onClick:l,disabled:o,className:"rounded-md border border-border bg-background px-3 py-1.5 text-sm hover:bg-secondary disabled:opacity-50",children:"취소"}),(0,a.jsx)("button",{type:"button",onClick:i,disabled:o,className:"rounded-md bg-rose-500 px-3 py-1.5 text-sm font-medium text-white hover:bg-rose-600 disabled:opacity-50",children:o?"잊는 중…":"잊기"})]})]})})}var Q=r(16767);let V={cli:"cli",pwa:"pwa",tg:"tg",dc:"dc"};function X(e){let{open:t,onClose:r,onPick:s,attachedSessions:l}=e,{client:o}=(0,u.Q)(),d=(0,Y.hG)(o),c=(0,n.useMemo)(()=>new _.jU(o),[o]),m=(0,B.h)(),[x,h]=(0,n.useState)(""),[p,f]=(0,n.useState)(0),[b,g]=(0,n.useState)(null),[v,j]=(0,n.useState)(!1),[y,w]=(0,n.useState)(!1),[k,N]=(0,n.useState)(null),C=(0,n.useRef)(null),I=(0,n.useRef)(null);(0,n.useEffect)(()=>{t&&(h(""),f(0),N(null),d.forceRefresh())},[t,d]),(0,n.useEffect)(()=>{N(null)},[x]);let S=(0,n.useMemo)(()=>{if(!x.trim())return[...m];let e=x.trim().toLowerCase();return m.filter(t=>!!(t.id.toLowerCase().startsWith(e)||t.lastMsgPreview&&t.lastMsgPreview.toLowerCase().includes(e))||!!t.origin&&e==="[".concat(t.origin,"]")||!!t.origin&&e===t.origin)},[m,x]);if((0,n.useEffect)(()=>{p>=S.length&&f(Math.max(0,S.length-1))},[S.length,p]),(0,n.useEffect)(()=>{var e;if(!t)return;null==(e=C.current)||e.focus();let a=e=>{if("Escape"===e.key){e.preventDefault(),r();return}if((e.metaKey||e.ctrlKey)&&"n"===e.key.toLowerCase()){e.preventDefault(),E();return}if((e.metaKey||e.ctrlKey)&&"f"===e.key.toLowerCase()){var t;e.preventDefault(),null==(t=C.current)||t.focus();return}if("ArrowDown"===e.key)e.preventDefault(),f(e=>Math.min(S.length-1,e+1));else if("ArrowUp"===e.key)e.preventDefault(),f(e=>Math.max(0,e-1));else if("Enter"===e.key){let t=S[p];if(!t){x.trim().length>=4&&(e.preventDefault(),T());return}e.preventDefault(),M(t)}else if("Delete"===e.key||"Backspace"===e.key){if(e.target instanceof HTMLInputElement)return;let t=S[p];t&&(e.preventDefault(),g(t))}};return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},[t,S,p,r,x,y]),!t)return null;let E=()=>{s({kind:"new",sessionId:(0,$.f6)()})},M=e=>{let t=l.get(e.id);if(t)return void s({kind:"jumpToTab",tabId:t.tabId});s({kind:"existing",sessionId:e.id})},T=async()=>{let e=x.trim().toLowerCase();if(!(e.length<4)&&!y){w(!0);try{var t;let r=await c.list(!0),a=(0,_.nj)(null!=(t=r.sessions)?t:[],e);if("one"===a.kind){let e=l.get(a.id);e?s({kind:"jumpToTab",tabId:e.tabId}):s({kind:"existing",sessionId:a.id})}else"none"===a.kind?N("'".concat(e,"' 로 시작하는 세션이 없습니다.")):N("prefix 모호 — ".concat(a.count,"개 일치. 더 길게 입력하세요."))}catch(e){N("resolve 실패: ".concat(e instanceof Error?e.message:String(e)))}finally{w(!1)}}},R=async()=>{if(b){j(!0);try{await d.forget(b.id),g(null)}finally{j(!1)}}};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{role:"dialog","aria-modal":"true","aria-label":"채팅 세션 선택",className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40",onClick:r,children:(0,a.jsxs)("div",{onClick:e=>e.stopPropagation(),className:"flex max-h-[min(640px,90vh)] w-[min(640px,calc(100vw-2rem))] flex-col rounded-lg border border-border bg-card shadow-lg",children:[(0,a.jsxs)("div",{className:"flex shrink-0 items-center justify-between gap-2 border-b border-border px-4 py-3",children:[(0,a.jsx)("h2",{className:"text-base font-semibold",children:"채팅 세션"}),(0,a.jsx)("button",{type:"button","aria-label":"close",onClick:r,className:"rounded-md p-1 text-muted-foreground hover:bg-secondary hover:text-foreground",children:(0,a.jsx)(z.A,{className:"h-4 w-4"})})]}),(0,a.jsx)("div",{className:"shrink-0 px-4 py-3",children:(0,a.jsxs)("button",{type:"button",onClick:E,className:"flex w-full items-center gap-3 rounded-lg border border-primary/40 bg-primary/10 px-3 py-2.5 text-left hover:bg-primary/15",children:[(0,a.jsx)(q.A,{className:"h-5 w-5 text-primary"}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("div",{className:"text-sm font-medium",children:"새 세션 시작"}),(0,a.jsx)("div",{className:"text-xs text-muted-foreground",children:"비어있는 새 채팅을 엽니다 (⌘N)"})]})]})}),(0,a.jsx)("div",{className:"shrink-0 border-y border-border bg-muted/30 px-4 py-2",children:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(U,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),(0,a.jsx)("input",{ref:C,value:x,onChange:e=>h(e.target.value),placeholder:"검색 — preview text \xb7 id \xb7 [pwa]/[cli]/[tg]/[dc]",className:"flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground/60"}),x&&(0,a.jsx)("button",{type:"button","aria-label":"clear search",onClick:()=>h(""),className:"rounded p-0.5 text-muted-foreground hover:bg-background",children:(0,a.jsx)(z.A,{className:"h-3 w-3"})})]})}),(0,a.jsx)("div",{ref:I,className:"min-h-0 flex-1 overflow-y-auto",children:0===S.length?(0,a.jsxs)("div",{className:"px-4 py-12 text-center",children:[(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:0!==m.length||x.trim()?"검색과 일치하는 세션 없음.":'아직 채팅 세션이 없습니다. 위 "+ 새 세션 시작" 으로 첫 채팅을 시작하세요.'}),x.trim().length>=4&&(0,a.jsx)("button",{type:"button",disabled:y,onClick:()=>void T(),className:"mt-3 rounded-md border border-violet-500/40 bg-violet-500/10 px-3 py-1.5 text-xs text-violet-300 hover:bg-violet-500/15 disabled:opacity-50",children:y?"resolve 중…":"⑂ id prefix '".concat(x.trim(),"' 로 이어가기 (Enter)")}),k&&(0,a.jsx)("p",{className:"mt-2 text-xs text-amber-400",children:k}),0===m.length&&!x.trim()&&(0,a.jsx)("p",{className:"mt-2 text-xs text-muted-foreground",children:"다른 디바이스 (cli / telegram / discord) 에서 세션을 시작하면 여기에 자동으로 나타납니다."})]}):(0,a.jsx)("ul",{className:"divide-y divide-border",children:S.map((e,t)=>{var r;let n=l.get(e.id),s=t===p;return(0,a.jsx)("li",{children:(0,a.jsxs)("div",{className:(0,i.cn)("group flex items-center gap-3 px-4 py-2.5 transition-colors",s?"bg-primary/10 ring-1 ring-inset ring-primary/30":"hover:bg-secondary/50"),onMouseEnter:()=>f(t),children:[(0,a.jsxs)("button",{type:"button",onClick:()=>M(e),className:"flex min-w-0 flex-1 flex-col items-start text-left",children:[(0,a.jsxs)("div",{className:"flex w-full items-center gap-2",children:[(0,a.jsx)("span",{className:"truncate text-sm font-medium",children:null!=(r=e.lastMsgPreview)?r:(0,a.jsx)("span",{className:"text-muted-foreground italic",children:"(empty session)"})}),n&&(0,a.jsxs)("span",{className:"ml-auto shrink-0 rounded-full bg-primary/15 px-2 py-0.5 text-[10px] font-medium text-primary",children:["✓ open in ",n.label]})]}),(0,a.jsxs)("div",{className:"mt-0.5 flex items-center gap-2 text-[11px] text-muted-foreground",children:[e.origin&&(0,a.jsx)("span",{className:"rounded bg-muted px-1.5 py-0.5 font-mono",children:V[e.origin]}),(0,a.jsx)("span",{children:function(e){try{let t=new Date(e).getTime();if(!Number.isFinite(t))return"";let r=Date.now()-t,a=Math.floor(r/6e4);if(a<1)return"방금 전";if(a<60)return"".concat(a,"분 전");let n=Math.floor(a/60);if(n<24)return"".concat(n,"시간 전");let s=Math.floor(n/24);if(s<7)return"".concat(s,"일 전");return new Date(t).toLocaleDateString()}catch(e){return""}}(e.lastTurnAt)}),(0,a.jsxs)("span",{children:["\xb7 ",e.msgCount," 메시지"]}),(0,a.jsx)(Q.S,{sessionId:e.id,source:"picker",variant:"subtle",showCopyIcon:!1})]})]}),(0,a.jsx)("button",{type:"button","aria-label":"forget ".concat(e.id),onClick:t=>{t.stopPropagation(),g(e)},className:(0,i.cn)("shrink-0 rounded p-1.5 text-muted-foreground transition-colors hover:bg-rose-500/10 hover:text-rose-500",s?"opacity-100":"opacity-0 group-hover:opacity-100"),children:(0,a.jsx)(K.A,{className:"h-4 w-4"})})]})},e.id)})})}),(0,a.jsxs)("div",{className:"shrink-0 border-t border-border bg-muted/30 px-4 py-2 text-[10px] text-muted-foreground",children:[(0,a.jsx)("span",{className:"mr-3",children:"↑↓ 이동"}),(0,a.jsx)("span",{className:"mr-3",children:"Enter 선택"}),(0,a.jsx)("span",{className:"mr-3",children:"⌘N 새 세션"}),(0,a.jsx)("span",{className:"mr-3",children:"⌘F 검색"}),(0,a.jsx)("span",{children:"Del 잊기"})]})]})}),(0,a.jsx)(F,{open:null!==b,session:b,busy:v,onCancel:()=>g(null),onConfirm:R})]})}let H=new Set(["chat","term","intake","tasks","control","settings"]);function G(){var e;let t=(0,l.hA)(),r=(0,s.useRouter)(),i=(0,s.useSearchParams)(),o=null!=(e=null==i?void 0:i.get("intent"))?e:null,d=(0,n.useRef)(null);(0,n.useEffect)(()=>{if(o&&d.current!==o){if(!H.has(o))return void r.replace("/workspace");if(d.current=o,"chat"===o){let e=(0,A.ub)(t.state).find(e=>"chat"===e.kind);e?t.activateTab(e.id):t.openPicker({kind:"addNewChat"})}else t.activateOrAdd(o);r.replace("/workspace")}},[o,t,r]);let c=(0,n.useMemo)(()=>{let e=new Map,r=0;for(let a of t.state.order){let n=t.state.tabs.find(e=>e.id===a);n&&"chat"===n.kind&&(r+=1,e.set(n.sessionId,{tabId:n.id,label:"chat#".concat(r)}))}return e},[t.state.order,t.state.tabs]);return(0,a.jsxs)("div",{className:"flex h-full flex-col",children:[(0,a.jsx)(J,{}),(0,a.jsx)("div",{className:"flex-1 min-h-0",children:(0,a.jsx)(O,{})}),(0,a.jsx)(X,{open:null!==t.pickerMode,onClose:t.closePicker,onPick:e=>{let r=t.pickerMode;r&&("jumpToTab"===e.kind?t.activateTab(e.tabId):"addNewChat"===r.kind?t.addTab({kind:"chat",sessionId:e.sessionId}):"attachToTab"===r.kind&&(t.updateChatTab(r.tabId,{sessionId:e.sessionId}),t.activateTab(r.tabId)),t.closePicker())},attachedSessions:c})]})}function W(){return(0,a.jsx)(n.Suspense,{fallback:(0,a.jsx)("div",{className:"h-full"}),children:(0,a.jsx)(G,{})})}},76835:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});let a=(0,r(3720).A)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},89383:(e,t,r)=>{Promise.resolve().then(r.bind(r,32175))}},e=>{e.O(0,[4615,2133,7235,7482,5583,5508,526,6852,7701,6258,3089,320,3839,6820,3659,1863,8617,8366,9058,2347,8837,9096,1380,7358],()=>e(e.s=89383)),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2975],{7024:(e,t,s)=>{"use strict";s.d(t,{n:()=>d});var n=s(8740),r=s(74160),a=s(8109),o=s(77414),i=s(30948),l=class extends o.Q{#e;#t=void 0;#s;#n;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#r()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),(0,i.f8)(this.options,t)||this.#e.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#s,observer:this}),t?.mutationKey&&this.options.mutationKey&&(0,i.EN)(t.mutationKey)!==(0,i.EN)(this.options.mutationKey)?this.reset():this.#s?.state.status==="pending"&&this.#s.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#s?.removeObserver(this)}onMutationUpdate(e){this.#r(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#s?.removeObserver(this),this.#s=void 0,this.#r(),this.#a()}mutate(e,t){return this.#n=t,this.#s?.removeObserver(this),this.#s=this.#e.getMutationCache().build(this.#e,this.options),this.#s.addObserver(this),this.#s.execute(e)}#r(){let e=this.#s?.state??(0,r.$)();this.#t={...e,isPending:"pending"===e.status,isSuccess:"success"===e.status,isError:"error"===e.status,isIdle:"idle"===e.status,mutate:this.mutate,reset:this.reset}}#a(e){a.jG.batch(()=>{if(this.#n&&this.hasListeners()){let t=this.#t.variables,s=this.#t.context,n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type==="success"){try{this.#n.onSuccess?.(e.data,t,s,n)}catch(e){Promise.reject(e)}try{this.#n.onSettled?.(e.data,null,t,s,n)}catch(e){Promise.reject(e)}}else if(e?.type==="error"){try{this.#n.onError?.(e.error,t,s,n)}catch(e){Promise.reject(e)}try{this.#n.onSettled?.(void 0,e.error,t,s,n)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},c=s(2859);function d(e,t){let s=(0,c.jE)(t),[r]=n.useState(()=>new l(s,e));n.useEffect(()=>{r.setOptions(e)},[r,e]);let o=n.useSyncExternalStore(n.useCallback(e=>r.subscribe(a.jG.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),d=n.useCallback((e,t)=>{r.mutate(e,t).catch(i.lQ)},[r]);if(o.error&&(0,i.GU)(r.options.throwOnError,[o.error]))throw o.error;return{...o,mutate:d,mutateAsync:o.mutate}}},11076:(e,t,s)=>{"use strict";s.d(t,{A:()=>n});let n=(0,s(3720).A)("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]])},17342:(e,t,s)=>{"use strict";s.d(t,{A:()=>n});let n=(0,s(3720).A)("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]])},23270:(e,t,s)=>{"use strict";s.d(t,{A:()=>n});let n=(0,s(3720).A)("git-branch",[["path",{d:"M15 6a9 9 0 0 0-9 9V3",key:"1cii5b"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}]])},24206:(e,t,s)=>{"use strict";s.d(t,{A:()=>n});let n=(0,s(3720).A)("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]])},33303:(e,t,s)=>{"use strict";s.d(t,{A:()=>n});let n=(0,s(3720).A)("refresh-cw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]])},46226:(e,t,s)=>{"use strict";s.d(t,{M1:()=>c,Qj:()=>d,tI:()=>l});var n=s(54728),r=s(8740),a=s(42706),o=s(2859);let i=(0,r.createContext)(null);function l(e){let{client:t,queryClient:s,defaultStaleTimeMs:l,children:c}=e,d=(0,r.useMemo)(()=>null!=s?s:new a.E({defaultOptions:{queries:{staleTime:null!=l?l:2e3,refetchOnWindowFocus:!1}}}),[s,l]);return(0,n.jsx)(i.Provider,{value:t,children:(0,n.jsx)(o.Ht,{client:d,children:c})})}function c(){let e=(0,r.useContext)(i);if(!e)throw Error("useNexusClient must be used within <NexusProvider>");return e}function d(){return(0,r.useContext)(i)}},63354:(e,t,s)=>{"use strict";s.d(t,{AF:()=>n});let n={all:["nexus"],health:()=>[...n.all,"health"],snapshot:()=>[...n.all,"snapshot"],tabs:e=>e?[...n.all,"tabs",{kind:e}]:[...n.all,"tabs"],tab:e=>[...n.all,"tab",e],templates:()=>[...n.all,"templates"],template:e=>[...n.all,"template",e],config:()=>[...n.all,"config"],switches:()=>[...n.all,"switches"],switch:e=>[...n.all,"switch",e],secrets:()=>[...n.all,"secrets"],bindingChannels:()=>[...n.all,"bindings","channels"],bindings:e=>[...n.all,"bindings",e],binding:(e,t)=>[...n.all,"binding",e,t],logsTail:(e,t)=>t?[...n.all,"logs",e,{lines:t}]:[...n.all,"logs",e],workflows:()=>[...n.all,"workflows"],workflow:e=>[...n.all,"workflow",e],workflowRun:e=>[...n.all,"workflow-run",e],workflowRuns:()=>[...n.all,"workflow-runs"],pendingApprovals:()=>[...n.all,"workflow-pending-approvals"],platforms:()=>[...n.all,"platforms"],providers:()=>[...n.all,"providers"],worktrees:()=>[...n.all,"worktrees"],designCheck:()=>[...n.all,"design-check"],registryCatalog:()=>[...n.all,"registry-catalog"],resolvedView:()=>[...n.all,"resolved-view"]};n.snapshot(),n.tabs(),n.health(),n.snapshot(),n.config(),n.switches()},64658:(e,t,s)=>{Promise.resolve().then(s.bind(s,88866))},72127:(e,t,s)=>{"use strict";s.d(t,{I:()=>r,x:()=>a});var n=s(85351);class r extends Error{constructor(e,t,s){super("nexus ".concat(e," on ").concat(t,": ").concat(function(e){try{return JSON.stringify(e)}catch(t){return String(e)}}(s))),this.status=e,this.path=t,this.body=s,this.name="NexusApiError"}}function a(e){var t,s;let a=e.baseUrl.replace(/\/$/,""),o=null!=(t=e.fetchImpl)?t:fetch,i=null!=(s=e.timeoutMs)?s:8e3;async function l(e,t,s,n){let l="".concat(a).concat(t),c=i>0||(null==n?void 0:n.signal)?new AbortController:null,d=c&&i>0?setTimeout(()=>c.abort(),i):null,u=null;if(c&&(null==n?void 0:n.signal)){let e=n.signal;if(e.aborted)c.abort();else{let t=()=>c.abort();e.addEventListener("abort",t),u=()=>e.removeEventListener("abort",t)}}try{let n=await o(l,{method:e,...c?{signal:c.signal}:{},...void 0!==s?{headers:{"content-type":"application/json"},body:JSON.stringify(s)}:{}}),a=null;try{a=await n.json()}catch(e){}if(!n.ok)throw new r(n.status,t,a);return a}finally{null!=d&&clearTimeout(d),u&&u()}}return{baseUrl:a,getHealth:()=>l("GET","/v1/health"),getNexus:()=>l("GET","/v1/nexus"),getTabs:e=>{let t=(null==e?void 0:e.kind)?"?kind=".concat(encodeURIComponent(e.kind)):"";return l("GET","/v1/nexus/tabs".concat(t))},getTab:e=>l("GET","/v1/nexus/tabs/".concat(encodeURIComponent(e))),getChatBackendDetection:()=>l("GET","/v1/nexus/chat-backend-detection"),mintConnectToken:()=>l("POST","/v1/nexus/connect-info/mint-token",{}),createTab:e=>l("POST","/v1/nexus/tabs",e),deleteTab:e=>l("DELETE","/v1/nexus/tabs/".concat(encodeURIComponent(e))),patchTab:(e,t)=>l("PATCH","/v1/nexus/tabs/".concat(encodeURIComponent(e)),t),startTab:e=>l("POST","/v1/nexus/tabs/".concat(encodeURIComponent(e),"/start")),stopTab:(e,t)=>{let s=(null==t?void 0:t.graceMs)!==void 0?"?graceMs=".concat(t.graceMs):"";return l("POST","/v1/nexus/tabs/".concat(encodeURIComponent(e),"/stop").concat(s))},restartTab:(e,t)=>{let s=(null==t?void 0:t.graceMs)!==void 0?"?graceMs=".concat(t.graceMs):"";return l("POST","/v1/nexus/tabs/".concat(encodeURIComponent(e),"/restart").concat(s))},getTemplates:()=>l("GET","/v1/nexus/templates"),getTemplate:e=>l("GET","/v1/nexus/templates/".concat(encodeURIComponent(e))),saveTemplate:e=>l("POST","/v1/nexus/templates",e),getWorkflows:()=>l("GET","/v1/workflows"),getWorkflow:e=>l("GET","/v1/workflows/".concat(encodeURIComponent(e))),saveWorkflow:(e,t)=>l("PUT","/v1/workflows/".concat(encodeURIComponent(e)),t),deleteWorkflow:(e,t)=>{let s=(null==t?void 0:t.scope)?"?scope=".concat(encodeURIComponent(t.scope)):"";return l("DELETE","/v1/workflows/".concat(encodeURIComponent(e)).concat(s))},validateWorkflow:(e,t)=>l("POST","/v1/workflows/validate",{yaml:e},t),generateWorkflow:(e,t)=>l("POST","/v1/workflows/generate",e,t),synthesizeWorkflow:(e,t)=>l("POST","/v1/workflows/synth",e,t),getTriggersSnapshot:e=>l("GET","/v1/triggers",void 0,e),getWorkflowTemplates:e=>l("GET","/v1/workflows/templates",void 0,e),runWorkflow:(e,t,s)=>l("POST","/v1/workflows/".concat(encodeURIComponent(e),"/run"),{arguments:t,...(null==s?void 0:s.dryRun)?{dryRun:!0}:{}}),getWorkflowRun:e=>l("GET","/v1/workflows/runs/".concat(encodeURIComponent(e))),getWorkflowRuns:()=>l("GET","/v1/workflows/runs"),workflowsEventsUrl:()=>a?"".concat(a,"/v1/workflows/events"):null,getPendingApprovals:()=>l("GET","/v1/workflows/runs/pending"),approveRun:(e,t)=>l("POST","/v1/workflows/runs/".concat(encodeURIComponent(e),"/approve"),null!=t?t:{}),rejectRun:(e,t)=>l("POST","/v1/workflows/runs/".concat(encodeURIComponent(e),"/reject"),null!=t?t:{}),getConfig:()=>l("GET","/v1/config"),getSwitches:()=>l("GET","/v1/config/switches"),getSwitch:e=>l("GET","/v1/config/switches/".concat(encodeURIComponent(e))),putSwitch:(e,t)=>l("PUT","/v1/config/switches/".concat(encodeURIComponent(e)),t),postSecret:e=>l("POST","/v1/config/secrets",e),deleteSecret:e=>l("DELETE","/v1/config/secrets/".concat(encodeURIComponent(e))),getSecrets:()=>l("GET","/v1/config/secrets"),getModelTier:()=>l("GET","/v1/config/model-tier"),putModelTier:e=>l("PUT","/v1/config/model-tier",e),getPlatforms:()=>l("GET","/v1/platforms"),getLlmProviders:()=>l("GET","/v1/setup/llm-providers"),setLlmProvider:e=>l("POST","/v1/setup/llm-provider",e),getPersonas:()=>l("GET","/v1/personas"),patchPersonaDescription:(e,t)=>l("PATCH","/v1/personas/".concat(encodeURIComponent(e)),{description:t}),getRegistryCatalog:()=>l("GET","/v1/registry/catalog"),getWorktrees:()=>l("GET","/v1/worktrees"),getDesignCheck:()=>l("GET","/v1/design-check"),disposeWorktree:e=>l("POST","/v1/worktrees/dispose",e),getLogsTail:(e,t)=>{let s=(null==t?void 0:t.lines)!==void 0?"?lines=".concat(t.lines):"";return l("GET","/v1/nexus/tabs/".concat(encodeURIComponent(e),"/logs").concat(s))},subscribeEvents:e=>{var t,s;let r=null!=(t=e.EventSourceImpl)?t:globalThis.EventSource;if(!r)throw Error("EventSource not available \xb7 pass EventSourceImpl");let o=(null!=(s=e.topics)?s:[]).join(","),i="".concat(a,"/v1/events").concat(o?"?topics=".concat(encodeURIComponent(o)):""),l=new r(i),c=t=>{try{let s=JSON.parse(t.data);e.onEvent(s)}catch(t){var s;null==(s=e.onError)||s.call(e,t)}},d=["nexus.boot","nexus.shutdown","tab.created","tab.up","tab.down","tab.unhealthy","tab.restart","tab.halt","config.changed","workflow.approval.pending","workflow.approval.resolved","workflow.run.started","workflow.run.node-started","workflow.run.node-skipped","workflow.run.node-done","workflow.run.completed","workflow.run.failed","hitl.banner.show","hitl.banner.cancel","intent-prediction.ranking"],u=e.kinds?[...new Set([...d,...e.kinds])]:d;for(let e of(l.addEventListener("message",c),u))l.addEventListener(e,c);return l.addEventListener("error",()=>{var t;try{(0,n.cY)("nexus.sse.error",{url:i,readyState:l.readyState,connectionState:0===l.readyState?"reconnecting":2===l.readyState?"closed":"open"})}catch(e){}null==(t=e.onError)||t.call(e,Error("SSE error"))}),()=>{try{l.close()}catch(e){}}},subscribeLogs:(e,t)=>{var s;let r=null!=(s=t.EventSourceImpl)?s:globalThis.EventSource;if(!r)throw Error("EventSource not available \xb7 pass EventSourceImpl");let o="".concat(a,"/v1/nexus/tabs/").concat(encodeURIComponent(e),"/logs?stream=1"),i=new r(o),l=e=>{try{let s=JSON.parse(e.data);t.onLine(s)}catch(e){var s;null==(s=t.onError)||s.call(t,e)}};return i.addEventListener("message",l),i.addEventListener("log",l),i.addEventListener("error",()=>{var e;try{(0,n.cY)("nexus.sse.error",{url:o,readyState:i.readyState,connectionState:0===i.readyState?"reconnecting":2===i.readyState?"closed":"open"})}catch(e){}null==(e=t.onError)||e.call(t,Error("SSE error"))}),()=>{try{i.close()}catch(e){}}}}}},85351:(e,t,s)=>{"use strict";let n;s.d(t,{cY:()=>d,x8:()=>i});let r={debug:0,info:1,warn:2,error:3},a="/v1/debug-logs/batch",o=null;function i(e){o=e}class l{health(){return{pending:this.queue.length,consecutiveFailures:this.consecutiveFailures,lastOkAt:this.lastOkAt,droppedByCap:this.droppedByCap,fallbackBatches:this.fallbackBatches}}push(e){if(!(r[function(e){let t=e.slice(e.lastIndexOf(".")+1).toLowerCase();return/^(error|exception|crash|fail|failed)$/.test(t)?"error":/^(warn|degraded|timeout)$/.test(t)?"warn":/^(boot|ready|start|begin|open|ok|done|resolve|end|stop|close)$/.test(t)?"info":"debug"}(e.category)]<r[this.minLevel])){if(this.queue.push(e),this.queue.length>500){let e=this.queue.length-500;this.droppedByCap+=e,this.queue.splice(0,e)}null===this.timer&&(this.timer=setTimeout(()=>{this.flush()},100))}}async flush(){if(this.timer&&(clearTimeout(this.timer),this.timer=null),this.inFlight||0===this.queue.length)return;let e=this.queue.slice(0,100);this.inFlight=!0;let t=!1,s=JSON.stringify({records:e});try{var n,r;t=await (n=this.fetchFn(s),r=this.postTimeoutMs,new Promise((e,t)=>{let s=setTimeout(()=>t(Error("debug-forward timeout after ".concat(r,"ms"))),r);n.then(t=>{clearTimeout(s),e(t)},e=>{clearTimeout(s),t(e)})}))}catch(e){t=!1}finally{this.inFlight=!1}if(!t){if(this.consecutiveFailures+=1,this.consecutiveFailures>=2&&o)try{await o(JSON.stringify({records:[...e,this.blockedNotice()]}))&&(this.fallbackBatches+=1)}catch(e){}this.wasFailing=!0,this.scheduleRetry();return}let a=this.lastOkAt;this.lastOkAt=Date.now();let i=this.consecutiveFailures;this.consecutiveFailures=0,this.queue.splice(0,e.length),this.wasFailing&&(this.wasFailing=!1,this.queue.push({ts:new Date().toISOString(),category:"pwa.debug-forwarder.recovered",event:"recovered",data:{consecutiveFailures:i,droppedByCap:this.droppedByCap,fallbackBatches:this.fallbackBatches,pending:this.queue.length,previousOkAt:a},source:{platform:"pwa"}})),this.queue.length>0&&null===this.timer&&(this.timer=setTimeout(()=>{this.flush()},100))}scheduleRetry(){if(null!==this.timer||0===this.queue.length)return;let e=Math.min(100*2**this.consecutiveFailures,3e4);this.timer=setTimeout(()=>{this.flush()},e)}blockedNotice(){return{ts:new Date().toISOString(),category:"pwa.debug-forwarder.http-blocked",event:"http-blocked",data:{consecutiveFailures:this.consecutiveFailures,pending:this.queue.length,droppedByCap:this.droppedByCap,lastOkAt:this.lastOkAt,via:"acp-fallback"},source:{platform:"pwa"}}}beaconFlush(){if(0!==this.queue.length)try{if("undefined"!=typeof navigator&&"function"==typeof navigator.sendBeacon){let e=this.queue.slice(0,100),t=new Blob([JSON.stringify({records:e})],{type:"application/json"});navigator.sendBeacon(a,t)&&this.queue.splice(0,e.length)}}catch(e){}}get pending(){return this.queue.length}constructor(e=c,t="debug",s=1e4){this.fetchFn=e,this.minLevel=t,this.postTimeoutMs=s,this.queue=[],this.timer=null,this.inFlight=!1,this.consecutiveFailures=0,this.lastOkAt=null,this.droppedByCap=0,this.fallbackBatches=0,this.wasFailing=!1}}async function c(e){return(await fetch(a,{method:"POST",headers:{"content-type":"application/json"},body:e,keepalive:!0,..."undefined"!=typeof AbortSignal&&"function"==typeof AbortSignal.timeout?{signal:AbortSignal.timeout(1e4)}:{}})).ok}function d(e,t){if("undefined"==typeof console)return;let s=new Date().toISOString();if(void 0!==t){let n="";try{let e=new WeakSet;n=JSON.stringify(t,(t,s)=>{if("bigint"==typeof s)return"".concat(s.toString(),"n");if("function"==typeof s)return"[fn ".concat(s.name||"anon","]");if(s&&"object"==typeof s){if(e.has(s))return"[circular]";e.add(s)}return s})}catch(e){n="[unserializable: ".concat(String(e),"]")}n&&n.length>800&&(n=n.slice(0,797)+"..."),console.debug("[".concat(s,"] ").concat(e," ").concat(n),t),u(s,e,n)}else console.debug("[".concat(s,"] ").concat(e)),u(s,e,void 0)}function u(e,t,s){let r,a=function(){if(void 0!==n)return n;let e=function(){try{let e="off"!==window.localStorage.getItem("elanous.pwa.debug.forward"),t=window.localStorage.getItem("elanous.pwa.debug.forwardLevel");return{forward:e,level:"info"===t||"warn"===t||"error"===t?t:"debug"}}catch(e){return{forward:!0,level:"debug"}}}();if(!e.forward)return n=null,null;let t=new l(c,e.level);try{window.addEventListener("visibilitychange",()=>{"hidden"===document.visibilityState&&t.beaconFlush()})}catch(e){}return n=t,t}();if(!a)return;let o=t.slice(t.lastIndexOf(".")+1)||t;if(void 0!==s&&""!==s)try{r=JSON.parse(s)}catch(e){r=s}a.push({ts:e,category:t,event:o,...void 0!==r?{data:r}:{},source:{platform:"pwa"}})}},88866:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>T});var n=s(54728),r=s(8740),a=s(24206),o=s(3720);let i=(0,o.A)("activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);var l=s(23270);let c=(0,o.A)("folder-tree",[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]]);var d=s(33303),u=s(17342);let h=(0,o.A)("lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);var p=s(11076),m=s(46226),f=s(11565),g=s(2859),x=s(7024),v=s(63354),w=s(72127);let b={orphan:0,active:1,detached:2,idle:3,main:4},y={orphan:"Orphan",active:"Active",detached:"Detached",idle:"Idle",main:"Main"},k={orphan:"bg-error/10 text-error",active:"bg-green-600/10 text-green-700",detached:"bg-warning/10 text-warning",idle:"bg-muted text-muted-foreground",main:"bg-primary/10 text-primary"},j={orphan:a.A,active:i,detached:l.A,idle:c,main:c};function N(){return(0,m.Qj)()?(0,n.jsx)(E,{}):(0,n.jsxs)("div",{className:"mx-auto max-w-2xl space-y-2 p-6",children:[(0,n.jsx)("h1",{className:"text-xl font-semibold tracking-tight",children:"Worktrees"}),(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"Connect to a NEXUS daemon to see active worktrees."})]})}function E(){var e,t,s,o;let{data:i,isLoading:l,error:N,refetch:E,isFetching:T}=function(){var e;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},s=(0,m.M1)();return(0,f.I)({queryKey:v.AF.worktrees(),queryFn:()=>s.getWorktrees(),enabled:null==(e=t.enabled)||e,refetchInterval:5e3})}(),C=function(){let e=(0,m.M1)(),t=(0,g.jE)();return(0,x.n)({mutationFn:async t=>{try{return await e.disposeWorktree(t)}catch(t){let e=function(e){if(e instanceof w.I&&e.body&&"object"==typeof e.body){let t=e.body;if("ok"in t)return t}return null}(t);if(e)return e;throw t}},onSuccess:e=>{e.ok&&t.invalidateQueries({queryKey:v.AF.worktrees()})}})}(),[O,M]=(0,r.useState)(null),R=null!=(e=null==i?void 0:i.repoRoot)?e:null,A=null!=(t=null==i?void 0:i.worktrees)?t:[],I=null!=(s=null==i?void 0:i.orphanedSessions)?s:[],P=A.map(e=>({view:e,status:e.orphan?"orphan":e.isMain?"main":e.isDetached?"detached":e.session&&e.session.alive?"active":"idle"})).sort((e,t)=>{var s,n,r,a;let o=null!=(s=b[e.status])?s:99,i=null!=(n=b[t.status])?n:99;if(o!==i)return o-i;let l=null!=(r=e.view.branch)?r:"~detached",c=null!=(a=t.view.branch)?a:"~detached";return l.localeCompare(c)}),U=function(e){let t={total:e.length,active:0,orphan:0,idle:0,detached:0,main:0};for(let s of e)t[s.status]+=1;return t}(P),F=Date.now(),G=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=!0===t.force,n=s?"Force-remove this worktree (will discard local changes)?\n\n".concat(e):t.locked?"This worktree is locked. Removing it will fail unless you force.\nProceed with --force?\n\n".concat(e):"Remove this worktree?\n\n".concat(e);if(!window.confirm(n))return;let r=await C.mutateAsync({path:e,force:s||!0===t.locked});M({path:e,result:r})};return(0,n.jsxs)("div",{className:"mx-auto max-w-5xl space-y-4 p-6",children:[(0,n.jsxs)("header",{className:"space-y-1",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsxs)("h1",{className:"flex items-center gap-2 text-xl font-semibold tracking-tight",children:[(0,n.jsx)(c,{className:"h-5 w-5"}),"Worktrees"]}),(0,n.jsxs)("button",{type:"button",onClick:()=>E(),disabled:T,"aria-label":"Refresh worktrees",className:"flex items-center gap-1 rounded-md border border-border px-2 py-1 text-[11px] hover:bg-surface-elevated disabled:opacity-50",children:[(0,n.jsx)(d.A,{className:"h-3 w-3 ".concat(T?"animate-spin":"")}),"Refresh"]})]}),R?(0,n.jsx)("p",{className:"text-[11px] font-mono text-muted-foreground",children:R}):(0,n.jsx)("p",{className:"text-[11px] text-muted-foreground",children:"Not inside a git repo (NEXUS launched outside a checkout). Worktree list will be empty."})]}),N&&(0,n.jsxs)("p",{className:"flex items-center gap-1 text-[11px] text-error",children:[(0,n.jsx)(u.A,{className:"h-3 w-3"}),N instanceof Error?N.message:"Failed to load worktrees"]}),l&&!i&&(0,n.jsx)("p",{className:"text-[11px] text-muted-foreground",children:"Querying /v1/worktrees…"}),i&&(0,n.jsx)(S,{summary:U}),O&&(0,n.jsx)("div",{"data-testid":"worktree-dispose-result","data-result-status":O.result.ok?"ok":"error",className:"rounded-md border px-2.5 py-1.5 text-[11px] ".concat(O.result.ok?"border-green-600/40 bg-green-600/5 text-green-700":"border-error/40 bg-error/5 text-error"),children:(0,n.jsxs)("div",{className:"flex items-baseline justify-between gap-2",children:[(0,n.jsxs)("span",{children:[O.result.ok?"".concat("orphan-session-cleanup"===O.result.action?"Cleared orphan session":"Removed worktree"," — ").concat(O.path):"Dispose failed — ".concat(null!=(o=O.result.error)?o:"unknown error"),O.result.detail&&(0,n.jsxs)("span",{className:"ml-1 font-mono text-[10px] opacity-80",children:["(",O.result.detail,")"]})]}),(0,n.jsx)("button",{type:"button",onClick:()=>M(null),className:"text-[10px] underline opacity-70 hover:opacity-100",children:"dismiss"})]})}),i&&P.length>0&&(0,n.jsx)("section",{"data-testid":"worktree-list",className:"overflow-x-auto rounded-md border border-border",children:(0,n.jsxs)("table",{className:"min-w-full text-[11px]",children:[(0,n.jsx)("thead",{className:"bg-surface-elevated",children:(0,n.jsxs)("tr",{children:[(0,n.jsx)("th",{className:"px-2 py-1.5 text-left font-medium",children:"Status"}),(0,n.jsx)("th",{className:"px-2 py-1.5 text-left font-medium",children:"Branch"}),(0,n.jsx)("th",{className:"px-2 py-1.5 text-left font-medium",children:"Path"}),(0,n.jsx)("th",{className:"px-2 py-1.5 text-left font-medium",children:"SHA"}),(0,n.jsx)("th",{className:"px-2 py-1.5 text-left font-medium",children:"Owner"}),(0,n.jsx)("th",{className:"px-2 py-1.5 text-left font-medium",children:"Entered"}),(0,n.jsx)("th",{className:"px-2 py-1.5 text-right font-medium",children:"Actions"})]})}),(0,n.jsx)("tbody",{children:P.map(e=>{var t;let{view:s,status:r}=e,a=j[r];return(0,n.jsxs)("tr",{"data-testid":"worktree-row-".concat(s.path),"data-status":r,className:"border-t border-border",children:[(0,n.jsxs)("td",{className:"px-2 py-1.5",children:[(0,n.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full px-1.5 py-0.5 text-[9px] font-medium uppercase tracking-wider ".concat(k[r]),children:[(0,n.jsx)(a,{className:"h-3 w-3"}),y[r]]}),s.isLocked&&(0,n.jsx)("span",{title:"locked",className:"ml-1 inline-flex items-center text-warning",children:(0,n.jsx)(h,{className:"h-3 w-3"})})]}),(0,n.jsx)("td",{className:"px-2 py-1.5 font-mono",children:null!=(t=s.branch)?t:(0,n.jsx)("span",{className:"text-muted-foreground",children:"—"})}),(0,n.jsx)("td",{className:"px-2 py-1.5 font-mono text-[10px] text-muted-foreground",children:s.path}),(0,n.jsx)("td",{className:"px-2 py-1.5 font-mono text-[10px] text-muted-foreground",children:s.sha.slice(0,7)}),(0,n.jsx)("td",{className:"px-2 py-1.5",children:s.session?(0,n.jsxs)("span",{className:"text-[10px] ".concat(s.session.alive?"text-foreground":"text-error"),children:["pid ",s.session.sessionId,s.session.alive?" (alive)":" (dead — orphan)"]}):(0,n.jsx)("span",{className:"text-[10px] text-muted-foreground",children:"—"})}),(0,n.jsx)("td",{className:"px-2 py-1.5 text-[10px] text-muted-foreground",children:s.session?function(e,t){if(void 0===t)return"";let s=Math.floor(Math.max(0,e-t)/1e3);if(s<60)return"".concat(s,"s ago");let n=Math.floor(s/60);if(n<60)return"".concat(n,"m ago");let r=Math.floor(n/60);if(r<24)return"".concat(r,"h ago");let a=Math.floor(r/24);return"".concat(a,"d ago")}(F,s.session.enteredAt):""}),(0,n.jsx)("td",{className:"px-2 py-1.5 text-right",children:s.isMain?(0,n.jsx)("span",{className:"text-[10px] text-muted-foreground",children:"—"}):(0,n.jsxs)("button",{type:"button","data-testid":"dispose-worktree-".concat(s.path),onClick:()=>G(s.path,{locked:s.isLocked}),disabled:C.isPending,className:"inline-flex items-center gap-1 rounded-md border border-border px-1.5 py-0.5 text-[10px] text-error hover:bg-error/10 disabled:opacity-50","aria-label":"Dispose worktree ".concat(s.path),children:[(0,n.jsx)(p.A,{className:"h-3 w-3"}),"Dispose"]})})]},s.path)})})]})}),i&&0===P.length&&(0,n.jsx)("p",{className:"text-[11px] text-muted-foreground","data-testid":"worktree-empty",children:"No worktrees registered."}),i&&I.length>0&&(0,n.jsxs)("section",{"data-testid":"orphaned-sessions",className:"space-y-1",children:[(0,n.jsxs)("h2",{className:"flex items-center gap-1 text-sm font-medium text-warning",children:[(0,n.jsx)(a.A,{className:"h-4 w-4"}),"Orphaned sessions (",I.length,")"]}),(0,n.jsxs)("p",{className:"text-[10px] text-muted-foreground",children:["Worktree directory was removed (e.g., via ",(0,n.jsx)("code",{children:"git worktree remove"}),") but the session JSON wasn't cleaned. Boot-time stale-cleanup will reap these the next time NEXUS restarts."]}),(0,n.jsx)("ul",{className:"space-y-1 text-[11px]",children:I.map(e=>(0,n.jsxs)("li",{"data-testid":"orphan-session-".concat(e.sessionId),className:"rounded-md border border-warning/40 bg-warning/5 px-2 py-1.5",children:[(0,n.jsxs)("div",{className:"flex items-baseline justify-between gap-2",children:[(0,n.jsxs)("div",{children:[(0,n.jsxs)("span",{className:"font-mono",children:["pid ",e.sessionId]})," ",(0,n.jsxs)("span",{className:"text-muted-foreground",children:["(",e.alive?"alive (unusual)":"dead",")"]})]}),(0,n.jsxs)("button",{type:"button","data-testid":"cleanup-orphan-".concat(e.sessionId),onClick:()=>G(e.worktreePath),disabled:C.isPending,className:"inline-flex items-center gap-1 rounded-md border border-border px-1.5 py-0.5 text-[10px] text-error hover:bg-error/10 disabled:opacity-50","aria-label":"Clear orphan session ".concat(e.sessionId),children:[(0,n.jsx)(p.A,{className:"h-3 w-3"}),"Cleanup"]})]}),(0,n.jsxs)("div",{className:"font-mono text-[10px] text-muted-foreground",children:["branch ",(0,n.jsx)("strong",{children:e.branch})," \xb7 ",e.worktreePath]})]},e.sessionId))})]})]})}function S(e){let{summary:t}=e,s=[{label:"Total",value:t.total,cls:"text-foreground"},{label:"Active",value:t.active,cls:"text-green-700"},{label:"Orphan",value:t.orphan,cls:"text-error"},{label:"Idle",value:t.idle,cls:"text-muted-foreground"},{label:"Detached",value:t.detached,cls:"text-warning"}];return(0,n.jsx)("div",{"data-testid":"worktree-summary",className:"flex flex-wrap items-baseline gap-3 text-[11px]",children:s.map(e=>(0,n.jsxs)("span",{className:"flex items-baseline gap-1",children:[(0,n.jsx)("span",{className:"text-muted-foreground",children:e.label}),(0,n.jsx)("span",{className:"font-medium ".concat(e.cls),children:e.value})]},e.label))})}function T(){return(0,n.jsx)(N,{})}}},e=>{e.O(0,[5508,6852,9096,1380,7358],()=>e(e.s=64658)),_N_E=e.O()}]);