@wjarka/cezarion 0.15.1 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (462) hide show
  1. package/README.md +167 -46
  2. package/dist/agent-config/catalog.d.ts +6 -2
  3. package/dist/agent-config/catalog.js +78 -3
  4. package/dist/agent-config/catalog.js.map +1 -1
  5. package/dist/agent-config/model-settings/shared.js +6 -3
  6. package/dist/agent-config/model-settings/shared.js.map +1 -1
  7. package/dist/agent-config/models.js +4 -0
  8. package/dist/agent-config/models.js.map +1 -1
  9. package/dist/agent-config/validate.js +6 -0
  10. package/dist/agent-config/validate.js.map +1 -1
  11. package/dist/artifacts/cli.js +10 -2
  12. package/dist/artifacts/cli.js.map +1 -1
  13. package/dist/automations/coordinator.d.ts +7 -0
  14. package/dist/automations/coordinator.js +22 -2
  15. package/dist/automations/coordinator.js.map +1 -1
  16. package/dist/automations/github-poller.d.ts +4 -4
  17. package/dist/automations/github-poller.js.map +1 -1
  18. package/dist/automations/schedule-runner.d.ts +130 -0
  19. package/dist/automations/schedule-runner.js +326 -0
  20. package/dist/automations/schedule-runner.js.map +1 -0
  21. package/dist/automations/scheduler.d.ts +38 -7
  22. package/dist/automations/scheduler.js +90 -22
  23. package/dist/automations/scheduler.js.map +1 -1
  24. package/dist/automations/store.d.ts +80 -3
  25. package/dist/automations/store.js +208 -16
  26. package/dist/automations/store.js.map +1 -1
  27. package/dist/automations/task-template.d.ts +42 -6
  28. package/dist/automations/task-template.js +152 -24
  29. package/dist/automations/task-template.js.map +1 -1
  30. package/dist/automations/types.d.ts +142 -6
  31. package/dist/automations/types.js +64 -6
  32. package/dist/automations/types.js.map +1 -1
  33. package/dist/autosave-holders.js +8 -12
  34. package/dist/autosave-holders.js.map +1 -1
  35. package/dist/ci-wait/client.d.ts +8 -1
  36. package/dist/ci-wait/client.js +43 -1
  37. package/dist/ci-wait/client.js.map +1 -1
  38. package/dist/ci-wait/controller.d.ts +83 -4
  39. package/dist/ci-wait/controller.js +76 -11
  40. package/dist/ci-wait/controller.js.map +1 -1
  41. package/dist/ci-wait/errors.d.ts +7 -1
  42. package/dist/ci-wait/errors.js +36 -0
  43. package/dist/ci-wait/errors.js.map +1 -1
  44. package/dist/ci-wait/github.d.ts +2 -0
  45. package/dist/ci-wait/github.js +3 -1
  46. package/dist/ci-wait/github.js.map +1 -1
  47. package/dist/ci-wait/mcp.d.ts +2 -98
  48. package/dist/ci-wait/mcp.js +11 -25
  49. package/dist/ci-wait/mcp.js.map +1 -1
  50. package/dist/ci-wait/supervisor.d.ts +2 -1
  51. package/dist/ci-wait/supervisor.js +2 -1
  52. package/dist/ci-wait/supervisor.js.map +1 -1
  53. package/dist/ci-wait/tools.d.ts +307 -0
  54. package/dist/ci-wait/tools.js +63 -0
  55. package/dist/ci-wait/tools.js.map +1 -0
  56. package/dist/config.d.ts +3 -0
  57. package/dist/config.js +7 -0
  58. package/dist/config.js.map +1 -1
  59. package/dist/contract/agent-config.d.ts +5 -0
  60. package/dist/contract/agent-profiles.d.ts +15 -0
  61. package/dist/contract/automation-schedule.d.ts +60 -0
  62. package/dist/contract/automations.d.ts +208 -36
  63. package/dist/contract/delegation.d.ts +96 -0
  64. package/dist/contract/discovery.d.ts +7 -0
  65. package/dist/contract/github.d.ts +1 -0
  66. package/dist/contract/health.d.ts +6 -0
  67. package/dist/contract/index.d.ts +3 -0
  68. package/dist/contract/index.js +1445 -745
  69. package/dist/contract/preview.d.ts +508 -0
  70. package/dist/contract/runs.d.ts +716 -15
  71. package/dist/contract/skills.d.ts +39 -0
  72. package/dist/contract/workflows.d.ts +6 -0
  73. package/dist/contract/workspace.d.ts +65 -0
  74. package/dist/contract/zoned-time.d.ts +35 -0
  75. package/dist/core/agent-env.d.ts +11 -0
  76. package/dist/core/agent-env.js +27 -5
  77. package/dist/core/agent-env.js.map +1 -1
  78. package/dist/core/agent-profiles.js +7 -0
  79. package/dist/core/agent-profiles.js.map +1 -1
  80. package/dist/core/agent-runner.d.ts +49 -1
  81. package/dist/core/agent-runner.js +2 -1
  82. package/dist/core/agent-runner.js.map +1 -1
  83. package/dist/core/backend-detect.d.ts +3 -2
  84. package/dist/core/backend-detect.js +27 -1
  85. package/dist/core/backend-detect.js.map +1 -1
  86. package/dist/core/claude-cli-runner.d.ts +1 -0
  87. package/dist/core/claude-cli-runner.js +69 -19
  88. package/dist/core/claude-cli-runner.js.map +1 -1
  89. package/dist/core/codex-app-server-runner.d.ts +1 -0
  90. package/dist/core/codex-app-server-runner.js +200 -25
  91. package/dist/core/codex-app-server-runner.js.map +1 -1
  92. package/dist/core/codex-app-server-transport.d.ts +7 -3
  93. package/dist/core/codex-app-server-transport.js +11 -9
  94. package/dist/core/codex-app-server-transport.js.map +1 -1
  95. package/dist/core/cursor-acp-runner.d.ts +1 -0
  96. package/dist/core/cursor-acp-runner.js +24 -9
  97. package/dist/core/cursor-acp-runner.js.map +1 -1
  98. package/dist/core/host-model-catalog.js +2 -0
  99. package/dist/core/host-model-catalog.js.map +1 -1
  100. package/dist/core/managed-session.js +2 -0
  101. package/dist/core/managed-session.js.map +1 -1
  102. package/dist/core/model-identity.js +2 -0
  103. package/dist/core/model-identity.js.map +1 -1
  104. package/dist/core/model-presets.js +3 -0
  105. package/dist/core/model-presets.js.map +1 -1
  106. package/dist/core/omp-model-catalog.d.ts +43 -0
  107. package/dist/core/omp-model-catalog.js +205 -0
  108. package/dist/core/omp-model-catalog.js.map +1 -0
  109. package/dist/core/omp-runner.d.ts +73 -0
  110. package/dist/core/omp-runner.js +990 -0
  111. package/dist/core/omp-runner.js.map +1 -0
  112. package/dist/core/omp-ui-mapper.d.ts +106 -0
  113. package/dist/core/omp-ui-mapper.js +882 -0
  114. package/dist/core/omp-ui-mapper.js.map +1 -0
  115. package/dist/core/opencode-server-runner.d.ts +18 -4
  116. package/dist/core/opencode-server-runner.js +337 -96
  117. package/dist/core/opencode-server-runner.js.map +1 -1
  118. package/dist/core/opencode-session-error.d.ts +11 -0
  119. package/dist/core/opencode-session-error.js +26 -0
  120. package/dist/core/opencode-session-error.js.map +1 -0
  121. package/dist/core/opencode-ui-mapper.js +4 -36
  122. package/dist/core/opencode-ui-mapper.js.map +1 -1
  123. package/dist/core/pi-runner.d.ts +1 -0
  124. package/dist/core/pi-runner.js +75 -12
  125. package/dist/core/pi-runner.js.map +1 -1
  126. package/dist/core/provider-auth.d.ts +9 -2
  127. package/dist/core/provider-auth.js +43 -6
  128. package/dist/core/provider-auth.js.map +1 -1
  129. package/dist/core/runner-factory.js +3 -0
  130. package/dist/core/runner-factory.js.map +1 -1
  131. package/dist/core/runner-model-catalog.js +1 -0
  132. package/dist/core/runner-model-catalog.js.map +1 -1
  133. package/dist/core/runner-stderr.d.ts +2 -0
  134. package/dist/core/runner-stderr.js +20 -0
  135. package/dist/core/runner-stderr.js.map +1 -0
  136. package/dist/core/session-process.d.ts +22 -0
  137. package/dist/core/session-process.js +202 -0
  138. package/dist/core/session-process.js.map +1 -0
  139. package/dist/core/ui-events.d.ts +1 -1
  140. package/dist/core/usage-limit.js +3 -60
  141. package/dist/core/usage-limit.js.map +1 -1
  142. package/dist/data-gitignore.d.ts +6 -0
  143. package/dist/data-gitignore.js +57 -0
  144. package/dist/data-gitignore.js.map +1 -0
  145. package/dist/delegation/capacity.d.ts +19 -0
  146. package/dist/delegation/capacity.js +34 -0
  147. package/dist/delegation/capacity.js.map +1 -0
  148. package/dist/delegation/cli.js +13 -4
  149. package/dist/delegation/cli.js.map +1 -1
  150. package/dist/delegation/conversations.d.ts +4 -2
  151. package/dist/delegation/conversations.js +8 -12
  152. package/dist/delegation/conversations.js.map +1 -1
  153. package/dist/delegation/credentials.d.ts +2 -0
  154. package/dist/delegation/credentials.js +10 -0
  155. package/dist/delegation/credentials.js.map +1 -1
  156. package/dist/delegation/destroy-observation.d.ts +42 -0
  157. package/dist/delegation/destroy-observation.js +115 -0
  158. package/dist/delegation/destroy-observation.js.map +1 -0
  159. package/dist/delegation/execution-identity.d.ts +6 -0
  160. package/dist/delegation/execution-identity.js +1 -1
  161. package/dist/delegation/execution-identity.js.map +1 -1
  162. package/dist/delegation/policy.d.ts +3 -2
  163. package/dist/delegation/policy.js +7 -5
  164. package/dist/delegation/policy.js.map +1 -1
  165. package/dist/delegation/process-liveness.d.ts +57 -20
  166. package/dist/delegation/process-liveness.js +114 -92
  167. package/dist/delegation/process-liveness.js.map +1 -1
  168. package/dist/delegation/provision.js +6 -6
  169. package/dist/delegation/provision.js.map +1 -1
  170. package/dist/delegation/results.js +4 -2
  171. package/dist/delegation/results.js.map +1 -1
  172. package/dist/delegation/retry-backoff.d.ts +23 -0
  173. package/dist/delegation/retry-backoff.js +18 -0
  174. package/dist/delegation/retry-backoff.js.map +1 -0
  175. package/dist/delegation/routes.d.ts +64 -58
  176. package/dist/delegation/scratch-cleanup.d.ts +29 -0
  177. package/dist/delegation/scratch-cleanup.js +143 -0
  178. package/dist/delegation/scratch-cleanup.js.map +1 -0
  179. package/dist/delegation/service.d.ts +20 -1
  180. package/dist/delegation/service.js +233 -70
  181. package/dist/delegation/service.js.map +1 -1
  182. package/dist/delegation/transport.d.ts +12 -6
  183. package/dist/delegation/workspace.d.ts +23 -4
  184. package/dist/delegation/workspace.js +147 -31
  185. package/dist/delegation/workspace.js.map +1 -1
  186. package/dist/git-worktree-lock-helper.js +8 -3
  187. package/dist/git-worktree-lock-helper.js.map +1 -1
  188. package/dist/git-worktree-lock.d.ts +6 -1
  189. package/dist/git-worktree-lock.js +10 -4
  190. package/dist/git-worktree-lock.js.map +1 -1
  191. package/dist/git-worktree-release.d.ts +20 -0
  192. package/dist/git-worktree-release.js +27 -0
  193. package/dist/git-worktree-release.js.map +1 -0
  194. package/dist/git-worktree.d.ts +8 -2
  195. package/dist/git-worktree.js +19 -2
  196. package/dist/git-worktree.js.map +1 -1
  197. package/dist/handoff.d.ts +2 -2
  198. package/dist/handoff.js +1 -1
  199. package/dist/index.js +109 -76
  200. package/dist/index.js.map +1 -1
  201. package/dist/paths.d.ts +1 -1
  202. package/dist/paths.js +5 -1
  203. package/dist/paths.js.map +1 -1
  204. package/dist/preview/cdp.d.ts +13 -0
  205. package/dist/preview/cdp.js +69 -0
  206. package/dist/preview/cdp.js.map +1 -0
  207. package/dist/preview/chromium.d.ts +75 -0
  208. package/dist/preview/chromium.js +394 -0
  209. package/dist/preview/chromium.js.map +1 -0
  210. package/dist/preview/dev-server.d.ts +68 -0
  211. package/dist/preview/dev-server.js +341 -0
  212. package/dist/preview/dev-server.js.map +1 -0
  213. package/dist/preview/host.d.ts +154 -0
  214. package/dist/preview/host.js +681 -0
  215. package/dist/preview/host.js.map +1 -0
  216. package/dist/preview/registration.d.ts +63 -0
  217. package/dist/preview/registration.js +109 -0
  218. package/dist/preview/registration.js.map +1 -0
  219. package/dist/preview/session.d.ts +73 -0
  220. package/dist/preview/session.js +347 -0
  221. package/dist/preview/session.js.map +1 -0
  222. package/dist/preview/url.d.ts +6 -0
  223. package/dist/preview/url.js +17 -0
  224. package/dist/preview/url.js.map +1 -0
  225. package/dist/runs/agent-tmpdir-removal.d.ts +15 -0
  226. package/dist/runs/agent-tmpdir-removal.js +60 -0
  227. package/dist/runs/agent-tmpdir-removal.js.map +1 -0
  228. package/dist/runs/agent-tmpdir.d.ts +12 -1
  229. package/dist/runs/agent-tmpdir.js +123 -34
  230. package/dist/runs/agent-tmpdir.js.map +1 -1
  231. package/dist/runs/delegation-state.d.ts +5 -1
  232. package/dist/runs/delegation-state.js +9 -0
  233. package/dist/runs/delegation-state.js.map +1 -1
  234. package/dist/runs/event-history.d.ts +4 -4
  235. package/dist/runs/event-history.js +97 -117
  236. package/dist/runs/event-history.js.map +1 -1
  237. package/dist/runs/history-compressor.d.ts +29 -0
  238. package/dist/runs/history-compressor.js +116 -0
  239. package/dist/runs/history-compressor.js.map +1 -0
  240. package/dist/runs/history-file.d.ts +36 -0
  241. package/dist/runs/history-file.js +463 -0
  242. package/dist/runs/history-file.js.map +1 -0
  243. package/dist/runs/human-ask-summary.js +18 -13
  244. package/dist/runs/human-ask-summary.js.map +1 -1
  245. package/dist/runs/legacy-index.d.ts +62 -0
  246. package/dist/runs/legacy-index.js +168 -0
  247. package/dist/runs/legacy-index.js.map +1 -0
  248. package/dist/runs/raw-record.d.ts +52 -0
  249. package/dist/runs/raw-record.js +145 -0
  250. package/dist/runs/raw-record.js.map +1 -0
  251. package/dist/runs/retention.d.ts +13 -6
  252. package/dist/runs/retention.js +42 -13
  253. package/dist/runs/retention.js.map +1 -1
  254. package/dist/runs/run-claims.d.ts +23 -0
  255. package/dist/runs/run-claims.js +24 -0
  256. package/dist/runs/run-claims.js.map +1 -0
  257. package/dist/runs/run-database.d.ts +385 -0
  258. package/dist/runs/run-database.js +930 -0
  259. package/dist/runs/run-database.js.map +1 -0
  260. package/dist/runs/run-index.d.ts +35 -9
  261. package/dist/runs/run-index.js +200 -25
  262. package/dist/runs/run-index.js.map +1 -1
  263. package/dist/runs/run-row.d.ts +44 -0
  264. package/dist/runs/run-row.js +84 -0
  265. package/dist/runs/run-row.js.map +1 -0
  266. package/dist/runs/run-search.d.ts +29 -0
  267. package/dist/runs/run-search.js +63 -0
  268. package/dist/runs/run-search.js.map +1 -0
  269. package/dist/runs/store-open-error.d.ts +24 -0
  270. package/dist/runs/store-open-error.js +61 -0
  271. package/dist/runs/store-open-error.js.map +1 -0
  272. package/dist/runs/store.d.ts +667 -32
  273. package/dist/runs/store.js +2153 -324
  274. package/dist/runs/store.js.map +1 -1
  275. package/dist/runs/transcript-facts.d.ts +77 -0
  276. package/dist/runs/transcript-facts.js +302 -0
  277. package/dist/runs/transcript-facts.js.map +1 -0
  278. package/dist/runs/webhook.js +5 -4
  279. package/dist/runs/webhook.js.map +1 -1
  280. package/dist/runs/worker-execution.d.ts +22 -0
  281. package/dist/runs/worker-execution.js +30 -0
  282. package/dist/runs/worker-execution.js.map +1 -0
  283. package/dist/server/capabilities.d.ts +1 -0
  284. package/dist/server/capabilities.js +2 -0
  285. package/dist/server/capabilities.js.map +1 -1
  286. package/dist/server/cockpit-ownership.d.ts +8 -0
  287. package/dist/server/cockpit-ownership.js +19 -0
  288. package/dist/server/cockpit-ownership.js.map +1 -1
  289. package/dist/server/forge/github.d.ts +1 -4
  290. package/dist/server/forge/github.js +47 -23
  291. package/dist/server/forge/github.js.map +1 -1
  292. package/dist/server/git.js +1 -1
  293. package/dist/server/git.js.map +1 -1
  294. package/dist/server/open-in-app.js +1 -0
  295. package/dist/server/open-in-app.js.map +1 -1
  296. package/dist/server/preview-socket.d.ts +36 -0
  297. package/dist/server/preview-socket.js +126 -0
  298. package/dist/server/preview-socket.js.map +1 -0
  299. package/dist/server/project-context.d.ts +31 -4
  300. package/dist/server/project-context.js +73 -9
  301. package/dist/server/project-context.js.map +1 -1
  302. package/dist/server/provider-action-gate.js +1 -0
  303. package/dist/server/provider-action-gate.js.map +1 -1
  304. package/dist/server/repo-branches.d.ts +4 -3
  305. package/dist/server/repo-branches.js +5 -4
  306. package/dist/server/repo-branches.js.map +1 -1
  307. package/dist/server/server.d.ts +4500 -2727
  308. package/dist/server/server.js +651 -202
  309. package/dist/server/server.js.map +1 -1
  310. package/dist/server/upgrade-router.d.ts +23 -0
  311. package/dist/server/upgrade-router.js +53 -0
  312. package/dist/server/upgrade-router.js.map +1 -0
  313. package/dist/server/validators.d.ts +6 -1
  314. package/dist/server/validators.js +4 -4
  315. package/dist/server/validators.js.map +1 -1
  316. package/dist/server/ws.d.ts +16 -16
  317. package/dist/server/ws.js +56 -54
  318. package/dist/server/ws.js.map +1 -1
  319. package/dist/skills-remote.d.ts +14 -0
  320. package/dist/skills-remote.js +91 -15
  321. package/dist/skills-remote.js.map +1 -1
  322. package/dist/task-cli/cli.js +40 -16
  323. package/dist/task-cli/cli.js.map +1 -1
  324. package/dist/task-cli/discovery.d.ts +4 -3
  325. package/dist/task-cli/discovery.js +4 -3
  326. package/dist/task-cli/discovery.js.map +1 -1
  327. package/dist/task-cli/http.d.ts +2 -0
  328. package/dist/task-cli/http.js +10 -4
  329. package/dist/task-cli/http.js.map +1 -1
  330. package/dist/task-cli/projections.d.ts +5 -2
  331. package/dist/task-cli/projections.js +13 -0
  332. package/dist/task-cli/projections.js.map +1 -1
  333. package/dist/task-cli/watch.d.ts +15 -2
  334. package/dist/task-cli/watch.js +31 -9
  335. package/dist/task-cli/watch.js.map +1 -1
  336. package/dist/ui-state.d.ts +4 -3
  337. package/dist/ui-state.js +8 -3
  338. package/dist/ui-state.js.map +1 -1
  339. package/dist/workflows/grouped-command.d.ts +31 -0
  340. package/dist/workflows/grouped-command.js +143 -0
  341. package/dist/workflows/grouped-command.js.map +1 -0
  342. package/dist/workflows/run.d.ts +223 -42
  343. package/dist/workflows/run.js +1316 -398
  344. package/dist/workflows/run.js.map +1 -1
  345. package/dist/workflows/types.d.ts +12 -0
  346. package/dist/workflows/types.js +20 -0
  347. package/dist/workflows/types.js.map +1 -1
  348. package/dist/workspace/agent-accounts.d.ts +5 -1
  349. package/dist/workspace/agent-accounts.js +1 -0
  350. package/dist/workspace/agent-accounts.js.map +1 -1
  351. package/dist/workspace/agent-profiles.js +1 -1
  352. package/dist/workspace/agent-profiles.js.map +1 -1
  353. package/dist/workspace/config.d.ts +3 -1
  354. package/dist/workspace/config.js +1 -0
  355. package/dist/workspace/config.js.map +1 -1
  356. package/dist/worktree-setup.d.ts +85 -0
  357. package/dist/worktree-setup.js +164 -0
  358. package/dist/worktree-setup.js.map +1 -0
  359. package/package.json +7 -5
  360. package/scripts/benchmark-run-store-fixture.ts +428 -0
  361. package/scripts/benchmark-run-store.ts +743 -0
  362. package/scripts/benchmark-stuck-destroys.ts +143 -0
  363. package/scripts/mock-autonomous.mjs +11 -0
  364. package/scripts/mock-ci-tool.mjs +20 -5
  365. package/scripts/mock-claude.mjs +110 -1
  366. package/scripts/mock-codex-app-server.mjs +117 -2
  367. package/scripts/mock-codex-coalesce-steer.mjs +59 -0
  368. package/scripts/mock-codex-reverse-steer.mjs +130 -0
  369. package/scripts/mock-cursor-acp.mjs +75 -1
  370. package/scripts/mock-omp-rpc.mjs +605 -0
  371. package/scripts/mock-opencode-serve.mjs +312 -22
  372. package/scripts/mock-pi-rpc.mjs +109 -3
  373. package/scripts/mock-runner-crash.mjs +42 -0
  374. package/scripts/mock-silent-tail.mjs +78 -0
  375. package/scripts/mock-turn-messages.mjs +5 -0
  376. package/scripts/omp-ci-wait.mjs +29 -0
  377. package/scripts/omp-restrict-delegation.yml +4 -0
  378. package/scripts/pi-ci-wait.mjs +12 -9
  379. package/scripts/seed-archive-profile.ts +3 -3
  380. package/web/dist/assets/agent-accounts-CFOBMVHc.js +1 -0
  381. package/web/dist/assets/alert-dialog-BrpNUwMt.js +1 -0
  382. package/web/dist/assets/app-window-CSHwDX9N.js +1 -0
  383. package/web/dist/assets/button-C_rd7CPp.js +43 -0
  384. package/web/dist/assets/compare-variants-D6WXhvXA.js +1 -0
  385. package/web/dist/assets/diff-DrEARXTV.js +3 -0
  386. package/web/dist/assets/diff-controls-B1-j7nFg.js +1 -0
  387. package/web/dist/assets/{diff-view-DPn6bQ5W.js → diff-view-DvGLjdTk.js} +3 -3
  388. package/web/dist/assets/dropdown-menu-BegOZFrj.js +1 -0
  389. package/web/dist/assets/format-DpNe3S0A.js +1 -0
  390. package/web/dist/assets/git-toolbar-Cw4ljmhB.js +1 -0
  391. package/web/dist/assets/github-CfV5sqL0.js +1 -0
  392. package/web/dist/assets/{image-preview-DJ8cgb1Z.js → image-preview-FOEfqpZP.js} +1 -1
  393. package/web/dist/assets/index-DgWWlOLy.js +13 -0
  394. package/web/dist/assets/index-fBFnuvxu.css +1 -0
  395. package/web/dist/assets/{nav-row-styles-3j64kH5s.js → nav-row-styles-vp2JbhuJ.js} +1 -1
  396. package/web/dist/assets/play-CmVAj_fu.js +1 -0
  397. package/web/dist/assets/popover-BohP6WTx.js +1 -0
  398. package/web/dist/assets/preview-pane-connected-qTA5KNoJ.js +3 -0
  399. package/web/dist/assets/preview-state-vuMviq6q.js +1 -0
  400. package/web/dist/assets/prompt-templates-Cubdut_C.js +15 -0
  401. package/web/dist/assets/repo-git-Cf4t5PD0.js +1 -0
  402. package/web/dist/assets/{run-diff-5-RRdcVz.js → run-diff-BpkUW37Z.js} +3 -3
  403. package/web/dist/assets/run-header-68WHf9wV.js +1 -0
  404. package/web/dist/assets/skills-DiVIgKeU.js +1 -0
  405. package/web/dist/assets/square-terminal-B6RYYieR.js +1 -0
  406. package/web/dist/assets/status-dot-CqTJHSP9.js +1 -0
  407. package/web/dist/assets/{tab-link-K0hjzEXR.js → tab-link-B07Hu4QX.js} +1 -1
  408. package/web/dist/assets/task-changes--lQF6EYf.js +1 -0
  409. package/web/dist/assets/task-commits-Cx0qy4DN.js +1 -0
  410. package/web/dist/assets/task-files-D50s-gKW.js +2 -0
  411. package/web/dist/assets/task-github-item-DaqmSwYT.js +1 -0
  412. package/web/dist/assets/task-thread-BPQ64lui.js +7 -0
  413. package/web/dist/assets/{task-thread-Bw_nQuTx.css → task-thread-zNE2Q9E-.css} +1 -1
  414. package/web/dist/assets/textarea-D20O4Pw0.js +1 -0
  415. package/web/dist/assets/thread-state-DWcFMrvb.js +4 -0
  416. package/web/dist/assets/use-hand-to-agent-state-BLIGmwbd.css +1 -0
  417. package/web/dist/assets/use-hand-to-agent-state-Cy9eyyfL.js +1 -0
  418. package/web/dist/assets/{utils-fzNfbPzA.js → utils-JsL3ZsJf.js} +1 -1
  419. package/web/dist/assets/workflows-jwG7uxqi.js +11 -0
  420. package/web/dist/assets/{zoomable-image-CDmZ_Rtl.js → zoomable-image-BJJ64KGc.js} +1 -1
  421. package/web/dist/cezarion-lockup-dark.svg +1 -13
  422. package/web/dist/cezarion-lockup-light.svg +1 -13
  423. package/web/dist/cezarion-mark-dark.svg +1 -12
  424. package/web/dist/cezarion-mark-light.svg +1 -12
  425. package/web/dist/index.html +16 -21
  426. package/web/dist/assets/agent-accounts-CU2ZDv24.js +0 -1
  427. package/web/dist/assets/alert-dialog-C-xYE_dg.js +0 -43
  428. package/web/dist/assets/chevron-right-BENZ-1ZN.js +0 -1
  429. package/web/dist/assets/collapsible-DD9J91Iv.js +0 -1
  430. package/web/dist/assets/compare-variants-5FmqpFSN.js +0 -1
  431. package/web/dist/assets/diff-controls-Bj0YrioE.js +0 -1
  432. package/web/dist/assets/diff-rE8rm75J2.js +0 -3
  433. package/web/dist/assets/diff-stat-BKDCSVfJ.js +0 -1
  434. package/web/dist/assets/dropdown-menu-Ch5BYQh_.js +0 -1
  435. package/web/dist/assets/format-dBiNDNVe.js +0 -1
  436. package/web/dist/assets/git-toolbar-ClVvf5iF.js +0 -1
  437. package/web/dist/assets/github-BkNOyour.css +0 -1
  438. package/web/dist/assets/github-DeZMeMwJ.js +0 -1
  439. package/web/dist/assets/github-item-detail-W5F6GVjF.js +0 -1
  440. package/web/dist/assets/github-sidebar-model-DcMu-IK2.js +0 -1
  441. package/web/dist/assets/highlighter-CdHqIwFr.js +0 -3
  442. package/web/dist/assets/index-CatemBEL.js +0 -8
  443. package/web/dist/assets/index-MvfD8bZJ.css +0 -1
  444. package/web/dist/assets/markdown-zdKeLIYA.js +0 -2
  445. package/web/dist/assets/mobile-run-bar-BCfmFi8V.js +0 -1
  446. package/web/dist/assets/prompt-templates-CBPp39IU.js +0 -15
  447. package/web/dist/assets/reference-chip-D6owncJT.js +0 -1
  448. package/web/dist/assets/repo-git-CtdkZFey.js +0 -1
  449. package/web/dist/assets/run-header-BcjoDi0W.js +0 -1
  450. package/web/dist/assets/sheet-ChnYVrp1.js +0 -1
  451. package/web/dist/assets/skills-C8YKp2vr.js +0 -1
  452. package/web/dist/assets/task-changes-BW8YdWG8.js +0 -1
  453. package/web/dist/assets/task-commits-q2kB2y6L.js +0 -1
  454. package/web/dist/assets/task-files-pPL6_3Cr.js +0 -2
  455. package/web/dist/assets/task-github-item-BXF5R52U.js +0 -1
  456. package/web/dist/assets/task-thread-DtkFL3EC.js +0 -10
  457. package/web/dist/assets/textarea-DxlkE-Yd.js +0 -1
  458. package/web/dist/assets/token-metrics-DIAjrPlM.js +0 -1
  459. package/web/dist/assets/use-desktop-CrDny2uG.js +0 -1
  460. package/web/dist/assets/use-submit-shortcut-KWJsC906.js +0 -1
  461. package/web/dist/assets/workflows-TmcPEj2K.js +0 -11
  462. /package/web/dist/assets/{lib-BQXq3kEf2.js → lib-BQXq3kEf.js} +0 -0
@@ -0,0 +1,3 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Si as r,t as i}from"./button-C_rd7CPp.js";import{M as a,t as o}from"./utils-JsL3ZsJf.js";import{a as s,c,n as l,o as u,s as d}from"./thread-state-DWcFMrvb.js";import{t as f}from"./createLucideIcon-BHp8sXmF.js";import{t as p}from"./status-dot-CqTJHSP9.js";import{a as m,i as h,l as g,n as _,r as v,u as y}from"./preview-state-vuMviq6q.js";import{t as b}from"./info-DA1x_4bz.js";import{f as x,l as ee}from"./format-DpNe3S0A.js";import{t as S}from"./play-CmVAj_fu.js";import{t as C}from"./square-terminal-B6RYYieR.js";import{a as te,i as w,l as T,p as ne,r as re,t as ie}from"./dropdown-menu-BegOZFrj.js";import{$t as E,G as D,K as O,W as k,Yt as A,bt as ae,cn as oe,en as se,in as j,on as ce,q as M,rn as le,sn as ue,tn as de,xt as fe,yt as pe}from"./index-DgWWlOLy.js";var me=f(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),he=f(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),N=f(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),P=f(`circle-stop`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`rect`,{x:`9`,y:`9`,width:`6`,height:`6`,rx:`1`,key:`1ssd4o`}]]),F=f(`circle-x`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),I=f(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),L=f(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),R=f(`flask-conical`,[[`path`,{d:`M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2`,key:`18mbvz`}],[`path`,{d:`M6.453 15h11.094`,key:`3shlmq`}],[`path`,{d:`M8.5 2h7`,key:`csnxdl`}]]),z=f(`folder-x`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}],[`path`,{d:`m9.5 10.5 5 5`,key:`ra9qjz`}],[`path`,{d:`m14.5 10.5-5 5`,key:`l2rkpq`}]]),B=f(`hourglass`,[[`path`,{d:`M5 22h14`,key:`ehvnwv`}],[`path`,{d:`M5 2h14`,key:`pdyrp9`}],[`path`,{d:`M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22`,key:`1d314k`}],[`path`,{d:`M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2`,key:`1vvvr6`}]]),V=f(`link-2`,[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]),H=f(`lock`,[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]),U=f(`maximize`,[[`path`,{d:`M8 3H5a2 2 0 0 0-2 2v3`,key:`1dcmit`}],[`path`,{d:`M21 8V5a2 2 0 0 0-2-2h-3`,key:`1e4gt3`}],[`path`,{d:`M3 16v3a2 2 0 0 0 2 2h3`,key:`wsl5sc`}],[`path`,{d:`M16 21h3a2 2 0 0 0 2-2v-3`,key:`18trek`}]]),ge=f(`monitor-smartphone`,[[`path`,{d:`M18 8V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h8`,key:`10dyio`}],[`path`,{d:`M10 19v-3.96 3.15`,key:`1irgej`}],[`path`,{d:`M7 19h5`,key:`qswx4l`}],[`rect`,{width:`6`,height:`10`,x:`16`,y:`12`,rx:`2`,key:`1egngj`}]]),_e=f(`plug`,[[`path`,{d:`M12 22v-5`,key:`1ega77`}],[`path`,{d:`M15 8V2`,key:`18g5xt`}],[`path`,{d:`M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z`,key:`1xoxul`}],[`path`,{d:`M9 8V2`,key:`14iosj`}]]),ve=f(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),ye=f(`rotate-cw`,[[`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`,key:`1p45f6`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}]]),be=f(`shield-alert`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]),xe=f(`tablet`,[[`rect`,{width:`16`,height:`20`,x:`4`,y:`2`,rx:`2`,ry:`2`,key:`76otgf`}],[`line`,{x1:`12`,x2:`12.01`,y1:`18`,y2:`18`,key:`1dp563`}]]),Se=f(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),Ce=f(`unplug`,[[`path`,{d:`m19 5 3-3`,key:`yk6iyv`}],[`path`,{d:`m2 22 3-3`,key:`19mgm9`}],[`path`,{d:`M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z`,key:`goz73y`}],[`path`,{d:`M7.5 13.5 10 11`,key:`7xgeeb`}],[`path`,{d:`M10.5 16.5 13 14`,key:`10btkg`}],[`path`,{d:`m12 6 6 6 2.3-2.3a2.4 2.4 0 0 0 0-3.4l-2.6-2.6a2.4 2.4 0 0 0-3.4 0Z`,key:`1snsnr`}]]),we=f(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),W=e(t(),1),G=1e3,K=[500,1e3,2e3,4e3,8e3],Te=1;function Ee(e,t){let n=`/api/v1/p/${encodeURIComponent(e.projectId)}/runs/${encodeURIComponent(e.runId)}/preview/ws`,r=()=>`${location.protocol===`https:`?`wss:`:`ws:`}//${location.host}${n}`,i=null,o,s=!1,c=!1,l=0,u=0,d=()=>{let e=globalThis.WebSocket;if(typeof e!=`function`)return;let n=new e(r());n.binaryType=`blob`,i=n,n.addEventListener(`open`,()=>{n===i&&(c=!0,t.onTransport(`open`))}),n.addEventListener(`message`,e=>{if(n!==i)return;let r=e.data;if(typeof r==`string`){let e;try{e=JSON.parse(r)}catch{return}let n=a.safeParse(e);n.success&&t.onMessage(n.data);return}r instanceof Blob&&(u=0,t.onFrame(r))}),n.addEventListener(`error`,()=>void 0),n.addEventListener(`close`,()=>{if(n!==i||s)return;if(i=null,!c){if(l+=1,l>=2){s=!0,t.onTransport(`blocked`);return}t.onTransport(`reconnecting`,l),o=setTimeout(d,G);return}if(u>=5){s=!0,t.onTransport(`closed`);return}let e=K[Math.min(u,K.length-1)];u+=1,t.onTransport(`reconnecting`,u),o=setTimeout(d,e)})};return t.onTransport(`connecting`),d(),{send(e){i?.readyState===Te&&i.send(JSON.stringify(e))},close(){s=!0,clearTimeout(o),o=void 0;let e=i;i=null,e?.close()}}}var q=n();function De({iconOnly:e=!1,responsive:t=!1,className:n}){return t?(0,q.jsx)(O,{children:(0,q.jsxs)(k,{children:[(0,q.jsx)(M,{asChild:!0,children:(0,q.jsxs)(`span`,{role:`img`,"aria-label":`Experimental`,tabIndex:0,"data-slot":`preview-experimental`,className:o(`inline-flex h-7 min-w-7 shrink-0 items-center justify-center gap-0 rounded-full bg-muted px-0 text-xs font-semibold text-muted-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none @min-[640px]:gap-1.5 @min-[640px]:px-2.5`,n),children:[(0,q.jsx)(R,{className:`size-3.5`,"aria-hidden":`true`}),(0,q.jsx)(`span`,{className:`hidden @min-[640px]:inline`,children:`Experimental`})]})}),(0,q.jsx)(D,{children:`Experimental`})]})}):e?(0,q.jsx)(O,{children:(0,q.jsxs)(k,{children:[(0,q.jsx)(M,{asChild:!0,children:(0,q.jsx)(`span`,{role:`img`,"aria-label":`Experimental`,tabIndex:0,"data-slot":`preview-experimental`,className:o(`inline-flex size-7 shrink-0 items-center justify-center rounded-full bg-muted text-muted-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,n),children:(0,q.jsx)(R,{className:`size-3.5`,"aria-hidden":`true`})})}),(0,q.jsx)(D,{children:`Experimental`})]})}):(0,q.jsxs)(`span`,{"data-slot":`preview-experimental`,className:o(`inline-flex h-7 shrink-0 items-center gap-1.5 rounded-full bg-muted px-2.5 text-xs font-semibold text-muted-foreground`,n),children:[(0,q.jsx)(R,{className:`size-3.5`,"aria-hidden":`true`}),`Experimental`]})}function J({text:e,source:t,onCopy:n,className:r}){let i=e.replace(/\s+$/,``).split(`
2
+ `);return(0,q.jsxs)(`div`,{"data-slot":`preview-log-tail`,className:o(`min-w-0 rounded-lg bg-muted px-3.5 py-3 font-mono text-xs`,r),children:[(0,q.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-3 font-sans text-xs text-soft-foreground`,children:[(0,q.jsxs)(`span`,{className:`min-w-0 truncate`,children:[(0,q.jsx)(`span`,{className:`font-semibold tracking-wide uppercase`,children:`Log tail`}),` last ${i.length} ${i.length===1?`line`:`lines`} · ${t}`]}),(0,q.jsxs)(`button`,{type:`button`,className:`-m-2 inline-flex min-h-11 items-center gap-1.5 rounded-sm p-2 text-muted-foreground hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none md:m-0 md:min-h-0 md:p-0`,onClick:()=>n(e),children:[(0,q.jsx)(j,{className:`size-3.5`,"aria-hidden":`true`}),`Copy`]})]}),(0,q.jsx)(`pre`,{className:`max-h-48 overflow-auto break-words whitespace-pre-wrap text-foreground`,children:e.replace(/\s+$/,``)})]})}var Oe=/^([a-z][a-z0-9+.-]*):/i;function ke(e,t){let n=e.trim();if(n===``)return{kind:`error`,message:`Type a URL or a port.`};if(/^\d{1,5}$/.test(n)){let e=Number(n);return e<1||e>65535?{kind:`error`,message:`A port is a number from 1 to 65535.`}:t.some(t=>t.port===e)?{kind:`server`,port:e}:{kind:`url`,url:`http://localhost:${e}`}}let r=Oe.exec(n)?.[1]?.toLowerCase();return r&&!/^[a-z0-9.-]+:\d/i.test(n)?r!==`http`&&r!==`https`?{kind:`error`,message:`Only http and https addresses open here.`}:Ae(n):Ae(`http://${n}`)}function Ae(e){let t={kind:`error`,message:`That is not a valid address.`};if(/\s/.test(e))return t;try{new URL(e)}catch{return t}return{kind:`url`,url:e}}function je(e){return e.replace(/^https?:\/\//i,``)}var Me=`https://github.com/hearsay-tools/cezarion#environment-variables`;function Ne({state:e,actions:t,url:n,worktree:r}){switch(e.stage){case`chromium-missing`:return(0,q.jsx)(Le,{state:e,actions:t});case`downloading`:return(0,q.jsx)(ze,{state:e,actions:t});case`download-failed`:return(0,q.jsx)(Be,{state:e,actions:t});case`sandbox-failed`:return(0,q.jsx)(Ve,{state:e,actions:t});case`browser-exited`:return(0,q.jsx)(He,{state:e,actions:t});case`needs-approval`:return(0,q.jsx)(Ge,{state:e,actions:t});case`port-held`:return(0,q.jsx)(Ke,{state:e,actions:t});case`server-starting`:return(0,q.jsx)(qe,{state:e,actions:t});case`server-stalled`:return(0,q.jsx)(Je,{state:e,actions:t});case`server-exited`:return(0,q.jsx)(Ye,{state:e,actions:t});case`server-stopped`:return(0,q.jsx)(Xe,{state:e,actions:t});case`loading`:return(0,q.jsx)(Qe,{step:e.step,url:n});case`worktree-removed`:return(0,q.jsx)($e,{state:e,actions:t,worktree:r});case`proxy-blocked`:return(0,q.jsx)(et,{actions:t});case`taken-over`:return(0,q.jsx)(nt,{state:e,actions:t})}}function Y({icon:e,title:t,children:n,state:r}){return(0,q.jsxs)(`div`,{"data-slot":`preview-state`,"data-state":r,className:`mx-auto flex h-full w-full max-w-[560px] flex-col justify-center gap-4 px-6 py-8`,children:[(0,q.jsx)(`div`,{"aria-hidden":`true`,className:`flex size-9 items-center justify-center rounded-lg bg-muted text-foreground [&_svg]:size-[18px]`,children:e}),(0,q.jsx)(`h2`,{className:`text-xl leading-tight font-semibold text-foreground`,children:t}),n]})}var X=({children:e})=>(0,q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e}),Z=({children:e})=>(0,q.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:e});function Pe({server:e}){return(0,q.jsxs)(`p`,{className:`flex items-start gap-2 text-xs text-muted-foreground`,children:[(0,q.jsx)(C,{className:`mt-px size-3.5 shrink-0`,"aria-hidden":`true`}),(0,q.jsx)(`span`,{children:`Runs ${h(e.command)} in this task's worktree, on the host.`})]})}function Fe({copy:e,command:t,label:n}){return(0,q.jsxs)(`div`,{"data-slot":`preview-install-command`,className:`min-w-0 rounded-lg bg-muted px-3.5 py-3`,children:[(0,q.jsxs)(`div`,{className:`mb-1.5 flex items-center justify-between gap-3 text-xs font-semibold tracking-wide text-soft-foreground uppercase`,children:[(0,q.jsx)(`span`,{children:n}),(0,q.jsx)(`button`,{type:`button`,"aria-label":`Copy command`,className:`-m-2 inline-flex size-11 items-center justify-center rounded-sm text-muted-foreground hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none md:m-0 md:size-6`,onClick:()=>e(t),children:(0,q.jsx)(j,{className:`size-4`,"aria-hidden":`true`})})]}),(0,q.jsx)(`code`,{className:`block font-mono text-sm break-words whitespace-pre-wrap text-foreground`,children:t})]})}function Ie({server:e,status:t}){return(0,q.jsxs)(`div`,{className:`min-w-0 rounded-lg border border-border bg-card px-3.5 py-3 text-sm`,children:[(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2.5 gap-y-1`,children:[(0,q.jsx)(p,{tone:`neutral`,shape:`ring`,"aria-hidden":`true`}),(0,q.jsx)(`span`,{className:`font-semibold text-foreground`,children:e.label}),(0,q.jsxs)(`span`,{className:`font-mono text-muted-foreground`,children:[`:`,e.port]}),(0,q.jsx)(`span`,{className:`text-muted-foreground`,children:t})]}),(0,q.jsxs)(`div`,{className:`mt-2.5 min-w-0 rounded-md bg-muted px-3 py-2 font-mono text-xs`,children:[(0,q.jsx)(`p`,{className:`break-words whitespace-pre-wrap text-foreground`,children:e.command}),e.cwd?(0,q.jsxs)(`p`,{className:`mt-1 flex gap-3 text-soft-foreground`,children:[(0,q.jsx)(`span`,{children:`cwd`}),(0,q.jsx)(`span`,{className:`break-all`,children:e.cwd})]}):null]}),(0,q.jsx)(`div`,{className:`mt-2.5`,children:(0,q.jsx)(Pe,{server:e})})]})}function Le({state:e,actions:t}){return(0,q.jsxs)(Y,{state:e.stage,icon:(0,q.jsx)(L,{}),title:`This host has no browser yet`,children:[(0,q.jsx)(X,{children:e.canDownload?`Preview runs Chromium on the machine cezar runs on. cezar can download it into ~/.cache/cez/ (about 150 MB). Nothing else on the host changes.`:`Preview runs Chromium on the machine cezar runs on. cezar has no download for this platform, so install it with the system package manager.`}),e.canDownload?(0,q.jsx)(Z,{children:(0,q.jsxs)(i,{variant:`contrast`,onClick:t.download,children:[(0,q.jsx)(L,{"aria-hidden":`true`}),`Download Chromium`]})}):null,(0,q.jsx)(Fe,{command:e.installCommand,copy:t.copy,label:e.canDownload?`Or install it yourself`:`Install it yourself`})]})}function Re(e){return Math.round(e/1e6)}function ze({state:e,actions:t}){let n=(0,W.useRef)(null);n.current??={at:Date.now(),received:e.received};let r=e.total>0?Math.min(100,Math.floor(e.received/e.total*100)):0,a=(Date.now()-n.current.at)/1e3,o=a>=1?(e.received-n.current.received)/a:0,s=o>0?Math.ceil((e.total-e.received)/o):void 0;return(0,q.jsxs)(Y,{state:e.stage,icon:(0,q.jsx)(L,{}),title:`Downloading Chromium`,children:[(0,q.jsx)(X,{children:`Into ~/.cache/cez/, no root needed. Nothing else on the host changes.`}),(0,q.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,q.jsx)(`div`,{role:`progressbar`,"aria-label":`Chromium download`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":r,className:`h-1.5 overflow-hidden rounded-full bg-muted`,children:(0,q.jsx)(`div`,{className:`h-full rounded-full bg-success`,style:{width:`${r}%`}})}),(0,q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 text-xs text-muted-foreground`,children:[(0,q.jsx)(`span`,{className:`font-mono`,children:`${Re(e.received)} of ${Re(e.total)} MB · ${r}%`}),s===void 0?null:(0,q.jsx)(`span`,{children:`about ${s} s left`})]})]}),(0,q.jsx)(Z,{children:(0,q.jsx)(i,{variant:`outline`,onClick:t.cancelDownload,children:`Cancel`})})]})}function Be({state:e,actions:t}){return(0,q.jsxs)(Y,{state:e.stage,icon:(0,q.jsx)(Se,{className:`text-danger`}),title:`Couldn't download Chromium`,children:[(0,q.jsx)(X,{children:`${e.error.replace(/\.$/,``)}. Install Chromium with the system package manager, then retry.`}),(0,q.jsx)(Fe,{command:e.installCommand,copy:t.copy,label:`Install it yourself`}),(0,q.jsxs)(Z,{children:[(0,q.jsxs)(i,{variant:`contrast`,onClick:t.download,children:[(0,q.jsx)(c,{"aria-hidden":`true`}),`Retry download`]}),(0,q.jsxs)(i,{variant:`outline`,onClick:()=>t.copy(`Chromium download failed\n${e.error}\nInstall: ${e.installCommand}`),children:[(0,q.jsx)(j,{"aria-hidden":`true`}),`Copy diagnostics`]})]})]})}function Ve({state:e,actions:t}){return(0,q.jsxs)(Y,{state:e.stage,icon:(0,q.jsx)(be,{className:`text-danger`}),title:`Chromium couldn't start its sandbox`,children:[(0,q.jsx)(X,{children:`The host blocks the sandbox Chromium needs. This usually means cezar runs as root, or inside a container without user namespaces.`}),(0,q.jsx)(J,{text:e.stderrTail,source:`chromium`,onCopy:t.copy}),(0,q.jsxs)(Z,{children:[(0,q.jsxs)(i,{variant:`contrast`,onClick:t.retryBrowser,children:[(0,q.jsx)(c,{"aria-hidden":`true`}),`Retry`]}),(0,q.jsxs)(i,{variant:`outline`,onClick:()=>t.copy(`Chromium failed to start its sandbox\n${e.stderrTail}`),children:[(0,q.jsx)(j,{"aria-hidden":`true`}),`Copy diagnostics`]})]}),(0,q.jsx)(`a`,{className:`text-sm font-medium text-accent-text underline-offset-2 hover:underline`,href:Me,target:`_blank`,rel:`noopener noreferrer`,children:`Docs: running without the sandbox (CEZ_PREVIEW_NO_SANDBOX=1)`})]})}function He({state:e,actions:t}){return(0,q.jsxs)(Y,{state:e.stage,icon:(0,q.jsx)(F,{className:`text-danger`}),title:`The browser stopped`,children:[(0,q.jsx)(X,{children:`Chromium exited unexpectedly${e.signal?` (${e.signal})`:``}. ${e.serverUp?`The dev server is still up; only the browser needs a restart.`:`The browser needs a restart.`}`}),(0,q.jsx)(J,{text:e.stderrTail,source:`chromium`,onCopy:t.copy}),(0,q.jsxs)(Z,{children:[(0,q.jsxs)(i,{variant:`contrast`,onClick:t.retryBrowser,children:[(0,q.jsx)(c,{"aria-hidden":`true`}),`Retry`]}),(0,q.jsxs)(i,{variant:`outline`,onClick:()=>t.copy(`Chromium exited${e.signal?` (${e.signal})`:``}\n${e.stderrTail}`),children:[(0,q.jsx)(j,{"aria-hidden":`true`}),`Copy diagnostics`]})]})]})}var Ue=2;function We(e){let[t,n]=(0,W.useState)(()=>Date.now());return(0,W.useEffect)(()=>{let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}function Ge({state:e,actions:t}){let{server:n,wasRunning:r}=e;return(0,q.jsxs)(Y,{state:e.stage,icon:r?(0,q.jsx)(Ce,{className:`text-pending-strong`}):(0,q.jsx)(S,{}),title:r?`Nothing answers on :${n.port} anymore`:`${n.label} isn't running yet`,children:[(0,q.jsx)(X,{children:r?`${n.label} was running when the agent registered it, likely inside the agent's own session, which has ended. cezar can start it with the registered command.`:`The agent registered this server. Nothing runs until you approve it here.`}),(0,q.jsx)(Ie,{server:n,status:r?`was running when registered · silent now`:`registered · not started`}),(0,q.jsx)(Z,{children:(0,q.jsxs)(i,{variant:`contrast`,onClick:()=>t.run(n.port),children:[(0,q.jsx)(S,{"aria-hidden":`true`}),`Run and open`]})})]})}function Ke({state:e,actions:t}){let{server:n,ownerTitle:r}=e;return(0,q.jsxs)(Y,{state:e.stage,icon:(0,q.jsx)(Se,{className:`text-pending-strong`}),title:`${n.label} :${n.port} is in use by another task`,children:[(0,q.jsx)(X,{children:`Task "${r}" is running its own server on :${n.port}. Register a different port for this task, or stop that task's server.`}),(0,q.jsx)(Z,{children:(0,q.jsx)(i,{variant:`contrast`,onClick:t.close,children:`Close preview`})})]})}function qe({state:e,actions:t}){let{server:n}=e,r=We(1e3),a=Math.max(0,Math.floor((r-Date.parse(e.startedAt))/1e3)),[o,s]=(0,W.useState)(()=>Date.now());(0,W.useEffect)(()=>s(Date.now()),[e.attempt]);let c=Math.max(0,Math.ceil(Ue-(r-o)/1e3));return(0,q.jsxs)(Y,{state:e.stage,icon:(0,q.jsx)(S,{}),title:`Starting ${n.label}`,children:[(0,q.jsx)(X,{children:`cezar ran ${h(n.command)} in the worktree. The page opens as soon as :${n.port} answers.`}),(0,q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-lg border border-border px-3.5 py-3 text-sm`,children:[(0,q.jsxs)(`span`,{className:`flex items-center gap-2.5 font-semibold text-foreground`,children:[(0,q.jsx)(x,{className:`size-4 animate-spin text-success motion-reduce:animate-none`,"aria-hidden":`true`}),c>0?`Attempt ${e.attempt} · next try in ${c} s`:`Attempt ${e.attempt}`]}),(0,q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`started ${a} s ago`})]}),e.logTail.length>0?(0,q.jsx)(J,{text:e.logTail.join(`
3
+ `),source:h(n.command),onCopy:t.copy}):null,(0,q.jsx)(Z,{children:(0,q.jsx)(i,{variant:`outline`,onClick:()=>t.stop(n.port),children:`Stop server`})})]})}function Je({state:e,actions:t}){let{server:n}=e;return(0,q.jsxs)(Y,{state:e.stage,icon:(0,q.jsx)(B,{className:`text-pending-strong`}),title:`${n.label} is running, but :${n.port} is silent`,children:[(0,q.jsx)(X,{children:`The process has run for 2 min without opening the port. It may be waiting on another service, or listening somewhere else.`}),(0,q.jsx)(J,{text:e.logTail,source:h(n.command),onCopy:t.copy}),(0,q.jsxs)(Z,{children:[(0,q.jsx)(i,{variant:`contrast`,onClick:()=>t.keepWaiting(n.port),children:`Keep waiting`}),(0,q.jsx)(i,{variant:`outline`,onClick:()=>t.stop(n.port),children:`Stop server`})]})]})}function Ye({state:e,actions:t}){let{server:n}=e;return(0,q.jsxs)(Y,{state:e.stage,icon:(0,q.jsx)(F,{className:`text-danger`}),title:e.exitCode===null?`${n.label} was stopped by a signal`:`${n.label} exited with code ${e.exitCode}`,children:[(0,q.jsx)(X,{children:`${h(n.command)} stopped.`}),(0,q.jsx)(J,{text:e.logTail,source:h(n.command),onCopy:t.copy}),(0,q.jsx)(Z,{children:(0,q.jsxs)(i,{variant:`contrast`,onClick:()=>t.run(n.port),children:[(0,q.jsx)(c,{"aria-hidden":`true`}),`Start again`]})}),(0,q.jsx)(Pe,{server:n})]})}function Xe({state:e,actions:t}){let{server:n}=e,r=e.reason===`idle`;return(0,q.jsxs)(Y,{state:e.stage,icon:(0,q.jsx)(E,{}),title:r?`Stopped after 15 min idle`:`${n.label} stopped`,children:[(0,q.jsx)(X,{children:r?`Nobody had this pane open for 15 min, so cezar stopped ${n.label} :${n.port} and the browser to free memory. Start again reopens ${je(e.lastUrl)}.`:`You stopped ${n.label} :${n.port}. Start again reopens ${je(e.lastUrl)}.`}),(0,q.jsx)(Z,{children:(0,q.jsxs)(i,{variant:`contrast`,onClick:()=>t.run(n.port),children:[(0,q.jsx)(c,{"aria-hidden":`true`}),`Start again`]})}),(0,q.jsx)(Pe,{server:n})]})}var Ze=[`browser`,`page`,`frame`];function Qe({step:e,url:t}){let n=Ze.indexOf(e),r=t?je(t):`the page`;return(0,q.jsx)(`div`,{"data-slot":`preview-state`,"data-state":`loading`,className:`mx-auto flex h-full w-full max-w-[560px] flex-col justify-center px-6 py-8`,children:(0,q.jsx)(`ol`,{"aria-label":`Opening the page`,className:`mx-auto flex flex-col gap-4 text-sm`,children:[{done:`Browser started`,active:`Starting the browser`},{done:`Opened ${r}`,active:`Opening ${r}`},{done:`First frame`,active:`First frame`}].map((e,t)=>{let r=t<n,i=t===n;return(0,q.jsxs)(`li`,{"aria-current":i?`step`:void 0,className:o(`flex items-center gap-3`,i?`font-semibold text-foreground`:r?`text-foreground`:`text-soft-foreground`),children:[r?(0,q.jsx)(N,{className:`size-5 text-success`,"aria-hidden":`true`}):i?(0,q.jsx)(x,{className:`size-5 animate-spin text-success motion-reduce:animate-none`,"aria-hidden":`true`}):(0,q.jsx)(I,{className:`size-5 text-border`,"aria-hidden":`true`}),r?e.done:i?e.active:e.done]},t)})})})}function $e({state:e,actions:t,worktree:n}){let r=n?/\.ai\/cezar\/worktrees\/[^/]+/.exec(n)?.[0]:void 0,a=e.server?.label;return(0,q.jsxs)(Y,{state:e.stage,icon:(0,q.jsx)(z,{}),title:`This task's worktree is gone`,children:[(0,q.jsx)(X,{children:`${a??`The server`} ran in ${r??`this task's worktree`}, which has been removed. There is nothing left to start.`}),e.server?(0,q.jsx)(u,{entry:{kind:`preview-server`,id:`preview-server:${e.server.port}`,server:e.server,state:`unavailable`},inPreview:!1}):null,(0,q.jsx)(Z,{children:(0,q.jsx)(i,{variant:`outline`,onClick:t.close,children:`Close preview`})})]})}function et({actions:e}){return(0,q.jsxs)(`div`,{"data-slot":`preview-state`,"data-state":`proxy-blocked`,className:`mx-auto flex h-full w-full max-w-[560px] flex-col justify-center gap-4 px-6 py-8`,children:[(0,q.jsx)(`div`,{children:(0,q.jsx)(De,{})}),(0,q.jsx)(`div`,{"aria-hidden":`true`,className:`flex size-9 items-center justify-center rounded-lg bg-muted text-foreground [&_svg]:size-[18px]`,children:(0,q.jsx)(_e,{})}),(0,q.jsx)(`h2`,{className:`text-xl leading-tight font-semibold text-foreground`,children:`Preview doesn't work behind this proxy yet`}),(0,q.jsx)(X,{children:`The proxy in front of cezar didn't let the preview's WebSocket through. This is a known gap behind Basic Auth. Everything else in cezar keeps working.`}),(0,q.jsxs)(Z,{children:[(0,q.jsx)(i,{variant:`outline`,onClick:e.close,children:`Close preview`}),(0,q.jsx)(`a`,{className:`inline-flex min-h-11 items-center text-sm font-medium text-accent-text underline-offset-2 hover:underline`,href:Me,target:`_blank`,rel:`noopener noreferrer`,children:`Which setups work`})]})]})}function tt(e){let t=/iPhone/.test(e)?`iPhone`:/iPad/.test(e)?`iPad`:/Android/.test(e)?`Android`:/Windows/.test(e)?`Windows`:/Mac OS X|Macintosh/.test(e)?`Mac`:/Linux|X11/.test(e)?`Linux`:``,n=/Edg\//.test(e)?`Edge`:/Firefox\/|FxiOS/.test(e)?`Firefox`:/Chrome\/|CriOS/.test(e)?`Chrome`:/Safari\//.test(e)?`Safari`:``;return n&&t?`${n} on ${t}`:n||t}function nt({state:e,actions:t}){let n=tt(e.by);return(0,q.jsxs)(Y,{state:e.stage,icon:(0,q.jsx)(ge,{}),title:`Preview is open somewhere else`,children:[(0,q.jsx)(X,{children:`Another tab took this browser${n?` (${n})`:``}. Only one tab can view and drive it at a time.`}),(0,q.jsxs)(Z,{children:[(0,q.jsxs)(i,{variant:`contrast`,onClick:t.useHere,children:[(0,q.jsx)(L,{"aria-hidden":`true`}),`Use it here`]}),(0,q.jsx)(i,{variant:`outline`,onClick:t.close,children:`Close preview`})]})]})}function rt({attempt:e,exhausted:t,onReconnect:n}){return(0,q.jsxs)(`div`,{"data-slot":`preview-connection-banner`,role:`status`,className:`absolute inset-x-3 top-3 z-10 flex flex-wrap items-center justify-between gap-x-3 gap-y-2 rounded-lg border border-border bg-card px-3.5 py-2.5 text-sm shadow-sm`,children:[(0,q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,q.jsx)(we,{className:`size-4 shrink-0 text-danger`,"aria-hidden":`true`}),(0,q.jsxs)(`span`,{children:[(0,q.jsx)(`strong`,{className:`font-semibold text-foreground`,children:`Lost the connection to the host`}),t?null:(0,q.jsx)(`span`,{className:`text-muted-foreground`,children:` · reconnecting (attempt ${e} of 5)`})]})]}),(0,q.jsx)(i,{variant:`outline`,onClick:n,children:t?`Reconnect`:`Reconnect now`})]})}function it({servers:e,states:t,onOpen:n}){return(0,q.jsxs)(`div`,{"data-slot":`preview-state`,"data-state":`empty`,className:`mx-auto flex h-full w-full max-w-[560px] flex-col justify-center gap-4 px-6 py-8`,children:[(0,q.jsx)(`h2`,{className:`text-xl leading-tight font-semibold text-foreground`,children:`Open a page in this task's browser`}),(0,q.jsx)(X,{children:`The browser runs on the host, next to the worktree. Type a URL, a bare port such as 3000, or open a server the agent registered.`}),e.length>0?(0,q.jsxs)(`section`,{"aria-labelledby":`preview-registered`,className:`overflow-hidden rounded-lg border border-border bg-card`,children:[(0,q.jsx)(`h3`,{id:`preview-registered`,className:`border-b border-border px-3.5 py-2.5 text-xs font-semibold tracking-wide text-soft-foreground uppercase`,children:`Registered in this task`}),(0,q.jsx)(`ul`,{children:e.map(e=>{let r=_(e,t),a=m(r);return(0,q.jsxs)(`li`,{className:`flex items-center justify-between gap-3 border-b border-border px-3.5 py-2 text-sm last:border-b-0`,children:[(0,q.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-x-2.5 gap-y-0.5`,children:[(0,q.jsx)(p,{tone:a.tone,shape:a.ring?`ring`:`filled`,pulse:a.pulse,"aria-hidden":`true`}),(0,q.jsx)(`span`,{className:`font-semibold text-foreground`,children:e.label}),(0,q.jsxs)(`span`,{className:`font-mono text-muted-foreground`,children:[`:`,e.port]}),(0,q.jsx)(`span`,{className:`text-muted-foreground`,children:a.text})]}),(0,q.jsx)(i,{variant:`outline`,size:`sm`,className:`max-md:h-11`,onClick:()=>n(e.port),children:v(r)?`Open`:`Review`})]},e.port)})})]}):null,(0,q.jsxs)(`p`,{className:`flex items-start gap-2 text-xs text-muted-foreground`,children:[(0,q.jsx)(b,{className:`mt-px size-3.5 shrink-0`,"aria-hidden":`true`}),(0,q.jsx)(`span`,{children:`Review opens a server's approval in this pane: its command, cwd and Run and open. Nothing runs from this list. Paste works; copying text out, file pickers and downloads don't yet.`})]})]})}function at({dialog:e,onResult:t}){let[n,r]=(0,W.useState)(e.defaultPrompt??``),a=e.type===`beforeunload`,o=(0,W.useRef)(null),s=(0,W.useRef)(null);(0,W.useEffect)(()=>{(e.type===`prompt`?s.current:o.current)?.focus()},[e.type]);let c=(0,W.useRef)(t);c.current=t,(0,W.useEffect)(()=>{let e=e=>{if(e.key!==`Escape`||e.defaultPrevented)return;let t=e.target instanceof Element?e.target:null;t&&t!==document.body&&!t.closest(`[data-slot="preview-pane-body"], [data-slot="preview-page-dialog"]`)||(e.stopPropagation(),c.current({accept:!1}))};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[]);let l=()=>t(e.type===`prompt`?{accept:!0,text:n}:{accept:!0});return(0,q.jsx)(`div`,{"data-slot":`preview-page-dialog`,className:`absolute inset-0 z-20 flex items-center justify-center bg-foreground/30 p-4`,children:(0,q.jsxs)(`div`,{role:`alertdialog`,"aria-modal":`true`,"aria-label":`${e.origin} says`,className:`w-full max-w-[380px] rounded-xl border border-border bg-card p-4 shadow-lg`,children:[(0,q.jsx)(`p`,{className:`mb-3 truncate font-mono text-xs text-muted-foreground`,children:`${e.origin} says`}),(0,q.jsx)(`p`,{className:`mb-4 text-sm break-words whitespace-pre-wrap text-foreground`,children:e.message||(a?`Changes you made may not be saved.`:``)}),e.type===`prompt`?(0,q.jsx)(`input`,{ref:s,value:n,onChange:e=>r(e.target.value),onKeyDown:e=>{e.key===`Enter`&&l()},className:`mb-4 h-11 w-full rounded-md border border-border bg-background px-3 text-sm outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`}):null,(0,q.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[e.type===`alert`?null:(0,q.jsx)(i,{variant:`outline`,onClick:()=>t({accept:!1}),children:a?`Stay`:`Cancel`}),(0,q.jsx)(i,{ref:o,variant:`contrast`,onClick:l,children:a?`Leave`:`OK`})]})]})})}var ot=10,st=500,ct=500,lt=4,ut=16,dt=e=>!!e.altKey|(e.ctrlKey?2:0)|(e.metaKey?4:0)|(e.shiftKey?8:0);function ft(e,t,n,r){return{x:Math.round((e-n.left)/r),y:Math.round((t-n.top)/r)}}function pt(e,t){return{rect:e,scale:t,touches:new Map,multiTouch:!1,click:{at:-1/0,x:0,y:0,button:-1,count:1}}}var mt=[`left`,`middle`,`right`];function Q(e,t,n,r){let i=ft(n.clientX,n.clientY,t.rect,t.scale);return{t:`mouse`,type:e,x:i.x,y:i.y,button:mt[n.button]??`none`,buttons:n.buttons,clickCount:1,modifiers:dt(n),...r}}var ht=e=>e===0?0:-e;function gt(e,t,n,r,i){let a=ft(t,n,e.rect,e.scale);return{t:`mouse`,type:`mouseWheel`,x:a.x,y:a.y,button:`none`,buttons:0,deltaX:ht(r/e.scale),deltaY:ht(i/e.scale),modifiers:0}}function _t(e,t){let{touches:n}=t,r=n.get(e.pointerId),i=()=>{n.delete(e.pointerId),n.size===0&&(t.multiTouch=!1)};switch(e.type){case`pointerdown`:return n.set(e.pointerId,{startX:e.clientX,startY:e.clientY,startAt:e.timeStamp,lastX:e.clientX,lastY:e.clientY,scrolling:!1}),n.size>1&&(t.multiTouch=!0),[];case`pointermove`:{if(!r)return[];if(t.multiTouch)return r.lastX=e.clientX,r.lastY=e.clientY,[];if(!r.scrolling){if(Math.hypot(e.clientX-r.startX,e.clientY-r.startY)<=ot)return[];r.scrolling=!0}let n=e.clientX-r.lastX,i=e.clientY-r.lastY;return r.lastX=e.clientX,r.lastY=e.clientY,n===0&&i===0?[]:[gt(t,e.clientX,e.clientY,n,i)]}case`pointerup`:{let n=r!==void 0&&!t.multiTouch&&!r.scrolling&&e.timeStamp-r.startAt<=st;if(i(),!n||!r)return[];let a={...e,clientX:r.startX,clientY:r.startY};return[Q(`mouseMoved`,t,a,{button:`none`,buttons:0}),Q(`mousePressed`,t,a,{button:`left`,buttons:1}),Q(`mouseReleased`,t,a,{button:`left`,buttons:0})]}case`pointercancel`:return i(),[]}}function vt(e,t){if(e.pointerType===`touch`)return _t(e,t);switch(e.type){case`pointerdown`:{let n=t.click,r=n.button===e.button&&e.timeStamp-n.at<=ct&&Math.hypot(e.clientX-n.x,e.clientY-n.y)<=lt;return t.click={at:e.timeStamp,x:e.clientX,y:e.clientY,button:e.button,count:r?n.count+1:1},[Q(`mousePressed`,t,e,{clickCount:t.click.count})]}case`pointermove`:return[Q(`mouseMoved`,t,e,{button:e.buttons&1?`left`:`none`})];case`pointerup`:return[Q(`mouseReleased`,t,e,{clickCount:t.click.count})];case`pointercancel`:return[]}}function yt(e,t,n){let r=ft(e.clientX,e.clientY,t,n),i=e.deltaMode===1?ut:1;return{t:`mouse`,type:`mouseWheel`,x:r.x,y:r.y,button:`none`,buttons:e.buttons??0,deltaX:e.deltaX*i/n,deltaY:e.deltaY*i/n,modifiers:dt(e)}}var bt={a:`selectAll`,c:`copy`,x:`cut`,z:`undo`,y:`redo`};function xt(e){let t=e.key.toLowerCase(),n=(e.ctrlKey||e.metaKey)&&!e.getModifierState?.(`AltGraph`);if(n&&(t===`v`||t===`k`))return;let r={t:`key`,key:e.key,code:e.code,modifiers:dt(e),vk:e.keyCode};if(e.type===`keyup`)return{...r,type:`keyUp`};let i=n?``:e.key.length===1?e.key:e.key===`Enter`?`\r`:e.key===`Tab`?` `:``,a=n?t===`z`&&e.shiftKey?`redo`:bt[t]:void 0,o={t:`key`,type:i?`keyDown`:`rawKeyDown`,key:e.key,code:e.code,text:i,modifiers:dt(e),vk:e.keyCode};return a?{...o,commands:[a]}:o}function St(e){return e?{t:`insertText`,text:e}:void 0}var Ct=e=>e,wt=e=>e.key===`Escape`&&e.shiftKey&&!e.ctrlKey&&!e.metaKey&&!e.altKey;function Tt({scale:e,send:t,onLeave:n}){let r=(0,W.useRef)(null),i=(0,W.useRef)(pt({left:0,top:0},e)),a=(0,W.useRef)(e);a.current=e;let o=(0,W.useRef)(t);o.current=t;let s=(0,W.useRef)(void 0),c=()=>{let e=r.current;e&&(i.current.rect=e.getBoundingClientRect()),i.current.scale=a.current},l=e=>{c();for(let t of vt(Ct(e),i.current))o.current(t)},u=()=>{let e=s.current;e&&(s.current=void 0,cancelAnimationFrame(e.frame),l(e.event))};(0,W.useEffect)(()=>()=>{s.current&&cancelAnimationFrame(s.current.frame)},[]),(0,W.useEffect)(()=>{document.activeElement===document.body&&r.current?.focus({preventScroll:!0})},[]),(0,W.useEffect)(()=>{let e=r.current;if(!e)return;let t=e=>{e.preventDefault(),c(),o.current(yt(e,i.current.rect,i.current.scale))};return e.addEventListener(`wheel`,t,{passive:!1}),()=>e.removeEventListener(`wheel`,t)},[]),(0,W.useEffect)(()=>{let e=e=>{if(document.activeElement!==r.current)return;let t=St(e.clipboardData?.getData(`text`)??``);t&&(e.preventDefault(),o.current(t))};return document.addEventListener(`paste`,e),()=>document.removeEventListener(`paste`,e)},[]);let d=e=>{u(),r.current?.focus({preventScroll:!0});try{r.current?.setPointerCapture(e.pointerId)}catch{}l(e.nativeEvent)},f=e=>{let t=e.nativeEvent;if(t.pointerType===`touch`)return l(t);let n=s.current;if(n){n.event=t;return}s.current={event:t,frame:requestAnimationFrame(()=>{let e=s.current;s.current=void 0,e&&l(e.event)})}},p=e=>{u(),l(e.nativeEvent)},m=e=>{if(wt(e)){e.preventDefault(),e.stopPropagation(),e.type===`keydown`&&(n?n():r.current?.blur());return}let i=xt(e.nativeEvent);i&&(e.preventDefault(),e.stopPropagation(),t(i))};return(0,q.jsx)(`div`,{ref:r,"data-slot":`preview-input`,role:`application`,"aria-label":`Page preview, interactive`,"aria-description":`Keys go to the page, Tab included. Press Shift+Escape to return to the cockpit.`,tabIndex:0,onPointerDown:d,onPointerMove:f,onPointerUp:p,onPointerCancel:p,onContextMenu:e=>e.preventDefault(),onKeyDown:m,onKeyUp:m,className:`absolute inset-0 touch-none select-none outline-none focus-visible:ring-2 focus-visible:ring-ring/60 focus-visible:ring-inset`})}async function Et(e){if(typeof createImageBitmap==`function`){let t=await createImageBitmap(e);return{source:t,width:t.width,height:t.height,release:()=>t.close()}}let t=URL.createObjectURL(e),n=new Image;return n.src=t,await n.decode(),{source:n,width:n.naturalWidth,height:n.naturalHeight,release:()=>URL.revokeObjectURL(t)}}function Dt({ref:e,viewport:t,dimmed:n=!1,cursor:r,onSize:i,renderInput:a,children:s}){let c=(0,W.useRef)(null),l=(0,W.useRef)(null),[u,d]=(0,W.useState)(null),f=(0,W.useRef)(i);f.current=i,(0,W.useImperativeHandle)(e,()=>({async draw(e){let t=l.current,n=t?.getContext(`2d`);if(!(!t||!n))try{let r=await Et(e);try{t.width!==r.width&&(t.width=r.width),t.height!==r.height&&(t.height=r.height),n.drawImage(r.source,0,0)}finally{r.release()}}catch{}}}),[]),(0,W.useEffect)(()=>{let e=c.current;if(!e)return;let t=()=>{let t=Math.round(e.clientWidth),n=Math.round(e.clientHeight);t===0||n===0||(d(e=>e&&e.w===t&&e.h===n?e:{w:t,h:n}),f.current?.({w:t,h:n}))};if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]);let p=t===`fit`?u:t,m=t===`fit`||!u?1:Math.min(1,(u.w-24)/t.w,(u.h-24)/t.h),h=p?{width:Math.floor(p.w*m),height:Math.floor(p.h*m)}:void 0;return(0,q.jsxs)(`div`,{ref:c,"data-slot":`preview-stage`,"data-viewport":t===`fit`?`fit`:`${t.w}x${t.h}`,className:o(`relative min-h-0 flex-1 overflow-hidden bg-muted`,t!==`fit`&&`flex items-start justify-center overflow-auto p-3`),children:[p?(0,q.jsxs)(`div`,{"data-slot":`preview-surface`,"data-scale":m,style:{...h,cursor:r},className:o(`relative shrink-0 bg-card`,t!==`fit`&&`shadow-md`,n&&`opacity-60 saturate-50`),children:[(0,q.jsx)(`canvas`,{ref:l,"aria-label":`Page preview`,role:`img`,style:h,className:`block touch-none select-none`}),a?.({canvas:l.current,scale:m,viewport:p})]}):null,s]})}var Ot=[{w:390,h:844,icon:g},{w:820,h:1180,icon:xe},{w:1440,h:900,icon:se}],$=`size-8 shrink-0 max-md:size-11`,kt=e=>e===`fit`?`Fit`:`${e.w} × ${e.h}`;function At(e){let[t,n]=(0,W.useState)(()=>Date.now());return(0,W.useEffect)(()=>{let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}var jt=e=>`${e.fps} fps · ${e.kbps} KB/s${e.rttMs===void 0?``:` · ${e.rttMs} ms`}`;function Mt({stats:e,shrunk:t}){let n=At(250),r=e.lastFrameAt===void 0||n-e.lastFrameAt>=1e3;return t?(0,q.jsx)(p,{"data-slot":`preview-stats`,tone:r?`neutral`:`success`,"aria-label":`Preview is live`,role:`img`}):(0,q.jsxs)(`span`,{"data-slot":`preview-stats`,role:`img`,"aria-label":r?`idle`:jt(e),className:`flex shrink-0 items-center gap-1.5 font-mono text-xs whitespace-nowrap text-muted-foreground`,children:[(0,q.jsx)(p,{tone:r?`neutral`:`success`,"aria-hidden":`true`}),(0,q.jsx)(`span`,{className:`hidden @min-[640px]:inline-block w-[28ch] overflow-hidden text-ellipsis`,children:r?`idle`:jt(e)})]})}function Nt(e){let{url:t,servers:n,current:r,adopted:a,viewport:s,compact:c=!1,navEnabled:l,loading:u=!1,stats:f,status:h,badge:g=!0}=e,v=n.length>=2,b=v||a,x=(0,W.useRef)(null),ee=e.urlInputRef??x,S=(0,W.useRef)(!1),[C,E]=(0,W.useState)(null),[D,O]=(0,W.useState)(!1),k=(0,q.jsx)(i,{variant:`ghost`,size:`icon-sm`,className:$,"aria-label":`Back`,disabled:!l,onClick:e.onBack,children:(0,q.jsx)(me,{"aria-hidden":`true`})}),ae=(0,q.jsx)(i,{variant:`ghost`,size:`icon-sm`,className:$,"aria-label":`Forward`,disabled:!l,onClick:e.onForward,children:(0,q.jsx)(he,{"aria-hidden":`true`})}),j=(0,q.jsx)(i,{variant:`ghost`,size:`icon-sm`,className:$,"aria-label":`Reload`,"aria-busy":u||void 0,disabled:!l||u,onClick:()=>e.onReload(!1),children:(0,q.jsx)(ye,{"aria-hidden":`true`})}),M=v?(0,q.jsxs)(ie,{children:[(0,q.jsx)(ne,{asChild:!0,children:(0,q.jsxs)(i,{variant:`outline`,size:`sm`,className:`max-w-[11rem] min-w-0 gap-1.5 max-md:h-11`,"aria-label":r?`Server: ${r.label} :${r.port}`:`Server`,children:[r?(0,q.jsx)(p,{tone:`neutral`,shape:`ring`,"aria-hidden":`true`}):(0,q.jsx)(d,{"aria-hidden":`true`}),(0,q.jsx)(`span`,{className:`truncate`,children:r?r.label:`Server`}),r?(0,q.jsxs)(`span`,{className:`font-mono font-normal text-muted-foreground`,children:[`:`,r.port]}):null,(0,q.jsx)(ce,{className:`size-3.5 text-muted-foreground`,"aria-hidden":`true`})]})}),(0,q.jsxs)(re,{align:`start`,className:`min-w-64`,onCloseAutoFocus:e=>{S.current&&(S.current=!1,e.preventDefault(),ee.current?.focus())},children:[n.map(t=>{let n=m(_(t,e.serverStates));return(0,q.jsxs)(w,{className:`min-h-11 gap-2.5 md:min-h-0`,onSelect:()=>e.onPickServer(t.port),children:[(0,q.jsx)(p,{tone:n.tone,shape:n.ring?`ring`:`filled`,pulse:n.pulse,"aria-hidden":`true`}),(0,q.jsx)(`span`,{className:`font-semibold`,children:t.label}),(0,q.jsxs)(`span`,{className:`font-mono text-muted-foreground`,children:[`:`,t.port]}),(0,q.jsx)(`span`,{className:`ml-auto text-xs text-muted-foreground`,children:n.text}),r?.port===t.port?(0,q.jsx)(oe,{className:`size-4`,"aria-hidden":`true`}):null]},t.port)}),(0,q.jsx)(T,{}),(0,q.jsxs)(w,{className:`min-h-11 gap-2.5 md:min-h-0`,onSelect:()=>{S.current=!0},children:[(0,q.jsx)(y,{"aria-hidden":`true`}),`Type a URL instead`]})]})]}):null,fe=(0,q.jsxs)(`div`,{className:`relative flex min-w-[9rem] flex-1 items-center`,children:[(0,q.jsx)(y,{className:`pointer-events-none absolute left-2.5 size-4 text-muted-foreground`,"aria-hidden":`true`}),(0,q.jsx)(`input`,{ref:ee,type:`text`,"aria-label":`Page address`,placeholder:`Type a URL or a port`,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,value:C??(D?t:je(t)),title:t||void 0,className:o(`h-8 w-full min-w-0 truncate rounded-md border border-transparent bg-muted pl-8 font-mono text-[13px] text-foreground outline-none placeholder:text-soft-foreground focus-visible:border-ring focus-visible:bg-background focus-visible:ring-[3px] focus-visible:ring-ring/30 max-md:h-11`,a?`pr-40`:`pr-2.5`),onFocus:e=>{let t=e.currentTarget;O(!0),requestAnimationFrame(()=>{document.activeElement===t&&t.select()})},onBlur:()=>{O(!1),E(null)},onChange:e=>E(e.target.value),onKeyDown:n=>{n.key===`Enter`?(e.onNavigate(C??t),n.currentTarget.blur()):n.key===`Escape`&&n.currentTarget.blur()}}),a&&!D?(0,q.jsxs)(`span`,{className:`pointer-events-none absolute right-2 inline-flex h-6 items-center gap-1 rounded-full border border-border bg-card px-2 text-xs font-semibold text-muted-foreground`,children:[(0,q.jsx)(V,{className:`size-3`,"aria-hidden":`true`}),`Not started by cezar`]}):null]}),pe=c?null:(0,q.jsxs)(ie,{children:[(0,q.jsx)(ne,{asChild:!0,children:(0,q.jsxs)(i,{variant:`outline`,size:`sm`,className:`shrink-0 gap-1.5`,"aria-label":`Viewport size: ${kt(s)}`,children:[s===`fit`?(0,q.jsx)(U,{"aria-hidden":`true`}):(0,q.jsx)(se,{"aria-hidden":`true`}),(0,q.jsx)(`span`,{className:o(`hidden @min-[500px]:inline`,s!==`fit`&&`font-mono font-normal`),children:kt(s)}),(0,q.jsx)(ce,{className:`size-3.5 text-muted-foreground`,"aria-hidden":`true`})]})}),(0,q.jsxs)(re,{align:`start`,className:`min-w-56`,children:[(0,q.jsxs)(w,{className:`gap-2.5`,onSelect:()=>e.onViewport(`fit`),children:[(0,q.jsx)(U,{"aria-hidden":`true`}),`Fit`,(0,q.jsx)(`span`,{className:`ml-auto text-xs text-muted-foreground`,children:`pane size`}),s===`fit`?(0,q.jsx)(oe,{className:`size-4`,"aria-hidden":`true`}):null]}),Ot.map(({w:t,h:n,icon:r})=>(0,q.jsxs)(w,{className:`gap-2.5 font-mono`,onSelect:()=>e.onViewport({w:t,h:n}),children:[(0,q.jsx)(r,{"aria-hidden":`true`}),t,` × `,n,s!==`fit`&&s.w===t&&s.h===n?(0,q.jsx)(oe,{className:`ml-auto size-4`,"aria-hidden":`true`}):null]},`${t}x${n}`))]})]}),N=c?null:f?(0,q.jsx)(Mt,{stats:f,shrunk:b}):h?(0,q.jsxs)(`span`,{"data-slot":`preview-status`,className:`flex shrink-0 items-center gap-1.5 font-mono text-xs whitespace-nowrap text-muted-foreground`,children:[(0,q.jsx)(p,{tone:h.tone,"aria-hidden":`true`}),h.label]}):null,F=(0,q.jsxs)(ie,{children:[(0,q.jsx)(ne,{asChild:!0,children:(0,q.jsx)(i,{variant:`ghost`,size:`icon-sm`,className:$,"aria-label":`More`,children:(0,q.jsx)(le,{"aria-hidden":`true`})})}),(0,q.jsxs)(re,{align:`end`,className:`min-w-64`,children:[b&&f&&!c?(0,q.jsx)(te,{className:`font-mono text-xs font-normal text-muted-foreground`,children:jt(f)}):null,(0,q.jsxs)(w,{className:`min-h-11 gap-2.5 md:min-h-0`,disabled:!l,onSelect:()=>e.onReload(!0),children:[(0,q.jsx)(ve,{"aria-hidden":`true`}),`Reload without cache`]}),(0,q.jsxs)(w,{className:`min-h-11 gap-2.5 md:min-h-0`,disabled:t===``,onSelect:e.onCopyUrl,children:[(0,q.jsx)(de,{"aria-hidden":`true`}),`Copy page URL`]}),r?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(T,{}),a?(0,q.jsxs)(w,{disabled:!0,className:`items-start gap-2.5 opacity-100 data-[disabled]:opacity-100`,children:[(0,q.jsx)(H,{className:`mt-0.5 text-muted-foreground`,"aria-hidden":`true`}),(0,q.jsxs)(`span`,{className:`flex flex-col gap-0.5`,children:[(0,q.jsx)(`span`,{className:`text-muted-foreground`,children:`Stop server · ${r.label} :${r.port}`}),(0,q.jsx)(`span`,{className:`text-xs whitespace-normal text-muted-foreground`,children:`cezar didn't start this server, so it won't stop it. Stop it where it was started.`})]})]}):(0,q.jsxs)(w,{variant:`destructive`,className:`min-h-11 gap-2.5 md:min-h-0`,onSelect:()=>e.onStop(r.port),children:[(0,q.jsx)(P,{"aria-hidden":`true`}),`Stop server · ${r.label} :${r.port}`]})]}):null,c?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(T,{}),(0,q.jsxs)(w,{className:`min-h-11 gap-2.5`,onSelect:e.onClose,children:[(0,q.jsx)(A,{"aria-hidden":`true`}),`Close preview`]})]}):null]})]}),I=e.onSession?(0,q.jsxs)(i,{variant:`outline`,size:`sm`,className:`shrink-0 gap-1 max-md:h-11`,onClick:e.onSession,children:[(0,q.jsx)(ue,{"aria-hidden":`true`}),`Session`]}):null,L=u?(0,q.jsx)(`div`,{role:`progressbar`,"aria-label":`Loading the page`,className:`absolute inset-x-0 bottom-0 h-0.5 overflow-hidden bg-transparent`,children:(0,q.jsx)(`div`,{className:`preview-progress h-full w-2/5 bg-success`})}):null;return c?(0,q.jsxs)(`div`,{"data-slot":`preview-toolbar`,"data-compact":``,className:`relative flex shrink-0 flex-col border-b border-border bg-background`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2 px-2 pt-[max(0.25rem,env(safe-area-inset-top))]`,children:[I,(0,q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col items-center leading-tight`,children:[(0,q.jsxs)(`span`,{className:`flex max-w-full items-center gap-1.5 text-sm font-semibold text-foreground`,children:[f?(0,q.jsx)(p,{tone:`success`,"aria-hidden":`true`}):null,(0,q.jsx)(`span`,{className:`truncate`,children:r?`${r.label} :${r.port}`:`Preview`})]}),g?(0,q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Experimental`}):null]}),F]}),(0,q.jsxs)(`div`,{className:`flex items-center gap-1 px-2 py-1`,children:[k,ae,j,fe]}),L]}):(0,q.jsxs)(`div`,{"data-slot":`preview-toolbar`,className:`@container relative flex shrink-0 items-center gap-1.5 border-b border-border bg-background px-2.5 py-2`,children:[I,k,ae,j,M,fe,pe,N,g?(0,q.jsx)(De,{iconOnly:b,responsive:!b}):null,(0,q.jsx)(`span`,{"aria-hidden":`true`,className:`mx-0.5 h-5 w-px shrink-0 bg-border`}),F,(0,q.jsx)(i,{variant:`ghost`,size:`icon-sm`,className:$,"aria-label":`Close preview`,onClick:e.onClose,children:(0,q.jsx)(A,{"aria-hidden":`true`})}),L]})}var Pt=2e3,Ft=500,It=1e3;function Lt(e){return(0,q.jsx)(fe,{onClose:e.onClose,children:(0,q.jsx)(Ht,{...e})})}function Rt(e,t){switch(e.stage){case`needs-approval`:case`port-held`:case`server-starting`:case`server-stalled`:case`server-exited`:case`server-stopped`:return e.server.port===t;case`loading`:case`streaming`:return!0;default:return!1}}function zt(e){navigator.clipboard?.writeText(e).then(()=>r(`Copied`),()=>r(`Couldn't copy to the clipboard`,{tone:`danger`}))}var Bt=e=>`http://localhost:${e.port}${e.path&&e.path!==`/`?e.path:``}`;function Vt(e,t,n,r){if(e.state===`blocked`)return{tone:`neutral`,label:`not supported`};if(n)return{tone:`neutral`,label:`paused`};if(t&&(e.state===`reconnecting`||e.state===`closed`))return{tone:`danger`,label:`offline`};if(e.state!==`open`)return{tone:`neutral`,label:`connecting…`};switch(r?.stage){case`downloading`:return{tone:`pending`,label:`downloading`};case`download-failed`:return{tone:`danger`,label:`download failed`};case`sandbox-failed`:return{tone:`danger`,label:`browser failed`};case`browser-exited`:return{tone:`danger`,label:`browser exited`};case`needs-approval`:return{tone:`neutral`,label:`not started`};case`port-held`:return{tone:`danger`,label:`port in use`};case`server-starting`:return{tone:`pending`,label:`waiting for :${r.server.port}`};case`server-stalled`:return{tone:`pending`,label:`waiting · 2 min`};case`server-exited`:return{tone:`danger`,label:`server exited`};case`server-stopped`:return{tone:`neutral`,label:`stopped`};case`loading`:return{tone:`neutral`,label:`connecting…`};default:return}}function Ht({run:e,servers:t,serverStates:n,request:r,onSession:i,onPort:a,onLive:o,onClose:s}){let c=ee(),l=ae(pe,!1),[u,d]=(0,W.useState)(0),[f,p]=(0,W.useState)({state:`connecting`,attempt:0}),[m,h]=(0,W.useState)(!1),[g,_]=(0,W.useState)(void 0),[v,y]=(0,W.useState)(void 0),[b,x]=(0,W.useState)(``),[S,C]=(0,W.useState)(void 0),[te,w]=(0,W.useState)(!1),[T,ne]=(0,W.useState)(!1),[re,ie]=(0,W.useState)(void 0),[E,D]=(0,W.useState)(void 0),[O,k]=(0,W.useState)(void 0),[A,oe]=(0,W.useState)(`fit`),[se,j]=(0,W.useState)(null),[ce,M]=(0,W.useState)(void 0),[le,ue]=(0,W.useState)(0),de=(0,W.useRef)(void 0),fe=(0,W.useRef)(null),me=(0,W.useRef)(null),he=(0,W.useRef)(void 0),N=(0,W.useRef)(void 0),P=(0,W.useRef)({port:S,stage:v});P.current={port:S,stage:v};let F=(0,W.useRef)([]),I=(0,W.useRef)(void 0),L=(0,W.useRef)(!1),R=(0,W.useRef)(!1),z=(0,W.useCallback)(e=>{R.current&&de.current?.send(e)},[]);(0,W.useEffect)(()=>{let t;return t=Ee({projectId:c??`default`,runId:e.id},{onFrame(e){let n=Date.now();F.current.push({at:n,bytes:e.size}),L.current||(L.current=!0,ne(!0)),(fe.current?.draw(e)??Promise.resolve()).finally(()=>t?.send({t:`ack`}))},onMessage(e){switch(e.t){case`state`:if(y(e),(e.stage===`streaming`||e.stage===`loading`)&&ue(e=>e+1),N.current!==void 0&&Rt(e,N.current)){let n=N.current;N.current=void 0,(e.stage===`needs-approval`||e.stage===`server-exited`||e.stage===`server-stopped`)&&t?.send({t:`run`,port:n})}return;case`url`:return x(e.url);case`cursor`:return ie(e.cursor);case`dialog`:return D(e);case`pong`:I.current=Math.max(0,Date.now()-e.ts);return;case`downloadProgress`:y(t=>t?.stage===`downloading`?{...t,received:e.received,total:e.total}:t);return;case`replaced`:_(e.by),R.current=!1,t?.close();return}},onTransport(e,n){R.current=e===`open`,p({state:e,attempt:n??0}),e===`open`&&(h(!0),he.current&&t?.send({t:`open`,target:he.current}))}}),de.current=t,()=>{R.current=!1,t?.close(),de.current===t&&(de.current=void 0)}},[c,e.id,u]);let B=f.state===`open`&&g===void 0,V=l||A===`fit`?se:A;(0,W.useEffect)(()=>{V&&B&&(v?.stage===`streaming`||v?.stage===`loading`)&&z({t:`resize`,w:V.w,h:V.h})},[V?.w,V?.h,B,v?.stage,le,z]),(0,W.useEffect)(()=>{if(!B)return;let e=setInterval(()=>z({t:`ping`,ts:Date.now()}),Pt);return()=>clearInterval(e)},[B,z]);let H=B&&v?.stage===`streaming`;(0,W.useEffect)(()=>{if(!H){k(void 0);return}let e=setInterval(()=>{let e=Date.now();F.current=F.current.filter(t=>e-t.at<=It);let t={fps:F.current.length,kbps:Math.round(F.current.reduce((e,t)=>e+t.bytes,0)/1024),...I.current===void 0?{}:{rttMs:I.current},...F.current.length>0?{lastFrameAt:F.current.at(-1).at}:{}};k(e=>{let n=t.lastFrameAt??e?.lastFrameAt,r={...t,...n===void 0?{}:{lastFrameAt:n}};return e&&e.fps===r.fps&&e.kbps===r.kbps&&e.rttMs===r.rttMs&&e.lastFrameAt===r.lastFrameAt?e:r})},Ft);return()=>clearInterval(e)},[H]),(0,W.useEffect)(()=>(o?.(H),()=>o?.(!1)),[H,o]),(0,W.useEffect)(()=>{a?.(S)},[S,a]);let U=(0,W.useCallback)((e,t,n=!1)=>{he.current=e,N.current=n&&`port`in e?e.port:void 0,w(!0),y(void 0),_(void 0),M(void 0),x(t),C(`port`in e?e.port:void 0),z({t:`open`,target:e})},[z]),ge=(0,W.useCallback)((e,n=!1)=>{let r=t.find(t=>t.port===e);U({port:e},r?Bt(r):`http://localhost:${e}`,n)},[t,U]);(0,W.useEffect)(()=>{r?.port!==void 0&&(P.current.port===r.port&&P.current.stage?.stage===`streaming`&&r.run!==!0||ge(r.port,r.run===!0))},[r]);let _e=!te&&!g&&f.state!==`blocked`,ve=r?.port!==void 0;(0,W.useEffect)(()=>{_e&&!ve&&me.current?.focus()},[_e,ve]);let ye=e=>{let n=ke(e,t);if(n.kind===`error`)return M(n.message);if(n.kind===`server`)return ge(n.port);if(P.current.stage?.stage===`streaming`)return he.current={url:n.url},N.current=void 0,C(void 0),M(void 0),x(n.url),z({t:`nav`,url:n.url});U({url:n.url},n.url)},be=()=>{_(void 0),p({state:`connecting`,attempt:0}),L.current=!1,d(e=>e+1)},xe=(0,W.useMemo)(()=>({download:()=>z({t:`download`}),cancelDownload:()=>z({t:`cancelDownload`}),retryBrowser:()=>z({t:`retryBrowser`}),run:e=>z({t:`run`,port:e}),stop:e=>z({t:`stop`,port:e}),keepWaiting:e=>z({t:`keepWaiting`,port:e}),close:s,useHere:be,copy:zt}),[z,s]),Se=t.find(e=>e.port===S),Ce=v?.stage===`streaming`&&v.adopted,we=m&&(f.state===`reconnecting`||f.state===`closed`),G=null,K=!1;f.state===`blocked`?G=(0,q.jsx)(Ne,{state:{stage:`proxy-blocked`},actions:xe}):g===void 0?_e?G=(0,q.jsx)(it,{servers:t,states:n,onOpen:e=>ge(e)}):v?.stage===`streaming`||v?.stage===`loading`&&T?G=null:v?G=(0,q.jsx)(Ne,{state:v,actions:xe,url:b,worktree:e.worktreePath}):we||(G=(0,q.jsx)(Ne,{state:{t:`state`,stage:`loading`,step:`browser`},actions:xe,url:b})):(K=!0,G=(0,q.jsx)(Ne,{state:{stage:`taken-over`,by:g},actions:xe})),we&&(K=!0);let Te=B&&G===null&&!E,De=T&&(v?.stage===`streaming`||v?.stage===`loading`||K);return(0,q.jsxs)(`section`,{"data-slot":`preview-pane-body`,"aria-label":`Live preview`,className:`flex h-full min-h-0 flex-col bg-background text-foreground`,children:[(0,q.jsx)(Nt,{url:b,servers:t,serverStates:n,badge:f.state!==`blocked`,current:Se,adopted:Ce,viewport:l?`fit`:A,compact:l,navEnabled:H,loading:v?.stage===`loading`,stats:H?O??{fps:0,kbps:0}:void 0,status:H?void 0:Vt(f,m,g!==void 0,v),urlInputRef:me,onSession:i,onNavigate:ye,onBack:()=>z({t:`back`}),onForward:()=>z({t:`forward`}),onReload:e=>z({t:`reload`,...e?{ignoreCache:!0}:{}}),onPickServer:e=>ge(e),onViewport:oe,onCopyUrl:()=>zt(b),onStop:e=>z({t:`stop`,port:e}),onClose:s}),ce?(0,q.jsx)(`p`,{role:`alert`,className:`border-b border-border bg-card px-3 py-1.5 text-xs text-danger`,children:ce}):null,(0,q.jsxs)(Dt,{ref:fe,viewport:l?`fit`:A,dimmed:K&&De,cursor:re,onSize:j,renderInput:e=>Te?(0,q.jsx)(Tt,{scale:e.scale,send:z,onLeave:()=>me.current?.focus()}):null,children:[we?(0,q.jsx)(rt,{attempt:f.attempt,exhausted:f.state===`closed`,onReconnect:be}):null,G?(0,q.jsx)(`div`,{"data-slot":`preview-overlay`,className:K&&T?`absolute inset-0 overflow-auto bg-background/85`:`absolute inset-0 overflow-auto bg-background`,children:G}):null,E?(0,q.jsx)(at,{dialog:E,onResult:e=>{D(void 0),z({t:`dialogResult`,...e})}}):null]})]})}function Ut(e){let{visibleEvents:t}=s(e);return(0,W.useMemo)(()=>{let e=new Map;for(let n of l(t,{activeTurn:!1}).turns)for(let t of n.items)t.kind===`preview-server`&&e.set(t.server.port,t);return e},[t])}function Wt(e){let t=Ut(e.run.id);return(0,q.jsx)(Lt,{...e,serverStates:t})}export{Wt as ConnectedPreviewPane};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t}from"./react-runtime-CCIEwYL0.js";import{t as n}from"./createLucideIcon-BHp8sXmF.js";import{n as r}from"./format-DpNe3S0A.js";var i=n(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),a=n(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),o=n(`smartphone`,[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]),s=e(t(),1);function c(e){if(!e.worktreePath||e.worktreeReclaimedAt)return!0;let t=e.delegation?.role===`worker`?e.delegation.destroy:void 0;return t!==void 0&&!t.remaining.includes(`worktree`)}function l(e){let{state:t,server:n}=e,i=r(e.stateAt);switch(t){case`registered`:return n.answeredAtRegistration?{tone:`neutral`,ring:!1,pulse:!1,text:`was running when registered`}:{tone:`neutral`,ring:!0,pulse:!1,text:`registered · not started`};case`adopted`:return{tone:`neutral`,ring:!1,pulse:!1,text:`was running when registered`};case`starting`:return{tone:`pending`,ring:!1,pulse:!0,text:`starting`};case`up`:return{tone:`success`,ring:!1,pulse:!1,text:i?`up · ${i}`:`up`};case`stalled`:return{tone:`pending`,ring:!1,pulse:!1,text:`stalled · port silent 2 min`};case`exited`:return{tone:`danger`,ring:!1,pulse:!1,text:e.exitCode===void 0?`exited`:`exited · code ${e.exitCode}`};case`stopped`:return{tone:`neutral`,ring:!0,pulse:!1,text:e.reason===`idle`?`stopped after 15 min idle`:`stopped`};case`unavailable`:return{tone:`neutral`,ring:!0,pulse:!1,text:`unavailable`}}}function u(e){return{kind:`preview-server`,id:`preview-server:${e.port}`,server:e,state:`registered`,stateAt:e.registeredAt}}function d(e,t){return t?.get(e.port)??u(e)}function f(e){return e.state===`registered`?e.server.answeredAtRegistration:e.state===`up`||e.state===`starting`||e.state===`adopted`}function p(e){return e.split(` -- `)[0].trim()}var m=(0,s.createContext)(null);function h(){return(0,s.useContext)(m)}function g(e){let[t,n]=(0,s.useState)(!1),[r,i]=(0,s.useState)(!1),[a,o]=(0,s.useState)(void 0),[c,l]=(0,s.useState)(!1),[u,d]=(0,s.useState)(void 0),[f,p]=(0,s.useState)(e);f!==e&&(p(e),n(!1),i(!1),o(void 0),l(!1),d(void 0));let m=(0,s.useCallback)(e=>{d({...e}),e.port!==void 0&&o(e.port),l(!1),n(!0)},[]),h=(0,s.useCallback)(()=>{n(!1),i(!1),l(!1),o(void 0)},[]),g=(0,s.useCallback)(()=>l(!0),[]);return(0,s.useMemo)(()=>({open:t,live:r,port:a,request:u,session:c,openPane:m,closePane:h,showSession:g,setLive:i,setPort:o}),[t,r,a,u,c,m,h,g])}export{l as a,c,i as d,p as i,o as l,d as n,h as o,f as r,g as s,m as t,a as u};
@@ -0,0 +1,15 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{C as r,Ct as i,P as a,f as o,v as s}from"./button-C_rd7CPp.js";import{G as c,t as l}from"./utils-JsL3ZsJf.js";import{d as u,l as d,m as f,p}from"./alert-dialog-BrpNUwMt.js";import{t as m}from"./createLucideIcon-BHp8sXmF.js";import{c as h,i as ee,p as g,r as _,s as v,t as te}from"./dropdown-menu-BegOZFrj.js";import{i as y,n as b,o as x,r as S,s as C}from"./textarea-D20O4Pw0.js";var w=m(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),T=e(t(),1),E=`quick-task`;function D(e,t,n=24){return[t,...(e??[]).filter(e=>!(e.source===t.source&&e.ref===t.ref))].slice(0,n)}var O=[{id:`claude`,label:`claude`,desc:`Claude Code CLI`},{id:`codex`,label:`codex`,desc:`OpenAI Codex (app-server)`},{id:`opencode`,label:`opencode`,desc:`OpenCode (serve)`},{id:`pi`,label:`pi`,desc:`pi CLI (provider/model)`},{id:`cursor`,label:`Cursor`,desc:`Cursor CLI (ACP)`},{id:`omp`,label:`OMP`,desc:`Oh My Pi CLI (provider/model)`}],k={claude:[{id:``,label:`auto`,desc:`Pick the best model per step`},{id:`opus`,label:`opus`,desc:`Deep reasoning for hard tasks`},{id:`sonnet`,label:`sonnet`,desc:`Fast and cheap`},{id:`haiku`,label:`haiku`,desc:`Fastest — simple, scoped tasks`}],codex:[{id:``,label:`auto`,desc:`Use your Codex default model`}],opencode:[{id:``,label:`auto`,desc:`Use your OpenCode default model`}],cursor:[{id:``,label:`auto`,desc:`Use your Cursor default model`}],pi:[{id:``,label:`auto`,desc:`Use your pi default model`}],omp:[{id:``,label:`auto`,desc:`Use your OMP default model`}]},A=[{value:``,label:`auto`,desc:`Harness default`},{value:`low`,label:`low`,desc:`Less reasoning, faster replies`},{value:`medium`,label:`medium`,desc:`Balanced reasoning`},{value:`high`,label:`high`,desc:`More reasoning for hard tasks`},{value:`xhigh`,label:`xhigh`,desc:`Extra-high reasoning`},{value:`max`,label:`max`,desc:`Maximum reasoning`}];function j(e,t,n){let r=e===`cursor`?[A[0]]:A,i=c(e)&&(e!==`cursor`||n?.runner===e)?n?.models.find(e=>e.id===t)?.effortLevels:void 0;if(!i?.length)return r;let a=[A[0]],o=new Set;for(let e of i){if(o.has(e))continue;let t=A.find(t=>t.value===e);t&&(o.add(e),a.push(t))}return a.length>1?a:r}function M(e,t){let n=e??``;return t.some(e=>e.value===n)?n:``}var N=[`opencode`,`pi`,`omp`];function P(e,t){return t===`cursor`||!e||k[t].some(t=>t.id===e)?!1:t!==`claude`&&[`claude-fable-5`,`claude-opus-4-8`,`claude-sonnet-5`,`claude-haiku-4-5`].includes(e)?!0:Object.entries(k).some(([n,r])=>n!==t&&!N.includes(n)&&r.some(t=>t.id!==``&&t.id===e))}function F(e,t,n=[]){let r=t?.runner===e?t.models:[],i=k[e]??k.claude,a=[...r.length?i.slice(0,1):i],o=new Set(a.map(e=>e.id));if(c(e))for(let e of r)!e.id||o.has(e.id)||(o.add(e.id),a.push({id:e.id,label:e.label||e.id,desc:e.description}));for(let t of n)!t||o.has(t)||P(t,e)||(o.add(t),a.push({id:t,label:t,desc:`Custom or legacy model`}));return a}var ne={claude:`Claude`,codex:`Codex`,opencode:`OpenCode`,pi:`Pi`,cursor:`Cursor`,omp:`OMP`};function I(e,t,n=!1,r=!1){if(!c(e))return;let i=ne[e];if(t?.stale)return`Using cached ${i} model list`;if(n||t?.source===`unavailable`)return`Latest ${i} models unavailable`;if(r&&!t)return`Loading ${i} models…`}function L(e){let t=O.map(e=>e.id).filter(t=>e.some(e=>e.name===t&&e.available));return t.length>0?t:[`claude`]}function re(e,t,n){return e!==null&&t.includes(e)?e:t.includes(n)?n:t[0]??`claude`}function ie(e,t,n=!1){return!n&&e===t?void 0:e}function ae(e,t,n,r){let i=F(t,r,[e,n?.[t]]);if(e!==null&&i.some(t=>t.id===e))return e;let a=n?.[t];return a!==void 0&&i.some(e=>e.id===a)?a:``}function oe(e,t,n){return e.source===`skill`?t.some(t=>t.name===e.ref):n.some(t=>t.name===e.ref)}function se(e,t,n){return e&&oe(e,t,n)?e:null}function ce(e){let{task:t,source:n,model:r,modelsLocked:i,effort:a,runner:o,runnerExplicit:s,defaultRunner:c,agentProfile:l,variants:u,images:d,worktree:f,autonomous:p,generateFollowups:m,todoId:h}=e;return{task:t,...n?.source===`skill`?{steps:[{id:`task`,name:n.ref,skill:n.ref,prompt:`{{task}}`}]}:{workflow:n?.ref??`quick-task`},model:i?void 0:r||void 0,effort:i?void 0:a||void 0,runner:ie(o,c,s),agentProfile:l||void 0,variants:u>1?u:void 0,images:d.length>0?[...d]:void 0,worktree:f===!1&&u<=1?!1:void 0,autonomous:p===!0||void 0,generateFollowups:m!==!1&&void 0,todoId:h||void 0}}function le(e,t){return t?{...e,notify:!0}:e}function ue(e){let t=`runs`in e?e.runs[0]:e;return t?`/tasks/${t.id}`:`/`}var R=n(),de=`inline-flex h-[26px] min-w-0 max-w-full items-center gap-1.5 rounded-full border border-control-border bg-card px-2.5 text-xs font-medium text-muted-foreground transition-colors focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-link-foreground hover:bg-muted hover:text-foreground disabled:pointer-events-none disabled:border-dashed disabled:bg-muted`,fe=(0,R.jsx)(a,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-supporting-foreground`}),pe=(0,T.createContext)(null),z=e=>Number.parseFloat(e)||0;function me({pill:e,box:t,full:n}){let r=getComputedStyle(e),i=[...e.children].filter(e=>{if(e===t)return!1;let n=getComputedStyle(e);return n.display!==`none`&&n.position!==`absolute`});return i.reduce((e,t)=>e+t.getBoundingClientRect().width,0)+z(r.columnGap)*i.length+n.getBoundingClientRect().width+z(r.paddingLeft)+z(r.paddingRight)+z(r.borderLeftWidth)+z(r.borderRightWidth)}function he(e){for(let t=e.parentElement;t;t=t.parentElement){if(t.dataset.slot===`picker-pill-disabled-wrapper`)continue;let e=getComputedStyle(t).display;if(e===`grid`||e===`flex`)return t}return e.parentElement}function ge(e){let t=new Map;for(let n of e){let e=he(n.pill),r=t.get(e)??new Map,i=Math.round(n.pill.getBoundingClientRect().top);r.set(i,[...r.get(i)??[],n]),t.set(e,r)}for(let[e,n]of t){let t=getComputedStyle(e),r=e.clientWidth-z(t.paddingLeft)-z(t.paddingRight);for(let e of n.values())if(e.reduce((e,t)=>e+me(t),0)+z(t.columnGap)*(e.length-1)>r+.5)return!1}return!0}function _e({children:e}){let t=(0,T.useRef)(new Map),n=(0,T.useRef)(null),[r,i]=(0,T.useState)(!0),a=(0,T.useCallback)(()=>i(ge([...t.current.values()])),[]),o=(0,T.useCallback)((e,r)=>{if(t.current.set(e,r),typeof ResizeObserver<`u`){n.current??=new ResizeObserver(a);for(let e of[r.box,r.full,he(r.pill)])n.current.observe(e)}return a(),()=>{if(t.current.delete(e),typeof ResizeObserver<`u`)for(let e of[r.box,r.full])n.current?.unobserve(e);a()}},[a]);(0,T.useLayoutEffect)(()=>()=>n.current?.disconnect(),[]);let s=(0,T.useMemo)(()=>({register:o,showPrefixes:r}),[o,r]);return(0,R.jsx)(pe.Provider,{value:s,children:e})}function ve({field:e,children:t}){let n=(0,T.useRef)(null),r=(0,T.useRef)(null),i=(0,T.useContext)(pe),a=i?.register,o=(0,T.useId)(),[s,c]=(0,T.useState)(!0);(0,T.useLayoutEffect)(()=>{let e=n.current,t=r.current;if(a){let n=e.closest(`[data-slot$="pill"]`);return n?a(o,{pill:n,box:e,full:t}):void 0}let i=()=>c(t.getBoundingClientRect().width<=e.getBoundingClientRect().width+.5);if(i(),typeof ResizeObserver>`u`)return;let s=new ResizeObserver(i);return s.observe(e),s.observe(t),()=>s.disconnect()},[e,t,o,a]);let u=i!==null,d=u?i.showPrefixes:s,f=u&&!d;return(0,R.jsxs)(`span`,{ref:n,className:`relative min-w-0 overflow-hidden`,"aria-hidden":`true`,children:[(0,R.jsxs)(`span`,{ref:r,className:l(`invisible w-max whitespace-nowrap`,f?`absolute left-0 top-0`:`block`),children:[e,` · `,t]}),(0,R.jsxs)(`span`,{"data-slot":`picker-label`,className:l(`block truncate`,f?`relative`:`absolute inset-0`),children:[d?(0,R.jsxs)(`span`,{className:`text-muted-foreground`,children:[e,` · `]}):null,t]})]})}function ye({slot:e,ariaLabel:t,label:n,value:r,options:o,onPick:s,disabled:c=!1,readOnly:u=!1,hint:d,disabledHint:f,status:p,searchPlaceholder:m,icon:y,fieldLabel:b=!1}){let[x,S]=(0,T.useState)(!1),[C,w]=(0,T.useState)(``),E=(0,T.useRef)(null),D=(0,T.useRef)(null),O=m?o.filter(e=>e.label.toLowerCase().includes(C.trim().toLowerCase())):o;(0,T.useEffect)(()=>{if(!x||!m)return;let e=window.setTimeout(()=>E.current?.focus());return()=>window.clearTimeout(e)},[x,m]);let k=e=>{E.current&&document.activeElement===E.current&&e.preventDefault()},A=y?` h-11 gap-2 rounded-lg border-border px-3 text-foreground`:``,j=b?`${t} · ${typeof n==`string`?n:o.find(e=>e.value===r)?.label??r}`:t,M=u?f??d:c?f:d,N=b?[j,M].filter(Boolean).join(` — `):M,P=(0,R.jsxs)(R.Fragment,{children:[y,b?(0,R.jsx)(ve,{field:t,children:n}):(0,R.jsx)(`span`,{className:`min-w-0 truncate`,title:typeof n==`string`?n:void 0,children:n})]});if(u)return(0,R.jsxs)(`span`,{"data-slot":e,"aria-label":j,title:N,className:l(de,A,`cursor-default hover:bg-card hover:text-muted-foreground`),children:[P,b?(0,R.jsx)(`span`,{className:`sr-only`,children:j}):null]});let F=(0,R.jsxs)(`button`,{type:`button`,"data-slot":e,"aria-label":j,disabled:c,title:N,className:l(de,A),children:[P,y?(0,R.jsx)(a,{"aria-hidden":`true`,className:`size-[13px] shrink-0 text-muted-foreground`}):fe]});return c?(0,R.jsx)(`span`,{"data-slot":`picker-pill-disabled-wrapper`,title:N,className:`inline-flex min-w-0 max-w-full`,children:F}):(0,R.jsxs)(te,{open:x,onOpenChange:e=>{S(e),e||w(``)},children:[(0,R.jsx)(g,{asChild:!0,children:F}),(0,R.jsxs)(_,{ref:D,align:`start`,"data-testid":`${e}-menu`,children:[m?(0,R.jsxs)(`div`,{className:`mb-1 flex min-h-11 items-center gap-2 border-b border-border px-2`,children:[(0,R.jsx)(i,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,R.jsx)(`input`,{ref:E,type:`search`,"aria-label":m,placeholder:m,value:C,onChange:e=>w(e.target.value),onKeyDown:e=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault(),e.stopPropagation();let t=D.current?.querySelectorAll(`[role="menuitemradio"]:not([data-disabled])`);(e.key===`ArrowDown`?t?.[0]:t?.[t.length-1])?.focus()}else e.key!==`Escape`&&e.stopPropagation()},className:`h-11 w-48 min-w-0 bg-transparent text-sm outline-none placeholder:text-muted-foreground`})]}):null,(0,R.jsx)(v,{value:r,onValueChange:s,children:O.map(e=>(0,R.jsx)(h,{value:e.value,className:l(`gap-2.5`,m&&`min-h-11`),onPointerMove:k,onPointerLeave:k,onKeyDown:t=>{E.current&&(t.key===`ArrowUp`&&e===O[0]||t.key===`Tab`&&t.shiftKey)&&(t.preventDefault(),t.stopPropagation(),E.current.focus())},children:(0,R.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,R.jsx)(`span`,{className:`text-[13px] font-medium`,children:e.label}),e.desc?(0,R.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:e.desc}):null]})},e.value))}),m&&O.length===0?(0,R.jsx)(`p`,{role:`status`,className:`px-2 py-5 text-center text-xs text-muted-foreground`,children:`No matches found.`}):null,p?(0,R.jsx)(ee,{disabled:!0,onPointerMove:k,onPointerLeave:k,className:`border-t border-border text-[11px] text-muted-foreground`,children:p}):null]})]})}var B=(e,t)=>t===null?e:`${e}:${t}`;function be({runners:e,value:t,onPick:n,disabled:r=!1,accounts:i=[],account:a=null,repoAccount:o,icon:s,fieldLabel:c}){let l=O.filter(t=>e.includes(t.id)).flatMap(e=>{let t=i.filter(t=>t.provider===e.id);return t.length<2?[{value:B(e.id,null),label:e.id,desc:e.desc}]:t.map(t=>({value:B(e.id,t.id),label:`${e.id} · ${t.label}`,desc:t.configDir}))}),u=a??o?.[t]??`default`,d=l.some(e=>e.value===B(t,u))?B(t,u):B(t,null);return(0,R.jsx)(ye,{icon:s,fieldLabel:c,slot:`runner-pill`,ariaLabel:`Runner`,label:l.find(e=>e.value===d)?.label??t,value:d,disabled:r,onPick:e=>{let[t,r]=e.split(`:`);n(t,r??null)},options:l})}var xe=1,Se=.9,Ce=.8,we=.17,V=.1,H=.999,Te=.9999,Ee=.99,De=/[\\\/_+.#"@\[\(\{&]/,Oe=/[\\\/_+.#"@\[\(\{&]/g,ke=/[\s-]/,Ae=/[\s-]/g;function U(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?xe:Ee;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var c=r.charAt(a),l=n.indexOf(c,i),u=0,d,f,p,m;l>=0;)d=U(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=xe:De.test(e.charAt(l-1))?(d*=Ce,p=e.slice(i,l-1).match(Oe),p&&i>0&&(d*=H**+p.length)):ke.test(e.charAt(l-1))?(d*=Se,m=e.slice(i,l-1).match(Ae),m&&i>0&&(d*=H**+m.length)):(d*=we,i>0&&(d*=H**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=Te)),(d<V&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=U(e,t,n,r,l+1,a+2,o),f*V>d&&(d=f*V)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function je(e){return e.toLowerCase().replace(Ae,` `)}function Me(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,U(e,t,je(e),je(t),0,0,{})}var W=`[cmdk-group=""]`,G=`[cmdk-group-items=""]`,Ne=`[cmdk-group-heading=""]`,Pe=`[cmdk-item=""]`,Fe=`${Pe}:not([aria-disabled="true"])`,K=`cmdk-item-select`,q=`data-value`,Ie=(e,t,n)=>Me(e,t,n),Le=T.createContext(void 0),J=()=>T.useContext(Le),Re=T.createContext(void 0),ze=()=>T.useContext(Re),Be=T.createContext(void 0),Ve=T.forwardRef((e,t)=>{let n=Z(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=Z(()=>new Set),i=Z(()=>new Map),a=Z(()=>new Map),c=Z(()=>new Set),l=Qe(e),{label:u,children:d,value:f,onValueChange:p,filter:m,shouldFilter:h,loop:ee,disablePointerSelection:g=!1,vimBindings:_=!0,...v}=e,te=o(),y=o(),b=o(),x=T.useRef(null),S=et();X(()=>{if(f!==void 0){let e=f.trim();n.current.value=e,C.emit()}},[f]),X(()=>{S(6,A)},[]);let C=T.useMemo(()=>({subscribe:e=>(c.current.add(e),()=>c.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,a,o;if(!Object.is(n.current[e],t)){if(n.current[e]=t,e===`search`)k(),D(),S(1,O);else if(e===`value`){if(document.activeElement.hasAttribute(`cmdk-input`)||document.activeElement.hasAttribute(`cmdk-root`)){let e=document.getElementById(b);e?e.focus():(i=document.getElementById(te))==null||i.focus()}if(S(7,()=>{n.current.selectedItemId=j()?.id,C.emit()}),r||S(5,A),l.current?.value!==void 0){let e=t??``;(o=(a=l.current).onValueChange)==null||o.call(a,e);return}}C.emit()}},emit:()=>{c.current.forEach(e=>e())}}),[]),w=T.useMemo(()=>({value:(e,t,r)=>{t!==a.current.get(e)?.value&&(a.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,E(t,r)),S(2,()=>{D(),C.emit()}))},item:(e,t)=>(r.current.add(e),t&&(i.current.has(t)?i.current.get(t).add(e):i.current.set(t,new Set([e]))),S(3,()=>{k(),D(),n.current.value||O(),C.emit()}),()=>{a.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=j();S(4,()=>{k(),t?.getAttribute(`id`)===e&&O(),C.emit()})}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{a.current.delete(e),i.current.delete(e)}),filter:()=>l.current.shouldFilter,label:u||e[`aria-label`],getDisablePointerSelection:()=>l.current.disablePointerSelection,listId:te,inputId:b,labelId:y,listInnerRef:x}),[]);function E(e,t){let r=l.current?.filter??Ie;return e?r(e,n.current.search,t):0}function D(){if(!n.current.search||l.current.shouldFilter===!1)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=i.current.get(n),a=0;r.forEach(t=>{let n=e.get(t);a=Math.max(n,a)}),t.push([n,a])});let r=x.current;M().sort((t,n)=>{let r=t.getAttribute(`id`),i=n.getAttribute(`id`);return(e.get(i)??0)-(e.get(r)??0)}).forEach(e=>{let t=e.closest(G);t?t.appendChild(e.parentElement===t?e:e.closest(`${G} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${G} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=x.current?.querySelector(`${W}[${q}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function O(){let e=M().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(q);C.setState(`value`,e||void 0)}function k(){if(!n.current.search||l.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let t of r.current){let r=E(a.current.get(t)?.value??``,a.current.get(t)?.keywords??[]);n.current.filtered.items.set(t,r),r>0&&e++}for(let[e,t]of i.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=e}function A(){var e;let t=j();t&&(t.parentElement?.firstChild===t&&((e=t.closest(W)?.querySelector(Ne))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function j(){return x.current?.querySelector(`${Pe}[aria-selected="true"]`)}function M(){return Array.from(x.current?.querySelectorAll(Fe)||[])}function N(e){let t=M()[e];t&&C.setState(`value`,t.getAttribute(q))}function P(e){var t;let n=j(),r=M(),i=r.findIndex(e=>e===n),a=r[i+e];(t=l.current)!=null&&t.loop&&(a=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),a&&C.setState(`value`,a.getAttribute(q))}function F(e){let t=j()?.closest(W),n;for(;t&&!n;)t=e>0?Xe(t,W):Ze(t,W),n=t?.querySelector(Fe);n?C.setState(`value`,n.getAttribute(q)):P(e)}let ne=()=>N(M().length-1),I=e=>{e.preventDefault(),e.metaKey?ne():e.altKey?F(1):P(1)},L=e=>{e.preventDefault(),e.metaKey?N(0):e.altKey?F(-1):P(-1)};return T.createElement(s.div,{ref:t,tabIndex:-1,...v,"cmdk-root":``,onKeyDown:e=>{var t;(t=v.onKeyDown)==null||t.call(v,e);let n=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||n))switch(e.key){case`n`:case`j`:_&&e.ctrlKey&&I(e);break;case`ArrowDown`:I(e);break;case`p`:case`k`:_&&e.ctrlKey&&L(e);break;case`ArrowUp`:L(e);break;case`Home`:e.preventDefault(),N(0);break;case`End`:e.preventDefault(),ne();break;case`Enter`:{e.preventDefault();let t=j();if(t){let e=new Event(K);t.dispatchEvent(e)}}}}},T.createElement(`label`,{"cmdk-label":``,htmlFor:w.inputId,id:w.labelId,style:nt},u),$(e,e=>T.createElement(Re.Provider,{value:C},T.createElement(Le.Provider,{value:w},e))))}),He=T.forwardRef((e,t)=>{let n=o(),i=T.useRef(null),a=T.useContext(Be),c=J(),l=Qe(e),u=l.current?.forceMount??a?.forceMount;X(()=>{if(!u)return c.item(n,a?.id)},[u]);let d=$e(n,i,[e.value,e.children,i],e.keywords),f=ze(),p=Q(e=>e.value&&e.value===d.current),m=Q(e=>u||c.filter()===!1?!0:!e.search||e.filtered.items.get(n)>0);T.useEffect(()=>{let t=i.current;if(!(!t||e.disabled))return t.addEventListener(K,h),()=>t.removeEventListener(K,h)},[m,e.onSelect,e.disabled]);function h(){var e,t;ee(),(t=(e=l.current).onSelect)==null||t.call(e,d.current)}function ee(){f.setState(`value`,d.current,!0)}if(!m)return null;let{disabled:g,value:_,onSelect:v,forceMount:te,keywords:y,...b}=e;return T.createElement(s.div,{ref:r(i,t),...b,id:n,"cmdk-item":``,role:`option`,"aria-disabled":!!g,"aria-selected":!!p,"data-disabled":!!g,"data-selected":!!p,onPointerMove:g||c.getDisablePointerSelection()?void 0:ee,onClick:g?void 0:h},e.children)}),Ue=T.forwardRef((e,t)=>{let{heading:n,children:i,forceMount:a,...c}=e,l=o(),u=T.useRef(null),d=T.useRef(null),f=o(),p=J(),m=Q(e=>a||p.filter()===!1?!0:!e.search||e.filtered.groups.has(l));X(()=>p.group(l),[]),$e(l,u,[e.value,e.heading,d]);let h=T.useMemo(()=>({id:l,forceMount:a}),[a]);return T.createElement(s.div,{ref:r(u,t),...c,"cmdk-group":``,role:`presentation`,hidden:!m||void 0},n&&T.createElement(`div`,{ref:d,"cmdk-group-heading":``,"aria-hidden":!0,id:f},n),$(e,e=>T.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?f:void 0},T.createElement(Be.Provider,{value:h},e))))}),We=T.forwardRef((e,t)=>{let{alwaysRender:n,...i}=e,a=T.useRef(null),o=Q(e=>!e.search);return!n&&!o?null:T.createElement(s.div,{ref:r(a,t),...i,"cmdk-separator":``,role:`separator`})}),Ge=T.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=ze(),o=Q(e=>e.search),c=Q(e=>e.selectedItemId),l=J();return T.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),T.createElement(s.input,{ref:t,...r,"cmdk-input":``,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":!0,"aria-controls":l.listId,"aria-labelledby":l.labelId,"aria-activedescendant":c,id:l.inputId,type:`text`,value:i?e.value:o,onChange:e=>{i||a.setState(`search`,e.target.value),n?.(e.target.value)}})}),Ke=T.forwardRef((e,t)=>{let{children:n,label:i=`Suggestions`,...a}=e,o=T.useRef(null),c=T.useRef(null),l=Q(e=>e.selectedItemId),u=J();return T.useEffect(()=>{if(c.current&&o.current){let e=c.current,t=o.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty(`--cmdk-list-height`,n.toFixed(1)+`px`)})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),T.createElement(s.div,{ref:r(o,t),...a,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":l,"aria-label":i,id:u.listId},$(e,e=>T.createElement(`div`,{ref:r(c,u.listInnerRef),"cmdk-list-sizer":``},e)))}),qe=T.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return T.createElement(d,{open:n,onOpenChange:r},T.createElement(f,{container:o},T.createElement(p,{"cmdk-overlay":``,className:i}),T.createElement(u,{"aria-label":e.label,"cmdk-dialog":``,className:a},T.createElement(Ve,{ref:t,...s}))))}),Je=T.forwardRef((e,t)=>Q(e=>e.filtered.count===0)?T.createElement(s.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),Ye=T.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return T.createElement(s.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},$(e,e=>T.createElement(`div`,{"aria-hidden":!0},e)))}),Y=Object.assign(Ve,{List:Ke,Item:He,Input:Ge,Group:Ue,Separator:We,Dialog:qe,Empty:Je,Loading:Ye});function Xe(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function Ze(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function Qe(e){let t=T.useRef(e);return X(()=>{t.current=e}),t}var X=typeof window>`u`?T.useEffect:T.useLayoutEffect;function Z(e){let t=T.useRef();return t.current===void 0&&(t.current=e()),t}function Q(e){let t=ze(),n=()=>e(t.snapshot());return T.useSyncExternalStore(t.subscribe,n,n)}function $e(e,t,n,r=[]){let i=T.useRef(),a=J();return X(()=>{var o;let s=(()=>{for(let e of n){if(typeof e==`string`)return e.trim();if(typeof e==`object`&&`current`in e)return e.current?e.current.textContent?.trim():i.current}})(),c=r.map(e=>e.trim());a.value(e,s,c),(o=t.current)==null||o.setAttribute(q,s),i.current=s}),i}var et=()=>{let[e,t]=T.useState(),n=Z(()=>new Map);return X(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function tt(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function $({asChild:e,children:t},n){return e&&T.isValidElement(t)?T.cloneElement(tt(t),{ref:t.ref},n(t.props.children)):n(t)}var nt={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`};function rt({className:e,...t}){return(0,R.jsx)(Y,{"data-slot":`command`,className:l(`flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground`,e),...t})}function it({title:e=`Command Palette`,description:t=`Search for a command to run...`,children:n,className:r,showCloseButton:i=!0,filter:a,...o}){return(0,R.jsxs)(b,{...o,children:[(0,R.jsxs)(x,{className:`sr-only`,children:[(0,R.jsx)(C,{children:e}),(0,R.jsx)(y,{children:t})]}),(0,R.jsx)(S,{className:l(`overflow-hidden p-0`,r),showCloseButton:i,children:(0,R.jsx)(rt,{filter:a,className:`**:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5`,children:n})})]})}function at({className:e,...t}){return(0,R.jsxs)(`div`,{"data-slot":`command-input-wrapper`,className:`flex h-9 shrink-0 items-center gap-2 border-b px-3 max-md:h-[44px]`,children:[(0,R.jsx)(i,{className:`size-4 shrink-0 opacity-50`}),(0,R.jsx)(Y.Input,{"data-slot":`command-input`,className:l(`flex h-10 w-full rounded-md bg-transparent py-3 text-base md:text-sm outline-hidden placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50`,e),...t})]})}function ot({className:e,onPointerMoveCapture:t,...n}){return(0,R.jsx)(Y.List,{"data-slot":`command-list`,onPointerMoveCapture:e=>{t?.(e),e.pointerType===`touch`&&e.stopPropagation()},className:l(`max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto`,e),...n})}function st({...e}){return(0,R.jsx)(Y.Empty,{"data-slot":`command-empty`,className:`py-6 text-center text-sm`,...e})}function ct({className:e,...t}){return(0,R.jsx)(Y.Group,{"data-slot":`command-group`,className:l(`overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground`,e),...t})}function lt({className:e,...t}){return(0,R.jsx)(Y.Separator,{"data-slot":`command-separator`,className:l(`-mx-1 h-px bg-border`,e),...t})}function ut({className:e,...t}){return(0,R.jsx)(Y.Item,{"data-slot":`command-item`,className:l(`relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground`,e),...t})}function dt({className:e,...t}){return(0,R.jsx)(`span`,{"data-slot":`command-shortcut`,className:l(`ml-auto text-xs tracking-widest text-muted-foreground`,e),...t})}var ft=80,pt=2e3,mt=50,ht=200,gt=50,_t=[{id:`add-tests`,label:`Add tests`,text:`Also add or update tests covering this change.`},{id:`explain-change`,label:`Explain the change`,text:`Explain what changed and why before finishing.`},{id:`keep-minimal`,label:`Keep it minimal`,text:`Keep the change as small and targeted as possible — no unrelated refactors.`},{id:`update-docs`,label:`Update docs`,text:`Also update any relevant documentation or comments.`},{id:`check-edge-cases`,label:`Double-check edge cases`,text:`Double-check edge cases and error handling before finishing.`}];function vt(e){return!!e&&typeof e==`object`}function yt(e){if(e===void 0||!Array.isArray(e))return _t.map(e=>({...e}));let t=new Set,n=[];for(let r of e){if(!vt(r))continue;let e=typeof r.id==`string`?r.id.trim():``,i=typeof r.label==`string`?r.label.trim():``,a=typeof r.text==`string`?r.text.trim():``;if(!e||!i||!a||t.has(e))continue;t.add(e);let o=bt(r.skills);if(n.push({id:e,label:i.slice(0,ft),text:a.slice(0,pt),...o.length>0?{skills:o}:{}}),n.length>=mt)break}return n}function bt(e){if(!Array.isArray(e))return[];let t=new Set;for(let n of e){if(typeof n!=`string`)continue;let e=n.trim();if(!(!e||t.has(e))&&(t.add(e.slice(0,ht)),t.size>=gt))break}return[...t]}function xt(e,t){if(t.length===0)return[];let n=new Set(t);return e.filter(e=>e.skills?.some(e=>n.has(e)))}function St(e,t){return xt(e,t).map(e=>e.text).join(`
2
+
3
+ `)}function Ct(e,t,n,r=``){if(e===``||e===r||e===t){let e=r&&n?`${r}\n\n${n}`:r||n;return{text:e,applied:n?e:``}}return{text:e,applied:t}}function wt(){return`tpl-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`}function Tt(e,t,n){let r=Math.max(0,Math.min(t,e.length)),i=e.slice(0,r),a=e.slice(r),o=``;i.length>0&&(o=i.endsWith(`
4
+
5
+ `)?``:i.endsWith(`
6
+ `)?`
7
+ `:`
8
+
9
+ `);let s=a.replace(/^[ \t]+/,``),c=``;return s.length>0&&(c=s.startsWith(`
10
+
11
+ `)?``:s.startsWith(`
12
+ `)?`
13
+ `:`
14
+
15
+ `),{text:i+o+n+c+s,caret:i.length+o.length+n.length}}function Et({prompt:e,base:t,selectionStart:n,focused:r,remembered:i}){return e===t?e.length:r&&n!=null||n!=null&&n>0?n:i??e.length}export{M as A,O as C,I as D,j as E,ue as F,le as I,w as L,re as M,se as N,F as O,ie as P,E as S,ce as T,ye as _,yt as a,fe as b,rt as c,ct as d,at as f,dt as g,lt as h,wt as i,ae as j,D as k,it as l,ot as m,St as n,Ct as o,ut as p,Tt as r,Et as s,_t as t,st as u,_e as v,L as w,de as x,be as y};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{D as r,E as i,F as a,Fr as o,Gt as s,Hi as c,J as l,K as u,M as d,Nt as f,Pt as p,Si as m,St as h,U as g,Ui as _,Xr as ee,Z as v,Zr as te,gn as y,nt as b,pn as ne,rt as re,sa as ie,t as ae,ta as x,tt as oe}from"./button-C_rd7CPp.js";import{s as S,t as C}from"./utils-JsL3ZsJf.js";import{$t as se,Ct as w,Et as ce,Rt as le,Tt as ue,Wn as de,_ as T,a as E,b as D,c as O,et as fe,i as k,ln as A,n as j,o as M,qn as N,r as P,s as F,t as I,wt as L}from"./alert-dialog-BrpNUwMt.js";import{t as R}from"./createLucideIcon-BHp8sXmF.js";import{t as pe}from"./status-dot-CqTJHSP9.js";import{l as me,n as z,y as he}from"./nav-row-styles-vp2JbhuJ.js";import{n as B}from"./diff-controls-B1-j7nFg.js";import{i as ge,r as _e,t as ve}from"./git-toolbar-Cw4ljmhB.js";import{t as V}from"./info-DA1x_4bz.js";import{f as ye,n as H,r as U}from"./format-DpNe3S0A.js";import{t as be}from"./search-x-I9Q8pgUa.js";import{i as W,l as xe,p as Se,r as Ce,t as we}from"./dropdown-menu-BegOZFrj.js";import{A as G,C as Te,D as Ee,Dt as De,E as Oe,O as ke,Ot as K,S as Ae,T as je,_ as Me,b as Ne,g as Pe,ht as Fe,k as Ie,kt as Le,ln as q,lt as Re,nn as ze,st as Be,ut as Ve,v as He,w as Ue,x as We,y as Ge}from"./index-DgWWlOLy.js";import{t as J}from"./diff-DrEARXTV.js";var Y=e(t(),1);function Ke(e,t){let n=x(t),r=n.getQueryCache();return Y.useSyncExternalStore(Y.useCallback(e=>r.subscribe(ie.batchCalls(e)),[r]),()=>n.isFetching(e),()=>n.isFetching(e))}var qe=R(`arrow-down-to-line`,[[`path`,{d:`M12 17V3`,key:`1cwfxf`}],[`path`,{d:`m6 11 6 6 6-6`,key:`12ii2o`}],[`path`,{d:`M19 21H5`,key:`150jfl`}]]),Je=R(`git-pull-request-create`,[[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M6 9v12`,key:`1sc30k`}],[`path`,{d:`M13 6h3a2 2 0 0 1 2 2v3`,key:`1jb6z3`}],[`path`,{d:`M18 15v6`,key:`9wciyi`}],[`path`,{d:`M21 18h-6`,key:`139f0c`}]]),X=n();function Ye(){let e=S(),t=w(),n=x(),r=Ke({queryKey:D.repo})>0,i=t.data?.info?t.data:null,a=Pe(e,i,`screen`);return(0,X.jsxs)(`div`,{"data-route":`repo-git`,"data-slot":`git-screen`,className:z,children:[(0,X.jsxs)(`div`,{className:`mb-[16px] flex items-center gap-[8px]`,children:[(0,X.jsx)(`h1`,{className:C(me,`min-w-0 flex-1`),children:`Git`}),(0,X.jsx)(`button`,{type:`button`,"data-slot":`git-screen-refresh`,"aria-label":`Refresh the repository`,title:`Refresh the repository`,disabled:r,onClick:()=>{n.invalidateQueries({queryKey:D.repo}),n.invalidateQueries({queryKey:D.worktrees})},className:`-my-2 -mr-[10px] flex size-11 shrink-0 items-center justify-center rounded-md text-soft-foreground hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-60`,children:(0,X.jsx)(h,{size:17,"aria-hidden":`true`,className:C(`size-[17px]`,r&&`motion-safe:animate-spin`)})})]}),i?.info?(0,X.jsx)(`div`,{className:`mb-[16px]`,children:(0,X.jsx)(We,{scope:e,repo:i,info:i.info,variant:`screen`},e)}):t.isPending?(0,X.jsx)(`p`,{"data-slot":`git-screen-loading`,role:`status`,className:`mb-[16px] px-[10px] text-[13px] text-soft-foreground`,children:`Loading the checkout…`}):t.isError?(0,X.jsxs)(`p`,{"data-slot":`git-screen-error`,role:`alert`,className:`mb-[16px] px-[10px] text-[13px] text-danger`,children:[`Could not load the repository: `,t.error.message]}):(0,X.jsx)(`p`,{"data-slot":`git-screen-not-git`,className:`mb-[16px] px-[10px] text-[13px] text-soft-foreground`,children:`Not a git repository.`}),t.isPending?null:(0,X.jsx)(Ge,{branch:i?.info?.branch??null,counts:a,variant:`screen`})]})}function Xe(){let e=ue(),t=G(),[n,r]=(0,Y.useState)(`unified`),[i,a]=(0,Y.useState)(!1),[o,c]=(0,Y.useState)(null),u=(0,Y.useRef)(null),d=e.isError&&e.error instanceof s&&e.error.status===409,f=e.data?.files??[],m=(0,Y.useMemo)(()=>_e(f),[f]),h=t?n:`unified`,g=!t||i;return(0,X.jsxs)(`section`,{"data-slot":`repo-changes`,className:`flex min-h-0 flex-1 flex-col`,children:[(0,X.jsxs)(`div`,{"data-slot":`repo-changes-toolbar`,className:`flex flex-wrap items-center gap-x-2.5 gap-y-1.5 px-[18px] py-[22px] md:px-9`,children:[(0,X.jsx)(`span`,{className:`text-sm`,children:e.data?`${e.data.stat.files} files changed ·`:`Uncommitted changes`}),e.data?(0,X.jsx)(ve,{stat:e.data.stat}):null,(0,X.jsx)(`span`,{className:`ml-auto hidden items-center gap-1 md:flex`,children:(0,X.jsx)(B,{mode:n,wrap:i,onModeChange:r,onWrapChange:a})})]}),e.isPending?(0,X.jsx)(`p`,{"data-slot":`changes-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-9`,children:`Loading changes…`}):e.isError?(0,X.jsx)(T,{icon:d?(0,X.jsx)(l,{size:16}):(0,X.jsx)(p,{size:16}),tone:d?`neutral`:`danger`,heading:`h2`,title:d?`No changes to show`:`Could not load the changes`,subtitle:e.error.message}):f.length===0?(0,X.jsx)(T,{icon:(0,X.jsx)(l,{size:16}),tone:`neutral`,heading:`h2`,title:`Working tree clean`,subtitle:`No uncommitted changes in the main working tree. Edits show up here as they happen.`}):(0,X.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col items-stretch gap-5 md:flex-row md:items-start px-[18px] pb-9 pt-0 [--diff-sticky-top:1rem] md:px-9`,children:[(0,X.jsxs)(`aside`,{"data-slot":`changes-tree-pane`,className:`md:sticky md:top-4 md:max-h-[calc(100dvh_-_64px_-_var(--diff-sticky-top)_-_1rem)] w-full md:w-60 shrink-0 overflow-y-auto overscroll-contain rounded-xl border border-border bg-card p-3.5 lg:w-[250px]`,children:[(0,X.jsx)(`h2`,{className:`mb-3 border-b border-border pb-3 text-xs font-semibold`,children:`Changed files`}),(0,X.jsx)(ge,{root:m,selected:o,onSelect:e=>{c(e),u.current?.scrollToPath(e)}})]}),(0,X.jsx)(J,{files:f,viewRef:u,mode:h,wrap:g,className:`min-w-0 flex-1`})]})]})}function Ze({repo:e,info:t}){let{sha:n}=c(),r=e.log,i=(0,Y.useMemo)(()=>ke(r),[r]);if(n)return(0,X.jsx)(et,{sha:n});let a=Oe(e,t),o=a&&a.behind>0?(0,X.jsx)($e,{info:t,tracking:a}):null;return r.length===0?(0,X.jsxs)(X.Fragment,{children:[o?(0,X.jsx)(`div`,{className:`px-[8px] pt-[12px] md:px-[20px]`,children:o}):null,(0,X.jsx)(T,{icon:(0,X.jsx)(b,{size:16}),tone:`neutral`,heading:`h2`,title:`No commits yet`,subtitle:`The log is empty — this repository has no commits to show.`})]}):(0,X.jsxs)(`div`,{"data-slot":`repo-commits`,className:`flex flex-col gap-[2px] px-[8px] pt-[12px] pb-[20px] md:px-[20px]`,children:[o,i.map(e=>(0,X.jsxs)(`section`,{"data-slot":`repo-commit-day`,"aria-label":e.label,className:`flex flex-col`,children:[(0,X.jsx)(`h2`,{className:`px-[10px] pt-[14px] pb-[4px] text-[11px] font-medium text-soft-foreground`,children:e.label}),(0,X.jsx)(`ul`,{className:`flex flex-col`,children:e.commits.map(e=>(0,X.jsxs)(`li`,{className:`flex min-h-[52px] items-center gap-[14px] rounded-[6px] hover:bg-sidebar-row-hover`,children:[(0,X.jsxs)(U,{to:`/git/commits/${e.hash}`,"data-slot":`commit-row`,"data-sha":e.hash,className:`flex min-h-[52px] min-w-0 flex-1 flex-col justify-center gap-[3px] rounded-[6px] px-[10px] py-[6px] focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,X.jsx)(`span`,{"data-slot":`commit-row-subject`,className:`truncate text-[13px] text-foreground`,children:e.subject}),(0,X.jsxs)(`span`,{"data-slot":`commit-row-meta`,className:`flex min-w-0 items-center gap-[6px] text-[11px] text-soft-foreground`,children:[(0,X.jsx)(`span`,{className:`shrink-0 font-mono`,children:e.hash}),(0,X.jsxs)(`span`,{className:`truncate`,children:[`· `,e.author,` · `,Ie(e.when)]})]})]}),(0,X.jsx)(Qe,{source:e.source})]},e.hash))})]},e.label))]})}function Qe({source:e}){let t=`hidden max-w-[45%] shrink-0 items-center gap-[5px] pr-[10px] text-[11.5px] text-soft-foreground md:flex`;return e?(0,X.jsxs)(U,{to:`/tasks/${e.runId}`,"data-slot":`commit-source`,"data-source":`task`,"aria-label":`From the task ${e.title}${e.prNumber===null?``:`, pull request #${e.prNumber}`}`,className:C(t,`rounded-[4px] hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring`),children:[e.prNumber===null?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(re,{"aria-hidden":`true`,className:`size-[11px] shrink-0 text-merged-text`}),(0,X.jsxs)(`span`,{className:`shrink-0 text-muted-foreground`,children:[`PR #`,e.prNumber]})]}),(0,X.jsx)(d,{"aria-hidden":`true`,className:`size-[12px] shrink-0`}),(0,X.jsx)(`span`,{className:`min-w-0 truncate`,children:e.title})]}):(0,X.jsx)(`span`,{"data-slot":`commit-source`,"data-source":`unknown`,className:t,children:`no task found`})}function $e({info:e,tracking:t}){let n=Te(S(),e),r=(0,Y.useRef)(null);return(0,X.jsxs)(`div`,{"data-slot":`git-incoming`,className:`mb-[4px] flex min-h-[40px] items-center gap-[8px] rounded-[8px] border border-border px-[10px] py-[6px]`,children:[(0,X.jsx)(qe,{"aria-hidden":`true`,className:`size-[14px] shrink-0 text-inbox-count-foreground`}),(0,X.jsxs)(`span`,{className:`min-w-0 flex-1 text-[12.5px] text-muted-foreground`,children:[t.behind,` commit`,t.behind===1?``:`s`,` on `,t.ref,` `,t.behind===1?`is`:`are`,` not in your checkout yet`]}),(0,X.jsxs)(`button`,{ref:r,type:`button`,"data-action":`repo-pull-incoming`,disabled:!n.hasRemote||n.pulling,onClick:()=>void n.pull(),className:`inline-flex h-[26px] shrink-0 items-center gap-[4px] rounded-[6px] bg-muted px-[10px] text-[12px] font-medium text-foreground hover:brightness-110 focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-50 max-md:h-11 [&>svg]:size-[12px]`,children:[n.pulling?(0,X.jsx)(ye,{"aria-hidden":`true`,className:`motion-safe:animate-spin`}):(0,X.jsx)(i,{"aria-hidden":`true`}),`Pull`]}),(0,X.jsx)(Ae,{checkout:n,returnFocus:r})]})}function et({sha:e}){let t=ce(e),n=G(),[i,a]=(0,Y.useState)(`unified`),[o,c]=(0,Y.useState)(!1),l=t.isError&&t.error instanceof s&&t.error.status===409,u=n?i:`unified`,d=!n||o;return(0,X.jsxs)(`section`,{"data-slot":`repo-commit`,"data-sha":e,className:`flex min-h-0 flex-1 flex-col`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2.5 gap-y-1.5 border-b border-border px-4 py-2 md:px-6`,children:[(0,X.jsx)(ae,{asChild:!0,variant:`ghost`,size:`sm`,"data-slot":`commit-back`,children:(0,X.jsxs)(U,{to:n?`/git`:Ue,children:[(0,X.jsx)(r,{size:16,"aria-hidden":`true`}),`All recent commits`]})}),t.data?(0,X.jsx)(Fe,{stat:t.data.stat}):null,(0,X.jsx)(`span`,{className:`ml-auto hidden items-center gap-1 md:flex`,children:(0,X.jsx)(B,{mode:i,wrap:o,onModeChange:a,onWrapChange:c})})]}),t.isPending?(0,X.jsx)(`p`,{"data-slot":`commit-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading commit…`}):t.isError?(0,X.jsx)(T,{icon:l?(0,X.jsx)(be,{}):(0,X.jsx)(p,{size:16}),tone:l?`neutral`:`danger`,heading:`h2`,title:l?`Commit not found`:`Could not load the commit`,subtitle:t.error.message}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{"data-slot":`commit-meta`,className:`border-b border-border px-4 py-3 md:px-6`,children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold`,children:t.data.subject}),(0,X.jsxs)(`p`,{className:`mt-0.5 text-[11px] text-soft-foreground`,children:[t.data.author,` · `,t.data.when,` ·`,` `,(0,X.jsx)(`span`,{className:`font-mono select-all`,children:t.data.sha})]})]}),t.data.files.length===0?(0,X.jsx)(T,{icon:(0,X.jsx)(b,{size:16}),tone:`neutral`,heading:`h2`,title:`No file changes`,subtitle:`This commit carries no diff of its own — a merge commit's changes live on the commits it merged.`}):(0,X.jsx)(`div`,{className:`px-4 py-4 [--diff-sticky-top:1rem] md:px-6`,children:(0,X.jsx)(J,{files:t.data.files,mode:u,wrap:d,className:`min-w-0`})})]})]})}var Z=`Squash-merged branches may show as not landed without GitHub`;function tt(e){let t=[],n=[],r=[];for(let i of e)if(i.class===`orphan`)r.push(i);else if(i.class!==`not-landed`)continue;else i.pr&&(i.pr.state===`open`||i.pr.state===`draft`)?n.push(i):t.push(i);return[{key:`no-pr`,title:`No pull request`,note:`nobody sees this work until you act`,rows:t},{key:`pr-open`,title:`Pull request open`,rows:n},{key:`deleted`,title:`Task deleted`,note:`this branch is the only copy of the work`,rows:r}].filter(e=>e.rows.length>0)}function nt(e){return e.filter(e=>e.class===`active`&&e.runId!==null&&e.ahead>0&&(e.runStatus===`done`||e.runStatus===`failed`||e.runStatus===`cancelled`)).length}var Q={done:`success`,failed:`danger`,cancelled:`neutral`};function rt(){let e=L(),t=le(),n=S(),[r,i]=(0,Y.useState)(null);if(e.isPending)return(0,X.jsx)(`p`,{"data-slot":`not-landed-loading`,role:`status`,className:`px-[28px] py-[20px] text-[13px] text-soft-foreground`,children:`Loading branches…`});if(e.isError)return(0,X.jsx)(T,{icon:(0,X.jsx)(p,{size:16}),tone:`danger`,heading:`h2`,title:`Could not classify the branches`,subtitle:e.error.message});let a=tt(e.data.branches),o=nt(e.data.branches),s=o>0?(0,X.jsxs)(`p`,{"data-slot":`not-landed-retained`,className:`flex items-start gap-[6px] px-[10px] pt-[6px] text-[11.5px] leading-[17px] text-soft-foreground`,children:[(0,X.jsx)(V,{"aria-hidden":`true`,className:`mt-[2.5px] size-[12px] shrink-0`}),(0,X.jsxs)(`span`,{children:[o,` finished task`,o===1?` still has its`:`s still have their`,` worktree and commits not on the base, so `,o===1?`it is`:`they are`,` not listed here.`,` `,`They show here once the worktree is reclaimed in `,(0,X.jsx)(U,{to:je.cleanup,className:`underline underline-offset-2 hover:text-foreground`,children:`Cleanup`}),`.`]})]}):null,c=new Map((t.data??[]).map(e=>[e.id,e.finishedAt]));return(0,X.jsxs)(Re,{projectId:n,requests:a.flatMap(e=>e.rows).flatMap(e=>e.pr?[{projectId:n,kind:`PR`,number:e.pr.number}]:[]),children:[(0,X.jsxs)(`div`,{"data-slot":`repo-not-landed`,className:`flex flex-col gap-[2px] px-[8px] pt-[12px] pb-[calc(90px+env(safe-area-inset-bottom))] md:px-[20px] md:pb-[20px]`,children:[e.data.prStateKnown?null:(0,X.jsx)(it,{}),s,a.length===0?(0,X.jsx)(T,{icon:(0,X.jsx)(ze,{size:16}),tone:`neutral`,heading:`h2`,title:o>0?`Nothing else waiting to land`:`Everything landed`,subtitle:o>0?`Every other finished task's commits are on the base branch, or it made none.`:`Every finished task's commits are on the base branch, or it made none.`}):(0,X.jsxs)(X.Fragment,{children:[a.map(e=>(0,X.jsxs)(`section`,{"data-slot":`not-landed-group`,"data-group":e.key,"aria-label":e.title,className:`flex flex-col`,children:[(0,X.jsxs)(`h2`,{className:`flex min-w-0 flex-wrap items-baseline gap-x-[6px] px-[10px] pt-[14px] pb-[6px] text-[11px] text-soft-foreground`,children:[(0,X.jsx)(`span`,{className:`font-medium`,children:e.title}),(0,X.jsx)(`span`,{children:e.rows.length}),e.note?(0,X.jsxs)(`span`,{children:[`· `,e.note]}):null]}),(0,X.jsx)(`ul`,{className:`flex flex-col`,children:e.rows.map(e=>(0,X.jsx)(at,{entry:e,finishedAt:e.runId?c.get(e.runId):void 0,onDelete:()=>i(e)},e.name))})]},e.key)),(0,X.jsxs)(`p`,{"data-slot":`not-landed-note`,className:`flex items-start gap-[6px] px-[10px] pt-[14px] text-[11.5px] leading-[17px] text-soft-foreground`,children:[(0,X.jsx)(V,{"aria-hidden":`true`,className:`mt-[2.5px] size-[12px] shrink-0`}),`Delete branch is in each row's … menu. It confirms and names the commits it drops. Nothing on this list can be bulk-deleted.`]})]})]}),(0,X.jsx)(st,{entry:r,onClose:()=>i(null)})]})}function it({className:e}){return(0,X.jsxs)(`p`,{"data-slot":`git-no-forge`,className:C(`flex items-start gap-[6px] px-[10px] pt-[6px] text-[11.5px] leading-[17px] text-soft-foreground`,e),children:[(0,X.jsx)(V,{"aria-hidden":`true`,className:`mt-[2.5px] size-[12px] shrink-0`}),Z,`.`]})}function at({entry:e,finishedAt:t,onDelete:n}){let r=x(),i=e.class===`orphan`,a=e.pr&&(e.pr.state===`open`||e.pr.state===`draft`)?e.pr:null,o=!i&&e.runId!==null&&!a,c=i?`No task · last commit “${e.lastCommit.subject}”`:e.title??e.name,l=H(t??e.lastCommit.at),d=i||!e.runStatus?l?`${l} ago`:``:`${e.runStatus}${l?` ${l} ago`:``}`,f=N({mutationFn:()=>ne(e.runId),onSuccess:e=>{m(`Draft PR created — ${e.url}`),r.invalidateQueries({queryKey:D.repoBranches}),r.invalidateQueries({queryKey:D.runs.all})},onError:e=>m(e instanceof s&&e.manual?`${e.message} — ${e.manual}`:e.message,{tone:`danger`})}),p=()=>void navigator.clipboard.writeText(e.name).then(()=>m(`Copied ${e.name}`),()=>m(`Could not copy the branch name`,{tone:`danger`})),h=`inline-flex h-[28px] shrink-0 items-center gap-[5px] rounded-[6px] px-[10px] text-[12px] font-medium text-foreground focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-50 [&>svg]:size-[12px]`;return(0,X.jsxs)(`li`,{"data-slot":`not-landed-row`,"data-branch":e.name,"data-branch-class":e.class,className:`flex min-h-[56px] items-center gap-[12px] rounded-[6px] px-[10px] py-[6px] hover:bg-sidebar-row-hover`,children:[(0,X.jsx)(`span`,{className:`flex size-[12px] shrink-0 items-center justify-center`,children:i?(0,X.jsx)(he,{"aria-label":`Task deleted`,className:`size-[12px] text-soft-foreground`}):(0,X.jsx)(pe,{tone:e.runStatus&&Q[e.runStatus]||`neutral`,"aria-label":e.runStatus??void 0})}),(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-[3px]`,children:[e.runId?(0,X.jsx)(U,{to:`/tasks/${e.runId}`,"data-slot":`not-landed-title`,className:`min-w-0 truncate rounded-[2px] text-[13px] text-foreground hover:underline underline-offset-2 focus-visible:outline-2 focus-visible:outline-ring`,children:c}):(0,X.jsx)(`span`,{"data-slot":`not-landed-title`,className:`min-w-0 truncate text-[13px] text-muted-foreground`,title:c,children:c}),(0,X.jsxs)(`span`,{"data-slot":`not-landed-meta`,className:`flex min-w-0 items-center gap-[6px] text-[11px] text-soft-foreground`,children:[(0,X.jsx)(`span`,{className:`shrink-0 font-mono text-muted-foreground`,children:e.name}),(0,X.jsxs)(`span`,{className:`shrink-0`,children:[`· `,e.ahead,` commit`,e.ahead===1?``:`s`]}),e.diffStat?(0,X.jsxs)(`span`,{className:`flex shrink-0 gap-[4px] tabular-nums`,children:[(0,X.jsxs)(`span`,{className:`text-success`,children:[`+`,e.diffStat.additions]}),(0,X.jsxs)(`span`,{className:`text-danger`,children:[`−`,e.diffStat.deletions]})]}):null,d?(0,X.jsxs)(`span`,{className:`truncate`,children:[`· `,d]}):null]})]}),e.pr?(0,X.jsxs)(`span`,{"data-slot":`not-landed-pr`,className:`hidden shrink-0 items-center gap-[4px] text-[11.5px] text-muted-foreground md:flex`,children:[(0,X.jsx)(Be,{plain:!0,reference:{kind:`PR`,number:e.pr.number,url:e.pr.url},taskTitle:e.title??e.name,status:e.pr.state===`draft`?`draft`:e.pr.state===`closed`?`closed`:void 0}),(0,X.jsx)(ot,{entry:e})]}):null,e.runId?(0,X.jsx)(U,{to:`/tasks/${e.runId}`,"data-action":`not-landed-open`,className:C(h,`hidden border border-border hover:bg-muted md:inline-flex`),children:`Open task`}):null,o?(0,X.jsxs)(`button`,{type:`button`,"data-action":`not-landed-create-pr`,disabled:f.isPending,onClick:()=>f.mutate(),className:C(h,`hidden bg-muted hover:brightness-110 md:inline-flex`),children:[(0,X.jsx)(Je,{"aria-hidden":`true`}),f.isPending?`Creating…`:`Create draft PR`]}):null,i?(0,X.jsxs)(`button`,{type:`button`,"data-action":`not-landed-copy`,onClick:p,className:C(h,`hidden border border-border hover:bg-muted md:inline-flex`),children:[(0,X.jsx)(g,{"aria-hidden":`true`}),`Copy branch`]}):null,(0,X.jsxs)(we,{children:[(0,X.jsx)(Se,{"data-action":`not-landed-more`,"aria-label":`More actions for ${e.name}`,className:`flex size-[28px] shrink-0 items-center justify-center rounded-[6px] text-soft-foreground outline-none hover:bg-muted hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring max-md:size-11`,children:(0,X.jsx)(u,{"aria-hidden":`true`,className:`size-[14px]`})}),(0,X.jsxs)(Ce,{align:`end`,className:`w-52`,children:[e.runId?(0,X.jsx)(W,{asChild:!0,className:`md:hidden`,children:(0,X.jsx)(U,{to:`/tasks/${e.runId}`,children:`Open task`})}):null,o?(0,X.jsx)(W,{className:`md:hidden`,disabled:f.isPending,onSelect:()=>f.mutate(),children:`Create draft PR`}):null,(0,X.jsx)(W,{className:C(!i&&`md:hidden`),onSelect:p,children:`Copy branch`}),(0,X.jsx)(xe,{className:`md:hidden`}),(0,X.jsx)(W,{"data-action":`not-landed-delete`,variant:`destructive`,onSelect:n,children:`Delete branch…`})]})]})]})}function ot({entry:e}){let t=de(Ve(`PR`,e.pr?.number).status),n=e.pr?.state;return(0,X.jsxs)(`span`,{"data-slot":`not-landed-pr-state`,children:[`· `,n===`draft`||n===`closed`?n:t?t.label.toLowerCase():`open`]})}function st({entry:e,onClose:t}){let n=x(),[r,i]=(0,Y.useState)(``),a=(0,Y.useId)(),o=N({mutationFn:e=>y({names:[e],confirm:e}),onSuccess:e=>{let t=e.dropped?.length??0;m(e.deleted.length>0?`Deleted ${e.deleted[0]}${t?` and ${t} commit${t===1?``:`s`} with it`:``}`:e.refused[0]?.reason??`Nothing was deleted`),n.invalidateQueries({queryKey:D.repo}),s()},onError:e=>m(e.message,{tone:`danger`})}),s=()=>{i(``),t()},c=e!==null&&r.trim()===e.name,l=e?`${e.ahead} commit${e.ahead===1?``:`s`}`:``;return(0,X.jsx)(I,{open:e!==null,onOpenChange:e=>!e&&!o.isPending&&s(),children:(0,X.jsxs)(k,{"data-slot":`delete-branch-dialog`,children:[(0,X.jsxs)(F,{children:[(0,X.jsxs)(O,{children:[`Delete `,e?.name,`?`]}),(0,X.jsx)(E,{asChild:!0,children:(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(`p`,{children:e?.class===`orphan`?`Its task was deleted, so this branch is the only copy of the work.`:(0,X.jsxs)(X.Fragment,{children:[`This drops the work of `,(0,X.jsx)(`span`,{className:`font-medium text-foreground`,children:e?.title??e?.name}),`. It is not on the base branch`,e?.pr?``:` and no pull request carries it`,`.`]})}),(0,X.jsxs)(`p`,{"data-slot":`delete-branch-dropped`,children:[l,` will be dropped`,e?.diffStat?` (+${e.diffStat.additions} −${e.diffStat.deletions})`:``,`, the latest “`,e?.lastCommit.subject,`”`,` `,`(`,(0,X.jsx)(`span`,{className:`font-mono`,children:e?.lastCommit.sha.slice(0,7)}),`).`]})]})})]}),(0,X.jsxs)(`form`,{onSubmit:t=>{t.preventDefault(),c&&e&&o.mutate(e.name)},className:`flex flex-col gap-[6px]`,children:[(0,X.jsxs)(`label`,{htmlFor:a,className:`text-[12.5px] text-muted-foreground`,children:[`Type `,(0,X.jsx)(`span`,{className:`font-mono text-foreground`,children:e?.name}),` to confirm`]}),(0,X.jsx)(Le,{id:a,"data-slot":`delete-branch-confirm`,autoComplete:`off`,spellCheck:!1,value:r,onChange:e=>i(e.target.value),className:`h-11 font-mono`})]}),(0,X.jsxs)(M,{children:[(0,X.jsx)(P,{className:`h-11`,disabled:o.isPending,children:`Keep it`}),(0,X.jsx)(j,{"data-action":`delete-branch-confirm`,className:`h-11 bg-danger text-danger-foreground hover:brightness-[0.96]`,disabled:!c||o.isPending,onClick:t=>{t.preventDefault(),c&&e&&o.mutate(e.name)},children:o.isPending?`Deleting…`:`Delete branch`})]})]})})}function ct({base:e}){let t=L(),n=x(),[r,i]=(0,Y.useState)({merged:!1,empty:!1}),[a,o]=(0,Y.useState)(!1),s=(t.data?.branches??[]).filter(e=>e.class===`merged`),c=(t.data?.branches??[]).filter(e=>e.class===`empty`),l=[...s,...c],u=N({mutationFn:e=>y({names:e}),onSuccess:e=>{let t=e.refused.length;m(`Deleted ${e.deleted.length} branch${e.deleted.length===1?``:`es`}${t?`; kept ${t} that ${t===1?`is`:`are`} no longer safe to delete`:``}`),n.invalidateQueries({queryKey:D.repo})},onError:e=>{n.invalidateQueries({queryKey:D.repo}),m(e.message,{tone:`danger`})}});if(t.isPending)return(0,X.jsx)(`p`,{"data-slot":`cleanup-branches-loading`,className:`text-[13px] text-soft-foreground`,children:`Loading branches…`});if(t.isError)return(0,X.jsxs)(`p`,{"data-slot":`cleanup-branches-error`,className:`text-[13px] text-danger`,children:[`Branches did not load: `,t.error.message]});let d=l.length,p=`branch${d===1?``:`es`}`;return(0,X.jsxs)(`section`,{"data-slot":`cleanup-branches`,"aria-labelledby":`cleanup-branches-title`,className:`flex flex-col rounded-[8px] border border-border`,children:[(0,X.jsxs)(`div`,{className:`flex flex-col gap-[10px] border-b border-border px-[14px] py-[12px] md:flex-row md:items-center`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-[2px]`,children:[(0,X.jsxs)(`h2`,{id:`cleanup-branches-title`,className:`text-[13px] font-semibold text-foreground`,children:[`Branches safe to delete · `,d]}),(0,X.jsxs)(`p`,{className:`text-[11.5px] leading-[17px] text-soft-foreground`,children:[`Their work is already on `,e,`, or they have none. Deleting loses nothing.`]})]}),(0,X.jsxs)(`button`,{type:`button`,"data-action":`cleanup-branches-delete`,disabled:d===0||u.isPending,onClick:()=>o(!0),className:`inline-flex h-[28px] shrink-0 items-center gap-[5px] self-start rounded-[6px] bg-muted px-[10px] text-[12px] font-medium text-foreground hover:brightness-110 focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-50 disabled:hover:brightness-100 max-md:h-11 md:self-center`,children:[(0,X.jsx)(f,{"aria-hidden":`true`,className:`size-[12px]`}),u.isPending?`Deleting…`:`Delete ${d} ${p}`]})]}),(0,X.jsx)($,{kind:`merged`,title:`Merged into ${e}`,hint:t.data.prStateKnown?`including squash-merged PRs, read from the PR state`:Z.toLowerCase(),rows:s,open:r.merged,onToggle:()=>i(e=>({...e,merged:!e.merged}))}),(0,X.jsx)($,{kind:`empty`,title:`Empty`,hint:`no commits beyond the fork point`,rows:c,open:r.empty,onToggle:()=>i(e=>({...e,empty:!e.empty}))}),(0,X.jsx)(I,{open:a,onOpenChange:o,children:(0,X.jsxs)(k,{children:[(0,X.jsxs)(F,{children:[(0,X.jsxs)(O,{children:[`Delete `,d,` `,p,`?`]}),(0,X.jsxs)(E,{children:[s.length,` merged into `,e,` and `,c.length,` empty. Their work is already on `,e,`, or they have none. Anything that stopped being safe since this list loaded is kept.`]})]}),(0,X.jsxs)(M,{children:[(0,X.jsx)(P,{children:`Keep them`}),(0,X.jsxs)(j,{"data-action":`cleanup-branches-confirm`,className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:()=>{u.mutate(l.map(e=>e.name)),o(!1)},children:[`Delete `,d,` `,p]})]})]})})]})}function $({kind:e,title:t,hint:n,rows:r,open:i,onToggle:o}){let s=`cleanup-branches-${e}`;return(0,X.jsxs)(`div`,{"data-slot":`cleanup-branch-group`,"data-group":e,className:`border-b border-border last:border-0`,children:[(0,X.jsxs)(`button`,{type:`button`,"aria-expanded":i,"aria-controls":s,disabled:r.length===0,onClick:o,className:`flex min-h-[44px] w-full items-center gap-[12px] px-[14px] py-[4px] text-left hover:bg-sidebar-row-hover focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring disabled:hover:bg-transparent`,children:[(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-[2px]`,children:[(0,X.jsxs)(`span`,{className:`truncate text-[12.5px] text-foreground`,children:[t,` · `,r.length]}),(0,X.jsx)(`span`,{className:`truncate text-[11px] text-soft-foreground`,children:n})]}),r.length>0?(0,X.jsx)(a,{"aria-hidden":`true`,className:C(`size-[13px] shrink-0 text-soft-foreground transition-transform motion-reduce:transition-none`,i&&`rotate-90`)}):null]}),i?(0,X.jsx)(`ul`,{id:s,"aria-label":t,className:`flex flex-col pb-[6px]`,children:r.map(e=>(0,X.jsxs)(`li`,{"data-slot":`cleanup-branch-row`,"data-branch":e.name,className:`flex min-h-[32px] items-center gap-[10px] px-[14px] pl-[26px] text-[11.5px]`,children:[(0,X.jsx)(`span`,{className:`shrink-0 font-mono text-muted-foreground`,children:e.name}),e.runId?(0,X.jsx)(U,{to:`/tasks/${e.runId}`,className:`min-w-0 flex-1 truncate text-soft-foreground underline-offset-2 hover:text-foreground hover:underline`,children:e.title??`Open the task`}):(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-soft-foreground`,children:e.lastCommit.subject}),e.pr?(0,X.jsxs)(`span`,{className:`shrink-0 text-soft-foreground`,children:[`PR #`,e.pr.number]}):null,(0,X.jsx)(`span`,{className:`shrink-0 tabular-nums text-soft-foreground`,children:H(e.lastCommit.at)})]},e.name))}):null]})}function lt(){let e=se(),t=fe().data?.targets.find(e=>e.id===`finder`),n=N({mutationFn:e=>o(e,t.id),onError:e=>m(e.message,{tone:`danger`})}),r=x(),[i,a]=(0,Y.useState)(!1),s=()=>Promise.all([r.invalidateQueries({queryKey:D.worktrees}),r.invalidateQueries({queryKey:D.repoBranches})]),c=N({mutationFn:e=>te(),onSuccess:(e,t)=>{s();let n=e.reclaimed.length,r=Math.max(0,t-n);m(n===0?r>0?`Nothing was reclaimed — the worktrees past the keep limit have uncommitted work or are in use`:`Nothing to reclaim — no finished worktrees exceed the keep limit`:`Reclaimed ${n} worktree${n===1?``:`s`} (branch kept)${r>0?` · ${r} kept: uncommitted work or in use`:``}`)},onError:e=>m(e.message,{tone:`danger`})}),l=N({mutationFn:e=>ee(e.runId),onSuccess:(e,t)=>{s(),m(`Reclaimed the worktree of ${t.title} (branch kept)`)},onError:e=>{s(),m(e.message,{tone:`danger`})}});if(e.isPending)return(0,X.jsx)(`p`,{"data-slot":`worktrees-loading`,className:`text-[13px] text-soft-foreground`,children:`Loading worktrees…`});if(e.isError)return(0,X.jsxs)(`p`,{"data-slot":`worktrees-error`,className:`text-[13px] text-danger`,children:[`Worktrees did not load: `,e.error.message]});let{worktrees:u,totalBytes:d,keep:f}=e.data,p=c.isPending||l.isPending,h=u.filter(e=>e.pastKeep),g=h.length>0,_=h.some(e=>e.sizeBytes===null)?null:h.reduce((e,t)=>e+(t.sizeBytes??0),0),v=g?_?`Reclaim ${A(_)} now`:`Reclaim ${h.length} now`:`Reclaim now`,y=d?A(d):null;return(0,X.jsxs)(`section`,{"data-slot":`worktrees-panel`,"aria-labelledby":`worktrees-panel-title`,className:`flex flex-col rounded-[8px] border border-border`,children:[(0,X.jsxs)(`div`,{className:`flex flex-col gap-[10px] border-b border-border px-[14px] py-[12px] md:flex-row md:items-center`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-[2px]`,children:[(0,X.jsxs)(`h2`,{id:`worktrees-panel-title`,className:`text-[13px] font-semibold text-foreground`,children:[`Worktrees on disk`,y?` · ${y}`:``]}),(0,X.jsxs)(`p`,{"data-slot":`worktrees-retention`,className:`text-[11.5px] leading-[17px] text-soft-foreground`,children:[f===0?`Retention is unlimited (`:`Retention keeps the newest ${f} finished checkout${f===1?``:`s`} (`,(0,X.jsx)(U,{to:`/settings/worktrees`,"data-slot":`worktrees-retention-link`,className:`underline-offset-2 hover:text-foreground hover:underline`,children:`Settings › Worktrees`}),f===0?`), so nothing is reclaimed on its own.`:`) and reclaims the rest.`,` `,`Reclaim removes the directory only; the branch stays, so its work stays recoverable.`]})]}),(0,X.jsxs)(`button`,{type:`button`,"data-action":`worktrees-reclaim-now`,disabled:p||!g,title:g?void 0:`Nothing past the keep limit to reclaim`,onClick:()=>a(!0),className:`inline-flex h-[28px] shrink-0 items-center gap-[5px] self-start rounded-[6px] bg-muted px-[10px] text-[12px] font-medium text-foreground hover:brightness-110 focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-50 disabled:hover:brightness-100 max-md:h-11 md:self-center`,children:[(0,X.jsx)(q,{"aria-hidden":`true`,className:`size-[12px]`}),v]})]}),u.length===0?(0,X.jsx)(`p`,{"data-slot":`worktrees-empty`,className:`px-[14px] py-[12px] text-[12.5px] text-soft-foreground`,children:`No task worktrees on disk.`}):(0,X.jsx)(`ul`,{"aria-label":`Task worktrees on disk`,className:`flex flex-col`,children:u.map(e=>(0,X.jsx)(ft,{worktree:e,keep:f,disabled:p,onOpen:t?()=>n.mutate(e.runId):void 0,opening:n.isPending,onReclaim:()=>l.mutate(e)},e.runId))}),(0,X.jsx)(I,{open:i,onOpenChange:a,children:(0,X.jsxs)(k,{children:[(0,X.jsxs)(F,{children:[(0,X.jsx)(O,{children:`Reclaim old worktrees?`}),(0,X.jsxs)(E,{children:[h.length,` finished worktree`,h.length===1?``:`s`,` beyond the keep limit`,_?` (${A(_)})`:``,` `,h.length===1?`is`:`are`,` reclaimed now, directory only. Their branches are kept, so the work stays recoverable.`]})]}),(0,X.jsxs)(M,{children:[(0,X.jsx)(P,{children:`Keep them`}),(0,X.jsx)(j,{"data-action":`worktrees-confirm`,onClick:()=>{c.mutate(h.length),a(!1)},children:v})]})]})})]})}var ut=new Set([`queued`,`running`,`waiting`,`review`]);function dt(e,t){return ut.has(e.status)||!e.reclaimable?{label:`in use`,tone:`in-use`}:e.pastKeep?{label:`reclaimable`,tone:`plain`}:{label:t>0?`kept · newest ${t}`:`kept`,tone:`plain`}}function ft({worktree:e,keep:t,disabled:n,onOpen:r,opening:i,onReclaim:a}){let o=dt(e,t),s=H(e.finishedAt??void 0),c=e.status===`review`?`at review`:s?`${e.status} ${s} ago`:e.status,l=(0,X.jsx)(`span`,{"data-slot":`worktree-state`,"data-state":o.tone===`in-use`?`in-use`:e.pastKeep?`reclaimable`:`kept`,className:C(`text-[11.5px]`,o.tone===`in-use`?`text-status-running`:`text-soft-foreground`),children:o.label}),u=`flex size-[28px] shrink-0 items-center justify-center rounded-[6px] text-soft-foreground hover:bg-muted hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-50 max-md:size-11`;return(0,X.jsxs)(`li`,{"data-slot":`worktree-row`,"data-run":e.runId,className:`flex min-h-[44px] items-center gap-[12px] border-b border-border px-[14px] py-[4px] last:border-0`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-[2px]`,children:[(0,X.jsx)(`span`,{className:`truncate text-[12.5px] text-foreground`,title:e.title,children:e.title}),(0,X.jsxs)(`span`,{className:`truncate font-mono text-[10.5px] text-soft-foreground`,children:[e.branch??e.runId.slice(0,8),` · `,c,(0,X.jsxs)(`span`,{className:`md:hidden`,children:[` · `,o.label]})]})]}),(0,X.jsx)(`span`,{"data-slot":`worktree-size`,className:`shrink-0 text-[11.5px] tabular-nums text-muted-foreground`,children:e.sizeBytes===null?`—`:A(e.sizeBytes)||`0 kB`}),(0,X.jsx)(`span`,{className:`hidden shrink-0 md:inline`,children:l}),r?(0,X.jsx)(`button`,{type:`button`,className:u,"aria-label":`Open folder for ${e.title}`,title:`Open folder`,disabled:i,onClick:r,children:(0,X.jsx)(v,{"aria-hidden":`true`,className:`size-[13px]`})}):null,o.tone===`in-use`?null:(0,X.jsx)(`button`,{type:`button`,"data-action":`worktree-reclaim`,"aria-label":`Reclaim the worktree of ${e.title} (branch kept)`,title:`Reclaim the directory (branch kept)`,disabled:n,onClick:a,className:u,children:(0,X.jsx)(q,{"aria-hidden":`true`,className:`size-[13px]`})})]})}function pt({section:e,index:t=!1}){let n=w(),r=G(),[i]=_();if(t&&!r&&i.get(`view`)!==`repo`)return(0,X.jsx)(Ye,{});if(n.isPending)return(0,X.jsx)(De,{});if(n.isError)return(0,X.jsxs)(`div`,{"data-route":`repo-git`,className:`flex min-h-full flex-col`,children:[(0,X.jsx)(K,{}),(0,X.jsx)(T,{icon:(0,X.jsx)(p,{size:16}),tone:`danger`,title:`Could not load the repository`,subtitle:n.error.message})]});let a=n.data.info;return a?(0,X.jsx)(mt,{repo:n.data,info:a,section:e}):(0,X.jsxs)(`div`,{"data-route":`repo-git`,className:`flex min-h-full flex-col`,children:[(0,X.jsx)(K,{}),(0,X.jsx)(T,{icon:(0,X.jsx)(oe,{size:16}),tone:`neutral`,title:`Not a git repository`,subtitle:`cezar is running outside a git repository — start it inside one to browse changes, commits and branches.`})]})}function mt({repo:e,info:t,section:n}){return(0,X.jsxs)(`div`,{"data-route":`repo-git`,"data-git-section":n,className:`flex min-h-full flex-col`,children:[(0,X.jsx)(K,{}),(0,X.jsxs)(`header`,{"data-slot":`repo-header`,className:`flex flex-col gap-1 px-[18px] pt-[18px] md:min-h-[61px] md:flex-row md:items-center md:gap-[10px] md:border-b md:border-border md:px-7 md:py-4`,children:[(0,X.jsx)(`h1`,{className:`min-w-0 flex-1 truncate text-2xl font-semibold tracking-tight md:text-[15px] md:tracking-normal`,children:Ne(n,t.branch)}),(0,X.jsx)(`p`,{"data-slot":`repo-meta`,className:`min-w-0 truncate text-[12px] text-soft-foreground md:text-[11.5px]`,children:(0,X.jsx)(ht,{repo:e,info:t,section:n})})]}),n===`main`?(0,X.jsx)(Ze,{repo:e,info:t}):n===`not-landed`?(0,X.jsx)(rt,{}):n===`cleanup`?(0,X.jsxs)(`div`,{"data-slot":`repo-cleanup`,className:`flex flex-col gap-[16px] px-[18px] pt-[12px] pb-[calc(90px+env(safe-area-inset-bottom))] md:px-[20px] md:pb-[20px]`,children:[(0,X.jsx)(lt,{}),(0,X.jsx)(ct,{base:e.baseBranch??t.branch})]}):n===`branches`?(0,X.jsx)(Me,{repo:e,info:t}):(0,X.jsx)(Xe,{})]})}function ht({repo:e,info:t,section:n}){let r=e.baseBranch??t.branch;switch(n){case`main`:return(0,X.jsxs)(X.Fragment,{children:[e.log.length===0?`no commits yet`:`latest ${e.log.length} commit${e.log.length===1?``:`s`} in the main checkout`,e.tracking?` · ${Ee(e.tracking)}`:``]});case`not-landed`:return(0,X.jsxs)(X.Fragment,{children:[`finished tasks whose commits are not on `,r]});case`branches`:return(0,X.jsx)(gt,{repo:e,info:t});case`changes`:return(0,X.jsxs)(X.Fragment,{children:[e.status.length,` uncommitted file`,e.status.length===1?``:`s`,` in the main checkout`]});case`cleanup`:return(0,X.jsxs)(X.Fragment,{children:[`nothing here can delete work that is not on `,r]})}}function gt({repo:e,info:t}){let n=He(e,L().data?.branches).length;return(0,X.jsxs)(X.Fragment,{children:[n,` branch`,n===1?``:`es`,` · on `,t.branch]})}export{pt as RepoGitRoute};
@@ -1,3 +1,3 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{in as r,l as i,pr as a,so as o}from"./alert-dialog-C-xYE_dg.js";import{t as s}from"./utils-fzNfbPzA.js";import{t as c}from"./chevron-right-BENZ-1ZN.js";import{n as l,r as u,t as d}from"./collapsible-DD9J91Iv.js";import{i as f,r as p}from"./highlighter-CdHqIwFr.js";var m=e(t(),1),h=/^diff --git /;function g(e){let t=e.replace(h,``),n=t.lastIndexOf(` b/`);return _(n>=0?t.slice(n+3):t)}function _(e){let t=e.trim();return t.startsWith(`"`)&&t.endsWith(`"`)&&t.length>=2?t.slice(1,-1).replace(/\\(.)/g,`$1`):t}function v(e){let t=_(e.slice(4));if(t!==`/dev/null`)return t.replace(/^[ab]\//,``)}function y(e){let t=[],n=null,r=!1;for(let i of e.split(`
2
- `)){if(h.test(i)){n={path:g(i),status:`modified`,binary:!1,additions:0,deletions:0,lines:[]},t.push(n),r=!1;continue}if(n){if(!r){if(i.startsWith(`@@`))r=!0,n.lines.push(i);else if(i.startsWith(`rename from `))n.status=`renamed`,n.oldPath=_(i.slice(12));else if(i.startsWith(`rename to `))n.status=`renamed`,n.path=_(i.slice(10));else if(i.startsWith(`new file mode`))n.status=`added`;else if(i.startsWith(`deleted file mode`))n.status=`deleted`;else if(i.startsWith(`Binary files `)||i===`GIT binary patch`)n.binary=!0;else if(i.startsWith(`+++ `)){let e=v(i);e!==void 0&&(n.path=e)}else if(i.startsWith(`--- `)){let e=v(i);e!==void 0&&n.status===`deleted`&&(n.path=e)}continue}n.lines.push(i),i.startsWith(`+`)?n.additions+=1:i.startsWith(`-`)&&(n.deletions+=1)}}let i=t.at(-1);return i&&i.lines.at(-1)===``&&i.lines.pop(),t}function b(e){return{files:e.length,additions:e.reduce((e,t)=>e+t.additions,0),deletions:e.reduce((e,t)=>e+t.deletions,0)}}var x=n(),S=20,C=300;function w({runId:e}){let t=o(),n=a(e);(0,m.useEffect)(()=>{t.invalidateQueries({queryKey:r.runs.diff(e)})},[t,e]);let s=(0,m.useMemo)(()=>y(n.data??``),[n.data]),[c,l]=(0,m.useState)(!1);if(n.isPending)return(0,x.jsx)(`p`,{className:`px-1 text-xs text-soft-foreground`,children:`Loading diff…`});if(n.isError)return(0,x.jsx)(`p`,{className:`px-1 text-xs text-danger`,children:n.error.message});if(s.length===0)return(0,x.jsx)(`p`,{"data-slot":`run-diff-empty`,className:`px-1 font-mono text-xs text-soft-foreground`,children:n.data.trim()||`(no changes)`});let u=b(s),d=c?s:s.slice(0,S);return(0,x.jsxs)(`div`,{"data-slot":`run-diff`,className:`flex min-w-0 flex-col gap-2`,children:[(0,x.jsxs)(`p`,{className:`flex items-center gap-2 px-1 text-xs text-muted-foreground`,children:[(0,x.jsxs)(`span`,{children:[u.files,` `,u.files===1?`file`:`files`,` changed`]}),(0,x.jsxs)(`span`,{className:`font-mono font-semibold tabular-nums`,children:[(0,x.jsxs)(`span`,{className:`text-success`,children:[`+`,u.additions]}),` `,(0,x.jsxs)(`span`,{className:`text-danger`,children:[`−`,u.deletions]})]})]}),d.map(e=>(0,x.jsx)(E,{file:e},`${e.oldPath??``}→${e.path}`)),s.length>d.length?(0,x.jsxs)(i,{variant:`ghost`,size:`sm`,className:`self-start`,onClick:()=>l(!0),children:[`Show `,s.length-d.length,` more files`]}):null]})}var T={added:`added`,deleted:`deleted`,renamed:`renamed`};function E({file:e}){let[t,n]=(0,m.useState)(!0),r=T[e.status];return(0,x.jsxs)(d,{open:t,onOpenChange:n,"data-slot":`diff-file`,className:`min-w-0 overflow-hidden rounded-md border border-border bg-card`,children:[(0,x.jsxs)(u,{className:`flex w-full items-center gap-2 px-3 py-2 text-left hover:bg-muted/50`,children:[(0,x.jsx)(c,{className:s(`size-3.5 shrink-0 text-soft-foreground transition-transform`,t&&`rotate-90`),"aria-hidden":`true`}),(0,x.jsx)(`span`,{"data-slot":`diff-file-path`,className:`min-w-0 truncate font-mono text-xs font-medium`,children:e.oldPath?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`span`,{className:`text-soft-foreground`,children:[e.oldPath,` → `]}),e.path]}):e.path}),r?(0,x.jsx)(`span`,{className:`shrink-0 rounded-sm bg-muted px-1.5 py-px text-[12px] font-medium text-muted-foreground`,children:r}):null,e.binary?(0,x.jsx)(`span`,{className:`shrink-0 rounded-sm bg-muted px-1.5 py-px text-[12px] font-medium text-muted-foreground`,children:`binary`}):null,(0,x.jsxs)(`span`,{className:`ml-auto shrink-0 font-mono text-[11px] font-semibold tabular-nums`,children:[(0,x.jsxs)(`span`,{className:`text-success`,children:[`+`,e.additions]}),` `,(0,x.jsxs)(`span`,{className:`text-danger`,children:[`−`,e.deletions]})]})]}),(0,x.jsx)(l,{children:(0,x.jsx)(`div`,{className:`border-t border-border/50`,children:e.binary?(0,x.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-soft-foreground`,children:`Binary file — no text diff.`}):e.lines.length===0?(0,x.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-soft-foreground`,children:`No content changes (metadata only).`}):(0,x.jsx)(D,{lines:e.lines})})})]})}function D({lines:e}){let[t,n]=(0,m.useState)(!1),r=t?e:e.slice(0,C),i=r.join(`
3
- `),[a,o]=(0,m.useState)(null);(0,m.useEffect)(()=>{let e=!1;return p(i,`diff`).then(t=>{e||o({text:i,tokens:t.tokens})}),()=>{e=!0}},[i]);let c=a?.text===i?a.tokens:f(i,`diff`)?.tokens??null;return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`pre`,{"data-slot":`diff-file-body`,className:`overflow-x-auto py-2 font-mono text-xs leading-[1.7] whitespace-pre`,children:r.map((e,t)=>(0,x.jsxs)(`span`,{className:s(`block px-4`,e.startsWith(`+`)&&`bg-diff-add`,e.startsWith(`-`)&&`bg-diff-del`,e.startsWith(`@@`)&&`text-soft-foreground`),children:[c?.[t]===void 0?e:c[t].map((e,t)=>(0,x.jsx)(`span`,{style:e.color===void 0?void 0:{color:e.color},children:e.content},t)),e===``?` `:``]},t))}),e.length>C?(0,x.jsx)(`button`,{type:`button`,"data-slot":`diff-file-toggle`,onClick:()=>n(e=>!e),className:`block w-full border-t border-border/50 px-4 py-1.5 text-left text-[11px] font-medium text-soft-foreground hover:text-foreground`,children:t?`Show less`:`Show all ${e.length} lines`}):null]})}export{w as t};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r,ta as i}from"./button-C_rd7CPp.js";import{t as a}from"./utils-JsL3ZsJf.js";import{Mt as o,b as s}from"./alert-dialog-BrpNUwMt.js";import{B as c,H as l,It as u,Lt as d,V as f,an as p}from"./index-DgWWlOLy.js";var m=e(t(),1),h=/^diff --git /;function g(e){let t=e.replace(h,``),n=t.lastIndexOf(` b/`);return _(n>=0?t.slice(n+3):t)}function _(e){let t=e.trim();return t.startsWith(`"`)&&t.endsWith(`"`)&&t.length>=2?t.slice(1,-1).replace(/\\(.)/g,`$1`):t}function v(e){let t=_(e.slice(4));if(t!==`/dev/null`)return t.replace(/^[ab]\//,``)}function y(e){let t=[],n=null,r=!1;for(let i of e.split(`
2
+ `)){if(h.test(i)){n={path:g(i),status:`modified`,binary:!1,additions:0,deletions:0,lines:[]},t.push(n),r=!1;continue}if(n){if(!r){if(i.startsWith(`@@`))r=!0,n.lines.push(i);else if(i.startsWith(`rename from `))n.status=`renamed`,n.oldPath=_(i.slice(12));else if(i.startsWith(`rename to `))n.status=`renamed`,n.path=_(i.slice(10));else if(i.startsWith(`new file mode`))n.status=`added`;else if(i.startsWith(`deleted file mode`))n.status=`deleted`;else if(i.startsWith(`Binary files `)||i===`GIT binary patch`)n.binary=!0;else if(i.startsWith(`+++ `)){let e=v(i);e!==void 0&&(n.path=e)}else if(i.startsWith(`--- `)){let e=v(i);e!==void 0&&n.status===`deleted`&&(n.path=e)}continue}n.lines.push(i),i.startsWith(`+`)?n.additions+=1:i.startsWith(`-`)&&(n.deletions+=1)}}let i=t.at(-1);return i&&i.lines.at(-1)===``&&i.lines.pop(),t}function b(e){return{files:e.length,additions:e.reduce((e,t)=>e+t.additions,0),deletions:e.reduce((e,t)=>e+t.deletions,0)}}var x=n(),S=20,C=300;function w({runId:e}){let t=i(),n=o(e);(0,m.useEffect)(()=>{t.invalidateQueries({queryKey:s.runs.diff(e)})},[t,e]);let a=(0,m.useMemo)(()=>y(n.data??``),[n.data]),[c,l]=(0,m.useState)(!1);if(n.isPending)return(0,x.jsx)(`p`,{className:`px-1 text-xs text-soft-foreground`,children:`Loading diff…`});if(n.isError)return(0,x.jsx)(`p`,{className:`px-1 text-xs text-danger`,children:n.error.message});if(a.length===0)return(0,x.jsx)(`p`,{"data-slot":`run-diff-empty`,className:`px-1 font-mono text-xs text-soft-foreground`,children:n.data.trim()||`(no changes)`});let u=b(a),d=c?a:a.slice(0,S);return(0,x.jsxs)(`div`,{"data-slot":`run-diff`,className:`flex min-w-0 flex-col gap-2`,children:[(0,x.jsxs)(`p`,{className:`flex items-center gap-2 px-1 text-xs text-muted-foreground`,children:[(0,x.jsxs)(`span`,{children:[u.files,` `,u.files===1?`file`:`files`,` changed`]}),(0,x.jsxs)(`span`,{className:`font-mono font-semibold tabular-nums`,children:[(0,x.jsxs)(`span`,{className:`text-success`,children:[`+`,u.additions]}),` `,(0,x.jsxs)(`span`,{className:`text-danger`,children:[`−`,u.deletions]})]})]}),d.map(e=>(0,x.jsx)(E,{file:e},`${e.oldPath??``}→${e.path}`)),a.length>d.length?(0,x.jsxs)(r,{variant:`ghost`,size:`sm`,className:`self-start`,onClick:()=>l(!0),children:[`Show `,a.length-d.length,` more files`]}):null]})}var T={added:`added`,deleted:`deleted`,renamed:`renamed`};function E({file:e}){let[t,n]=(0,m.useState)(!0),r=T[e.status];return(0,x.jsxs)(c,{open:t,onOpenChange:n,"data-slot":`diff-file`,className:`min-w-0 overflow-hidden rounded-md border border-border bg-card`,children:[(0,x.jsxs)(l,{className:`flex w-full items-center gap-2 px-3 py-2 text-left hover:bg-muted/50`,children:[(0,x.jsx)(p,{className:a(`size-3.5 shrink-0 text-soft-foreground transition-transform`,t&&`rotate-90`),"aria-hidden":`true`}),(0,x.jsx)(`span`,{"data-slot":`diff-file-path`,className:`min-w-0 truncate font-mono text-xs font-medium`,children:e.oldPath?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`span`,{className:`text-soft-foreground`,children:[e.oldPath,` → `]}),e.path]}):e.path}),r?(0,x.jsx)(`span`,{className:`shrink-0 rounded-sm bg-muted px-1.5 py-px text-[12px] font-medium text-muted-foreground`,children:r}):null,e.binary?(0,x.jsx)(`span`,{className:`shrink-0 rounded-sm bg-muted px-1.5 py-px text-[12px] font-medium text-muted-foreground`,children:`binary`}):null,(0,x.jsxs)(`span`,{className:`ml-auto shrink-0 font-mono text-[11px] font-semibold tabular-nums`,children:[(0,x.jsxs)(`span`,{className:`text-success`,children:[`+`,e.additions]}),` `,(0,x.jsxs)(`span`,{className:`text-danger`,children:[`−`,e.deletions]})]})]}),(0,x.jsx)(f,{children:(0,x.jsx)(`div`,{className:`border-t border-border/50`,children:e.binary?(0,x.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-soft-foreground`,children:`Binary file — no text diff.`}):e.lines.length===0?(0,x.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-soft-foreground`,children:`No content changes (metadata only).`}):(0,x.jsx)(D,{lines:e.lines})})})]})}function D({lines:e}){let[t,n]=(0,m.useState)(!1),r=t?e:e.slice(0,C),i=r.join(`
3
+ `),[o,s]=(0,m.useState)(null);(0,m.useEffect)(()=>{let e=!1;return u(i,`diff`).then(t=>{e||s({text:i,tokens:t.tokens})}),()=>{e=!0}},[i]);let c=o?.text===i?o.tokens:d(i,`diff`)?.tokens??null;return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`pre`,{"data-slot":`diff-file-body`,className:`overflow-x-auto py-2 font-mono text-xs leading-[1.7] whitespace-pre`,children:r.map((e,t)=>(0,x.jsxs)(`span`,{className:a(`block px-4`,e.startsWith(`+`)&&`bg-diff-add`,e.startsWith(`-`)&&`bg-diff-del`,e.startsWith(`@@`)&&`text-soft-foreground`),children:[c?.[t]===void 0?e:c[t].map((e,t)=>(0,x.jsx)(`span`,{style:e.color===void 0?void 0:{color:e.color},children:e.content},t)),e===``?` `:``]},t))}),e.length>C?(0,x.jsx)(`button`,{type:`button`,"data-slot":`diff-file-toggle`,onClick:()=>n(e=>!e),className:`block w-full border-t border-border/50 px-4 py-1.5 text-left text-[11px] font-medium text-soft-foreground hover:text-foreground`,children:t?`Show less`:`Show all ${e.length} lines`}):null]})}export{w as t};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Bt as r,Fr as i,Gt as a,Ir as o,K as s,M as c,Nt as l,Oi as u,P as d,R as f,Si as p,T as m,U as h,Zt as g,_n as _,bt as v,ot as y,t as b,ta as x,zi as S}from"./button-C_rd7CPp.js";import{n as C,t as w}from"./utils-JsL3ZsJf.js";import{Cn as T,E,Fn as ee,K as te,Ln as D,Pt as O,Q as k,Rt as ne,Xn as re,Z as A,_n as j,a as ie,b as ae,c as M,cn as oe,et as N,fn as P,ft as F,gn as I,gt as se,i as L,j as R,n as z,nt as ce,o as le,ot as ue,pt as de,qn as B,r as fe,s as pe,t as me,tt as he,vn as ge,xn as _e,yn as ve}from"./alert-dialog-BrpNUwMt.js";import{t as V}from"./createLucideIcon-BHp8sXmF.js";import{t as ye}from"./app-window-CSHwDX9N.js";import{t as H}from"./status-dot-CqTJHSP9.js";import{i as be,r as xe,t as Se}from"./popover-BohP6WTx.js";import{d as Ce,o as we}from"./preview-state-vuMviq6q.js";import{t as Te}from"./info-DA1x_4bz.js";import{l as U,r as Ee,u as De}from"./format-DpNe3S0A.js";import{n as Oe,t as W}from"./tab-link-B07Hu4QX.js";import{t as ke}from"./square-terminal-B6RYYieR.js";import{n as Ae,t as je}from"./agent-accounts-CFOBMVHc.js";import{a as G,i as K,l as Me,n as Ne,p as q,r as J,t as Y}from"./dropdown-menu-BegOZFrj.js";import{a as Pe,i as Fe,n as Ie,o as Le,r as Re,s as ze,t as Be}from"./textarea-D20O4Pw0.js";import{At as X,Ft as Ve,J as He,M as Ue,N as We,Pt as Ge,Qt as Ke,U as qe,X as Je,Xt as Ye,_t as Xe,at as Ze,ct as Qe,dt as $e,et,ft as tt,ht as nt,it as rt,j as it,lt as at,mt as ot,pt as st,st as ct,un as lt,vt as ut}from"./index-DgWWlOLy.js";var dt=V(`bell-off`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742`,key:`178tsu`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05`,key:`1hqiys`}]]),ft=V(`mail`,[[`path`,{d:`m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7`,key:`132q7q`}],[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}]]),pt=V(`pin-off`,[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89`,key:`znwnzq`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11`,key:`c9qhm2`}]]),Z=e(t(),1),Q=n();function mt(e){let t=x();return B({mutationFn:t=>g(e,t),onSuccess:()=>t.invalidateQueries({queryKey:ae.runs.all}),onError:e=>p(e.message,{tone:`danger`})})}function ht(e){return e.archived?`Unarchive`:`Archive task`}function gt({run:e,open:t,onOpenChange:n,onConfirm:r}){return(0,Q.jsx)(me,{open:t,onOpenChange:n,children:(0,Q.jsxs)(L,{"data-slot":`task-confirmation`,className:`sm:max-w-[660px]`,children:[(0,Q.jsxs)(pe,{children:[(0,Q.jsx)(M,{children:`Archive task?`}),(0,Q.jsxs)(ie,{children:[`Move “`,(0,Q.jsx)(`span`,{className:`font-medium text-foreground`,title:D(e),children:D(e)}),`” out of Active tasks. You can restore it from Archived.`]})]}),(0,Q.jsxs)(le,{children:[(0,Q.jsx)(fe,{children:`Cancel`}),(0,Q.jsx)(z,{className:`bg-accent-strong text-accent-strong-foreground hover:brightness-[0.96]`,onClick:r,children:`Archive task`})]})]})})}function _t({run:e,className:t,compactOnMobile:n=!1}){let[r,i]=(0,Z.useState)(!1),a=mt(e.id),o=ht(e);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(b,{type:`button`,variant:`outline`,"data-slot":`archive-action`,"aria-label":o,title:e.archived?`Put this task back in Active tasks`:`Move this task out of Active tasks`,disabled:a.isPending,className:w(`h-11 gap-[7px] px-3`,n&&`max-md:size-11 max-md:px-0`,t),onClick:()=>e.archived?a.mutate(!1):i(!0),children:[e.archived?(0,Q.jsx)(lt,{"aria-hidden":`true`}):(0,Q.jsx)(m,{"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:w(n&&`max-md:sr-only`),children:o})]}),(0,Q.jsx)(gt,{run:e,open:r,onOpenChange:i,onConfirm:()=>{a.mutate(!0),i(!1)}})]})}function vt({run:e}){let t=U(),n=F(),r=k(e.id),[i,a]=(0,Z.useState)(null),o=(n.data?.projects?.find(e=>e.id===(t??n.data?.bootProject)))?.webhook?.url,s=e.notify===!0;return!o&&!s?null:(0,Q.jsxs)(Q.Fragment,{children:[s?(0,Q.jsxs)(Y,{children:[(0,Q.jsx)(q,{asChild:!0,children:(0,Q.jsxs)(b,{variant:`outline`,size:`sm`,"data-slot":`notifying-chip`,className:`h-11 gap-1.5 md:h-[30px]`,"aria-label":o?`Notifying ${X(o)} — webhook actions`:`Notifying — webhook actions`,title:o?X(o):void 0,children:[(0,Q.jsx)(H,{tone:`success`}),(0,Q.jsx)(`span`,{children:`Notifying`}),(0,Q.jsx)(d,{"aria-hidden":`true`,className:`size-3.5`})]})}),(0,Q.jsxs)(J,{align:`end`,"data-slot":`notifying-menu`,className:`w-[240px] max-w-[calc(100vw-2rem)] p-2`,children:[o?(0,Q.jsx)(G,{className:`truncate px-2 py-1.5 text-[11px] font-normal text-muted-foreground`,children:(0,Q.jsx)(`span`,{title:X(o),children:`Task webhook`})}):null,o?(0,Q.jsxs)(K,{className:`min-h-11`,onSelect:()=>a(`note`),children:[(0,Q.jsx)(Oe,{"aria-hidden":`true`}),` Send a note…`]}):null,(0,Q.jsxs)(K,{variant:`destructive`,className:`min-h-11`,disabled:r.isPending,onSelect:()=>r.mutate({notify:!1},{onSuccess:()=>p(`Stopped notifying the webhook`),onError:e=>p(`Could not stop notifying. ${e.message}`,{tone:`danger`})}),children:[(0,Q.jsx)(dt,{"aria-hidden":`true`}),` Stop notifying`]})]})]}):(0,Q.jsxs)(b,{variant:`outline`,size:`sm`,"data-action":`handoff`,className:`size-11 px-0 md:h-[30px] md:w-auto md:px-2.5`,"aria-label":`Hand off to webhook`,onClick:()=>a(`handoff`),children:[(0,Q.jsx)(Ye,{"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`max-md:sr-only`,children:`Hand off`})]}),o?(0,Q.jsx)(yt,{mode:i,url:o,pending:r.isPending,onOpenChange:e=>!e&&a(null),onSubmit:e=>r.mutate({notify:!0,...e?{message:e}:{}},{onSuccess:()=>{a(null),p(i===`note`?`Note sent to the webhook`:`Handed off to the webhook`)},onError:e=>p(`Could not hand off. ${e.message}`,{tone:`danger`})})}):null]})}function yt({mode:e,url:t,pending:n,onOpenChange:r,onSubmit:i}){let a=(0,Z.useId)(),o=(0,Z.useId)(),[s,c]=(0,Z.useState)(``);(0,Z.useEffect)(()=>{e!==null&&c(``)},[e]);let l=e===`note`,u=X(t);return(0,Q.jsx)(Ie,{open:e!==null,onOpenChange:e=>{e||c(``),r(e)},children:(0,Q.jsx)(Re,{"data-slot":`handoff-dialog`,className:`max-sm:top-auto max-sm:bottom-0 max-sm:left-0 max-sm:max-w-none max-sm:translate-x-0 max-sm:translate-y-0 max-sm:rounded-b-none max-sm:rounded-t-xl max-sm:border-x-0 max-sm:border-b-0 max-sm:pb-[max(1.5rem,env(safe-area-inset-bottom))] max-sm:data-[state=open]:slide-in-from-bottom max-sm:data-[state=open]:zoom-in-100 max-sm:data-[state=closed]:slide-out-to-bottom max-sm:data-[state=closed]:zoom-out-100`,children:(0,Q.jsxs)(`form`,{className:`grid gap-4`,onSubmit:e=>{e.preventDefault(),i(s.trim())},children:[(0,Q.jsxs)(Le,{className:`text-left`,children:[(0,Q.jsx)(ze,{children:l?`Send a note to the webhook`:`Hand off to webhook`}),(0,Q.jsx)(Fe,{children:(0,Q.jsx)(`span`,{"data-webhook-destination":``,title:u,children:l?`The bot gets this note with the task's current status.`:`The webhook will start receiving this task's status updates. Add a note for it (optional).`})})]}),(0,Q.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,Q.jsx)(`label`,{htmlFor:a,className:`text-[13px] font-medium`,children:`Note`}),(0,Q.jsx)(Be,{id:a,"data-slot":`handoff-note`,"aria-describedby":o,rows:4,maxLength:1e5,className:`min-h-24`,placeholder:`e.g. Take over from here, ping me when the PR is green`,value:s,onChange:e=>c(e.target.value)}),(0,Q.jsxs)(`p`,{id:o,className:`flex items-center gap-1.5 text-[12px] text-muted-foreground`,children:[(0,Q.jsx)(Te,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),`The note goes to the webhook only, not to the agent.`]})]}),(0,Q.jsxs)(Pe,{className:`gap-2 max-sm:flex-col-reverse max-sm:[&>button]:h-11 max-sm:[&>button]:w-full`,children:[(0,Q.jsx)(b,{type:`button`,variant:`ghost`,className:`sm:h-9`,onClick:()=>r(!1),children:`Cancel`}),(0,Q.jsxs)(b,{type:`submit`,variant:`contrast`,className:`sm:h-9`,"data-action":`handoff-submit`,disabled:n||l&&s.trim()===``,children:[(0,Q.jsx)(Ye,{"aria-hidden":`true`}),l?`Send note`:`Hand off`]})]})]})})})}function bt({runId:e,children:t}){let n=S(),r=(0,Z.useMemo)(()=>({runId:e}),[e]);return n?(0,Q.jsx)(xt,{runId:e,children:t}):(0,Q.jsx)(Ve.Provider,{value:r,children:t})}function xt({runId:e,children:t}){let n=U(),r=(0,Z.useMemo)(()=>({runId:e,...n?{projectId:n}:{}}),[e,n]);return(0,Q.jsx)(Ve.Provider,{value:r,children:t})}var St=3,Ct=(e,t)=>e.kind===t.kind&&e.number===t.number;function wt(e,t,n=St){let r=t?e.findIndex(e=>Ct(e,t)):-1;if(e.length<=n||r<n)return{inline:e.slice(0,n),overflow:e.slice(n)};let i=[...e.slice(0,n-1),e[r]];return{inline:i,overflow:e.filter(e=>!i.includes(e))}}var Tt=(e,t)=>`/tasks/${e}/${t.kind}/${t.number}`;function Et({tab:e}){return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(e.kind===`pr`?y:f,{"aria-hidden":`true`,className:`mr-1 size-3.5 shrink-0`}),(0,Q.jsx)(`span`,{className:`sr-only`,children:e.kind===`pr`?`Pull request`:`Issue`}),` #`,e.number,(0,Q.jsx)(Qe,{kind:e.kind===`pr`?`PR`:`Issue`,number:e.number,className:`ml-1`})]})}var Dt=new Map;function Ot({servers:e}){let t=we();if(t===null)return null;let n=e[0];return(0,Q.jsxs)(b,{variant:`outline`,size:`sm`,"data-slot":`preview-toggle`,className:`max-md:h-11`,"aria-pressed":t.open,onClick:()=>t.openPane(e.length===1&&n?{port:n.port}:{}),children:[(0,Q.jsx)(ye,{"aria-hidden":`true`}),`Preview`,n?` :${n.port}`:``,e.length>1?` +${e.length-1}`:``,t.live?(0,Q.jsx)(H,{tone:`success`,"aria-label":`Preview is live`}):null]})}function kt({run:e,tab:t=`session`,hasPendingHumanAsk:n=!1,onMarkedUnread:r}){let i=re(e,n),a=Ze(e),[o,s]=(0,Z.useState)(!1),[c,l]=(0,Z.useState)(!1),u=jt(e,r),[,f]=(0,Z.useReducer)(e=>e+1,0),p=(0,Z.useId)(),m=U(),h=JSON.stringify([m,e.id]),g=Dt.get(h)??!1,_=()=>{Dt.set(h,!g),f()},v=ne(),y=te(),x=qe(y.data),S=e.status===`queued`?ee(v.data??[]).get(e.id):void 0,C=We(),T=Ue(),E=C!==null&&!T?C:null,D=E!==null,O=ue(),k=(0,Z.useMemo)(()=>_e(e,O),[e,O]),A=k[0],j=se(),ie=(0,Z.useMemo)(()=>j===void 0?[]:k.map(e=>({projectId:j,kind:e.kind,number:e.number})),[k,j]),ae=(0,Z.useMemo)(()=>ge(e,O),[e,O]),M=typeof t==`object`?t:null,{inline:oe,overflow:N}=wt(ae,M),P=(0,Z.useRef)(null),F=M?`${M.kind}#${M.number}`:null;(0,Z.useEffect)(()=>{!F||T||P.current?.querySelector(`[aria-current="page"]`)?.scrollIntoView?.({block:`nearest`,inline:`nearest`})},[F,oe.map(e=>`${e.kind}#${e.number}`).join(`,`),T]);let I=e.worktreePath&&y.data?.capabilities?.preview===!0?(0,Q.jsx)(Ot,{servers:e.previewServers??[]}):null,L=(0,Q.jsx)(Vt,{run:e,actions:u,onOpenChooser:()=>l(!0),onToggleNotes:()=>s(e=>!e)}),R=(0,Q.jsx)(b,{variant:`ghost`,size:`icon-sm`,className:`size-11 md:hidden`,"aria-label":g?`Hide run details`:`Show run details`,"aria-controls":p,"aria-expanded":g,onClick:_,children:(0,Q.jsx)(d,{"aria-hidden":`true`,className:w(`transition-transform motion-reduce:transition-none`,g&&`rotate-180`)})}),z=t!==`session`&&a.archive?(0,Q.jsx)(_t,{run:e}):null;return(0,Q.jsx)(at,{projectId:j,repoBase:O,requests:ie,children:(0,Q.jsxs)(`header`,{"data-slot":`run-header`,className:w(`relative z-20 bg-background px-[18px] md:px-9 md:pt-7`,D?`pt-0`:`pt-[18px]`,t===`session`&&`md:sticky md:top-0`),children:[(0,Q.jsxs)(`div`,{className:`w-full`,children:[E?(0,Q.jsxs)(it,{slot:E,children:[(0,Q.jsx)(Pt,{run:e,children:(0,Q.jsxs)(`span`,{"data-slot":`mobile-run-state`,className:`flex min-w-0 items-center gap-1.5 text-[11.5px] leading-tight text-soft-foreground`,children:[(0,Q.jsx)(H,{tone:i.tone,shape:i.shape,pulse:i.pulse}),(0,Q.jsxs)(`span`,{className:`truncate`,children:[i.label,S===void 0?``:` #${S}`,A?` · #${A.number}`:``]})]})}),R,L]}):(0,Q.jsxs)(`div`,{"data-slot":`run-title-row`,className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 md:flex-nowrap`,children:[(0,Q.jsx)(`p`,{"data-slot":`session-kind`,className:`text-[12px] font-semibold tracking-[0.14em] text-muted-foreground uppercase md:hidden`,children:e.delegation?.role===`worker`?`Worker session`:e.delegation?.role===`root`?`Parent session`:`Task session`}),(0,Q.jsx)(Nt,{run:e}),(0,Q.jsxs)($e,{dot:i.tone,shape:i.shape,pulse:i.pulse,children:[i.label,S===void 0?``:` #${S}`]}),(0,Q.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-1 md:gap-2.5`,children:[R,z,I,(0,Q.jsx)(vt,{run:e}),L]})]}),(0,Q.jsxs)(`div`,{id:p,"data-slot":`run-details`,className:w(g?`block`:`hidden`,`md:block`),children:[E?(0,Q.jsxs)(`div`,{"data-slot":`run-details-actions`,className:`flex flex-wrap items-center gap-2 pt-2`,children:[z,I,(0,Q.jsx)(vt,{run:e})]}):null,(0,Q.jsx)(It,{run:e,showTokens:x.tokens,showCost:x.cost,automationsAvailable:y.data?.capabilities?.automations===!0})]}),(0,Q.jsx)(Rt,{run:e}),(0,Q.jsx)(zt,{run:e}),(0,Q.jsxs)(`div`,{ref:P,"data-slot":`run-tabs`,"data-phone-bar":D||void 0,className:`mt-3 flex flex-wrap items-end gap-1 border-b border-border md:mt-5 max-md:flex-nowrap max-md:overflow-x-auto max-md:border-b-0 max-md:shadow-[inset_0_-1px_0_var(--border)] max-md:gap-0 max-md:[&>*]:mb-0 max-md:[&>*]:shrink-0 max-md:[&>a]:min-h-11 max-md:[&>a]:px-3.5 max-md:[&>a]:text-[13.5px]`,children:[(0,Q.jsx)(W,{to:`/tasks/${e.id}`,active:t===`session`,replace:D,children:`Session`}),(0,Q.jsx)(W,{to:`/tasks/${e.id}/changes`,active:t===`changes`,replace:D,count:D&&e.diffStat&&e.diffStat.files>0?e.diffStat.files:void 0,children:`Changes`}),(0,Q.jsx)(W,{to:`/tasks/${e.id}/commits`,active:t===`commits`,replace:D,children:`Commits`}),(0,Q.jsx)(W,{to:`/tasks/${e.id}/files`,active:t===`files`,replace:D,children:`Files`}),oe.map(t=>(0,Q.jsx)(W,{to:Tt(e.id,t),active:M!==null&&Ct(t,M),replace:D,children:(0,Q.jsx)(Et,{tab:t})},`${t.kind}-${t.number}`)),N.length>0?(0,Q.jsxs)(Y,{children:[(0,Q.jsxs)(q,{"data-slot":`run-tabs-more`,"aria-label":`${N.length} more linked items`,className:`-mb-px flex h-8 items-center rounded-t-md border-b-2 border-transparent px-3 text-[13px] font-medium text-muted-foreground hover:bg-muted hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-link-foreground max-md:min-h-11 max-md:px-3.5 max-md:text-[13.5px]`,children:[`+`,N.length]}),(0,Q.jsx)(J,{align:`end`,children:N.map(t=>(0,Q.jsx)(K,{asChild:!0,children:(0,Q.jsx)(Ee,{to:Tt(e.id,t),replace:D,children:(0,Q.jsx)(Et,{tab:t})})},`${t.kind}-${t.number}`))})]}):null]}),o?(0,Q.jsx)(Ut,{runId:e.id,onClose:()=>s(!1)}):null,c?(0,Q.jsx)(At,{run:e,canResume:Ze(e).terminal,onResume:()=>u.terminal.mutate(),onClose:()=>l(!1)}):null]}),(0,Q.jsx)(Ht,{run:e,actions:u})]})})}function At({run:e,canResume:t,onResume:n,onOpen:a,onClose:o}){let s=N(),c=de(),l=B({mutationFn:t=>i(e.id,t),onError:e=>p(e.message,{tone:`danger`})}),d=u(c.data),f=e=>!c.isSuccess||d.includes(e??`claude`),m=t&&f(et(e)),g=e.worktreePath?(s.data?.targets??[]).filter(e=>{let t=Xe(e.id);return t===void 0||f(t)}).map(t=>({target:t,...Je(e,t.id)?{suffix:` (resume)`,title:`Resume this run's session`}:{}})):[];if(!m&&g.length===0)return null;let _=()=>{let t=e.worktreePath;t&&navigator.clipboard.writeText(t).then(()=>p(`Worktree path copied`)).catch(()=>p(`Path: ${t}`))};if(a)return(0,Q.jsx)(K,{onSelect:a,children:`Open in…`});let v=rt(e);return(0,Q.jsxs)(`section`,{"aria-label":`Open task worktree in…`,className:`task-action-panel my-5 rounded-xl border border-border bg-card p-6`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Q.jsx)(`h2`,{className:`text-lg font-medium`,children:`Open task worktree in…`}),(0,Q.jsx)(b,{variant:`ghost`,size:`icon`,"aria-label":`Close worktree chooser`,onClick:o,children:(0,Q.jsx)(r,{})})]}),e.worktreePath?(0,Q.jsx)(`p`,{className:`my-4 break-all text-xs text-muted-foreground`,children:e.worktreePath}):null,(0,Q.jsxs)(`div`,{className:`task-open-targets mt-4 flex flex-wrap gap-3`,children:[m?(0,Q.jsxs)(b,{variant:`outline`,"data-target":`terminal-resume`,onClick:n,children:[(0,Q.jsx)(ke,{}),`Terminal (resume session)`]}):null,g.map(({target:e,suffix:t,title:n})=>{let r=ut(e);return(0,Q.jsxs)(b,{variant:`outline`,"data-target":e.id,title:n,disabled:l.isPending,onClick:()=>l.mutate(e.id),children:[(0,Q.jsx)(r,{"aria-hidden":`true`}),e.label,t??``]},e.id)}),e.worktreePath?(0,Q.jsxs)(b,{variant:`outline`,onClick:_,children:[(0,Q.jsx)(h,{}),`Copy worktree path`]}):null]}),v?(0,Q.jsxs)(`div`,{className:`mt-5 border-t border-border pt-5`,children:[(0,Q.jsx)(`h3`,{className:`text-base font-medium`,children:`Resume in a terminal`}),(0,Q.jsx)(`pre`,{className:`my-4 whitespace-pre-wrap break-all rounded-lg border border-border bg-background p-4 text-xs`,children:v}),(0,Q.jsxs)(b,{variant:`outline`,onClick:()=>void $(v,`Command copied to clipboard.`),children:[(0,Q.jsx)(h,{}),`Copy resume command`]})]}):null]})}function jt(e,t){let n=x(),r=De(),[i,s]=(0,Z.useState)(null),c=()=>n.invalidateQueries({queryKey:ae.runs.all}),l=e=>p(e.message,{tone:`danger`}),u=ce(),d={isPending:u.isPending,mutate:()=>u.mutate({id:e.id,pinned:!e.pinned})},f=A();return{pin:d,markUnread:{isPending:f.isPending,mutate:()=>{t?.(),f.mutate(e.id,{onError:l})}},delete:B({mutationFn:()=>_(e.id),onSuccess:()=>{c(),r(`/`)},onError:l}),terminal:B({mutationFn:()=>o(e.id),onError:e=>{if(e instanceof a&&e.command){$(e.command,`No terminal found — command copied to clipboard.`);return}l(e)}}),confirming:i,setConfirming:s}}async function $(e,t){try{await navigator.clipboard.writeText(e),p(t)}catch{p(`Run manually: ${e}`)}}function Mt(e){let t=he(e.id),n=D(e);return{title:n,editor:st(n,e=>t.mutate({title:e},{onError:e=>p(e.message,{tone:`danger`})}))}}function Nt({run:e}){let{title:t,editor:n}=Mt(e);return n.editing?(0,Q.jsx)(tt,{editor:n,className:`flex-1 text-[16px] font-semibold`}):(0,Q.jsxs)(`span`,{className:`group flex min-w-0 items-center gap-1`,children:[(0,Q.jsx)(`h1`,{className:`line-clamp-2 min-w-0 break-words text-2xl font-semibold tracking-tight`,title:e.task,children:t}),(0,Q.jsx)(`button`,{type:`button`,"aria-label":`Rename task`,onClick:n.begin,className:`shrink-0 rounded-sm p-1 text-soft-foreground opacity-0 transition-opacity group-hover:opacity-100 hover:bg-muted hover:text-foreground focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,Q.jsx)(Ke,{className:`size-3.5`,"aria-hidden":`true`})})]})}function Pt({run:e,children:t}){let{title:n,editor:r}=Mt(e);return(0,Q.jsxs)(Se,{open:r.editing,onOpenChange:e=>{e?r.begin():r.commit()},children:[(0,Q.jsxs)(`div`,{"data-slot":`mobile-run-title`,className:`flex min-w-0 flex-1 flex-col gap-px`,children:[(0,Q.jsx)(`h1`,{className:`truncate text-[15px] leading-tight font-semibold text-foreground`,title:e.task,children:n}),t]}),(0,Q.jsx)(be,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,"aria-label":`Rename task`,className:`flex size-11 shrink-0 items-center justify-center rounded-sm text-soft-foreground hover:bg-muted hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,Q.jsx)(Ke,{className:`size-3.5`,"aria-hidden":`true`})})}),(0,Q.jsx)(xe,{align:`end`,className:`w-64 max-w-[calc(100vw-16px)] p-2`,onEscapeKeyDown:e=>{e.preventDefault(),r.cancel()},children:(0,Q.jsx)(tt,{editor:r,className:`text-[16px] font-semibold`})})]})}function Ft({branch:e}){let[t,n]=(0,Z.useState)(null),r=(0,Z.useRef)(null);(0,Z.useEffect)(()=>()=>{r.current!==null&&clearTimeout(r.current)},[]);let i=t===e,a=async()=>{r.current!==null&&clearTimeout(r.current),n(null);try{if(!navigator.clipboard?.writeText)throw Error(`Clipboard unavailable`);await navigator.clipboard.writeText(e),n(e),r.current=setTimeout(()=>n(null),2e3)}catch{p(`Could not copy branch. Select and copy: ${e}`)}};return(0,Q.jsxs)(`span`,{className:`inline-flex min-w-0 max-w-full items-center gap-1`,children:[(0,Q.jsx)(`span`,{"data-slot":`branch-chip`,className:`min-w-0 rounded-sm border border-border bg-card px-1.5 py-px font-mono text-[11px] font-medium break-all`,children:e}),(0,Q.jsxs)(`button`,{type:`button`,"aria-label":i?`Copied branch name`:`Copy branch name`,onClick:()=>void a(),className:`inline-flex min-h-11 shrink-0 items-center gap-1 rounded-sm px-2 text-xs font-medium text-foreground hover:bg-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-link-foreground md:min-h-8`,children:[(0,Q.jsx)(h,{className:`size-3.5`,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{"aria-live":`polite`,children:i?`Copied`:`Copy`})]})]})}function It({run:e,showTokens:t,showCost:n,automationsAvailable:r}){let i=ue(),a=se(),o=t=>a===void 0?void 0:j(a,e.id,t,i),s=(0,Z.useMemo)(()=>_e(e,i),[e,i]),c=[(0,Q.jsx)(`span`,{className:`min-w-0 max-w-full break-all`,children:T(e)},`workflow`)];e.branch&&c.push((0,Q.jsx)(Ft,{branch:e.branch},`branch`));let l=s.filter(e=>e.kind===`PR`);for(let t of l)c.push((0,Q.jsx)(ct,{reference:t,to:o(t),taskTitle:D(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`,conflictAction:(0,Q.jsx)(He,{run:e,prNumber:t.number})},`pr-${t.number}`));let u=ve(e);u&&C(u)&&!l.some(e=>e.url===u)&&c.push((0,Q.jsx)(ct,{reference:{kind:`PR`,url:u},taskTitle:D(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`},`pr`));let d=I(e,i);if(d&&C(d)){let t=P(d);c.push((0,Q.jsx)(ct,{reference:{kind:`Issue`,...t?{number:Number(t)}:{},url:d},to:t?o({kind:`Issue`,number:Number(t),url:d}):void 0,taskTitle:D(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`},`issue`))}e.diffStat&&c.push((0,Q.jsx)(nt,{stat:e.diffStat},`diff`)),e.automation&&c.push(r?(0,Q.jsx)(Ee,{to:`/automations/${encodeURIComponent(e.automation.automationId)}/log`,className:`rounded-sm border border-border bg-card px-1.5 py-px text-[11px] font-medium hover:text-foreground`,children:`Automation`},`automation`):(0,Q.jsx)(`span`,{"data-slot":`automation-origin`,title:`Automations are off on this server (CEZ_AUTOMATIONS)`,className:`rounded-sm border border-border bg-card px-1.5 py-px text-[11px] font-medium`,children:`Automation`},`automation`));let f=[];return t&&(e.inputTokens!==void 0||e.outputTokens!==void 0)&&f.push((0,Q.jsx)(ot,{inputTokens:e.inputTokens,outputTokens:e.outputTokens},`tokens`)),n&&e.costUsd!==void 0&&f.push((0,Q.jsx)(`span`,{className:`tabular-nums`,children:oe(e.costUsd)},`cost`)),(0,Q.jsx)(Q.Fragment,{children:(0,Q.jsxs)(`div`,{"data-slot":`run-meta`,className:`mt-1 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-xs text-muted-foreground md:mt-1.5 md:gap-y-1`,children:[c.map((e,t)=>(0,Q.jsxs)(Z.Fragment,{children:[t>0?(0,Q.jsx)(`span`,{className:`text-soft-foreground`,"aria-hidden":`true`,children:`·`}):null,e]},t)),(0,Q.jsxs)(`span`,{className:`ml-auto flex min-w-0 max-w-full items-center gap-1.5`,children:[f.map((e,t)=>(0,Q.jsxs)(Z.Fragment,{children:[t>0?(0,Q.jsx)(`span`,{className:`text-soft-foreground`,"aria-hidden":`true`,children:`·`}):null,e]},t)),(0,Q.jsx)(Bt,{run:e})]})]})})}function Lt(e){let t=e.ciWait;return[`running`,`queued`,`waiting`].includes(e.status)&&t&&t.phase!==`delivered`&&t.phase!==`withdrawn`?t:void 0}function Rt({run:e}){let t=Lt(e),n=t??e.lastCiWait;if(!t&&e.lastCiWaitError)return(0,Q.jsx)(`div`,{"data-slot":`ci-wait-status`,role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`mt-1 min-w-0 text-xs text-muted-foreground [overflow-wrap:anywhere]`,children:e.lastCiWaitError});if(!n)return null;let r=n.result,i={passed:`CI checks passed — observed checks only; not merge approval`,failed:`CI checks failed — inspect the PR checks`,cancelled:`CI wait cancelled`,skipped:`CI checks skipped — inspect the PR checks`,no_checks:`No CI checks found — inspect the PR workflows`,deadline:`CI wait timed out — inspect the PR checks`,error:`CI wait unavailable — inspect access and the PR checks`,head_changed:`CI head changed — ${r?.headSha.slice(0,7)} → ${r?.observedHeadSha?.slice(0,7)??`unknown`}`},a=t?n.phase===`wake-pending`?e.status!==`running`||e.activity===`monitoring`?`CI result ready — waiting for capacity`:`CI result ready — current turn still working`:`Waiting for CI`:r?i[r.outcome]:n.phase===`withdrawn`?`CI wait cancelled`:`CI wait unavailable`,o=t?n.deadline:r?.observedAt,s=o?new Date(o):void 0,c=s&&Number.isFinite(s.getTime())?new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`long`}).format(s):void 0,l=`${n.repository}#${n.prNumber}`;return(0,Q.jsxs)(`div`,{"data-slot":`ci-wait-status`,role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`mt-1 min-w-0 text-xs text-muted-foreground [overflow-wrap:anywhere]`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-1`,children:[(0,Q.jsx)(`span`,{children:a}),(0,Q.jsx)(`span`,{"aria-hidden":`true`,children:`—`}),C(n.prUrl)?(0,Q.jsx)(`a`,{href:n.prUrl,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex min-h-11 min-w-11 max-w-full items-center rounded-sm px-1 font-medium text-foreground underline underline-offset-2 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:l}):(0,Q.jsx)(`span`,{children:l})]}),c?(0,Q.jsxs)(`p`,{children:[t?`Deadline`:`Observed`,` `,(0,Q.jsx)(`time`,{dateTime:o,children:c})]}):t?(0,Q.jsx)(`p`,{children:`CI deadline unavailable`}):null]})}function zt({run:e}){if(Lt(e)||e.status!==`running`||e.activity!==`monitoring`)return null;if(e.monitoringWakeCapReached)return(0,Q.jsx)(`p`,{"data-slot":`monitoring-schedule`,role:`status`,className:`mt-1 text-xs text-muted-foreground`,children:`Automatic checks paused — 40/40 reached`});let t=e.monitoringWakeAt?new Date(e.monitoringWakeAt):null,n=t&&Number.isFinite(t.getTime())?t:null;if(!n)return(0,Q.jsx)(`p`,{"data-slot":`monitoring-schedule`,role:`status`,className:`mt-1 text-xs text-muted-foreground`,children:`Parked — no automatic check scheduled`});let r=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`long`}).format(n);return(0,Q.jsxs)(`p`,{"data-slot":`monitoring-schedule`,role:`status`,className:`mt-1 text-xs text-muted-foreground`,children:[`Next automatic check`,` `,(0,Q.jsx)(`time`,{dateTime:e.monitoringWakeAt,className:`font-medium text-foreground`,children:r})]})}function Bt({run:e}){let t=R(),n=E(),{accounts:r}=Ae(),i=e.runner??t.data?.defaultRunner??`claude`,a=e.model??`auto`,o=e.effort||`auto`,s=[...e.steps].reverse().find(e=>e.profileId),l=s?.profileId,u=s?.backend??i,d=n.data?.profiles.find(e=>e.id===l&&e.provider===u),f=l===void 0||n.isPending?void 0:n.isError?l:l==="default"?je(r,u)?`default`:void 0:d?je(r,u)?d.label:void 0:`${l} (removed)`,p=e.modelIdentity&&e.modelIdentity!==a?e.modelIdentity:void 0,m=[i,f,a,o].filter(Boolean).join(` · `);return(0,Q.jsxs)(Y,{children:[(0,Q.jsx)(q,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`agent-badge`,title:m,"aria-label":`Agent: ${i}, ${f?`account ${f}, `:``}model ${a}${o?`, effort ${o}`:``}`,className:`flex min-w-0 shrink items-center max-md:min-h-11 gap-1.5 rounded-sm px-1 py-1 text-soft-foreground hover:bg-muted hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:[(0,Q.jsx)(c,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{"data-slot":`agent-badge-summary`,className:`truncate font-mono text-[11px]`,children:m})]})}),(0,Q.jsxs)(J,{align:`end`,className:`min-w-[9rem] max-md:max-w-[calc(100vw-2rem)] max-md:break-all`,children:[(0,Q.jsxs)(G,{className:`font-mono text-[11px] font-normal text-muted-foreground`,children:[`runner: `,i]}),f?(0,Q.jsxs)(G,{"data-slot":`agent-badge-account`,className:`font-mono text-[11px] font-normal text-muted-foreground`,children:[`account: `,f]}):null,(0,Q.jsxs)(G,{className:`font-mono text-[11px] font-normal text-muted-foreground`,children:[`model: `,a]}),o?(0,Q.jsxs)(G,{"data-slot":`agent-badge-effort`,className:`font-mono text-[11px] font-normal text-muted-foreground`,children:[`effort: `,o]}):null,p?(0,Q.jsxs)(G,{"data-slot":`agent-badge-identity`,className:`font-mono text-[11px] font-normal text-muted-foreground`,children:[`identity: `,p]}):null]})]})}function Vt({run:e,actions:t,onToggleNotes:n,onOpenChooser:r}){let i=Ze(e),a=rt(e);return(0,Q.jsxs)(Y,{children:[(0,Q.jsx)(q,{asChild:!0,children:(0,Q.jsx)(b,{variant:`ghost`,size:`icon-sm`,className:`size-11`,"aria-label":`Run actions`,children:(0,Q.jsx)(s,{"aria-hidden":`true`})})}),(0,Q.jsxs)(J,{align:`end`,"data-slot":`run-actions-menu`,className:`w-[270px] max-w-[calc(100vw-2rem)] p-3`,children:[(0,Q.jsx)(G,{className:`px-2 py-3 text-[12px] font-normal text-muted-foreground`,children:`TASK ACTIONS`}),(0,Q.jsxs)(K,{onSelect:n,children:[(0,Q.jsx)(Ce,{"aria-hidden":`true`}),` Notes / handoff`]}),(0,Q.jsx)(At,{run:e,canResume:i.terminal,onResume:()=>t.terminal.mutate(),onOpen:r}),a?(0,Q.jsxs)(K,{onSelect:()=>void $(a,`Command copied to clipboard.`),children:[(0,Q.jsx)(h,{"aria-hidden":`true`}),` Copy resume command`]}):null,i.markUnread?(0,Q.jsxs)(K,{disabled:t.markUnread.isPending,onSelect:()=>t.markUnread.mutate(),children:[(0,Q.jsx)(ft,{"aria-hidden":`true`}),` Mark unread`]}):null,i.pin?(0,Q.jsxs)(Ne,{"data-slot":`pin-run`,className:`min-h-11`,checked:!!e.pinned,disabled:t.pin.isPending,onCheckedChange:()=>t.pin.mutate(),children:[e.pinned?(0,Q.jsx)(pt,{"aria-hidden":`true`}):(0,Q.jsx)(v,{"aria-hidden":`true`}),e.pinned?`Unpin task`:`Pin task`]}):null,i.deleteRun?(0,Q.jsx)(Me,{}):null,i.deleteRun?(0,Q.jsxs)(K,{variant:`destructive`,onSelect:()=>t.setConfirming(`delete`),children:[(0,Q.jsx)(l,{"aria-hidden":`true`}),` Delete task…`]}):null]})]})}function Ht({run:e,actions:t}){let n=t.confirming;return(0,Q.jsx)(me,{open:n!==null,onOpenChange:e=>!e&&t.setConfirming(null),children:(0,Q.jsxs)(L,{"data-slot":`task-confirmation`,className:`sm:max-w-[660px]`,children:[(0,Q.jsxs)(pe,{children:[(0,Q.jsx)(M,{className:`text-danger`,children:`Delete task permanently?`}),(0,Q.jsx)(ie,{children:(0,Q.jsxs)(Q.Fragment,{children:[`Delete “`,(0,Q.jsx)(`span`,{className:`font-medium text-foreground`,title:D(e),children:D(e)}),`” and its transcript, worktree and branch. This cannot be undone.`]})})]}),(0,Q.jsxs)(le,{children:[(0,Q.jsx)(fe,{children:`Cancel`}),(0,Q.jsx)(z,{className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:()=>{t.delete.mutate(),t.setConfirming(null)},children:`Delete task`})]})]})})}function Ut({runId:e,onClose:t}){let n=O(e);return(0,Q.jsxs)(`div`,{"data-slot":`notes-panel`,className:`my-5 rounded-xl border border-border bg-card p-6`,children:[(0,Q.jsxs)(`div`,{className:`mb-4 flex items-center justify-between gap-3`,children:[(0,Q.jsx)(`h2`,{className:`text-lg font-medium`,children:`Notes / handoff`}),(0,Q.jsx)(b,{variant:`ghost`,size:`icon`,"aria-label":`Close notes`,onClick:t,children:(0,Q.jsx)(r,{})})]}),n.isPending?(0,Q.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`Loading notes…`}):n.isError?(0,Q.jsx)(`p`,{className:`text-xs text-danger`,children:n.error.message}):n.data.trim().length>0?(0,Q.jsx)(bt,{runId:e,children:(0,Q.jsx)(Ge,{children:n.data})}):(0,Q.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`No notes yet — the handoff file is seeded when the task starts.`}),(0,Q.jsxs)(`div`,{className:`mt-4 flex gap-3`,children:[(0,Q.jsx)(b,{variant:`outline`,disabled:!n.data?.trim(),onClick:()=>void $(n.data??``,`Notes copied`),children:`Copy notes`}),(0,Q.jsx)(b,{variant:`outline`,onClick:t,children:`Close`})]})]})}export{bt as n,_t as r,kt as t};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{At as r,Ct as i,D as a,G as o,L as s,Ot as c,Pt as l,Qr as u,Si as d,St as f,Ui as p,Vt as m,Wt as h,Yr as g,fn as _,gt as v,kt as y,qt as b,rn as x,t as S,ta as C,xt as w}from"./button-C_rd7CPp.js";import{t as T}from"./utils-JsL3ZsJf.js";import{J as E,Qt as D,Ut as O,Wt as k,Xt as A,_ as j,b as M,en as N,ft as ee,qn as P}from"./alert-dialog-BrpNUwMt.js";import{F}from"./prompt-templates-Cubdut_C.js";import{r as I,u as te}from"./format-DpNe3S0A.js";import{a as ne,i as re,n as ie,o as ae,r as oe,s as L}from"./textarea-D20O4Pw0.js";import{i as R,l as z,n as B,o as V,p as H}from"./skills-DFBiAuJG.js";import{Nt as U,gt as W,jt as G,kt as K}from"./index-DgWWlOLy.js";import{t as se}from"./skill-empty-hint-oOtzR3v0.js";var q=e(t(),1),J=n(),ce=`https://github.com/open-mercato/skills`;function Y(e){let t=e?.importedSkills;if(Array.isArray(t))return t.filter(e=>typeof e==`string`&&!!e)}function X(e,t){return Y(e)??[...t]}function le({projectId:e}){let t=C(),n=D(),a=E(),[o,s]=(0,q.useState)(``),c=k(e,!!e),u=a.data??[],f=(0,q.useMemo)(()=>u.map(e=>e.name),[u]),p=(0,q.useRef)([]);p.current=f;let m=(0,q.useMemo)(()=>new Set(X(n.data,f)),[n.data,f]),h=(0,q.useRef)(Promise.resolve()),_=(0,q.useRef)(0),b=(0,q.useCallback)(e=>{let n=N.uiState,r=t.getQueryData(n),i=e(X(r,p.current));t.setQueryData(n,{...r,importedSkills:i});let a=++_.current;h.current=h.current.then(async()=>{try{let e=await g({importedSkills:i});a===_.current&&(t.setQueryData(n,e),t.invalidateQueries({queryKey:M.skills}))}catch(e){d(e instanceof Error?e.message:String(e),{tone:`danger`}),a===_.current&&t.invalidateQueries({queryKey:n})}})},[t]),x=(0,q.useCallback)(e=>{b(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[b]),S=f.length>0&&f.every(e=>m.has(e)),O=(0,q.useCallback)(()=>{if(S){let e=new Set(p.current);b(t=>t.filter(t=>!e.has(t)))}else b(e=>[...new Set([...e,...p.current])])},[S,b]);if(a.isError)return(0,J.jsx)(j,{icon:(0,J.jsx)(l,{}),tone:`danger`,heading:`h2`,title:`Could not load importable skills`,subtitle:a.error.message});let A=z(u,o);return(0,J.jsxs)(`div`,{"data-slot":`skills-import-panel`,className:`w-full min-w-0 [&_button]:min-h-11`,children:[(0,J.jsx)(`p`,{className:`mb-4 text-[12px] font-medium tracking-wide text-link-foreground`,children:`OPEN-MERCATO / SKILLS`}),(0,J.jsx)(`h2`,{className:`text-2xl font-medium`,children:`Manage skills`}),(0,J.jsxs)(`p`,{className:`mt-2 text-[13px] leading-relaxed text-muted-foreground`,children:[`Choose which `,(0,J.jsx)(`a`,{href:ce,target:`_blank`,rel:`noreferrer`,children:`open-mercato`}),` skills appear in your catalog and composer picker. All are enabled by default; uncheck any you don’t want.`]}),(0,J.jsx)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:`Applies across projects · saved automatically`}),(0,J.jsx)(ue,{projectId:e,state:c.data,loadError:c.error}),(0,J.jsx)(`p`,{className:`mt-4 text-xs text-soft-foreground`,children:`Checkboxes control visibility. Updating refreshes installed skill files; it does not change your selection.`}),(0,J.jsxs)(`div`,{className:`sw-import-controls mt-4 flex flex-wrap items-center gap-2`,children:[(0,J.jsxs)(`div`,{className:`sw-search relative min-w-0 flex-1`,children:[(0,J.jsx)(i,{"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,J.jsx)(K,{"data-slot":`import-filter`,placeholder:`Filter skills…`,"aria-label":`Filter skills`,value:o,onChange:e=>s(e.target.value),className:`h-11 min-w-0 pl-9 text-xs`})]}),(0,J.jsxs)(`button`,{type:`button`,"data-slot":`import-all`,disabled:f.length===0||n.isPending,onClick:O,className:`h-11 shrink-0 rounded-md border border-border bg-card px-2.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-55`,children:[S?(0,J.jsx)(v,{"aria-hidden":`true`,className:`size-4`}):(0,J.jsx)(w,{"aria-hidden":`true`,className:`size-4`}),S?`Remove all`:`Enable all`]})]}),(0,J.jsx)(`div`,{"data-slot":`import-list`,className:`mt-3 flex flex-col gap-1.5`,children:a.isPending?(0,J.jsx)(`p`,{className:`px-1 py-2 text-[13px] text-soft-foreground`,children:`Loading…`}):A.length>0?A.map(e=>{let t=m.has(e.name);return(0,J.jsxs)(`label`,{"data-slot":`import-row`,"data-skill":e.name,"data-imported":t?`true`:void 0,className:T(`flex min-h-16 cursor-pointer items-start gap-3 rounded-lg border border-border p-4 transition-colors hover:bg-muted`,t&&`bg-background`),children:[(0,J.jsxs)(`span`,{className:`relative size-5 shrink-0`,children:[(0,J.jsx)(`input`,{type:`checkbox`,"data-slot":`import-toggle`,checked:t,onChange:()=>x(e.name),className:`peer absolute inset-0 m-0 size-5 opacity-0`}),t?(0,J.jsx)(y,{"aria-hidden":`true`,className:`pointer-events-none size-5 text-link-foreground peer-focus-visible:outline-2 peer-focus-visible:outline-ring`}):(0,J.jsx)(r,{"aria-hidden":`true`,className:`pointer-events-none size-5 text-link-foreground peer-focus-visible:outline-2 peer-focus-visible:outline-ring`})]}),(0,J.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`span`,{className:`flex min-w-0 items-center gap-2`,children:(0,J.jsx)(`span`,{className:`min-w-0 break-words text-[13px] font-medium text-foreground`,children:e.name})}),e.description?(0,J.jsx)(`span`,{className:`mt-2 block text-xs leading-relaxed text-soft-foreground`,children:e.description}):null]})]},e.name)}):(0,J.jsx)(`p`,{className:`px-1 py-2 text-xs text-soft-foreground`,children:u.length>0?`(no skills match)`:`(no skills available — the repo may still be cloning)`})})]})}function Z(e){return e===`project`?`Project installation`:`Global installation`}function ue({projectId:e,state:t,loadError:n}){let r=C(),i=te(),a=(0,q.useRef)(0),[o,c]=(0,q.useState)(!1),l=P({mutationFn:()=>_({task:`Apply the upgrade notes after updating the installed Open Mercato skills.`,steps:[{id:`apply-upgrade-notes`,name:`Apply upgrade notes`,skill:`om-apply-upgrade-notes`,prompt:`{{task}}`}]}),onSuccess:e=>{c(!1),i(F(e))},onError:e=>d(e.message,{tone:`danger`})}),u=(t,n)=>{n.seq===a.current&&(r.setQueryData(N.skillsUpdate(e),t),n.action===`apply`&&t.updatedAt&&t.updatedAt!==n.previousUpdatedAt&&(r.invalidateQueries({queryKey:M.skills}),d(t.status===`error`?`Some skill updates failed.`:`Open Mercato skills updated.`),c(!0)))},p=(e,t)=>{t.seq===a.current&&d(e.message,{tone:`danger`})},m=P({mutationFn:t=>x(e).then(e=>({result:e,request:t})),onSuccess:({result:e,request:t})=>u(e,t),onError:(e,t)=>p(e,t)}),h=P({mutationFn:t=>b(e).then(e=>({result:e,request:t})),onSuccess:({result:e,request:t})=>u(e,t),onError:(e,t)=>p(e,t)}),g=e=>{let n=++a.current;e===`apply`?h.mutate({action:e,seq:n,previousUpdatedAt:t?.updatedAt??null}):m.mutate({action:e,seq:n})},v=t?.scopes.some(e=>e.skills.length>0)??!1,y=t?.status===`error`,w=v&&(t?.available||y),E=h.isPending||t?.status===`updating`,D=t?.scopes.filter(e=>e.status===`error`||e.status===`unavailable`)??[],O=t?.scopes.filter(e=>e.updatedAt&&!D.includes(e))??[],k=`Checking installed Open Mercato skills…`;return n?k=`Update status is unavailable right now.`:t?.status===`available`?k=`An update is available for your installed Open Mercato skills.`:t?.status===`updating`?k=`Updating installed Open Mercato skills…`:t?.status===`current`?k=`Installed Open Mercato skills are up to date.`:t?.status===`unavailable`?k=t.scopes.find(e=>e.reason)?.reason??`Automatic updates are unavailable.`:t?.status===`error`&&(k=`The update did not finish for every installation.`),(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`section`,{"data-slot":`skills-update-card`,"aria-live":`polite`,className:`mt-4 rounded-lg border border-border bg-background p-4`,children:[(0,J.jsxs)(`div`,{className:`flex flex-col items-start gap-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`p`,{className:`text-[13px] font-medium text-foreground`,children:k}),(0,J.jsx)(`p`,{className:`mt-4 text-xs text-soft-foreground`,children:`Project and global installations are checked separately.`}),t?.checkedAt?(0,J.jsxs)(`p`,{className:`mt-1 text-xs text-soft-foreground`,children:[`Last checked `,new Date(t.checkedAt).toLocaleString(),`.`]}):null,t?.scopes.some(e=>e.skills.length>0)?(0,J.jsx)(`ul`,{className:`mt-1 text-xs text-soft-foreground`,children:t.scopes.filter(e=>e.skills.length>0).map(e=>(0,J.jsxs)(`li`,{children:[Z(e.scope),` · `,e.skills.length,` tracked`]},e.scope))}):null,D.length>0?(0,J.jsxs)(`p`,{className:`mt-1 text-xs text-destructive`,children:[`Failed: `,D.map(e=>Z(e.scope)).join(`, `),O.length?`; updated: ${O.map(e=>Z(e.scope)).join(`, `)}`:``,`.`]}):null]}),w?(0,J.jsxs)(S,{"data-action":`skills-update-apply`,size:`sm`,disabled:E,onClick:()=>g(`apply`),children:[(0,J.jsx)(f,{"aria-hidden":`true`,className:T(`size-3.5`,E&&`motion-safe:animate-spin`)}),E?`Updating…`:y?`Retry`:`Update now`]}):t?.status===`current`?(0,J.jsxs)(S,{"data-action":`skills-update-check`,variant:`outline`,size:`sm`,disabled:m.isPending,onClick:()=>g(`check`),children:[(0,J.jsx)(f,{"aria-hidden":`true`,className:`size-4`}),`Check again`]}):t?.status===`unavailable`||n?(0,J.jsx)(S,{"data-action":`skills-update-check`,variant:`outline`,size:`sm`,disabled:m.isPending,onClick:()=>g(`check`),children:`Retry check`}):null]}),t?.status===`unavailable`||n?(0,J.jsxs)(`div`,{className:`mt-2 text-xs text-soft-foreground`,children:[`Manual examples: `,(0,J.jsx)(`code`,{children:`npx skills update -p`}),` · `,(0,J.jsx)(`code`,{children:`npx skills update -g`}),`. These broad commands may update other tracked sources.`]}):null,t?.needsUpgradeNotes?(0,J.jsxs)(`div`,{"data-slot":`skills-upgrade-notes`,className:`mt-3 flex gap-2 rounded-md border border-accent-strong/30 bg-background p-2.5 text-xs text-foreground`,children:[(0,J.jsx)(s,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 text-link-foreground`}),(0,J.jsxs)(`span`,{children:[`Skill files were updated. Run `,(0,J.jsx)(`code`,{children:`/om-apply-upgrade-notes`}),` in each configured repository to apply descriptor migrations while preserving local edits.`]})]}):null]}),(0,J.jsx)(ie,{open:o,onOpenChange:e=>l.isPending?void 0:c(e),children:(0,J.jsxs)(oe,{"data-slot":`skills-upgrade-notes-dialog`,showCloseButton:!1,children:[(0,J.jsxs)(ae,{children:[(0,J.jsx)(L,{children:`Apply the upgrade notes now?`}),(0,J.jsxs)(re,{children:[`The skill files were updated successfully. Start a new session with`,` `,(0,J.jsx)(`code`,{children:`/om-apply-upgrade-notes`}),` to sync repository descriptors while preserving local edits?`]})]}),(0,J.jsxs)(ne,{children:[(0,J.jsx)(S,{type:`button`,variant:`outline`,disabled:l.isPending,onClick:()=>c(!1),children:`No`}),(0,J.jsx)(S,{type:`button`,disabled:l.isPending,onClick:()=>l.mutate(),children:l.isPending?`Starting…`:`Yes, start session`})]})]})})]})}var Q=`__bm`,$=`__import`;function de(){return(0,J.jsx)(`div`,{"data-route":`skills`,className:`mx-auto min-h-full w-full px-[18px] py-6 md:p-9`,children:(0,J.jsx)(fe,{})})}function fe(){let e=O(),t=A(),n=E(),[r]=p(),[s,g]=(0,q.useState)(``),_=C(),v=ee(),y=h().projectId??v.data?.bootProject??``,b=P({mutationFn:()=>u(),onSuccess:e=>{_.setQueryData(M.skills,e),d(`Team skills refreshed.`)},onError:e=>d(e.message,{tone:`danger`})});if(e.isError)return(0,J.jsx)(j,{icon:(0,J.jsx)(l,{}),tone:`danger`,heading:`h2`,title:`Could not load skills`,subtitle:e.error.message});let x=V(e.data??[]),S=(n.data?.length??0)>0,w=r.get(`skill`),D=w===Q||w===$||w!==null&&x.some(e=>e.name===w)?w:x[0]?.name??(S?$:Q),k=x.find(e=>e.name===D)??null,N=B(x,s);return(0,J.jsxs)(`div`,{"data-slot":`skills-section`,className:`@container flex min-w-0 flex-col gap-[22px]`,children:[(0,J.jsxs)(`header`,{className:`flex flex-col gap-4 @min-[700px]:flex-row @min-[700px]:items-center @min-[700px]:justify-between`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h1`,{className:`text-[25px] font-semibold md:text-[30px]`,children:`Skills`}),(0,J.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground md:text-[13px]`,children:`Markdown playbooks your agents can follow.`})]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[S?(0,J.jsxs)(I,{to:`/skills?skill=${$}`,"data-slot":`import-skills-row`,"aria-current":D===$?`page`:void 0,className:`inline-flex min-h-11 items-center gap-2 rounded-lg border border-border bg-card px-3 text-xs font-medium aria-[current=page]:bg-accent-strong/10 hover:bg-muted focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,J.jsx)(o,{"aria-hidden":`true`,className:`size-4 text-link-foreground`}),`Manage skills`]}):null,(0,J.jsxs)(I,{to:`/skills?skill=${Q}`,"data-slot":`bookmarklets-row`,"aria-current":D===Q?`page`:void 0,className:`inline-flex min-h-11 items-center gap-2 rounded-lg border border-border bg-card px-3 text-xs font-medium aria-[current=page]:bg-accent-strong/10 hover:bg-muted focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,J.jsx)(m,{"aria-hidden":`true`,className:`size-4 text-link-foreground`}),`Run from GitHub`]})]})]}),(0,J.jsxs)(`div`,{className:T(`flex-col items-start gap-2 sm:flex-row sm:items-center md:flex`,w===null?`flex`:`hidden`),children:[(0,J.jsxs)(`div`,{className:`sw-search relative w-full min-w-0 flex-1`,children:[(0,J.jsx)(i,{"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,J.jsx)(K,{"data-slot":`skills-filter`,placeholder:`Filter skills…`,"aria-label":`Filter skills`,value:s,onChange:e=>g(e.target.value),className:`h-11 min-w-0 bg-card pl-9 text-xs`})]}),(0,J.jsxs)(`button`,{type:`button`,"data-slot":`skills-refresh`,title:`git fetch the team skills repos`,disabled:b.isPending,onClick:()=>b.mutate(),className:`flex h-11 shrink-0 items-center gap-1.5 rounded-md border border-border bg-card px-2.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-55`,children:[(0,J.jsx)(f,{"aria-hidden":`true`,className:T(`size-3`,b.isPending&&`motion-safe:animate-spin`)}),`Refresh`]})]}),(0,J.jsxs)(`div`,{className:`grid min-w-0 items-start gap-[22px] md:grid-cols-[minmax(220px,310px)_minmax(0,1fr)]`,children:[(0,J.jsx)(`section`,{"data-slot":`skills-list`,className:T(`min-w-0 flex-col rounded-xl border border-border bg-card p-3 md:flex`,w===null?`flex`:`hidden`),children:(0,J.jsx)(`ul`,{"data-slot":`skill-rows`,className:`flex min-h-0 flex-col gap-1 overflow-y-auto md:max-h-[calc(100dvh-280px)]`,children:e.isPending?(0,J.jsx)(`li`,{role:`status`,"aria-busy":`true`,className:`min-h-72 p-3 text-[13px] text-soft-foreground`,children:`Loading skills…`}):N.length>0?N.map(e=>(0,J.jsx)(pe,{skill:e,active:D===e.name,highlighted:D===$&&e===x[0]},e.path)):(0,J.jsx)(`li`,{className:`px-2.5 py-2 text-xs leading-relaxed text-soft-foreground`,children:x.length>0?`(no skills match)`:(0,J.jsx)(se,{})})})}),(0,J.jsx)(`section`,{"data-slot":`skills-detail`,className:T(`min-w-0 flex-col rounded-xl border border-border bg-card md:flex`,w===null?`hidden`:`flex`),children:(0,J.jsxs)(`div`,{className:`min-w-0 p-5`,children:[(0,J.jsxs)(I,{to:`/skills`,"data-slot":`skills-back`,className:`mb-4 inline-flex min-h-11 items-center gap-2 rounded-lg border border-border px-3 text-xs font-medium hover:bg-muted md:hidden`,children:[(0,J.jsx)(a,{"aria-hidden":`true`,className:`size-3.5`}),`Back to skills`]}),D===$?(0,J.jsx)(le,{projectId:y}):D===Q?(0,J.jsx)(W,{skills:x}):k?(0,J.jsx)(G,{skill:k,usedBy:H(t.data?.workflows??[],k.name)}):e.isPending?(0,J.jsx)(`div`,{role:`status`,"aria-busy":`true`,className:`min-h-72 text-xs text-muted-foreground`,children:`Loading skill…`}):(0,J.jsx)(j,{icon:(0,J.jsx)(c,{}),tone:`neutral`,heading:`h2`,title:`No skill selected`,subtitle:`Pick a skill from the catalog.`})]})})]})]})}function pe({skill:e,active:t,highlighted:n}){let r=R(e);return(0,J.jsx)(`li`,{children:(0,J.jsxs)(I,{to:`/skills?skill=${encodeURIComponent(e.name)}`,"data-slot":`skill-row`,"data-skill":e.name,"data-highlighted":n||void 0,"data-project":r?`true`:void 0,"aria-current":t?`page`:void 0,className:T(`selection-row flex min-h-24 flex-col gap-2 rounded-lg border-b border-border p-3 transition-colors hover:bg-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-link-foreground`,(t||n)&&`border-transparent bg-accent-strong/10`),children:[(0,J.jsx)(`span`,{className:`flex min-w-0 items-center gap-2`,children:(0,J.jsx)(`span`,{className:T(`min-w-0 break-words text-[13px]`,r?`font-semibold text-foreground`:`font-normal text-muted-foreground`),children:e.name})}),e.description?(0,J.jsx)(`span`,{className:`line-clamp-2 text-xs leading-relaxed text-supporting-foreground`,children:e.description}):null,(0,J.jsx)(U,{source:e.source,className:`self-start border-0 bg-transparent p-0 text-link-foreground`})]})})}export{de as SkillsRoute};
@@ -0,0 +1 @@
1
+ import{t as e}from"./createLucideIcon-BHp8sXmF.js";var t=e(`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`}]]);export{t};
@@ -0,0 +1 @@
1
+ import"./rolldown-runtime-QTnfLwEv.js";import{i as e,t}from"./react-runtime-CCIEwYL0.js";import{r as n}from"./button-C_rd7CPp.js";import{t as r}from"./utils-JsL3ZsJf.js";import{t as i}from"./createLucideIcon-BHp8sXmF.js";var a=i(`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`}]]);e();var o=t(),s=n(`inline-block shrink-0`,{variants:{tone:{success:``,pending:``,danger:``,accent:``,info:``,running:``,neutral:``},shape:{filled:`size-[7px] rounded-full`,ring:`size-[7px] rounded-full border-[1.5px] bg-transparent`,workers:`inline-flex size-[12px] items-center justify-center`},pulse:{true:`animate-pulse motion-reduce:animate-none`,false:``}},compoundVariants:[{shape:`filled`,tone:`success`,className:`bg-success`},{shape:`filled`,tone:`pending`,className:`bg-pending-strong`},{shape:`filled`,tone:`danger`,className:`bg-danger`},{shape:`filled`,tone:`accent`,className:`bg-accent-strong`},{shape:`filled`,tone:`info`,className:`bg-info`},{shape:`filled`,tone:`running`,className:`bg-status-running`},{shape:`filled`,tone:`neutral`,className:`bg-soft-foreground`},{shape:`ring`,tone:`success`,className:`border-success`},{shape:`ring`,tone:`pending`,className:`border-pending-strong`},{shape:`ring`,tone:`danger`,className:`border-danger`},{shape:`ring`,tone:`accent`,className:`border-accent-strong`},{shape:`ring`,tone:`info`,className:`border-info`},{shape:`ring`,tone:`running`,className:`border-status-running`},{shape:`ring`,tone:`neutral`,className:`border-soft-foreground`},{shape:`workers`,tone:`success`,className:`text-success`},{shape:`workers`,tone:`pending`,className:`text-pending-strong`},{shape:`workers`,tone:`danger`,className:`text-danger`},{shape:`workers`,tone:`accent`,className:`text-accent-icon`},{shape:`workers`,tone:`info`,className:`text-info`},{shape:`workers`,tone:`running`,className:`text-status-running`},{shape:`workers`,tone:`neutral`,className:`text-soft-foreground`}],defaultVariants:{tone:`neutral`,shape:`filled`,pulse:!1}});function c({className:e,tone:t=`neutral`,shape:n=`filled`,pulse:i=!1,...c}){return(0,o.jsx)(`span`,{"data-slot":`status-dot`,"data-tone":t,"data-shape":n,className:r(s({tone:t,shape:n,pulse:i,className:e})),...c,children:n===`workers`?(0,o.jsx)(a,{className:`size-[12px]`,"aria-hidden":`true`}):null})}export{a as n,c as t};
@@ -1 +1 @@
1
- import{t as e}from"./react-runtime-CCIEwYL0.js";import{t}from"./utils-fzNfbPzA.js";import{t as n}from"./createLucideIcon-BHp8sXmF.js";import{r}from"./format-dBiNDNVe.js";var i=n(`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`}]]),a=e();function o({to:e,active:n=!1,onClick:i,count:o,replace:s,className:c,children:l}){return(0,a.jsxs)(r,{to:e,replace:s,"aria-current":n?`page`:void 0,onClick:i,className:t(`-mb-px flex h-8 items-center rounded-t-md border-b-2 px-3 text-[13px] font-medium`,n?`border-foreground font-semibold text-foreground`:`border-transparent text-muted-foreground hover:bg-muted hover:text-foreground`,c),children:[l,o===void 0?null:(0,a.jsx)(`span`,{"data-slot":`tab-count`,className:`ml-1.5 text-[11.5px] font-normal text-soft-foreground`,children:o})]})}export{i as n,o as t};
1
+ import{t as e}from"./react-runtime-CCIEwYL0.js";import{t}from"./utils-JsL3ZsJf.js";import{t as n}from"./createLucideIcon-BHp8sXmF.js";import{r}from"./format-DpNe3S0A.js";var i=n(`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`}]]),a=e();function o({to:e,active:n=!1,onClick:i,count:o,replace:s,className:c,children:l}){return(0,a.jsxs)(r,{to:e,replace:s,"aria-current":n?`page`:void 0,onClick:i,className:t(`-mb-px flex h-8 items-center rounded-t-md border-b-2 px-3 text-[13px] font-medium`,n?`border-foreground font-semibold text-foreground`:`border-transparent text-muted-foreground hover:bg-muted hover:text-foreground`,c),children:[l,o===void 0?null:(0,a.jsx)(`span`,{"data-slot":`tab-count`,className:`ml-1.5 text-[11.5px] font-normal text-soft-foreground`,children:o})]})}export{i as n,o as t};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Gt as r,Hi as i,Ir as a,J as o,Pr as s,Si as c,Wr as l,an as u,ci as d,nt as ee,pn as f,t as p,ta as m,ur as h}from"./button-C_rd7CPp.js";import{Ct as g,K as _,Ln as v,Ot as y,_ as b,b as x,kt as S,qn as C}from"./alert-dialog-BrpNUwMt.js";import{t as w}from"./run-header-68WHf9wV.js";import{i as T,n as E,r as D}from"./git-toolbar-Cw4ljmhB.js";import{a as O,i as k,n as A,o as j,r as M,s as N,t as P}from"./textarea-D20O4Pw0.js";import{A as F,Bt as I,Q as L,Tt as R,tt as te,wt as z}from"./index-DgWWlOLy.js";import{t as B}from"./diff-DrEARXTV.js";var V=e(t(),1),H=e=>e===`running`||e===`queued`||e===`waiting`,U=`no worktree — this task ran directly in the repo working tree`;function W(e){let t=e=>({id:`commit`,label:`Commit`,enabled:!1,reason:e});return e.hasWorktree?e.status===`running`?t(`Commit unavailable — the agent is still working in this worktree`):e.changedFiles===void 0?t(`Commit unavailable — changes are still loading`):e.changedFiles===0?t(`Commit unavailable — no changes to commit`):{id:`commit`,label:`Commit`,enabled:!0}:t(`Commit unavailable — ${U}`)}function G(e){let t=e=>({id:`push`,label:`Push`,enabled:!1,reason:e});return e.hasWorktree?e.remote===void 0?t(`Push unavailable — no remote configured`):e.branch===void 0?t(`Push unavailable — the run has no branch to push`):e.status===`running`?t(`Push unavailable — the agent is still working in this worktree`):{id:`push`,label:`Push`,enabled:!0}:t(`Push unavailable — ${U}`)}function K(e){let t=e=>({id:`create-pr`,label:`Create PR`,enabled:!1,reason:e});return!e.hasWorktree||e.branch===void 0?t(`Create PR unavailable — ${U}`):e.forge===null?t(`Create PR unavailable — no supported forge remote (GitHub) detected`):e.forge.available?H(e.status)?t(`Create PR unavailable — the run is still active; wait for the review gate`):{id:`create-pr`,label:`Create PR`,enabled:!0}:t(`Create PR unavailable — ${e.forge.reason??`the forge is unreachable`}`)}function q(e){let t=e.prUrl?{id:`view-pr`,label:`View PR`,enabled:!0,href:e.prUrl}:W(e),n=e.prUrl?[W(e),G(e)]:[G(e),K(e)],r=[];if(e.localHandoff){let t=e.hasSession?H(e.status)?{id:`open-terminal`,label:`Open in terminal`,enabled:!1,reason:`Terminal unavailable — the session is still active in the engine`}:{id:`open-terminal`,label:`Open in terminal`,enabled:!0}:{id:`open-terminal`,label:`Open in terminal`,enabled:!1,reason:`Terminal unavailable — no agent session to resume`};r.push(t)}return{primary:t,secondary:n,menu:r}}var J=n();function Y({run:e,open:t,onOpenChange:n}){let r=m(),[i,a]=(0,V.useState)(``),o=v(e),s=(0,V.useRef)(o);s.current=o,(0,V.useEffect)(()=>{t&&a(s.current)},[t]);let l=C({mutationFn:t=>u(e.id,t),onSuccess:t=>{c(`Committed ${t.sha.slice(0,7)}`),n(!1),r.invalidateQueries({queryKey:x.runs.changes(e.id)}),r.invalidateQueries({queryKey:x.runs.all})},onError:e=>c(e.message,{tone:`danger`})}),d=()=>{let e=i.trim();e.length===0||l.isPending||l.mutate(e)};return(0,J.jsx)(A,{open:t,onOpenChange:n,children:(0,J.jsxs)(M,{"data-slot":`commit-dialog`,children:[(0,J.jsxs)(j,{children:[(0,J.jsx)(N,{children:`Commit changes`}),(0,J.jsxs)(k,{children:[`Stages everything in the task's worktree (git add -A) and commits to`,` `,e.branch?(0,J.jsx)(`span`,{className:`font-mono`,children:e.branch}):`its branch`,`.`]})]}),(0,J.jsx)(P,{"data-slot":`commit-message`,"aria-label":`Commit message`,rows:3,value:i,onChange:e=>a(e.target.value),onKeyDown:e=>{I({key:e.key,shiftKey:e.shiftKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,repeat:e.repeat,isComposing:e.nativeEvent.isComposing})&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),d())}}),(0,J.jsxs)(O,{children:[(0,J.jsx)(p,{variant:`outline`,onClick:()=>n(!1),children:`Cancel`}),(0,J.jsx)(p,{"data-slot":`commit-confirm`,disabled:i.trim().length===0||l.isPending,onClick:d,children:l.isPending?`Committing…`:`Commit`})]})]})})}function X(){let{id:e}=i(),t=y(e);return t.isPending?(0,J.jsx)(R,{tab:`changes`}):t.isError?(0,J.jsx)(z,{tab:`changes`,error:t.error}):(0,J.jsx)(Z,{run:t.data})}function Z({run:e}){let t=_(),n=g(),i=S(e.id,L(e.status)),u=F(),[p,h]=(0,V.useState)(`unified`),[v,y]=(0,V.useState)(!1),[O,k]=(0,V.useState)(null),[A,j]=(0,V.useState)(!1),M=(0,V.useRef)(null),N=m(),P=()=>N.invalidateQueries({queryKey:x.runs.all}),I=e=>c(e.message,{tone:`danger`}),R=C({mutationFn:()=>l(e.id),onSuccess:e=>c(e.upstreamSet?`Pushed ${e.branch} to ${e.remote} (upstream set)`:`Pushed ${e.branch} to ${e.remote}`),onError:I}),z=C({mutationFn:()=>f(e.id),onSuccess:e=>{c(`Draft PR created — ${e.url}`),P()},onError:I}),H=C({mutationFn:()=>a(e.id),onError:e=>{if(e instanceof r&&e.command){navigator.clipboard.writeText(e.command).then(()=>c(`No terminal found — command copied to clipboard.`)).catch(()=>c(`Run manually: ${e.command}`));return}I(e)}}),U=C({mutationFn:t=>s(e.id,t),onError:I}),W=i.isError&&i.error instanceof r&&i.error.status===409,G=q({status:e.status,hasWorktree:!!e.worktreePath&&!W,branch:e.branch,changedFiles:i.data?.stat.files,remote:n.data?.info?.remote,forge:t.data?.forge??null,localHandoff:t.data?.capabilities.localHandoff??!1,hasSession:te(e)!==void 0,prUrl:e.pullRequestUrl}),K=e=>{switch(e){case`commit`:j(!0);break;case`push`:R.mutate();break;case`create-pr`:z.mutate();break;case`open-terminal`:H.mutate();break;case`view-pr`:break}},X=i.data?.files??[],Z=(0,V.useMemo)(()=>D(X),[X]),Q=u?p:`unified`,$=!u||v;return(0,J.jsxs)(`div`,{"data-route":`task-changes`,className:`flex min-h-full flex-col`,children:[(0,J.jsx)(w,{run:e,tab:`changes`}),(0,J.jsx)(E,{bar:G,branch:e.branch,stat:i.data?.stat,mode:Q,wrap:$,onModeChange:h,onWrapChange:y,onAction:K}),i.data?.repointedHead?(0,J.jsxs)(`p`,{"data-slot":`repointed-head-note`,className:`border-b px-4 py-2 text-xs text-soft-foreground md:px-9`,children:[`HEAD is on `,(0,J.jsx)(`code`,{children:i.data.repointedHead.headBranch}),`, not this task's branch`,` `,(0,J.jsx)(`code`,{children:i.data.repointedHead.taskBranch}),` — showing only what this task changed there.`]}):null,i.isPending?(0,J.jsx)(`p`,{"data-slot":`changes-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-9`,children:`Loading changes…`}):i.isError?(0,J.jsx)(b,{icon:W?(0,J.jsx)(o,{size:16}):(0,J.jsx)(ee,{size:16}),tone:W?`neutral`:`danger`,heading:`h2`,title:W?`No changes to show`:`Could not load the changes`,subtitle:i.error.message}):X.length===0?(0,J.jsx)(b,{icon:(0,J.jsx)(o,{size:16}),tone:`neutral`,heading:`h2`,title:`No changes yet`,subtitle:`The worktree matches its base branch. Changes appear here as the agent works.`}):(0,J.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col items-stretch gap-5 md:flex-row md:items-start px-[18px] pb-9 pt-0 [--diff-sticky-top:0px] md:[--diff-sticky-top:1rem] md:px-9`,children:[(0,J.jsxs)(`aside`,{"data-slot":`changes-tree-pane`,className:`md:sticky md:top-4 max-h-[calc(100dvh_-_64px_-_var(--diff-sticky-top)_-_1rem)] w-full md:w-60 shrink-0 overflow-y-auto overscroll-contain rounded-xl border border-border bg-card p-3.5 md:block lg:w-[250px]`,children:[(0,J.jsx)(`h2`,{className:`mb-3 border-b border-border pb-3 text-xs font-semibold`,children:`Changed files`}),(0,J.jsx)(T,{root:Z,selected:O,onSelect:e=>{k(e),M.current?.scrollToPath(e)}})]}),(0,J.jsx)(B,{files:X,viewRef:M,mode:Q,wrap:$,loadFileText:t=>ne(e.id,t),imageSrc:t=>d(e.id,t),onOpenInApp:t.data?.capabilities.localHandoff?e=>U.mutate(e):void 0,className:`min-w-0 flex-1`})]}),(0,J.jsx)(Y,{run:e,open:A,onOpenChange:j})]})}async function ne(e,t){try{let n=await h(e,t);return n.type!==`file`||n.binary||n.tooLarge?null:n.content??null}catch{return null}}export{X as TaskChangesRoute};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Ct as r,D as i,Gt as a,Hi as o,J as s,Pt as c,nt as l,q as u,t as d}from"./button-C_rd7CPp.js";import{t as f}from"./utils-JsL3ZsJf.js";import{At as p,Ot as m,_ as h,jt as g,kt as _}from"./alert-dialog-BrpNUwMt.js";import{t as v}from"./run-header-68WHf9wV.js";import{n as y}from"./diff-controls-B1-j7nFg.js";import{r as b}from"./format-DpNe3S0A.js";import{t as x}from"./search-x-I9Q8pgUa.js";import{A as S,Q as C,Tt as w,ht as T,kt as E,wt as D}from"./index-DgWWlOLy.js";import{t as O}from"./lib-BQXq3kEf.js";import{t as k}from"./diff-DrEARXTV.js";var A=e(t(),1),j=n(),M=77;function N({slot:e,commits:t,className:n,heading:i}){let[a,o]=(0,A.useState)(``),s=a.trim().toLowerCase(),c=s?t.filter(e=>e.subject.toLowerCase().includes(s)):t,l=c.length>150,u=(0,A.useRef)(null),d=(0,A.useRef)(null),[p,m]=(0,A.useState)(0);(0,A.useLayoutEffect)(()=>{if(!l)return;let e=()=>{let e=u.current,t=d.current;!e||!t||m(Math.max(0,Math.round(e.getBoundingClientRect().top-t.getBoundingClientRect().top+t.scrollTop)))};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[l]);let h=c.map(n=>(0,j.jsx)(P,{commit:n,detailed:e===`task-commits`&&t.length===1},n.sha));return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`label`,{className:`relative mb-[22px] block`,children:[(0,j.jsx)(r,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute top-3.5 left-3 size-4 text-muted-foreground`}),(0,j.jsx)(E,{"aria-label":`Search commit messages`,placeholder:`Search commit messages…`,value:a,onChange:e=>o(e.target.value),className:`h-11 bg-card pl-10`})]}),(0,j.jsxs)(`div`,{ref:e=>{u.current=e,e&&(d.current=e.closest(`[data-slot="main"]`))},"data-slot":e,"data-virtualized":l,className:f(`flex flex-col divide-y divide-border rounded-xl border border-border bg-card px-4 py-1 md:px-5`,n),children:[i?(0,j.jsx)(`div`,{className:`flex min-h-14 flex-wrap items-center gap-2 py-4`,children:i}):null,c.length===0?(0,j.jsx)(`p`,{role:`status`,className:`py-5 text-sm text-muted-foreground`,children:`No loaded commits match your search.`}):null,l?(0,j.jsx)(O,{scrollRef:d,startMargin:p,itemSize:M,children:h}):h]})]})}function P({commit:e,detailed:t}){return(0,j.jsx)(`div`,{className:`[contain-intrinsic-block-size:auto_77px] [content-visibility:auto]`,children:(0,j.jsxs)(b,{"data-slot":`commit-row`,"data-sha":e.sha,to:e.href,className:f(`flex min-h-[76px] min-w-0 flex-col items-start gap-3 rounded-sm py-4 hover:bg-muted`,!t&&`md:flex-row md:items-center md:py-3`),children:[(0,j.jsx)(l,{size:16,"aria-hidden":`true`,className:f(`shrink-0 text-accent-text`,t?`size-[22px]`:`size-4`)}),(0,j.jsxs)(`span`,{className:f(`min-w-0 w-full`,!t&&`md:w-auto md:flex-1`),children:[(0,j.jsx)(`span`,{className:f(`block font-normal`,t?`text-[22px] leading-snug`:`text-[13px] md:truncate`),children:e.subject}),(0,j.jsxs)(`span`,{className:`mt-1 block truncate text-[11px] text-soft-foreground`,children:[e.author,` · `,e.when]})]}),(0,j.jsx)(`span`,{className:`shrink-0 rounded-md bg-muted px-2 py-1 font-mono text-[11px] text-muted-foreground`,children:e.shaLabel}),t?(0,j.jsxs)(`span`,{className:`inline-flex min-h-11 items-center gap-2 rounded-lg bg-action px-3 text-xs font-medium text-action-foreground`,children:[(0,j.jsx)(s,{size:16,"aria-hidden":`true`,className:`size-4`}),`View changes`]}):null]})})}function F(){let{id:e}=o(),t=m(e);return t.isPending?(0,j.jsx)(w,{tab:`changes`}):t.isError?(0,j.jsx)(D,{tab:`changes`,error:t.error}):(0,j.jsx)(I,{run:t.data})}function I({run:e}){let{sha:t}=o(),n=g(e.id,C(e.status));return(0,j.jsxs)(`div`,{"data-route":`task-commits`,className:`flex min-h-full flex-col`,children:[(0,j.jsx)(v,{run:e,tab:`commits`}),t?(0,j.jsx)(L,{runId:e.id,sha:t}):n.isPending?(0,j.jsx)(`p`,{"data-slot":`commits-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading commits…`}):n.isError?(0,j.jsx)(h,{icon:(0,j.jsx)(l,{size:16}),tone:n.error instanceof a&&n.error.status===409?`neutral`:`danger`,heading:`h2`,title:n.error instanceof a&&n.error.status===409?`No commits to show`:`Could not load the commits`,subtitle:n.error.message}):n.data.commits.length===0?(0,j.jsx)(h,{icon:(0,j.jsx)(l,{size:16}),tone:`neutral`,heading:`h2`,title:`No commits yet`,subtitle:`This task hasn't committed anything on its branch. Autosave commits and any the agent makes appear here.`}):(0,j.jsxs)(`div`,{className:`px-[18px] py-[22px] md:px-9`,children:[(0,j.jsx)(N,{slot:`task-commits`,heading:(0,j.jsxs)(`h2`,{className:`text-base font-semibold`,children:[n.data.commits.length,` `,n.data.commits.length===1?`commit`:`commits`,` in this task`]}),className:`w-full`,commits:n.data.commits.map(t=>({...t,shaLabel:t.sha.slice(0,8),href:`/tasks/${e.id}/commits/${t.sha}`}))}),(0,j.jsx)(R,{run:e})]})]})}function L({runId:e,sha:t}){let n=p(e,t),r=S(),[o,s]=(0,A.useState)(`unified`),[u,f]=(0,A.useState)(!1),m=n.isError&&n.error instanceof a&&n.error.status===409,g=r?o:`unified`,_=!r||u;return(0,j.jsxs)(`section`,{"data-slot":`task-commit`,"data-sha":t,className:`mx-auto flex min-h-0 w-full max-w-[var(--measure)] flex-1 flex-col`,children:[(0,j.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2.5 gap-y-1.5 border-b border-border px-4 py-2 md:px-6`,children:[(0,j.jsx)(d,{asChild:!0,variant:`ghost`,size:`sm`,"data-slot":`commit-back`,children:(0,j.jsxs)(b,{to:`/tasks/${e}/commits`,children:[(0,j.jsx)(i,{size:16,"aria-hidden":`true`}),`All commits`]})}),n.data?(0,j.jsx)(T,{stat:n.data.stat}):null,(0,j.jsx)(`span`,{className:`ml-auto hidden items-center gap-1 md:flex`,children:(0,j.jsx)(y,{mode:o,wrap:u,onModeChange:s,onWrapChange:f})})]}),n.isPending?(0,j.jsx)(`p`,{"data-slot":`commit-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading commit…`}):n.isError?(0,j.jsx)(h,{icon:m?(0,j.jsx)(x,{}):(0,j.jsx)(c,{size:16}),tone:m?`neutral`:`danger`,heading:`h2`,title:m?`Commit not found`:`Could not load the commit`,subtitle:n.error.message}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{"data-slot":`commit-meta`,className:`border-b border-border px-4 py-3 md:px-6`,children:[(0,j.jsx)(`h2`,{className:`text-sm font-semibold`,children:n.data.subject}),(0,j.jsxs)(`p`,{className:`mt-0.5 text-[11px] text-soft-foreground`,children:[n.data.author,` · `,n.data.when,` ·`,` `,(0,j.jsx)(`span`,{className:`font-mono select-all`,children:n.data.sha})]})]}),n.data.files.length===0?(0,j.jsx)(h,{icon:(0,j.jsx)(l,{size:16}),tone:`neutral`,heading:`h2`,title:`No file changes`,subtitle:`This commit carries no diff of its own — a merge commit's changes live on the commits it merged.`}):(0,j.jsx)(`div`,{className:`px-4 py-4 [--diff-sticky-top:0px] md:[--diff-sticky-top:1rem] md:px-6`,children:(0,j.jsx)(k,{files:n.data.files,mode:g,wrap:_,className:`min-w-0`})})]})]})}function R({run:e}){let t=_(e.id,C(e.status));return t.isPending?(0,j.jsx)(`p`,{className:`mt-[22px] text-xs text-muted-foreground`,children:`Loading changed files…`}):t.isError?(0,j.jsxs)(`p`,{role:`status`,className:`mt-[22px] text-xs text-danger`,children:[`Could not load changed files: `,t.error.message]}):t.data.files.length===0?null:(0,j.jsxs)(`section`,{"data-slot":`task-commit-files`,className:`mt-[22px] rounded-[10px] border border-border bg-card p-5`,children:[(0,j.jsxs)(`h2`,{className:`mb-4 text-[16px] font-semibold`,children:[t.data.files.length,` changed files`]}),(0,j.jsx)(`ul`,{className:`space-y-4`,children:t.data.files.map(t=>(0,j.jsx)(`li`,{children:(0,j.jsxs)(b,{to:`/tasks/${e.id}/changes`,className:`flex min-h-11 items-center gap-2 text-xs text-muted-foreground hover:text-foreground`,children:[(0,j.jsx)(u,{size:16,"aria-hidden":`true`,className:`size-[15px] shrink-0`}),(0,j.jsx)(`span`,{className:`break-all`,children:t.path})]})},t.path))})]})}export{F as TaskCommitsRoute};
@@ -0,0 +1,2 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Ct as r,F as i,Gt as a,Hi as o,Pt as s,Qt as c,Ui as l,X as u,Y as d,ci as f,q as p,t as m,xn as h}from"./button-C_rd7CPp.js";import{t as g}from"./utils-JsL3ZsJf.js";import{L as _,Nt as v,O as y,Ot as b,_ as x,k as S}from"./alert-dialog-BrpNUwMt.js";import{t as C}from"./createLucideIcon-BHp8sXmF.js";import{n as w,t as T}from"./run-header-68WHf9wV.js";import{Ft as E,It as D,Lt as O,Pt as k,Rt as A,Tt as j,kt as M,wt as N}from"./index-DgWWlOLy.js";var P=C(`file-exclamation-point`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),F=C(`file-question-mark`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}],[`path`,{d:`M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3`,key:`mhlwft`}]]),I=C(`file-x`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m14.5 12.5-5 5`,key:`b62r18`}],[`path`,{d:`m9.5 12.5 5 5`,key:`1rk7el`}]]),L=C(`folder-tree`,[[`path`,{d:`M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`hod4my`}],[`path`,{d:`M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`w4yl2u`}],[`path`,{d:`M3 5a2 2 0 0 0 2 2h3`,key:`f2jnh7`}],[`path`,{d:`M3 3v13a2 2 0 0 0 2 2h3`,key:`k8epm1`}]]),R=C(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),z=e(t(),1),B=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`svg`,`bmp`,`ico`,`avif`]);function V(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=t.lastIndexOf(`.`);return n<=0?!1:B.has(t.slice(n+1).toLowerCase())}function H(e){return e.tooLarge?`too-large`:V(e.path)?`image`:e.binary?`binary`:`text`}function U(e){return e>=1024**2?`${(e/1024**2).toFixed(1)} MB`:e>=1024?`${(e/1024).toFixed(1)} kB`:`${e} B`}var W=n();function G({runId:e,path:t,className:n}){let r=v(e,t??void 0);if(t===null)return(0,W.jsx)(q,{className:n,children:(0,W.jsx)(x,{icon:(0,W.jsx)(d,{size:16}),tone:`neutral`,heading:`h2`,title:`Select a file`,subtitle:`Pick a file from this task’s worktree to inspect its contents.`,className:`[&_[data-slot=centered-state-tile]]:size-10 [&_[data-slot=centered-state-tile]]:border-0 [&_[data-slot=centered-state-tile]]:bg-transparent [&_[data-slot=centered-state-tile]]:text-accent-text [&_[data-slot=centered-state-tile]]:shadow-none [&_h2]:text-xl`})});if(r.isPending)return(0,W.jsx)(q,{className:n,children:(0,W.jsxs)(`p`,{"data-slot":`file-preview-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground`,children:[`Loading `,t,`…`]})});if(r.isError){let e=r.error instanceof a&&r.error.status===409;return(0,W.jsx)(q,{className:n,children:(0,W.jsx)(x,{icon:e?(0,W.jsx)(I,{}):(0,W.jsx)(s,{size:16}),tone:e?`neutral`:`danger`,heading:`h2`,title:e?`Cannot preview this file`:`Could not load this file`,subtitle:r.error.message})})}return r.data.type===`file`?(0,W.jsx)(K,{runId:e,entry:r.data,className:n}):(0,W.jsx)(q,{className:n,children:(0,W.jsx)(x,{icon:(0,W.jsx)(F,{}),tone:`neutral`,heading:`h2`,title:`Choose a file inside this directory`,subtitle:`Expand the folder in the tree, or enter the full path to a file.`})})}function K({runId:e,entry:t,className:n,imageUrl:r,downloadUrl:i,snapshot:a,documentPreview:o=!1}){let[s,c]=(0,z.useState)(!1),l=o&&/\.(?:md|markdown)$/i.test(t.path),u=/\.(?:png|jpe?g|gif|webp|bmp|ico|avif)$/i.test(t.path),d=o&&u&&t.size<=10*1024*1024?`image`:H(t);return(0,W.jsxs)(q,{className:n,children:[(0,W.jsxs)(`header`,{"data-slot":`file-preview-head`,className:`flex items-center gap-2 border-b border-border bg-muted/40 px-4 py-2 text-xs`,children:[(0,W.jsx)(`span`,{className:`min-w-0 truncate font-mono font-medium`,children:t.path}),(0,W.jsx)(`span`,{className:`ml-auto shrink-0 tabular-nums text-soft-foreground`,children:U(t.size)})]}),a||i||l?(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 border-b border-border px-4 py-2 text-xs`,children:[a?(0,W.jsxs)(`span`,{children:[`Published snapshot · `,a]}):null,i?(0,W.jsx)(`a`,{className:`inline-flex min-h-11 items-center text-accent-text underline`,href:i,children:`Download`}):null,l?(0,W.jsx)(`button`,{className:`min-h-11 rounded px-2 text-accent-text underline focus-visible:ring-2`,onClick:()=>c(e=>!e),children:s?`Preview`:`View source`}):null]}):null,d===`image`&&(!o||u)?(0,W.jsx)(`div`,{className:`flex justify-center p-4`,children:(0,W.jsx)(`img`,{"data-slot":`file-preview-image`,src:r??f(e,t.path),alt:t.path,className:`max-h-[70vh] max-w-full rounded-sm`})}):d===`too-large`?(0,W.jsx)(x,{icon:(0,W.jsx)(P,{}),tone:`neutral`,heading:`h2`,title:`Too large to preview`,subtitle:`${U(t.size)} — past the preview cap. Open it in your editor instead.`}):d===`binary`?(0,W.jsx)(x,{icon:(0,W.jsx)(F,{}),tone:`neutral`,heading:`h2`,title:`Binary file`,subtitle:`${U(t.size)} of binary data — no text preview.`}):l&&!s?(0,W.jsx)(`div`,{className:`p-4`,children:(0,W.jsx)(k,{document:!0,children:t.content??``})}):(0,W.jsx)(X,{path:t.path,text:t.content??``})]})}function q({className:e,children:t}){return(0,W.jsx)(`section`,{"data-slot":`file-preview`,className:g(`flex flex-col overflow-hidden rounded-lg border border-border bg-card`,e),children:t})}var J=1500;function Y(e,t){let n=(0,z.useMemo)(()=>t.split(`
2
+ `).map(e=>[{content:e}]),[t]),r=(0,z.useMemo)(()=>A(e),[e]),i=n.length>J,[a,o]=(0,z.useState)(null);return(0,z.useEffect)(()=>{if(r===null||i)return;let n=!1;return D(t,r).then(r=>{n||o({key:`${e}\0${t}`,tokens:r.tokens})}),()=>{n=!0}},[e,t,r,i]),r===null||i?n:a?.key===`${e}\0${t}`?a.tokens:O(t,r)?.tokens??n}function X({path:e,text:t}){let n=Y(e,t);return(0,W.jsx)(`div`,{"data-slot":`file-preview-code`,"data-lang":A(e)??`plaintext`,className:`overflow-x-auto py-2 font-mono text-xs leading-[1.7]`,children:n.map((e,t)=>(0,W.jsxs)(`div`,{className:`flex px-4`,children:[(0,W.jsx)(`span`,{className:`w-10 shrink-0 select-none pr-3 text-right tabular-nums text-soft-foreground`,children:t+1}),(0,W.jsx)(`span`,{className:`min-w-0 flex-1 whitespace-pre pr-4`,children:e.map((e,t)=>(0,W.jsx)(`span`,{style:e.color===void 0?void 0:{color:e.color},children:e.content},t))})]},t))})}function Z({runId:e,path:t,artifactId:n}){let r=_(e,n?null:t),i=y(e,n),a=n?i:r,o=(0,z.useContext)(E),s=a.data,l=(0,z.useMemo)(()=>s?.type===`file`&&s.source!==`artifact`?{runId:e,...o,basePath:s.path}:null,[s,o,e]);if(!t&&!n)return(0,W.jsx)(G,{runId:e,path:null,className:`min-w-0 flex-1`});if(a.isPending)return(0,W.jsx)(`p`,{role:`status`,className:`p-4`,children:`Loading file…`});if(a.isError)return(0,W.jsxs)(`section`,{"data-slot":`file-preview`,className:`min-w-0 flex-1 rounded-lg border p-4`,children:[(0,W.jsx)(`h2`,{children:`Could not load this file`}),(0,W.jsx)(`p`,{className:`wrap-anywhere text-sm`,children:a.error.message}),(0,W.jsx)(m,{variant:`outline`,onClick:()=>void a.refetch(),children:`Retry`})]});if(!s)return(0,W.jsx)(`p`,{role:`alert`,className:`p-4`,children:`No file data was returned.`});if(s.type!==`file`)return(0,W.jsxs)(`section`,{"data-slot":`file-preview`,className:`min-w-0 flex-1 rounded-lg border p-4`,children:[(0,W.jsx)(`h2`,{children:s.type===`unpublished`?`File not published`:`Cannot preview this file`}),(0,W.jsx)(`p`,{className:`wrap-anywhere py-2 font-mono text-xs`,children:s.path}),(0,W.jsx)(`p`,{className:`text-sm`,children:s.reason}),(0,W.jsx)(m,{variant:`outline`,onClick:()=>void a.refetch(),children:`Retry`})]});let u=s.artifact;return(0,W.jsx)(E.Provider,{value:l,children:(0,W.jsx)(K,{runId:e,entry:s,documentPreview:!0,className:`min-w-0 flex-1`,imageUrl:u?c(e,u.id,`image`):h(e,t),...u?{downloadUrl:c(e,u.id,`download`),snapshot:new Date(u.createdAt).toLocaleString()}:{}},u?.id??s.path)})}function Q({runId:e,selected:t,onSelect:n}){return(0,W.jsx)(`nav`,{"data-slot":`files-tree`,"aria-label":`Worktree files`,className:`min-w-0 text-[13px]`,children:(0,W.jsx)(`ul`,{className:`flex flex-col gap-px`,children:(0,W.jsx)($,{runId:e,path:``,depth:0,selected:t,onSelect:n})})})}function $({runId:e,path:t,depth:n,selected:r,onSelect:i}){let a=v(e,t);return a.isPending?(0,W.jsx)(`li`,{"data-slot":`files-tree-loading`,className:`px-1.5 py-1 text-xs text-soft-foreground`,style:{paddingLeft:`${6+n*14}px`},children:`Loading…`}):a.isError?(0,W.jsx)(`li`,{"data-slot":`files-tree-error`,className:`px-1.5 py-1 text-xs text-danger`,style:{paddingLeft:`${6+n*14}px`},children:a.error.message}):a.data.type===`dir`?a.data.entries.length===0?(0,W.jsx)(`li`,{"data-slot":`files-tree-empty`,className:`px-1.5 py-1 text-xs text-soft-foreground`,style:{paddingLeft:`${6+n*14}px`},children:`Empty directory`}):(0,W.jsx)(W.Fragment,{children:a.data.entries.map(a=>a.type===`dir`?(0,W.jsx)(ee,{runId:e,name:a.name,path:t===``?a.name:`${t}/${a.name}`,depth:n,selected:r,onSelect:i},a.name):(0,W.jsx)(te,{name:a.name,path:t===``?a.name:`${t}/${a.name}`,size:a.size,depth:n,selected:r,onSelect:i},a.name))}):null}function ee({runId:e,name:t,path:n,depth:r,selected:a,onSelect:o}){let[s,c]=(0,z.useState)(!1);return(0,W.jsxs)(`li`,{children:[(0,W.jsxs)(`button`,{type:`button`,"data-slot":`files-dir`,"data-path":n,"data-state":s?`open`:`closed`,"aria-expanded":s,onClick:()=>c(e=>!e),className:`flex min-h-11 md:min-h-8 w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left text-muted-foreground hover:bg-muted hover:text-foreground`,style:{paddingLeft:`${6+r*14}px`},children:[(0,W.jsx)(i,{size:16,"aria-hidden":`true`,className:g(`order-last ml-auto size-3.5 shrink-0 transition-transform motion-reduce:transition-none`,s&&`rotate-90`)}),(0,W.jsx)(u,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,W.jsx)(`span`,{className:`min-w-0 truncate font-normal`,children:t})]}),s?(0,W.jsx)(`ul`,{className:`flex flex-col gap-px`,children:(0,W.jsx)($,{runId:e,path:n,depth:r+1,selected:a,onSelect:o})}):null]})}function te({name:e,path:t,size:n,depth:r,selected:i,onSelect:a}){let o=i===t,s=V(t)?R:p;return(0,W.jsx)(`li`,{children:(0,W.jsxs)(`button`,{type:`button`,"data-slot":`files-file`,"data-path":t,"aria-current":o?`true`:void 0,onClick:()=>a(t),className:g(`flex min-h-11 md:min-h-8 w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left hover:bg-muted`,o?`bg-muted font-medium text-foreground`:`text-muted-foreground hover:text-foreground`),style:{paddingLeft:`${6+r*14}px`},children:[(0,W.jsx)(s,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,W.jsx)(`span`,{className:`min-w-0 truncate`,children:e}),n===void 0?null:(0,W.jsx)(`span`,{className:`ml-auto shrink-0 pl-2 font-mono text-[11px] tabular-nums text-soft-foreground`,children:U(n)})]})})}function ne(){let{id:e}=o(),t=b(e);return t.isPending?(0,W.jsx)(j,{tab:`files`}):t.isError?(0,W.jsx)(N,{tab:`files`,error:t.error}):(0,W.jsx)(w,{runId:t.data.id,children:(0,W.jsx)(re,{run:t.data},t.data.id)})}function re({run:e}){let t=v(e.id,``),n=S(e.id),[i,o]=l(),c=i.get(`path`),u=i.get(`artifact`),d=i.getAll(`path`).length>1||i.getAll(`artifact`).length>1||c!==null&&u!==null,[f,p]=(0,z.useState)(c??``);(0,z.useEffect)(()=>p(c??``),[c]);let h=(e,t)=>{let n=new URLSearchParams(i);n.delete(`path`),n.delete(`artifact`),n.set(e,t),o(n)},g=t.isError&&t.error instanceof a&&t.error.status===409;return(0,W.jsxs)(`div`,{"data-route":`task-files`,className:`flex min-h-full flex-col`,children:[(0,W.jsx)(T,{run:e,tab:`files`}),(0,W.jsxs)(`form`,{className:`flex min-w-0 gap-2 px-[18px] pt-[22px] md:px-9`,onSubmit:e=>{e.preventDefault(),f.trim()&&h(`path`,f.trim())},children:[(0,W.jsxs)(`label`,{className:`relative min-w-0 flex-1`,children:[(0,W.jsx)(r,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,W.jsx)(M,{"aria-label":`File path in the worktree`,placeholder:`Open a file by path…`,value:f,onChange:e=>p(e.target.value),className:`h-11 min-w-0 bg-card pl-10`})]}),(0,W.jsx)(m,{type:`submit`,variant:`outline`,className:`h-11 shrink-0`,disabled:!f.trim(),children:`Open file`})]}),(0,W.jsxs)(`div`,{className:`flex min-h-0 flex-col items-stretch gap-5 px-[18px] py-[22px] [--diff-sticky-top:1rem] md:flex-row md:items-start md:px-9`,children:[(0,W.jsxs)(`aside`,{"data-slot":`files-tree-pane`,className:`w-full shrink-0 rounded-xl border border-border bg-card p-3.5 md:sticky md:top-[var(--diff-sticky-top)] md:max-h-[calc(100dvh_-_64px_-_var(--diff-sticky-top)_-_1rem)] md:w-60 md:overflow-y-auto md:overscroll-contain lg:w-72`,children:[(0,W.jsx)(`h2`,{className:`sr-only`,children:`Worktree files`}),t.isPending?(0,W.jsx)(`p`,{"data-slot":`files-loading`,className:`py-4 text-xs`,children:`Loading files…`}):t.isError?(0,W.jsx)(x,{icon:g?(0,W.jsx)(L,{}):(0,W.jsx)(s,{size:16}),tone:g?`neutral`:`danger`,heading:`h2`,title:g?`No files to browse`:`Could not load the files`,subtitle:t.error.message}):(0,W.jsx)(Q,{runId:e.id,selected:c,onSelect:e=>h(`path`,e)}),(0,W.jsxs)(`section`,{className:`mt-4 border-t border-border pt-3`,"aria-label":`Published artifacts`,children:[(0,W.jsx)(`h2`,{className:`text-sm font-medium`,children:`Published artifacts`}),n.isPending?(0,W.jsx)(`p`,{className:`py-2 text-xs`,children:`Loading published files…`}):n.isError?(0,W.jsx)(`p`,{role:`alert`,className:`py-2 text-xs`,children:`Could not load published files.`}):n.data.artifacts.length===0?(0,W.jsx)(`p`,{className:`py-2 text-xs text-muted-foreground`,children:`No published files yet.`}):(0,W.jsx)(`ul`,{children:n.data.artifacts.map(e=>(0,W.jsx)(`li`,{children:(0,W.jsx)(`button`,{type:`button`,"aria-current":e.id===u?`true`:void 0,className:`min-h-11 w-full rounded px-2 py-2 text-left text-xs wrap-anywhere hover:bg-muted focus-visible:ring-2`,onClick:()=>h(`artifact`,e.id),children:e.name})},e.id))}),(0,W.jsx)(m,{variant:`ghost`,className:`min-h-11`,onClick:()=>void n.refetch(),children:`Refresh published files`})]})]}),d?(0,W.jsx)(`p`,{role:`alert`,className:`p-4`,children:`Invalid file link: choose either a path or a published artifact.`}):c!==null||u!==null||t.isSuccess?(0,W.jsx)(Z,{runId:e.id,path:c,artifactId:u}):null]}),(0,W.jsx)(`p`,{className:`px-[18px] pb-6 text-xs text-muted-foreground md:px-9`,children:`Browsing files is read-only. Worktree contents may differ from your main checkout. Published files are snapshots.`})]})}export{ne as TaskFilesRoute};