@useorgx/openclaw-plugin 0.4.9 → 0.7.2

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 (224) hide show
  1. package/README.md +77 -11
  2. package/dashboard/dist/assets/6mILZQ2a.js +1 -0
  3. package/dashboard/dist/assets/6mILZQ2a.js.br +0 -0
  4. package/dashboard/dist/assets/6mILZQ2a.js.gz +0 -0
  5. package/dashboard/dist/assets/8dksYiq4.js +2 -0
  6. package/dashboard/dist/assets/8dksYiq4.js.br +0 -0
  7. package/dashboard/dist/assets/8dksYiq4.js.gz +0 -0
  8. package/dashboard/dist/assets/B5zYRHc3.js +1 -0
  9. package/dashboard/dist/assets/B5zYRHc3.js.br +0 -0
  10. package/dashboard/dist/assets/B5zYRHc3.js.gz +0 -0
  11. package/dashboard/dist/assets/B6wPWJ35.js +1 -0
  12. package/dashboard/dist/assets/B6wPWJ35.js.br +0 -0
  13. package/dashboard/dist/assets/B6wPWJ35.js.gz +0 -0
  14. package/dashboard/dist/assets/BJgZIVUQ.js +53 -0
  15. package/dashboard/dist/assets/BJgZIVUQ.js.br +0 -0
  16. package/dashboard/dist/assets/BJgZIVUQ.js.gz +0 -0
  17. package/dashboard/dist/assets/BWEwjt1W.js +1 -0
  18. package/dashboard/dist/assets/BWEwjt1W.js.br +0 -0
  19. package/dashboard/dist/assets/BWEwjt1W.js.gz +0 -0
  20. package/dashboard/dist/assets/BgOYB78t.js +4 -0
  21. package/dashboard/dist/assets/BgOYB78t.js.br +0 -0
  22. package/dashboard/dist/assets/BgOYB78t.js.gz +0 -0
  23. package/dashboard/dist/assets/BzRbDCAD.css +1 -0
  24. package/dashboard/dist/assets/BzRbDCAD.css.br +0 -0
  25. package/dashboard/dist/assets/BzRbDCAD.css.gz +0 -0
  26. package/dashboard/dist/assets/C-KIc3Wc.js.br +0 -0
  27. package/dashboard/dist/assets/C-KIc3Wc.js.gz +0 -0
  28. package/dashboard/dist/assets/C8uM3AX8.js +1 -0
  29. package/dashboard/dist/assets/C8uM3AX8.js.br +0 -0
  30. package/dashboard/dist/assets/C8uM3AX8.js.gz +0 -0
  31. package/dashboard/dist/assets/C9jy61eu.js +212 -0
  32. package/dashboard/dist/assets/C9jy61eu.js.br +0 -0
  33. package/dashboard/dist/assets/C9jy61eu.js.gz +0 -0
  34. package/dashboard/dist/assets/CC63EwFD.js +1 -0
  35. package/dashboard/dist/assets/CC63EwFD.js.br +0 -0
  36. package/dashboard/dist/assets/CC63EwFD.js.gz +0 -0
  37. package/dashboard/dist/assets/CL_wXqR7.js +1 -0
  38. package/dashboard/dist/assets/CL_wXqR7.js.br +0 -0
  39. package/dashboard/dist/assets/CL_wXqR7.js.gz +0 -0
  40. package/dashboard/dist/assets/CZaT3ob_.js +1 -0
  41. package/dashboard/dist/assets/CZaT3ob_.js.br +0 -0
  42. package/dashboard/dist/assets/CZaT3ob_.js.gz +0 -0
  43. package/dashboard/dist/assets/CgaottFX.js +1 -0
  44. package/dashboard/dist/assets/CgaottFX.js.br +0 -0
  45. package/dashboard/dist/assets/CgaottFX.js.gz +0 -0
  46. package/dashboard/dist/assets/{CpJsfbXo.js → CxQ08qFN.js} +2 -2
  47. package/dashboard/dist/assets/CxQ08qFN.js.br +0 -0
  48. package/dashboard/dist/assets/CxQ08qFN.js.gz +0 -0
  49. package/dashboard/dist/assets/CzCxAZlW.js +1 -0
  50. package/dashboard/dist/assets/CzCxAZlW.js.br +0 -0
  51. package/dashboard/dist/assets/CzCxAZlW.js.gz +0 -0
  52. package/dashboard/dist/assets/D3iMTYEj.js +1 -0
  53. package/dashboard/dist/assets/D3iMTYEj.js.br +0 -0
  54. package/dashboard/dist/assets/D3iMTYEj.js.gz +0 -0
  55. package/dashboard/dist/assets/D8JNX8kq.js +2 -0
  56. package/dashboard/dist/assets/D8JNX8kq.js.br +0 -0
  57. package/dashboard/dist/assets/D8JNX8kq.js.gz +0 -0
  58. package/dashboard/dist/assets/DnA8dpj6.js +1 -0
  59. package/dashboard/dist/assets/DnA8dpj6.js.br +0 -0
  60. package/dashboard/dist/assets/DnA8dpj6.js.gz +0 -0
  61. package/dashboard/dist/assets/IUexzymk.js +1 -0
  62. package/dashboard/dist/assets/IUexzymk.js.br +0 -0
  63. package/dashboard/dist/assets/IUexzymk.js.gz +0 -0
  64. package/dashboard/dist/assets/cNrhgGc1.js +8 -0
  65. package/dashboard/dist/assets/cNrhgGc1.js.br +0 -0
  66. package/dashboard/dist/assets/cNrhgGc1.js.gz +0 -0
  67. package/dashboard/dist/assets/ic2FaMnh.js +1 -0
  68. package/dashboard/dist/assets/ic2FaMnh.js.br +0 -0
  69. package/dashboard/dist/assets/ic2FaMnh.js.gz +0 -0
  70. package/dashboard/dist/assets/qm8xLgv-.css +1 -0
  71. package/dashboard/dist/assets/qm8xLgv-.css.br +0 -0
  72. package/dashboard/dist/assets/qm8xLgv-.css.gz +0 -0
  73. package/dashboard/dist/assets/rttbDbEx.js +1 -0
  74. package/dashboard/dist/assets/rttbDbEx.js.br +0 -0
  75. package/dashboard/dist/assets/rttbDbEx.js.gz +0 -0
  76. package/dashboard/dist/brand/anthropic-mark.svg.br +0 -0
  77. package/dashboard/dist/brand/anthropic-mark.svg.gz +0 -0
  78. package/dashboard/dist/brand/openai-mark.svg.br +0 -0
  79. package/dashboard/dist/brand/openai-mark.svg.gz +0 -0
  80. package/dashboard/dist/brand/openclaw-mark.svg.br +0 -0
  81. package/dashboard/dist/brand/openclaw-mark.svg.gz +0 -0
  82. package/dashboard/dist/brand/xandy-orchestrator.png +0 -0
  83. package/dashboard/dist/index.html +7 -5
  84. package/dashboard/dist/index.html.br +0 -0
  85. package/dashboard/dist/index.html.gz +0 -0
  86. package/dist/activity-actor-fields.js +26 -4
  87. package/dist/activity-store.js +34 -8
  88. package/dist/agent-context-store.js +79 -17
  89. package/dist/agent-run-store.js +44 -3
  90. package/dist/agent-suite.d.ts +9 -0
  91. package/dist/agent-suite.js +149 -9
  92. package/dist/artifacts/artifact-domain-schemas.d.ts +66 -0
  93. package/dist/artifacts/artifact-domain-schemas.js +357 -0
  94. package/dist/artifacts/register-artifact.d.ts +4 -3
  95. package/dist/artifacts/register-artifact.js +170 -57
  96. package/dist/chat-store.d.ts +157 -0
  97. package/dist/chat-store.js +586 -0
  98. package/dist/cli/orgx.js +11 -0
  99. package/dist/contracts/client.d.ts +43 -3
  100. package/dist/contracts/client.js +159 -30
  101. package/dist/contracts/practice-exercise-schema.d.ts +216 -0
  102. package/dist/contracts/practice-exercise-schema.js +314 -0
  103. package/dist/contracts/retro-schema.d.ts +81 -0
  104. package/dist/contracts/retro-schema.js +80 -0
  105. package/dist/contracts/shared-types.d.ts +159 -0
  106. package/dist/contracts/shared-types.js +199 -1
  107. package/dist/contracts/skill-pack-schema.d.ts +192 -0
  108. package/dist/contracts/skill-pack-schema.js +180 -0
  109. package/dist/contracts/types.d.ts +247 -2
  110. package/dist/entities/auto-assignment.js +43 -17
  111. package/dist/event-sanitization.d.ts +11 -0
  112. package/dist/event-sanitization.js +113 -0
  113. package/dist/gateway-watchdog.d.ts +5 -0
  114. package/dist/gateway-watchdog.js +50 -0
  115. package/dist/hooks/post-reporting-event.mjs +1 -5
  116. package/dist/http/helpers/activity-headline.js +13 -132
  117. package/dist/http/helpers/auto-continue-engine.d.ts +198 -10
  118. package/dist/http/helpers/auto-continue-engine.js +3145 -186
  119. package/dist/http/helpers/autopilot-operations.d.ts +19 -0
  120. package/dist/http/helpers/autopilot-operations.js +182 -31
  121. package/dist/http/helpers/autopilot-runtime.d.ts +1 -0
  122. package/dist/http/helpers/autopilot-runtime.js +328 -25
  123. package/dist/http/helpers/autopilot-slice-utils.d.ts +18 -0
  124. package/dist/http/helpers/autopilot-slice-utils.js +514 -93
  125. package/dist/http/helpers/decision-mapper.d.ts +40 -0
  126. package/dist/http/helpers/decision-mapper.js +223 -7
  127. package/dist/http/helpers/dispatch-lifecycle.d.ts +19 -2
  128. package/dist/http/helpers/dispatch-lifecycle.js +242 -37
  129. package/dist/http/helpers/kickoff-context.js +104 -0
  130. package/dist/http/helpers/llm-client.d.ts +47 -0
  131. package/dist/http/helpers/llm-client.js +256 -0
  132. package/dist/http/helpers/mission-control.d.ts +102 -3
  133. package/dist/http/helpers/mission-control.js +498 -9
  134. package/dist/http/helpers/sentinel-catalog.d.ts +23 -0
  135. package/dist/http/helpers/sentinel-catalog.js +193 -0
  136. package/dist/http/helpers/session-classification.d.ts +9 -0
  137. package/dist/http/helpers/session-classification.js +564 -0
  138. package/dist/http/helpers/slice-experience-v2.d.ts +137 -0
  139. package/dist/http/helpers/slice-experience-v2.js +677 -0
  140. package/dist/http/helpers/slice-run-projections.d.ts +72 -0
  141. package/dist/http/helpers/slice-run-projections.js +877 -0
  142. package/dist/http/helpers/triage-mapper.d.ts +43 -0
  143. package/dist/http/helpers/triage-mapper.js +549 -0
  144. package/dist/http/helpers/value-utils.js +7 -2
  145. package/dist/http/helpers/workspace-scope.d.ts +15 -0
  146. package/dist/http/helpers/workspace-scope.js +170 -0
  147. package/dist/http/index.js +1420 -105
  148. package/dist/http/routes/agent-suite.d.ts +9 -0
  149. package/dist/http/routes/agent-suite.js +294 -8
  150. package/dist/http/routes/agents-catalog.js +64 -19
  151. package/dist/http/routes/chat.d.ts +19 -0
  152. package/dist/http/routes/chat.js +522 -0
  153. package/dist/http/routes/decision-actions.d.ts +8 -1
  154. package/dist/http/routes/decision-actions.js +42 -5
  155. package/dist/http/routes/dispatch-gateway-envelope.d.ts +25 -0
  156. package/dist/http/routes/dispatch-gateway-envelope.js +26 -0
  157. package/dist/http/routes/entities.d.ts +16 -0
  158. package/dist/http/routes/entities.js +232 -6
  159. package/dist/http/routes/live-legacy.d.ts +5 -0
  160. package/dist/http/routes/live-legacy.js +23 -509
  161. package/dist/http/routes/live-misc.d.ts +12 -0
  162. package/dist/http/routes/live-misc.js +251 -31
  163. package/dist/http/routes/live-snapshot.d.ts +49 -2
  164. package/dist/http/routes/live-snapshot.js +653 -23
  165. package/dist/http/routes/live-terminal.d.ts +11 -0
  166. package/dist/http/routes/live-terminal.js +154 -0
  167. package/dist/http/routes/live-triage.d.ts +61 -0
  168. package/dist/http/routes/live-triage.js +192 -0
  169. package/dist/http/routes/mission-control-actions.d.ts +49 -1
  170. package/dist/http/routes/mission-control-actions.js +1246 -84
  171. package/dist/http/routes/mission-control-read.d.ts +48 -3
  172. package/dist/http/routes/mission-control-read.js +1658 -20
  173. package/dist/http/routes/realtime-orchestrator.d.ts +10 -0
  174. package/dist/http/routes/realtime-orchestrator.js +74 -0
  175. package/dist/http/routes/run-control.d.ts +5 -2
  176. package/dist/http/routes/run-control.js +10 -0
  177. package/dist/http/routes/sentinels-catalog.d.ts +7 -0
  178. package/dist/http/routes/sentinels-catalog.js +24 -0
  179. package/dist/http/routes/summary.js +10 -3
  180. package/dist/http/routes/usage.d.ts +24 -0
  181. package/dist/http/routes/usage.js +362 -0
  182. package/dist/http/routes/work-artifacts.js +28 -9
  183. package/dist/index.js +165 -27
  184. package/dist/local-openclaw.js +29 -6
  185. package/dist/mcp-client-setup.js +3 -3
  186. package/dist/mcp-http-handler.d.ts +3 -0
  187. package/dist/mcp-http-handler.js +34 -60
  188. package/dist/next-up-queue-store.d.ts +16 -1
  189. package/dist/next-up-queue-store.js +89 -7
  190. package/dist/outbox.d.ts +5 -0
  191. package/dist/outbox.js +113 -9
  192. package/dist/paths.js +36 -5
  193. package/dist/reporting/rollups.d.ts +41 -0
  194. package/dist/reporting/rollups.js +113 -0
  195. package/dist/retro/domain-templates.d.ts +45 -0
  196. package/dist/retro/domain-templates.js +297 -0
  197. package/dist/retro/quality-rubric.d.ts +33 -0
  198. package/dist/retro/quality-rubric.js +213 -0
  199. package/dist/runtime-cleanup.d.ts +18 -0
  200. package/dist/runtime-cleanup.js +87 -0
  201. package/dist/services/background.d.ts +11 -0
  202. package/dist/services/background.js +22 -0
  203. package/dist/services/experiment-randomization.d.ts +21 -0
  204. package/dist/services/experiment-randomization.js +63 -0
  205. package/dist/skill-pack-state.d.ts +36 -5
  206. package/dist/skill-pack-state.js +273 -29
  207. package/dist/sync/local-agent-telemetry.d.ts +13 -0
  208. package/dist/sync/local-agent-telemetry.js +128 -0
  209. package/dist/sync/outbox-replay.js +131 -24
  210. package/dist/team-context-store.d.ts +23 -0
  211. package/dist/team-context-store.js +116 -0
  212. package/dist/telemetry/posthog.js +4 -2
  213. package/dist/tools/core-tools.d.ts +10 -14
  214. package/dist/tools/core-tools.js +1289 -24
  215. package/dist/types.d.ts +2 -0
  216. package/dist/types.js +2 -0
  217. package/dist/worker-supervisor.js +23 -0
  218. package/package.json +20 -6
  219. package/dashboard/dist/assets/B3ziCA02.js +0 -8
  220. package/dashboard/dist/assets/B5NEElEI.css +0 -1
  221. package/dashboard/dist/assets/BhapSNAs.js +0 -215
  222. package/dashboard/dist/assets/iFdvE7lx.js +0 -1
  223. package/dashboard/dist/assets/jRJsmpYM.js +0 -1
  224. package/dashboard/dist/assets/sAhvFnpk.js +0 -4
package/README.md CHANGED
@@ -163,17 +163,48 @@ Environment overrides:
163
163
 
164
164
  ### MCP Tools
165
165
 
166
- The plugin registers these tools for your agents:
167
-
168
- - **`orgx_status`** — Get current org status (initiatives, agents, tasks, decisions)
169
- - **`orgx_status_json`** — Get current org status as JSON (for MCP Apps / automation)
170
- - **`orgx_live_app`** — Open the OrgX Live MCP App (interactive widget)
171
- - **`orgx_sync`** — Bidirectional memory sync with OrgX
172
- - **`orgx_spawn_check`** — Pre-spawn quality gate + model routing
173
- - **`orgx_quality_score`** — Record quality scores for completed work
174
- - **`orgx_create_entity`** — Create initiatives, tasks, decisions, etc.
175
- - **`orgx_update_entity`** Update entity status and fields
176
- - **`orgx_list_entities`** — Query entities by type and status
166
+ The plugin currently registers **27 MCP tools** from `src/tools/core-tools.ts`.
167
+
168
+ Core sync/reporting:
169
+ - `orgx_status`
170
+ - `orgx_sync`
171
+ - `orgx_emit_activity`
172
+ - `orgx_report_progress`
173
+ - `orgx_register_artifact`
174
+
175
+ Delegation, checkpoints, run control:
176
+ - `orgx_delegation_preflight`
177
+ - `orgx_spawn_check`
178
+ - `orgx_run_action`
179
+ - `orgx_checkpoints_list`
180
+ - `orgx_checkpoint_restore`
181
+
182
+ Quality, proof, and outcomes:
183
+ - `orgx_quality_score`
184
+ - `orgx_proof_status`
185
+ - `orgx_verify_completion`
186
+ - `orgx_record_outcome`
187
+ - `orgx_get_outcome_attribution`
188
+
189
+ Entity and stream management:
190
+ - `orgx_create_entity`
191
+ - `orgx_update_entity`
192
+ - `orgx_list_entities`
193
+ - `orgx_reassign_stream`
194
+ - `orgx_reassign_streams`
195
+ - `orgx_apply_changeset`
196
+ - `update_stream_progress`
197
+
198
+ Decision and config/policy:
199
+ - `orgx_request_decision`
200
+ - `orgx_sentinel_catalog`
201
+ - `list_agent_configs`
202
+ - `get_agent_config`
203
+ - `update_agent_config`
204
+
205
+ The local MCP bridge endpoints are:
206
+ - `/orgx/mcp` (full tool surface)
207
+ - `/orgx/mcp/{domain}` (domain-scoped subset)
177
208
 
178
209
  ### Live Dashboard
179
210
 
@@ -299,6 +330,38 @@ Notes:
299
330
  Manual dispatch:
300
331
  - Use `docs/marketing/manual-agent-dispatch-golden-prompt.md` when manually launching a marketing agent for a specific task (non-batched dispatch).
301
332
 
333
+ ## Version Harness E2E (Real Queue + Play + Auto)
334
+
335
+ Use this when you need a real end-to-end validation of queue execution in a live plugin session:
336
+ - seeds an isolated initiative with workstreams/milestones/tasks across domains
337
+ - moves the harness workstream to top of Next Up
338
+ - executes one manual `Play`
339
+ - executes auto-continue for the remaining slices (default target is 5, auto-raised if needed to cover all seeded domains)
340
+ - validates completed slices, run isolation (unique run IDs), skill/domain coverage, progress evidence, task/artifact updates, and exact output file contents
341
+ - tears down seeded entities and restores queue order
342
+ - writes a JSON report to `artifacts/harness-runs/`
343
+
344
+ Safety gate (required):
345
+
346
+ ```bash
347
+ export ORGX_E2E_ALLOW_WRITE=1
348
+ ```
349
+
350
+ Run:
351
+
352
+ ```bash
353
+ npm run verify:version-harness
354
+ ```
355
+
356
+ Useful options:
357
+ - `ORGX_HARNESS_BASE_URL` (default `http://127.0.0.1:18789`)
358
+ - `ORGX_HARNESS_TARGET_COMPLETED_SLICES` (default `5`)
359
+ - `ORGX_HARNESS_REQUEST_TIMEOUT_MS` (default `30000`; per-request API timeout)
360
+ - `ORGX_HARNESS_DOMAINS` (default `engineering,product,design,marketing,operations,sales`)
361
+ - `ORGX_HARNESS_REQUIRE_REAL_WORKER=1` (default true; fails if worker is `mock`)
362
+ - `ORGX_HARNESS_KEEP=1` (skip teardown)
363
+ - `ORGX_HARNESS_SEED_ONLY=1` (seed + queue-top only)
364
+
302
365
  ## SEO Automation (Keywords Everywhere + DataForSEO)
303
366
 
304
367
  This repo also includes a repo-local SEO pipeline runner (scripts only; not shipped in the plugin package) under `scripts/seo/`.
@@ -380,6 +443,9 @@ cd dashboard && npm run dev
380
443
 
381
444
  # Full build (core + dashboard)
382
445
  npm run build
446
+
447
+ # Dev mode from main: always fetch/update origin/main, build it, and copy dist outputs here
448
+ npm run dev:main
383
449
  ```
384
450
 
385
451
  ### Repository Structure
@@ -0,0 +1 @@
1
+ import{r as c,j as e}from"./cNrhgGc1.js";import{B as bt,u as gt,P as yt,w as de,C as Qe,K as Ve,x as V,A as He,E as ue,h as Re,y as We,z as wt,U as vt}from"./C9jy61eu.js";import{S as B}from"./CZaT3ob_.js";import{A as Se,m as te,R as kt,b as jt,a as Nt}from"./CxQ08qFN.js";async function Je(t,r){var m;const i=await(await fetch(t,r)).json().catch(()=>null),x=((m=i==null?void 0:i.data)==null?void 0:m.url)??(i==null?void 0:i.url)??null;if(typeof x=="string"&&x.trim())return x.trim();throw new Error((i==null?void 0:i.error)??"Billing link unavailable")}async function Ct(t){var x;const r=((x=t==null?void 0:t.actions)==null?void 0:x.checkout)??"/orgx/api/billing/checkout",a=((t==null?void 0:t.requiredPlan)??"starter").trim().toLowerCase()||"starter",i=await Je(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({planId:a})});window.open(i,"_blank","noopener,noreferrer")}async function It(t){var i;const r=((i=t==null?void 0:t.actions)==null?void 0:i.portal)??"/orgx/api/billing/portal",a=await Je(r,{method:"POST"});window.open(a,"_blank","noopener,noreferrer")}function St(t){return t==="success"?"border-emerald-400/30 bg-[#0A1210]/95 text-emerald-100":t==="warning"?"border-amber-300/30 bg-[#12100A]/95 text-amber-100":t==="error"?"border-red-400/32 bg-[#120A0A]/95 text-red-100":t==="info"?"border-cyan-300/28 bg-[#0A1012]/95 text-cyan-100":"border-strong bg-[#0B0F16]/95 text-primary"}function $t({open:t,tone:r="neutral",title:a,message:i=null,className:x,primaryAction:m=null,secondaryAction:b=null,onDismiss:v=null,autoDismissMs:j=null}){return c.useEffect(()=>{if(!t||!v||!j)return;const U=window.setTimeout(()=>v(),j);return()=>window.clearTimeout(U)},[j,v,t,a,i]),e.jsx(Se,{initial:!1,children:t?e.jsx(te.div,{initial:{opacity:0,y:-8,scale:.985},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.985},transition:{duration:.2,ease:[.22,1,.36,1]},className:`pointer-events-none ${x??""}`,children:e.jsxs("div",{className:`pointer-events-none min-w-[220px] max-w-[420px] rounded-xl border px-3 py-2 shadow-[0_16px_36px_rgba(0,0,0,0.42)] backdrop-blur ${St(r)}`,children:[e.jsxs("div",{className:"flex items-start gap-2.5",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"text-caption font-semibold",children:a}),i?e.jsx("p",{className:"mt-0.5 text-caption opacity-85",children:i}):null]}),v?e.jsx("button",{type:"button",onClick:v,className:"pointer-events-auto inline-flex h-6 w-6 items-center justify-center rounded-md text-current/70 transition-colors hover:bg-white/[0.08] hover:text-current","aria-label":"Dismiss toast",title:"Dismiss",children:e.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M18 6 6 18"}),e.jsx("path",{d:"m6 6 12 12"})]})}):null]}),m||b?e.jsxs("div",{className:"mt-2 flex items-center gap-1.5",children:[b?e.jsx("button",{type:"button",onClick:b.onClick,className:"pointer-events-auto h-7 rounded-md border border-strong bg-white/[0.06] px-2.5 text-micro font-semibold text-current transition-colors hover:bg-white/[0.12]",children:b.label}):null,m?e.jsx("button",{type:"button",onClick:m.onClick,className:"pointer-events-auto h-7 rounded-md border border-white/25 bg-white/[0.14] px-2.5 text-micro font-semibold text-current transition-colors hover:bg-white/[0.2]",children:m.label}):null]}):null]})}):null})}function Xe({className:t=""}){return e.jsx("svg",{viewBox:"0 0 20 20",fill:"none","aria-hidden":!0,className:t,children:e.jsx("path",{d:"M7 5.4v9.2c0 .7.75 1.15 1.38.83l7.6-4.6a.95.95 0 0 0 0-1.62l-7.6-4.64A.95.95 0 0 0 7 5.4Z",fill:"currentColor"})})}function qt({className:t=""}){return e.jsxs("svg",{viewBox:"0 0 20 20",fill:"none","aria-hidden":!0,className:t,children:[e.jsx("path",{d:"M6.2 9.4V6.7c0-.7.5-1.2 1.1-1.2s1.1.5 1.1 1.2v2.2",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),e.jsx("path",{d:"M8.4 8.9V5.8c0-.7.5-1.3 1.1-1.3s1.1.6 1.1 1.3v3",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),e.jsx("path",{d:"M10.6 8.9V6.2c0-.7.5-1.3 1.1-1.3s1.1.6 1.1 1.3v3.2",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),e.jsx("path",{d:"M12.8 9.6V7.2c0-.7.5-1.2 1.1-1.2s1.1.5 1.1 1.2v4.2c0 2.7-1.9 4.6-4.6 4.6H9.2c-2.1 0-3.7-1-4.6-2.8l-.9-1.7c-.3-.6 0-1.4.6-1.7.6-.3 1.3 0 1.6.6l.7 1.4",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})]})}function Rt({className:t=""}){return e.jsxs("svg",{viewBox:"0 0 20 20",fill:"none","aria-hidden":!0,className:t,children:[e.jsx("path",{d:"M6.4 9.2V7.4c0-.7.5-1.2 1.1-1.2s1.1.5 1.1 1.2v1.3",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),e.jsx("path",{d:"M8.6 8.9V7c0-.7.5-1.2 1.1-1.2s1.1.5 1.1 1.2v2",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),e.jsx("path",{d:"M10.8 9.2V7.3c0-.7.5-1.2 1.1-1.2s1.1.5 1.1 1.2v2.6",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),e.jsx("path",{d:"M13 9.8V8.2c0-.7.5-1.2 1.1-1.2s1.1.5 1.1 1.2v3.6c0 2.4-1.7 4-4.1 4H9.7c-2 0-3.4-.9-4.2-2.5l-.8-1.4c-.3-.6 0-1.3.5-1.6.6-.3 1.2-.1 1.6.5l.6 1",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})]})}function Ze(t){return t==="running"?"from-teal-300/0 via-teal-300/60 to-teal-300/0":t==="blocked"?"from-amber-300/0 via-amber-300/55 to-amber-300/0":t==="idle"?"from-white/0 via-white/35 to-white/0":"from-[#BFFF00]/0 via-[#BFFF00]/70 to-[#BFFF00]/0"}function $e(t){return t==="running"?"Current":t==="blocked"?"Blocked on":"Next"}function qe(t){const r=typeof t.sliceTaskCount=="number"&&Number.isFinite(t.sliceTaskCount)?Math.max(0,Math.floor(t.sliceTaskCount)):null,a=t.sliceScope==="task"?"task":t.sliceScope==="milestone"?"milestone slice":"workstream slice",i=r&&r>0?`${r} ${r===1?"task":"tasks"}`:null;return t.queueState==="running"?i?`Executing ${i} in ${a}.`:"Execution in progress. Task detail will appear as the scheduler advances.":t.queueState==="blocked"?t.blockReason?"Blocked while waiting for dependency resolution.":"Blocked. Waiting for dependency or review.":t.queueState==="queued"?i?`Queued with ${i} in ${a}.`:"Queued at workstream scope. Task detail will populate after dispatch.":t.queueState==="completed"?"Completed. No queued tasks remain.":"Idle. Ready to dispatch when started."}function Ge(t){const r=typeof t.initiativePriority=="string"?t.initiativePriority.trim().toLowerCase():"",a=typeof t.initiativePriorityNum=="number"&&Number.isFinite(t.initiativePriorityNum)?Math.max(1,Math.min(100,Math.round(t.initiativePriorityNum))):null,i=r==="urgent"||r==="high"||r==="medium"||r==="low"?r:a!==null?a<=12?"urgent":a<=30?"high":a<=60?"medium":"low":null;if(!i)return null;const x=i==="urgent"?"P1":i==="high"?"P2":i==="medium"?"P3":"P4",m=i==="urgent"?"Urgent":i==="high"?"High":i==="medium"?"Medium":"Low",b=i==="urgent"?"border-red-300/35 bg-red-500/[0.14] text-red-100":i==="high"?"border-amber-300/35 bg-amber-500/[0.14] text-amber-100":i==="medium"?"border-[#BFFF00]/35 bg-[#BFFF00]/14 text-[#E1FFB2]":"border-white/[0.2] bg-white/[0.08] text-white/70";return{shortLabel:`${x} ${m}`,longLabel:`Initiative priority ${m} (${x})`,toneClass:b}}function Tt(t){const r=t.trim().toLowerCase();if(r.includes("timed out")||r.includes("timeout")||r.includes("request cancelled")||r.includes("signal is aborted"))return"Next Up is still syncing. Keep this panel open and it will repopulate automatically.";if(r.includes("unauthorized")||r.includes("forbidden")||r.includes("api key")||r.includes("auth"))return"Next Up is unavailable until OrgX authentication is reconnected in Settings.";if(r.includes("unknown api endpoint")||r.includes("route is unavailable"))return"This runtime is missing queue routes. Restart and update the plugin build.";const a=t.split("|").map(i=>i.trim()).filter(Boolean).map(i=>i.replace(/^[^:]+:\s*/,"").trim()).filter(Boolean).slice(0,2).join(" ");return Re(a||t)||"Next Up is temporarily unavailable."}function Bt(t){const r=t.trim().toLowerCase();return r.includes("timed out")||r.includes("timeout")||r.includes("request cancelled")||r.includes("signal is aborted")?"Signal is delayed right now. Queue data will appear as soon as sync catches up.":r.includes("fallback")?"Showing fallback queue data while full signal refreshes.":r.includes("unknown api endpoint")||r.includes("route is unavailable")?"Some queue controls are unavailable in this plugin build. Update and restart to restore full controls.":Re(t.trim())}function ke(t,r,a){const i=typeof t=="string"?t.trim():"";if(i&&!We(i))return V(i);const x=typeof r=="string"?r.trim():"";return x?We(x)?`${a} ${wt(x)}`:V(x):a}function Ye(t){const r=typeof t.runnerAgentName=="string"?t.runnerAgentName.trim():"";if(!r)return"Unassigned";const a=r.toLowerCase();return a==="undefined"||a==="null"||a==="main"&&(t.runnerAgentId==="unassigned"||t.runnerSource==="fallback")?"Unassigned":r}function Oe(t){return t.runnerSource==="inferred"?"inferred":null}function et(t,r){const a=t.runnerSource==="assigned"?"assigned":t.runnerSource==="inferred"?"inferred":"fallback";return r==="Unassigned"?`Runner ${a}`:`${r} · ${a}`}function ee(t,r){return!t||t.trim().length===0?r:Re(t.trim())||r}function De(t){return!t||typeof t!="object"||Array.isArray(t)?null:t}function tt(t,r){const a=V(t.workstreamTitle),i=De(r),x=i&&typeof i.dispatchMode=="string"?i.dispatchMode:null,m=De(i==null?void 0:i.run);return(m&&typeof m.stopReason=="string"?m.stopReason:m&&typeof m.stop_reason=="string"?m.stop_reason:null)==="budget_exhausted"?`Dispatch acknowledged for ${a}, but autopilot stopped: budget exhausted.`:x==="pending"?`Dispatching ${a}; waiting for slice start…`:x==="fallback"?`Dispatched ${a} using fallback runner.`:`Dispatched ${a}.`}function nt({className:t=""}){return e.jsxs("svg",{viewBox:"0 0 20 20",fill:"none","aria-hidden":!0,className:t,children:[e.jsx("circle",{cx:"4.5",cy:"10",r:"1.4",fill:"currentColor"}),e.jsx("circle",{cx:"10",cy:"10",r:"1.4",fill:"currentColor"}),e.jsx("circle",{cx:"15.5",cy:"10",r:"1.4",fill:"currentColor"})]})}function Lt({compact:t}){const r=t?3:6;return e.jsxs("div",{className:"space-y-2.5",children:[e.jsxs("div",{className:"flex items-center gap-2 px-1 pt-1 text-micro uppercase tracking-[0.12em] text-muted",children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-[#BFFF00]/70 status-breathe"}),e.jsx("span",{children:"Calibrating queue"})]}),Array.from({length:r}).map((a,i)=>e.jsxs("div",{className:"nextup-skeleton-card rounded-2xl border border-white/[0.08] bg-white/[0.02] px-3 py-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2.5",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 items-start gap-2.5",children:[e.jsx(B,{className:"h-8 w-8 rounded-full"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx(B,{className:"h-3 w-40 rounded-md"}),e.jsx(B,{className:"mt-2 h-4 w-56 rounded-md"})]})]}),e.jsx(B,{className:"h-5 w-16 rounded-full"})]}),e.jsxs("div",{className:"mt-3 rounded-lg border border-white/[0.07] bg-black/[0.18] px-2.5 py-2",children:[e.jsx(B,{className:"h-3 w-14 rounded"}),e.jsx(B,{className:"mt-2 h-3 w-full rounded"}),e.jsx(B,{className:"mt-2 h-3 w-3/5 rounded"})]}),e.jsxs("div",{className:"mt-2.5 flex flex-wrap gap-1.5",children:[e.jsx(B,{className:"h-8 w-24 rounded-full"}),e.jsx(B,{className:"h-8 w-20 rounded-full"}),e.jsx(B,{className:"h-8 w-24 rounded-full"})]})]},`nextup-skeleton-${i}`))]})}function Mt({initiativeId:t=null,projectId:r=null,authToken:a=null,embedMode:i=!1,title:x="Next Up",showHeader:m=!0,compact:b=!1,className:v,disableEnterAnimation:j=!1,allowCompactToggle:U=!1,onToggleCompact:ne,onOpenInitiative:G,onOpenSettings:C,onUpgradeGate:L,onOpenSliceDetail:M,selectionEnabled:K=!0,panelStyle:xe="card",showQueueSettings:re=!0,queueModel:me,queueActions:je,snapshotVersion:H=null}){var Ke;const[pe,J]=c.useState(b);c.useEffect(()=>J(b),[b]);const u=U&&!ne?pe:b,y=n=>{ne?ne(n):J(n)},[F,h]=c.useState(null),he="bottom",[w,P]=c.useState(null),[$,Q]=c.useState(null),[E,I]=c.useState(null),[S,d]=c.useState(new Set),[fe,Y]=c.useState(null),[se,ie]=c.useState(!1),[rt,be]=c.useState(!1),Te=c.useRef(null),st=bt({initiativeId:t,projectId:r,authToken:a,embedMode:i,enabled:!me,snapshotVersion:H}),it=me??st,{items:oe,degraded:X,isLoading:A,isFetching:Be,error:ge,refetch:ot,playWorkstream:Le,startWorkstreamAutoContinue:Me}=it,at=gt({authToken:a,embedMode:i}),z=je??at,q=n=>`${n.initiativeId}:${n.workstreamId}`,ae=c.useMemo(()=>oe.filter(n=>n.queueState==="running").length,[oe]),R=c.useMemo(()=>{const n=oe.filter(l=>l.queueState!=="running");return n.length>0?n:oe},[oe]),Fe=c.useMemo(()=>R.length===0?"empty":R.some(n=>n.queueState!=="running"&&n.queueState!=="blocked")?"queued":R.some(n=>n.queueState==="blocked")?"blocked":R.some(n=>n.queueState==="running")?"running":"queued",[R]),k=c.useMemo(()=>u?R.slice(0,5):R,[u,R]),lt=c.useMemo(()=>k.filter(n=>S.has(q(n))),[S,k]),[O,Pe]=c.useState([]),Ne=c.useRef([]),Ee=c.useMemo(()=>{const n=new Map;for(const l of k)n.set(q(l),l);return n},[k]),N=c.useMemo(()=>k.map(q),[k]),ct=c.useMemo(()=>N.join("|"),[N]);c.useEffect(()=>{Pe(n=>{if(u)return[];const l=[],o=new Set(N);for(const s of n)o.has(s)&&l.push(s);for(const s of N)l.includes(s)||l.push(s);return l})},[u,ct]),c.useEffect(()=>{Ne.current=O},[O]),c.useEffect(()=>{fe&&(N.includes(fe)||Y(null))},[fe,N]),c.useEffect(()=>{d(n=>{if(n.size===0)return n;const l=new Set(k.map(q)),o=new Set;for(const s of n)l.has(s)&&o.add(s);return o.size===n.size?n:o})},[k]),c.useEffect(()=>{if(!E)return;k.some(l=>q(l)===E)||I(null)},[E,k]),c.useEffect(()=>{if(X.length===0){be(!1);return}be(!1)},[X]),c.useEffect(()=>{K&&!u&&S.size>0&&ie(!1)},[u,S.size,K]),c.useEffect(()=>{if(!se)return;const n=o=>{var p;const s=o.target;s&&((p=Te.current)!=null&&p.contains(s)||ie(!1))},l=o=>{o.key==="Escape"&&ie(!1)};return document.addEventListener("mousedown",n),document.addEventListener("touchstart",n),document.addEventListener("keydown",l),()=>{document.removeEventListener("mousedown",n),document.removeEventListener("touchstart",n),document.removeEventListener("keydown",l)}},[se]);const Ae=async n=>{const l=q(n),o=V(n.workstreamTitle);try{await z.remove({initiativeId:n.initiativeId,workstreamId:n.workstreamId}),d(s=>{if(!s.has(l))return s;const p=new Set(s);return p.delete(l),p}),Y(s=>s===l?null:s),h(`Removed ${o} from queue.`)}catch(s){const p=s instanceof Error?s.message:"";h(ee(p,"Failed to remove from queue"))}},dt=(n,l,o)=>{const s=u?N:O.length>0?O:N;d(p=>{const f=new Set(p),T=fe;if(o&&T&&s.includes(T)){const g=s.indexOf(n),D=s.indexOf(T);if(g>=0&&D>=0){const[we,ve]=g<D?[g,D]:[D,g];for(const ce of s.slice(we,ve+1))l?f.add(ce):f.delete(ce)}else l?f.add(n):f.delete(n)}else l?f.add(n):f.delete(n);return f}),Y(n)},ut=()=>{d(new Set(N)),Y(N.length>0?N[N.length-1]:null)},xt=()=>{d(new Set),Y(null)},Ce=async n=>{if(S.size===0){h("Select one or more queue items first.");return}const l=k.map(o=>({key:q(o),item:o})).filter(o=>S.has(o.key));if(l.length===0){h("Selected queue items are no longer visible.");return}Q(`bulk:${n}`),h(null);try{const o=l.map(({item:g})=>({initiativeId:g.initiativeId,workstreamId:g.workstreamId})),s=await z.bulk({action:n,items:o}),p=typeof(s==null?void 0:s.updated)=="number"?s.updated??0:0,f=typeof(s==null?void 0:s.failed)=="number"?s.failed??0:0,T=Array.isArray(s==null?void 0:s.errors)?s.errors.filter(g=>typeof g=="string").map(g=>g.trim()).filter(Boolean):[],W=n==="remove"?"removed":n==="move_top"?"moved to top":"moved to bottom";p===0&&f>0&&T.length>0?h(ee(T[0],`${f} queue action${f===1?"":"s"} failed.`)):h(f>0?`${p} item${p===1?"":"s"} ${W}; ${f} failed.`:`${p} item${p===1?"":"s"} ${W}.`),d(new Set),Y(null)}catch(o){const s=o instanceof Error?o.message:"";h(ee(s,"Bulk queue action failed"))}finally{Q(null)}},mt=async()=>{const n=Ne.current.map(l=>Ee.get(l)).filter(Boolean).map(l=>({initiativeId:l.initiativeId,workstreamId:l.workstreamId}));n.length!==0&&await z.reorder({order:n})},le=async(n,l,o)=>{h(null),P(null),L==null||L(null),Q(n);try{const s=await l();h(typeof o=="function"?o(s):o)}catch(s){if(s instanceof vt)P(s),L==null||L(s);else{const p=s instanceof Error?s.message:"";h(ee(p,"Action failed"))}}finally{Q(null)}},ye=w?"upgrade":ge?"error":F?"notice":null,ze=ge?Tt(ge):null,Ie=X.length>0?Bt(X[0]):null,pt=ye!==null,ht=X.length>0&&!rt&&E===null&&!se,Z=lt.length,_e=K&&!u&&Z>0,ft=ae>0?`No queued workstreams yet. ${ae} running item${ae===1?"":"s"} still in-flight.`:X.length>0?"Queue signal is delayed right now.":"No queued workstreams right now.",Ue=e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",onClick:ut,className:"control-pill h-8 px-2.5 text-caption font-semibold",children:"Select all"}),e.jsx("button",{type:"button",onClick:xt,disabled:S.size===0,className:"control-pill h-8 px-2.5 text-caption font-semibold disabled:opacity-45",children:"Clear"}),e.jsx("button",{type:"button",disabled:Z===0||$==="bulk:move_top",onClick:()=>void Ce("move_top"),className:"control-pill h-8 px-2.5 text-caption font-semibold disabled:opacity-45",children:"Move top"}),e.jsx("button",{type:"button",disabled:Z===0||$==="bulk:move_bottom",onClick:()=>void Ce("move_bottom"),className:"control-pill h-8 px-2.5 text-caption font-semibold disabled:opacity-45",children:"Move bottom"}),e.jsx("button",{type:"button",disabled:Z===0||$==="bulk:remove",onClick:()=>void Ce("remove"),className:"control-pill h-8 px-2.5 text-caption font-semibold disabled:opacity-45",children:"Remove"})]});return e.jsxs(yt,{surface:xe==="card",className:`flex h-full min-h-0 flex-col overflow-hidden ${j?"":"card-enter"} ${xe==="flat"?"!rounded-none !border-none !bg-transparent !shadow-none":""} ${v??""}`,children:[m?e.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-subtle px-4 py-3",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("h2",{className:"truncate text-heading font-semibold text-white",children:x}),e.jsx("span",{className:"chip inline-flex min-w-[52px] justify-center text-micro tabular-nums",children:A?e.jsx("span",{"aria-hidden":!0,className:"h-2.5 w-5 rounded bg-white/15 animate-pulse"}):R.length}),e.jsx("span",{className:de("chip inline-flex min-w-[148px] justify-center text-micro tabular-nums transition-opacity",!A&&ae>0?"text-secondary opacity-100":"pointer-events-none opacity-0"),children:`${ae} active elsewhere`}),e.jsx("span",{className:de("inline-flex min-w-[92px] justify-end text-micro text-muted transition-opacity",Be&&!A?"opacity-100":"opacity-0"),"aria-live":"polite",children:"refreshing…"})]}),e.jsx("div",{className:"flex items-center gap-1.5",children:U?e.jsx("button",{type:"button",onClick:()=>y(!u),className:"control-pill h-8 flex-shrink-0 whitespace-nowrap px-3 text-caption font-semibold",title:u?"Switch to expanded cards":"Switch to compact list","aria-label":u?"Expand Next Up queue":"Compact Next Up queue",children:u?"Expand":"Compact"}):null})]}):null,pt&&e.jsx("div",{className:"px-3 pt-2",children:e.jsx(Se,{initial:!1,mode:"wait",children:ye==="upgrade"&&w?e.jsx(te.div,{initial:{opacity:0,y:-4,scale:.99},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-4,scale:.99},transition:{duration:.18,ease:[.22,1,.36,1]},className:"rounded-xl border border-amber-200/25 bg-amber-200/10 px-3 py-2 text-caption text-amber-100",children:e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"rounded-full border border-amber-200/25 bg-amber-200/10 px-2 py-0.5 text-micro font-semibold uppercase tracking-[0.08em] text-amber-100/90",children:"Upgrade required"}),e.jsxs("span",{className:"truncate text-micro text-secondary",children:[Qe(w.currentPlan)," →"," ",Qe(w.requiredPlan)]})]}),e.jsx("div",{className:"mt-1 line-clamp-2 text-caption leading-snug text-amber-50/90",title:w.message,children:w.message}),F?e.jsx("div",{className:"mt-1 text-micro text-rose-50/85",children:F}):null]}),e.jsxs("div",{className:"flex flex-shrink-0 flex-col items-end gap-1",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("button",{type:"button",onClick:()=>void Ct({actions:w.actions,requiredPlan:w.requiredPlan}).catch(n=>h(ee(n instanceof Error?n.message:"","Checkout failed"))),className:"h-7 rounded-full border border-amber-200/25 bg-amber-200/15 px-3 text-micro font-semibold text-amber-50 transition-colors hover:bg-amber-200/20",children:"Upgrade"}),e.jsx("button",{type:"button",onClick:()=>void It({actions:w.actions}).catch(n=>h(ee(n instanceof Error?n.message:"","Portal failed"))),className:"h-7 rounded-full border border-strong bg-white/[0.04] px-3 text-micro font-semibold text-primary transition-colors hover:bg-white/[0.08]",children:"Billing"}),C&&e.jsx("button",{type:"button",onClick:C,className:"h-7 rounded-full border border-strong bg-white/[0.04] px-2.5 text-micro font-semibold text-primary transition-colors hover:bg-white/[0.08]",children:"Settings"})]}),(Ke=w.actions)!=null&&Ke.pricing?e.jsx("a",{href:w.actions.pricing,target:"_blank",rel:"noopener noreferrer",className:"text-micro text-secondary underline decoration-white/20 hover:text-primary",children:"View pricing"}):null]})]})},"upgrade"):ye==="error"&&ze?e.jsx(te.div,{initial:{opacity:0,y:-4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.18},className:"rounded-xl border border-red-400/25 bg-red-500/[0.08] px-3 py-2 text-caption text-red-100",children:ze},"error"):ye==="notice"&&F?e.jsx(te.div,{initial:{opacity:0,y:-4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.18},className:"rounded-xl border border-white/[0.1] bg-white/[0.03] px-3 py-2 text-caption text-primary",children:F},"notice"):null})}),e.jsxs("div",{className:`flex-1 space-y-2.5 overflow-y-auto overscroll-y-contain px-3 pb-3 ${m?"pt-1":"pt-2.5"}`,children:[!A&&R.length>0?e.jsxs("div",{className:"flex flex-col gap-2.5 px-0.5 sm:flex-row sm:items-start sm:justify-between",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"truncate text-micro uppercase tracking-[0.08em] text-muted",children:Fe==="blocked"?"Needs attention":Fe==="running"?"Running now":"Queue"}),e.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-1.5",children:[Z>0?e.jsxs("span",{className:"chip text-micro",children:[Z," selected"]}):null,e.jsx("span",{className:de("inline-flex min-w-[92px] text-micro text-muted transition-opacity",Be&&!A?"opacity-100":"opacity-0"),"aria-live":"polite",children:"refreshing…"}),K&&!u&&Z===0?e.jsx("span",{className:"text-micro text-muted",children:"Shift+select to pick ranges."}):null]})]}),e.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-1.5 sm:justify-end",children:[U?e.jsx("button",{type:"button",onClick:()=>y(!u),className:"control-pill h-8 px-2.5 text-caption font-semibold",title:u?"Switch to expanded cards":"Switch to compact list","aria-label":u?"Expand Next Up queue":"Compact Next Up queue",children:u?"Expand":"Compact"}):null,_e?e.jsx("div",{className:"flex flex-wrap justify-end gap-1.5",children:Ue}):null,!_e&&re?e.jsxs("div",{ref:Te,className:"relative",children:[e.jsxs("button",{type:"button",onClick:()=>ie(n=>!n),className:"control-pill h-8 px-2.5 text-caption font-semibold","aria-haspopup":"menu","aria-expanded":se,title:"Queue settings",children:[e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"opacity-85","aria-hidden":!0,children:[e.jsx("path",{d:"M4 6h16"}),e.jsx("path",{d:"M7 12h10"}),e.jsx("path",{d:"M10 18h4"})]}),e.jsx("span",{children:"Queue"})]}),se?e.jsx("div",{className:"surface-tier-2 absolute right-0 top-[calc(100%+8px)] z-[280] w-[320px] max-w-[86vw] rounded-xl p-3 shadow-[0_18px_42px_rgba(0,0,0,0.46)] backdrop-blur-xl",children:e.jsxs("div",{className:"space-y-2.5",children:[K&&!u?e.jsxs("div",{children:[e.jsx("p",{className:"section-kicker",children:"Bulk actions"}),e.jsx("div",{className:"mt-1.5 flex flex-wrap items-center gap-1.5",children:Ue})]}):null,C?e.jsx("button",{type:"button",onClick:()=>{ie(!1),C()},className:"control-pill h-7 px-2.5 text-micro font-semibold",children:"Open settings"}):null]})}):null]}):null]})]}):null,A?e.jsx(Lt,{compact:u}):null,!A&&k.length===0&&!ge&&e.jsxs("div",{className:"rounded-xl border border-white/[0.08] bg-white/[0.02] px-3 py-4 text-center",children:[e.jsx("p",{className:"text-body text-secondary",children:ft}),Ie?e.jsx("p",{className:"mt-1 text-micro text-muted",children:Ie}):null,X.length>0?e.jsx("div",{className:"mt-2.5 flex items-center justify-center gap-1.5",children:e.jsx("button",{type:"button",onClick:()=>{be(!1),ot()},className:"control-pill h-7 px-2.5 text-micro font-semibold",children:"Retry now"})}):null]}),!A&&u?e.jsx(Se,{initial:!1,children:k.map((n,l)=>{const o=q(n),s=$===o,p=n.queueState==="running",f=n.nextTaskDueAt?Ve(n.nextTaskDueAt):null,T=ke(n.initiativeTitle,n.initiativeId,"Initiative"),W=ke(n.workstreamTitle,n.workstreamId,"Workstream"),g=Ge(n),D=n.nextTaskTitle?V(n.nextTaskTitle):null,we=n.blockReason?V(n.blockReason):null,ve=Ye(n),ce=Oe(n);return e.jsxs(te.article,{layout:!0,initial:{opacity:0,y:6,scale:.99},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-4,scale:.99},transition:{duration:.22,delay:Math.min(l,7)*.018,ease:[.22,1,.36,1]},className:"group relative overflow-visible rounded-2xl border border-white/[0.08] bg-white/[0.02] px-2.5 py-2 cursor-pointer transition-colors hover:border-white/[0.14]",onClick:()=>M==null?void 0:M(n),role:"button",tabIndex:0,onKeyDown:_=>{(_.key==="Enter"||_.key===" ")&&(_.preventDefault(),M==null||M(n))},children:[e.jsx("div",{className:`pointer-events-none absolute inset-x-2.5 top-0 h-px bg-gradient-to-r ${Ze(n.queueState)}`,"aria-hidden":!0}),e.jsxs("div",{className:"flex min-w-0 items-center gap-2.5",children:[e.jsx(He,{name:ve,hint:et(n,ve),size:"xs"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[e.jsx(ue,{type:"initiative",size:11,className:"flex-shrink-0 opacity-85"}),e.jsx("button",{type:"button",onClick:()=>G==null?void 0:G(n.initiativeId,n.initiativeTitle),className:"block min-w-0 flex-1 truncate text-left text-micro uppercase tracking-[0.08em] text-muted transition-colors hover:text-white/72",title:T,children:T}),g?e.jsx("span",{className:de("inline-flex flex-shrink-0 items-center rounded-full border px-2 py-0.5 text-[9px] font-semibold uppercase tracking-[0.08em]",g.toneClass),title:g.longLabel,children:g.shortLabel}):null]}),e.jsxs("p",{className:"mt-0.5 flex min-w-0 items-center gap-1.5 text-caption font-semibold leading-snug text-white",title:W,children:[e.jsx(ue,{type:"workstream",size:12,className:"flex-shrink-0 opacity-95"}),e.jsx("span",{className:"line-clamp-2",children:W})]}),D?e.jsxs("p",{className:"mt-0.5 line-clamp-2 text-micro leading-snug text-secondary",title:`${$e(n.queueState)}: ${D}${f?` · ${f}`:""}`,children:[$e(n.queueState),": ",D,f?` · ${f}`:""]}):e.jsx("p",{className:"mt-0.5 line-clamp-2 text-micro leading-snug text-secondary",title:qe(n),children:qe(n)}),ce?e.jsxs("p",{className:"mt-0.5 text-micro text-muted",children:["Runner ",ce]}):null]})]}),we&&e.jsxs("div",{className:"mt-1.5 rounded-lg border border-red-400/24 bg-red-500/[0.08] px-2.5 py-1 text-micro text-red-100/85",children:["Blocked: ",we]}),e.jsxs("div",{className:"mt-1.5 flex items-center gap-1.5",onClick:_=>_.stopPropagation(),children:[e.jsx("button",{type:"button",disabled:s||p,onClick:()=>void le(o,()=>Le({initiativeId:n.initiativeId,workstreamId:n.workstreamId,agentId:n.runnerAgentId}),_=>tt(n,_)),className:"control-pill flex h-7 items-center justify-center px-2.5 text-micro font-semibold disabled:opacity-40",title:p?"Already running":"Start now",children:e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(Xe,{className:"h-3 w-3 opacity-85"}),e.jsx("span",{children:p?"Running":"Start"})]})}),e.jsxs("div",{className:"relative ml-auto",children:[e.jsx("button",{type:"button",disabled:s,onClick:()=>I(_=>_===o?null:o),className:"control-pill flex h-7 items-center justify-center px-2.5 text-micro font-semibold disabled:opacity-40",title:"Queue actions",children:e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(nt,{className:"h-3 w-3 opacity-85"}),e.jsx("span",{children:"More"})]})}),E===o&&e.jsxs("div",{className:"absolute right-0 top-[calc(100%+6px)] z-[320] min-w-[178px] rounded-xl border border-white/[0.1] bg-[#080d14]/95 p-1.5 shadow-[0_16px_36px_rgba(0,0,0,0.42)] backdrop-blur",children:[e.jsx("button",{type:"button",onClick:()=>{I(null),le(`${o}:top`,()=>z.move({initiativeId:n.initiativeId,workstreamId:n.workstreamId,placement:"top"}),`Moved ${W} to top of queue.`)},className:"flex h-8 w-full items-center rounded-md px-2.5 text-left text-caption text-primary transition-colors hover:bg-white/[0.08]",children:"Move to top"}),e.jsx("button",{type:"button",onClick:()=>{I(null),le(`${o}:bottom`,()=>z.move({initiativeId:n.initiativeId,workstreamId:n.workstreamId,placement:"bottom"}),`Moved ${W} to bottom of queue.`)},className:"flex h-8 w-full items-center rounded-md px-2.5 text-left text-caption text-primary transition-colors hover:bg-white/[0.08]",children:"Move to bottom"}),e.jsx("button",{type:"button",onClick:()=>{I(null),le(`${o}:auto`,async()=>(await z.move({initiativeId:n.initiativeId,workstreamId:n.workstreamId,placement:"top"}),Me({initiativeId:n.initiativeId,workstreamId:n.workstreamId,agentId:n.runnerAgentId,scope:"initiative"})),`Start+Auto enabled for ${T}.`)},className:"flex h-8 w-full items-center rounded-md px-2.5 text-left text-caption text-primary transition-colors hover:bg-white/[0.08]",children:"Start with auto"}),e.jsx("button",{type:"button",disabled:z.isRemoving,onClick:()=>{I(null),Ae(n)},className:"mt-1 flex h-8 w-full items-center rounded-md px-2.5 text-left text-caption text-red-100 transition-colors hover:bg-red-500/[0.12] disabled:opacity-45",children:"Remove from queue"})]})]})]})]},o)})}):A?null:e.jsx(kt,{axis:"y",values:O,onReorder:n=>{Ne.current=n,Pe(n)},className:"space-y-2.5",children:O.map(n=>Ee.get(n)).filter(Boolean).map((n,l)=>e.jsx(Ft,{item:n,index:l,actionKey:$,setNotice:h,setUpgradeGate:P,onUpgradeGate:L,onOpenInitiative:G,onOpenSliceDetail:M,selected:S.has(q(n)),selectionEnabled:K,onToggleSelection:dt,menuKey:E,setMenuKey:I,playWorkstream:Le,startWorkstreamAutoContinue:Me,triagePlacement:he,onPauseWorkstream:(o,s)=>z.stopTriage({initiativeId:o.initiativeId,workstreamId:o.workstreamId,placement:s,resetToTodo:!1}),onMoveWorkstream:(o,s)=>z.move({initiativeId:o.initiativeId,workstreamId:o.workstreamId,placement:s}),onCommitReorder:()=>void mt().catch(()=>null),onDismiss:Ae,runAction:le},q(n)))})]}),e.jsx("div",{className:"pointer-events-none absolute bottom-3 right-3 z-[250]",children:e.jsx($t,{open:ht,tone:"warning",title:"Limited signal",message:Ie,autoDismissMs:6e3,onDismiss:()=>be(!0)})})]})}function Ft({item:t,index:r,actionKey:a,setNotice:i,setUpgradeGate:x,onUpgradeGate:m,onOpenInitiative:b,onOpenSliceDetail:v,selected:j,selectionEnabled:U,onToggleSelection:ne,menuKey:G,setMenuKey:C,playWorkstream:L,startWorkstreamAutoContinue:M,triagePlacement:K,onPauseWorkstream:xe,onMoveWorkstream:re,onCommitReorder:me,onDismiss:je,runAction:H}){const pe=jt(),[J,u]=c.useState(!1),y=`${t.initiativeId}:${t.workstreamId}`,F=a===y,h=t.queueState==="running",he=t.nextTaskDueAt?Ve(t.nextTaskDueAt):null,w=ke(t.initiativeTitle,t.initiativeId,"Initiative"),P=ke(t.workstreamTitle,t.workstreamId,"Workstream"),$=Ge(t),Q=t.nextTaskTitle?V(t.nextTaskTitle):null,E=t.blockReason?V(t.blockReason):null,I=Ye(t),S=Oe(t);return e.jsx(Nt,{value:y,id:y,dragListener:!1,dragControls:pe,onDragStart:()=>u(!0),onDragEnd:()=>{u(!1),me()},whileDrag:{scale:1.02,boxShadow:"0 20px 48px rgba(0,0,0,0.5), 0 0 0 1px rgba(191,255,0,0.15)",zIndex:50,cursor:"grabbing"},className:"relative",children:e.jsxs(te.article,{layout:!0,initial:{opacity:0,y:12,scale:.97},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.98},transition:{duration:.4,ease:[.25,.1,.25,1],delay:Math.min(r,7)*.05,opacity:{duration:.32,ease:[.25,.1,.25,1]}},className:"group relative overflow-visible rounded-2xl border border-white/[0.08] bg-white/[0.02] px-3 py-3 cursor-pointer transition-colors hover:border-white/[0.14]",onClick:()=>v==null?void 0:v(t),role:"button",tabIndex:0,onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),v==null||v(t))},children:[e.jsx("div",{className:`pointer-events-none absolute inset-x-3 top-0 h-px bg-gradient-to-r ${Ze(t.queueState)}`,"aria-hidden":!0}),e.jsx("div",{className:"flex items-start justify-between gap-2.5",children:e.jsxs("div",{className:"min-w-0 flex flex-1 items-start gap-2.5",children:[e.jsxs("div",{className:"relative h-8 w-8 flex-shrink-0",children:[e.jsx("div",{className:`absolute inset-0 transition-[opacity,transform] duration-200 ease-out ${U?j?"opacity-0 scale-90":"opacity-100 scale-100 group-hover:opacity-0 group-hover:scale-90 group-focus-within:opacity-0 group-focus-within:scale-90":"opacity-100 scale-100"}`,children:e.jsx(He,{name:I,hint:et(t,I),size:"sm"})}),U?e.jsx("button",{type:"button",role:"checkbox","aria-checked":j,"aria-label":"Select queue row",title:j?"Selected (Shift+click for range)":"Select (Shift+click for range)",onClick:d=>{d.stopPropagation(),ne(y,!j,d.shiftKey)},onMouseDown:d=>d.stopPropagation(),onKeyDown:d=>d.stopPropagation(),className:`absolute inset-0 flex items-center justify-center rounded-full border transition-[opacity,transform,background-color,border-color,color] duration-200 ease-out ${j?"opacity-100 scale-100 border-[#BFFF00]/40 bg-[#BFFF00]/18 text-[#E1FFB2]":"opacity-0 scale-90 border-white/[0.24] bg-black/55 text-white/78 group-hover:opacity-100 group-hover:scale-100 group-focus-within:opacity-100 group-focus-within:scale-100 hover:bg-black/62"}`,children:e.jsx("span",{className:"inline-flex h-4 w-4 items-center justify-center rounded-full border border-current/45 bg-black/30",children:j?e.jsx("svg",{viewBox:"0 0 16 16",className:"h-2.5 w-2.5",fill:"none","aria-hidden":!0,children:e.jsx("path",{d:"M3.2 8.3 6.2 11l6.6-6.1",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}):null})}):null]}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[e.jsx(ue,{type:"initiative",size:11,className:"flex-shrink-0 opacity-85"}),e.jsx("button",{type:"button",onClick:()=>b==null?void 0:b(t.initiativeId,t.initiativeTitle),className:"block min-w-0 flex-1 truncate text-left text-micro uppercase tracking-[0.08em] text-muted transition-colors hover:text-white/72",title:w,children:w}),$?e.jsx("span",{className:de("inline-flex flex-shrink-0 items-center rounded-full border px-2 py-0.5 text-[9px] font-semibold uppercase tracking-[0.08em]",$.toneClass),title:$.longLabel,children:$.shortLabel}):null]}),e.jsxs("div",{className:"mt-0.5 flex min-w-0 items-start gap-1.5",children:[e.jsx(ue,{type:"workstream",size:12,className:"mt-[3px] flex-shrink-0 opacity-95"}),e.jsx("p",{className:"min-w-0 line-clamp-2 text-body font-semibold leading-snug text-white",title:P,children:P})]}),e.jsxs("div",{className:"mt-1.5 flex items-center gap-2 text-micro text-secondary",children:[e.jsx("span",{className:"rounded-full border border-strong bg-white/[0.03] px-2 py-0.5 text-micro uppercase tracking-[0.08em] text-secondary",children:"Runner"}),e.jsxs("span",{className:"truncate text-white/68",children:[I,S?` · ${S}`:""]})]})]})]})}),e.jsx("div",{className:"mt-2 rounded-lg border border-white/[0.07] bg-black/[0.18] px-2.5 py-2 text-caption text-white/68",children:Q?e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-1 text-micro uppercase tracking-[0.08em] text-white/44",children:[e.jsx(ue,{type:"task",size:10,className:"flex-shrink-0 opacity-80"}),e.jsx("span",{children:$e(t.queueState)}),he?e.jsxs("span",{className:"truncate text-micro normal-case tracking-normal text-muted",children:["· ",he]}):null]}),e.jsx("p",{className:"line-clamp-2 break-words text-caption leading-snug text-white/84",title:Q,children:Q})]}):e.jsx("span",{className:"text-secondary",children:qe(t)})}),E&&e.jsxs("div",{className:"mt-1.5 rounded-lg border border-red-400/24 bg-red-500/[0.08] px-2.5 py-1 text-micro text-red-100/85",children:["Blocked: ",E]}),e.jsxs("div",{className:"mt-2 flex items-center gap-1.5",onClick:d=>d.stopPropagation(),children:[e.jsx("button",{type:"button",disabled:F||h,onClick:()=>void H(y,()=>L({initiativeId:t.initiativeId,workstreamId:t.workstreamId,agentId:t.runnerAgentId}),d=>tt(t,d)),className:"control-pill flex h-7 items-center justify-center px-2.5 text-micro font-semibold disabled:opacity-40",title:h?"Already running":"Start this workstream now",children:e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(Xe,{className:"h-3 w-3 opacity-85"}),e.jsx("span",{children:h?"Running":"Start"})]})}),e.jsxs("button",{type:"button",onPointerDown:d=>pe.start(d),"aria-label":"Drag to reorder",title:J?"Reordering":"Drag to reorder",className:`control-pill flex h-7 items-center justify-center gap-1 px-2 text-micro font-semibold transition-colors ${J?"border-[#BFFF00]/35 bg-[#BFFF00]/14 text-[#E1FFB2] cursor-grabbing":"cursor-grab hover:bg-white/[0.08] hover:text-bright"}`,children:[J?e.jsx(Rt,{className:"h-3.5 w-3.5 opacity-90"}):e.jsx(qt,{className:"h-3.5 w-3.5 opacity-90"}),e.jsx("span",{children:J?"Reordering":"Drag"})]}),e.jsxs("div",{className:"relative ml-auto",children:[e.jsx("button",{type:"button",disabled:F,onClick:()=>C(d=>d===y?null:y),className:"control-pill flex h-7 items-center justify-center px-2.5 text-micro font-semibold disabled:opacity-40",title:"Queue actions",children:e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(nt,{className:"h-3 w-3 opacity-85"}),e.jsx("span",{children:"More"})]})}),G===y&&e.jsxs("div",{className:"absolute right-0 top-[calc(100%+6px)] z-[320] min-w-[198px] rounded-xl border border-white/[0.1] bg-[#080d14]/95 p-1.5 shadow-[0_16px_36px_rgba(0,0,0,0.42)] backdrop-blur",children:[e.jsx("button",{type:"button",onClick:()=>{C(null),H(`${y}:top`,()=>re(t,"top"),`Moved ${P} to top of queue.`)},className:"flex h-8 w-full items-center rounded-md px-2.5 text-left text-caption text-primary transition-colors hover:bg-white/[0.08]",children:"Move to top"}),e.jsx("button",{type:"button",onClick:()=>{C(null),H(`${y}:bottom`,()=>re(t,"bottom"),`Moved ${P} to bottom of queue.`)},className:"flex h-8 w-full items-center rounded-md px-2.5 text-left text-caption text-primary transition-colors hover:bg-white/[0.08]",children:"Move to bottom"}),e.jsx("button",{type:"button",onClick:()=>{C(null),H(`${y}:auto`,async()=>(await re(t,"top"),M({initiativeId:t.initiativeId,workstreamId:t.workstreamId,agentId:t.runnerAgentId,scope:"initiative"})),`Start+Auto enabled for ${w}.`)},className:"flex h-8 w-full items-center rounded-md px-2.5 text-left text-caption text-primary transition-colors hover:bg-white/[0.08]",children:"Start with auto"}),h?e.jsx("button",{type:"button",onClick:()=>{C(null),H(`${y}:pause`,()=>xe(t,K),`Paused ${P}.`)},className:"mt-1 flex h-8 w-full items-center rounded-md px-2.5 text-left text-caption text-primary transition-colors hover:bg-white/[0.08]",children:"Pause run"}):null,e.jsx("button",{type:"button",disabled:F||h,onClick:()=>{C(null),je(t)},className:"mt-1 flex h-8 w-full items-center rounded-md px-2.5 text-left text-caption text-red-100 transition-colors hover:bg-red-500/[0.12] disabled:opacity-45",children:"Remove from queue"})]})]})]})]})})}const _t=Object.freeze(Object.defineProperty({__proto__:null,NextUpPanel:Mt},Symbol.toStringTag,{value:"Module"}));export{$t as I,Mt as N,_t as a,Ct as o};
@@ -0,0 +1,2 @@
1
+ import{r as d,j as e}from"./cNrhgGc1.js";import{r as C,E as k,d as m,K as S}from"./C9jy61eu.js";import"./C-KIc3Wc.js";import"./BJgZIVUQ.js";import"./CxQ08qFN.js";function $(i){const o=i.trim().toLowerCase();return o==="fulfilled"||o==="completed"?m.lime:o==="claimed"?m.teal:o==="blocked"?m.red:m.amber}function J({open:i,onClose:o,handoffs:x}){const[p,g]=d.useState(""),[c,h]=d.useState(new Set),[y,n]=d.useState(null);d.useEffect(()=>{i&&n(null)},[i]);const b=d.useMemo(()=>[...x].sort((t,s)=>Date.parse(s.updatedAt??"")-Date.parse(t.updatedAt??"")),[x]),r=d.useMemo(()=>{const t=p.trim().toLowerCase();return t?b.filter(s=>[s.title,s.summary,s.status,s.priority].filter(Boolean).join(" ").toLowerCase().includes(t)):b},[b,p]);d.useEffect(()=>{i&&h(t=>{const s=new Set(r.map(a=>a.id)),l=new Set;for(const a of t)s.has(a)&&l.add(a);return l})},[r,i]);const u=c.size,f=r.length>0&&r.every(t=>c.has(t.id)),w=()=>{h(t=>r.length===0?t:f?new Set:new Set(r.map(s=>s.id)))},j=t=>{h(s=>{const l=new Set(s);return l.has(t)?l.delete(t):l.add(t),l})},N=async()=>{const t=r.filter(a=>u===0||c.has(a.id)),s=[];s.push(`# Handoffs (${t.length})`),s.push("");for(const a of t)s.push(`- **${a.title}** — ${a.status}${a.priority?` (priority: ${a.priority})`:""}`),a.summary&&s.push(` - ${a.summary}`),s.push(` - Updated: ${a.updatedAt}`);const l=s.join(`
2
+ `);try{await navigator.clipboard.writeText(l),n("Copied markdown."),setTimeout(()=>n(null),1200)}catch{n("Copy failed (clipboard unavailable).")}},v=async()=>{const t=r.filter(s=>u===0||c.has(s.id));try{await navigator.clipboard.writeText(JSON.stringify(t,null,2)),n("Copied JSON."),setTimeout(()=>n(null),1200)}catch{n("Copy failed (clipboard unavailable).")}};return e.jsx(C,{open:i,onClose:o,maxWidth:"max-w-3xl",children:e.jsxs("div",{className:"flex h-full w-full flex-col",children:[e.jsxs("div",{className:"border-b border-subtle px-5 pt-5 pb-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("h3",{className:"inline-flex items-center gap-2 text-heading font-semibold text-white",children:[e.jsx(k,{type:"handoff",size:14}),e.jsx("span",{className:"truncate",children:"Handoffs"}),e.jsx("span",{className:"rounded-full border border-strong bg-white/[0.04] px-2 py-0.5 text-caption font-semibold text-primary",children:x.length})]}),e.jsx("p",{className:"mt-1 text-body leading-relaxed text-secondary",children:"Review and export current handoffs. Select items for a tighter export."})]}),e.jsx("button",{type:"button",onClick:o,className:"rounded-md border border-strong bg-white/[0.03] px-2.5 py-1.5 text-caption text-primary transition-colors hover:bg-white/[0.08]","aria-label":"Close handoffs modal",children:"Close"})]}),e.jsxs("div",{className:"mt-4 flex flex-col gap-2 sm:flex-row sm:items-center",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("label",{className:"sr-only",htmlFor:"bulk-handoffs-search",children:"Search handoffs"}),e.jsx("input",{id:"bulk-handoffs-search",value:p,onChange:t=>g(t.target.value),placeholder:"Search title, summary, status…","data-modal-autofocus":"true",className:"w-full rounded-lg border border-strong bg-black/25 px-3 py-2 text-body text-white placeholder:text-muted focus:outline-none focus:ring-1 focus:ring-[#BFFF00]/35"})]}),e.jsx("button",{type:"button",onClick:w,disabled:r.length===0,className:"rounded-lg border border-strong bg-white/[0.03] px-3 py-2 text-caption text-primary transition-colors hover:bg-white/[0.08] disabled:opacity-45",children:f?"Clear all":`Select all (${r.length})`})]}),y&&e.jsx("div",{className:"mt-3 rounded-xl border border-white/[0.08] bg-white/[0.02] px-3 py-2 text-body text-secondary",children:y})]}),e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-5 py-4",children:r.length===0?e.jsx("div",{className:"rounded-xl border border-subtle bg-white/[0.02] p-4 text-body text-secondary",children:"No handoffs match this view."}):e.jsx("div",{className:"space-y-2",children:r.map(t=>{const s=c.has(t.id),l=$(t.status);return e.jsx("div",{className:"rounded-xl border border-white/[0.08] bg-white/[0.02] px-3 py-2.5",style:{borderColor:s?`${m.lime}40`:"rgba(255,255,255,0.08)"},children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("input",{type:"checkbox",checked:s,onChange:()=>j(t.id),className:"mt-0.5 h-4 w-4 rounded border-white/20 bg-black/40 text-lime focus:ring-lime/40","aria-label":`Select handoff ${t.title}`}),e.jsx("div",{className:"min-w-0 flex-1",children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"truncate text-body font-medium text-white",children:t.title}),t.summary&&e.jsx("p",{className:"mt-1 line-clamp-2 text-caption text-secondary",children:t.summary}),e.jsxs("p",{className:"mt-1 text-micro text-secondary",children:["Updated ",S(t.updatedAt)]})]}),e.jsx("span",{className:"shrink-0 rounded-full border px-2 py-0.5 text-micro font-semibold uppercase tracking-[0.08em]",style:{borderColor:`${l}30`,backgroundColor:`${l}14`,color:l},children:t.status})]})})]})},t.id)})})}),e.jsxs("div",{className:"flex flex-col gap-2 border-t border-subtle px-5 py-3 sm:flex-row sm:items-center sm:justify-between",children:[e.jsx("div",{className:"text-caption text-secondary",children:u>0?`${u} selected`:"No selection (exporting will include all filtered handoffs)"}),e.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-2",children:[e.jsx("button",{type:"button",onClick:N,disabled:r.length===0,className:"rounded-md border border-strong bg-white/[0.03] px-3 py-1.5 text-caption text-primary transition-colors hover:bg-white/[0.08] disabled:opacity-45",children:"Copy markdown"}),e.jsx("button",{type:"button",onClick:v,disabled:r.length===0,className:"rounded-md border border-strong bg-white/[0.03] px-3 py-1.5 text-caption text-primary transition-colors hover:bg-white/[0.08] disabled:opacity-45",children:"Copy JSON"})]})]})]})})}export{J as BulkHandoffsModal};
@@ -0,0 +1 @@
1
+ import{r as o,j as e}from"./cNrhgGc1.js";import{d as l,r as p,E as h,V as u}from"./C9jy61eu.js";import{DecisionQueue as b}from"./rttbDbEx.js";import"./C-KIc3Wc.js";import"./BJgZIVUQ.js";import"./CxQ08qFN.js";import"./C8uM3AX8.js";import"./B6wPWJ35.js";function C({open:n,onClose:a,decisions:t,onApproveDecision:i,onRejectDecision:d,onApproveAll:m,onBulkDecisionAction:x}){const r=o.useMemo(()=>t.length>0?Math.max(0,...t.map(c=>c.waitingMinutes)):0,[t]),s=o.useMemo(()=>t.length>=20||r>=15?l.red:t.length>0?l.amber:l.textMuted,[t.length,r]);return e.jsx(p,{open:n,onClose:a,maxWidth:"max-w-3xl",children:e.jsxs("div",{className:"flex h-full w-full flex-col",children:[e.jsx("div",{className:"border-b border-subtle px-5 pt-5 pb-4",children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("h3",{className:"inline-flex items-center gap-2 text-heading font-semibold text-white",children:[e.jsx(h,{type:"decision",size:14}),e.jsx("span",{className:"truncate",children:"Decisions"}),e.jsx("span",{className:"rounded-full border px-2 py-0.5 text-caption font-semibold",style:{borderColor:`${s}30`,backgroundColor:`${s}14`,color:s},children:t.length})]}),e.jsx("p",{className:"mt-1 text-body leading-relaxed text-secondary",children:"Bulk review and resolve pending decisions."}),t.length>0&&e.jsxs("p",{className:"mt-2 text-caption text-secondary",children:["Oldest: ",e.jsxs("span",{className:"font-semibold text-white",children:[u(r)," ago"]})]})]}),e.jsx("button",{type:"button",onClick:a,className:"rounded-md border border-strong bg-white/[0.03] px-2.5 py-1.5 text-caption text-primary transition-colors hover:bg-white/[0.08]","aria-label":"Close decisions modal",children:"Close"})]})}),e.jsx("div",{className:"min-h-0 flex-1 overflow-hidden p-4",children:e.jsx(b,{decisions:t,onApproveDecision:i,onRejectDecision:d,onApproveAll:m,onBulkDecisionAction:x})})]})})}export{C as BulkDecisionsModal};
@@ -0,0 +1 @@
1
+ import{r as a,j as e}from"./cNrhgGc1.js";import{d as i}from"./C9jy61eu.js";import{A as m,m as x}from"./CxQ08qFN.js";function f({message:l,durationMs:s=5e3,onUndo:d,onExpire:r}){const[t,c]=a.useState(!0),o=a.useRef();a.useEffect(()=>(o.current=setTimeout(()=>{c(!1),r()},s),()=>clearTimeout(o.current)),[s,r]);const n=()=>{clearTimeout(o.current),c(!1),d()};return e.jsx(m,{children:t&&e.jsx(x.div,{initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:10,scale:.95},transition:{duration:.22,ease:[.22,1,.36,1]},className:"fixed bottom-6 left-1/2 z-50 -translate-x-1/2",children:e.jsxs("div",{className:"flex items-center gap-3 rounded-xl px-4 py-2.5 shadow-lg",style:{backgroundColor:i.cardBgElevated,border:`1px solid ${i.cardBorderStrong}`},children:[e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:i.lime,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M20 6 9 17l-5-5"})}),e.jsx("span",{className:"text-body text-primary",children:l}),e.jsx("button",{onClick:n,className:"ml-1 rounded-md px-2.5 py-1 text-caption font-semibold transition-colors hover:bg-white/[0.08]",style:{color:i.lime},children:"Undo"}),e.jsx("div",{className:"absolute bottom-0 left-3 right-3 h-0.5 overflow-hidden rounded-full",children:e.jsx("div",{className:"h-full origin-left rounded-full",style:{backgroundColor:i.lime,opacity:.4,animation:`undoCountdown ${s}ms linear forwards`}})})]})})})}function y(){const[l,s]=a.useState([]),d=o=>{const n=`undo-${Date.now()}-${Math.random().toString(36).slice(2,6)}`;return s(u=>[...u,{...o,id:n}]),n},r=o=>{s(n=>n.filter(u=>u.id!==o))},t=l[0]??null;return{enqueue:d,ToastRenderer:()=>t?e.jsx(f,{message:t.message,onUndo:()=>{t.onUndo(),r(t.id)},onExpire:()=>{t.onCommit(),r(t.id)}},t.id):null}}export{y as u};