elanous 0.2.5 → 0.2.7

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 (479) hide show
  1. package/.env.example +10 -7
  2. package/README.md +9 -4
  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/1105-c473ed46272fba79.js +1 -0
  6. package/apps/pwa/out/_next/static/chunks/1201-09613bce624467c0.js +1 -0
  7. package/apps/pwa/out/_next/static/chunks/1377-1efeffbbac0963ff.js +1 -0
  8. package/apps/pwa/out/_next/static/chunks/1470.98a6ab61ccb4131c.js +1 -0
  9. package/apps/pwa/out/_next/static/chunks/216-5acd01cbde4acda7.js +1 -0
  10. package/apps/pwa/out/_next/static/chunks/2330-c2f07246c8788af1.js +1 -0
  11. package/apps/pwa/out/_next/static/chunks/{5391-8793f88b03b30161.js → 2375-cb6debea56cce4fb.js} +1 -1
  12. package/apps/pwa/out/_next/static/chunks/{1751.50b96ea9c37b49b6.js → 2415.ed6428ff334c7ce2.js} +1 -1
  13. package/apps/pwa/out/_next/static/chunks/2929-617f1e66a55be184.js +1 -0
  14. package/apps/pwa/out/_next/static/chunks/2977-e38442e86289f1d3.js +1 -0
  15. package/apps/pwa/out/_next/static/chunks/2982-2a2df543be3d2e5a.js +25 -0
  16. package/apps/pwa/out/_next/static/chunks/{4daa2798-1363d725c79f3593.js → 2ea96958-e8c7e112de50b067.js} +1 -1
  17. package/apps/pwa/out/_next/static/chunks/3403.4bc97b4066945a94.js +5 -0
  18. package/apps/pwa/out/_next/static/chunks/3441-a1dd4acfeda14488.js +1 -0
  19. package/apps/pwa/out/_next/static/chunks/371-4ad6af55dad02ced.js +1 -0
  20. package/apps/pwa/out/_next/static/chunks/4114-3e63117452378807.js +1 -0
  21. package/apps/pwa/out/_next/static/chunks/{8617.465ca22a319c95b3.js → 4323.c5dfb6f503304775.js} +1 -1
  22. package/apps/pwa/out/_next/static/chunks/4836-2eba6079f31b88d4.js +1 -0
  23. package/apps/pwa/out/_next/static/chunks/{8918-482b30ce2a8ebf4c.js → 5080-1613752891fcadb4.js} +3 -3
  24. package/apps/pwa/out/_next/static/chunks/5609-012bb3557211f07e.js +1 -0
  25. package/apps/pwa/out/_next/static/chunks/{5348-bbf838e119661eee.js → 5791-bb82743fa6299562.js} +1 -1
  26. package/apps/pwa/out/_next/static/chunks/{9704-3221c102623c8d73.js → 6062-73e68343a9814f6a.js} +1 -1
  27. package/apps/pwa/out/_next/static/chunks/{4440-18bb160d95819f4e.js → 6090-85a3f05f954e5697.js} +1 -1
  28. package/apps/pwa/out/_next/static/chunks/6284-69db415193d5f8bd.js +1 -0
  29. package/apps/pwa/out/_next/static/chunks/6320-baac91d68843a9a6.js +1 -0
  30. package/apps/pwa/out/_next/static/chunks/6416-505ba707cacafbba.js +1 -0
  31. package/apps/pwa/out/_next/static/chunks/6725-68ab7cc0b1faf00d.js +1 -0
  32. package/apps/pwa/out/_next/static/chunks/6998-a654fe5c58271600.js +1 -0
  33. package/apps/pwa/out/_next/static/chunks/7647.2fcd30d894d5ee30.js +1 -0
  34. package/apps/pwa/out/_next/static/chunks/7673-2eda1507d38dadb8.js +1 -0
  35. package/apps/pwa/out/_next/static/chunks/7990-e12efba616f46e03.js +1 -0
  36. package/apps/pwa/out/_next/static/chunks/{f6f3850d-7f324c6566002113.js → 8046cadf-211ca3c0e00f2b72.js} +1 -1
  37. package/apps/pwa/out/_next/static/chunks/8067-f74bf14d67ad98f1.js +1 -0
  38. package/apps/pwa/out/_next/static/chunks/8142-744998d65d7bb17e.js +1 -0
  39. package/apps/pwa/out/_next/static/chunks/8519-f6b5d8a5833a7603.js +1 -0
  40. package/apps/pwa/out/_next/static/chunks/8619-4365e03a2862830f.js +1 -0
  41. package/apps/pwa/out/_next/static/chunks/8894-e92491a164192cc1.js +1 -0
  42. package/apps/pwa/out/_next/static/chunks/920-f7dceb78f1c585ef.js +1 -0
  43. package/apps/pwa/out/_next/static/chunks/9454-a3e0953307216c58.js +1 -0
  44. package/apps/pwa/out/_next/static/chunks/9651-3cd291a6fa1370d2.js +1 -0
  45. package/apps/pwa/out/_next/static/chunks/9740-67051141115ce775.js +1 -0
  46. package/apps/pwa/out/_next/static/chunks/9804-64c02c3c127d5014.js +1 -0
  47. package/apps/pwa/out/_next/static/chunks/ae787e4c-f2998de7f1ba72a4.js +1 -0
  48. package/apps/pwa/out/_next/static/chunks/app/_not-found/page-859cea1570b6227a.js +1 -0
  49. package/apps/pwa/out/_next/static/chunks/app/approvals/page-d5ebde04844689e6.js +1 -0
  50. package/apps/pwa/out/_next/static/chunks/app/autopilot/{page-f89e9a303515a033.js → page-10ed24f413ed66e9.js} +1 -1
  51. package/apps/pwa/out/_next/static/chunks/app/board/{page-4f403cd060442c95.js → page-211810b6c93ab66a.js} +1 -1
  52. package/apps/pwa/out/_next/static/chunks/app/botlab/{page-0ac5d053f0444d21.js → page-624f7a2f89b60c8f.js} +1 -1
  53. package/apps/pwa/out/_next/static/chunks/app/bots/page-5a5fb385a4df0ffe.js +1 -0
  54. package/apps/pwa/out/_next/static/chunks/app/chat/page-80497e93a878ddc5.js +1 -0
  55. package/apps/pwa/out/_next/static/chunks/app/consult/page-7457f52683562161.js +1 -0
  56. package/apps/pwa/out/_next/static/chunks/app/control/page-cee86394de407aa6.js +1 -0
  57. package/apps/pwa/out/_next/static/chunks/app/design-check/page-4ff8edab44196b8c.js +1 -0
  58. package/apps/pwa/out/_next/static/chunks/app/editor/page-92e4f44428d5e290.js +1 -0
  59. package/apps/pwa/out/_next/static/chunks/app/exec/page-b7dcf5d48a854b76.js +1 -0
  60. package/apps/pwa/out/_next/static/chunks/app/field/page-51480757e7d68b92.js +1 -0
  61. package/apps/pwa/out/_next/static/chunks/app/healthz/route-859cea1570b6227a.js +1 -0
  62. package/apps/pwa/out/_next/static/chunks/app/intake/page-2a05dfe80c8bdf16.js +1 -0
  63. package/apps/pwa/out/_next/static/chunks/app/layout-d9979633aa82f8e6.js +1 -0
  64. package/apps/pwa/out/_next/static/chunks/app/live/page-30533117beb53625.js +1 -0
  65. package/apps/pwa/out/_next/static/chunks/app/market/page-f7857826c2f97ad7.js +1 -0
  66. package/apps/pwa/out/_next/static/chunks/app/missions/[id]/page-07267f1391b96aba.js +1 -0
  67. package/apps/pwa/out/_next/static/chunks/app/morning/{page-bccce0babceae30f.js → page-55d50e9b0006a91d.js} +1 -1
  68. package/apps/pwa/out/_next/static/chunks/app/not-found-9699b1786be6171d.js +1 -0
  69. package/apps/pwa/out/_next/static/chunks/app/observatory/page-43dd772aee8af75f.js +1 -0
  70. package/apps/pwa/out/_next/static/chunks/app/page-a7e37af7d0399cb8.js +1 -0
  71. package/apps/pwa/out/_next/static/chunks/app/reflection/page-973ab7af59c718b7.js +1 -0
  72. package/apps/pwa/out/_next/static/chunks/app/scheduler/page-a9f8d3865b91e436.js +1 -0
  73. package/apps/pwa/out/_next/static/chunks/app/sessions/page-15e5a15db84c56aa.js +1 -0
  74. package/apps/pwa/out/_next/static/chunks/app/settings/devices/page-a2e572e4511f2a16.js +1 -0
  75. package/apps/pwa/out/_next/static/chunks/app/settings/page-dd107bf1c7d52a90.js +1 -0
  76. package/apps/pwa/out/_next/static/chunks/app/setup/done/page-d42b99cdfb9f27c6.js +1 -0
  77. package/apps/pwa/out/_next/static/chunks/app/setup/layout-859cea1570b6227a.js +1 -0
  78. package/apps/pwa/out/_next/static/chunks/app/setup/page-2764ff40dad5a995.js +1 -0
  79. package/apps/pwa/out/_next/static/chunks/app/share/page-c5f1152db116ff96.js +1 -0
  80. package/apps/pwa/out/_next/static/chunks/app/showroom/page-f933bca81ea38a6f.js +1 -0
  81. package/apps/pwa/out/_next/static/chunks/app/tasks/page-c1c95739c0bff3b8.js +1 -0
  82. package/apps/pwa/out/_next/static/chunks/app/term/page-a7aaffcf771662d8.js +1 -0
  83. package/apps/pwa/out/_next/static/chunks/app/trace/page-71d18eec33b9c667.js +1 -0
  84. package/apps/pwa/out/_next/static/chunks/app/vault/page-56adbe1a1f1379bd.js +1 -0
  85. package/apps/pwa/out/_next/static/chunks/app/workflows/chat-ui/page-2c4e59079ee357ac.js +1 -0
  86. package/apps/pwa/out/_next/static/chunks/app/workflows/page-a81f113f3ef89d72.js +1 -0
  87. package/apps/pwa/out/_next/static/chunks/app/workspace/page-5d422f38c052967e.js +1 -0
  88. package/apps/pwa/out/_next/static/chunks/app/worktrees/page-fc27b00e20733146.js +1 -0
  89. package/apps/pwa/out/_next/static/chunks/framework-ea806bb57f2b8923.js +1 -0
  90. package/apps/pwa/out/_next/static/chunks/main-8d2302399c2c8f87.js +1 -0
  91. package/apps/pwa/out/_next/static/chunks/main-app-6870f30ea99f8346.js +1 -0
  92. package/apps/pwa/out/_next/static/chunks/pages/_app-b10928c60f0b8488.js +1 -0
  93. package/apps/pwa/out/_next/static/chunks/pages/_error-689039227d443fab.js +1 -0
  94. package/apps/pwa/out/_next/static/chunks/{webpack-2bf59c720fe9542c.js → webpack-e5bea36f183b25e6.js} +1 -1
  95. package/apps/pwa/out/_next/static/css/f537bdb19c69306a.css +1 -0
  96. package/apps/pwa/out/_next/static/keajW7DDyghEs1y8oJe6T/_buildManifest.js +1 -0
  97. package/apps/pwa/out/approvals/index.html +1 -1
  98. package/apps/pwa/out/approvals/index.txt +22 -22
  99. package/apps/pwa/out/autopilot/index.html +1 -1
  100. package/apps/pwa/out/autopilot/index.txt +22 -22
  101. package/apps/pwa/out/board/index.html +1 -1
  102. package/apps/pwa/out/board/index.txt +22 -22
  103. package/apps/pwa/out/botlab/index.html +1 -1
  104. package/apps/pwa/out/botlab/index.txt +21 -21
  105. package/apps/pwa/out/bots/index.html +1 -1
  106. package/apps/pwa/out/bots/index.txt +21 -21
  107. package/apps/pwa/out/chat/index.html +1 -1
  108. package/apps/pwa/out/chat/index.txt +21 -21
  109. package/apps/pwa/out/consult/index.html +1 -0
  110. package/apps/pwa/out/consult/index.txt +32 -0
  111. package/apps/pwa/out/control/index.html +1 -1
  112. package/apps/pwa/out/control/index.txt +22 -22
  113. package/apps/pwa/out/design-check/index.html +1 -1
  114. package/apps/pwa/out/design-check/index.txt +22 -22
  115. package/apps/pwa/out/editor/index.html +1 -1
  116. package/apps/pwa/out/editor/index.txt +22 -22
  117. package/apps/pwa/out/exec/index.html +1 -0
  118. package/apps/pwa/out/exec/index.txt +32 -0
  119. package/apps/pwa/out/field/index.html +1 -0
  120. package/apps/pwa/out/field/index.txt +32 -0
  121. package/apps/pwa/out/healthz +1 -1
  122. package/apps/pwa/out/icons/elanous-16.png +0 -0
  123. package/apps/pwa/out/icons/elanous-180.png +0 -0
  124. package/apps/pwa/out/icons/elanous-192.png +0 -0
  125. package/apps/pwa/out/icons/elanous-32.png +0 -0
  126. package/apps/pwa/out/icons/elanous-512.png +0 -0
  127. package/apps/pwa/out/index.html +1 -1
  128. package/apps/pwa/out/index.txt +21 -21
  129. package/apps/pwa/out/intake/index.html +1 -1
  130. package/apps/pwa/out/intake/index.txt +22 -22
  131. package/apps/pwa/out/live/index.html +1 -1
  132. package/apps/pwa/out/live/index.txt +22 -22
  133. package/apps/pwa/out/market/index.html +1 -1
  134. package/apps/pwa/out/market/index.txt +21 -21
  135. package/apps/pwa/out/missions/placeholder/index.html +1 -1
  136. package/apps/pwa/out/missions/placeholder/index.txt +21 -21
  137. package/apps/pwa/out/morning/index.html +1 -1
  138. package/apps/pwa/out/morning/index.txt +22 -22
  139. package/apps/pwa/out/observatory/index.html +1 -1
  140. package/apps/pwa/out/observatory/index.txt +22 -22
  141. package/apps/pwa/out/reflection/index.html +1 -1
  142. package/apps/pwa/out/reflection/index.txt +22 -22
  143. package/apps/pwa/out/scheduler/index.html +1 -1
  144. package/apps/pwa/out/scheduler/index.txt +22 -22
  145. package/apps/pwa/out/sessions/index.html +1 -1
  146. package/apps/pwa/out/sessions/index.txt +21 -21
  147. package/apps/pwa/out/settings/devices/index.html +1 -1
  148. package/apps/pwa/out/settings/devices/index.txt +22 -22
  149. package/apps/pwa/out/settings/index.html +1 -1
  150. package/apps/pwa/out/settings/index.txt +22 -22
  151. package/apps/pwa/out/setup/done/index.html +1 -1
  152. package/apps/pwa/out/setup/done/index.txt +22 -22
  153. package/apps/pwa/out/setup/index.html +1 -1
  154. package/apps/pwa/out/setup/index.txt +22 -22
  155. package/apps/pwa/out/share/index.html +1 -1
  156. package/apps/pwa/out/share/index.txt +22 -22
  157. package/apps/pwa/out/showroom/index.html +1 -1
  158. package/apps/pwa/out/showroom/index.txt +21 -21
  159. package/apps/pwa/out/tasks/index.html +1 -1
  160. package/apps/pwa/out/tasks/index.txt +22 -22
  161. package/apps/pwa/out/term/index.html +1 -1
  162. package/apps/pwa/out/term/index.txt +22 -22
  163. package/apps/pwa/out/trace/index.html +1 -1
  164. package/apps/pwa/out/trace/index.txt +22 -22
  165. package/apps/pwa/out/vault/index.html +1 -1
  166. package/apps/pwa/out/vault/index.txt +22 -22
  167. package/apps/pwa/out/workflows/chat-ui/index.html +1 -1
  168. package/apps/pwa/out/workflows/chat-ui/index.txt +22 -22
  169. package/apps/pwa/out/workflows/index.html +1 -1
  170. package/apps/pwa/out/workflows/index.txt +22 -22
  171. package/apps/pwa/out/workspace/index.html +1 -1
  172. package/apps/pwa/out/workspace/index.txt +22 -22
  173. package/apps/pwa/out/worktrees/index.html +1 -1
  174. package/apps/pwa/out/worktrees/index.txt +22 -22
  175. package/bin/elanous.cjs +107 -0
  176. package/graphs/field/field-feed.yaml +24 -0
  177. package/graphs/field/recipes.yaml +12 -0
  178. package/graphs/landing/landing-heal.yaml +3 -1
  179. package/graphs/landing/recipes.yaml +3 -0
  180. package/graphs/release/recipes.yaml +13 -0
  181. package/graphs/release/release-loop.yaml +13 -4
  182. package/package.json +5 -5
  183. package/plugins/card-followup/README.md +42 -0
  184. package/plugins/card-followup/examples/card-sample.json +7 -0
  185. package/plugins/card-followup/graphs/card-followup.yaml +18 -0
  186. package/plugins/card-followup/graphs/recipes.yaml +16 -0
  187. package/plugins/card-followup/graphs/run-step.ts +276 -0
  188. package/plugins/card-followup/graphs/sales-strategy.ts +173 -0
  189. package/plugins/card-followup/plugin.json +25 -0
  190. package/plugins/doc-draft/README.md +13 -0
  191. package/plugins/doc-draft/examples/brief-sample.json +8 -0
  192. package/plugins/doc-draft/graphs/doc-draft.yaml +14 -0
  193. package/plugins/doc-draft/graphs/recipes.yaml +9 -0
  194. package/plugins/doc-draft/graphs/run-step.ts +113 -0
  195. package/plugins/doc-draft/plugin.json +24 -0
  196. package/plugins/geo-check/README.md +15 -0
  197. package/plugins/geo-check/examples/brand-sample.json +8 -0
  198. package/plugins/geo-check/graphs/geo-check.yaml +20 -0
  199. package/plugins/geo-check/graphs/recipes.yaml +18 -0
  200. package/plugins/geo-check/graphs/run-step.ts +198 -0
  201. package/plugins/geo-check/plugin.json +24 -0
  202. package/plugins/job-coach/.codex-plugin/plugin.json +1 -1
  203. package/plugins/job-coach/README.md +31 -1
  204. package/plugins/job-coach/graphs/run-step.ts +2 -2
  205. package/plugins/job-coach/plugin.json +1 -1
  206. package/plugins/job-coach/plugin.ts +1 -1
  207. package/scripts/affinity/endcard.sh +3 -2
  208. package/scripts/affinity/reframe.sh +3 -1
  209. package/scripts/ci-public-export-leak-gate.ts +48 -0
  210. package/scripts/codex-quota-alert.ts +122 -258
  211. package/scripts/coord-tracks.json +4 -4
  212. package/scripts/daemon-port-baseline.txt +1 -2
  213. package/scripts/field-feed/deliver-node.ts +52 -0
  214. package/scripts/field-feed/feed-node.ts +67 -0
  215. package/scripts/field-feed/lib.ts +162 -0
  216. package/scripts/field-feed/reel-node.ts +24 -0
  217. package/scripts/field-feed/start.ts +62 -0
  218. package/scripts/fixtures/vflow-sample.ndjson +6 -0
  219. package/scripts/install.sh +92 -13
  220. package/scripts/landing-heal/clean-checkout.ts +114 -0
  221. package/scripts/landing-heal/run-mission.ts +38 -3
  222. package/scripts/lib/android-test-device.ts +32 -0
  223. package/scripts/lib/pwa-scenarios/scenarios.ts +2 -1
  224. package/scripts/public-export.ts +8 -4
  225. package/scripts/release-loop/baseline-from-logs.ts +92 -0
  226. package/scripts/release-loop/checklist-gate-node.ts +35 -0
  227. package/scripts/release-loop/env-known-failures.ts +31 -0
  228. package/scripts/release-loop/gate-diff.ts +29 -0
  229. package/scripts/release-loop/gate-node.ts +124 -29
  230. package/scripts/release-loop/known-issues-node.ts +159 -0
  231. package/scripts/release-loop/npm-publish-node.ts +118 -0
  232. package/scripts/release-loop/ops-upgrade-node.ts +87 -0
  233. package/scripts/release-loop/release-readiness.ts +58 -0
  234. package/scripts/release-loop/shard-plan.ts +47 -0
  235. package/scripts/release-loop/unattended-release.ts +93 -0
  236. package/scripts/ux/measure-first-text.ts +102 -0
  237. package/scripts/ux/record-page.ts +4 -1
  238. package/scripts/vflow-collect.ts +20 -7
  239. package/scripts/vflow-search.ts +73 -0
  240. package/scripts/video-free-line-test-walker.ts +36 -0
  241. package/scripts/video-pipeline.ts +2 -2
  242. package/skills/explainer-video/SKILL.md +24 -3
  243. package/skills/explainer-video/engine/brand/elanous-mark-on-dark.svg +1 -1
  244. package/skills/explainer-video/engine/build.mjs +2 -2
  245. package/skills/explainer-video/engine/reel.mjs +235 -0
  246. package/skills/explainer-video/engine/reel.sh +9 -0
  247. package/skills/explainer-video/engine/vo.ts +58 -16
  248. package/skills/explainer-video/examples/elanous-0.2.5/script.json +1 -1
  249. package/skills/grill-me/SKILL.md +1 -1
  250. package/skills/omni-digest/docs/diagrams/noncode-terminal-promotion-path-2026-08-13.mmd +1 -1
  251. package/src/a2a/server.ts +2 -0
  252. package/src/acp/elanous-aware-peers.ts +30 -0
  253. package/src/acp/server.ts +91 -15
  254. package/src/agent/monad-agent-turn.ts +25 -6
  255. package/src/agent/shared-app-tools.ts +5 -3
  256. package/src/agent-substrate/review-intent.ts +6 -2
  257. package/src/agent-substrate/shard-boundary-intent.ts +70 -0
  258. package/src/auth/github-app-token.ts +4 -1
  259. package/src/autopilot/mission-origin.ts +20 -4
  260. package/src/autopilot/mission-phase-track.ts +11 -1
  261. package/src/autopilot/track-agent-shadow.ts +151 -0
  262. package/src/autopilot/track-agent.ts +26 -6
  263. package/src/autopilot/track-courier.ts +2 -2
  264. package/src/boot/acp-server-help.ts +16 -0
  265. package/src/boot/daemon-prompt-turn.ts +31 -10
  266. package/src/boot/daemon-tools/index.ts +7 -1
  267. package/src/budget/codex-credit-pace.ts +84 -0
  268. package/src/budget/codex-credit-plan.ts +154 -0
  269. package/src/budget/codex-reset-credit-state.ts +2 -0
  270. package/src/chat/chat-cli.ts +4 -1
  271. package/src/chat/short-question.ts +40 -0
  272. package/src/cli/agent-cli.ts +24 -15
  273. package/src/cli/ask-bare.ts +42 -0
  274. package/src/cli/cli-user-error.ts +25 -0
  275. package/src/cli/codex-credit-plan-view.ts +25 -0
  276. package/src/cli/dependence-gauge.ts +237 -0
  277. package/src/cli/doctor-cli.ts +5 -0
  278. package/src/cli/doctor-modes.ts +48 -0
  279. package/src/cli/intake-cli.ts +12 -2
  280. package/src/cli/intake-source-cli.ts +58 -0
  281. package/src/cli/machine-cli.ts +23 -0
  282. package/src/cli/msg-cli.ts +137 -0
  283. package/src/cli/nexus-ios-bind.ts +25 -8
  284. package/src/cli/phone-link.ts +117 -0
  285. package/src/cli/plugin-cli.ts +52 -0
  286. package/src/cli/pr-cli.ts +36 -0
  287. package/src/cli/private-ledger-commands.ts +31 -0
  288. package/src/cli/provider-cli.ts +5 -0
  289. package/src/cli/release-cli.ts +56 -12
  290. package/src/cli/release-run-if-ready.ts +48 -0
  291. package/src/cli/setup-cli.ts +27 -6
  292. package/src/cli/setup-recommend.ts +8 -0
  293. package/src/cli/usage-cli.ts +11 -1
  294. package/src/codex/setup.ts +27 -8
  295. package/src/dashboard/index.ts +1 -1
  296. package/src/discord.ts +56 -6
  297. package/src/domains/core-tools.ts +37 -14
  298. package/src/domains/outbound-alert.ts +55 -16
  299. package/src/exec-requests/planner.ts +140 -0
  300. package/src/exec-requests/runner.ts +338 -0
  301. package/src/exec-requests/store.ts +76 -0
  302. package/src/field/field-media.ts +250 -0
  303. package/src/field/field-reel.ts +196 -0
  304. package/src/grok/credential.ts +7 -5
  305. package/src/harness/aside-run-status.ts +33 -0
  306. package/src/harness/browser-verify.ts +48 -17
  307. package/src/harness/harness-cli-command.ts +25 -3
  308. package/src/harness/image-load-state.ts +21 -0
  309. package/src/harness/process-garbage.ts +45 -0
  310. package/src/index.ts +104 -38
  311. package/src/instance/leader.ts +13 -1
  312. package/src/intake-plane/collect-github.ts +5 -3
  313. package/src/intake-plane/collect-telegram-saved.ts +15 -3
  314. package/src/intake-plane/discord-seat-work.ts +56 -0
  315. package/src/intake-plane/intake-sources.ts +202 -0
  316. package/src/intake-plane/items.ts +28 -12
  317. package/src/intake-plane/seat-doc-route.ts +207 -0
  318. package/src/intake-plane/submit-intake-work.ts +9 -1
  319. package/src/intake-plane/telegram-seat-work.ts +72 -0
  320. package/src/llm/model-defaults.ts +24 -1
  321. package/src/llm.ts +5 -4
  322. package/src/machines/machine-ledger.ts +127 -0
  323. package/src/market/pack-internal-refs.ts +28 -0
  324. package/src/market/publish.ts +31 -4
  325. package/src/maturity/feature-maturity.ts +65 -0
  326. package/src/model-tier/turn-tier.ts +24 -0
  327. package/src/msg/msg-store.ts +149 -0
  328. package/src/native-tool-catalog.ts +2 -1
  329. package/src/nexus/api/chat-fast-path-config.ts +28 -0
  330. package/src/nexus/api/consult-requests.ts +117 -0
  331. package/src/nexus/api/discord-trigger-bot.ts +3 -0
  332. package/src/nexus/api/exec-requests.ts +51 -0
  333. package/src/nexus/api/field-uploads.ts +180 -0
  334. package/src/nexus/api/graph-approvals-feed.ts +140 -0
  335. package/src/nexus/api/graph-approvals.ts +120 -4
  336. package/src/nexus/api/harness-api.ts +219 -5
  337. package/src/nexus/api/http-server.ts +68 -5
  338. package/src/nexus/api/seat-requests.ts +254 -0
  339. package/src/nexus/api/trace-run-scan.ts +37 -0
  340. package/src/nexus/api/trace.ts +19 -3
  341. package/src/nexus/index.ts +3 -0
  342. package/src/nexus/setup-status.ts +4 -5
  343. package/src/notify/llm-budget-alert.ts +125 -0
  344. package/src/oauth/codex-account-rotation.ts +26 -4
  345. package/src/oauth/codex-account-store.ts +20 -2
  346. package/src/oauth/codex-browser-login.ts +173 -0
  347. package/src/oauth/codex.ts +4 -1
  348. package/src/oauth/fallback-chain.ts +5 -5
  349. package/src/oauth/store.ts +42 -5
  350. package/src/onboarding/continue-here.ts +29 -0
  351. package/src/onboarding/entry-hints.ts +8 -0
  352. package/src/onboarding/full-screen-io.ts +35 -3
  353. package/src/onboarding/help/skills.md +1 -1
  354. package/src/onboarding/non-interactive.ts +1 -0
  355. package/src/onboarding/subscription-hint.ts +27 -0
  356. package/src/onboarding/web-first.ts +83 -0
  357. package/src/onboarding.ts +230 -23
  358. package/src/plugins/maker/node-install.ts +92 -0
  359. package/src/plugins/maker/node-maker.ts +139 -0
  360. package/src/plugins/maker/plugin-maker.ts +220 -0
  361. package/src/policy/llm-policy.ts +268 -0
  362. package/src/prompt-library/session-guidance.ts +7 -1
  363. package/src/prompt-library/universal-preamble.ts +2 -2
  364. package/src/relay/channel.ts +184 -0
  365. package/src/relay/mux.ts +182 -0
  366. package/src/relay/relay-cli.ts +20 -0
  367. package/src/relay/relay-server.ts +220 -0
  368. package/src/relay/test-vectors.json +29 -0
  369. package/src/release-loop/checklist.ts +36 -9
  370. package/src/seat-address/seat-address.ts +34 -0
  371. package/src/self-dev/decompose.ts +1 -0
  372. package/src/self-dev/dev-pipeline.ts +6 -3
  373. package/src/self-dev/run-record-mirror.ts +44 -0
  374. package/src/self-dev/run-store.ts +12 -3
  375. package/src/self-implement/harness-policy-gates.ts +4 -1
  376. package/src/self-implement/report-origin.ts +12 -1
  377. package/src/self-implement/run-ledger-compact.ts +1 -1
  378. package/src/session/chat.ts +17 -5
  379. package/src/session/index.ts +23 -10
  380. package/src/skills/shared-agent-skill-roots.ts +25 -0
  381. package/src/steward/failure-streak.ts +78 -0
  382. package/src/steward/steward-cards.ts +24 -0
  383. package/src/steward/triage-budget.ts +127 -0
  384. package/src/steward/triage-plan.ts +75 -0
  385. package/src/steward/triage.ts +244 -42
  386. package/src/task-cards/card-store.ts +1 -1
  387. package/src/task-orchestrator/surfaces/pod-bun-cache.ts +18 -0
  388. package/src/task-orchestrator/surfaces/pod-command-job.ts +12 -3
  389. package/src/task-orchestrator/surfaces/pod-ledger-collect.ts +11 -5
  390. package/src/task-orchestrator/surfaces/pod-ledger-events.ts +68 -0
  391. package/src/task-orchestrator/surfaces/self-implement-pod.ts +78 -4
  392. package/src/telegram.ts +145 -2
  393. package/src/tool-runtime/elanous-skills-list-runtime.ts +3 -3
  394. package/src/tool-runtime/self-cognition-runtimes.ts +160 -2
  395. package/src/user-config.ts +84 -4
  396. package/src/version/packed-revision.json +1 -1
  397. package/src/video-pipeline/recipes/character.ts +42 -5
  398. package/src/video-pipeline/recipes/explainer.ts +213 -0
  399. package/src/video-pipeline/recipes/ffmpeg.ts +1 -1
  400. package/src/video-pipeline/recipes/free-line.ts +16 -3
  401. package/src/video-pipeline/recipes/remote.ts +7 -1
  402. package/src/video-pipeline/vflow-reference.ts +109 -0
  403. package/src/video-pipeline/walk-line.ts +3 -2
  404. package/apps/pwa/out/_next/static/chunks/06ef2eba-d1b99ac6d2ea663c.js +0 -1
  405. package/apps/pwa/out/_next/static/chunks/1413-7179a49332db5a80.js +0 -1
  406. package/apps/pwa/out/_next/static/chunks/150-25c277137a9638ab.js +0 -1
  407. package/apps/pwa/out/_next/static/chunks/1640-bc99ec23bbe29d12.js +0 -1
  408. package/apps/pwa/out/_next/static/chunks/2300-de059d0ab2a16630.js +0 -1
  409. package/apps/pwa/out/_next/static/chunks/2684-05b0a81e75298c16.js +0 -1
  410. package/apps/pwa/out/_next/static/chunks/3026-2ed7e317d9b02102.js +0 -25
  411. package/apps/pwa/out/_next/static/chunks/3611-77496ada38cd6358.js +0 -1
  412. package/apps/pwa/out/_next/static/chunks/3717-68957c4dc9ceec90.js +0 -1
  413. package/apps/pwa/out/_next/static/chunks/3929-46ba9af6f9d895cc.js +0 -1
  414. package/apps/pwa/out/_next/static/chunks/4015-62c5a3744698a8da.js +0 -1
  415. package/apps/pwa/out/_next/static/chunks/4217-3c4317a7905f9eeb.js +0 -1
  416. package/apps/pwa/out/_next/static/chunks/4240-3230f230fae2d7d5.js +0 -1
  417. package/apps/pwa/out/_next/static/chunks/4271-e53e075ebd48593b.js +0 -1
  418. package/apps/pwa/out/_next/static/chunks/4377.3b125fef79576dfd.js +0 -5
  419. package/apps/pwa/out/_next/static/chunks/4853-35fdbe6bdbcdc0fc.js +0 -1
  420. package/apps/pwa/out/_next/static/chunks/5007-6a3b30e23ff68a6e.js +0 -1
  421. package/apps/pwa/out/_next/static/chunks/5244-12b424c42070f5ff.js +0 -1
  422. package/apps/pwa/out/_next/static/chunks/5611-df00af3e4e4a61bb.js +0 -1
  423. package/apps/pwa/out/_next/static/chunks/5890-dca2321773be829a.js +0 -1
  424. package/apps/pwa/out/_next/static/chunks/6123-37c9dc57ddaa7ab0.js +0 -1
  425. package/apps/pwa/out/_next/static/chunks/6588-b7975304a302ab91.js +0 -1
  426. package/apps/pwa/out/_next/static/chunks/6604-c03961962b6273b6.js +0 -1
  427. package/apps/pwa/out/_next/static/chunks/7109-cf8c87e968e83a65.js +0 -1
  428. package/apps/pwa/out/_next/static/chunks/7178-30f77877525a2efb.js +0 -1
  429. package/apps/pwa/out/_next/static/chunks/7262-871563fc9663730b.js +0 -1
  430. package/apps/pwa/out/_next/static/chunks/7294-f0eeebb92aa93459.js +0 -1
  431. package/apps/pwa/out/_next/static/chunks/7429-881af44deed6958f.js +0 -1
  432. package/apps/pwa/out/_next/static/chunks/7527.943753b6ed829f09.js +0 -1
  433. package/apps/pwa/out/_next/static/chunks/764-a01e858525a190c0.js +0 -1
  434. package/apps/pwa/out/_next/static/chunks/7868-e35d5f7985ecd3f1.js +0 -1
  435. package/apps/pwa/out/_next/static/chunks/8320-51484af7b01fdfa5.js +0 -1
  436. package/apps/pwa/out/_next/static/chunks/9131-52f5fad51cceca04.js +0 -1
  437. package/apps/pwa/out/_next/static/chunks/9238.2cd5f47f4bf7a2c3.js +0 -1
  438. package/apps/pwa/out/_next/static/chunks/app/_not-found/page-70c404c7bb6d7f0f.js +0 -1
  439. package/apps/pwa/out/_next/static/chunks/app/approvals/page-3ffd80166b1050aa.js +0 -1
  440. package/apps/pwa/out/_next/static/chunks/app/bots/page-4bcc63e272ae8205.js +0 -1
  441. package/apps/pwa/out/_next/static/chunks/app/chat/page-880734bd07d62882.js +0 -1
  442. package/apps/pwa/out/_next/static/chunks/app/control/page-72bd384898d88955.js +0 -1
  443. package/apps/pwa/out/_next/static/chunks/app/design-check/page-1018bbc9586ecae5.js +0 -1
  444. package/apps/pwa/out/_next/static/chunks/app/editor/page-de86f8c38076dd7b.js +0 -1
  445. package/apps/pwa/out/_next/static/chunks/app/healthz/route-70c404c7bb6d7f0f.js +0 -1
  446. package/apps/pwa/out/_next/static/chunks/app/intake/page-cd6447196d8bafe6.js +0 -1
  447. package/apps/pwa/out/_next/static/chunks/app/layout-e733630c47fa102b.js +0 -1
  448. package/apps/pwa/out/_next/static/chunks/app/live/page-d1c1a8357b161875.js +0 -1
  449. package/apps/pwa/out/_next/static/chunks/app/market/page-60c514128e81d787.js +0 -1
  450. package/apps/pwa/out/_next/static/chunks/app/missions/[id]/page-8b637b7e325e13c1.js +0 -1
  451. package/apps/pwa/out/_next/static/chunks/app/not-found-63301d11dbe73836.js +0 -1
  452. package/apps/pwa/out/_next/static/chunks/app/observatory/page-a8cf0dc472060db2.js +0 -1
  453. package/apps/pwa/out/_next/static/chunks/app/page-02fba54881ccfa49.js +0 -1
  454. package/apps/pwa/out/_next/static/chunks/app/reflection/page-d5e8e90f0038f8de.js +0 -1
  455. package/apps/pwa/out/_next/static/chunks/app/scheduler/page-b1ef6824f494466a.js +0 -1
  456. package/apps/pwa/out/_next/static/chunks/app/sessions/page-d589bb0f233b1009.js +0 -1
  457. package/apps/pwa/out/_next/static/chunks/app/settings/devices/page-c9bbaebef4cda059.js +0 -1
  458. package/apps/pwa/out/_next/static/chunks/app/settings/page-3639ce7916b92fed.js +0 -1
  459. package/apps/pwa/out/_next/static/chunks/app/setup/done/page-7450ae7478955653.js +0 -1
  460. package/apps/pwa/out/_next/static/chunks/app/setup/layout-70c404c7bb6d7f0f.js +0 -1
  461. package/apps/pwa/out/_next/static/chunks/app/setup/page-b41ca4abfd618452.js +0 -1
  462. package/apps/pwa/out/_next/static/chunks/app/share/page-b333dd79ebee3fa9.js +0 -1
  463. package/apps/pwa/out/_next/static/chunks/app/showroom/page-8be1227492793655.js +0 -1
  464. package/apps/pwa/out/_next/static/chunks/app/tasks/page-6e03e9371b552e0d.js +0 -1
  465. package/apps/pwa/out/_next/static/chunks/app/term/page-911411e9fca18d03.js +0 -1
  466. package/apps/pwa/out/_next/static/chunks/app/trace/page-792170e649b37088.js +0 -1
  467. package/apps/pwa/out/_next/static/chunks/app/vault/page-c40463466937bc91.js +0 -1
  468. package/apps/pwa/out/_next/static/chunks/app/workflows/chat-ui/page-509c798b80384536.js +0 -1
  469. package/apps/pwa/out/_next/static/chunks/app/workflows/page-1cac2aa21d77c417.js +0 -1
  470. package/apps/pwa/out/_next/static/chunks/app/workspace/page-9626799d9b4a2cd1.js +0 -1
  471. package/apps/pwa/out/_next/static/chunks/app/worktrees/page-84cd419494e16b0f.js +0 -1
  472. package/apps/pwa/out/_next/static/chunks/framework-361487d2da603917.js +0 -1
  473. package/apps/pwa/out/_next/static/chunks/main-app-607f5beb94cb2e07.js +0 -1
  474. package/apps/pwa/out/_next/static/chunks/main-d0222d219e29dddf.js +0 -1
  475. package/apps/pwa/out/_next/static/chunks/pages/_app-a26980a31126decc.js +0 -1
  476. package/apps/pwa/out/_next/static/chunks/pages/_error-edb2b37decf23e4d.js +0 -1
  477. package/apps/pwa/out/_next/static/css/eaa74e8bb2f62269.css +0 -1
  478. package/apps/pwa/out/_next/static/ktMqfrBbf8BMGac0jqLrb/_buildManifest.js +0 -1
  479. /package/apps/pwa/out/_next/static/{ktMqfrBbf8BMGac0jqLrb → keajW7DDyghEs1y8oJe6T}/_ssgManifest.js +0 -0
@@ -1 +1 @@
1
- "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4440],{64440:(e,t,n)=>{n.d(t,{ChatPanel:()=>eo});var r=n(58443),a=n(77947),s=n(97228),l=n(19989),o=n(853),i=n(34015),c=n(61643),u=n(19002),d=n(5131),h=n(49413),m=n(12906);function p(e){let{segmentKey:t,value:n,glyph:a}=e,s=function(e){var t;let n=/(\d{1,3})\s*%/.exec(e);if(!n)return null;let r=Number.parseInt(null!=(t=n[1])?t:"",10);return Number.isFinite(r)?Math.max(0,Math.min(100,r)):null}(n);if(null===s)return(0,r.jsxs)("span",{"data-elanous-hud-key":t,"data-elanous-hud-gauge":"false",className:"inline-flex items-center gap-1 font-mono text-[11px] text-muted-foreground",children:[a?(0,r.jsx)("span",{"aria-hidden":"true",children:a}):null,(0,r.jsx)("span",{children:n})]});let{bar:l,text:o}=s>=80?{bar:"bg-pink-400",text:"text-pink-300"}:s>=60?{bar:"bg-amber-400",text:"text-amber-300"}:{bar:"bg-emerald-500",text:"text-emerald-300"};return(0,r.jsxs)("span",{"data-elanous-hud-key":t,"data-elanous-hud-gauge":"true","data-elanous-hud-percent":String(s),className:"inline-flex items-center gap-1.5 font-mono text-[11px]",children:[a?(0,r.jsx)("span",{"aria-hidden":"true",className:"text-muted-foreground",children:a}):null,(0,r.jsx)("span",{role:"progressbar","aria-valuenow":s,"aria-valuemin":0,"aria-valuemax":100,"aria-label":"".concat(t," ").concat(s,"%"),className:"relative h-2 w-20 overflow-hidden rounded bg-muted/30",children:(0,r.jsx)("span",{"aria-hidden":"true",style:{width:"".concat(s,"%")},className:(0,h.cn)("block h-full",l)})}),(0,r.jsx)("span",{className:(0,h.cn)("tabular-nums",o),children:n})]})}let g=new Set(["variant","workspace","model","token-gauge","ctx","agent-activity","agents"]),f=new Set(["token-gauge","ctx"]),x={normal:"text-foreground",warn:"text-amber-300",danger:"text-pink-300",success:"text-emerald-300",info:"text-sky-300",muted:"text-muted-foreground"};function b(e){var t,n;let{segment:a}=e;if(f.has(a.key))return(0,r.jsx)(p,{segmentKey:a.key,value:a.value,...void 0!==a.glyph?{glyph:a.glyph}:{}});let s=a.tone?x[a.tone]:x.normal;return(0,r.jsxs)("span",{"data-elanous-hud-key":a.key,"data-elanous-hud-tone":null!=(t=a.tone)?t:"normal","data-elanous-hud-priority":String(null!=(n=a.priority)?n:50),className:(0,h.cn)("inline-flex items-center gap-1 font-mono text-[11px]",s),children:[a.glyph?(0,r.jsx)("span",{"aria-hidden":"true",children:a.glyph}):null,(0,r.jsx)("span",{children:a.value})]})}function v(e){let{segments:t,row:n,className:a}=e;return 0===t.length?null:(0,r.jsx)("div",{"data-elanous-hud-row":n,className:(0,h.cn)("flex flex-wrap items-center gap-x-3 gap-y-1",a),children:t.map((e,t)=>(0,r.jsxs)("span",{className:"flex items-center gap-x-3",children:[t>0?(0,r.jsx)("span",{"aria-hidden":"true",className:"text-muted-foreground",children:"\xb7"}):null,(0,r.jsx)(b,{segment:e})]},e.key))})}function y(e){let{segments:t}=e;if(0===t.length)return null;let{top:n,bottom:a}=function(e){let t=[],n=[];for(let r of e)g.has(r.key)?t.push(r):n.push(r);return{top:t,bottom:n}}(t);return(0,r.jsxs)("div",{"data-elanous-hud":"strip",role:"status","aria-label":"HUD status",className:"flex flex-col gap-0.5 border-b border-border/40 bg-muted/10 px-3 py-1.5",children:[(0,r.jsx)(v,{segments:n,row:"top"}),(0,r.jsx)(v,{segments:a,row:"bottom",className:"hidden sm:flex"})]})}let w=[];function j(){return w}function k(){let e=(0,a.useSyncExternalStore)(m.er,m.Wl,j);return(0,r.jsx)(y,{segments:e})}var N=n(19418),S=n(83654),C=n(21234);let A=(0,n(51719).A)("hand",[["path",{d:"M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2",key:"1fvzgz"}],["path",{d:"M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2",key:"1kc0my"}],["path",{d:"M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8",key:"10h0bg"}],["path",{d:"M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15",key:"1s1gnw"}]]);var I=n(77306),q=n(33919),T=n(88719),R=n(82725);let E={idle:"음성 대기",connecting:"데몬 연결 중…",listening:"듣는 중",processing:"생각 중…",speaking:"말하는 중",error:"음성 오류"},D={idle:"마이크를 켜서 대화를 시작하세요.",connecting:"잠시만 기다려주세요.",listening:"문장이 끝나면 자동으로 전송됩니다.",processing:"서버가 응답을 생성하는 중입니다.",speaking:"음성 응답을 재생하는 중입니다.",error:"아래 메시지를 확인하고 다시 시도하세요."},U={idle:"bg-slate-400",connecting:"bg-amber-500",listening:"bg-emerald-500",processing:"bg-sky-500",speaking:"bg-fuchsia-500",error:"bg-rose-600"};function L(e){let{active:t,phase:n,errorMsg:a,onToggle:s,ttsSupported:i=!1,ttsMuted:c=!1,onTtsToggle:u,onInterrupt:d}=e,m="speaking"===n&&"function"==typeof d;return(0,r.jsxs)("div",{"data-elanous-voice-overlay":!0,"aria-hidden":!t,className:(0,h.cn)("pointer-events-none absolute inset-0 z-10 flex items-center justify-center transition-opacity duration-300",t?"pointer-events-auto opacity-100":"opacity-0"),children:[(0,r.jsx)("div",{className:"absolute inset-0 bg-background/60 backdrop-blur-md"}),(0,r.jsxs)("div",{className:"relative mx-4 flex w-full max-w-sm flex-col items-center gap-5 rounded-xl border border-border bg-card px-6 py-7 text-center shadow-xl",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 text-sm",children:[(0,r.jsx)("span",{className:(0,h.cn)("h-2.5 w-2.5 rounded-full",U[n],("listening"===n||"speaking"===n||"connecting"===n)&&"animate-pulse"),"aria-hidden":!0}),(0,r.jsx)("span",{className:"font-medium tracking-wide",children:E[n]})]}),(0,r.jsx)("p",{className:"text-xs text-muted-foreground",children:D[n]}),(0,r.jsx)("button",{type:"button",onClick:m?d:s,"data-elanous-action":m?"voice-overlay-interrupt":"voice-overlay-toggle",className:(0,h.cn)("inline-flex h-16 w-16 items-center justify-center rounded-full text-white transition-colors",m?"bg-amber-500 hover:bg-amber-400 animate-pulse":"connecting"===n||"processing"===n?"bg-sky-500 hover:bg-sky-400":"error"===n?"bg-rose-600 hover:bg-rose-500":"bg-rose-500 hover:bg-rose-400"),"aria-label":m?"끼어들기":"마이크 끄기",children:m?(0,r.jsx)(A,{className:"h-7 w-7"}):"connecting"===n||"processing"===n?(0,r.jsx)(I.A,{className:"h-7 w-7 animate-spin"}):"error"===n?(0,r.jsx)(q.A,{className:"h-7 w-7"}):(0,r.jsx)(l.A,{className:"h-7 w-7"})}),a&&(0,r.jsx)("p",{className:"max-w-xs text-xs text-rose-500",children:a}),(0,r.jsxs)("div",{className:"flex items-center gap-4",children:[i&&u&&(0,r.jsxs)("button",{type:"button",onClick:u,"data-elanous-action":"voice-overlay-tts-toggle",className:"inline-flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground","aria-label":c?"음성 응답 켜기":"음성 응답 끄기","aria-pressed":!c,children:[c?(0,r.jsx)(T.A,{className:"h-3.5 w-3.5"}):(0,r.jsx)(R.A,{className:"h-3.5 w-3.5"}),(0,r.jsx)("span",{children:c?"음성 응답 OFF":"음성 응답 ON"})]}),(0,r.jsxs)("button",{type:"button",onClick:s,className:"inline-flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground","aria-label":"음성 닫고 텍스트로 돌아가기",children:[(0,r.jsx)(o.A,{className:"h-3.5 w-3.5"}),(0,r.jsx)("span",{children:"음성 끄기"})]})]})]})]})}function Y(e){let{open:t,onClose:n,lines:s}=e,[l,o]=(0,a.useState)(""),i=(0,a.useMemo)(()=>{if(!l.trim())return null;try{return RegExp(l,"i")}catch(e){return null}},[l]),c=(0,a.useMemo)(()=>l.trim().toLowerCase(),[l]),u=(0,a.useMemo)(()=>{let e=s.length>200?s.slice(s.length-200):s;return i?e.filter(e=>i.test(e.category)||i.test(e.event)):c?e.filter(e=>e.category.toLowerCase().includes(c)||e.event.toLowerCase().includes(c)):e},[s,i,c]);return(0,r.jsx)("div",{"data-elanous-debug-tap-drawer":t?"open":"closed",className:(0,h.cn)("fixed bottom-0 left-0 right-0 z-50 transition-transform duration-200 ease-out","pointer-events-none",t?"translate-y-0":"translate-y-full"),role:"region","aria-label":"Debug Tap Drawer","aria-hidden":!t,children:(0,r.jsxs)("div",{className:(0,h.cn)("pointer-events-auto mx-auto flex max-h-[60vh] w-full max-w-[1100px] flex-col","rounded-t-md border border-b-0 border-border bg-card shadow-xl"),children:[(0,r.jsxs)("header",{className:"flex items-center justify-between gap-2 border-b border-border/60 px-3 py-2",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("span",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Debug Tap"}),(0,r.jsxs)("span",{className:"text-[10px] text-muted-foreground/70","data-elanous-debug-tap-count":u.length,"data-elanous-debug-tap-total":s.length,children:[u.length,"/",s.length]})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("input",{type:"text",placeholder:"regex filter…",value:l,onChange:e=>o(e.target.value),spellCheck:!1,autoComplete:"off",className:(0,h.cn)("w-40 rounded border border-border bg-background px-2 py-1 text-[11px] font-mono","focus:outline-none focus:ring-1 focus:ring-primary"),"data-elanous-debug-tap-filter":"","aria-label":"Filter debug lines"}),(0,r.jsx)("button",{type:"button",onClick:n,className:"rounded px-2 py-1 text-xs text-muted-foreground hover:bg-muted hover:text-foreground","aria-label":"Close debug drawer","data-elanous-debug-tap-close":"",children:"✕"})]})]}),(0,r.jsx)("ul",{className:"flex-1 overflow-y-auto px-3 py-2 text-[11px] font-mono","data-elanous-debug-tap-list":"",children:0===u.length?(0,r.jsx)("li",{className:"italic text-muted-foreground/60",children:0===s.length?"(no debug lines yet)":"(no matches for filter)"}):u.map((e,t)=>(0,r.jsx)(F,{line:e},"".concat(e.loggedAt,"-").concat(e.seq,"-").concat(t)))})]})})}function F(e){let{line:t}=e,n=new Date(t.loggedAt).toISOString().slice(11,23);return(0,r.jsxs)("li",{"data-elanous-debug-tap-line":"","data-elanous-category":t.category,"data-elanous-event":t.event,className:"py-0.5",children:[(0,r.jsxs)("span",{className:"text-muted-foreground/70",children:["[",n,"]"]})," ",(0,r.jsxs)("span",{className:"text-amber-400",children:["[",t.category,"]"]})," ",(0,r.jsx)("span",{className:"text-foreground",children:t.event}),void 0!==t.data&&(0,r.jsxs)("details",{className:"ml-4 text-muted-foreground",children:[(0,r.jsx)("summary",{className:"cursor-pointer select-none text-[10px]",children:"data"}),(0,r.jsx)("pre",{className:"m-0 mt-1 whitespace-pre-wrap break-all text-[10px] text-muted-foreground/80",children:function(e){try{return JSON.stringify(e,null,2)}catch(t){return String(e)}}(t.data)})]})]})}var M=n(3924),O=n(32156),_=n(61777),P=n(26882),z=n(19990),W=n(65534),$=n(65333);let Q="Other";function J(e){let{request:t,onSubmit:n,onCancel:a,onChatAboutThis:s}=e;return(0,r.jsx)(P.lG,{open:null!==t,onOpenChange:e=>{e||a()},children:(0,r.jsx)(P.Cf,{className:"max-w-2xl",children:t?(0,r.jsx)(K,{request:t,onSubmit:n,onCancel:a,onChatAboutThis:s}):null})})}function K(e){let{request:t,onSubmit:n,onCancel:s,onChatAboutThis:l}=e,[o,i]=(0,a.useState)(()=>Object.fromEntries(t.questions.map(e=>[e.id,new Set]))),[c,u]=(0,a.useState)({}),[d,h]=(0,a.useState)({}),m=1===t.questions.length?t.questions[0].header:"Pick options",p=(0,a.useMemo)(()=>{for(let n of t.questions){var e;let t=null!=(e=o[n.id])?e:new Set,r=G(n,o,d);if(0===t.size&&!r)return!1}return!0},[t.questions,o,d]);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(P.c7,{children:[(0,r.jsx)(P.L3,{children:m}),1===t.questions.length?(0,r.jsx)(P.rr,{children:t.questions[0].question}):(0,r.jsxs)(P.rr,{children:[t.questions.length," questions"]})]}),(0,r.jsx)($.F,{className:"max-h-[60vh] pr-2",children:(0,r.jsx)("div",{className:"flex flex-col gap-6 py-2",children:t.questions.map(e=>{var t;return(0,r.jsx)(B,{question:e,isSelected:t=>{var n,r,a;return n=e.id,null!=(a=null==(r=o[n])?void 0:r.has(t))&&a},onToggle:t=>{i(n=>{var r;let a={...n},s=new Set(null!=(r=a[e.id])?r:[]);return e.multiSelect?s.has(t)?s.delete(t):s.add(t):(s.clear(),s.add(t),h(t=>({...t,[e.id]:!1}))),a[e.id]=s,a})},otherActive:G(e,o,d),onToggleOther:()=>{e.multiSelect?h(t=>{var n;return{...t,[e.id]:!(null!=(n=t[e.id])&&n)}}):i(t=>{let n={...t};return n[e.id]=new Set([Q]),n})},otherText:null!=(t=c[e.id])?t:"",onOtherText:t=>u(n=>({...n,[e.id]:t}))},e.id)})})}),(0,r.jsxs)(P.Es,{className:"flex-wrap gap-2 sm:justify-between",children:[(0,r.jsx)(z.$,{variant:"ghost",onClick:l,"aria-label":"Chat about this",children:"\uD83D\uDCAC Chat about this"}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(z.$,{variant:"outline",onClick:s,children:"Cancel"}),(0,r.jsx)(z.$,{onClick:function(){let e={},r={};for(let n of t.questions){var a,s;let t=Array.from(null!=(a=o[n.id])?a:[]);if(G(n,o,d)&&!t.includes(Q)&&t.push(Q),0!==t.length&&(n.multiSelect?e[n.id]=t:e[n.id]=t[0],t.includes(Q))){let e=(null!=(s=c[n.id])?s:"").trim();e.length>0&&(r[n.id]=e)}}let l={answers:e};Object.keys(r).length>0&&(l.otherText=r),n(l)},disabled:!p,children:"Submit"})]})]})]})}function B(e){var t,n;let{question:a}=e;return(0,r.jsxs)("section",{className:"flex flex-col gap-2",children:[""!==e.question.id?(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("span",{className:"rounded-full bg-primary/15 px-2 py-0.5 text-xs font-medium text-primary",children:a.header}),a.multiSelect?(0,r.jsx)("span",{className:"text-xs text-muted-foreground",children:"multi-select"}):null]}):null,(0,r.jsxs)("div",{className:"flex flex-col gap-1.5",children:[a.options.map(t=>{var n;return(0,r.jsx)(V,{multi:null!=(n=a.multiSelect)&&n,option:t,selected:e.isSelected(t.label),onToggle:()=>e.onToggle(t.label)},t.label)}),null==(t=a.includeOther)||t?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(V,{multi:null!=(n=a.multiSelect)&&n,option:{label:"Other",description:"Type your own response"},selected:e.otherActive,onToggle:e.onToggleOther}),e.otherActive?(0,r.jsx)(W.p,{value:e.otherText,onChange:t=>e.onOtherText(t.target.value),placeholder:"Type your own response","aria-label":"Other response",className:"ml-8"}):null]}):null]})]})}function V(e){let{multi:t,option:n,selected:a,onToggle:s}=e;return(0,r.jsxs)("button",{type:"button",role:t?"checkbox":"radio","aria-checked":a,onClick:s,className:"\n flex items-start gap-3 rounded-md border p-3 text-left\n transition-colors\n ".concat(a?"border-primary bg-primary/10":"border-border hover:bg-muted/40","\n "),children:[(0,r.jsx)("span",{className:"mt-0.5 flex h-5 w-5 shrink-0 items-center justify-center ".concat(t?"rounded":"rounded-full"," border ").concat(a?"border-primary bg-primary text-primary-foreground":"border-muted-foreground/40"),"aria-hidden":"true",children:a?t?"✓":"●":null}),(0,r.jsxs)("span",{className:"flex flex-col gap-0.5",children:[(0,r.jsx)("span",{className:"font-medium",children:n.label}),(0,r.jsx)("span",{className:"text-sm text-muted-foreground",children:n.description}),n.preview?(0,r.jsx)("span",{className:"mt-1 rounded bg-muted/40 px-2 py-1 text-xs font-mono text-muted-foreground",children:n.preview}):null]})]})}function G(e,t,n){var r,a,s;return e.multiSelect?null!=(a=n[e.id])&&a:null!=(s=null==(r=t[e.id])?void 0:r.has(Q))&&s}var H=n(28190),Z=n(89704),X=n(23783);function ee(e,t){var n;return"error"!==t.kind?null:null!=(n=function(e){if(!e||"object"!=typeof e)return null;let{error:t,message:n,holder:r}=e;return"turn_busy"!==t?null:{message:"string"==typeof n?n:"This session is currently receiving input. Please try again when that turn finishes.",holder:"string"==typeof r&&r.trim()?r:null}}(t.payload))?n:e}function et(e){return"string"==typeof e.mediaType&&e.mediaType.toLowerCase().startsWith("image/")}async function en(e,t){let n=e.downloadUrl.startsWith("http")?e.downloadUrl:"".concat(t.baseUrl.replace(/\/$/,"")).concat(e.downloadUrl),r={};t.token&&(r.authorization="Bearer ".concat(t.token));let a=await fetch(n,{headers:r});if(!a.ok)throw Error("fetch attachment ".concat(e.id," failed: ").concat(a.status));return function(e){let t=new Uint8Array(e),n="";for(let e=0;e<t.length;e+=32768)n+=String.fromCharCode(...t.subarray(e,e+32768));return btoa(n)}(await a.arrayBuffer())}async function er(e,t,n){if(0===t.length)return null;let r=[];for(let a of(e.length>0&&r.push({type:"text",text:e}),t))if(et(a))try{let e=await en(a,n);r.push({type:"image",mimeType:a.mediaType,data:e})}catch(t){let e=t instanceof Error?t.message:String(t);r.push({type:"text",text:"[image fetch failed: ".concat(a.filename," — ").concat(e,"]")})}else r.push({type:"resource_link",uri:a.path?"file://".concat(a.path):a.downloadUrl,mimeType:a.mediaType,name:a.filename});return r}function ea(){var e;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{client:n,config:p,sessionId:g,setSessionId:f}=(0,i.Q)(),[x,b]=(0,a.useState)([]),[v,y]=(0,a.useState)(),[w,j]=(0,a.useState)(!1),[A,I]=(0,a.useState)(null),[q,T]=(0,a.useState)(null),[R,E]=(0,a.useState)([]),D=(0,a.useRef)(!1),U=(0,a.useRef)(null),F=(0,a.useRef)(null),[P,z]=(0,a.useState)(null),W=(0,a.useMemo)(()=>{try{let e=new URLSearchParams(window.location.search);return"on"===e.get("debug-tap")}catch(e){return!1}},[]),[$,Q]=(0,a.useState)(W),K=(0,a.useMemo)(()=>{let e=[];for(let t of x)if(Array.isArray(t.blocks)){for(let n of t.blocks)if("debug_session"===n.kind)for(let t of n.lines)e.push({seq:t.seq,category:t.category,event:t.event,...void 0!==t.data?{data:t.data}:{},loggedAt:t.loggedAt})}return e},[x]),B=(0,a.useRef)(async()=>{}),V=(0,a.useRef)(!1);V.current=w;let G=(0,a.useRef)(async()=>{}),en=n.voiceWsUrl(),ea=(0,a.useCallback)(e=>{let t=e.trim();if(t){if(V.current)return void(0,X.cY)("chat.voice.skip-pending",{len:t.length});(0,X.cY)("chat.voice.auto-send",{len:t.length}),B.current(t)}},[]),es=(0,O.sS)({wsUrl:en,...p.token?{token:p.token}:{},onTranscript:ea}),el=!!p.baseUrl;G.current=()=>es.toggle();let[eo,ei]=(0,a.useState)(!1),ec=(0,_.$)({enabled:es.active&&!eo,language:"ko-KR"}),eu=(0,a.useCallback)(()=>{null==q||q.abort(),(0,X.cY)("webterm.chat.stop",{had:!!q})},[q]);(0,a.useEffect)(()=>{if(!q)return;let e=e=>{var t;if("Escape"!==e.key)return;let n=e.target,r=null==n||null==(t=n.tagName)?void 0:t.toLowerCase();"input"===r||"textarea"===r||null!=n&&n.isContentEditable||(e.preventDefault(),eu())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[q,eu]),(0,a.useEffect)(()=>{let e=e=>{"m"===e.key.toLowerCase()&&e.shiftKey&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),(0,X.cY)("chat.voice.shortcut.toggle"),G.current())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[]);let ed=(0,a.useCallback)(e=>{E(t=>[...t,...e]),(0,X.cY)("webterm.chat.attach.queue",{added:e.length,filenames:e.map(e=>e.filename)})},[]);(0,a.useEffect)(()=>{try{let e=window.sessionStorage.getItem("elanous.pwa.shareAttachments");if(!e)return;window.sessionStorage.removeItem("elanous.pwa.shareAttachments");let t=JSON.parse(e);if(!Array.isArray(t)||0===t.length)return;E(e=>[...e,...t]);let n=1===t.length?"1 file shared from another app":"".concat(t.length," files shared from another app");Z.oR.success(n),(0,X.cY)("pwa.chat.share-attachments.consume",{count:t.length})}catch(e){(0,X.cY)("pwa.chat.share-attachments.parse-failed",{reason:e instanceof Error?e.message:String(e)})}},[]);let eh=(0,a.useRef)("");(0,a.useEffect)(()=>{if(!g||eh.current===g)return;eh.current=g;let e=!0;return(async()=>{try{let t=await n.fetchJson("/v1/sessions/store/".concat(encodeURIComponent(g),"?ifExists=1"));if(!e||!(null==t?void 0:t.messages)||0===t.messages.length)return;b(e=>e.length>0?e:function(e,t){let n,r=[],a=[];for(let l of e){var s;if("tool"===l.role){for(let e of function(e,t){let n,r=function(e,t){var n,r;let a,s=String(null!=(n=e.toolName)?n:"");try{a=JSON.parse(String(null!=(r=e.toolResult)?r:""))}catch(e){a=void 0}let l=a&&"object"==typeof a&&!Array.isArray(a)?a:void 0,o=null==l?void 0:l._meta,i=o&&"object"==typeof o&&!Array.isArray(o)?o.ui:void 0,c=i&&"object"==typeof i&&!Array.isArray(i)?i.resourceUri:void 0,u=null==l?void 0:l["ui/resourceUri"],d="string"==typeof c?c:"string"==typeof u?u:void 0;return void 0!==d&&""!==d.trim()?{kind:"mcp_app",toolId:t,toolName:s,screenUrl:d,...void 0!==a?{toolResult:a}:{}}:{kind:"tool_use",id:t,name:s,status:"done",...void 0!==l&&void 0!==e.toolArgs?{args:{raw:String(e.toolArgs)}}:{}}}(e,t);try{var a;n=JSON.parse(String(null!=(a=e.toolResult)?a:""))}catch(e){n=void 0}return[...(0,m.uS)(n).map(e=>({kind:"image",...e})),r]}(l,"restore-tool-".concat(a.length,"-").concat(r.length)))"image"===e.kind&&a.some(t=>"image"===t.kind&&t.src===e.src)||a.push(e);continue}if("user"!==l.role&&"assistant"!==l.role)continue;let e=String(null!=(s=l.content)?s:""),o=String(null!=e?e:"").split("\n").filter(e=>!/^\[tool_(use|result)\]$/.test(e.trim())).join("\n"),i="assistant"===l.role?"assistant":"user";if(""===o.trim()){a.length>0&&"assistant"===i&&(r.push({id:"restore-".concat(r.length),role:i,text:"",blocks:a,timestamp:t+r.length}),a=[]);continue}let c=o!==e,u=void 0!==n&&n.role===i&&n.text===o&&(c||n.wasStripped)&&0===a.length;if(n={role:i,text:o,wasStripped:c},u)continue;let d=a.length>0&&"assistant"===i?[...a,{kind:"text",text:o}]:void 0;void 0!==d&&(a=[]),r.push({id:"restore-".concat(r.length),role:i,text:o,...void 0!==d?{blocks:d}:{},timestamp:t+r.length})}return a.length>0&&(r.push({id:"restore-".concat(r.length),role:"assistant",text:"",blocks:a,timestamp:t+r.length}),a=[]),r}(t.messages,Date.now()))}catch(e){}})(),()=>{e=!1}},[g,n]);let em=(0,a.useCallback)(e=>{E(t=>t.filter(t=>t.id!==e))},[]),ep={client:n,sessionId:g,provider:p.provider,setSessionId:f,daemon:{baseUrl:p.baseUrl,...p.token?{token:p.token}:{}},messages:x},eg=e=>{b(t=>[...t,e])},ef=async e=>{I(e=>ee(e,{kind:"turn-begin"})),(0,X.cY)("webterm.chat.input",{len:e.length,attachCount:R.length}),E([]);let t=R.filter(et),r=R.filter(e=>!et(e)),a=function(e){if(!e)return!0;let t=e.toLowerCase();return!!("auto"===t||t.startsWith("anthropic")||"anthropic"===t||t.startsWith("codex")||"openai-codex"===t||t.startsWith("openai")||"openai"===t||t.startsWith("gemini")||"gemini"===t||t.startsWith("grok")||"grok"===t||t.startsWith("local"))}(p.provider),s=t.length>0&&a;t.length>0&&!a&&Z.oR.warning("이 모델은 이미지 입력을 지원하지 않습니다 — ".concat(t.length,"개 이미지가 무시됩니다. (vision 모델로 전환 후 재첨부)"));let l=r.map(e=>e.path?"[attached] ".concat(e.path):"").filter(e=>e.length>0),o=l.length>0?"".concat(l.join("\n"),"\n\n").concat(e).trimEnd():e,i=null;if(s&&p.baseUrl)try{i=await er(o,t,{baseUrl:p.baseUrl,token:p.token})}catch(t){let e=t instanceof Error?t.message:String(t);(0,X.cY)("webterm.chat.attach.contentblock.error",{msg:e}),Z.oR.error("이미지 첨부 변환 실패 — 텍스트만 전송: ".concat(e)),i=null}e.length>0&&eg((0,m.tw)(e)),R.length>0&&eg((0,m.$Q)("\uD83D\uDCCE attached: ".concat(R.map(e=>e.filename).join(", "))));let c=e?await (0,m.yN)(e,ep):null;if(c){"__CLEAR__"===c.text?b([]):eg((0,m.$Q)(c.text)),c.newSessionId&&f(c.newSessionId);return}if(!p.baseUrl)return void eg((0,m.$Q)("error: daemon baseUrl not configured. Visit /settings."));j(!0),D.current=!0;let u="m-stream-".concat(Date.now(),"-").concat(Math.random().toString(36).slice(2,6));eg({id:u,role:"assistant",text:"",timestamp:Date.now(),meta:{provider:p.provider}});let d=new AbortController;T(d);let h=0,x=F.current,v=!!(x&&g&&p.baseUrl),y=null;(0,X.cY)("webterm.chat.runturn.path",{useAcpPath:v,hasAcp:!!x,hasSession:!!g});let w=e=>{b(t=>t.map(t=>t.id===u?{...t,text:e}:t)),e.length>h&&(ec.pushText(e.slice(h)),h=e.length)},k=e=>{b(t=>t.map(t=>t.id===u?{...t,blocks:e}:t))};try{v&&(y=n.connectAcp({sessionId:g}));let{message:e,newSessionId:t}=v?await (0,m.py)(y,o,{...ep,sessionId:await y.ready||g},{signal:d.signal,...i?{userContent:i}:{},onPartial:w,onPartialBlocks:k}):await (0,m.HD)(o,ep,{signal:d.signal,...i?{userContent:i}:{},...$?{debugTap:!0}:{},onPartial:w,onPartialBlocks:k,onError:e=>I(t=>ee(t,{kind:"error",payload:e}))});I(e=>ee(e,{kind:"turn-end"})),b(t=>t.map(t=>t.id===u?e:t)),t&&f(t),ec.flush()}catch(n){let e=d.signal.aborted,t=n instanceof Error?n.message:String(n);ec.cancel(),e?(b(e=>e.map(e=>e.id===u?{...e,meta:{...e.meta,stopReason:"aborted"}}:e)),(0,X.cY)("webterm.chat.runturn.stream.abort",{reason:t})):(b(e=>e.filter(e=>e.id!==u)),eg((0,m.$Q)("error: ".concat(t))),Z.oR.error("chat failed: ".concat(t)),(0,X.cY)("webterm.chat.runturn.error",{reason:t,useAcpPath:v}))}finally{null==y||y.close(),j(!1),T(null),D.current=!1}};B.current=ef,(0,a.useEffect)(()=>{I(e=>ee(e,{kind:"session-change"}))},[g]),(0,a.useEffect)(()=>{if(!g||!p.baseUrl)return;let e=(0,m.lY)(n,g,{isLocalTurnInFlight:()=>D.current,provider:p.provider,onPlaceholder:e=>{let{sessionId:t}=e;I(e=>ee(e,{kind:"turn-begin"}));let n="m-obs-".concat(Date.now(),"-").concat(Math.random().toString(36).slice(2,6)),r={id:n,role:"assistant",text:"",timestamp:Date.now(),meta:{provider:p.provider}};return(0,X.cY)("webterm.chat.observer.placeholder",{id:n,turnSessionId:t}),b(e=>[...e,r]),U.current=n,n},onPartialBlocks:(e,t)=>{b(n=>n.map(n=>n.id===e?{...n,blocks:t}:n))},onFinalize:(e,t)=>{I(e=>ee(e,{kind:"turn-end"})),b(n=>n.map(n=>n.id===e?t:n)),U.current===e&&(U.current=null)},onError:(e,t)=>{I(e=>ee(e,{kind:"error",payload:t})),(0,X.cY)("webterm.chat.observer.error",{placeholderId:e,error:t.error}),b(n=>n.map(n=>n.id===e?{...n,meta:{...n.meta,stopReason:t.error}}:n)),U.current===e&&(U.current=null)}});return()=>{e()}},[n,g,p.baseUrl,p.provider]),(0,a.useEffect)(()=>{if(!g||!p.baseUrl)return;let e=n.subscribeChatFeedbackEvents(g,{agentStatus:{onFeedback:e=>{b(t=>{if(0===t.length)return t;for(let n=t.length-1;n>=0;n--){if("assistant"!==t[n].role)continue;let r=t[n],a=Array.isArray(r.blocks)?[...r.blocks]:[];if("applied"!==(0,M.K4)(a,e))break;let s={...r,blocks:a};return[...t.slice(0,n),s,...t.slice(n+1)]}return t})},onError:e=>{(0,X.cY)("webterm.agent-status.error",e)}},hudSegment:{onFeedback:e=>(0,m.Ju)(e),onError:e=>{(0,X.cY)("webterm.hud-segment.error",e)}}});return()=>{e()}},[n,g,p.baseUrl]),(0,a.useEffect)(()=>{if(!g||!p.baseUrl)return;let e=null;try{e=n.connectAcp({sessionId:g,onSession:e=>{if(e&&e!==g){var n;(0,X.cY)("webterm.chat.acp.session-adopt",{previous:g,issued:e}),null==(n=t.onSessionAdopt)||n.call(t,e),f(e)}}})}catch(e){(0,X.cY)("webterm.chat.acp.connect-failed",{reason:String(e)});return}F.current=e,z(e);let r=e;(0,X.x8)(async e=>{let t=JSON.parse(e);return await r.send("elanous/debug-logs/ingest",{records:t.records}),!0});let a=(0,m.ZH)(e,g,{isLocalTurnInFlight:()=>D.current,isRemoteSseTurnInFlight:()=>null!==U.current,onPlaceholder:e=>{let{sessionId:t}=e;I(e=>ee(e,{kind:"turn-begin"}));let n="m-acp-".concat(Date.now(),"-").concat(Math.random().toString(36).slice(2,6)),r={id:n,role:"assistant",text:"",timestamp:Date.now(),meta:{provider:p.provider}};return(0,X.cY)("webterm.chat.acp.foreign-placeholder",{id:n,turnSessionId:t}),b(e=>[...e,r]),n},onPartialBlocks:(e,t)=>{let n=t.find(e=>"text"===e.kind),r=t.some(e=>"image"===e.kind||"tool_use"===e.kind);b(a=>a.map(a=>a.id===e?{...a,...n?{text:n.text}:{},...r?{blocks:t}:{}}:a))},onFinalize:e=>{(0,X.cY)("webterm.chat.acp.foreign-finalize",{placeholderId:e})}});return()=>{a(),(0,X.x8)(null);try{null==e||e.close()}catch(e){}F.current===e&&(F.current=null),z(null)}},[n,g,p.baseUrl,p.provider]);let ex=function(e){var t;let{acp:n,onComposerPrefill:r}=e,[s,l]=(0,a.useState)(null),o=(0,a.useRef)(null),i=(0,a.useCallback)(e=>{o.current=e,l(e)},[]),c=(0,a.useCallback)(e=>{let t=o.current;t&&(t.resolve(e),i(null))},[i]);(0,a.useEffect)(()=>{if(!n)return;let e=n.onRequest("elanous/ask/request",async e=>{let t=function(e){if(!e||"object"!=typeof e||"string"!=typeof e.id||!e.id||!e.request||"object"!=typeof e.request)return null;let t=e.request;return Array.isArray(t.questions)&&0!==t.questions.length?{id:e.id,request:e.request}:null}(e);if(!t)return{answers:{},cancelled:!0};let n=o.current;return n&&n.resolve({answers:{},cancelled:!0}),await new Promise(e=>{i({request:t.request,resolve:e,askId:t.id})})}),t=n.on("sessionUpdate",()=>{}),r=n.onAny(e=>{var t;if("elanous/ask/cancel"!==e.method||void 0!==e.id)return;let n=(t=e.params)&&"object"==typeof t&&"string"==typeof t.id&&t.id?{id:t.id,..."string"==typeof t.reason?{reason:t.reason}:{}}:null;if(!n)return;let r=o.current;r&&r.askId===n.id&&c({answers:{},cancelled:!0})});return()=>{e(),t(),r();let n=o.current;n&&(n.resolve({answers:{},cancelled:!0}),o.current=null)}},[n,i,c]);let u=(0,a.useCallback)(e=>{c(e)},[c]),d=(0,a.useCallback)(()=>{c({answers:{},cancelled:!0})},[c]),h=(0,a.useCallback)(()=>{let e=o.current;e&&r&&r(e.request),c({answers:{},cancelled:!0})},[c,r]);return{pendingRequest:null!=(t=null==s?void 0:s.request)?t:null,submit:u,cancel:d,chatAboutThis:h}}({acp:P,onComposerPrefill:e=>{let t=e.questions[0];if(!t)return;let n="[ Q: ".concat(t.question.trim()," ]\n\n");(0,N.vn)(n),y(e=>{var t;return{text:n,id:(null!=(t=null==e?void 0:e.id)?t:0)+1}}),Z.oR.info("\uD83D\uDCAC 입력 영역에 질문 prefill 됨 (Chat about this)")}});return(0,r.jsxs)("div",{className:"flex h-full flex-col",children:[(0,r.jsxs)("div",{className:"flex shrink-0 items-center justify-between gap-3 border-b border-border bg-background px-4 py-2",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(d.Qh,{sessionId:g,...t.onAttachRequest?{onAttachRequest:t.onAttachRequest}:{},...t.onForgetRequest?{onForgetRequest:t.onForgetRequest}:{}}),(0,r.jsx)(s.vG,{children:(0,r.jsx)(S.rm,{})}),(0,r.jsx)(s.vG,{children:(0,r.jsx)(C.D,{})})]}),(0,r.jsx)("div",{className:"flex items-center gap-2",children:(0,r.jsxs)("button",{type:"button",onClick:()=>void es.toggle(),disabled:!el,title:el?null!=(e=es.errorMsg)?e:H.g[es.phase]:"daemon URL 미설정 — Settings 에서 Base URL 입력","data-elanous-action":"chat-voice-toggle",className:(0,h.cn)("inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-medium transition-colors",es.active?"border-rose-500/40 bg-rose-500/10 text-rose-600 hover:bg-rose-500/20":"border-border bg-background text-foreground hover:bg-muted",!el&&"cursor-not-allowed opacity-50"),children:[(0,r.jsx)("span",{className:(0,h.cn)("h-2 w-2 rounded-full",H.x[es.phase],("listening"===es.phase||"speaking"===es.phase)&&"animate-pulse"),"aria-hidden":!0}),es.active?(0,r.jsx)(l.A,{className:"h-3.5 w-3.5"}):(0,r.jsx)(o.A,{className:"h-3.5 w-3.5"}),(0,r.jsx)("span",{className:"hidden sm:inline",children:H.g[es.phase]})]})})]}),(0,r.jsx)(k,{}),(0,r.jsxs)("div",{className:"relative flex flex-1 min-h-0 flex-col",children:[(0,r.jsx)(c.D,{messages:x,pending:w,...t.tabId?{tabId:t.tabId}:{}}),A&&(0,r.jsxs)("div",{role:"alert",className:"mx-4 mb-3 flex shrink-0 items-start justify-between gap-3 rounded-md border border-amber-500/40 bg-amber-500/10 px-3 py-2 text-sm text-foreground","data-elanous-turn-busy-banner":"",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"font-medium",children:"This session is busy"}),(0,r.jsx)("p",{className:"text-muted-foreground",children:A.message}),(0,r.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:A.holder?"Current input holder: ".concat(A.holder):"The current input holder is not available."})]}),(0,r.jsx)("button",{type:"button",onClick:()=>I(null),className:"rounded px-2 py-1 text-xs text-muted-foreground hover:bg-amber-500/10 hover:text-foreground","aria-label":"Dismiss busy-session notice",children:"Dismiss"})]}),(0,r.jsx)(L,{active:es.active,phase:es.phase,errorMsg:es.errorMsg,onToggle:()=>void es.toggle(),ttsSupported:ec.supported,ttsMuted:eo,onTtsToggle:()=>ei(e=>!e),onInterrupt:()=>{try{ec.cancel()}catch(e){}es.interrupt()}})]}),w&&q&&(0,r.jsxs)("div",{className:"flex shrink-0 items-center justify-end gap-2 border-t border-border bg-muted/30 px-4 py-1.5 text-xs",children:[(0,r.jsx)("span",{className:"text-muted-foreground",children:"streaming…"}),(0,r.jsx)("button",{type:"button",onClick:eu,className:"rounded border border-border bg-background px-2 py-0.5 font-mono hover:bg-muted","data-elanous-action":"chat-stop",title:"Stop the running turn (Esc)",children:"Stop ⎋"})]}),(0,r.jsx)(u.V,{onSubmit:ef,prefill:v,disabled:w,attachments:R,onAttached:ed,onRemoveAttachment:em,voice:{active:es.active,phase:es.phase,dotColor:H.x[es.phase],phaseLabel:H.g[es.phase],disabled:!el,onToggle:()=>void es.toggle()},...t.tabId?{tabId:t.tabId}:{},onListFiles:P&&g?async e=>{var t,n;let r=await P.send("elanous/fs/list",{sessionId:g,query:e,limit:50}),a=(null!=(t=r.entries)?t:[]).filter(e=>"string"==typeof(null==e?void 0:e.name)&&"boolean"==typeof(null==e?void 0:e.isDir)&&"string"==typeof(null==e?void 0:e.relPath)).map(e=>({name:e.name,isDir:e.isDir,relPath:e.relPath}));return{cwd:null!=(n=r.cwd)?n:"",entries:a}}:void 0,onListSkills:P&&g?async e=>{var t;return{entries:(null!=(t=(await P.send("elanous/skills/list",{sessionId:g,query:e})).entries)?t:[]).filter(e=>"string"==typeof(null==e?void 0:e.name)&&"string"==typeof(null==e?void 0:e.description)).map(e=>({name:e.name,description:e.description}))}}:void 0}),W&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(Y,{open:$,onClose:()=>Q(!1),lines:K}),!$&&(0,r.jsxs)("button",{type:"button",onClick:()=>Q(!0),"data-elanous-debug-tap-reopen":"",className:(0,h.cn)("fixed bottom-3 right-3 z-40 rounded-full border border-border bg-card px-3 py-1.5","text-[11px] font-mono text-muted-foreground shadow hover:bg-muted hover:text-foreground"),"aria-label":"Reopen debug drawer",title:"Reopen Debug Tap drawer",children:["⌁ debug (",K.length,")"]})]}),(0,r.jsx)(J,{request:ex.pendingRequest,onSubmit:ex.submit,onCancel:ex.cancel,onChatAboutThis:ex.chatAboutThis})]})}var es=n(68320),el=n(87139);function eo(){var e;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=(0,es.tg)(),{client:s,sessionId:l,setSessionId:o}=(0,i.Q)(),[c,u]=(0,a.useState)(l||"default"),d=(0,a.useRef)(null);(0,a.useEffect)(()=>{if(d.current===l){d.current=null;return}d.current=null,u(l||"default")},[l]);let h=(0,a.useRef)(t.sessionId),m=(0,a.useRef)(l),p=null!=(e=null==n?void 0:n.state.activeId)?e:null;(0,a.useEffect)(()=>{let e=t.sessionId;if(n&&t.tabId&&e&&l){var r,a;let s=function(e){if(!e.isActive||e.tabSessionId===e.daemonSessionId)return"none";let t=e.prevTabSessionId!==e.tabSessionId,n=e.prevDaemonSessionId!==e.daemonSessionId;return t||!n?"adopt-tab":"record-global"}({isActive:p===t.tabId,tabSessionId:e,daemonSessionId:l,prevTabSessionId:null!=(r=h.current)?r:e,prevDaemonSessionId:null!=(a=m.current)?a:l});"adopt-tab"===s?o(e):"record-global"===s&&n.updateChatTab(t.tabId,{sessionId:l})}h.current=t.sessionId,m.current=l},[n,p,t.tabId,t.sessionId,l,o]);let g=n&&t.tabId?()=>n.openPicker({kind:"attachToTab",tabId:t.tabId}):void 0,f=n&&t.sessionId?async()=>{let e=(0,el.hG)(s);await e.forget(t.sessionId)}:void 0;return(0,r.jsx)(ea,{onSessionAdopt:e=>{d.current=e},...g?{onAttachRequest:g}:{},...f?{onForgetRequest:f}:{},...t.tabId?{tabId:t.tabId}:{}},c)}}}]);
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6090],{6090:(e,t,n)=>{n.d(t,{ChatPanel:()=>eo});var r=n(41121),a=n(91269),s=n(82356),l=n(82823),o=n(73139),i=n(38519),c=n(92646),u=n(19206),d=n(68355),h=n(82157),m=n(56594);function p(e){let{segmentKey:t,value:n,glyph:a}=e,s=function(e){var t;let n=/(\d{1,3})\s*%/.exec(e);if(!n)return null;let r=Number.parseInt(null!=(t=n[1])?t:"",10);return Number.isFinite(r)?Math.max(0,Math.min(100,r)):null}(n);if(null===s)return(0,r.jsxs)("span",{"data-elanous-hud-key":t,"data-elanous-hud-gauge":"false",className:"inline-flex items-center gap-1 font-mono text-[11px] text-muted-foreground",children:[a?(0,r.jsx)("span",{"aria-hidden":"true",children:a}):null,(0,r.jsx)("span",{children:n})]});let{bar:l,text:o}=s>=80?{bar:"bg-pink-400",text:"text-pink-300"}:s>=60?{bar:"bg-amber-400",text:"text-amber-300"}:{bar:"bg-emerald-500",text:"text-emerald-300"};return(0,r.jsxs)("span",{"data-elanous-hud-key":t,"data-elanous-hud-gauge":"true","data-elanous-hud-percent":String(s),className:"inline-flex items-center gap-1.5 font-mono text-[11px]",children:[a?(0,r.jsx)("span",{"aria-hidden":"true",className:"text-muted-foreground",children:a}):null,(0,r.jsx)("span",{role:"progressbar","aria-valuenow":s,"aria-valuemin":0,"aria-valuemax":100,"aria-label":"".concat(t," ").concat(s,"%"),className:"relative h-2 w-20 overflow-hidden rounded bg-muted/30",children:(0,r.jsx)("span",{"aria-hidden":"true",style:{width:"".concat(s,"%")},className:(0,h.cn)("block h-full",l)})}),(0,r.jsx)("span",{className:(0,h.cn)("tabular-nums",o),children:n})]})}let g=new Set(["variant","workspace","model","token-gauge","ctx","agent-activity","agents"]),f=new Set(["token-gauge","ctx"]),x={normal:"text-foreground",warn:"text-amber-300",danger:"text-pink-300",success:"text-emerald-300",info:"text-sky-300",muted:"text-muted-foreground"};function b(e){var t,n;let{segment:a}=e;if(f.has(a.key))return(0,r.jsx)(p,{segmentKey:a.key,value:a.value,...void 0!==a.glyph?{glyph:a.glyph}:{}});let s=a.tone?x[a.tone]:x.normal;return(0,r.jsxs)("span",{"data-elanous-hud-key":a.key,"data-elanous-hud-tone":null!=(t=a.tone)?t:"normal","data-elanous-hud-priority":String(null!=(n=a.priority)?n:50),className:(0,h.cn)("inline-flex items-center gap-1 font-mono text-[11px]",s),children:[a.glyph?(0,r.jsx)("span",{"aria-hidden":"true",children:a.glyph}):null,(0,r.jsx)("span",{children:a.value})]})}function v(e){let{segments:t,row:n,className:a}=e;return 0===t.length?null:(0,r.jsx)("div",{"data-elanous-hud-row":n,className:(0,h.cn)("flex flex-wrap items-center gap-x-3 gap-y-1",a),children:t.map((e,t)=>(0,r.jsxs)("span",{className:"flex items-center gap-x-3",children:[t>0?(0,r.jsx)("span",{"aria-hidden":"true",className:"text-muted-foreground",children:"\xb7"}):null,(0,r.jsx)(b,{segment:e})]},e.key))})}function y(e){let{segments:t}=e;if(0===t.length)return null;let{top:n,bottom:a}=function(e){let t=[],n=[];for(let r of e)g.has(r.key)?t.push(r):n.push(r);return{top:t,bottom:n}}(t);return(0,r.jsxs)("div",{"data-elanous-hud":"strip",role:"status","aria-label":"HUD status",className:"flex flex-col gap-0.5 border-b border-border/40 bg-muted/10 px-3 py-1.5",children:[(0,r.jsx)(v,{segments:n,row:"top"}),(0,r.jsx)(v,{segments:a,row:"bottom",className:"hidden sm:flex"})]})}let w=[];function j(){return w}function k(){let e=(0,a.useSyncExternalStore)(m.er,m.Wl,j);return(0,r.jsx)(y,{segments:e})}var N=n(56178),S=n(38869),C=n(25194);let A=(0,n(89117).A)("hand",[["path",{d:"M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2",key:"1fvzgz"}],["path",{d:"M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2",key:"1kc0my"}],["path",{d:"M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8",key:"10h0bg"}],["path",{d:"M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15",key:"1s1gnw"}]]);var I=n(50940),q=n(67089),T=n(41657),R=n(8979);let E={idle:"음성 대기",connecting:"데몬 연결 중…",listening:"듣는 중",processing:"생각 중…",speaking:"말하는 중",error:"음성 오류"},D={idle:"마이크를 켜서 대화를 시작하세요.",connecting:"잠시만 기다려주세요.",listening:"문장이 끝나면 자동으로 전송됩니다.",processing:"서버가 응답을 생성하는 중입니다.",speaking:"음성 응답을 재생하는 중입니다.",error:"아래 메시지를 확인하고 다시 시도하세요."},U={idle:"bg-slate-400",connecting:"bg-amber-500",listening:"bg-emerald-500",processing:"bg-sky-500",speaking:"bg-fuchsia-500",error:"bg-rose-600"};function L(e){let{active:t,phase:n,errorMsg:a,onToggle:s,ttsSupported:i=!1,ttsMuted:c=!1,onTtsToggle:u,onInterrupt:d}=e,m="speaking"===n&&"function"==typeof d;return(0,r.jsxs)("div",{"data-elanous-voice-overlay":!0,"aria-hidden":!t,className:(0,h.cn)("pointer-events-none absolute inset-0 z-10 flex items-center justify-center transition-opacity duration-300",t?"pointer-events-auto opacity-100":"opacity-0"),children:[(0,r.jsx)("div",{className:"absolute inset-0 bg-background/60 backdrop-blur-md"}),(0,r.jsxs)("div",{className:"relative mx-4 flex w-full max-w-sm flex-col items-center gap-5 rounded-xl border border-border bg-card px-6 py-7 text-center shadow-xl",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 text-sm",children:[(0,r.jsx)("span",{className:(0,h.cn)("h-2.5 w-2.5 rounded-full",U[n],("listening"===n||"speaking"===n||"connecting"===n)&&"animate-pulse"),"aria-hidden":!0}),(0,r.jsx)("span",{className:"font-medium tracking-wide",children:E[n]})]}),(0,r.jsx)("p",{className:"text-xs text-muted-foreground",children:D[n]}),(0,r.jsx)("button",{type:"button",onClick:m?d:s,"data-elanous-action":m?"voice-overlay-interrupt":"voice-overlay-toggle",className:(0,h.cn)("inline-flex h-16 w-16 items-center justify-center rounded-full text-white transition-colors",m?"bg-amber-500 hover:bg-amber-400 animate-pulse":"connecting"===n||"processing"===n?"bg-sky-500 hover:bg-sky-400":"error"===n?"bg-rose-600 hover:bg-rose-500":"bg-rose-500 hover:bg-rose-400"),"aria-label":m?"끼어들기":"마이크 끄기",children:m?(0,r.jsx)(A,{className:"h-7 w-7"}):"connecting"===n||"processing"===n?(0,r.jsx)(I.A,{className:"h-7 w-7 animate-spin"}):"error"===n?(0,r.jsx)(q.A,{className:"h-7 w-7"}):(0,r.jsx)(l.A,{className:"h-7 w-7"})}),a&&(0,r.jsx)("p",{className:"max-w-xs text-xs text-rose-500",children:a}),(0,r.jsxs)("div",{className:"flex items-center gap-4",children:[i&&u&&(0,r.jsxs)("button",{type:"button",onClick:u,"data-elanous-action":"voice-overlay-tts-toggle",className:"inline-flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground","aria-label":c?"음성 응답 켜기":"음성 응답 끄기","aria-pressed":!c,children:[c?(0,r.jsx)(T.A,{className:"h-3.5 w-3.5"}):(0,r.jsx)(R.A,{className:"h-3.5 w-3.5"}),(0,r.jsx)("span",{children:c?"음성 응답 OFF":"음성 응답 ON"})]}),(0,r.jsxs)("button",{type:"button",onClick:s,className:"inline-flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground","aria-label":"음성 닫고 텍스트로 돌아가기",children:[(0,r.jsx)(o.A,{className:"h-3.5 w-3.5"}),(0,r.jsx)("span",{children:"음성 끄기"})]})]})]})]})}function Y(e){let{open:t,onClose:n,lines:s}=e,[l,o]=(0,a.useState)(""),i=(0,a.useMemo)(()=>{if(!l.trim())return null;try{return RegExp(l,"i")}catch(e){return null}},[l]),c=(0,a.useMemo)(()=>l.trim().toLowerCase(),[l]),u=(0,a.useMemo)(()=>{let e=s.length>200?s.slice(s.length-200):s;return i?e.filter(e=>i.test(e.category)||i.test(e.event)):c?e.filter(e=>e.category.toLowerCase().includes(c)||e.event.toLowerCase().includes(c)):e},[s,i,c]);return(0,r.jsx)("div",{"data-elanous-debug-tap-drawer":t?"open":"closed",className:(0,h.cn)("fixed bottom-0 left-0 right-0 z-50 transition-transform duration-200 ease-out","pointer-events-none",t?"translate-y-0":"translate-y-full"),role:"region","aria-label":"Debug Tap Drawer","aria-hidden":!t,children:(0,r.jsxs)("div",{className:(0,h.cn)("pointer-events-auto mx-auto flex max-h-[60vh] w-full max-w-[1100px] flex-col","rounded-t-md border border-b-0 border-border bg-card shadow-xl"),children:[(0,r.jsxs)("header",{className:"flex items-center justify-between gap-2 border-b border-border/60 px-3 py-2",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("span",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Debug Tap"}),(0,r.jsxs)("span",{className:"text-[10px] text-muted-foreground/70","data-elanous-debug-tap-count":u.length,"data-elanous-debug-tap-total":s.length,children:[u.length,"/",s.length]})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("input",{type:"text",placeholder:"regex filter…",value:l,onChange:e=>o(e.target.value),spellCheck:!1,autoComplete:"off",className:(0,h.cn)("w-40 rounded border border-border bg-background px-2 py-1 text-[11px] font-mono","focus:outline-none focus:ring-1 focus:ring-primary"),"data-elanous-debug-tap-filter":"","aria-label":"Filter debug lines"}),(0,r.jsx)("button",{type:"button",onClick:n,className:"rounded px-2 py-1 text-xs text-muted-foreground hover:bg-muted hover:text-foreground","aria-label":"Close debug drawer","data-elanous-debug-tap-close":"",children:"✕"})]})]}),(0,r.jsx)("ul",{className:"flex-1 overflow-y-auto px-3 py-2 text-[11px] font-mono","data-elanous-debug-tap-list":"",children:0===u.length?(0,r.jsx)("li",{className:"italic text-muted-foreground/60",children:0===s.length?"(no debug lines yet)":"(no matches for filter)"}):u.map((e,t)=>(0,r.jsx)(F,{line:e},"".concat(e.loggedAt,"-").concat(e.seq,"-").concat(t)))})]})})}function F(e){let{line:t}=e,n=new Date(t.loggedAt).toISOString().slice(11,23);return(0,r.jsxs)("li",{"data-elanous-debug-tap-line":"","data-elanous-category":t.category,"data-elanous-event":t.event,className:"py-0.5",children:[(0,r.jsxs)("span",{className:"text-muted-foreground/70",children:["[",n,"]"]})," ",(0,r.jsxs)("span",{className:"text-amber-400",children:["[",t.category,"]"]})," ",(0,r.jsx)("span",{className:"text-foreground",children:t.event}),void 0!==t.data&&(0,r.jsxs)("details",{className:"ml-4 text-muted-foreground",children:[(0,r.jsx)("summary",{className:"cursor-pointer select-none text-[10px]",children:"data"}),(0,r.jsx)("pre",{className:"m-0 mt-1 whitespace-pre-wrap break-all text-[10px] text-muted-foreground/80",children:function(e){try{return JSON.stringify(e,null,2)}catch(t){return String(e)}}(t.data)})]})]})}var M=n(33628),O=n(68158),_=n(45977),P=n(19866),z=n(72030),W=n(59062),$=n(749);let Q="Other";function J(e){let{request:t,onSubmit:n,onCancel:a,onChatAboutThis:s}=e;return(0,r.jsx)(P.lG,{open:null!==t,onOpenChange:e=>{e||a()},children:(0,r.jsx)(P.Cf,{className:"max-w-2xl",children:t?(0,r.jsx)(K,{request:t,onSubmit:n,onCancel:a,onChatAboutThis:s}):null})})}function K(e){let{request:t,onSubmit:n,onCancel:s,onChatAboutThis:l}=e,[o,i]=(0,a.useState)(()=>Object.fromEntries(t.questions.map(e=>[e.id,new Set]))),[c,u]=(0,a.useState)({}),[d,h]=(0,a.useState)({}),m=1===t.questions.length?t.questions[0].header:"Pick options",p=(0,a.useMemo)(()=>{for(let n of t.questions){var e;let t=null!=(e=o[n.id])?e:new Set,r=G(n,o,d);if(0===t.size&&!r)return!1}return!0},[t.questions,o,d]);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(P.c7,{children:[(0,r.jsx)(P.L3,{children:m}),1===t.questions.length?(0,r.jsx)(P.rr,{children:t.questions[0].question}):(0,r.jsxs)(P.rr,{children:[t.questions.length," questions"]})]}),(0,r.jsx)($.F,{className:"max-h-[60vh] pr-2",children:(0,r.jsx)("div",{className:"flex flex-col gap-6 py-2",children:t.questions.map(e=>{var t;return(0,r.jsx)(B,{question:e,isSelected:t=>{var n,r,a;return n=e.id,null!=(a=null==(r=o[n])?void 0:r.has(t))&&a},onToggle:t=>{i(n=>{var r;let a={...n},s=new Set(null!=(r=a[e.id])?r:[]);return e.multiSelect?s.has(t)?s.delete(t):s.add(t):(s.clear(),s.add(t),h(t=>({...t,[e.id]:!1}))),a[e.id]=s,a})},otherActive:G(e,o,d),onToggleOther:()=>{e.multiSelect?h(t=>{var n;return{...t,[e.id]:!(null!=(n=t[e.id])&&n)}}):i(t=>{let n={...t};return n[e.id]=new Set([Q]),n})},otherText:null!=(t=c[e.id])?t:"",onOtherText:t=>u(n=>({...n,[e.id]:t}))},e.id)})})}),(0,r.jsxs)(P.Es,{className:"flex-wrap gap-2 sm:justify-between",children:[(0,r.jsx)(z.$,{variant:"ghost",onClick:l,"aria-label":"Chat about this",children:"\uD83D\uDCAC Chat about this"}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(z.$,{variant:"outline",onClick:s,children:"Cancel"}),(0,r.jsx)(z.$,{onClick:function(){let e={},r={};for(let n of t.questions){var a,s;let t=Array.from(null!=(a=o[n.id])?a:[]);if(G(n,o,d)&&!t.includes(Q)&&t.push(Q),0!==t.length&&(n.multiSelect?e[n.id]=t:e[n.id]=t[0],t.includes(Q))){let e=(null!=(s=c[n.id])?s:"").trim();e.length>0&&(r[n.id]=e)}}let l={answers:e};Object.keys(r).length>0&&(l.otherText=r),n(l)},disabled:!p,children:"Submit"})]})]})]})}function B(e){var t,n;let{question:a}=e;return(0,r.jsxs)("section",{className:"flex flex-col gap-2",children:[""!==e.question.id?(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("span",{className:"rounded-full bg-primary/15 px-2 py-0.5 text-xs font-medium text-primary",children:a.header}),a.multiSelect?(0,r.jsx)("span",{className:"text-xs text-muted-foreground",children:"multi-select"}):null]}):null,(0,r.jsxs)("div",{className:"flex flex-col gap-1.5",children:[a.options.map(t=>{var n;return(0,r.jsx)(V,{multi:null!=(n=a.multiSelect)&&n,option:t,selected:e.isSelected(t.label),onToggle:()=>e.onToggle(t.label)},t.label)}),null==(t=a.includeOther)||t?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(V,{multi:null!=(n=a.multiSelect)&&n,option:{label:"Other",description:"Type your own response"},selected:e.otherActive,onToggle:e.onToggleOther}),e.otherActive?(0,r.jsx)(W.p,{value:e.otherText,onChange:t=>e.onOtherText(t.target.value),placeholder:"Type your own response","aria-label":"Other response",className:"ml-8"}):null]}):null]})]})}function V(e){let{multi:t,option:n,selected:a,onToggle:s}=e;return(0,r.jsxs)("button",{type:"button",role:t?"checkbox":"radio","aria-checked":a,onClick:s,className:"\n flex items-start gap-3 rounded-md border p-3 text-left\n transition-colors\n ".concat(a?"border-primary bg-primary/10":"border-border hover:bg-muted/40","\n "),children:[(0,r.jsx)("span",{className:"mt-0.5 flex h-5 w-5 shrink-0 items-center justify-center ".concat(t?"rounded":"rounded-full"," border ").concat(a?"border-primary bg-primary text-primary-foreground":"border-muted-foreground/40"),"aria-hidden":"true",children:a?t?"✓":"●":null}),(0,r.jsxs)("span",{className:"flex flex-col gap-0.5",children:[(0,r.jsx)("span",{className:"font-medium",children:n.label}),(0,r.jsx)("span",{className:"text-sm text-muted-foreground",children:n.description}),n.preview?(0,r.jsx)("span",{className:"mt-1 rounded bg-muted/40 px-2 py-1 text-xs font-mono text-muted-foreground",children:n.preview}):null]})]})}function G(e,t,n){var r,a,s;return e.multiSelect?null!=(a=n[e.id])&&a:null!=(s=null==(r=t[e.id])?void 0:r.has(Q))&&s}var H=n(72422),Z=n(66062),X=n(51215);function ee(e,t){var n;return"error"!==t.kind?null:null!=(n=function(e){if(!e||"object"!=typeof e)return null;let{error:t,message:n,holder:r}=e;return"turn_busy"!==t?null:{message:"string"==typeof n?n:"This session is currently receiving input. Please try again when that turn finishes.",holder:"string"==typeof r&&r.trim()?r:null}}(t.payload))?n:e}function et(e){return"string"==typeof e.mediaType&&e.mediaType.toLowerCase().startsWith("image/")}async function en(e,t){let n=e.downloadUrl.startsWith("http")?e.downloadUrl:"".concat(t.baseUrl.replace(/\/$/,"")).concat(e.downloadUrl),r={};t.token&&(r.authorization="Bearer ".concat(t.token));let a=await fetch(n,{headers:r});if(!a.ok)throw Error("fetch attachment ".concat(e.id," failed: ").concat(a.status));return function(e){let t=new Uint8Array(e),n="";for(let e=0;e<t.length;e+=32768)n+=String.fromCharCode(...t.subarray(e,e+32768));return btoa(n)}(await a.arrayBuffer())}async function er(e,t,n){if(0===t.length)return null;let r=[];for(let a of(e.length>0&&r.push({type:"text",text:e}),t))if(et(a))try{let e=await en(a,n);r.push({type:"image",mimeType:a.mediaType,data:e})}catch(t){let e=t instanceof Error?t.message:String(t);r.push({type:"text",text:"[image fetch failed: ".concat(a.filename," — ").concat(e,"]")})}else r.push({type:"resource_link",uri:a.path?"file://".concat(a.path):a.downloadUrl,mimeType:a.mediaType,name:a.filename});return r}function ea(){var e;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{client:n,config:p,sessionId:g,setSessionId:f}=(0,i.Q)(),[x,b]=(0,a.useState)([]),[v,y]=(0,a.useState)(),[w,j]=(0,a.useState)(!1),[A,I]=(0,a.useState)(null),[q,T]=(0,a.useState)(null),[R,E]=(0,a.useState)([]),D=(0,a.useRef)(!1),U=(0,a.useRef)(null),F=(0,a.useRef)(null),[P,z]=(0,a.useState)(null),W=(0,a.useMemo)(()=>{try{let e=new URLSearchParams(window.location.search);return"on"===e.get("debug-tap")}catch(e){return!1}},[]),[$,Q]=(0,a.useState)(W),K=(0,a.useMemo)(()=>{let e=[];for(let t of x)if(Array.isArray(t.blocks)){for(let n of t.blocks)if("debug_session"===n.kind)for(let t of n.lines)e.push({seq:t.seq,category:t.category,event:t.event,...void 0!==t.data?{data:t.data}:{},loggedAt:t.loggedAt})}return e},[x]),B=(0,a.useRef)(async()=>{}),V=(0,a.useRef)(!1);V.current=w;let G=(0,a.useRef)(async()=>{}),en=n.voiceWsUrl(),ea=(0,a.useCallback)(e=>{let t=e.trim();if(t){if(V.current)return void(0,X.cY)("chat.voice.skip-pending",{len:t.length});(0,X.cY)("chat.voice.auto-send",{len:t.length}),B.current(t)}},[]),es=(0,O.sS)({wsUrl:en,...p.token?{token:p.token}:{},onTranscript:ea}),el=!!p.baseUrl;G.current=()=>es.toggle();let[eo,ei]=(0,a.useState)(!1),ec=(0,_.$)({enabled:es.active&&!eo,language:"ko-KR"}),eu=(0,a.useCallback)(()=>{null==q||q.abort(),(0,X.cY)("webterm.chat.stop",{had:!!q})},[q]);(0,a.useEffect)(()=>{if(!q)return;let e=e=>{var t;if("Escape"!==e.key)return;let n=e.target,r=null==n||null==(t=n.tagName)?void 0:t.toLowerCase();"input"===r||"textarea"===r||null!=n&&n.isContentEditable||(e.preventDefault(),eu())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[q,eu]),(0,a.useEffect)(()=>{let e=e=>{"m"===e.key.toLowerCase()&&e.shiftKey&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),(0,X.cY)("chat.voice.shortcut.toggle"),G.current())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[]);let ed=(0,a.useCallback)(e=>{E(t=>[...t,...e]),(0,X.cY)("webterm.chat.attach.queue",{added:e.length,filenames:e.map(e=>e.filename)})},[]);(0,a.useEffect)(()=>{try{let e=window.sessionStorage.getItem("elanous.pwa.shareAttachments");if(!e)return;window.sessionStorage.removeItem("elanous.pwa.shareAttachments");let t=JSON.parse(e);if(!Array.isArray(t)||0===t.length)return;E(e=>[...e,...t]);let n=1===t.length?"1 file shared from another app":"".concat(t.length," files shared from another app");Z.oR.success(n),(0,X.cY)("pwa.chat.share-attachments.consume",{count:t.length})}catch(e){(0,X.cY)("pwa.chat.share-attachments.parse-failed",{reason:e instanceof Error?e.message:String(e)})}},[]);let eh=(0,a.useRef)("");(0,a.useEffect)(()=>{if(!g||eh.current===g)return;eh.current=g;let e=!0;return(async()=>{try{let t=await n.fetchJson("/v1/sessions/store/".concat(encodeURIComponent(g),"?ifExists=1"));if(!e||!(null==t?void 0:t.messages)||0===t.messages.length)return;b(e=>e.length>0?e:function(e,t){let n,r=[],a=[];for(let l of e){var s;if("tool"===l.role){for(let e of function(e,t){let n,r=function(e,t){var n,r;let a,s=String(null!=(n=e.toolName)?n:"");try{a=JSON.parse(String(null!=(r=e.toolResult)?r:""))}catch(e){a=void 0}let l=a&&"object"==typeof a&&!Array.isArray(a)?a:void 0,o=null==l?void 0:l._meta,i=o&&"object"==typeof o&&!Array.isArray(o)?o.ui:void 0,c=i&&"object"==typeof i&&!Array.isArray(i)?i.resourceUri:void 0,u=null==l?void 0:l["ui/resourceUri"],d="string"==typeof c?c:"string"==typeof u?u:void 0;return void 0!==d&&""!==d.trim()?{kind:"mcp_app",toolId:t,toolName:s,screenUrl:d,...void 0!==a?{toolResult:a}:{}}:{kind:"tool_use",id:t,name:s,status:"done",...void 0!==l&&void 0!==e.toolArgs?{args:{raw:String(e.toolArgs)}}:{}}}(e,t);try{var a;n=JSON.parse(String(null!=(a=e.toolResult)?a:""))}catch(e){n=void 0}return[...(0,m.uS)(n).map(e=>({kind:"image",...e})),r]}(l,"restore-tool-".concat(a.length,"-").concat(r.length)))"image"===e.kind&&a.some(t=>"image"===t.kind&&t.src===e.src)||a.push(e);continue}if("user"!==l.role&&"assistant"!==l.role)continue;let e=String(null!=(s=l.content)?s:""),o=String(null!=e?e:"").split("\n").filter(e=>!/^\[tool_(use|result)\]$/.test(e.trim())).join("\n"),i="assistant"===l.role?"assistant":"user";if(""===o.trim()){a.length>0&&"assistant"===i&&(r.push({id:"restore-".concat(r.length),role:i,text:"",blocks:a,timestamp:t+r.length}),a=[]);continue}let c=o!==e,u=void 0!==n&&n.role===i&&n.text===o&&(c||n.wasStripped)&&0===a.length;if(n={role:i,text:o,wasStripped:c},u)continue;let d=a.length>0&&"assistant"===i?[...a,{kind:"text",text:o}]:void 0;void 0!==d&&(a=[]),r.push({id:"restore-".concat(r.length),role:i,text:o,...void 0!==d?{blocks:d}:{},timestamp:t+r.length})}return a.length>0&&(r.push({id:"restore-".concat(r.length),role:"assistant",text:"",blocks:a,timestamp:t+r.length}),a=[]),r}(t.messages,Date.now()))}catch(e){}})(),()=>{e=!1}},[g,n]);let em=(0,a.useCallback)(e=>{E(t=>t.filter(t=>t.id!==e))},[]),ep={client:n,sessionId:g,provider:p.provider,setSessionId:f,daemon:{baseUrl:p.baseUrl,...p.token?{token:p.token}:{}},messages:x},eg=e=>{b(t=>[...t,e])},ef=async e=>{I(e=>ee(e,{kind:"turn-begin"})),(0,X.cY)("webterm.chat.input",{len:e.length,attachCount:R.length}),E([]);let t=R.filter(et),r=R.filter(e=>!et(e)),a=function(e){if(!e)return!0;let t=e.toLowerCase();return!!("auto"===t||t.startsWith("anthropic")||"anthropic"===t||t.startsWith("codex")||"openai-codex"===t||t.startsWith("openai")||"openai"===t||t.startsWith("gemini")||"gemini"===t||t.startsWith("grok")||"grok"===t||t.startsWith("local"))}(p.provider),s=t.length>0&&a;t.length>0&&!a&&Z.oR.warning("이 모델은 이미지 입력을 지원하지 않습니다 — ".concat(t.length,"개 이미지가 무시됩니다. (vision 모델로 전환 후 재첨부)"));let l=r.map(e=>e.path?"[attached] ".concat(e.path):"").filter(e=>e.length>0),o=l.length>0?"".concat(l.join("\n"),"\n\n").concat(e).trimEnd():e,i=null;if(s&&p.baseUrl)try{i=await er(o,t,{baseUrl:p.baseUrl,token:p.token})}catch(t){let e=t instanceof Error?t.message:String(t);(0,X.cY)("webterm.chat.attach.contentblock.error",{msg:e}),Z.oR.error("이미지 첨부 변환 실패 — 텍스트만 전송: ".concat(e)),i=null}e.length>0&&eg((0,m.tw)(e)),R.length>0&&eg((0,m.$Q)("\uD83D\uDCCE attached: ".concat(R.map(e=>e.filename).join(", "))));let c=e?await (0,m.yN)(e,ep):null;if(c){"__CLEAR__"===c.text?b([]):eg((0,m.$Q)(c.text)),c.newSessionId&&f(c.newSessionId);return}if(!p.baseUrl)return void eg((0,m.$Q)("error: daemon baseUrl not configured. Visit /settings."));j(!0),D.current=!0;let u="m-stream-".concat(Date.now(),"-").concat(Math.random().toString(36).slice(2,6));eg({id:u,role:"assistant",text:"",timestamp:Date.now(),meta:{provider:p.provider}});let d=new AbortController;T(d);let h=0,x=F.current,v=!!(x&&g&&p.baseUrl),y=null;(0,X.cY)("webterm.chat.runturn.path",{useAcpPath:v,hasAcp:!!x,hasSession:!!g});let w=e=>{b(t=>t.map(t=>t.id===u?{...t,text:e}:t)),e.length>h&&(ec.pushText(e.slice(h)),h=e.length)},k=e=>{b(t=>t.map(t=>t.id===u?{...t,blocks:e}:t))};try{v&&(y=n.connectAcp({sessionId:g}));let{message:e,newSessionId:t}=v?await (0,m.py)(y,o,{...ep,sessionId:await y.ready||g},{signal:d.signal,...i?{userContent:i}:{},onPartial:w,onPartialBlocks:k}):await (0,m.HD)(o,ep,{signal:d.signal,...i?{userContent:i}:{},...$?{debugTap:!0}:{},onPartial:w,onPartialBlocks:k,onError:e=>I(t=>ee(t,{kind:"error",payload:e}))});I(e=>ee(e,{kind:"turn-end"})),b(t=>t.map(t=>t.id===u?e:t)),t&&f(t),ec.flush()}catch(n){let e=d.signal.aborted,t=n instanceof Error?n.message:String(n);ec.cancel(),e?(b(e=>e.map(e=>e.id===u?{...e,meta:{...e.meta,stopReason:"aborted"}}:e)),(0,X.cY)("webterm.chat.runturn.stream.abort",{reason:t})):(b(e=>e.filter(e=>e.id!==u)),eg((0,m.$Q)("error: ".concat(t))),Z.oR.error("chat failed: ".concat(t)),(0,X.cY)("webterm.chat.runturn.error",{reason:t,useAcpPath:v}))}finally{null==y||y.close(),j(!1),T(null),D.current=!1}};B.current=ef,(0,a.useEffect)(()=>{I(e=>ee(e,{kind:"session-change"}))},[g]),(0,a.useEffect)(()=>{if(!g||!p.baseUrl)return;let e=(0,m.lY)(n,g,{isLocalTurnInFlight:()=>D.current,provider:p.provider,onPlaceholder:e=>{let{sessionId:t}=e;I(e=>ee(e,{kind:"turn-begin"}));let n="m-obs-".concat(Date.now(),"-").concat(Math.random().toString(36).slice(2,6)),r={id:n,role:"assistant",text:"",timestamp:Date.now(),meta:{provider:p.provider}};return(0,X.cY)("webterm.chat.observer.placeholder",{id:n,turnSessionId:t}),b(e=>[...e,r]),U.current=n,n},onPartialBlocks:(e,t)=>{b(n=>n.map(n=>n.id===e?{...n,blocks:t}:n))},onFinalize:(e,t)=>{I(e=>ee(e,{kind:"turn-end"})),b(n=>n.map(n=>n.id===e?t:n)),U.current===e&&(U.current=null)},onError:(e,t)=>{I(e=>ee(e,{kind:"error",payload:t})),(0,X.cY)("webterm.chat.observer.error",{placeholderId:e,error:t.error}),b(n=>n.map(n=>n.id===e?{...n,meta:{...n.meta,stopReason:t.error}}:n)),U.current===e&&(U.current=null)}});return()=>{e()}},[n,g,p.baseUrl,p.provider]),(0,a.useEffect)(()=>{if(!g||!p.baseUrl)return;let e=n.subscribeChatFeedbackEvents(g,{agentStatus:{onFeedback:e=>{b(t=>{if(0===t.length)return t;for(let n=t.length-1;n>=0;n--){if("assistant"!==t[n].role)continue;let r=t[n],a=Array.isArray(r.blocks)?[...r.blocks]:[];if("applied"!==(0,M.K4)(a,e))break;let s={...r,blocks:a};return[...t.slice(0,n),s,...t.slice(n+1)]}return t})},onError:e=>{(0,X.cY)("webterm.agent-status.error",e)}},hudSegment:{onFeedback:e=>(0,m.Ju)(e),onError:e=>{(0,X.cY)("webterm.hud-segment.error",e)}}});return()=>{e()}},[n,g,p.baseUrl]),(0,a.useEffect)(()=>{if(!g||!p.baseUrl)return;let e=null;try{e=n.connectAcp({sessionId:g,onSession:e=>{if(e&&e!==g){var n;(0,X.cY)("webterm.chat.acp.session-adopt",{previous:g,issued:e}),null==(n=t.onSessionAdopt)||n.call(t,e),f(e)}}})}catch(e){(0,X.cY)("webterm.chat.acp.connect-failed",{reason:String(e)});return}F.current=e,z(e);let r=e;(0,X.x8)(async e=>{let t=JSON.parse(e);return await r.send("elanous/debug-logs/ingest",{records:t.records}),!0});let a=(0,m.ZH)(e,g,{isLocalTurnInFlight:()=>D.current,isRemoteSseTurnInFlight:()=>null!==U.current,onPlaceholder:e=>{let{sessionId:t}=e;I(e=>ee(e,{kind:"turn-begin"}));let n="m-acp-".concat(Date.now(),"-").concat(Math.random().toString(36).slice(2,6)),r={id:n,role:"assistant",text:"",timestamp:Date.now(),meta:{provider:p.provider}};return(0,X.cY)("webterm.chat.acp.foreign-placeholder",{id:n,turnSessionId:t}),b(e=>[...e,r]),n},onPartialBlocks:(e,t)=>{let n=t.find(e=>"text"===e.kind),r=t.some(e=>"image"===e.kind||"tool_use"===e.kind);b(a=>a.map(a=>a.id===e?{...a,...n?{text:n.text}:{},...r?{blocks:t}:{}}:a))},onFinalize:e=>{(0,X.cY)("webterm.chat.acp.foreign-finalize",{placeholderId:e})}});return()=>{a(),(0,X.x8)(null);try{null==e||e.close()}catch(e){}F.current===e&&(F.current=null),z(null)}},[n,g,p.baseUrl,p.provider]);let ex=function(e){var t;let{acp:n,onComposerPrefill:r}=e,[s,l]=(0,a.useState)(null),o=(0,a.useRef)(null),i=(0,a.useCallback)(e=>{o.current=e,l(e)},[]),c=(0,a.useCallback)(e=>{let t=o.current;t&&(t.resolve(e),i(null))},[i]);(0,a.useEffect)(()=>{if(!n)return;let e=n.onRequest("elanous/ask/request",async e=>{let t=function(e){if(!e||"object"!=typeof e||"string"!=typeof e.id||!e.id||!e.request||"object"!=typeof e.request)return null;let t=e.request;return Array.isArray(t.questions)&&0!==t.questions.length?{id:e.id,request:e.request}:null}(e);if(!t)return{answers:{},cancelled:!0};let n=o.current;return n&&n.resolve({answers:{},cancelled:!0}),await new Promise(e=>{i({request:t.request,resolve:e,askId:t.id})})}),t=n.on("sessionUpdate",()=>{}),r=n.onAny(e=>{var t;if("elanous/ask/cancel"!==e.method||void 0!==e.id)return;let n=(t=e.params)&&"object"==typeof t&&"string"==typeof t.id&&t.id?{id:t.id,..."string"==typeof t.reason?{reason:t.reason}:{}}:null;if(!n)return;let r=o.current;r&&r.askId===n.id&&c({answers:{},cancelled:!0})});return()=>{e(),t(),r();let n=o.current;n&&(n.resolve({answers:{},cancelled:!0}),o.current=null)}},[n,i,c]);let u=(0,a.useCallback)(e=>{c(e)},[c]),d=(0,a.useCallback)(()=>{c({answers:{},cancelled:!0})},[c]),h=(0,a.useCallback)(()=>{let e=o.current;e&&r&&r(e.request),c({answers:{},cancelled:!0})},[c,r]);return{pendingRequest:null!=(t=null==s?void 0:s.request)?t:null,submit:u,cancel:d,chatAboutThis:h}}({acp:P,onComposerPrefill:e=>{let t=e.questions[0];if(!t)return;let n="[ Q: ".concat(t.question.trim()," ]\n\n");(0,N.vn)(n),y(e=>{var t;return{text:n,id:(null!=(t=null==e?void 0:e.id)?t:0)+1}}),Z.oR.info("\uD83D\uDCAC 입력 영역에 질문 prefill 됨 (Chat about this)")}});return(0,r.jsxs)("div",{className:"flex h-full flex-col",children:[(0,r.jsxs)("div",{className:"flex shrink-0 items-center justify-between gap-3 border-b border-border bg-background px-4 py-2",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(d.Qh,{sessionId:g,...t.onAttachRequest?{onAttachRequest:t.onAttachRequest}:{},...t.onForgetRequest?{onForgetRequest:t.onForgetRequest}:{}}),(0,r.jsx)(s.vG,{children:(0,r.jsx)(S.rm,{})}),(0,r.jsx)(s.vG,{children:(0,r.jsx)(C.D,{})})]}),(0,r.jsx)("div",{className:"flex items-center gap-2",children:(0,r.jsxs)("button",{type:"button",onClick:()=>void es.toggle(),disabled:!el,title:el?null!=(e=es.errorMsg)?e:H.g[es.phase]:"daemon URL 미설정 — Settings 에서 Base URL 입력","data-elanous-action":"chat-voice-toggle",className:(0,h.cn)("inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-medium transition-colors",es.active?"border-rose-500/40 bg-rose-500/10 text-rose-600 hover:bg-rose-500/20":"border-border bg-background text-foreground hover:bg-muted",!el&&"cursor-not-allowed opacity-50"),children:[(0,r.jsx)("span",{className:(0,h.cn)("h-2 w-2 rounded-full",H.x[es.phase],("listening"===es.phase||"speaking"===es.phase)&&"animate-pulse"),"aria-hidden":!0}),es.active?(0,r.jsx)(l.A,{className:"h-3.5 w-3.5"}):(0,r.jsx)(o.A,{className:"h-3.5 w-3.5"}),(0,r.jsx)("span",{className:"hidden sm:inline",children:H.g[es.phase]})]})})]}),(0,r.jsx)(k,{}),(0,r.jsxs)("div",{className:"relative flex flex-1 min-h-0 flex-col",children:[(0,r.jsx)(c.D,{messages:x,pending:w,...t.tabId?{tabId:t.tabId}:{}}),A&&(0,r.jsxs)("div",{role:"alert",className:"mx-4 mb-3 flex shrink-0 items-start justify-between gap-3 rounded-md border border-amber-500/40 bg-amber-500/10 px-3 py-2 text-sm text-foreground","data-elanous-turn-busy-banner":"",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"font-medium",children:"This session is busy"}),(0,r.jsx)("p",{className:"text-muted-foreground",children:A.message}),(0,r.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:A.holder?"Current input holder: ".concat(A.holder):"The current input holder is not available."})]}),(0,r.jsx)("button",{type:"button",onClick:()=>I(null),className:"rounded px-2 py-1 text-xs text-muted-foreground hover:bg-amber-500/10 hover:text-foreground","aria-label":"Dismiss busy-session notice",children:"Dismiss"})]}),(0,r.jsx)(L,{active:es.active,phase:es.phase,errorMsg:es.errorMsg,onToggle:()=>void es.toggle(),ttsSupported:ec.supported,ttsMuted:eo,onTtsToggle:()=>ei(e=>!e),onInterrupt:()=>{try{ec.cancel()}catch(e){}es.interrupt()}})]}),w&&q&&(0,r.jsxs)("div",{className:"flex shrink-0 items-center justify-end gap-2 border-t border-border bg-muted/30 px-4 py-1.5 text-xs",children:[(0,r.jsx)("span",{className:"text-muted-foreground",children:"streaming…"}),(0,r.jsx)("button",{type:"button",onClick:eu,className:"rounded border border-border bg-background px-2 py-0.5 font-mono hover:bg-muted","data-elanous-action":"chat-stop",title:"Stop the running turn (Esc)",children:"Stop ⎋"})]}),(0,r.jsx)(u.V,{onSubmit:ef,prefill:v,disabled:w,attachments:R,onAttached:ed,onRemoveAttachment:em,voice:{active:es.active,phase:es.phase,dotColor:H.x[es.phase],phaseLabel:H.g[es.phase],disabled:!el,onToggle:()=>void es.toggle()},...t.tabId?{tabId:t.tabId}:{},onListFiles:P&&g?async e=>{var t,n;let r=await P.send("elanous/fs/list",{sessionId:g,query:e,limit:50}),a=(null!=(t=r.entries)?t:[]).filter(e=>"string"==typeof(null==e?void 0:e.name)&&"boolean"==typeof(null==e?void 0:e.isDir)&&"string"==typeof(null==e?void 0:e.relPath)).map(e=>({name:e.name,isDir:e.isDir,relPath:e.relPath}));return{cwd:null!=(n=r.cwd)?n:"",entries:a}}:void 0,onListSkills:P&&g?async e=>{var t;return{entries:(null!=(t=(await P.send("elanous/skills/list",{sessionId:g,query:e})).entries)?t:[]).filter(e=>"string"==typeof(null==e?void 0:e.name)&&"string"==typeof(null==e?void 0:e.description)).map(e=>({name:e.name,description:e.description}))}}:void 0}),W&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(Y,{open:$,onClose:()=>Q(!1),lines:K}),!$&&(0,r.jsxs)("button",{type:"button",onClick:()=>Q(!0),"data-elanous-debug-tap-reopen":"",className:(0,h.cn)("fixed bottom-3 right-3 z-40 rounded-full border border-border bg-card px-3 py-1.5","text-[11px] font-mono text-muted-foreground shadow hover:bg-muted hover:text-foreground"),"aria-label":"Reopen debug drawer",title:"Reopen Debug Tap drawer",children:["⌁ debug (",K.length,")"]})]}),(0,r.jsx)(J,{request:ex.pendingRequest,onSubmit:ex.submit,onCancel:ex.cancel,onChatAboutThis:ex.chatAboutThis})]})}var es=n(48619),el=n(82443);function eo(){var e;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=(0,es.tg)(),{client:s,sessionId:l,setSessionId:o}=(0,i.Q)(),[c,u]=(0,a.useState)(l||"default"),d=(0,a.useRef)(null);(0,a.useEffect)(()=>{if(d.current===l){d.current=null;return}d.current=null,u(l||"default")},[l]);let h=(0,a.useRef)(t.sessionId),m=(0,a.useRef)(l),p=null!=(e=null==n?void 0:n.state.activeId)?e:null;(0,a.useEffect)(()=>{let e=t.sessionId;if(n&&t.tabId&&e&&l){var r,a;let s=function(e){if(!e.isActive||e.tabSessionId===e.daemonSessionId)return"none";let t=e.prevTabSessionId!==e.tabSessionId,n=e.prevDaemonSessionId!==e.daemonSessionId;return t||!n?"adopt-tab":"record-global"}({isActive:p===t.tabId,tabSessionId:e,daemonSessionId:l,prevTabSessionId:null!=(r=h.current)?r:e,prevDaemonSessionId:null!=(a=m.current)?a:l});"adopt-tab"===s?o(e):"record-global"===s&&n.updateChatTab(t.tabId,{sessionId:l})}h.current=t.sessionId,m.current=l},[n,p,t.tabId,t.sessionId,l,o]);let g=n&&t.tabId?()=>n.openPicker({kind:"attachToTab",tabId:t.tabId}):void 0,f=n&&t.sessionId?async()=>{let e=(0,el.hG)(s);await e.forget(t.sessionId)}:void 0;return(0,r.jsx)(ea,{onSessionAdopt:e=>{d.current=e},...g?{onAttachRequest:g}:{},...f?{onForgetRequest:f}:{},...t.tabId?{tabId:t.tabId}:{}},c)}}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6284],{749:(e,t,n)=>{n.d(t,{F:()=>d});var r=n(41121);n(91269);var s=n(442),a=n(14402),o=n(29836),l=n(41004),i=n(54408),c=n(82157);function d(e){let{className:t,children:n,...l}=e;return(0,r.jsxs)(s.V,{"data-slot":"scroll-area",className:(0,c.cn)("relative",t),...l,children:[(0,r.jsx)(a.B,{"data-slot":"scroll-area-viewport",className:"size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1",children:n}),(0,r.jsx)(u,{}),(0,r.jsx)(o.I,{})]})}function u(e){let{className:t,orientation:n="vertical",...s}=e;return(0,r.jsx)(l.V,{"data-slot":"scroll-area-scrollbar","data-orientation":n,orientation:n,className:(0,c.cn)("flex touch-none p-px transition-colors select-none data-horizontal:h-2.5 data-horizontal:flex-col data-horizontal:border-t data-horizontal:border-t-transparent data-vertical:h-full data-vertical:w-2.5 data-vertical:border-l data-vertical:border-l-transparent",t),...s,children:(0,r.jsx)(i.l,{"data-slot":"scroll-area-thumb",className:"relative flex-1 rounded-full bg-border"})})}},5159:(e,t,n)=>{n.d(t,{h:()=>l,t:()=>o});var r=n(91269),s=n(38519),a=n(82443);function o(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{client:t}=(0,s.Q)(),n=(0,a.hG)(t),o=()=>n.list(),l=(0,r.useSyncExternalStore)(e=>n.subscribe(e),o,o);return(0,r.useEffect)(()=>{if(e.activePoll)return n.enterActive()},[n,e.activePoll]),l}function l(){let{client:e}=(0,s.Q)(),t=(0,a.hG)(e),n=o({activePoll:!0}),[,l]=(0,r.useState)(0);return(0,r.useEffect)(()=>{t.forceRefresh().then(()=>l(e=>e+1))},[t]),n}},9290:(e,t,n)=>{n.d(t,{T:()=>u});var r=n(41121),s=n(91269),a=n(50940),o=n(12093),l=n(38519),i=n(66062),c=n(51215),d=n(73313);function u(e){let{onAttached:t}=e,{config:n}=(0,l.Q)(),[u,m]=(0,s.useState)(!1),f=(0,s.useRef)(null),p=async e=>{var r;let s=null==(r=e.target.files)?void 0:r[0];if(e.target.value="",s){if(!n.baseUrl)return void i.oR.error("Daemon URL 미설정 — Settings 에서 입력");m(!0),(0,c.cY)("webterm.attach.pick",{filename:s.name,size:s.size,type:s.type});try{let e=await (0,d.v)({baseUrl:n.baseUrl,...n.token?{token:n.token}:{},file:s,filename:s.name});if(!e.ok){(0,c.cY)("webterm.attach.error",{status:e.status,detail:e.reason.slice(0,200)}),i.oR.error("업로드 실패 (".concat(e.status,")"));return}let{meta:r}=e;(0,c.cY)("webterm.attach.ok",{id:r.id,size:r.size}),i.oR.success("\uD83D\uDCCE ".concat(r.filename," (").concat((r.size/1024).toFixed(1)," kB)")),null==t||t(r)}catch(e){(0,c.cY)("webterm.attach.exception",{reason:String(e)}),i.oR.error("업로드 실패: ".concat(String(e instanceof Error?e.message:e)))}finally{m(!1)}}};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("button",{type:"button",onClick:()=>{var e;return null==(e=f.current)?void 0:e.click()},disabled:u,"aria-label":"attach photo",title:"attach photo (camera or file)",className:"rounded p-1.5 text-muted-foreground hover:bg-accent hover:text-foreground disabled:opacity-50",children:u?(0,r.jsx)(a.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,r.jsx)(o.A,{className:"h-3.5 w-3.5"})}),(0,r.jsx)("input",{ref:f,type:"file",accept:"image/*",capture:"environment",className:"hidden",onChange:p})]})}},19206:(e,t,n)=>{n.d(t,{V:()=>R});var r=n(41121),s=n(91269),a=n(20322),o=n(72754),l=n(82823),i=n(73139),c=n(4074),d=n(66062),u=n(72030),m=n(56594),f=n(56178),p=n(82157),h=n(9290),x=n(31113),g=n(73404),b=n(50940),v=n(19866),j=n(38519),y=n(51215),w=n(95939);function k(e){let{open:t,image:n,filename:a="photo.jpg",onClose:o}=e,{config:l}=(0,j.Q)(),[i,c]=(0,s.useState)("idle"),[m,f]=(0,s.useState)(""),[p,h]=(0,s.useState)("minimal"),[x,g]=(0,s.useState)("minimal"),k=(0,w.hn)(),[N,S]=(0,s.useState)(k.defaultUseLlmVision),[I,C]=(0,s.useState)(k.defaultPreferHandwriting),[D,E]=(0,s.useState)(""),[L,M]=(0,s.useState)(""),[A,T]=(0,s.useState)("");async function R(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:N,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:I;if(!n)return;if(!l.baseUrl){M("Daemon URL 미설정 — Settings 에서 입력"),c("error");return}c("ocr"),M("");let s=new FormData;s.append("image",n,a),s.append("polishMode",e);let o=[];t&&o.push("context-aware","diagrams"),r&&o.push("handwriting"),o.length>0&&s.append("strengths",o.join(",")),(0,y.cY)("notes.ocr.start",{polishMode:e,vision:t,handwriting:r,filename:a,size:n.size});try{let t=await fetch("".concat(l.baseUrl,"/v1/notes/from-image"),{method:"POST",body:s,...l.token?{headers:{authorization:"Bearer ".concat(l.token)}}:{}});if(!t.ok){let e=await t.text().catch(()=>"");M("OCR 실패 (HTTP ".concat(t.status,") ").concat(e.slice(0,160))),c("error"),(0,y.cY)("notes.ocr.error",{status:t.status,detail:e.slice(0,200)});return}let n=await t.json(),r=n.usedLlmPolish?n.polishMode:"minimal";if(0===n.markdown.trim().length){M(n.usedLlmPolish?"이미지에서 텍스트를 추출하지 못했습니다. 다른 사진으로 다시 시도해주세요.":"이미지에서 텍스트를 추출하지 못했습니다. 다른 사진을 사용하거나 polishMode를 'enrich'로 바꾸어 LLM polish를 시도해주세요."),h(n.polishMode),g(r),E(n.provider),c("error"),(0,y.cY)("notes.ocr.empty",{provider:n.provider,requested:e,applied:r,usedLlmPolish:n.usedLlmPolish});return}f(n.markdown),T(n.markdown),E(n.provider),h(n.polishMode),g(r),c("review"),(0,y.cY)("notes.ocr.ok",{provider:n.provider,requested:e,applied:r,usedLlmPolish:n.usedLlmPolish,chars:n.markdown.length})}catch(e){M("OCR 실패: ".concat(String(e instanceof Error?e.message:e))),c("error"),(0,y.cY)("notes.ocr.exception",{reason:String(e)})}}async function U(){if(!l.baseUrl){M("Daemon URL 미설정"),c("error");return}let e=m!==A;c("saving"),(0,y.cY)("notes.save.start",{provider:D,selectedPolishMode:p,appliedPolishMode:x,edited:e,chars:m.length}),e&&P("edit");try{let e=await fetch("".concat(l.baseUrl,"/v1/notes/save"),{method:"POST",headers:{"content-type":"application/json",...l.token?{authorization:"Bearer ".concat(l.token)}:{}},body:JSON.stringify({markdown:m,sourceProvider:D,polishMode:x})});if(!e.ok){let t=await e.text().catch(()=>"");M("저장 실패 (HTTP ".concat(e.status,") ").concat(t.slice(0,160))),c("error"),(0,y.cY)("notes.save.error",{status:e.status,detail:t.slice(0,200)});return}let t=await e.json();c("saved"),d.oR.success("\uD83D\uDCDD 저장됨 — ".concat(t.vaultLabel," \xb7 ").concat(t.knowledgeId)),(0,y.cY)("notes.save.ok",{knowledgeId:t.knowledgeId,vaultLabel:t.vaultLabel}),setTimeout(o,400)}catch(e){M("저장 실패: ".concat(String(e instanceof Error?e.message:e))),c("error"),(0,y.cY)("notes.save.exception",{reason:String(e)})}}function P(e){l.baseUrl&&fetch("".concat(l.baseUrl,"/v1/metrics/notes-event"),{method:"POST",headers:{"content-type":"application/json",...l.token?{authorization:"Bearer ".concat(l.token)}:{}},body:JSON.stringify({type:e,polishMode:p})}).catch(()=>{})}function O(){let e=m!==A;(0,y.cY)("notes.cancel",{phase:i,edited:e,chars:m.length}),P("cancel"),e&&"review"===i&&P("discard"),o()}return(0,s.useEffect)(()=>{if(!t){c("idle"),f(""),T(""),E(""),M(""),h("minimal"),g("minimal");let e=(0,w.hn)();S(e.defaultUseLlmVision),C(e.defaultPreferHandwriting)}},[t]),(0,s.useEffect)(()=>{t&&n&&"idle"===i&&R(p)},[t,n]),(0,r.jsx)(v.lG,{open:t,onOpenChange:e=>{e||O()},children:(0,r.jsxs)(v.Cf,{className:"sm:max-w-lg",children:[(0,r.jsxs)(v.c7,{children:[(0,r.jsx)(v.L3,{children:"사진 → 마크다운 노트"}),(0,r.jsx)(v.rr,{children:"OCR 로 추출한 본문을 검토 + 편집 후 저장합니다."})]}),"ocr"===i&&(0,r.jsxs)("div",{className:"flex items-center justify-center gap-2 py-12 text-muted-foreground",children:[(0,r.jsx)(b.A,{className:"h-4 w-4 animate-spin"}),(0,r.jsx)("span",{children:"OCR 인식 중…"})]}),"saving"===i&&(0,r.jsxs)("div",{className:"flex items-center justify-center gap-2 py-12 text-muted-foreground",children:[(0,r.jsx)(b.A,{className:"h-4 w-4 animate-spin"}),(0,r.jsx)("span",{children:"저장 중…"})]}),"saved"===i&&(0,r.jsx)("div",{className:"flex items-center justify-center py-12 text-emerald-600",children:"✓ 저장 완료"}),"error"===i&&(0,r.jsxs)("div",{className:"space-y-3 py-4",children:[(0,r.jsx)("div",{className:"rounded-md bg-destructive/10 p-3 text-sm text-destructive",children:L}),(0,r.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,r.jsx)(u.$,{variant:"ghost",onClick:O,children:"닫기"}),n&&(0,r.jsx)(u.$,{onClick:()=>R(p),children:"다시 시도"})]})]}),"review"===i&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[(0,r.jsxs)("span",{children:["provider: ",(0,r.jsx)("code",{children:D||"?"})]}),(0,r.jsx)("span",{children:"\xb7"}),(0,r.jsxs)("label",{className:"flex items-center gap-1",children:["polish:",(0,r.jsxs)("select",{value:p,onChange:e=>{let t=e.target.value;h(t),t!==x&&R(t)},className:"rounded border border-input bg-background px-1 py-0.5","aria-label":"polish mode",children:[(0,r.jsx)("option",{value:"minimal",children:"minimal (raw)"}),(0,r.jsx)("option",{value:"enrich",children:"enrich (polished)"})]})]}),(0,r.jsx)("span",{children:"\xb7"}),(0,r.jsxs)("label",{className:"flex items-center gap-1",title:"LLM 비전 우선시 — 더 정확하지만 느림 + 비쌈",children:[(0,r.jsx)("input",{type:"checkbox",checked:N,onChange:e=>{let t=e.target.checked;S(t),R(p,t,I)},"aria-label":"prefer LLM vision"}),"LLM 비전"]}),(0,r.jsx)("span",{children:"\xb7"}),(0,r.jsxs)("label",{className:"flex items-center gap-1",title:"손글씨 우선시 — handwriting strength 추가 (registry 점수 boost)",children:[(0,r.jsx)("input",{type:"checkbox",checked:I,onChange:e=>{let t=e.target.checked;C(t),R(p,N,t)},"aria-label":"prefer handwriting"}),"손글씨"]}),(0,r.jsx)("span",{children:"\xb7"}),(0,r.jsxs)("span",{"data-testid":"notes-applied-polish",children:["applied: ",(0,r.jsx)("code",{children:x}),"enrich"===p&&"minimal"===x&&(0,r.jsx)("span",{className:"ml-1 text-amber-600",children:"(LLM polish 비활성)"})]}),(0,r.jsx)(u.$,{type:"button",variant:"ghost",size:"sm",className:"ml-auto text-xs",onClick:()=>R(p),"aria-label":"re-run OCR",children:"Re-OCR"})]}),(0,r.jsx)("textarea",{value:m,onChange:e=>f(e.target.value),rows:12,placeholder:"markdown 본문…","aria-label":"markdown editor",className:"w-full resize-y rounded-md border border-input bg-background px-3 py-2 font-mono text-xs shadow-xs focus:outline-none focus:ring-2 focus:ring-ring"})]}),(0,r.jsxs)(v.Es,{children:[(0,r.jsx)(u.$,{variant:"outline",onClick:O,children:"취소"}),(0,r.jsx)(u.$,{onClick:()=>void U(),disabled:0===m.trim().length,children:"저장"})]})]})]})})}function N(){let e=(0,s.useRef)(null),[t,n]=(0,s.useState)(!1),[a,o]=(0,s.useState)(null),[l,i]=(0,s.useState)("photo.jpg");return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("button",{type:"button",onClick:()=>{var t;return null==(t=e.current)?void 0:t.click()},"aria-label":"save photo as note",title:"사진 → 마크다운 노트로 저장",className:"rounded p-1.5 text-muted-foreground hover:bg-accent hover:text-foreground",children:(0,r.jsx)(g.A,{className:"h-3.5 w-3.5"})}),(0,r.jsx)("input",{ref:e,type:"file",accept:"image/*",capture:"environment",className:"hidden",onChange:function(e){var t;let r=null==(t=e.target.files)?void 0:t[0];e.target.value="",r&&(o(r),i(r.name),n(!0))}}),(0,r.jsx)(k,{open:t,image:a,filename:l,onClose:function(){n(!1),o(null)}})]})}var S=n(76161),I=n(91732);function C(){var e,t,n;let{client:a}=(0,j.Q)(),[o,l]=(0,s.useState)([]),[i,c]=(0,s.useState)(""),[u,m]=(0,s.useState)(!1),f=(0,s.useCallback)(async()=>{try{var e,t;let n=await a.fetchJson("/v1/setup/llm-providers");l(null!=(e=n.providers)?e:[]),c(null!=(t=n.activeProvider)?t:"")}catch(e){}},[a]);(0,s.useEffect)(()=>{f()},[f]);let p=o.filter(e=>"apiKey"===e.flow&&e.hasSavedKey||"auto"===e.flow),h=(0,s.useCallback)(async()=>{if(u||0===p.length)return;let e=p.findIndex(e=>e.provider===i),t=p[(e+1)%p.length];if(t.provider!==i||1!==p.length){m(!0);try{let e=await a.fetchJson("/v1/setup/llm-provider",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({provider:t.provider})});if(e&&e.error)d.oR.error("provider 전환 실패: ".concat(e.error));else{var n,r;c(null!=(r=null==e||null==(n=e.active)?void 0:n.provider)?r:t.provider)}}catch(e){d.oR.error("provider 전환 실패: ".concat(e instanceof Error?e.message:e))}finally{m(!1)}}},[u,p,i,a]);if(0===p.length)return null;let x=null!=(n=null!=(t=null==(e=o.find(e=>e.provider===i))?void 0:e.label)?t:i)?n:p[0].label;return(0,r.jsx)("button",{type:"button",onClick:()=>void h(),disabled:u||p.length<2,className:"rounded-full border border-border bg-card px-2 py-1 text-[11px] font-medium text-muted-foreground transition-colors hover:text-foreground disabled:opacity-60",title:p.length<2?"LLM provider: ".concat(x):"클릭하면 다음 provider 로 순환 (현재 ".concat(x,")"),children:x})}var D=n(80777),E=n(45012);function L(e){let{seats:t,selected:n,onSelect:s,disabled:a}=e;return 0===t.length?null:(0,r.jsx)("div",{className:"mb-2 flex flex-wrap items-center gap-1.5","aria-label":"요청할 자리",children:t.map(e=>(0,r.jsx)("button",{type:"button",disabled:a,"aria-pressed":n===e.id,onClick:()=>s(n===e.id?null:e.id),className:(0,p.cn)("rounded-full border px-2.5 py-1 text-xs transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",n===e.id?"border-accent bg-accent/15 font-semibold text-foreground":"border-border text-muted-foreground hover:bg-muted",a&&"opacity-60"),children:e.title},e.id))})}let M=[],A="elanous.pwa.chat.promptHistory.v1";function T(e,t){let n=e.lastIndexOf(t);if(n<0)return null;let r=e.slice(n+1);if(/[\s]/.test(r))return null;if(n>0){let t=e[n-1];if(!/\s/.test(t))return null}return r}function R(e){let{onSubmit:t,disabled:n,attachments:g=M,onAttached:b,onRemoveAttachment:v,tabId:y,voice:w,onListFiles:k,onListSkills:R,prefill:U}=e,{client:P,config:O}=(0,j.Q)(),[F,_]=(0,s.useState)([]),[Y,z]=(0,s.useState)(null),[q,H]=(0,s.useState)([]),[J,$]=(0,s.useState)(""),[B,K]=(0,s.useState)(!1),V=(0,s.useRef)(null);(0,s.useEffect)(()=>{let e=!0;return"function"!=typeof(null==P?void 0:P.listSeatRequests)?()=>{e=!1}:(P.listSeatRequests().then(t=>{e&&_(t.seats)}).catch(()=>{}),()=>{e=!1})},[P]);let W=(0,I.o1)("chatInput",y),[G,Q]=(0,s.useState)(()=>{let e=(0,I.N2)(W);return"string"==typeof e?e:""}),[Z,X]=(0,s.useState)(()=>(function(){try{let e=window.localStorage.getItem(A);if(!e)return[];let t=JSON.parse(e);if(!Array.isArray(t))return[];return t.filter(e=>"string"==typeof e)}catch(e){return[]}})()),[ee,et]=(0,s.useState)(-1),en=(0,s.useRef)(""),er=!G.startsWith("/")||/\s/.test(G)?null:G.slice(1),es=null!==er?function(e){let t=e.trim().toLowerCase();return 0===t.length?m.bK:m.bK.filter(e=>e.name.toLowerCase().startsWith(t))}(er):[],[ea,eo]=(0,s.useState)(0);(0,s.useEffect)(()=>{eo(0)},[er]);let el=k?T(G,"@"):null,[ei,ec]=(0,s.useState)([]),[ed,eu]=(0,s.useState)(""),[em,ef]=(0,s.useState)(0);(0,s.useEffect)(()=>{if(null===el||!k)return;ef(0);let e=setTimeout(()=>{k(el).then(e=>{ec(e.entries),eu(e.cwd)}).catch(()=>{})},200);return()=>clearTimeout(e)},[el,k]),(0,s.useEffect)(()=>{null===el&&(ec([]),eu(""),ef(0))},[el]);let[ep,eh]=(0,s.useState)(!1),[ex,eg]=(0,s.useState)(0),eb=(0,s.useRef)(""),ev=ep?0===G.trim().length?Z:Z.filter(e=>e.toLowerCase().includes(G.trim().toLowerCase())):[],ej=()=>{Q(eb.current),eh(!1),eg(0),eb.current=""},ey=R?T(G,"$"):null,[ew,ek]=(0,s.useState)([]),[eN,eS]=(0,s.useState)(0),[eI,eC]=(0,s.useState)(D.kv);(0,s.useEffect)(()=>(eC((0,D.Vm)()),(0,D.$L)(eC)),[]);let{prediction:eD,predict:eE,clear:eL}=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{baseUrl:t,token:n,enabled:r=!0,debounceMs:a=300}=e,[o,l]=(0,s.useState)(null),[i,c]=(0,s.useState)(!1),[d,u]=(0,s.useState)(null),m=(0,s.useRef)(null),f=(0,s.useRef)(null),p=(0,s.useCallback)(()=>{m.current&&(clearTimeout(m.current),m.current=null),f.current&&(f.current.abort(),f.current=null)},[]),h=(0,s.useCallback)(()=>{p(),l(null),u(null)},[p]),x=(0,s.useCallback)(function(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];if(p(),!r||!t||0===e.trim().length&&0===s.length)return void l(null);m.current=setTimeout(async()=>{m.current=null;let r=new AbortController;f.current=r,c(!0);try{let a="".concat(t,"/v1/llm/route/predict"),o={"Content-Type":"application/json"};n&&n.length>0&&(o.Authorization="Bearer ".concat(n));let i=await fetch(a,{method:"POST",headers:o,body:JSON.stringify({text:e,attachments:s.map(e=>({kind:e}))}),signal:r.signal});if(r.signal.aborted)return;if(!i.ok)return void u("http-".concat(i.status));let c=await i.json();l(c),u(null)}catch(e){if(r.signal.aborted)return;u(e instanceof Error?e.message:String(e))}finally{f.current===r&&(f.current=null),c(!1)}},a)},[t,n,r,a,p]);return(0,s.useEffect)(()=>()=>p(),[p]),{prediction:o,inflight:i,error:d,predict:x,clear:h}}({baseUrl:O.baseUrl,token:O.token,enabled:eI.autoRouting});(0,s.useEffect)(()=>{if(!eI.autoRouting)return void eL();eE(G,g.map(e=>{var t;return(null==(t=e.mediaType)?void 0:t.startsWith("image/"))?"image":"document"}))},[G,eI.autoRouting,g,eE,eL]),(0,s.useEffect)(()=>{if(null===ey||!R)return;eS(0);let e=setTimeout(()=>{R(ey).then(e=>{ek(e.entries)}).catch(()=>{})},200);return()=>clearTimeout(e)},[ey,R]),(0,s.useEffect)(()=>{null===ey&&(ek([]),eS(0))},[ey]),(0,s.useEffect)(()=>{let e=(0,f.ht)();e&&(Q(e),d.oR.success("\uD83D\uDCE5 공유 받음 — 검토 후 보내세요"))},[]),(0,s.useEffect)(()=>{U&&(Q(U.text),(0,f.ht)())},[U]);let eM=(0,s.useRef)(null);(0,s.useEffect)(()=>(eM.current&&clearTimeout(eM.current),eM.current=setTimeout(()=>{0===G.length?(0,I.yd)(W):(0,I.Os)(W,G)},300),()=>{eM.current&&clearTimeout(eM.current)}),[G,W]);let eA=async e=>{K(!0),$("");try{let t=await P.submitSeatRequest({seat:e.seat,text:e.text},e.key);H(e=>[...e,t]),V.current=null,Q(""),(0,I.yd)(W)}catch(t){V.current=e,t instanceof E.J_&&"unknown-seat"===t.code?(_(t.seats),Y&&!t.seats.some(e=>e.id===Y)&&(z(null),V.current=null),$("그 자리를 찾지 못했습니다 — ".concat(t.seats.map(e=>e.title).join(", ")))):$("접수하지 못했습니다 — 잠시 뒤 다시")}finally{K(!1)}},eT=()=>eR(G),eR=e=>{let r=e.trim(),s=/^@\S+\s+[\s\S]*\S$/.test(e.trimEnd());if(!n&&!B){if((s||Y)&&g.length)return void $("자리 요청에는 첨부파일을 보낼 수 없습니다");if((s||Y)&&r){let e=s?{text:r,key:crypto.randomUUID()}:{seat:Y,text:r,key:crypto.randomUUID()},t=V.current;eA(t&&t.seat===e.seat&&t.text===e.text?t:e);return}(r||0!==g.length)&&(r.length>0&&(X(e=>{if(e[0]===r)return e;let t=[r,...e].slice(0,50);try{window.localStorage.setItem(A,JSON.stringify(t))}catch(e){}return t}),et(-1),en.current=""),t(r),Q(""),(0,I.yd)(W))}},eU=e=>{let t=G.lastIndexOf("@");if(t<0)return;let n=G.slice(0,t),r=e.isDir?"".concat(e.relPath,"/"):e.relPath;Q("".concat(n,"@").concat(r).concat(e.isDir?"":" "))},eP=e=>{let t=G.lastIndexOf("$");if(t<0)return;let n=G.slice(0,t);Q("".concat(n,"/run-skill ").concat(e.name," "))},eO=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:es[Math.min(Math.max(ea,0),es.length-1)];e&&Q(":".concat(e.name," "))};(0,s.useEffect)(()=>{!(ee<0)&&Z[ee]&&G!==Z[ee]&&(et(-1),en.current="")},[G]);let eF=(0,m.FM)(G);return(0,r.jsxs)("div",{className:"border-t border-border bg-background p-3",children:[q.map(e=>{var t,n;return(0,r.jsxs)("div",{role:"status",className:"mb-2 rounded-md border border-border bg-card px-3 py-2 text-sm",children:["\uD83D\uDCE8 ",null!=(n=null==(t=F.find(t=>t.id===e.seat))?void 0:t.title)?n:e.seat," 접수 ",e.receiptId," \xb7 방금"]},e.receiptId)}),J&&(0,r.jsx)("p",{role:"alert",className:"mb-2 text-sm text-destructive",children:J}),(0,r.jsx)(L,{seats:F,selected:Y,onSelect:e=>{z(e),$("")},disabled:n||B}),ep&&(0,r.jsxs)("div",{className:"mb-2 overflow-hidden rounded-md border border-border bg-card shadow-md",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between px-3 py-1.5 text-[10px] uppercase tracking-wide text-muted-foreground",children:[(0,r.jsx)("span",{children:"\uD83D\uDD0E reverse-i-search"}),(0,r.jsxs)("span",{className:"text-xs font-semibold",children:[ev.length," match",1===ev.length?"":"es"]})]}),0===ev.length?(0,r.jsx)("div",{className:"px-3 py-2 text-xs text-muted-foreground",children:0===G.length?"history 가 비어 있음":"일치 없음 — '".concat(G,"'")}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("ul",{className:"divide-y divide-border",children:ev.slice(0,8).map((e,t)=>{let n=t===ex;return(0,r.jsx)("li",{role:"button",tabIndex:-1,onMouseDown:n=>{n.preventDefault(),eg(t),requestAnimationFrame(()=>{eh(!1),eb.current="",Q(e)})},className:(0,p.cn)("flex cursor-pointer items-center gap-2 px-3 py-1.5 text-sm",n?"bg-accent/15 font-semibold":"hover:bg-accent/8"),children:(0,r.jsx)("span",{className:"line-clamp-2",children:e})},"".concat(e,"-").concat(t))})}),ev.length>8&&(0,r.jsxs)("div",{className:"px-3 py-1 text-[10px] text-muted-foreground",children:["+ ",ev.length-8," more (refine query)"]})]})]}),null!==el&&ei.length>0&&(0,r.jsxs)("div",{className:"mb-2 overflow-hidden rounded-md border border-border bg-card shadow-md",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between px-3 py-1.5 text-[10px] uppercase tracking-wide text-muted-foreground",children:[(0,r.jsxs)("span",{title:ed,children:["\uD83D\uDCC1 ",ed.length>48?"…"+ed.slice(-45):ed]}),(0,r.jsx)("span",{className:"text-xs font-semibold",children:ei.length})]}),(0,r.jsx)("ul",{className:"divide-y divide-border",children:ei.slice(0,12).map((e,t)=>{let n=t===em;return(0,r.jsxs)("li",{role:"button",tabIndex:-1,onMouseDown:n=>{n.preventDefault(),ef(t),requestAnimationFrame(()=>eU(e))},className:(0,p.cn)("flex cursor-pointer items-center gap-2 px-3 py-1.5 text-sm",n?"bg-accent/15":"hover:bg-accent/8"),children:[(0,r.jsx)("span",{className:"text-xs",children:e.isDir?"\uD83D\uDCC2":"\uD83D\uDCC4"}),(0,r.jsxs)("span",{className:(0,p.cn)("font-mono",n?"font-semibold":"font-normal"),children:[e.name,e.isDir?"/":""]}),e.isDir&&(0,r.jsx)("span",{className:"ml-auto text-[10px] uppercase text-muted-foreground",children:"dir"})]},e.relPath)})}),ei.length>12&&(0,r.jsxs)("div",{className:"px-3 py-1 text-[10px] text-muted-foreground",children:["+ ",ei.length-12," more (refine query)"]})]}),null!==ey&&ew.length>0&&(0,r.jsxs)("div",{className:"mb-2 overflow-hidden rounded-md border border-border bg-card shadow-md",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between px-3 py-1.5 text-[10px] uppercase tracking-wide text-muted-foreground",children:[(0,r.jsx)("span",{children:"✨ skills"}),(0,r.jsx)("span",{className:"text-xs font-semibold",children:ew.length})]}),(0,r.jsx)("ul",{className:"divide-y divide-border",children:ew.map((e,t)=>{let n=t===eN;return(0,r.jsxs)("li",{role:"button",tabIndex:-1,onMouseDown:n=>{n.preventDefault(),eS(t),requestAnimationFrame(()=>eP(e))},className:(0,p.cn)("flex cursor-pointer flex-col gap-0.5 px-3 py-1.5",n?"bg-accent/15":"hover:bg-accent/8"),children:[(0,r.jsx)("span",{className:(0,p.cn)("font-mono text-sm",n?"font-semibold":"font-normal"),children:e.name}),e.description.length>0&&(0,r.jsx)("span",{className:"text-xs text-muted-foreground",children:e.description})]},e.name)})})]}),null!==er&&(0,r.jsxs)("div",{className:"mb-2 overflow-hidden rounded-md border border-border bg-card shadow-md",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between px-3 py-1.5 text-[10px] uppercase tracking-wide text-muted-foreground",children:[(0,r.jsx)("span",{children:"slash commands"}),(0,r.jsx)("span",{className:"text-xs font-semibold",children:es.length})]}),0===es.length?(0,r.jsx)("div",{className:"px-3 py-2 text-xs text-muted-foreground",children:"일치하는 명령 없음"}):(0,r.jsx)("ul",{className:"divide-y divide-border",children:es.map((e,t)=>{let n=t===ea;return(0,r.jsxs)("li",{role:"button",tabIndex:-1,onMouseDown:n=>{n.preventDefault(),eo(t),eO(e)},className:(0,p.cn)("flex cursor-pointer items-center gap-2 px-3 py-1.5 text-sm",n?"bg-accent/15":"hover:bg-accent/8"),children:[(0,r.jsxs)("span",{className:(0,p.cn)("font-mono",n?"font-semibold text-foreground":"text-foreground/86"),children:[":",e.name]}),(0,r.jsx)("span",{className:"text-xs text-muted-foreground",children:e.description})]},e.name)})})]}),g.length>0&&(0,r.jsx)("ul",{className:"mb-2 flex flex-wrap gap-1.5",children:g.map(e=>{var t,n;let s="string"==typeof e.mediaType&&e.mediaType.startsWith("image/");return(0,r.jsxs)("li",{className:"inline-flex items-center gap-1.5 rounded-md border border-border bg-card px-1.5 py-0.5 text-[11px]",title:null!=(t=e.path)?t:e.filename,children:[s?(0,r.jsx)("img",{src:function(e,t,n){if(!e)return"";let r=e.includes("?")?"&":"?",s=n?"".concat(r,"auth=").concat(encodeURIComponent(n)):"";return"".concat(null!=t?t:"").concat(e).concat(s)}(e.downloadUrl,O.baseUrl,O.token),alt:e.filename,className:"h-6 w-6 rounded-sm object-cover",loading:"lazy"}):(0,r.jsx)(a.A,{className:"h-3 w-3 text-muted-foreground","aria-hidden":!0}),(0,r.jsx)("span",{className:"max-w-[160px] truncate font-mono",children:e.filename}),(0,r.jsx)("span",{className:"text-muted-foreground",children:(n=e.size)<1024?"".concat(n," B"):n<1048576?"".concat((n/1024).toFixed(1)," kB"):"".concat((n/1024/1024).toFixed(1)," MB")}),v&&(0,r.jsx)("button",{type:"button",onClick:()=>v(e.id),"aria-label":"remove ".concat(e.filename),className:"rounded text-muted-foreground hover:text-rose-500",children:(0,r.jsx)(o.A,{className:"h-3 w-3"})})]},e.id)})}),(0,r.jsxs)("div",{className:"relative flex flex-wrap items-end gap-2 sm:flex-nowrap",children:[(0,r.jsxs)("div",{className:"flex shrink-0 basis-full items-center gap-0.5 pb-1 sm:basis-auto","data-elanous-composer-tools":!0,children:[(0,r.jsx)(h.T,{onAttached:b?e=>b([e]):void 0}),(0,r.jsx)(x.u,{onAttached:b}),(0,r.jsx)(N,{}),(0,r.jsx)(S.z,{}),(0,r.jsx)(C,{}),eI.autoRouting&&eD&&(0,r.jsx)("span",{className:"text-xs text-muted-foreground",title:"입력 의도 분류 \xb7 ACP 송신 경로는 변경하지 않습니다",children:eD.mission})]}),(0,r.jsx)("textarea",{value:G,onChange:e=>Q(e.target.value),onKeyDown:e=>{if(e.ctrlKey&&("r"===e.key||"R"===e.key)){e.preventDefault(),ep||(eb.current=G,eh(!0),eg(0),Q(""));return}if(ep){if("Enter"===e.key&&!e.shiftKey){e.preventDefault(),(()=>{if(0===ev.length)return ej();let e=Math.min(Math.max(ex,0),ev.length-1),t=ev[e];eh(!1),eg(0),eb.current="",Q(t)})();return}if("ArrowUp"===e.key){e.preventDefault(),eg(e=>Math.max(0,e-1));return}if("ArrowDown"===e.key){e.preventDefault(),eg(e=>Math.min(ev.length-1,e+1));return}if("Escape"===e.key){e.preventDefault(),ej();return}}if("Tab"===e.key&&!e.shiftKey&&(()=>{if(null!==el&&ei.length>0){let e=Math.min(Math.max(em,0),ei.length-1),t=ei[e],n=G.lastIndexOf("@");if(n<0)return!1;let r=G.slice(0,n),s=t.isDir?"".concat(t.name,"/"):t.name;return Q("".concat(r,"@").concat(s)),!0}if(null!==ey&&ew.length>0){let e=Math.min(Math.max(eN,0),ew.length-1),t=ew[e],n=G.lastIndexOf("$");if(n<0)return!1;let r=G.slice(0,n);return Q("".concat(r,"$").concat(t.name)),!0}if(null!==er&&es.length>0){let e=Math.min(Math.max(ea,0),es.length-1);return eO(es[e]),!0}return!1})())return void e.preventDefault();if(null!==el&&ei.length>0){if("Enter"===e.key&&!e.shiftKey){e.preventDefault(),(()=>{if(0===ei.length)return;let e=Math.min(Math.max(em,0),ei.length-1);eU(ei[e])})();return}if("ArrowUp"===e.key){e.preventDefault(),ef(e=>Math.max(0,e-1));return}if("ArrowDown"===e.key){e.preventDefault(),ef(e=>Math.min(ei.length-1,e+1));return}if("Escape"===e.key){e.preventDefault();let t=G.lastIndexOf("@");t>=0&&Q(G.slice(0,t));return}}if(null!==ey&&ew.length>0){if("Enter"===e.key&&!e.shiftKey){e.preventDefault(),(()=>{if(0===ew.length)return;let e=Math.min(Math.max(eN,0),ew.length-1);eP(ew[e])})();return}if("ArrowUp"===e.key){e.preventDefault(),eS(e=>Math.max(0,e-1));return}if("ArrowDown"===e.key){e.preventDefault(),eS(e=>Math.min(ew.length-1,e+1));return}if("Escape"===e.key){e.preventDefault();let t=G.lastIndexOf("$");t>=0&&Q(G.slice(0,t));return}}if(null!==er&&es.length>0){if("Enter"===e.key&&!e.shiftKey){e.preventDefault();let t=function(e,t,n){let r=t.find(t=>t.name.toLowerCase()===e.trim().toLowerCase());if(r)return{kind:"run",line:":".concat(r.name)};let s=t[Math.min(Math.max(n,0),t.length-1)];return s?{kind:"complete",value:":".concat(s.name," ")}:null}(er,es,ea);(null==t?void 0:t.kind)==="run"?eR(t.line):t&&Q(t.value);return}if("ArrowUp"===e.key){e.preventDefault(),eo(e=>Math.max(0,e-1));return}if("ArrowDown"===e.key){e.preventDefault(),eo(e=>Math.min(es.length-1,e+1));return}if("Escape"===e.key){e.preventDefault(),Q("");return}}if("Enter"===e.key&&!e.shiftKey){e.preventDefault(),eT();return}if("ArrowUp"===e.key){(()=>{if(0===Z.length||G.includes("\n"))return!1;-1===ee&&(en.current=G);let e=Math.min(ee+1,Z.length-1);return e===ee||(et(e),Q(Z[e]),!0)})()&&e.preventDefault();return}if("ArrowDown"===e.key){(()=>{if(ee<0||G.includes("\n"))return!1;if(0===ee)return et(-1),Q(en.current),!0;let e=ee-1;return et(e),Q(Z[e]),!0})()&&e.preventDefault();return}},placeholder:"메시지 \xb7 :help 명령 목록",rows:2,disabled:n||B,className:(0,p.cn)("min-h-[44px] max-h-[180px] min-w-0 flex-1 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",eF&&"border-accent text-accent-foreground bg-accent/10",n&&"opacity-60")}),w&&(0,r.jsx)("button",{type:"button",onClick:w.onToggle,disabled:w.disabled,title:w.disabled?"daemon URL 미설정":w.phaseLabel,"data-elanous-action":"chat-voice-toggle-inline",className:(0,p.cn)("inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-md border transition-colors",w.active?"border-rose-500/40 bg-rose-500/10 text-rose-600 hover:bg-rose-500/20":"border-input bg-background text-foreground hover:bg-muted",w.disabled&&"cursor-not-allowed opacity-50"),children:(0,r.jsxs)("span",{className:"relative inline-flex",children:[w.active?(0,r.jsx)(l.A,{className:"h-4 w-4"}):(0,r.jsx)(i.A,{className:"h-4 w-4"}),(0,r.jsx)("span",{"aria-hidden":!0,className:(0,p.cn)("absolute -right-0.5 -top-0.5 h-1.5 w-1.5 rounded-full",w.dotColor,("listening"===w.phase||"speaking"===w.phase)&&"animate-pulse")})]})}),(0,r.jsx)(u.$,{onClick:eT,disabled:n||B||!G.trim()&&0===g.length,size:"sm",children:(0,r.jsx)(c.A,{className:"h-4 w-4"})})]}),eF&&(0,r.jsx)("p",{className:"mt-1 text-[11px] text-muted-foreground",children:"meta command — handled locally, not sent to LLM"})]})}},19866:(e,t,n)=>{n.d(t,{Cf:()=>g,Es:()=>v,L3:()=>j,c7:()=>b,lG:()=>p,rr:()=>y});var r=n(41121);n(91269);var s=n(12148),a=n(54427),o=n(47977),l=n(1396),i=n(26591),c=n(93339),d=n(29035),u=n(82157),m=n(72030),f=n(72754);function p(e){let{...t}=e;return(0,r.jsx)(s.D,{"data-slot":"dialog",...t})}function h(e){let{...t}=e;return(0,r.jsx)(a.Z,{"data-slot":"dialog-portal",...t})}function x(e){let{className:t,...n}=e;return(0,r.jsx)(o.X,{"data-slot":"dialog-overlay",className:(0,u.cn)("fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",t),...n})}function g(e){let{className:t,children:n,showCloseButton:s=!0,...a}=e;return(0,r.jsxs)(h,{children:[(0,r.jsx)(x,{}),(0,r.jsxs)(l.h,{"data-slot":"dialog-content",className:(0,u.cn)("fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",t),...a,children:[n,s&&(0,r.jsxs)(i.H,{"data-slot":"dialog-close",render:(0,r.jsx)(m.$,{variant:"ghost",className:"absolute top-2 right-2",size:"icon-sm"}),children:[(0,r.jsx)(f.A,{}),(0,r.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})}function b(e){let{className:t,...n}=e;return(0,r.jsx)("div",{"data-slot":"dialog-header",className:(0,u.cn)("flex flex-col gap-2",t),...n})}function v(e){let{className:t,showCloseButton:n=!1,children:s,...a}=e;return(0,r.jsxs)("div",{"data-slot":"dialog-footer",className:(0,u.cn)("-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 sm:flex-row sm:justify-end",t),...a,children:[s,n&&(0,r.jsx)(i.H,{render:(0,r.jsx)(m.$,{variant:"outline"}),children:"Close"})]})}function j(e){let{className:t,...n}=e;return(0,r.jsx)(c.L,{"data-slot":"dialog-title",className:(0,u.cn)("font-heading text-base leading-none font-medium",t),...n})}function y(e){let{className:t,...n}=e;return(0,r.jsx)(d.r,{"data-slot":"dialog-description",className:(0,u.cn)("text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",t),...n})}},22967:(e,t,n)=>{n.d(t,{S:()=>d});var r=n(41121),s=n(91269),a=n(67770),o=n(95515),l=n(82157),i=n(68355),c=n(51215);function d(e){let{sessionId:t,source:n="inline",variant:d="default",className:u,showCopyIcon:m=!0}=e,[f,p]=(0,s.useState)(!1),h=(0,s.useRef)(null);(0,s.useEffect)(()=>()=>{h.current&&clearTimeout(h.current)},[]);let x=async()=>{if(!t)return;let e=await (0,i.lW)(t);(0,c.cY)("webterm.session-id-chip.copy",{sessionId:t,ok:e,source:n}),e&&(p(!0),h.current&&clearTimeout(h.current),h.current=setTimeout(()=>p(!1),1200))},g=(0,i.o)(t),b=!t,v=t?"세션 ID 전체 (".concat(t.length,"자): ").concat(t,"\n\xb7 클릭하면 자동 복사 — 단축 표시 (앞 8자 + …)\n\xb7 새 세션 fork 시 다른 ID 발급 (crypto.randomUUID v4)"):"세션 미설정";return(0,r.jsxs)("span",{role:"button",tabIndex:b?-1:0,"aria-disabled":b,onClick:b?void 0:e=>{e.stopPropagation(),x()},onKeyDown:b?void 0:e=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),e.stopPropagation(),x())},title:v,"aria-label":t?"세션 ID ".concat(t," 복사"):"세션 미설정","data-elanous-session-id":null!=t?t:"","data-elanous-action":"session-id-copy",className:(0,l.cn)("inline-flex items-center gap-1 rounded font-mono transition-colors select-none focus:outline-none focus:ring-1 focus:ring-ring","default"===d?"px-1 py-0.5 hover:bg-secondary":"opacity-70 hover:opacity-100 hover:bg-muted/40 px-0.5",f&&"bg-emerald-500/10 text-emerald-600 dark:text-emerald-400",b&&"cursor-not-allowed opacity-40",!b&&"cursor-copy",u),children:[(0,r.jsx)("span",{children:g}),m&&(f?(0,r.jsx)(a.A,{className:"h-3 w-3","aria-hidden":!0}):(0,r.jsx)(o.A,{className:"h-3 w-3 opacity-60","aria-hidden":!0}))]})}},25194:(e,t,n)=>{n.d(t,{D:()=>d});var r=n(41121),s=n(91269),a=n(82823),o=n(38519),l=n(82157),i=n(51215);function c(e){return!Number.isFinite(e)||e<0?"$0.00":"$".concat(e.toFixed(2))}function d(){let{client:e,config:t}=(0,o.Q)(),[n,d]=(0,s.useState)(null),[u,m]=(0,s.useState)(!1),f=!!t.baseUrl,p=(0,s.useCallback)(async()=>{if(f)try{let t=await e.voiceCost();d(t),m(!1)}catch(e){m(!0),(0,i.cY)("chat.voice.cost-pill.error",{reason:e instanceof Error?e.message:String(e)})}},[e,f]);if((0,s.useEffect)(()=>{if(!f)return;p();let e=setInterval(()=>void p(),6e4);return()=>clearInterval(e)},[f,p]),!f)return null;if(u&&!n)return(0,r.jsxs)("div",{className:"inline-flex items-center gap-1 rounded-md border border-border bg-muted/40 px-2 py-1 text-[11px] text-muted-foreground",title:"voice cost — daemon /v1/voice/cost 응답 없음","data-elanous-pill":"voice-cost",children:[(0,r.jsx)(a.A,{className:"h-3 w-3","aria-hidden":!0}),(0,r.jsx)("span",{children:"—"})]});if(!n)return(0,r.jsxs)("div",{className:"inline-flex items-center gap-1 rounded-md border border-border bg-muted/40 px-2 py-1 text-[11px] text-muted-foreground","data-elanous-pill":"voice-cost",children:[(0,r.jsx)(a.A,{className:"h-3 w-3","aria-hidden":!0}),(0,r.jsx)("span",{children:"…"})]});let h=n.totalUsd>0;return(0,r.jsxs)("div",{className:(0,l.cn)("inline-flex items-center gap-1 rounded-md border px-2 py-1 text-[11px]",h?"border-emerald-500/30 bg-emerald-500/5 text-emerald-700 dark:text-emerald-400":"border-border bg-muted/40 text-muted-foreground"),title:"voice cost ".concat(n.monthYYYYMM," \xb7 STT ").concat(c(n.sttUsd)," \xb7 TTS ").concat(c(n.ttsUsd)),"data-elanous-pill":"voice-cost",children:[(0,r.jsx)(a.A,{className:"h-3 w-3","aria-hidden":!0}),(0,r.jsx)("span",{children:c(n.totalUsd)}),(0,r.jsx)("span",{className:"text-muted-foreground",children:"/mo"})]})}},38869:(e,t,n)=>{n.d(t,{rm:()=>l});var r=n(41121),s=n(91269),a=n(38519),o=n(23934);function l(){var e;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{loadStatus:n=o.gh,pollMs:l=6e4,initialStatus:i}=t,{config:c}=(0,a.Q)(),[d,u]=(0,s.useState)(void 0===i?void 0:i);if((0,s.useEffect)(()=>{let e=!1,t=async()=>{if(!c.baseUrl){e||u(null);return}let t=await n({baseUrl:c.baseUrl,...c.token?{token:c.token}:{}});e||u(t)};if(t(),l<=0)return()=>{e=!0};let r=setInterval(()=>{t()},l);return()=>{e=!0,clearInterval(r)}},[c.baseUrl,c.token,n,l]),void 0===d)return null;if(null===d)return(0,r.jsx)("div",{className:"rounded-md border border-border bg-muted/40 px-2 py-1 text-[11px] text-muted-foreground",title:"예산 상태를 읽지 못했습니다","data-elanous-pill":"budget","data-budget-status":"unread",children:"budget —"});let m="warning"===(e=d.status)||"cap-exceeded"===e;return(0,r.jsx)("div",{className:m?"rounded-md border border-amber-500/50 bg-amber-500/10 px-2 py-1 text-[11px] font-medium text-amber-700 dark:text-amber-300":"rounded-md border border-border bg-muted/40 px-2 py-1 text-[11px] text-muted-foreground",title:"".concat(d.monthYYYYMM," \xb7 ").concat(d.status),"data-elanous-pill":"budget","data-budget-status":d.status,"data-budget-emphasis":m?"true":"false",children:function(e){let t="이번 달 ".concat(function(e){let t=Number.isFinite(e)?e:0;return"$".concat(t.toFixed(2))}(e.monthSoFarUsd));return null!=e.percent&&Number.isFinite(e.percent)?"".concat(t," \xb7 ").concat(e.percent,"%"):t}(d)})}},45977:(e,t,n)=>{n.d(t,{$:()=>o});var r=n(91269);let s=/[.!?。!?]+\s*/g;function a(){return void 0!==window.speechSynthesis}function o(e){var t;let[n,o]=(0,r.useState)(!1);(0,r.useEffect)(()=>{o(a())},[]);let[,l]=(0,r.useState)({}),i=(0,r.useRef)(""),c=(0,r.useRef)(e.enabled);c.current=e.enabled;let d=null!=(t=e.maxBufferChars)?t:80,u=(0,r.useRef)(e.language);u.current=e.language,(0,r.useEffect)(()=>{var e,t;if(!n)return;let r=()=>l({});return window.speechSynthesis.getVoices(),null==(e=(t=window.speechSynthesis).addEventListener)||e.call(t,"voiceschanged",r),()=>{var e,t;null==(e=(t=window.speechSynthesis).removeEventListener)||e.call(t,"voiceschanged",r)}},[n]),(0,r.useEffect)(()=>{n&&(e.enabled||(window.speechSynthesis.cancel(),i.current=""))},[e.enabled,n]);let m=(0,r.useCallback)(e=>{if(!n||!c.current)return;let t=e.trim();if(!t)return;let r=new SpeechSynthesisUtterance(t),s=function(e){var t;if(!a()||!e)return null;let n=window.speechSynthesis.getVoices();if(0===n.length)return null;let r=e.toLowerCase(),s=n.find(e=>e.lang.toLowerCase()===r);if(s)return s;let o=r.split("-")[0];return null!=(t=n.find(e=>e.lang.toLowerCase().startsWith(o)))?t:null}(u.current);s&&(r.voice=s),u.current&&(r.lang=u.current),window.speechSynthesis.speak(r)},[n]),f=(0,r.useCallback)(e=>{if(!e||!c.current)return;i.current+=e;let{sentences:t,remainder:n}=function(e){let t,n=[],r=0;for(s.lastIndex=0;null!==(t=s.exec(e));){let s=t.index+t[0].length,a=e.slice(r,s).trim();a&&n.push(a),r=s}return{sentences:n,remainder:e.slice(r)}}(i.current);for(let e of(i.current=n,t))m(e);if(i.current.length>=d){let e=i.current;i.current="",m(e)}},[d,m]);return{pushText:f,flush:(0,r.useCallback)(()=>{let e=i.current.trim();i.current="",e&&m(e)},[m]),cancel:(0,r.useCallback)(()=>{n&&(window.speechSynthesis.cancel(),i.current="")},[n]),supported:n}}},47940:(e,t,n)=>{n.d(t,{KW:()=>a,jU:()=>r,nj:()=>s});class r{async list(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.client.fetchJson("/v1/sessions/store".concat(e?"?includeEmpty=1":""))}async transcript(e){return this.client.fetchJson("/v1/sessions/store/".concat(encodeURIComponent(e)))}async fork(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.client.fetchJson("/v1/sessions/store/".concat(encodeURIComponent(e),"/fork"),{method:"POST",...void 0!==t.beforeUser?{headers:{"content-type":"application/json"},body:JSON.stringify({beforeUser:t.beforeUser})}:{}})}async delete(e){return this.client.fetchJson("/v1/sessions/store/".concat(encodeURIComponent(e)),{method:"DELETE"})}constructor(e){this.client=e}}function s(e,t){let n=t.trim().toLowerCase();if(!n)return{kind:"none"};let r=e.filter(e=>e.id.toLowerCase().startsWith(n));return 1===r.length?{kind:"one",id:r[0].id}:0===r.length?{kind:"none"}:{kind:"ambiguous",count:r.length}}function a(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Date.now(),n=Date.parse(e);if(!Number.isFinite(n))return"";let r=Math.max(0,Math.floor((t-n)/1e3));return r<30?"방금":r<3600?"".concat(Math.floor(r/60),"분 전"):r<86400?"".concat(Math.floor(r/3600),"시간 전"):"".concat(Math.floor(r/86400),"일 전")}},56178:(e,t,n)=>{n.d(t,{ht:()=>a,vn:()=>s});let r="elanous.pwa.sharePrefill";function s(e){try{window.sessionStorage.setItem(r,e)}catch(e){}}function a(){try{var e;let t=null!=(e=window.sessionStorage.getItem(r))?e:"";return window.sessionStorage.removeItem(r),t}catch(e){return""}}},68355:(e,t,n)=>{n.d(t,{Qh:()=>y,lW:()=>v,o:()=>j});var r=n(41121),s=n(91269),a=n(38519),o=n(27813),l=n(5159),i=n(26229),c=n(34182),d=n(78282),u=n(70491),m=n(30448),f=n(67770),p=n(95515),h=n(69109),x=n(51215),g=n(22967);let b={cli:"cli",pwa:"pwa",tg:"tg",dc:"dc"};async function v(e){if(!e||"undefined"==typeof navigator||!navigator.clipboard)return!1;try{return await navigator.clipboard.writeText(e),!0}catch(e){return!1}}function j(e){return e?e.length<=8?e:"".concat(e.slice(0,8),"…"):"—"}function y(){var e,t,n,j,y;let w=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},k=(0,a.Q)(),N=(0,l.t)(),[S,I]=(0,s.useState)(!1),[C,D]=(0,s.useState)(!1),[E,L]=(0,s.useState)(!1),M=(0,s.useRef)(null),A=(0,s.useRef)(null),T=(0,s.useRef)(null),R=null!=(e=w.sessionId)?e:k.sessionId,U=N.find(e=>e.id===R);(0,s.useEffect)(()=>()=>{M.current&&clearTimeout(M.current),A.current&&clearTimeout(A.current)},[]),(0,s.useEffect)(()=>{if(!C)return;let e=e=>{T.current&&!T.current.contains(e.target)&&D(!1)},t=e=>{"Escape"===e.key&&D(!1)};return document.addEventListener("mousedown",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",t)}},[C]);let P=async()=>{if(!R)return;let e=await v(R);(0,x.cY)("webterm.session-pill.copy",{sessionId:R,ok:e,source:"dropdown"}),e&&(L(!0),A.current&&clearTimeout(A.current),A.current=setTimeout(()=>L(!1),1200))},O=S?"한 번 더 누르면 새 대화가 시작됩니다 — 지금 대화는 그대로 저장되고 세션 목록에 남습니다":"새 대화 시작 (두 번 클릭) — 빈 세션에서 새로 시작합니다",F=null!=(t=null==U?void 0:U.lastMsgPreview)?t:null;return(0,r.jsxs)("div",{ref:T,className:"relative flex items-center",children:[(0,r.jsxs)("div",{className:"flex items-center gap-1 rounded-md border border-border bg-card px-2 py-1 text-[11px]",children:[(0,r.jsx)("span",{className:"text-muted-foreground font-mono",children:"sess:"}),(0,r.jsx)(g.S,{sessionId:R,source:"pill"}),(null==U?void 0:U.origin)&&(0,r.jsx)("span",{className:"ml-1 rounded bg-muted px-1 py-0.5 font-mono text-[9px] uppercase text-muted-foreground",children:null!=(n=b[U.origin])?n:U.origin}),F&&(0,r.jsx)("span",{className:"ml-1 max-w-[180px] truncate border-l border-border pl-2 text-muted-foreground",title:F,children:F}),(0,r.jsxs)("span",{className:"ml-1 flex items-center gap-1 border-l border-border pl-1.5",children:[(0,r.jsx)("button",{type:"button",onClick:()=>{if(!S){I(!0),(0,x.cY)("webterm.session-pill.fork-armed",{sessionId:R}),M.current&&clearTimeout(M.current),M.current=setTimeout(()=>{I(!1),(0,x.cY)("webterm.session-pill.fork-disarmed-timeout",{sessionId:R})},4e3);return}M.current&&(clearTimeout(M.current),M.current=null),I(!1);let e=(0,o.Zr)();(0,x.cY)("webterm.session-pill.fork-confirmed",{previous:R,next:e}),k.setSessionId(e)},className:S?"rounded p-0.5 bg-destructive text-destructive-foreground hover:bg-destructive/90":"rounded p-0.5 hover:bg-secondary",title:O,"aria-label":O,children:(0,r.jsx)(i.A,{className:"h-3 w-3"})}),S?(0,r.jsx)("span",{className:"text-[10px] text-destructive","aria-live":"polite",children:"fork?"}):null,(0,r.jsx)("button",{type:"button",onClick:()=>D(e=>!e),"aria-label":"session menu",className:"rounded p-0.5 hover:bg-secondary",title:"세션 메뉴",children:(0,r.jsx)(c.A,{className:"h-3 w-3"})})]})]}),C&&(0,r.jsxs)("div",{role:"menu",className:"absolute left-0 top-7 z-50 w-72 rounded-md border border-border bg-popover py-1 text-xs shadow-md",children:[(0,r.jsxs)("button",{type:"button",role:"menuitem",onClick:()=>{let e=(0,o.Zr)();(0,x.cY)("webterm.session-pill.new-chat",{previous:R,next:e,source:"menu"}),k.setSessionId(e),D(!1)},className:"flex w-full items-start gap-2 px-3 py-1.5 text-left hover:bg-secondary",children:[(0,r.jsx)(d.A,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-muted-foreground"}),(0,r.jsxs)("span",{children:["새 대화 시작",(0,r.jsx)("span",{className:"block text-[10px] text-muted-foreground",children:"빈 세션에서 새로 시작합니다 \xb7 지금 대화는 세션 목록에 남습니다"})]})]}),w.onAttachRequest&&(0,r.jsxs)("button",{type:"button",role:"menuitem",onClick:()=>{w.onAttachRequest(),D(!1)},className:"flex w-full items-center gap-2 px-3 py-1.5 hover:bg-secondary",children:[(0,r.jsx)(u.A,{className:"h-3.5 w-3.5 text-muted-foreground"}),"다른 세션 attach"]}),(0,r.jsxs)("div",{className:"px-3 py-1.5 text-muted-foreground",children:[(0,r.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,r.jsx)(m.A,{className:"h-3 w-3 shrink-0"}),(0,r.jsx)("span",{className:"text-[10px] uppercase tracking-wide",children:"세션 ID"})]}),(0,r.jsxs)("div",{className:"mt-1 flex items-center gap-1.5",children:[(0,r.jsx)("span",{className:"flex-1 select-all break-all font-mono text-[11px] text-foreground",title:R||"",children:R||"(미설정)"}),(0,r.jsx)("button",{type:"button",onClick:()=>void P(),disabled:!R,className:"shrink-0 rounded p-1 hover:bg-secondary disabled:cursor-not-allowed disabled:opacity-50",title:E?"복사됨":"세션 ID 전체 복사","aria-label":"세션 ID 복사","data-elanous-action":"session-id-copy-dropdown",children:E?(0,r.jsx)(f.A,{className:"h-3 w-3 text-emerald-500"}):(0,r.jsx)(p.A,{className:"h-3 w-3"})})]}),(0,r.jsxs)("div",{className:"mt-1 text-[10px]",children:[null!=(j=null==U?void 0:U.msgCount)?j:0," 메시지",(null==U?void 0:U.origin)&&" \xb7 ".concat(null!=(y=b[U.origin])?y:U.origin)]})]}),w.onForgetRequest&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"my-1 border-t border-border"}),(0,r.jsxs)("button",{type:"button",role:"menuitem",onClick:()=>{w.onForgetRequest(),D(!1)},className:"flex w-full items-center gap-2 px-3 py-1.5 text-rose-500 hover:bg-rose-500/10",children:[(0,r.jsx)(h.A,{className:"h-3.5 w-3.5"}),"이 세션 잊기"]})]})]})]})}},72422:(e,t,n)=>{n.d(t,{g:()=>s,x:()=>r});let r={idle:"bg-slate-400",connecting:"bg-amber-500",listening:"bg-emerald-500",processing:"bg-sky-500",speaking:"bg-fuchsia-500",error:"bg-rose-600"},s={idle:"음성 대기",connecting:"연결 중…",listening:"듣는 중",processing:"생각 중",speaking:"말하는 중",error:"음성 오류"}},80777:(e,t,n)=>{n.d(t,{$L:()=>i,Kz:()=>l,Vm:()=>o,kv:()=>a});let r="elanous.pwa.chat.autoRouting",s="elanous-chat-routing-changed",a={autoRouting:!1};function o(){return{autoRouting:function(e,t){try{let n=window.localStorage.getItem(e);if("1"===n)return!0;if("0"===n)return!1;return t}catch(e){return t}}(r,a.autoRouting)}}function l(e){try{window.localStorage.setItem(r,e?"1":"0")}catch(e){}window.dispatchEvent(new CustomEvent(s))}function i(e){let t=()=>e(o()),n=t=>{t.key===r&&e(o())};return window.addEventListener(s,t),window.addEventListener("storage",n),()=>{window.removeEventListener(s,t),window.removeEventListener("storage",n)}}},82356:(e,t,n)=>{n.d(t,{vG:()=>a});var r=n(41121),s=n(91269);function a(e){let{children:t}=e;return!function(){let[e,t]=(0,s.useState)(!1);return(0,s.useEffect)(()=>{"public"===new URLSearchParams(window.location.search).get("capture")&&t(!0)},[]),e}()?(0,r.jsx)(r.Fragment,{children:t}):null}},82443:(e,t,n)=>{n.d(t,{hG:()=>c});var r=n(47940),s=n(51215);let a=new Set(["cli","pwa","tg","dc"]);function o(e){var t;let n;e.origin&&a.has(e.origin)?n=e.origin:"telegram"===e.source?n="tg":"cli"===e.source&&(n="cli");let r=(null!=(t=e.preview)?t:"").trim();return{id:e.id,msgCount:e.messageCount,lastTurnAt:e.updatedAt,...r?{lastMsgPreview:r}:{},...n?{origin:n}:{}}}class l{list(){return this.cache}start(){!this.disposed&&(this.timer||(this.scheduleTimer(),this.openEventStream(),this.forceRefresh()))}stop(){this.timer&&(clearInterval(this.timer),this.timer=null,this.currentIntervalMs=null),this.closeEventStream()}dispose(){this.disposed=!0,this.stop(),this.listeners.clear()}enterActive(){this.activeCount+=1,this.scheduleTimer();let e=!1;return()=>{e||(e=!0,this.activeCount=Math.max(0,this.activeCount-1),this.scheduleTimer())}}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}forceRefresh(){if(this.inFlight)return this.inFlight;let e=this.fetchAndStore().finally(()=>{this.inFlight=null});return this.inFlight=e,e}async forget(e){(0,s.cY)("webterm.sessions.forget",{sessionId:e}),await this.api.delete(e),await this.forceRefresh()}scheduleTimer(){if(this.disposed)return;let e=this.activeCount>0?this.opts.activeIntervalMs:this.opts.idleIntervalMs;this.currentIntervalMs===e&&this.timer||(this.timer&&(clearInterval(this.timer),this.timer=null),this.currentIntervalMs=e,this.timer=setInterval(()=>{this.forceRefresh()},e))}openEventStream(){if(this.es||this.disposed||"undefined"==typeof EventSource)return;let e=this.client.sessionStoreEventsUrl();if(e)try{let t=new EventSource(e),n=()=>{this.sseDebounce&&clearTimeout(this.sseDebounce),this.sseDebounce=setTimeout(()=>{this.forceRefresh()},500)};t.addEventListener("session.created",n),t.addEventListener("session.updated",n),t.onmessage=n,this.es=t}catch(e){this.es=null}}closeEventStream(){var e;this.sseDebounce&&(clearTimeout(this.sseDebounce),this.sseDebounce=null),null==(e=this.es)||e.close(),this.es=null}async fetchAndStore(){try{let e=await this.api.list(),t=(Array.isArray(null==e?void 0:e.sessions)?e.sessions:[]).map(o);if(function(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],s=t[n];if(r.id!==s.id||r.msgCount!==s.msgCount||r.lastTurnAt!==s.lastTurnAt||r.lastMsgPreview!==s.lastMsgPreview||r.origin!==s.origin)return!1}return!0}(this.cache,t))return;for(let e of(this.cache=t,this.listeners))try{e()}catch(e){}}catch(e){(0,s.cY)("webterm.sessions.fetch.error",{err:String(e)})}}constructor(e,t={activeIntervalMs:1e4,idleIntervalMs:6e4}){this.client=e,this.opts=t,this.cache=[],this.listeners=new Set,this.activeCount=0,this.timer=null,this.currentIntervalMs=null,this.inFlight=null,this.es=null,this.sseDebounce=null,this.disposed=!1,this.api=new r.jU(e)}}let i=null;function c(e){if(i&&i.client===e)return i.svc;i&&i.svc.dispose();let t=new l(e);return i={client:e,svc:t},t.start(),t}},91732:(e,t,n)=>{function r(e,t){return"".concat("elanous.pwa.snapshot.").concat(e,".").concat(t&&t.length>0?t:"singleton")}function s(){try{return window.localStorage}catch(e){return null}}function a(e){let t=s();if(!t)return null;try{let n=t.getItem(e);if(null===n)return null;return JSON.parse(n)}catch(n){try{t.removeItem(e)}catch(e){}return null}}function o(e,t){let n,r=s();if(r){try{n=JSON.stringify(t)}catch(e){return}if(!(n.length>262144))try{r.setItem(e,n)}catch(e){}}}function l(e){let t=s();if(t)try{t.removeItem(e)}catch(e){}}n.d(t,{N2:()=>a,Os:()=>o,o1:()=>r,yd:()=>l})},92646:(e,t,n)=>{n.d(t,{D:()=>eo});var r=n(41121),s=n(91269),a=n(749),o=n(71946);let l=[n(38317).A];var i=n(82157),c=n(67770),d=n(95515),u=n(98297),m=n(34182),f=n(51215);function p(e){let{block:t}=e,{msg:n,done:s,metrics:a}=t,o=[];if(a){let e=function(e){let t=Math.max(0,Math.round(e/1e3));return t<60?"".concat(t,"s"):t<3600?"".concat(Math.floor(t/60),"m ").concat(t%60,"s"):"".concat(Math.floor(t/3600),"h ").concat(Math.floor(t%3600/60),"m")}(a.elapsedMs);e&&a.elapsedMs>0&&o.push(e);let t=function(e){if(e<=0)return"";let t=e/1e3;return t>=1?"".concat(t.toFixed(1),"k tokens"):"".concat(e," tokens")}(a.tokenCount);t&&o.push(t)}let l=o.length?" (".concat(o.join(" \xb7 "),")"):"";return(0,r.jsxs)("div",{"data-elanous-block-kind":"agent_thinking","data-elanous-block-id":t.blockId,"data-elanous-done":s?"true":"false",className:(0,i.cn)("inline-flex items-center gap-1.5 rounded-full border bg-muted/30 px-2 py-0.5 text-[11px] font-mono",s?"border-border text-muted-foreground":"border-border/60 text-foreground"),children:[(0,r.jsx)("span",{"aria-hidden":"true",className:(0,i.cn)("inline-block h-1.5 w-1.5 rounded-full",s?"bg-emerald-500":"bg-amber-400 motion-safe:animate-pulse")}),(0,r.jsxs)("span",{children:[s?"✓ ":"",n,s?"":"…",(0,r.jsx)("span",{className:"text-muted-foreground",children:l})]})]})}let h={running:"●",queued:"◌",done:"✓",error:"✗"},x={running:"border-amber-400/50 text-amber-300",queued:"border-border text-muted-foreground",done:"border-emerald-500/40 text-emerald-300",error:"border-destructive/50 text-destructive"};function g(e){let{block:t}=e,n=h[t.status],s=x[t.status];return(0,r.jsxs)("div",{"data-elanous-block-kind":"agent_status","data-elanous-block-id":t.blockId,"data-monad-agent-id":t.agentId,"data-elanous-status":t.status,className:(0,i.cn)("inline-flex items-center gap-1.5 rounded border bg-muted/20 px-2 py-0.5 text-[11px] font-mono",s),children:[(0,r.jsx)("span",{"aria-hidden":"true",className:(0,i.cn)("running"===t.status?"motion-safe:animate-pulse":void 0),children:n}),(0,r.jsx)("span",{className:"font-semibold",children:t.agentId}),(0,r.jsx)("span",{className:"uppercase tracking-wide text-[10px] text-muted-foreground",children:t.status}),t.lastEvent&&(0,r.jsxs)("span",{className:"ml-1 truncate text-muted-foreground",children:["\xb7 ",t.lastEvent]})]})}let b={pending:"○","in-progress":"◐",done:"●",skipped:"⊘"},v={pending:"text-muted-foreground","in-progress":"text-amber-300",done:"text-emerald-400",skipped:"text-muted-foreground/60 line-through"};function j(e){let{block:t}=e;return(0,r.jsxs)("div",{"data-elanous-block-kind":"agent_plan","data-elanous-block-id":t.blockId,"data-elanous-plan-ref":t.ref,className:"rounded border border-border bg-muted/20 px-2 py-1.5 text-xs font-mono",children:[(0,r.jsxs)("div",{className:"mb-1 flex items-center justify-between text-[10px] uppercase tracking-wide text-muted-foreground",children:[(0,r.jsxs)("span",{children:["Plan \xb7 ",t.ref]}),"number"==typeof t.activeIndex&&t.steps.length>0&&(0,r.jsxs)("span",{children:[t.activeIndex+1,"/",t.steps.length]})]}),(0,r.jsx)("ol",{className:"m-0 list-none space-y-0.5 p-0",children:t.steps.map((e,n)=>{let s=n===t.activeIndex;return(0,r.jsxs)("li",{"data-elanous-step-index":n,"data-elanous-step-status":e.status,className:(0,i.cn)("flex items-start gap-2 leading-snug",v[e.status],s&&"done"!==e.status?"font-semibold motion-safe:animate-pulse":void 0),children:[(0,r.jsx)("span",{"aria-hidden":"true",className:"select-none",children:b[e.status]}),(0,r.jsx)("span",{className:"flex-1 whitespace-pre-wrap",children:e.text})]},n)})})]})}let y={add:"bg-emerald-500/10 text-emerald-300",del:"bg-rose-500/10 text-rose-300",ctx:"text-muted-foreground"},w={add:"+",del:"-",ctx:" "};function k(e){let{block:t}=e,[n,a]=(0,s.useState)(!1),{adds:o,dels:l}=function(e){let t=0,n=0;for(let r of e.hunks)for(let e of r.lines)"add"===e.kind?t+=1:"del"===e.kind&&(n+=1);return{adds:t,dels:n}}(t),c=t.hunks.length;return(0,r.jsxs)("div",{"data-elanous-block-kind":"tool_diff","data-elanous-block-id":t.blockId,"data-elanous-file-path":t.filePath,className:"rounded border border-border bg-muted/20 px-2 py-1 text-xs font-mono",children:[(0,r.jsxs)("button",{type:"button",onClick:()=>a(!n),"aria-expanded":n,className:"flex w-full items-center gap-2 text-left",children:[(0,r.jsx)("span",{"aria-hidden":"true",children:"⌥"}),(0,r.jsx)("span",{className:"font-semibold truncate",children:t.filePath}),t.language&&(0,r.jsxs)("span",{className:"text-[10px] text-muted-foreground",children:["\xb7",t.language]}),(0,r.jsxs)("span",{className:"ml-auto flex items-center gap-1.5 text-[10px]",children:[o>0&&(0,r.jsxs)("span",{className:"text-emerald-300",children:["+",o]}),l>0&&(0,r.jsxs)("span",{className:"text-rose-300",children:["-",l]}),(0,r.jsxs)("span",{className:"text-muted-foreground",children:[c," hunk",1===c?"":"s"]}),(0,r.jsx)("span",{"aria-hidden":"true",className:"text-muted-foreground",children:n?"▾":"▸"})]})]}),n&&(0,r.jsx)("div",{className:"mt-1 overflow-x-auto rounded bg-background/40",children:t.hunks.map((e,t)=>(0,r.jsxs)("div",{"data-elanous-hunk-index":t,className:"border-t border-border/40 first:border-t-0",children:[(0,r.jsxs)("div",{className:"px-2 py-0.5 text-[10px] text-muted-foreground bg-muted/30",children:["@@ -",e.oldStart,",",e.oldLines," +",e.newStart,",",e.newLines," @@"]}),(0,r.jsx)("pre",{className:"m-0 whitespace-pre p-0 text-[11px] leading-tight",children:e.lines.map((e,t)=>(0,r.jsxs)("div",{"data-elanous-line-kind":e.kind,className:(0,i.cn)("flex items-baseline px-2 py-px",y[e.kind]),children:[(0,r.jsx)("span",{"aria-hidden":"true",className:"w-3 shrink-0 select-none",children:w[e.kind]}),(0,r.jsx)("span",{className:"flex-1",children:e.text})]},t))})]},t))})]})}function N(e){var t,n,s,a;let{hit:o}=e;return(0,r.jsx)("li",{"data-elanous-search-hit-file":o.filePath,"data-elanous-search-hit-line":o.line,className:"rounded px-2 py-1 hover:bg-muted/30",children:(0,r.jsxs)("a",{href:function(e){var t;let n=null!=(t=e.column)?t:1;return"vscode://file/".concat(e.filePath,":").concat(e.line,":").concat(n)}(o),className:"block",target:"_blank",rel:"noopener",children:[(0,r.jsxs)("div",{className:"flex items-baseline gap-2 text-[11px]",children:[(0,r.jsx)("span",{className:"font-semibold truncate",children:o.filePath}),(0,r.jsxs)("span",{className:"text-muted-foreground",children:[":",o.line]}),void 0!==o.column&&(0,r.jsxs)("span",{className:"text-muted-foreground",children:[":",o.column]})]}),(null!=(s=null==(t=o.contextBefore)?void 0:t.length)?s:0)>0&&(0,r.jsx)("pre",{className:"m-0 mt-0.5 whitespace-pre-wrap break-words text-[10px] text-muted-foreground/70",children:o.contextBefore.join("\n")}),(0,r.jsx)("pre",{className:"m-0 whitespace-pre-wrap break-words text-[10px] text-foreground",children:o.snippet}),(null!=(a=null==(n=o.contextAfter)?void 0:n.length)?a:0)>0&&(0,r.jsx)("pre",{className:"m-0 whitespace-pre-wrap break-words text-[10px] text-muted-foreground/70",children:o.contextAfter.join("\n")})]})})}function S(e){let{block:t}=e,[n,a]=(0,s.useState)(!1),o=t.hits.length,l=n?t.hits:t.hits.slice(0,5),c=o-l.length;return(0,r.jsxs)("div",{"data-elanous-block-kind":"tool_search_hits","data-elanous-block-id":t.blockId,"data-elanous-search-query":t.query,"data-elanous-accum-count":t.accumCount,className:(0,i.cn)("rounded border border-border bg-muted/20 px-2 py-1 text-xs font-mono"),children:[(0,r.jsxs)("div",{className:"flex items-baseline gap-2 mb-1",children:[(0,r.jsx)("span",{"aria-hidden":"true",children:"\uD83D\uDD0E"}),(0,r.jsx)("span",{className:"font-semibold",children:t.query}),(0,r.jsxs)("span",{className:"text-[10px] text-muted-foreground",children:[t.accumCount," hit",1===t.accumCount?"":"s"]}),t.truncated&&(0,r.jsx)("span",{className:"text-[10px] text-amber-300",children:"truncated"})]}),0===o?(0,r.jsx)("div",{className:"text-[10px] text-muted-foreground italic",children:"(no hits yet)"}):(0,r.jsx)("ul",{className:"m-0 list-none space-y-0.5 p-0",children:l.map((e,t)=>(0,r.jsx)(N,{hit:e},"".concat(e.filePath,":").concat(e.line,":").concat(t)))}),c>0&&(0,r.jsxs)("button",{type:"button",onClick:()=>a(!0),className:"mt-1 w-full rounded bg-muted/40 px-2 py-0.5 text-[10px] text-muted-foreground hover:bg-muted/60",children:["+ ",c," more"]}),n&&o>5&&(0,r.jsx)("button",{type:"button",onClick:()=>a(!1),className:"mt-1 w-full rounded bg-muted/40 px-2 py-0.5 text-[10px] text-muted-foreground hover:bg-muted/60",children:"collapse"})]})}let I={stdout:"text-foreground",stderr:"text-rose-300",http:"text-amber-300",generic:"text-muted-foreground"},C={stdout:"▌",stderr:"▌",http:"↹",generic:"\xb7"};function D(e){var t;let{block:n}=e,[a,o]=(0,s.useState)(!1),l=n.lines.length,c=0===l?"":n.lines[l-1],d=void 0===n.exitCode?"":0===n.exitCode?"text-emerald-300":"text-rose-300";return(0,r.jsxs)("div",{"data-elanous-block-kind":"tool_progress","data-elanous-block-id":n.blockId,"data-elanous-stream":n.stream,"data-elanous-done":n.done?"true":"false",className:"rounded border border-border bg-muted/20 px-2 py-1 text-xs font-mono",children:[(0,r.jsxs)("button",{type:"button",onClick:()=>o(!a),"aria-expanded":a,className:"flex w-full items-center gap-2 text-left",children:[(0,r.jsx)("span",{"aria-hidden":"true",className:(0,i.cn)(I[n.stream],!n.done&&"motion-safe:animate-pulse"),children:C[n.stream]}),(0,r.jsx)("span",{className:"uppercase tracking-wide text-[10px] text-muted-foreground",children:n.stream}),!a&&c&&(0,r.jsx)("span",{className:(0,i.cn)("flex-1 truncate",I[n.stream]),children:c}),(0,r.jsxs)("span",{className:"ml-auto flex items-center gap-1.5 text-[10px] text-muted-foreground",children:[(0,r.jsxs)("span",{children:[l," line",1===l?"":"s"]}),void 0!==n.bytesSoFar&&(0,r.jsxs)("span",{children:["\xb7 ",(t=n.bytesSoFar)<1024?"".concat(t,"B"):t<1048576?"".concat((t/1024).toFixed(1),"KB"):"".concat((t/1048576).toFixed(1),"MB")]}),void 0!==n.exitCode&&(0,r.jsxs)("span",{className:d,children:["\xb7 exit ",n.exitCode]}),n.done&&!n.exitCode&&(0,r.jsx)("span",{className:"text-emerald-300",children:"\xb7 ✓"}),(0,r.jsx)("span",{"aria-hidden":"true",children:a?"▾":"▸"})]})]}),a&&(0,r.jsx)("pre",{className:(0,i.cn)("m-0 mt-1 max-h-64 overflow-auto rounded bg-background/40 p-1.5 text-[11px] leading-tight whitespace-pre",I[n.stream]),children:0===n.lines.length?"(no output yet)":n.lines.join("\n")})]})}function E(e){var t;let{group:n}=e,s=function(e){if(0===e.samples.length)return"";if(1===e.samples.length)return"M0,".concat(9," L").concat(80,",").concat(9);let t=e.max-e.min||1,n=e.samples.map((n,r)=>{let s=r/(e.samples.length-1)*80,a=(n.value-e.min)/t;return"".concat(s.toFixed(1),",").concat((18-18*a).toFixed(1))});return"M".concat(n[0]," L").concat(n.slice(1).join(" L"))}(n);return(0,r.jsxs)("div",{"data-elanous-perf-metric":n.metric,"data-elanous-perf-latest":n.latest,className:"flex items-center gap-2 text-[10px] font-mono",children:[(0,r.jsx)("span",{className:"text-muted-foreground truncate min-w-[120px]",children:n.metric}),(0,r.jsx)("svg",{width:80,height:18,viewBox:"0 0 ".concat(80," ").concat(18),className:"shrink-0","aria-label":"".concat(n.metric," sparkline"),children:(0,r.jsx)("path",{d:s,fill:"none",stroke:"currentColor",strokeWidth:"1",strokeLinejoin:"round",strokeLinecap:"round",className:"text-amber-400"})}),(0,r.jsx)("span",{className:"text-foreground tabular-nums",children:(t=n.latest)>=1e3?(t/1e3).toFixed(1)+"k":t>=10?t.toFixed(0):t.toFixed(1)}),n.unit&&(0,r.jsx)("span",{className:"text-muted-foreground",children:n.unit})]})}function L(e){let{block:t}=e,n=(0,s.useMemo)(()=>(function(e){let t=new Map;for(let n of e){let e=t.get(n.metric);e?e.push(n):t.set(n.metric,[n])}let n=[];for(let[e,r]of t.entries()){let t=1/0,s=-1/0;for(let e of r)e.value<t&&(t=e.value),e.value>s&&(s=e.value);let a=r[r.length-1].value,o={metric:e,samples:r,latest:a,min:t,max:s},l=r[r.length-1].unit;void 0!==l&&(o.unit=l),n.push(o)}return n.sort((e,t)=>t.samples.length-e.samples.length),n})(t.samples),[t.samples]);return 0===n.length?(0,r.jsx)("div",{"data-elanous-block-kind":"perf_session","data-elanous-block-id":t.blockId,className:"rounded border border-border bg-muted/20 px-2 py-1 text-[10px] text-muted-foreground italic",children:"(no perf samples yet)"}):(0,r.jsx)("div",{"data-elanous-block-kind":"perf_session","data-elanous-block-id":t.blockId,"data-elanous-perf-metric-count":n.length,className:(0,i.cn)("rounded border border-border bg-muted/20 px-2 py-1","flex flex-col gap-0.5"),children:n.map(e=>(0,r.jsx)(E,{group:e},e.metric))})}let M="'none'";function A(e){let t=function(e){if(!e)return[];let t=new Set;for(let n of e)if("string"==typeof n)try{let e=new URL(n);if("http:"!==e.protocol&&"https:"!==e.protocol||e.username||e.password||"/"!==e.pathname||e.search||e.hash)continue;t.add(e.origin)}catch(e){}return[...t]}(e);return t.length>0?t.join(" "):M}let T="ui/notifications/tool-result",R=(e,t,n)=>"".concat(e,":").concat(t,":").concat(typeof n,":").concat(String(n));function U(e,t,n){return{jsonrpc:"2.0",id:e,error:{code:t,message:n}}}function P(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function O(e){return{frames:{...e.frames},pending:{...e.pending},pushes:[...e.pushes],unmatched:[...e.unmatched],nextGeneration:e.nextGeneration}}function F(e){return{jsonrpc:"2.0",method:T,params:{content:[],_meta:{"elanous/resultOmittedReason":e}}}}function _(e){let{message:t,omitted:n,bytes:r}=function(e){if(!(P(e)&&(!("content"in e)||Array.isArray(e.content))))return{message:F("not_a_tool_result"),omitted:"not_a_tool_result",bytes:-1};let t={jsonrpc:"2.0",method:T,params:e};try{structuredClone(t);let e=new TextEncoder().encode(JSON.stringify(t)).byteLength;if(e<=65536)return{message:t,bytes:e};return{message:F("too_large"),omitted:"too_large",bytes:e}}catch(e){return{message:F("unserializable"),omitted:"unserializable",bytes:-1}}}(e.result);return{kind:"notify",frameId:e.frameId,message:t,bytes:r,...n?{omitted:n}:{}}}function Y(e,t){for(let[n,r]of(delete e.frames[t],Object.entries(e.pending)))r.frameId===t&&delete e.pending[n];e.pushes=e.pushes.filter(e=>e.frameId!==t)}function z(e){return{frames:{},pending:{},pushes:[],unmatched:[],nextGeneration:e.nextGeneration}}function q(e,t,n,r,s){let a=R(t,n,r),o=e.frames[t];if(!e.pending[a]||!o||o.generation!==n)return{state:e,actions:[]};let l=O(e);return delete l.pending[a],{state:l,actions:[{kind:"respond",frameId:t,message:"result"in s?{jsonrpc:"2.0",id:r,result:s.result}:{jsonrpc:"2.0",id:r,error:{code:-32603,message:"Daemon tool call failed",data:s.error}}}]}}let H=new WeakMap;var J=n(38519);function $(e){let{html:t,connectDomains:n,resourceDomains:a,server:o,tool:l,toolCallId:i,toolResult:c}=e,d=function(){let{connectDomains:e,resourceDomains:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=A(e),r=A(t);return["default-src ".concat(M),"connect-src ".concat(n),"img-src ".concat(r),"media-src ".concat(r),"style-src ".concat(r),"font-src ".concat(r),"script-src 'unsafe-inline' ".concat(r),"base-uri ".concat(M),"form-action ".concat(M),"navigate-to ".concat(M)].join("; ")}({connectDomains:n,resourceDomains:a}),u='<meta http-equiv="Content-Security-Policy" content="'.concat(d,'">').concat(t),m=(0,s.useRef)(null),p=(0,s.useId)(),h=(0,s.useContext)(J.C),[x,g]=(0,s.useState)(!1),[b,v]=(0,s.useState)(null),j=(0,s.useCallback)(()=>{var e,t;g(!0),v(null!=(t=null==(e=m.current)?void 0:e.contentWindow)?t:null)},[]);return(0,s.useEffect)(()=>{if(b&&h)return function(e,t){let n=e.register({frameId:t.frameId,source:t.source,server:t.server,...void 0!==t.tool?{tool:t.tool}:{},...void 0!==t.toolCallId?{toolCallId:t.toolCallId}:{}}),r=void 0!==t.toolResult&&void 0!==t.tool;return(0,f.cY)("mcp-app.bridge.attach",{frameId:t.frameId,server:t.server,hasTool:void 0!==t.tool,hasToolCallId:void 0!==t.toolCallId,hasToolResult:void 0!==t.toolResult,published:r,...r?{}:{skipped:void 0===t.tool?"no-tool":"no-tool-result"}}),r&&e.publish({server:t.server,tool:t.tool,...void 0!==t.toolCallId?{toolCallId:t.toolCallId}:{},result:t.toolResult}),n}(function(e,t){let n=H.get(e);if(n)return n;let r=function(e,t){let n={frames:{},pending:{},pushes:[],unmatched:[],nextGeneration:1},r=(e,t)=>{var r;let s=null==(r=n.frames[e])?void 0:r.source;if("function"!=typeof(null==s?void 0:s.postMessage))return"no-target";try{return s.postMessage(t,"*"),"posted"}catch(e){return"threw"}},s=e=>{for(let a of e){if("observe"===a.kind&&(0,f.cY)("mcp-app.bridge.discard",{reason:a.reason,...a.method?{method:a.method}:{}}),"notify"===a.kind){let e=r(a.frameId,a.message);(0,f.cY)("mcp-app.bridge.push",{frameId:a.frameId,post:e,bytes:a.bytes,maxBytes:65536,...a.omitted?{omitted:a.omitted}:{}})}"respond"===a.kind&&r(a.frameId,a.message),"daemon-tool-call"===a.kind&&t.callWidgetTool({server:a.server,tool:a.tool,arguments:a.arguments}).then(e=>{let t=q(n,a.frameId,a.generation,a.id,{result:e});n=t.state,s(t.actions)},e=>{let t=q(n,a.frameId,a.generation,a.id,{error:String(e)});n=t.state,s(t.actions)})}},a=e=>{let t=function(e,t,n){let r=Object.values(e.frames).find(e=>e.source===t);if(!r)return{state:e,actions:[{kind:"observe",reason:"untrusted-source"}]};if(!P(n)||"2.0"!==n.jsonrpc||"string"!=typeof n.method)return{state:e,actions:[{kind:"observe",reason:"malformed-message"}]};if("notifications/initialized"===n.method||"ui/notifications/initialized"===n.method){var s;if(r.ready)return{state:e,actions:[]};let t=O(e);t.frames[r.frameId]={...r,ready:!0};let n=t.pushes.filter(e=>e.frameId===r.frameId&&e.generation===r.generation);return t.pushes=t.pushes.filter(e=>e.frameId!==r.frameId||e.generation!==r.generation),{state:t,actions:n.map(_)}}if(!("string"==typeof(s=n.id)||"number"==typeof s&&Number.isFinite(s)))return{state:e,actions:[]};if("ui/initialize"===n.method)return{state:e,actions:[{kind:"respond",frameId:r.frameId,message:{jsonrpc:"2.0",id:n.id,result:{protocolVersion:"2025-11-21",hostInfo:{name:"elanous",version:"1"},hostCapabilities:{serverTools:{}},hostContext:{}}}}]};if("ui/open-link"===n.method||"tools/call"!==n.method)return{state:e,actions:[{kind:"observe",reason:"unknown-method",method:n.method},{kind:"respond",frameId:r.frameId,message:U(n.id,-32601,"Method not found")}]};if(!P(n.params)||"string"!=typeof n.params.name)return{state:e,actions:[{kind:"respond",frameId:r.frameId,message:U(n.id,-32602,"Invalid params")}]};let a=R(r.frameId,r.generation,n.id);if(e.pending[a])return{state:e,actions:[{kind:"respond",frameId:r.frameId,message:U(n.id,-32600,"Duplicate request id")}]};let o=O(e);return o.pending[a]={frameId:r.frameId,id:n.id,generation:r.generation},{state:o,actions:[{kind:"daemon-tool-call",frameId:r.frameId,id:n.id,generation:r.generation,server:r.server,tool:n.params.name,arguments:n.params.arguments}]}}(n,e.source,e.data);n=t.state,s(t.actions)};return e.addEventListener("message",a),{register(e){var t;let r=function(e,t){let n=O(e);for(let[e,r]of Object.entries(n.frames))(e===t.frameId||r.source===t.source)&&Y(n,e);let r=n.nextGeneration++;n.frames[t.frameId]={...t,generation:r,ready:!1};let s=n.unmatched.filter(e=>e.server===t.server&&e.tool===t.tool&&void 0!==e.toolCallId&&e.toolCallId===t.toolCallId);for(let e of(n.unmatched=n.unmatched.filter(e=>!s.includes(e)),s))n.pushes.push({...e,frameId:t.frameId,generation:r});return{state:n,actions:[]}}(n,e);n=r.state,s(r.actions);let a=null==(t=n.frames[e.frameId])?void 0:t.generation;return()=>{void 0!==a&&(n=function(e,t,n){let r=e.frames[t];if(!r||void 0!==n&&r.generation!==n)return{state:e,actions:[]};let s=O(e);return Y(s,t),{state:s,actions:[]}}(n,e.frameId,a).state)}},publish(e){let t=function(e,t){let n=e,r=[],s=!1;for(let a of Object.values(e.frames)){if(a.server!==t.server||a.tool!==t.tool||(void 0!==t.toolCallId||void 0!==a.toolCallId)&&t.toolCallId!==a.toolCallId)continue;s=!0;let e=function(e,t){let n=e.frames[t.frameId];if(!n||n.generation!==t.generation)return{state:e,actions:[]};if(n.ready)return{state:e,actions:[_(t)]};let r=O(e);return r.pushes.push(t),{state:r,actions:[]}}(n,{...t,frameId:a.frameId,generation:a.generation});n=e.state,r.push(...e.actions)}if(!s&&void 0!==t.toolCallId){let e=O(n);e.unmatched=[...e.unmatched,t],n=e}return{state:n,actions:r}}(n,e);n=t.state,s(t.actions)},disposeConversation(){n=z(n)},close(){e.removeEventListener("message",a),n=z(n)}}}(t,{async callWidgetTool(t){let{tool:n,arguments:r}=t;return e.fetchJson("/v1/mcp/widgets/call",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({toolName:n,args:null!=r?r:{}})})}});return H.set(e,r),r}(h.client,window),{frameId:p,source:b,server:null!=o?o:"",...void 0!==l?{tool:l}:{},...void 0!==i?{toolCallId:i}:{},...void 0!==c?{toolResult:c}:{}})},[b,h,p,o,l,i,c]),(0,r.jsx)("iframe",{ref:m,"data-elanous-mcp-app-frame":"true","data-elanous-mcp-server":null!=o?o:"",sandbox:"allow-scripts",srcDoc:u,title:"MCP App",onLoad:j,className:"mt-2 w-full rounded border border-border bg-background transition-[height] ".concat(x?"h-96":"h-10")})}function B(e,t){let n=e.headers.get(t);if(null!==n)return n.split(",").map(e=>e.trim()).filter(e=>e.length>0)}async function K(e,t){if(!t.server||!t.uri)return null;try{let n=await e.fetchResponse(function(e,t){let n=new URLSearchParams({server:e,uri:t});return"".concat("/v1/mcp/resources","?").concat(n.toString())}(t.server,t.uri),t.signal?{signal:t.signal}:void 0);if(!n.ok)return null;let r=await n.text();if(0===r.length)return null;let s=B(n,"x-elanous-mcp-app-connect-domains"),a=B(n,"x-elanous-mcp-app-resource-domains");return{html:r,...s?{connectDomains:s}:{},...a?{resourceDomains:a}:{}}}catch(e){return null}}let V=["__","."];function W(e){var t,n,a,o,l,i;let{block:c}=e,d=function(e){for(let t of V){let n=e.indexOf(t);if(n>0)return e.slice(0,n)}return""}(c.toolName),u=(0,s.useContext)(J.C),[m,p]=(0,s.useState)(null);(0,s.useEffect)(()=>{if(c.html||!u||!d||!c.screenUrl)return;let e=new AbortController,t=!0,n=Date.now();return(0,f.cY)("mcp-app.body.fetch",{server:d,uri:c.screenUrl,reason:"not-embedded"}),K(u.client,{server:d,uri:c.screenUrl,signal:e.signal}).then(e=>{var r,s,a,o,l;t&&((0,f.cY)("mcp-app.body.fetched",{server:d,elapsedMs:Date.now()-n,ok:null!==e,bytes:null!=(a=null==e?void 0:e.html.length)?a:0,connectDomains:null!=(o=null==e||null==(r=e.connectDomains)?void 0:r.length)?o:null,resourceDomains:null!=(l=null==e||null==(s=e.resourceDomains)?void 0:s.length)?l:null}),p(e))}).catch(e=>{t&&(0,f.cY)("mcp-app.body.fetched",{server:d,elapsedMs:Date.now()-n,ok:!1,threw:!0,reason:e instanceof Error?e.message.slice(0,200):String(e).slice(0,200)})}),()=>{t=!1,e.abort()}},[c.html,c.screenUrl,u,d]);let h=null!=(n=null!=(t=c.html)?t:null==m?void 0:m.html)?n:void 0,{connectDomains:x,resourceDomains:g}={...(null!=(a=c.connectDomains)?a:null==m?void 0:m.connectDomains)?{connectDomains:null!=(o=c.connectDomains)?o:null==m?void 0:m.connectDomains}:{},...(null!=(l=c.resourceDomains)?l:null==m?void 0:m.resourceDomains)?{resourceDomains:null!=(i=c.resourceDomains)?i:null==m?void 0:m.resourceDomains}:{}};return(0,r.jsxs)("section",{"data-elanous-block-kind":"mcp_app","data-elanous-tool-id":c.toolId,"data-elanous-tool-name":c.toolName,className:"rounded border border-border bg-muted/40 px-3 py-2 text-sm",children:[(0,r.jsx)("div",{className:"font-medium",children:c.toolName}),(0,r.jsx)("div",{className:"text-xs text-muted-foreground",children:c.toolId}),(0,r.jsx)("div",{className:"mt-1 break-all font-mono text-xs",children:c.screenUrl}),h&&(0,r.jsx)($,{html:h,connectDomains:x,resourceDomains:g,server:d,tool:c.toolName,toolCallId:c.toolId,toolResult:c.toolResult}),c.fallbackText&&(0,r.jsx)("p",{className:"mt-2 whitespace-pre-wrap text-sm",children:c.fallbackText})]})}let G={pre:function(e){let{children:t}=e,n=(0,s.useMemo)(()=>(function e(t){if(null==t||"boolean"==typeof t)return"";if("string"==typeof t||"number"==typeof t)return String(t);if(Array.isArray(t))return t.map(e).join("");if("object"==typeof t&&"props"in t){let n=t.props;return e(null==n?void 0:n.children)}return""})(t),[t]),a=(0,s.useMemo)(()=>(function e(t){if(null==t||"object"!=typeof t)return null;if(Array.isArray(t)){for(let n of t){let t=e(n);if(t)return t}return null}let n=t.props;if((null==n?void 0:n.className)&&"string"==typeof n.className){var r;let e=/language-([\w+-]+)/.exec(n.className);if(e)return null!=(r=e[1])?r:null}return(null==n?void 0:n.children)?e(n.children):null})(t),[t]),o=(0,s.useMemo)(()=>"string"==typeof n&&0!==n.length&&(n.length>800||n.split("\n").length>12),[n]),[l,i]=(0,s.useState)(!o),[p,h]=(0,s.useState)(!1);if(!o)return(0,r.jsx)("pre",{children:t});let x=function(e){let t=e.split("\n");return t.length<=8?e:t.slice(0,8).join("\n")+"\n…"}(n),g=n.split("\n").length,b=async()=>{try{var e;await (null==(e=navigator.clipboard)?void 0:e.writeText(n)),h(!0),(0,f.cY)("pwa.code-block.copy",{lang:a,lineCount:g}),setTimeout(()=>h(!1),1500)}catch(e){(0,f.cY)("pwa.code-block.copy-error",{reason:String(e)})}};return(0,r.jsxs)("div",{className:"my-2 overflow-hidden rounded-md border border-border bg-muted/40","data-testid":"collapsible-code-block",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between gap-2 border-b border-border bg-muted/60 px-2 py-1 text-[11px] text-muted-foreground",children:[(0,r.jsxs)("span",{className:"font-mono",children:[null!=a?a:"code"," \xb7 ",g," lines \xb7 ",n.length," chars"]}),(0,r.jsxs)("div",{className:"flex items-center gap-1",children:[(0,r.jsxs)("button",{type:"button",onClick:()=>{b()},"aria-label":"copy code",className:"inline-flex items-center gap-1 rounded px-1.5 py-0.5 hover:bg-muted hover:text-foreground",children:[p?(0,r.jsx)(c.A,{className:"h-3 w-3"}):(0,r.jsx)(d.A,{className:"h-3 w-3"}),p?"copied":"copy"]}),(0,r.jsxs)("button",{type:"button",onClick:()=>i(e=>!e),"aria-label":l?"collapse code":"expand code",className:"inline-flex items-center gap-1 rounded px-1.5 py-0.5 hover:bg-muted hover:text-foreground",children:[l?(0,r.jsx)(u.A,{className:"h-3 w-3"}):(0,r.jsx)(m.A,{className:"h-3 w-3"}),l?"collapse":"show all"]})]})]}),(0,r.jsx)("pre",{className:"!my-0 overflow-x-auto !rounded-none !bg-transparent !p-2 !text-[13px]",children:l?t:x})]})}};function Q(e){let{text:t}=e;return(0,r.jsx)("div",{className:"prose prose-sm max-w-none break-words [&_pre]:bg-muted [&_pre]:p-2 [&_pre]:rounded [&_code]:font-mono [&_code]:text-xs [&_p]:my-1 [&_table]:text-xs",children:(0,r.jsx)(o.oz,{remarkPlugins:l,components:G,children:t})})}function Z(e){let{block:t}=e,[n,a]=(0,s.useState)(!1),o="running"===t.status?"⋯":"done"===t.status?"✓":"✗",l="running"===t.status?"text-muted-foreground border-border":"error"===t.status?"text-destructive border-destructive/40":"text-foreground border-border",c=!!t.args&&Object.keys(t.args).length>0,d=[t.startedAt,t.endedAt].filter(e=>"number"==typeof e).map(e=>new Date(e).toLocaleTimeString()).join(" → ");return(0,r.jsxs)("div",{"data-elanous-block-kind":"tool_use","data-elanous-tool-name":t.name,"data-elanous-tool-status":t.status,className:(0,i.cn)("rounded border bg-muted/40 px-2 py-1 text-xs font-mono",l),children:[(0,r.jsxs)("button",{type:"button",onClick:c?()=>a(!n):void 0,className:(0,i.cn)("flex w-full items-center gap-2 text-left",c?"cursor-pointer":"cursor-default"),"aria-expanded":c?n:void 0,children:[(0,r.jsx)("span",{"aria-hidden":"true",children:o}),(0,r.jsx)("span",{className:"font-semibold",children:t.name}),t.summary&&(0,r.jsx)("span",{className:"ml-1 truncate text-muted-foreground",children:t.summary}),d&&(0,r.jsx)("span",{className:"ml-auto text-muted-foreground",children:d}),c&&(0,r.jsx)("span",{className:"ml-auto text-muted-foreground","aria-hidden":"true",children:n?"▾":"▸"})]}),n&&c&&(0,r.jsx)("pre",{className:"mt-1 overflow-x-auto rounded bg-background/60 p-1.5 text-[10px] leading-tight",children:JSON.stringify(t.args,null,2)})]})}function X(e){let{blocks:t}=e;return(0,r.jsx)("div",{className:"flex flex-col gap-2",children:t.map((e,t)=>{if("text"===e.kind)return(0,r.jsx)(Q,{text:e.text},t);if("image"===e.kind){var n;return(0,r.jsx)("img",{src:e.src,alt:null!=(n=e.alt)?n:"inline image (".concat(e.mediaType,")"),className:"max-w-full rounded border border-border","data-elanous-block-kind":"image","data-elanous-media-type":e.mediaType},t)}return"tool_use"===e.kind?(0,r.jsx)(Z,{block:e},"".concat(e.id,"-").concat(t)):"mcp_app"===e.kind?(0,r.jsx)(W,{block:e},"".concat(e.toolId,"-").concat(t)):"agent_thinking"===e.kind?(0,r.jsx)(p,{block:e},"thinking-".concat(e.blockId)):"agent_status"===e.kind?(0,r.jsx)(g,{block:e},"status-".concat(e.blockId)):"agent_plan"===e.kind?(0,r.jsx)(j,{block:e},"plan-".concat(e.blockId)):"tool_diff"===e.kind?(0,r.jsx)(k,{block:e},"diff-".concat(e.blockId)):"tool_search_hits"===e.kind?(0,r.jsx)(S,{block:e},"search-".concat(e.blockId)):"tool_progress"===e.kind?(0,r.jsx)(D,{block:e},"progress-".concat(e.blockId)):"perf_session"===e.kind?(0,r.jsx)(L,{block:e},"perf-".concat(e.blockId)):null})})}function ee(e){var t,n,s,a;let{message:o}=e,l="user"===o.role,c="meta"===o.role,d="system"===o.role,u=new Date(o.timestamp).toLocaleTimeString();if(c)return(0,r.jsx)("div",{className:"px-2 py-1 text-[11px] text-muted-foreground italic",children:(0,r.jsx)("pre",{className:"whitespace-pre-wrap font-mono text-[11px]",children:o.text})});if(d){let e="error"===(null!=(a=null==(s=o.meta)?void 0:s.systemLevel)?a:"note");return(0,r.jsx)("div",{className:"px-3 py-2",children:(0,r.jsxs)("div",{className:(0,i.cn)("rounded-md border px-3 py-2 text-xs font-mono",e?"border-rose-500/60 bg-rose-500/10 text-rose-300":"border-border/60 bg-muted/40 text-muted-foreground italic"),children:[(0,r.jsxs)("div",{className:"flex items-baseline gap-2",children:[(0,r.jsx)("span",{className:(0,i.cn)("shrink-0 text-[10px] font-semibold uppercase tracking-wide",e?"text-rose-400":"text-muted-foreground/70"),children:e?"⚠ Error":"Note"}),(0,r.jsx)("pre",{className:"flex-1 whitespace-pre-wrap break-all",children:o.text})]}),(0,r.jsx)("div",{className:"mt-1 text-[10px] text-muted-foreground/80",children:u})]})})}let m=Array.isArray(o.blocks)&&o.blocks.length>0;return(0,r.jsx)("div",{className:(0,i.cn)("flex gap-3 px-4 py-3",l?"justify-end":"justify-start"),children:(0,r.jsxs)("div",{className:(0,i.cn)("max-w-[85%] rounded-lg px-3 py-2 text-sm shadow-sm",l?"bg-primary text-primary-foreground":"bg-card text-card-foreground border border-border"),children:[m?(0,r.jsx)(X,{blocks:o.blocks}):(0,r.jsx)(Q,{text:o.text}),(0,r.jsxs)("div",{className:"mt-1 flex items-center gap-2 text-[10px] text-muted-foreground",children:[(0,r.jsx)("span",{children:u}),o.terminalId&&(0,r.jsx)("span",{title:"이 메시지가 나눈 터미널",className:"rounded border border-border/60 bg-muted/60 px-1 font-mono text-[9px] leading-4",children:o.terminalId}),(null==(t=o.meta)?void 0:t.provider)&&(0,r.jsxs)("span",{title:"답한 LLM",children:["\xb7 ",o.meta.provider,o.meta.model?" \xb7 ".concat(o.meta.model):""]}),(null==(n=o.meta)?void 0:n.stopReason)&&(0,r.jsxs)("span",{children:["\xb7 ",o.meta.stopReason]})]})]})})}function et(e){return en(e)>240}function en(e){return Math.max(0,e.scrollHeight-e.clientHeight-e.scrollTop)}function er(e){var t;return null!=(t=null==e?void 0:e.querySelector('[data-slot="scroll-area-viewport"],[data-radix-scroll-area-viewport]'))?t:null}let es=["wheel","touchmove","pointerdown","keydown"];var ea=n(91732);function eo(e){let{messages:t,pending:n,tabId:o}=e,l=(0,s.useRef)(null),i=(0,s.useRef)(null),c=(0,ea.o1)("chatScroll",o);(0,s.useEffect)(()=>{let e=er(i.current);if(!e)return;let t=(0,ea.N2)(c);"number"==typeof t&&t>0&&(e.scrollTop=t)},[c]),(0,s.useEffect)(()=>{let e=er(i.current);if(!e)return;let t=null,n=()=>{t&&clearTimeout(t),t=setTimeout(()=>{(0,ea.Os)(c,e.scrollTop)},250)};return e.addEventListener("scroll",n,{passive:!0}),()=>{e.removeEventListener("scroll",n),t&&clearTimeout(t)}},[c]);let[d,u]=(0,s.useState)(!1),m=(0,s.useRef)({stuck:!0}),f=(0,s.useRef)(!1),p=(0,s.useRef)(t.length);(0,s.useEffect)(()=>{let e=t[t.length-1];t.length>p.current&&(null==e?void 0:e.role)==="user"&&(f.current=!0),p.current=t.length},[t]),(0,s.useEffect)(()=>{var e,t;let n=er(i.current),r=null==(e=l.current)?void 0:e.parentElement;if(!n||!r)return;let s=!1,a=e=>{var t;!s&&(u(et({scrollTop:n.scrollTop,scrollHeight:n.scrollHeight,clientHeight:n.clientHeight})),t=m.current,(f.current||t.stuck)&&(f.current=!1,n.scrollTo({top:n.scrollHeight,behavior:e?"auto":"smooth"})))};a(!1);let o=()=>({scrollTop:n.scrollTop,scrollHeight:n.scrollHeight,clientHeight:n.clientHeight}),c=null,d=()=>{let e=o();m.current=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:96;return{stuck:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:96;return en(e)<=t}(t,n)}}(m.current,e),u(et(e))},p=()=>{u(et(o()))},h=e=>{var t;if("keydown"!==e.type||"PageUp"===(t=e.key)||"PageDown"===t||"Home"===t||"End"===t||"ArrowUp"===t||"ArrowDown"===t||" "===t||"Spacebar"===t){if("pointerdown"===e.type){s=!0,n.scrollTo({top:n.scrollTop,behavior:"auto"});return}"function"==typeof requestAnimationFrame?(null!==c&&cancelAnimationFrame(c),c=requestAnimationFrame(()=>{c=null,d()})):d()}},x=()=>{s&&(s=!1,d())};n.addEventListener("scroll",p,{passive:!0});let g=null!=(t=i.current)?t:n;for(let e of es)g.addEventListener(e,h,{passive:!0});let b=window;null==b||b.addEventListener("pointerup",x,{passive:!0}),null==b||b.addEventListener("pointercancel",x,{passive:!0});let v=()=>{for(let e of(null!==c&&"function"==typeof cancelAnimationFrame&&(cancelAnimationFrame(c),c=null),n.removeEventListener("scroll",p),es))g.removeEventListener(e,h);null==b||b.removeEventListener("pointerup",x),null==b||b.removeEventListener("pointercancel",x)};if("undefined"==typeof ResizeObserver)return v;let j=new ResizeObserver(()=>{a(!0)});return j.observe(r),()=>{j.disconnect(),v()}},[t.length,n]);let h=(0,s.useCallback)(()=>{let e=er(i.current);m.current={stuck:!0},null==e||e.scrollTo({top:e.scrollHeight,behavior:"smooth"})},[]);return 0!==t.length||n?(0,r.jsxs)("div",{ref:i,className:"relative flex-1 min-h-0",children:[(0,r.jsx)(a.F,{className:"h-full",children:(0,r.jsxs)("div",{className:"flex flex-col gap-1 pt-2 ".concat("pb-24"),children:[t.map(e=>(0,r.jsx)(ee,{message:e},e.id)),n&&(0,r.jsx)("div",{className:"flex justify-start px-4 py-3",children:(0,r.jsxs)("div",{className:"flex items-center gap-2 rounded-lg border border-border bg-card px-3 py-2 text-sm text-muted-foreground",children:[(0,r.jsx)("span",{className:"h-1.5 w-1.5 animate-pulse rounded-full bg-primary"}),"thinking…"]})}),(0,r.jsx)("div",{ref:l})]})}),d&&(0,r.jsx)("button",{type:"button",onClick:h,"data-elanous-jump-to-bottom":"true",className:"absolute bottom-3 left-1/2 -translate-x-1/2 rounded-full border border-border bg-card/95 px-3 py-1.5 text-xs shadow-lg backdrop-blur transition-colors hover:bg-accent",children:"맨 아래로 ↓"})]}):(0,r.jsxs)("div",{className:"flex flex-1 flex-col items-center justify-center gap-2 p-8 text-center text-sm text-muted-foreground",children:[(0,r.jsx)("p",{children:"무엇이든 말을 걸어 보세요."}),(0,r.jsxs)("p",{className:"text-xs",children:[(0,r.jsx)("code",{className:"rounded bg-muted px-1.5 py-0.5 font-mono",children:":help"})," 를 치면 명령 목록이 나옵니다."]})]})}},95939:(e,t,n)=>{n.d(t,{hn:()=>a,qv:()=>o,sg:()=>l});let r="elanous.ocr.prefs",s={defaultUseLlmVision:!1,defaultPreferHandwriting:!1};function a(){if("undefined"==typeof localStorage)return{...s};try{let e=localStorage.getItem(r);if(!e)return{...s};let t=JSON.parse(e);return{defaultUseLlmVision:"boolean"==typeof t.defaultUseLlmVision?t.defaultUseLlmVision:s.defaultUseLlmVision,defaultPreferHandwriting:"boolean"==typeof t.defaultPreferHandwriting?t.defaultPreferHandwriting:s.defaultPreferHandwriting}}catch(e){return{...s}}}function o(e){if("undefined"==typeof localStorage)return{...s,...e};let t={...a(),...e};try{localStorage.setItem(r,JSON.stringify(t))}catch(e){}return t}function l(){if("undefined"==typeof localStorage)return{...s};try{localStorage.removeItem(r)}catch(e){}return{...s}}}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6320],{5344:(e,t,s)=>{s.d(t,{r:()=>i});var n=s(41121),a=s(45609),r=s.n(a);let l=[{key:"autopilot",href:"/autopilot",num:"①",label:"미션",sub:"Autopilot"},{key:"tasks",href:"/tasks",num:"②",label:"작업",sub:"Tasks"},{key:"scheduler",href:"/scheduler",num:"③",label:"스케줄",sub:"Schedules"}];function i(e){let{active:t}=e;return(0,n.jsxs)("nav",{"aria-label":"Mission Fabric 파이프라인","data-testid":"fabric-stage-header",className:"flex flex-wrap items-center gap-1 text-xs",children:[(0,n.jsx)("span",{className:"mr-1 text-muted-foreground",children:"Missions"}),l.map((e,s)=>(0,n.jsxs)("span",{className:"flex items-center gap-1",children:[(0,n.jsxs)(r(),{href:e.href,"aria-current":e.key===t?"page":void 0,className:["rounded px-2 py-1 ring-1 transition-colors",e.key===t?"bg-primary/15 font-medium text-foreground ring-primary/40":"text-muted-foreground ring-border hover:bg-muted hover:text-foreground"].join(" "),children:[(0,n.jsx)("span",{className:"mr-1",children:e.num}),e.label,(0,n.jsx)("span",{className:"ml-1 text-[10px] opacity-70",children:e.sub})]}),s<l.length-1&&(0,n.jsx)("span",{className:"text-muted-foreground/50","aria-hidden":!0,children:"→"})]},e.key))]})}},26320:(e,t,s)=>{s.d(t,{B:()=>T});var n=s(41121),a=s(91269),r=s(38519),l=s(72030);class i{buildSnapshot(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:80;return this.client.fetchJson("/v1/builds/".concat(encodeURIComponent(e),"?tail=").concat(t))}list(){return this.client.fetchJson("/v1/tasks")}detail(e){return this.client.fetchJson("/v1/tasks/".concat(encodeURIComponent(e)))}constructor(e){this.client=e}}var d=s(86542),o=s(51215),c=s(66062),u=s(94387);class m extends Error{constructor(e,t,s){super("fluent-chain ".concat(e," on ").concat(t)),this.status=e,this.path=t,this.body=s,this.name="FluentChainApiError"}}function x(e){var t;let s=e.baseUrl.replace(/\/+$/,""),n=null!=(t=e.fetchImpl)?t:fetch,a="/v1/next-fluent/preview";return{async preview(t){let r={"content-type":"application/json"};e.authHeader&&(r.authorization=e.authHeader);let l=await n("".concat(s).concat(a),{method:"POST",headers:r,body:JSON.stringify(t)});if(204===l.status)return{kind:"no-suggestions",enabled:!0};let i=await l.json().catch(()=>null);if(409===l.status){let e=!!i&&"object"==typeof i&&"enabled"in i&&!!i.enabled;return e?{kind:"no-suggestions",enabled:e}:{kind:"disabled"}}if(503===l.status&&i&&"object"==typeof i&&"next-fluent-not-wired"===i.error)return{kind:"disabled"};if(!l.ok||!(null==i?void 0:i.card))throw new m(l.status,a,i);return{kind:"card",card:i.card}},async dispatch(t,a){let r={"content-type":"application/json"};e.authHeader&&(r.authorization=e.authHeader);let l=u.m,i=await n("".concat(s).concat(l),{method:"POST",headers:r,body:JSON.stringify({refId:t,action:a})}),d=await i.json().catch(()=>null);return d&&"object"==typeof d&&"ok"in d?d:{ok:!1,error:"dispatch ".concat(i.status)}}}}function p(e){var t;let[s,r]=(0,a.useState)({kind:"loading"});if((0,a.useEffect)(()=>{var t;let s=!1;return(null!=(t=e.api)?t:x({baseUrl:window.location.origin})).preview(e.trigger).then(e=>{s||("card"===e.kind?r({kind:"card",card:e.card}):"no-suggestions"===e.kind?r({kind:"empty"}):r({kind:"disabled"}))}).catch(e=>{s||r({kind:"error",message:e instanceof Error?e.message:String(e)})}),()=>{s=!0}},[e.api,e.trigger.refId,e.trigger.refKind,e.trigger.outcome,e.trigger.completedAt]),"loading"===s.kind)return(0,n.jsx)("span",{className:"text-xs opacity-60",children:"checking next-action…"});if("disabled"===s.kind||"empty"===s.kind)return null;if("error"===s.kind)return(0,n.jsxs)("span",{className:"text-xs text-rose-700",children:["next-action: ",s.message]});let l=null!=(t=e.limit)?t:3,i=s.card.suggestions.slice(0,l);return 0===i.length?null:(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-1 text-xs","data-fluent-ref":e.trigger.refId,children:[(0,n.jsx)("span",{className:"opacity-60",children:"next:"}),i.map(t=>(0,n.jsxs)("button",{type:"button",className:"rounded-full border border-zinc-300 bg-white px-2 py-0.5 hover:bg-zinc-50",onClick:()=>{var s;return null==(s=e.onChoose)?void 0:s.call(e,t.kind,t)},title:t.reason||t.kind,children:[t.kind,"none"!==t.endorsedBy&&(0,n.jsxs)("span",{className:"ml-1 text-[10px] opacity-60",children:["\xb7 ",t.endorsedBy]})]},t.kind))]})}class h extends Error{constructor(e,t,s){super("idle-nudge ".concat(e," on ").concat(t)),this.status=e,this.path=t,this.body=s,this.name="IdleNudgeApiError"}}function g(e){let[t,s]=(0,a.useState)({kind:"loading"});if((0,a.useEffect)(()=>{var t;let n=!1;return(null!=(t=e.api)?t:function(e){var t;let s=e.baseUrl.replace(/\/+$/,""),n=null!=(t=e.fetchImpl)?t:fetch,a=u.J3;return{async preview(t){let r={"content-type":"application/json"};e.authHeader&&(r.authorization=e.authHeader);let l=await n("".concat(s).concat(a),{method:"POST",headers:r,body:JSON.stringify(t)}),i=await l.json().catch(()=>null);if(!l.ok)throw new h(l.status,a,i);return i}}}({baseUrl:window.location.origin})).preview(e.request).then(e=>{n||("nudge"===e.decision.kind&&e.record?s({kind:"nudge",decision:e.decision,record:e.record}):"defer"===e.decision.kind?s({kind:"defer",nextAt:e.decision.nextEligibleAt}):s({kind:"idle"}))}).catch(e=>{n||s({kind:"error",message:e instanceof h?"Idle-nudge error (".concat(e.status,")"):e instanceof Error?e.message:String(e)})}),()=>{n=!0}},[e.api,e.request.taskId,e.request.observedAt,e.request.status,e.request.enteredStatusAt]),"loading"===t.kind||"idle"===t.kind)return null;if("defer"===t.kind)return(0,n.jsxs)("span",{className:"text-[10px] opacity-60",children:["nudge deferred until ",new Date(t.nextAt).toLocaleTimeString()]});if("error"===t.kind)return(0,n.jsx)("span",{className:"text-[10px] text-rose-700",children:t.message});let r=Math.round(t.decision.idleMs/36e5);return(0,n.jsxs)("button",{type:"button",className:"inline-flex items-center gap-1 rounded-full border border-amber-300 bg-amber-50 px-2 py-0.5 text-[11px] text-amber-900 hover:bg-amber-100",onClick:()=>{var s;return null==(s=e.onOpenShowroom)?void 0:s.call(e,t.record.showroomSessionId)},title:"Idle ".concat(r,"h \xb7 click to open nudge room"),"data-task-id":t.record.taskId,children:[(0,n.jsx)("span",{"aria-hidden":!0,children:"⏳"}),"idle ",r,"h \xb7 ",t.record.lanes.length," lanes"]})}var f=s(5344);let b=(0,a.createContext)(null),v=new Set(["ready","running","review","blocked"]),y=new Set(["done","failed"]),k=[{id:"backlog",label:"Backlog",statuses:["backlog","blocked"]},{id:"scheduled",label:"Scheduled",statuses:["scheduled"]},{id:"ready",label:"Ready",statuses:["ready"]},{id:"running",label:"Running",statuses:["running"]},{id:"review",label:"Review",statuses:["review"]},{id:"closed",label:"Closed",statuses:["done","failed","cancelled","superseded"]}],j={urgent:"bg-red-500/15 text-red-300 ring-red-500/30",high:"bg-amber-500/15 text-amber-200 ring-amber-500/30",medium:"bg-sky-500/15 text-sky-200 ring-sky-500/30",low:"bg-muted text-muted-foreground ring-border"},N={pending:"bg-slate-500/15 text-slate-300 ring-slate-500/30",active:"bg-sky-500/15 text-sky-200 ring-sky-500/30",verifying:"bg-amber-500/15 text-amber-200 ring-amber-500/30",done:"bg-emerald-500/15 text-emerald-300 ring-emerald-500/30",failed:"bg-red-500/15 text-red-300 ring-red-500/30"};function w(e){let t=Math.max(0,Math.floor((Date.now()-e)/1e3));if(t<60)return"".concat(t,"s ago");let s=Math.floor(t/60);if(s<60)return"".concat(s,"m ago");let n=Math.floor(s/60);return n<24?"".concat(n,"h ago"):"".concat(Math.floor(n/24),"d ago")}let S={running:0,review:1,ready:2,blocked:3,backlog:4,done:5,failed:5,cancelled:6,superseded:6,scheduled:3};function C(e){var t;let{group:s,selectedId:r,onSelect:l,arcDetail:i}=e,d=s.total>0?Math.round(s.doneCount/s.total*100):0,[o,c]=(0,a.useState)(!1),u=(null!=(t=null==i?void 0:i.length)?t:0)>0;return(0,n.jsxs)("section",{className:"rounded-2xl border border-border bg-muted/20 p-3",children:[(0,n.jsxs)("div",{className:"mb-2 flex flex-wrap items-center gap-2",children:[!s.isStandalone&&(0,n.jsx)("span",{className:"text-xs",children:"\uD83C\uDFAF"}),u&&(0,n.jsx)("button",{type:"button",onClick:()=>c(e=>!e),className:"text-xs text-muted-foreground hover:text-foreground",title:"아크 상세",children:o?"▾":"▸"}),(0,n.jsx)("h2",{className:"text-sm font-semibold",title:s.missionTitle,children:s.missionTitle}),(0,n.jsxs)("span",{className:"rounded-full bg-background px-2 py-0.5 text-[11px] text-muted-foreground",children:[s.doneCount,"/",s.total," \xb7 ",d,"%"]}),s.runningCount>0&&(0,n.jsxs)("span",{className:"animate-pulse rounded-full bg-sky-500/15 px-2 py-0.5 text-[10px] text-sky-200 ring-1 ring-sky-500/30",children:["● ",s.runningCount," 빌드중"]}),s.failedCount>0&&(0,n.jsxs)("span",{className:"rounded-full bg-red-500/15 px-2 py-0.5 text-[10px] text-red-300 ring-1 ring-red-500/30",children:["✗ ",s.failedCount," 실패"]})]}),s.arcs.length>0&&(0,n.jsx)("div",{className:"mb-2 flex flex-wrap gap-1.5",children:s.arcs.map((e,t)=>{var s;return(0,n.jsxs)("span",{className:"flex items-center gap-1 text-[10px]",children:[t>0&&(0,n.jsx)("span",{className:"text-muted-foreground",children:"→"}),(0,n.jsxs)("span",{className:"rounded-full px-2 py-0.5 ring-1 ".concat(null!=(s=N[e.status])?s:N.pending),children:["⬡ ",e.name," ",e.done,"/",e.total]})]},e.name)})}),o&&u&&(0,n.jsx)("div",{className:"mb-3 space-y-1.5 rounded-xl border border-border bg-background/40 p-2",children:i.map((e,t)=>{var s,a,r,l;let i="failed"===e.status||(null==(s=e.verifyResult)?void 0:s.ok)===!1;return(0,n.jsxs)("div",{className:"text-[11px]",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[(0,n.jsxs)("span",{className:"text-muted-foreground",children:["아크 ",t+1]}),(0,n.jsxs)("span",{className:"rounded-full px-2 py-0.5 ring-1 ".concat(null!=(l=N[e.status])?l:N.pending),children:["⬡ ",e.name," \xb7 ",e.status]}),e.dependsOnArcs.length>0&&(0,n.jsxs)("span",{className:"text-muted-foreground",children:["← 선행 ",e.dependsOnArcs.length]})]}),(0,n.jsx)("div",{className:"mt-0.5 pl-1 text-muted-foreground",children:e.intent}),i&&(null==(a=e.verifyResult)?void 0:a.missing)&&(0,n.jsxs)("div",{className:"mt-0.5 rounded-md bg-red-500/10 px-2 py-1 text-red-300",children:["\uD83D\uDD12 아크 통합검증 실패: ",e.verifyResult.missing,(0,n.jsx)("div",{className:"text-red-400/70",children:"→ arc-revise 초안 카드가 발송됩니다(페이즈는 완료돼도 아크로는 미충족)."})]}),(null==(r=e.verifyResult)?void 0:r.ok)&&(0,n.jsxs)("div",{className:"mt-0.5 pl-1 text-emerald-400/70",children:["✓ 통합검증 통과: ",e.verifyResult.evidence.slice(0,80)]}),e.preflightVerdict&&"founded"!==e.preflightVerdict.verdict&&(0,n.jsxs)("div",{className:"mt-0.5 rounded-md bg-amber-500/10 px-2 py-1 text-amber-300",children:["⚠️ pre-flight: ","mirage"===e.preflightVerdict.verdict?"허상 의심":"과대 범위"," → ",e.preflightVerdict.action,(0,n.jsx)("div",{className:"text-amber-400/70",children:e.preflightVerdict.reason.slice(0,120)})]})]},e.arcId)})}),(0,n.jsx)("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 xl:grid-cols-3",children:s.tasks.map(e=>(0,n.jsx)(A,{task:e,selected:e.id===r,onClick:()=>l(e.id)},e.id))})]})}function I(e){var t;let{api:s,buildId:r}=e,[l,i]=(0,a.useState)(null),[d,o]=(0,a.useState)(null),c=(0,a.useRef)(null);return(0,a.useEffect)(()=>{let e,t=!1,n=async()=>{try{let a=await s.buildSnapshot(r,120);if(t)return;i(a),o(null),"running"===a.build.status&&(e=window.setTimeout(()=>void n(),2e3))}catch(e){t||o(e instanceof Error?e.message:String(e))}};return n(),()=>{t=!0,e&&window.clearTimeout(e)}},[s,r]),(0,a.useEffect)(()=>{c.current&&(c.current.scrollTop=c.current.scrollHeight)},[l]),(0,n.jsxs)("div",{className:"space-y-1.5",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 text-[11px]",children:[(0,n.jsx)("span",{className:"font-medium",children:"빌드 로그"}),(0,n.jsx)("span",{className:"rounded-full bg-muted px-2 py-0.5 text-muted-foreground",children:r}),l&&(0,n.jsx)("span",{className:"rounded-full px-2 py-0.5 ring-1 ".concat("running"===l.build.status?"bg-sky-500/15 text-sky-200 ring-sky-500/30":"bg-muted text-muted-foreground ring-border"),children:"running"===l.build.status?"● 라이브":l.build.status}),(null==l?void 0:l.diffStat)&&(0,n.jsxs)("span",{className:"text-muted-foreground",children:["+",l.diffStat.insertions,"/-",l.diffStat.deletions," \xb7 ",l.diffStat.files,"파일"]})]}),d&&(0,n.jsxs)("div",{className:"text-[11px] text-red-300",children:["로그 조회 실패: ",d]}),(0,n.jsx)("div",{ref:c,className:"max-h-64 overflow-auto rounded-lg border border-border bg-background/60 p-2 font-mono text-[10px] leading-relaxed text-muted-foreground",children:(null==l||null==(t=l.logTail)?void 0:t.length)?l.logTail.map((e,t)=>(0,n.jsx)("div",{className:"whitespace-pre-wrap break-all",children:e},t)):(0,n.jsx)("div",{className:"opacity-60",children:"로그 대기 중…"})})]})}function A(e){var t,s,a;let{task:r,selected:l,onClick:i}=e;return(0,n.jsxs)("button",{type:"button",onClick:i,className:["w-full rounded-xl border p-3 text-left transition-colors",l?"border-primary bg-primary/10 ring-1 ring-primary/40":"border-border bg-card hover:bg-accent/40"].join(" "),children:[(0,n.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,n.jsxs)("div",{className:"min-w-0",children:[r.missionTitle&&(0,n.jsxs)("div",{className:"mb-1 flex items-center gap-1 truncate text-[10px] text-indigo-300",title:r.missionTitle,children:[(0,n.jsx)("span",{className:"shrink-0",children:"\uD83C\uDFAF 미션"}),(0,n.jsx)("span",{className:"truncate opacity-80",children:r.missionTitle})]}),(0,n.jsx)("div",{className:"text-sm font-medium leading-5",children:r.title}),(0,n.jsx)("div",{className:"mt-1 text-[11px] text-muted-foreground",children:r.id})]}),(0,n.jsxs)("div",{className:"flex items-center gap-1.5",children:[r.dryRun&&(0,n.jsx)("span",{className:"rounded-full bg-emerald-500/15 px-2 py-0.5 text-[10px] text-emerald-300",children:"dry run"}),(0,n.jsx)("span",{className:"rounded-full px-2 py-0.5 text-[10px] ring-1 ".concat(null!=(t=j[r.priority])?t:j.low),children:r.priority})]})]}),(0,n.jsxs)("div",{className:"mt-3 flex flex-wrap gap-1.5 text-[11px] text-muted-foreground",children:[(0,n.jsx)("span",{className:"rounded-full bg-muted px-2 py-0.5",children:r.surfaceKind}),"running"===r.status&&r.build&&(0,n.jsxs)("span",{className:"flex items-center gap-1 rounded-full bg-sky-500/15 px-2 py-0.5 text-sky-200 ring-1 ring-sky-500/30",title:"빌드 ".concat(r.build.buildId," \xb7 ").concat(r.build.backend).concat(r.build.maxTurns?" \xb7 ".concat(r.build.maxTurns,"턴"):""),children:[(0,n.jsx)("span",{className:"animate-pulse",children:"●"})," 빌드중 ",r.build.backend.replace(/^elanous-self:/,"")," 시도",r.build.attemptSeq]}),r.arcName&&(0,n.jsxs)("span",{className:"rounded-full px-2 py-0.5 ring-1 ".concat(null!=(a=N[null!=(s=r.arcStatus)?s:"pending"])?a:N.pending),title:"아크: ".concat(r.arcName).concat(r.arcStatus?" \xb7 ".concat(r.arcStatus):""),children:["⬡ ",r.arcName,r.phaseIndexInArc&&r.arcTotalPhases?" \xb7 ".concat(r.phaseIndexInArc,"/").concat(r.arcTotalPhases):""]}),r.featureName&&(0,n.jsx)("span",{className:"rounded-full bg-muted px-2 py-0.5",children:r.featureName}),r.scheduleText&&(0,n.jsx)("span",{className:"rounded-full bg-muted px-2 py-0.5",children:r.scheduleText}),r.showroomSessionId&&(0,n.jsx)("a",{href:"/showroom?session=".concat(encodeURIComponent(r.showroomSessionId)),onClick:e=>e.stopPropagation(),className:"rounded-full bg-sky-500/15 px-2 py-0.5 text-sky-200 ring-1 ring-sky-500/30 hover:bg-sky-500/25",title:"Open showroom session ".concat(r.showroomSessionId),children:"↗ showroom"})]}),(0,n.jsxs)("div",{className:"mt-3 flex items-center justify-between text-[11px] text-muted-foreground",children:[(0,n.jsxs)("span",{children:["attempt ",r.attempt,"/",r.maxRetries]}),(0,n.jsx)("span",{children:w(r.updatedAt)})]}),(0,n.jsx)(M,{task:r})]})}function M(e){let{task:t}=e,s=y.has(t.status),r=v.has(t.status),l=(0,a.useContext)(b);return s||r?(0,n.jsxs)("div",{className:"mt-2 flex flex-wrap items-center gap-2",onClick:e=>e.stopPropagation(),children:[s&&(0,n.jsx)(p,{trigger:{refId:t.id,refKind:"task",finishedSurface:function(e){switch(e){case"terminal-pane":case"vw-slot":case"subagent":case"skill":case"chat-prompt":case"cron":case"llm-direct":case"acx-session":case"showroom":return e;default:return null}}(t.surfaceKind),outcome:"done"===t.status?"ok":"failed",completedAt:t.updatedAt,...t.featureName?{tags:[t.featureName]}:{}},...l?{onChoose:e=>{l(t.id,e)}}:{}}),r&&(0,n.jsx)(g,{request:{taskId:t.id,status:t.status,enteredStatusAt:t.updatedAt,observedAt:Date.now(),taskTitle:t.title}})]}):null}function R(e){let{label:t,value:s}=e;return(0,n.jsxs)("div",{className:"space-y-1",children:[(0,n.jsx)("div",{className:"text-[11px] uppercase tracking-wide text-muted-foreground",children:t}),(0,n.jsx)("div",{className:"text-sm",children:s})]})}function T(){var e,t,s,u,m,p;let{client:h}=(0,r.Q)(),g=(0,a.useMemo)(()=>new i(h),[h]),v=(0,a.useMemo)(()=>new d.Yt(h),[h]),[y,j]=(0,a.useState)(""),[N,M]=(0,a.useState)(!1),[T,J]=(0,a.useState)(new Map),[E,O]=(0,a.useState)([]),[D,P]=(0,a.useState)(null),[U,_]=(0,a.useState)(null),[F,H]=(0,a.useState)(null),[q,z]=(0,a.useState)(!1),[L,K]=(0,a.useState)(!1),[V,B]=(0,a.useState)("mission"),$=(0,a.useCallback)(async()=>{(0,o.cY)("webterm.tasks.list.refresh",{}),z(!0);try{let e=await g.list();O(e.tasks),P(e.summary),v.missionArcMap().then(J).catch(()=>{}),_(t=>t&&e.tasks.some(e=>e.id===t)?t:null)}catch(e){c.oR.error("task board failed: ".concat(e instanceof Error?e.message:e))}finally{z(!1)}},[g,v]),Y=(0,a.useCallback)(async(e,t)=>{try{var s;let n=await x({baseUrl:window.location.origin}).dispatch(e,t);n.ok?c.oR.success("".concat(t," 실행됨")):c.oR.error("".concat(t," 실패: ").concat(null!=(s=n.error)?s:""))}catch(e){c.oR.error("".concat(t," 실패: ").concat(e instanceof Error?e.message:e))}await $()},[$]),G=(0,a.useCallback)(async()=>{let e=y.trim();if(e&&!N){M(!0);try{let t=await v.commitMission(e,"intake");t.ok?(c.oR.success("태스크 생성 → 미션 fabric 이 플랜화 중".concat(t.missionId?" (".concat(t.missionId,")"):"")),j(""),setTimeout(()=>void $(),1200)):c.oR.error("태스크 생성 실패")}catch(e){c.oR.error("태스크 생성 실패: ".concat(e instanceof Error?e.message:e))}finally{M(!1)}}},[y,N,v,$]);(0,a.useEffect)(()=>{$();let e=window.setInterval(()=>void $(),15e3);return()=>window.clearInterval(e)},[$]),(0,a.useEffect)(()=>{if(!U)return void H(null);let e=!1;return K(!0),(async()=>{try{var t;let s=await g.detail(U);if(e)return;H({task:s.task,executions:s.executions.map(e=>({id:e.id,status:e.status,startedAt:e.startedAt,durationMs:e.durationMs,output:e.output})),events:s.events,linkedSchedulerJob:null!=(t=s.linkedSchedulerJob)?t:null})}catch(t){e||c.oR.error("task detail failed: ".concat(t instanceof Error?t.message:t))}finally{e||K(!1)}})(),()=>{e=!0}},[g,U]);let Q=(0,a.useMemo)(()=>k.map(e=>({...e,tasks:E.filter(t=>e.statuses.some(e=>e===t.status))})),[E]),W=(0,a.useMemo)(()=>(function(e){var t,s,n,a,r,l,i;let d=new Map;for(let n of e){let e=n.missionTitle?null!=(t=n.goalSlug)?t:n.missionTitle:"__standalone__";(null!=(s=d.get(e))?s:d.set(e,[]).get(e)).push(n)}let o=[];for(let[e,t]of Array.from(d.entries())){let s="__standalone__"===e,d=new Map;for(let e of t)if(e.arcName){let t=null!=(l=d.get(e.arcName))?l:{name:e.arcName,total:0,done:0,status:null!=(a=e.arcStatus)?a:"pending",index:null!=(r=e.arcIndex)?r:0};t.total+=1,"done"===e.status&&(t.done+=1),e.arcStatus&&(t.status=e.arcStatus),d.set(e.arcName,t)}let c=[...t].sort((e,t)=>{var s,n;return(null!=(s=S[e.status])?s:9)-(null!=(n=S[t.status])?n:9)||t.createdAt-e.createdAt});o.push({key:e,missionTitle:s?"독립 태스크 (미션 외)":null!=(i=null==(n=t[0])?void 0:n.missionTitle)?i:e,tasks:c,total:t.length,doneCount:t.filter(e=>"done"===e.status).length,runningCount:t.filter(e=>"running"===e.status).length,failedCount:t.filter(e=>"failed"===e.status).length,arcs:Array.from(d.values()).sort((e,t)=>e.index-t.index),isStandalone:s})}return o.sort((e,t)=>{if(e.isStandalone!==t.isStandalone)return e.isStandalone?1:-1;let s=e.runningCount>0||e.doneCount<e.total;return s!==(t.runningCount>0||t.doneCount<t.total)?s?-1:1:t.total-e.total})})(E),[E]);return(0,n.jsx)(b.Provider,{value:Y,children:(0,n.jsxs)("div",{className:"mx-auto max-w-[1600px] space-y-4 p-4",children:[(0,n.jsx)(f.r,{active:"tasks"}),(0,n.jsxs)("header",{className:"flex flex-col gap-3 lg:flex-row lg:items-end lg:justify-between",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{className:"text-xl font-semibold tracking-tight",children:"Task Manager"}),(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"TOX board snapshot for backlog, running work, and closed items."})]}),(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[D&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"rounded-lg border border-border bg-card px-3 py-2 text-xs",children:[(0,n.jsx)("div",{className:"text-muted-foreground",children:"open"}),(0,n.jsx)("div",{className:"text-sm font-semibold",children:D.open})]}),(0,n.jsxs)("div",{className:"rounded-lg border border-border bg-card px-3 py-2 text-xs",children:[(0,n.jsx)("div",{className:"text-muted-foreground",children:"closed"}),(0,n.jsx)("div",{className:"text-sm font-semibold",children:D.terminal})]}),(0,n.jsxs)("div",{className:"rounded-lg border border-border bg-card px-3 py-2 text-xs",children:[(0,n.jsx)("div",{className:"text-muted-foreground",children:"linked schedules"}),(0,n.jsx)("div",{className:"text-sm font-semibold",children:D.linkedScheduler})]})]}),(0,n.jsxs)("div",{className:"flex rounded-lg border border-border bg-card p-0.5 text-xs",children:[(0,n.jsx)("button",{type:"button",onClick:()=>B("mission"),className:"rounded-md px-2.5 py-1 ".concat("mission"===V?"bg-primary/20 text-primary":"text-muted-foreground hover:text-foreground"),children:"\uD83C\uDFAF 미션별"}),(0,n.jsx)("button",{type:"button",onClick:()=>B("kanban"),className:"rounded-md px-2.5 py-1 ".concat("kanban"===V?"bg-primary/20 text-primary":"text-muted-foreground hover:text-foreground"),children:"칸반"})]}),(0,n.jsx)(l.$,{size:"sm",variant:"outline",onClick:()=>void $(),disabled:q,children:"Refresh"})]})]}),(0,n.jsxs)("div",{className:"flex items-center gap-2 rounded-xl border border-border bg-card p-2",children:[(0,n.jsx)("span",{className:"pl-1 text-sm text-muted-foreground",children:"+"}),(0,n.jsx)("input",{type:"text",value:y,onChange:e=>j(e.target.value),onKeyDown:e=>{"Enter"===e.key&&G()},placeholder:"새 태스크(골)를 입력하면 미션 fabric 이 플랜화→구현→DONE… 예: 'README 중복 정리 리포트 만들어줘'",className:"min-w-0 flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground/60",disabled:N}),(0,n.jsx)(l.$,{size:"sm",onClick:()=>void G(),disabled:N||!y.trim(),children:N?"생성 중…":"Create Task"})]}),(0,n.jsxs)("div",{className:"flex flex-col gap-4 xl:flex-row xl:items-start",children:[(0,n.jsx)("section",{className:"min-w-0 flex-1 space-y-3",children:"mission"===V?(0,n.jsx)("div",{className:"space-y-3",children:W.length>0?W.map(e=>{var t;return(0,n.jsx)(C,{group:e,selectedId:U,onSelect:_,arcDetail:null==(t=T.get(e.key))?void 0:t.arcs},e.key)}):(0,n.jsx)("div",{className:"rounded-xl border border-dashed border-border px-3 py-12 text-center text-sm text-muted-foreground",children:"미션/태스크 없음"})}):(0,n.jsx)("div",{className:"pb-2",children:(0,n.jsx)("div",{className:"flex flex-wrap gap-3",children:Q.map(e=>(0,n.jsxs)("div",{className:"min-w-[170px] flex-1 rounded-2xl border border-border bg-muted/30 p-3",children:[(0,n.jsxs)("div",{className:"mb-3 flex items-center justify-between",children:[(0,n.jsx)("h2",{className:"text-sm font-semibold",children:e.label}),(0,n.jsx)("span",{className:"rounded-full bg-background px-2 py-0.5 text-[11px] text-muted-foreground",children:e.tasks.length})]}),(0,n.jsx)("div",{className:"space-y-2",children:e.tasks.length>0?e.tasks.map(e=>(0,n.jsx)(A,{task:e,selected:e.id===U,onClick:()=>_(e.id)},e.id)):(0,n.jsx)("div",{className:"rounded-xl border border-dashed border-border px-3 py-8 text-center text-xs text-muted-foreground",children:"no tasks"})})]},e.id))})})}),U&&(0,n.jsxs)("aside",{className:"w-full shrink-0 space-y-3 rounded-2xl border border-border bg-card p-4 xl:w-[360px]",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsx)("h2",{className:"text-base font-semibold",children:"Detail"}),(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(null==F?void 0:F.task)&&(0,n.jsx)("span",{className:"rounded-full bg-muted px-2 py-0.5 text-[11px] text-muted-foreground",children:F.task.status}),(0,n.jsx)("button",{type:"button",onClick:()=>_(null),className:"rounded-md px-1.5 py-0.5 text-xs text-muted-foreground hover:bg-accent/40 hover:text-foreground","aria-label":"Close detail",children:"✕"})]})]}),L||!F?(0,n.jsx)("div",{className:"text-sm text-muted-foreground",children:"Loading task detail…"}):(0,n.jsxs)("div",{className:"space-y-4",children:[(()=>{let e=E.find(e=>e.id===U);return(null==e?void 0:e.status)==="running"&&e.build?(0,n.jsx)(I,{api:g,buildId:e.build.buildId}):null})(),(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"text-lg font-semibold leading-6",children:F.task.title}),(0,n.jsx)("div",{className:"mt-1 text-xs text-muted-foreground",children:F.task.id}),F.task.description&&(0,n.jsx)("p",{className:"mt-3 whitespace-pre-wrap text-sm text-muted-foreground",children:F.task.description})]}),(0,n.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2",children:[(0,n.jsx)(R,{label:"Surface",value:F.task.surface.kind}),(0,n.jsx)(R,{label:"Priority",value:F.task.priority}),(0,n.jsx)(R,{label:"Goal",value:null!=(u=F.task.goalSlug)?u:"—"}),(0,n.jsx)(R,{label:"Feature",value:null!=(m=F.task.featureName)?m:"—"}),(0,n.jsx)(R,{label:"Depends On",value:F.task.dependsOn.length>0?F.task.dependsOn.join(", "):"—"}),(0,n.jsx)(R,{label:"Schedule",value:null!=(p=F.task.schedulerJobId)?p:"—"})]}),F.linkedSchedulerJob&&(0,n.jsxs)("div",{className:"rounded-xl border border-border bg-muted/40 px-3 py-2 text-sm",children:["linked schedule: ",F.linkedSchedulerJob.title,(0,n.jsx)("span",{className:"ml-2 text-xs text-muted-foreground",children:F.linkedSchedulerJob.taskId}),(null==(e=F.linkedSchedulerJob.taskMeta)?void 0:e.dryRun)&&(0,n.jsxs)("span",{className:"ml-2 rounded-full bg-emerald-500/15 px-2 py-0.5 text-[10px] text-emerald-300",children:["dry run",F.linkedSchedulerJob.taskMeta.dryRunOutcome?" \xb7 ".concat(F.linkedSchedulerJob.taskMeta.dryRunOutcome):""]})]}),(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsx)("div",{className:"text-sm font-semibold",children:"Acceptance"}),(null==(s=F.task.acceptance)||null==(t=s.criteria)?void 0:t.length)?(0,n.jsx)("ul",{className:"space-y-1 text-sm text-muted-foreground",children:F.task.acceptance.criteria.map(e=>(0,n.jsx)("li",{className:"rounded-lg bg-muted/50 px-3 py-2",children:e},e))}):(0,n.jsx)("div",{className:"text-sm text-muted-foreground",children:"No acceptance criteria."})]}),(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsx)("div",{className:"text-sm font-semibold",children:"Recent Executions"}),F.executions.length>0?(0,n.jsx)("div",{className:"space-y-2",children:F.executions.map(e=>(0,n.jsxs)("div",{className:"rounded-xl border border-border bg-background p-3",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,n.jsx)("span",{className:"font-medium",children:e.status}),(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:w(e.startedAt)})]}),void 0!==e.durationMs&&(0,n.jsxs)("div",{className:"mt-1 text-xs text-muted-foreground",children:["duration ",Math.round(e.durationMs/1e3),"s"]}),e.output&&(0,n.jsx)("pre",{className:"mt-2 max-h-28 overflow-auto whitespace-pre-wrap rounded-lg bg-muted p-2 text-xs text-muted-foreground",children:e.output.slice(0,600)})]},e.id))}):(0,n.jsx)("div",{className:"text-sm text-muted-foreground",children:"No executions recorded yet."})]}),(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsx)("div",{className:"text-sm font-semibold",children:"Recent Events"}),F.events.length>0?(0,n.jsx)("div",{className:"space-y-1",children:F.events.slice(-8).reverse().map((e,t)=>(0,n.jsxs)("div",{className:"flex items-center justify-between rounded-lg bg-muted/50 px-3 py-2 text-xs",children:[(0,n.jsx)("span",{children:e.kind}),(0,n.jsx)("span",{className:"text-muted-foreground",children:w(e.timestamp)})]},"".concat(e.kind,"-").concat(e.timestamp,"-").concat(t)))}):(0,n.jsx)("div",{className:"text-sm text-muted-foreground",children:"No events recorded yet."})]})]})]})]})]})})}},86542:(e,t,s)=>{function n(e){let t=e.filter(e=>"cron"===e.kind&&e.id).map(e=>e.id);return t.length?"/scheduler?ids=".concat(t.map(encodeURIComponent).join(",")):null}s.d(t,{NE:()=>d,Yt:()=>i,on:()=>n});let a=["task","goal-loop","single-shot"],r=["scheduler","monitor-trigger"];function l(e){var t,s,n,l,i,d,o;let c=e.autopilot,u=null!=(t=null==c?void 0:c.executionModel)?t:null;return{id:e.id,goal:e.title||e.description||e.id,source:null!=(s=null==c?void 0:c.origin)?s:"human",status:null!=(n=null==c?void 0:c.apmStatus)?n:e.status,model:u,tier:null!=(l=null==c?void 0:c.tier)?l:null,engine:null!=(i=null==c?void 0:c.engine)?i:null,kind:(o=null!=(d=null==c?void 0:c.executionModel)?d:null)&&a.includes(o)?"finite":o&&r.includes(o)?"continuous":"other",reviewDue:!1,createdAt:new Date(e.createdAt).toISOString(),isAutopilot:null!=c,toxStatus:e.status,taskCount:e.taskCount,taskCounts:e.taskStatusCounts}}class i{async triagePreview(e,t){return this.client.fetchJson("/v1/autopilot/triage-preview",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({goal:e,...t?{category:t}:{}})})}async commitMission(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"intake",s=arguments.length>2?arguments[2]:void 0;return this.client.fetchJson("/v1/autopilot/triage-preview",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({goal:e,commit:!0,source:t,...s?{category:s}:{}})})}async missions(e,t){let s=new URLSearchParams({...e?{status:e}:{},...t?{source:t}:{}}).toString();return this.client.fetchJson("/v1/autopilot/missions".concat(s?"?".concat(s):""))}async missionsUnified(e){var t,s;let n=new URLSearchParams({...e?{status:e}:{}}).toString(),a=await this.client.fetchJson("/v1/missions".concat(n?"?".concat(n):"")),r=null!=(t=a.missions)?t:[];return{ok:!0,total:null!=(s=a.total)?s:r.length,missions:r.map(l)}}async trace(e){return this.client.fetchJson("/v1/autopilot/trace?id=".concat(encodeURIComponent(e)))}async missionArcMap(){var e,t,s;let n=await this.client.fetchJson("/v1/missions"),a=new Map;for(let r of null!=(e=n.missions)?e:[]){let e=null==(t=r.autopilot)?void 0:t.arcs;e&&e.length>0&&a.set(r.id,{apmStatus:null==(s=r.autopilot)?void 0:s.apmStatus,arcs:e})}return a}async missionAction(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.client.fetchJson("/v1/autopilot/mission-action",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({id:e,action:t,...s})})}async repoWatch(){return this.client.fetchJson("/v1/autopilot/repo-watch")}async autonomy(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:50,t=arguments.length>1?arguments[1]:void 0,s=new URLSearchParams({limit:String(e),...t?{loop:t}:{}});return this.client.fetchJson("/v1/autopilot/autonomy?".concat(s.toString()))}async arming(){return this.client.fetchJson("/v1/autopilot/arming")}constructor(e){this.client=e}}let d={task:{label:"작업 분해",tone:"bg-sky-500/15 text-sky-200 ring-sky-500/30"},"goal-loop":{label:"목표 루프",tone:"bg-violet-500/15 text-violet-200 ring-violet-500/30"},scheduler:{label:"스케줄러",tone:"bg-emerald-500/15 text-emerald-200 ring-emerald-500/30"},"monitor-trigger":{label:"감시 트리거",tone:"bg-amber-500/15 text-amber-200 ring-amber-500/30"},hybrid:{label:"하이브리드",tone:"bg-fuchsia-500/15 text-fuchsia-200 ring-fuchsia-500/30"},fanout:{label:"병렬 팬아웃",tone:"bg-cyan-500/15 text-cyan-200 ring-cyan-500/30"},"single-shot":{label:"즉답",tone:"bg-muted text-muted-foreground ring-border"},"hitl-delegate":{label:"HITL 위임",tone:"bg-rose-500/15 text-rose-200 ring-rose-500/30"}}}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6416],{2961:(e,t,a)=>{a.d(t,{A:()=>r});let r=(0,a(89117).A)("sliders-vertical",[["path",{d:"M10 8h4",key:"1sr2af"}],["path",{d:"M12 21v-9",key:"17s77i"}],["path",{d:"M12 8V3",key:"13r4qs"}],["path",{d:"M17 16h4",key:"h1uq16"}],["path",{d:"M19 12V3",key:"o1uvq1"}],["path",{d:"M19 21v-5",key:"qua636"}],["path",{d:"M3 14h4",key:"bcjad9"}],["path",{d:"M5 10V3",key:"cb8scm"}],["path",{d:"M5 21v-7",key:"1w1uti"}]])},4790:(e,t,a)=>{a.d(t,{A:()=>r});let r=(0,a(89117).A)("telescope",[["path",{d:"m10.065 12.493-6.18 1.318a.934.934 0 0 1-1.108-.702l-.537-2.15a1.07 1.07 0 0 1 .691-1.265l13.504-4.44",key:"k4qptu"}],["path",{d:"m13.56 11.747 4.332-.924",key:"19l80z"}],["path",{d:"m16 21-3.105-6.21",key:"7oh9d"}],["path",{d:"M16.485 5.94a2 2 0 0 1 1.455-2.425l1.09-.272a1 1 0 0 1 1.212.727l1.515 6.06a1 1 0 0 1-.727 1.213l-1.09.272a2 2 0 0 1-2.425-1.455z",key:"m7xp4m"}],["path",{d:"m6.158 8.633 1.114 4.456",key:"74o979"}],["path",{d:"m8 21 3.105-6.21",key:"1fvxut"}],["circle",{cx:"12",cy:"13",r:"2",key:"1c1ljs"}]])},6381:(e,t,a)=>{a.d(t,{A:()=>r});let r=(0,a(89117).A)("store",[["path",{d:"M15 21v-5a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v5",key:"slp6dd"}],["path",{d:"M17.774 10.31a1.12 1.12 0 0 0-1.549 0 2.5 2.5 0 0 1-3.451 0 1.12 1.12 0 0 0-1.548 0 2.5 2.5 0 0 1-3.452 0 1.12 1.12 0 0 0-1.549 0 2.5 2.5 0 0 1-3.77-3.248l2.889-4.184A2 2 0 0 1 7 2h10a2 2 0 0 1 1.653.873l2.895 4.192a2.5 2.5 0 0 1-3.774 3.244",key:"o0xfot"}],["path",{d:"M4 10.95V19a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8.05",key:"wn3emo"}]])},7347:(e,t,a)=>{a.d(t,{A:()=>r});let r=(0,a(89117).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"}]])},8542:(e,t,a)=>{a.d(t,{A:()=>r});let r=(0,a(89117).A)("inbox",[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]])},9050:(e,t,a)=>{var r=a(65390);a.o(r,"useParams")&&a.d(t,{useParams:function(){return r.useParams}}),a.o(r,"usePathname")&&a.d(t,{usePathname:function(){return r.usePathname}}),a.o(r,"useRouter")&&a.d(t,{useRouter:function(){return r.useRouter}}),a.o(r,"useSearchParams")&&a.d(t,{useSearchParams:function(){return r.useSearchParams}})},26882:(e,t,a)=>{a.d(t,{A:()=>r});let r=(0,a(89117).A)("layers",[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]])},31159:(e,t,a)=>{a.d(t,{A:()=>r});let r=(0,a(89117).A)("settings",[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]])},33011:(e,t,a)=>{a.d(t,{A:()=>r});let r=(0,a(89117).A)("layers-2",[["path",{d:"M13 13.74a2 2 0 0 1-2 0L2.5 8.87a1 1 0 0 1 0-1.74L11 2.26a2 2 0 0 1 2 0l8.5 4.87a1 1 0 0 1 0 1.74z",key:"15q6uc"}],["path",{d:"m20 14.285 1.5.845a1 1 0 0 1 0 1.74L13 21.74a2 2 0 0 1-2 0l-8.5-4.87a1 1 0 0 1 0-1.74l1.5-.845",key:"byia6g"}]])},34881:(e,t,a)=>{a.d(t,{A:()=>r});let r=(0,a(89117).A)("square-kanban",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 7v7",key:"1x2jlm"}],["path",{d:"M12 7v4",key:"xawao1"}],["path",{d:"M16 7v9",key:"1hp2iy"}]])},42310:(e,t,a)=>{a.d(t,{A:()=>r});let r=(0,a(89117).A)("book-open",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]])},42859:(e,t,a)=>{a.d(t,{A:()=>r});let r=(0,a(89117).A)("message-square",[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]])},49454:(e,t,a)=>{a.d(t,{A:()=>r});let r=(0,a(89117).A)("crosshair",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"22",x2:"18",y1:"12",y2:"12",key:"l9bcsi"}],["line",{x1:"6",x2:"2",y1:"12",y2:"12",key:"13hhkx"}],["line",{x1:"12",x2:"12",y1:"6",y2:"2",key:"10w3f3"}],["line",{x1:"12",x2:"12",y1:"22",y2:"18",key:"15g9kq"}]])},49559:(e,t,a)=>{a.d(t,{A:()=>r});let r=(0,a(89117).A)("palette",[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]])},58291:(e,t,a)=>{a.d(t,{A:()=>r});let r=(0,a(89117).A)("lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]])},59573:(e,t,a)=>{a.d(t,{A:()=>r});let r=(0,a(89117).A)("bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]])},62480:(e,t,a)=>{a.d(t,{A:()=>r});let r=(0,a(89117).A)("git-pull-request",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M13 6h3a2 2 0 0 1 2 2v7",key:"1yeb86"}],["line",{x1:"6",x2:"6",y1:"9",y2:"21",key:"rroup"}]])},68634:(e,t,a)=>{a.d(t,{A:()=>r});let r=(0,a(89117).A)("compass",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",key:"9ktpf1"}]])},70765:(e,t,a)=>{a.d(t,{A:()=>r});let r=(0,a(89117).A)("layout-grid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]])},84081:(e,t,a)=>{a.d(t,{A:()=>r});let r=(0,a(89117).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"}]])},87216:(e,t,a)=>{a.d(t,{A:()=>r});let r=(0,a(89117).A)("square-terminal",[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]])},89117:(e,t,a)=>{a.d(t,{A:()=>k});var r=a(91269);let l=function(){for(var e=arguments.length,t=Array(e),a=0;a<e;a++)t[a]=arguments[a];return t.filter((e,t,a)=>!!e&&""!==e.trim()&&a.indexOf(e)===t).join(" ").trim()},h=e=>{let t=e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,a)=>a?a.toUpperCase():t.toLowerCase());return t.charAt(0).toUpperCase()+t.slice(1)};var y={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let c=(0,r.createContext)({}),d=(0,r.forwardRef)((e,t)=>{var a,h,d;let{color:k,size:i,strokeWidth:o,absoluteStrokeWidth:n,className:s="",children:p,iconNode:u,...x}=e,{size:A=24,strokeWidth:m=2,absoluteStrokeWidth:M=!1,color:v="currentColor",className:f=""}=null!=(a=(0,r.useContext)(c))?a:{},w=(null!=n?n:M)?24*Number(null!=o?o:m)/Number(null!=i?i:A):null!=o?o:m;return(0,r.createElement)("svg",{ref:t,...y,width:null!=(h=null!=i?i:A)?h:y.width,height:null!=(d=null!=i?i:A)?d:y.height,stroke:null!=k?k:v,strokeWidth:w,className:l("lucide",f,s),...!p&&!(e=>{for(let t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0;return!1})(x)&&{"aria-hidden":"true"},...x},[...u.map(e=>{let[t,a]=e;return(0,r.createElement)(t,a)}),...Array.isArray(p)?p:[p]])}),k=(e,t)=>{let a=(0,r.forwardRef)((a,y)=>{let{className:c,...k}=a;return(0,r.createElement)(d,{ref:y,iconNode:t,className:l("lucide-".concat(h(e).replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()),"lucide-".concat(e),c),...k})});return a.displayName=h(e),a}},95895:(e,t,a)=>{a.d(t,{A:()=>r});let r=(0,a(89117).A)("calendar-clock",[["path",{d:"M16 14v2.2l1.6 1",key:"fo4ql5"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5",key:"1osxxc"}],["path",{d:"M3 10h5",key:"r794hk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]])}}]);