@runfusion/fusion 0.14.0 → 0.14.1

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 (35) hide show
  1. package/dist/bin.js +82 -6
  2. package/dist/client/assets/{AgentDetailView-CBFUveyO.js → AgentDetailView-B3KAsP2O.js} +1 -1
  3. package/dist/client/assets/{AgentsView-DPezXQ-U.js → AgentsView-DoXb_amw.js} +3 -3
  4. package/dist/client/assets/{ChatView-5N4-EuhD.js → ChatView-BJ2c7wvd.js} +1 -1
  5. package/dist/client/assets/{DevServerView-Daft4YFc.js → DevServerView-DbgM4tlT.js} +1 -1
  6. package/dist/client/assets/{DirectoryPicker-rew1y6qO.js → DirectoryPicker-DfmtfMiu.js} +1 -1
  7. package/dist/client/assets/{DocumentsView-i72qJzwd.js → DocumentsView-_-Efkx_W.js} +1 -1
  8. package/dist/client/assets/{InsightsView-BL5eZJ0a.js → InsightsView-DUjcfW53.js} +1 -1
  9. package/dist/client/assets/{MemoryView-pl8Cdg_p.js → MemoryView-DxMPBb0q.js} +1 -1
  10. package/dist/client/assets/{NodesView-D6eJ15zc.js → NodesView-BEBTI15s.js} +1 -1
  11. package/dist/client/assets/{PiExtensionsManager-ExInwXWP.js → PiExtensionsManager-BpMYhHH_.js} +1 -1
  12. package/dist/client/assets/PluginManager-CPv7yQd3.js +1 -0
  13. package/dist/client/assets/PluginManager-DA_T0GHn.css +1 -0
  14. package/dist/client/assets/{ResearchView-B_QPUEjB.js → ResearchView-BrFvdyXT.js} +1 -1
  15. package/dist/client/assets/{RoadmapsView-DBNLaEsK.js → RoadmapsView-BDjLrtcj.js} +1 -1
  16. package/dist/client/assets/{SettingsModal-1ET586M3.js → SettingsModal-Cd-QGB0C.js} +3 -3
  17. package/dist/client/assets/{SettingsModal-CL_gWmOj.js → SettingsModal-CxDxiTRy.js} +1 -1
  18. package/dist/client/assets/{SetupWizardModal-CLkY9HFL.js → SetupWizardModal-DFUA4X3z.js} +1 -1
  19. package/dist/client/assets/{SkillMultiselect-B0qi32SQ.js → SkillMultiselect-BUWe5ujb.js} +1 -1
  20. package/dist/client/assets/{SkillsView-umVjRq6o.js → SkillsView-RAkqGX3y.js} +1 -1
  21. package/dist/client/assets/TodoView-Ceb0wrg1.js +6 -0
  22. package/dist/client/assets/{folder-open-nYPrL1W3.js → folder-open-DcM-Vd6r.js} +1 -1
  23. package/dist/client/assets/{index-Bc8nfKeH.js → index-DH3aprf6.js} +6 -6
  24. package/dist/client/assets/{list-checks-sK8xJeH_.js → list-checks-ByGHVQpZ.js} +1 -1
  25. package/dist/client/assets/{star-BRtXbYkB.js → star-DlEYI8GL.js} +1 -1
  26. package/dist/client/assets/{upload-BP60eBwN.js → upload-DKshabz-.js} +1 -1
  27. package/dist/client/assets/{users-qSGAX2Pf.js → users-X6tYPPBV.js} +1 -1
  28. package/dist/client/index.html +1 -1
  29. package/dist/client/version.json +1 -1
  30. package/dist/extension.js +82 -6
  31. package/dist/pi-claude-cli/package.json +1 -1
  32. package/package.json +1 -1
  33. package/dist/client/assets/PluginManager-CYhtxHun.js +0 -1
  34. package/dist/client/assets/PluginManager-jyNkJZSz.css +0 -1
  35. package/dist/client/assets/TodoView-CFifSvrD.js +0 -6
@@ -1,4 +1,4 @@
1
- import{c}from"./index-Bc8nfKeH.js";/**
1
+ import{c}from"./index-DH3aprf6.js";/**
2
2
  * @license lucide-react v1.7.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as a}from"./index-Bc8nfKeH.js";/**
1
+ import{c as a}from"./index-DH3aprf6.js";/**
2
2
  * @license lucide-react v1.7.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as a}from"./index-Bc8nfKeH.js";/**
1
+ import{c as a}from"./index-DH3aprf6.js";/**
2
2
  * @license lucide-react v1.7.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as e}from"./index-Bc8nfKeH.js";/**
1
+ import{c as e}from"./index-DH3aprf6.js";/**
2
2
  * @license lucide-react v1.7.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -92,7 +92,7 @@
92
92
  }
93
93
  })();
94
94
  </script>
95
- <script type="module" crossorigin src="/assets/index-Bc8nfKeH.js"></script>
95
+ <script type="module" crossorigin src="/assets/index-DH3aprf6.js"></script>
96
96
  <link rel="modulepreload" crossorigin href="/assets/vendor-react-K0fH_qHe.js">
97
97
  <link rel="modulepreload" crossorigin href="/assets/vendor-xterm-DzcZoU0P.js">
98
98
  <link rel="stylesheet" crossorigin href="/assets/vendor-xterm-LZoznX6r.css">
@@ -1 +1 @@
1
- {"version":"monistpj-af26ccb5"}
1
+ {"version":"monkm5qv-26aba899"}
package/dist/extension.js CHANGED
@@ -10371,7 +10371,7 @@ function validatePluginManifest(manifest) {
10371
10371
  const m = manifest;
10372
10372
  if (!m.id || typeof m.id !== "string" || m.id.trim() === "") {
10373
10373
  errors.push("id is required and must be a non-empty string");
10374
- } else if (!/^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/.test(m.id)) {
10374
+ } else if (!SLUG_PATTERN.test(m.id)) {
10375
10375
  errors.push("id must be a valid slug (lowercase, alphanumeric, hyphens only, cannot start or end with hyphen)");
10376
10376
  }
10377
10377
  if (!m.name || typeof m.name !== "string" || m.name.trim() === "") {
@@ -10424,7 +10424,7 @@ function validatePluginManifest(manifest) {
10424
10424
  const runtime = m.runtime;
10425
10425
  if (!runtime.runtimeId || typeof runtime.runtimeId !== "string" || runtime.runtimeId.trim() === "") {
10426
10426
  errors.push("runtime.runtimeId is required and must be a non-empty string");
10427
- } else if (!/^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/.test(runtime.runtimeId)) {
10427
+ } else if (!SLUG_PATTERN.test(runtime.runtimeId)) {
10428
10428
  errors.push("runtime.runtimeId must be a valid slug (lowercase, alphanumeric, hyphens only, cannot start or end with hyphen)");
10429
10429
  }
10430
10430
  if (!runtime.name || typeof runtime.name !== "string" || runtime.name.trim() === "") {
@@ -10439,14 +10439,93 @@ function validatePluginManifest(manifest) {
10439
10439
  }
10440
10440
  }
10441
10441
  }
10442
+ if (m.skills !== void 0) {
10443
+ if (!Array.isArray(m.skills)) {
10444
+ errors.push("skills must be an array");
10445
+ } else {
10446
+ for (const [index, skill] of m.skills.entries()) {
10447
+ if (!skill || typeof skill !== "object") {
10448
+ errors.push(`skills[${index}] must be an object`);
10449
+ continue;
10450
+ }
10451
+ const skillMeta = skill;
10452
+ if (!skillMeta.skillId || typeof skillMeta.skillId !== "string" || skillMeta.skillId.trim() === "") {
10453
+ errors.push(`skills[${index}].skillId is required and must be a non-empty string`);
10454
+ } else if (!SLUG_PATTERN.test(skillMeta.skillId)) {
10455
+ errors.push(`skills[${index}].skillId must be a valid slug (lowercase, alphanumeric, hyphens only, cannot start or end with hyphen)`);
10456
+ }
10457
+ if (!skillMeta.name || typeof skillMeta.name !== "string" || skillMeta.name.trim() === "") {
10458
+ errors.push(`skills[${index}].name is required and must be a non-empty string`);
10459
+ }
10460
+ }
10461
+ }
10462
+ }
10463
+ if (m.workflowSteps !== void 0) {
10464
+ if (!Array.isArray(m.workflowSteps)) {
10465
+ errors.push("workflowSteps must be an array");
10466
+ } else {
10467
+ for (const [index, step] of m.workflowSteps.entries()) {
10468
+ if (!step || typeof step !== "object") {
10469
+ errors.push(`workflowSteps[${index}] must be an object`);
10470
+ continue;
10471
+ }
10472
+ const stepMeta = step;
10473
+ if (!stepMeta.stepId || typeof stepMeta.stepId !== "string" || stepMeta.stepId.trim() === "") {
10474
+ errors.push(`workflowSteps[${index}].stepId is required and must be a non-empty string`);
10475
+ } else if (!SLUG_PATTERN.test(stepMeta.stepId)) {
10476
+ errors.push(`workflowSteps[${index}].stepId must be a valid slug (lowercase, alphanumeric, hyphens only, cannot start or end with hyphen)`);
10477
+ }
10478
+ if (!stepMeta.name || typeof stepMeta.name !== "string" || stepMeta.name.trim() === "") {
10479
+ errors.push(`workflowSteps[${index}].name is required and must be a non-empty string`);
10480
+ }
10481
+ if (stepMeta.mode !== void 0 && (typeof stepMeta.mode !== "string" || !["prompt", "script"].includes(stepMeta.mode))) {
10482
+ errors.push(`workflowSteps[${index}].mode must be one of: prompt, script`);
10483
+ }
10484
+ }
10485
+ }
10486
+ }
10487
+ if (m.promptSurfaces !== void 0) {
10488
+ if (!Array.isArray(m.promptSurfaces)) {
10489
+ errors.push("promptSurfaces must be an array");
10490
+ } else {
10491
+ for (const [index, surface] of m.promptSurfaces.entries()) {
10492
+ if (typeof surface !== "string" || !PROMPT_CONTRIBUTION_SURFACES.includes(surface)) {
10493
+ errors.push(`promptSurfaces[${index}] must be one of: ${PROMPT_CONTRIBUTION_SURFACES.join(", ")}`);
10494
+ }
10495
+ }
10496
+ }
10497
+ }
10498
+ if (m.setup !== void 0) {
10499
+ if (typeof m.setup !== "object" || m.setup === null) {
10500
+ errors.push("setup must be an object");
10501
+ } else {
10502
+ const setup = m.setup;
10503
+ if (!setup.binaryName || typeof setup.binaryName !== "string" || setup.binaryName.trim() === "") {
10504
+ errors.push("setup.binaryName is required and must be a non-empty string");
10505
+ }
10506
+ if (!setup.description || typeof setup.description !== "string" || setup.description.trim() === "") {
10507
+ errors.push("setup.description is required and must be a non-empty string");
10508
+ }
10509
+ if (setup.channel !== void 0 && (typeof setup.channel !== "string" || !SETUP_CHANNELS.includes(setup.channel))) {
10510
+ errors.push(`setup.channel must be one of: ${SETUP_CHANNELS.join(", ")}`);
10511
+ }
10512
+ if (setup.defaultTimeoutMs !== void 0 && (typeof setup.defaultTimeoutMs !== "number" || !Number.isFinite(setup.defaultTimeoutMs) || setup.defaultTimeoutMs <= 0)) {
10513
+ errors.push("setup.defaultTimeoutMs must be a positive finite number");
10514
+ }
10515
+ }
10516
+ }
10442
10517
  return {
10443
10518
  valid: errors.length === 0,
10444
10519
  errors
10445
10520
  };
10446
10521
  }
10522
+ var SLUG_PATTERN, PROMPT_CONTRIBUTION_SURFACES, SETUP_CHANNELS;
10447
10523
  var init_plugin_types = __esm({
10448
10524
  "../core/src/plugin-types.ts"() {
10449
10525
  "use strict";
10526
+ SLUG_PATTERN = /^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/;
10527
+ PROMPT_CONTRIBUTION_SURFACES = ["executor-system", "executor-task", "triage", "reviewer", "heartbeat"];
10528
+ SETUP_CHANNELS = ["stable", "beta", "nightly"];
10450
10529
  }
10451
10530
  });
10452
10531
 
@@ -53221,11 +53300,8 @@ async function createFnAgent2(options) {
53221
53300
  const createSessionWithModel = async (modelOverride) => {
53222
53301
  const customToolList = [
53223
53302
  ...wrappedTools,
53224
- ...isReadonly ? [] : options.customTools ?? []
53303
+ ...options.customTools ?? []
53225
53304
  ];
53226
- if (isReadonly && (options.customTools?.length ?? 0) > 0) {
53227
- piLog.log(`readonly session \u2014 customTools (${options.customTools.length}) skipped`);
53228
- }
53229
53305
  if (options.beforeSpawnSession) {
53230
53306
  await options.beforeSpawnSession();
53231
53307
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fusion/pi-claude-cli",
3
- "version": "0.14.0",
3
+ "version": "0.14.1",
4
4
  "description": "Fusion vendored fork: pi coding-agent extension that routes LLM calls through the Claude Code CLI. Forked from rchern/pi-claude-cli (MIT). See UPSTREAM.md.",
5
5
  "license": "MIT",
6
6
  "private": true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@runfusion/fusion",
3
- "version": "0.14.0",
3
+ "version": "0.14.1",
4
4
  "license": "MIT",
5
5
  "description": "Fusion CLI: HTTP API server, daemon, dashboard launcher, and task tooling for the Fusion AI coding agent.",
6
6
  "homepage": "https://github.com/Runfusion/Fusion#readme",
@@ -1 +0,0 @@
1
- import{r as u,j as s}from"./vendor-react-K0fH_qHe.js";import{w as ee,dP as se,s as ne,X as k,an as te,J as O,dQ as A,V,R as ie,dR as ae,aF as le,ch as re,dS as ce,dT as de,dU as ue,dV as oe,dW as _,ce as ge}from"./index-Bc8nfKeH.js";import{D as me}from"./DirectoryPicker-rew1y6qO.js";import"./vendor-xterm-DzcZoU0P.js";import"./folder-open-nYPrL1W3.js";const H=[{id:"fusion-plugin-hermes-runtime",name:"Hermes Runtime",path:"./plugins/fusion-plugin-hermes-runtime",experimental:!0},{id:"fusion-plugin-paperclip-runtime",name:"Paperclip Runtime",path:"./plugins/fusion-plugin-paperclip-runtime"},{id:"fusion-plugin-openclaw-runtime",name:"OpenClaw Runtime",path:"./plugins/fusion-plugin-openclaw-runtime",experimental:!0}],j={started:"var(--color-success)",loaded:"var(--color-warning)",error:"var(--color-error)",stopped:"var(--color-muted)",installed:"var(--color-info)"};function fe({addToast:l,projectId:c}){const[N,x]=u.useState([]),[S,w]=u.useState(!0),[J,f]=u.useState(!1),[b,v]=u.useState(""),[C,P]=u.useState(!1),[h,I]=u.useState(null),[i,y]=u.useState(null),[a,p]=u.useState({}),[M,R]=u.useState(!1),[$,E]=u.useState(null),{confirm:G}=ee(),o=u.useCallback(async()=>{try{w(!0);const e=await se(c);x(e)}catch(e){l(`Failed to load plugins: ${e instanceof Error?e.message:String(e)}`,"error")}finally{w(!1)}},[c,l]);u.useEffect(()=>{o()},[o]);const K=u.useRef([]);K.current=N,u.useEffect(()=>{const e=c?`?projectId=${encodeURIComponent(c)}`:"",n=g=>{try{const t=JSON.parse(g.data);if(c&&t.projectId&&t.projectId!==c)return;switch(t.transition){case"installing":case"enabled":case"disabled":case"settings-updated":x(d=>{const m=d.findIndex(r=>r.id===t.pluginId);if(m>=0){const r=[...d];return r[m]={...r[m],enabled:t.enabled,state:t.state,settings:t.settings,error:t.error},r}else return o(),d});break;case"uninstalled":x(d=>d.filter(m=>m.id!==t.pluginId));break;case"error":x(d=>{const m=d.findIndex(r=>r.id===t.pluginId);if(m>=0){const r=[...d];return r[m]={...r[m],state:t.state,error:t.error},r}return d});break}}catch{}};return ne(`/api/events${e}`,{events:{"plugin:lifecycle":n},onReconnect:()=>{o()}})},[c,o]);const z=async()=>{if(!b.trim()){l("Please enter a plugin path","error");return}try{P(!0),await _({path:b},c),l("Plugin installed successfully","success"),f(!1),v(""),await o()}catch(e){l(`Failed to install plugin: ${e instanceof Error?e.message:String(e)}`,"error")}finally{P(!1)}},Q=async e=>{try{E(e.id),await _({path:e.path},c),l(`${e.name} installed successfully`,"success"),await o()}catch(n){l(`Failed to install ${e.name}: ${n instanceof Error?n.message:String(n)}`,"error")}finally{E(null)}},F=async e=>{try{await ue(e.id,c),l(`${e.name} enabled`,"success"),await o()}catch(n){l(`Failed to enable plugin: ${n instanceof Error?n.message:String(n)}`,"error")}},U=async e=>{try{await de(e.id,c),l(`${e.name} disabled`,"success"),await o()}catch(n){l(`Failed to disable plugin: ${n instanceof Error?n.message:String(n)}`,"error")}},B=async e=>{try{I(e.id),await ce(e.id,c),l(`${e.name} reloaded`,"success"),await o()}catch(n){l(`Failed to reload plugin: ${n instanceof Error?n.message:String(n)}`,"error")}finally{I(null)}},L=async e=>{if(await G({title:"Uninstall Plugin",message:`Are you sure you want to uninstall "${e.name}"?`,danger:!0}))try{await oe(e.id,c),l(`${e.name} uninstalled`,"success"),await o(),y(null)}catch(g){l(`Failed to uninstall plugin: ${g instanceof Error?g.message:String(g)}`,"error")}},W=async e=>{y(e);try{R(!0);const n=await ge(e.id,c);p(n)}catch{p({})}finally{R(!1)}},X=async()=>{if(i)try{await re(i.id,a,c),l("Settings saved","success")}catch(e){l(`Failed to save settings: ${e instanceof Error?e.message:String(e)}`,"error")}};if(i)return s.jsxs("div",{className:"plugin-manager-detail","data-testid":"plugin-manager-detail",children:[s.jsxs("div",{className:"plugin-manager-detail-header",children:[s.jsx("button",{className:"btn-icon",onClick:()=>y(null),"aria-label":"Back to plugin list",children:s.jsx(k,{size:16})}),s.jsxs("div",{className:"plugin-detail-title",children:[s.jsx("h4",{className:"plugin-detail-name",children:i.name}),s.jsx("span",{className:"plugin-state-badge",style:{color:j[i.state]||j.installed},children:i.state})]})]}),s.jsxs("div",{className:"plugin-detail-content",children:[s.jsxs("div",{className:"plugin-detail-card",children:[i.description&&s.jsx("p",{className:"plugin-description",children:i.description}),i.author&&s.jsxs("p",{className:"plugin-detail-meta-row",children:[s.jsx("span",{className:"text-muted",children:"Author:"}),i.author]}),i.homepage&&s.jsxs("p",{className:"plugin-detail-meta-row plugin-homepage",children:[s.jsx("span",{className:"text-muted",children:"Homepage:"}),s.jsxs("a",{href:i.homepage,target:"_blank",rel:"noopener noreferrer",children:[i.homepage,s.jsx(te,{size:12})]})]}),s.jsxs("p",{className:"plugin-detail-meta-row",children:[s.jsx("span",{className:"text-muted",children:"Version:"}),i.version]})]}),s.jsxs("div",{className:"plugin-detail-card",children:[s.jsx("h5",{className:"plugin-detail-section-heading",children:"Settings"}),M?s.jsx("p",{className:"text-muted",children:"Loading..."}):i.settingsSchema&&Object.keys(i.settingsSchema).length>0?s.jsxs("div",{className:"plugin-settings-form",children:[Object.entries(i.settingsSchema).map(([e,n])=>{const g=`setting-${e}-help`;return s.jsxs("div",{className:"form-group",children:[s.jsxs("label",{htmlFor:`setting-${e}`,children:[n.label||e,n.required&&" *"]}),n.type==="string"&&!n.multiline&&s.jsx("input",{type:"text",id:`setting-${e}`,value:a[e]??"",onChange:t=>p({...a,[e]:t.target.value}),placeholder:n.description,"aria-describedby":n.description&&!n.required?g:void 0}),n.type==="string"&&n.multiline&&s.jsx("textarea",{id:`setting-${e}`,rows:4,value:a[e]??"",onChange:t=>p({...a,[e]:t.target.value}),placeholder:n.description,"aria-describedby":n.description&&!n.required?g:void 0}),n.type==="password"&&s.jsx("input",{type:"password",id:`setting-${e}`,value:a[e]??"",onChange:t=>p({...a,[e]:t.target.value}),placeholder:n.description,"aria-describedby":n.description&&!n.required?g:void 0}),n.type==="number"&&s.jsx("input",{type:"number",id:`setting-${e}`,value:a[e]??"",onChange:t=>p({...a,[e]:Number(t.target.value)}),"aria-describedby":n.description&&!n.required?g:void 0}),n.type==="boolean"&&s.jsxs("label",{className:"checkbox-label",children:[s.jsx("input",{type:"checkbox",checked:a[e]??!1,onChange:t=>p({...a,[e]:t.target.checked})}),n.description]}),n.type==="enum"&&s.jsxs("select",{id:`setting-${e}`,value:a[e]??"",onChange:t=>p({...a,[e]:t.target.value}),"aria-describedby":n.description&&!n.required?g:void 0,children:[s.jsx("option",{value:"",children:"Select..."}),n.enumValues?.map(t=>s.jsx("option",{value:t,children:t},t))]}),n.type==="array"&&s.jsxs("div",{className:"plugin-settings-array",children:[a[e]?.map((t,d)=>s.jsxs("div",{className:"plugin-settings-array-item",children:[s.jsx("input",{type:n.itemType==="number"?"number":"text",value:t??"",onChange:m=>{const r=m.target.value,D=[...a[e]||[]];D[d]=n.itemType==="number"?Number(r):r,p({...a,[e]:D})}}),s.jsx("button",{className:"btn-icon",onClick:()=>{const r=[...a[e]||[]];r.splice(d,1),p({...a,[e]:r})},"aria-label":"Remove item",children:s.jsx(k,{size:14})})]},d)),s.jsxs("button",{className:"btn btn-secondary",onClick:()=>{const t=a[e]||[],d=n.itemType==="number"?0:"";p({...a,[e]:[...t,d]})},children:[s.jsx(O,{size:14})," Add Item"]})]}),n.description&&!n.required&&!n.multiline&&s.jsx("span",{id:g,className:"form-help",children:n.description})]},e)}),s.jsx("button",{className:"btn btn-primary",onClick:X,children:"Save Settings"})]}):s.jsx("p",{className:"text-muted",children:"No configurable settings."})]}),s.jsxs("div",{className:"plugin-detail-actions",children:[i.state==="started"&&s.jsxs("button",{className:"btn btn-secondary",onClick:()=>B(i),disabled:h===i.id,children:[s.jsx(A,{size:14,className:h===i.id?"spin":""}),h===i.id?"Reloading...":"Reload"]}),i.enabled?s.jsx("button",{className:"btn btn-secondary",onClick:()=>U(i),children:"Disable"}):s.jsx("button",{className:"btn btn-primary",onClick:()=>F(i),children:"Enable"}),s.jsxs("button",{className:"btn btn-danger",onClick:()=>L(i),children:[s.jsx(V,{size:14})," Uninstall"]})]})]})]});const Y=new Set(N.map(e=>e.id)),Z=new Set(H.map(e=>e.id)),q=N.filter(e=>!Z.has(e.id)),T=()=>s.jsxs("section",{className:"plugin-bundled-runtime-section","aria-label":"Bundled Runtime Plugins",children:[s.jsxs("div",{className:"plugin-bundled-runtime-header",children:[s.jsx("h4",{className:"plugin-bundled-runtime-heading",children:"Bundled Runtime Plugins"}),s.jsx("p",{className:"plugin-bundled-runtime-description",children:"Install Fusion's bundled runtimes directly from this screen."})]}),s.jsx("div",{className:"plugin-bundled-runtime-list","aria-label":"Bundled runtime plugin recommendations",children:H.map(e=>{const n=Y.has(e.id);return s.jsxs("div",{className:"plugin-bundled-runtime-item",children:[s.jsxs("div",{className:"plugin-bundled-runtime-meta",children:[s.jsx("span",{className:"plugin-bundled-runtime-name",children:e.name}),e.experimental&&s.jsx("span",{className:"plugin-bundled-runtime-badge",children:"Experimental"}),s.jsx("span",{className:`plugin-bundled-runtime-status ${n?"plugin-bundled-runtime-status--installed":"plugin-bundled-runtime-status--available"}`,children:n?"Installed":"Not installed"})]}),s.jsx("button",{className:`btn ${n?"btn-secondary":"btn-primary"} btn-sm`,onClick:()=>Q(e),disabled:n||$===e.id,children:n?"Installed":$===e.id?"Installing...":`Install ${e.name}`})]},e.id)})})]});return s.jsxs("div",{className:"plugin-manager","data-testid":"plugin-manager",children:[s.jsxs("div",{className:"plugin-manager-header",children:[s.jsx("span",{className:"plugin-manager-header-title",children:"Installed Plugins"}),s.jsxs("div",{className:"plugin-manager-actions",children:[s.jsxs("button",{className:"btn btn-sm btn-ghost",onClick:o,title:"Refresh","aria-label":"Refresh plugin list",children:[s.jsx(ie,{size:14,className:S?"spin":""}),"Refresh"]}),s.jsxs("button",{className:"btn btn-primary btn-sm",onClick:()=>f(!0),children:[s.jsx(O,{size:14})," Install"]})]})]}),J&&s.jsxs("div",{className:"plugin-install-form",children:[s.jsxs("p",{className:"plugin-install-hint",children:["Browse to a plugin package root (contains ",s.jsx("code",{children:"manifest.json"}),") or a built ",s.jsx("code",{children:"dist"})," directory."]}),s.jsx(me,{value:b,onChange:v,placeholder:"Absolute path to plugin directory or dist folder",onInputKeyDown:e=>{e.key==="Enter"&&(e.preventDefault(),z())}}),s.jsxs("div",{className:"plugin-install-actions",children:[s.jsx("button",{className:"btn btn-primary",onClick:z,disabled:C||!b.trim(),children:C?"Installing...":"Install Plugin"}),s.jsx("button",{className:"btn btn-secondary",onClick:()=>{f(!1),v("")},children:"Cancel"})]})]}),S?s.jsx("div",{className:"settings-empty-state",children:"Loading plugins..."}):s.jsxs(s.Fragment,{children:[q.length===0?s.jsxs("div",{className:"settings-empty-state",children:[s.jsx(ae,{size:32,className:"text-muted"}),s.jsx("p",{children:"No plugins installed."}),s.jsx("p",{className:"text-muted",children:"Install a plugin to get started, or use a bundled runtime below."})]}):s.jsx("div",{className:"plugin-list",children:q.map(e=>s.jsxs("div",{className:"plugin-item",children:[s.jsxs("div",{className:"plugin-info",children:[s.jsx("span",{className:"plugin-name",children:e.name}),s.jsxs("span",{className:"plugin-version text-muted",children:["v",e.version]}),s.jsx("span",{className:"plugin-state-badge",style:{color:j[e.state]||j.installed},children:e.state})]}),s.jsxs("div",{className:"plugin-actions",children:[e.state==="started"&&s.jsx("button",{className:"btn-icon",onClick:()=>B(e),disabled:h===e.id,title:"Reload",children:s.jsx(A,{size:14,className:h===e.id?"spin":""})}),s.jsxs("label",{className:"toggle-switch",children:[s.jsx("input",{type:"checkbox",checked:e.enabled,onChange:()=>e.enabled?U(e):F(e)}),s.jsx("span",{className:"toggle-slider"})]}),s.jsx("button",{className:"btn-icon",onClick:()=>W(e),title:"Settings",children:s.jsx(le,{size:14})}),s.jsx("button",{className:"btn-icon",onClick:()=>L(e),title:"Uninstall",children:s.jsx(V,{size:14})})]})]},e.id))}),T()]})]})}export{fe as PluginManager,j as STATE_COLORS};
@@ -1 +0,0 @@
1
- .plugin-manager,.plugin-manager-detail{display:flex;flex-direction:column;gap:var(--space-lg);padding-inline:var(--space-xl);padding-block:var(--space-md)}.plugin-manager-header{display:flex;align-items:center;justify-content:space-between;padding-bottom:var(--space-sm);border-bottom:var(--btn-border-width) solid var(--border);gap:var(--space-sm)}.plugin-manager-header-title{font-size:13px;font-weight:600;color:var(--text);flex:1}.plugin-manager-actions{display:flex;gap:var(--space-sm);align-items:center}.plugin-install-form{display:flex;flex-direction:column;gap:var(--space-sm);padding:var(--space-lg);border:var(--btn-border-width) solid var(--border);border-radius:var(--radius-md);background:var(--surface)}.plugin-install-hint{margin:0;font-size:.85rem;color:var(--text-secondary, var(--text-muted));line-height:1.45}.plugin-install-hint code{padding:var(--btn-border-width) var(--space-xs);border-radius:var(--radius-sm);background:color-mix(in srgb,var(--text-muted) 12%,transparent);font-size:.85em}.plugin-install-actions{display:flex;gap:var(--space-sm);justify-content:flex-end}.plugin-list{display:flex;flex-direction:column;gap:var(--space-sm)}.plugin-item{display:flex;align-items:center;justify-content:space-between;padding:var(--space-md) var(--space-lg);background:var(--surface);border:var(--btn-border-width) solid var(--border);border-radius:var(--radius-md);transition:border-color var(--transition-fast)}.plugin-item:hover{border-color:var(--text-dim)}.plugin-info{display:flex;align-items:center;gap:var(--space-sm);min-width:0}.plugin-name{font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.plugin-version{font-size:.85rem}.plugin-state-badge{display:inline-flex;align-items:center;padding:var(--space-xs) var(--space-sm);border-radius:var(--radius-pill);font-size:.7rem;font-weight:600;text-transform:uppercase;letter-spacing:.04em;background:color-mix(in srgb,currentColor 12%,transparent)}.plugin-actions{display:flex;align-items:center;gap:var(--space-xs);flex-shrink:0}.plugin-manager-detail-header,.plugin-detail-title{display:flex;align-items:center;gap:var(--space-md);flex-wrap:wrap}.plugin-detail-name{margin:0}.plugin-detail-content{display:flex;flex-direction:column;gap:var(--space-lg)}.plugin-detail-card{background:var(--surface);border:var(--btn-border-width) solid var(--border);border-radius:var(--radius-md);padding:var(--space-lg);display:flex;flex-direction:column;gap:var(--space-md)}.plugin-description{font-size:.95rem;color:var(--text-secondary, var(--text-muted));line-height:1.5}.plugin-detail-meta-row{display:flex;align-items:center;gap:var(--space-xs);font-size:.9rem;color:var(--text-muted)}.plugin-homepage a{display:inline-flex;align-items:center;gap:var(--space-xs);color:var(--color-info);font-size:.85rem}.plugin-detail-section-heading{margin:0;padding:0;border:0;font-size:.95rem}.plugin-settings-form{display:flex;flex-direction:column;gap:var(--space-lg);margin-top:var(--space-xs)}.plugin-settings-form .form-group{padding:0;margin:0}.plugin-settings-array{display:flex;flex-direction:column;gap:var(--space-sm)}.plugin-settings-array-item{display:flex;align-items:center;gap:var(--space-sm)}.plugin-settings-array-item input{flex:1}.plugin-detail-actions{display:flex;gap:var(--space-sm);padding-top:var(--space-md);border-top:var(--btn-border-width) solid var(--border);justify-content:flex-end}.plugin-manager .empty-state,.plugin-manager .loading-state,.plugin-manager .settings-empty-state{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--space-sm);padding:var(--space-2xl);text-align:center;color:var(--text-muted)}.plugin-bundled-runtime-list{width:100%;display:flex;flex-direction:column;gap:var(--space-sm);margin-top:var(--space-sm)}.plugin-bundled-runtime-item{display:flex;align-items:center;justify-content:space-between;gap:var(--space-sm);padding:var(--space-sm) var(--space-md);border:var(--btn-border-width) solid var(--border);border-radius:var(--radius-md);background:var(--surface)}.plugin-bundled-runtime-meta{display:flex;align-items:center;gap:var(--space-sm);min-width:0}.plugin-bundled-runtime-name{color:var(--text);font-size:.9rem;font-weight:500}.plugin-bundled-runtime-badge{display:inline-flex;align-items:center;padding:var(--btn-border-width) var(--space-xs);border-radius:var(--radius-pill);background:var(--status-in-review-bg);color:var(--in-review);font-size:.75rem;font-weight:600;text-transform:uppercase}.plugin-bundled-runtime-section{display:flex;flex-direction:column;gap:var(--space-sm)}.plugin-bundled-runtime-header{display:flex;flex-direction:column;gap:var(--space-xs)}.plugin-bundled-runtime-heading{margin:0;font-size:.95rem}.plugin-bundled-runtime-description{margin:0;font-size:.85rem;color:var(--text-muted)}.plugin-bundled-runtime-status{display:inline-flex;align-items:center;padding:var(--btn-border-width) var(--space-xs);border-radius:var(--radius-pill);font-size:.75rem;font-weight:600;text-transform:uppercase}.plugin-bundled-runtime-status--installed{background:var(--status-done-bg);color:var(--done)}.plugin-bundled-runtime-status--available{background:var(--status-todo-bg);color:var(--todo)}@media(max-width:768px){.plugin-manager-detail-header{gap:var(--space-sm)}.plugin-detail-title{gap:var(--space-xs)}.plugin-detail-card{padding:var(--space-md);gap:var(--space-sm)}.plugin-list{gap:var(--space-xs)}.plugin-item{padding:var(--space-md);flex-direction:column;align-items:stretch;gap:var(--space-sm)}.plugin-info{width:100%;flex-wrap:wrap;row-gap:var(--space-xs)}.plugin-name{flex:1 1 100%;white-space:normal}.plugin-actions{width:100%;justify-content:flex-end;flex-wrap:wrap;gap:var(--space-sm)}.plugin-actions .btn-icon,.plugin-actions .toggle-switch{min-width:36px;min-height:36px}.plugin-actions .toggle-switch{display:inline-flex;align-items:center;justify-content:center}.plugin-detail-actions{flex-wrap:wrap;justify-content:flex-start}.plugin-detail-actions button{flex:1 1 auto;min-height:36px}.plugin-bundled-runtime-item{flex-direction:column;align-items:stretch}.plugin-bundled-runtime-item .btn{min-height:36px}}
@@ -1,6 +0,0 @@
1
- import{r as d,j as e}from"./vendor-react-K0fH_qHe.js";import{c as It,b$ as Nt,c0 as wt,c1 as Ct,c2 as St,c3 as At,c4 as $t,c5 as Et,c6 as Dt,w as Ft,i as Tt,z as q,c7 as ct,L as Mt,J as Ot,bl as G,X as Q,aH as lt,V as ut,ad as Rt,W as Pt,am as Ut,B as mt}from"./index-Bc8nfKeH.js";import{L as bt}from"./list-checks-sK8xJeH_.js";import"./vendor-xterm-DzcZoU0P.js";/**
2
- * @license lucide-react v1.7.0 - ISC
3
- *
4
- * This source code is licensed under the ISC license.
5
- * See the LICENSE file in the root directory of this source tree.
6
- */const _t=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]],Kt=It("circle-plus",_t);function Bt(L){const{items:l,...f}=L;return f}function pt(L){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?`${L}-${crypto.randomUUID()}`:`${L}-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}function Vt(L={}){const{projectId:l,addToast:f}=L,[I,N]=d.useState([]),[k,y]=d.useState([]),[S,_]=d.useState(!0),[H,g]=d.useState(null),[$,E]=d.useState(null),[v,h]=d.useState([]),C=d.useRef($);C.current=$,d.useEffect(()=>{let s=!1;async function c(){_(!0),g(null);try{const r=await Dt(l);if(s)return;h(r),N(r.map(Bt));const u=C.current&&r.some(a=>a.id===C.current)?C.current:r[0]?.id??null;E(u),y(u?r.find(a=>a.id===u)?.items??[]:[])}catch(r){if(s)return;h([]),N([]),y([]),E(null),g(r instanceof Error?r.message:"Failed to load todo lists")}finally{s||_(!1)}}return c(),()=>{s=!0}},[l]),d.useEffect(()=>{if(!$){y([]);return}const s=v.find(c=>c.id===$);y(s?.items??[])},[v,$]);const J=d.useCallback(async s=>{const c=I,r=v,u=new Date().toISOString(),a={id:pt("temp-list"),projectId:l??"",title:s,createdAt:u,updatedAt:u};g(null),N(n=>[...n,a]),h(n=>[...n,{...a,items:[]}]);try{const n=await Nt(s,l);N(i=>i.map(o=>o.id===a.id?n:o)),h(i=>i.map(o=>o.id===a.id?{...n,items:[]}:o)),C.current||E(n.id)}catch(n){N(c),h(r),g(n instanceof Error?n.message:"Failed to create list"),f?.("Failed to create todo list","error")}},[f,v,I,l]),T=d.useCallback(async(s,c)=>{const r=I,u=v;g(null),N(a=>a.map(n=>n.id===s?{...n,title:c}:n)),h(a=>a.map(n=>n.id===s?{...n,title:c}:n));try{const a=await wt(s,c,l);N(n=>n.map(i=>i.id===s?a:i)),h(n=>n.map(i=>i.id===s?{...a,items:i.items}:i))}catch(a){N(r),h(u),g(a instanceof Error?a.message:"Failed to rename list"),f?.("Failed to rename todo list","error")}},[f,v,I,l]),A=d.useCallback(async s=>{const c=I,r=v,u=C.current,a=u===s?I.find(n=>n.id!==s)?.id??null:u;g(null),N(n=>n.filter(i=>i.id!==s)),h(n=>n.filter(i=>i.id!==s)),u===s&&E(a);try{await Ct(s,l)}catch(n){N(c),h(r),E(u),g(n instanceof Error?n.message:"Failed to delete list"),f?.("Failed to delete todo list","error")}},[f,v,I,l]),K=d.useCallback(async s=>{const c=C.current;if(!c)return;const r=k,u=v,a=new Date().toISOString(),n=k.reduce((o,b)=>Math.max(o,b.sortOrder),-1),i={id:pt("temp-item"),listId:c,text:s,completed:!1,completedAt:null,createdAt:a,updatedAt:a,sortOrder:n+1};g(null),y(o=>[...o,i]),h(o=>o.map(b=>b.id===c?{...b,items:[...b.items,i]}:b));try{const o=await St(c,s,l);y(b=>b.map(x=>x.id===i.id?o:x)),h(b=>b.map(x=>x.id===c?{...x,items:x.items.map(F=>F.id===i.id?o:F)}:x))}catch(o){y(r),h(u),g(o instanceof Error?o.message:"Failed to create item"),f?.("Failed to create todo item","error")}},[f,k,v,l]),w=d.useCallback(async(s,c)=>{const r=k.find(o=>o.id===s);if(!r)return;const u=k,a=v,n=c.completed??r.completed,i={...r,...c,completed:n,completedAt:n?r.completedAt??new Date().toISOString():null,updatedAt:new Date().toISOString()};g(null),y(o=>o.map(b=>b.id===s?i:b)),h(o=>o.map(b=>b.id===i.listId?{...b,items:b.items.map(x=>x.id===s?i:x)}:b));try{const o=await At(s,c,l);y(b=>b.map(x=>x.id===s?o:x)),h(b=>b.map(x=>x.id===o.listId?{...x,items:x.items.map(F=>F.id===s?o:F)}:x))}catch(o){y(u),h(a),g(o instanceof Error?o.message:"Failed to update item"),f?.("Failed to update todo item","error")}},[f,k,v,l]),M=d.useCallback(async s=>{const c=k.find(r=>r.id===s);c&&await w(s,{completed:!c.completed})},[k,w]),D=d.useCallback(async s=>{const c=k,r=v;g(null),y(u=>u.filter(a=>a.id!==s)),h(u=>u.map(a=>({...a,items:a.items.filter(n=>n.id!==s)})));try{await $t(s,l)}catch(u){y(c),h(r),g(u instanceof Error?u.message:"Failed to delete item"),f?.("Failed to delete todo item","error")}},[f,k,v,l]),B=d.useCallback(async s=>{const c=C.current;if(!c)return;const r=k,u=v,a=new Map(k.map(i=>[i.id,i])),n=s.map((i,o)=>{const b=a.get(i);return b?{...b,sortOrder:o}:null}).filter(i=>i!==null);g(null),y(n),h(i=>i.map(o=>o.id===c?{...o,items:n}:o));try{await Et(c,s,l)}catch(i){y(r),h(u),g(i instanceof Error?i.message:"Failed to reorder items"),f?.("Failed to reorder todo items","error")}},[f,k,v,l]);return{lists:I,items:k,loading:S,error:H,selectedListId:$,setSelectedListId:E,createList:J,renameList:T,deleteList:A,createItem:K,updateItem:w,toggleItem:M,deleteItem:D,reorderItems:B}}function zt(L){return[...L].sort((l,f)=>l.sortOrder-f.sortOrder)}function qt({projectId:L,addToast:l,onPlanningMode:f}){const{lists:I,items:N,loading:k,error:y,selectedListId:S,setSelectedListId:_,createList:H,renameList:g,deleteList:$,createItem:E,updateItem:v,toggleItem:h,deleteItem:C,reorderItems:J}=Vt({projectId:L,addToast:(t,p)=>{if(p==="success"||p==="error"||p==="info"||p===void 0){l(t,p);return}l(t,"info")}}),[T,A]=d.useState(null),[K,w]=d.useState(""),[M,D]=d.useState(null),[B,s]=d.useState(""),[c,r]=d.useState(""),[u,a]=d.useState(!1),[n,i]=d.useState(""),[o,b]=d.useState([]),[x,F]=d.useState(!1),[W,O]=d.useState(!1),[Y,R]=d.useState(null),X=d.useRef(null),{confirm:ht}=Ft(),Z=d.useMemo(()=>I.find(t=>t.id===S)??null,[I,S]),V=d.useMemo(()=>zt(N.filter(t=>t.listId===S)),[N,S]);function tt(){A(null),w(""),r(""),a(!1)}function z(){D(null),s(""),i("")}function ft(t){tt(),z(),_(t)}const xt=d.useCallback(async()=>{F(!0);try{const t=await Tt(void 0,L);b(t),O(!0)}catch(t){l(`Failed to load agents: ${q(t)}`,"error"),O(!1),R(null)}finally{F(!1)}},[L,l]);d.useEffect(()=>{A(null),w(""),r(""),a(!1),D(null),s(""),i(""),O(!1),R(null)},[S]),d.useEffect(()=>{if(!W)return;const t=p=>{X.current&&!X.current.contains(p.target)&&(O(!1),R(null))};return document.addEventListener("mousedown",t),()=>{document.removeEventListener("mousedown",t)}},[W]);function gt(t){z(),A(t.id),w(t.title),a(!1)}async function et(){if(!T)return;const t=K.trim();if(!t){A(null),w("");return}await g(T,t),A(null),w("")}function st(){A(null),w("")}function nt(t){tt(),D(t.id),s(t.text)}async function at(){if(!M)return;const t=B.trim();if(!t){D(null),s("");return}await v(M,{text:t}),D(null),s("")}function it(){D(null),s("")}async function ot(){const t=c.trim();t&&(await H(t),r(""),a(!1))}async function dt(){if(!S)return;const t=n.trim();t&&(await E(t),i(""))}async function vt(t){await ht({title:"Delete List",message:"Delete this list and all its items?",danger:!0})&&await $(t)}async function jt(t){await C(t)}async function rt(t,p){const j=V.map(U=>U.id),m=j.findIndex(U=>U===t);if(m<0)return;const P=p==="up"?m-1:m+1;P<0||P>=j.length||([j[m],j[P]]=[j[P],j[m]],await J(j))}const yt=d.useCallback(async t=>{try{const p={description:t.text,column:"triage",source:{sourceType:"dashboard_ui"}},j=await ct(p,L);l(`Created ${j.id} from todo`,"success")}catch(p){l(`Failed to create task: ${q(p)}`,"error")}},[L,l]),Lt=d.useCallback(async(t,p)=>{try{const j={description:t.text,column:"triage",assignedAgentId:p,source:{sourceType:"dashboard_ui"}},m=await ct(j,L),U=o.find(kt=>kt.id===p)?.name??p;l(`Created ${m.id} and assigned to ${U}`,"success"),O(!1),R(null)}catch(j){l(`Failed to create and assign task: ${q(j)}`,"error")}},[L,l,o]);return k?e.jsx("div",{className:"todo-view",children:e.jsxs("div",{className:"todo-loading",children:[e.jsx(Mt,{className:"todo-loading-icon","aria-hidden":"true"}),e.jsx("p",{children:"Loading todos..."})]})}):e.jsxs("div",{className:"todo-view",children:[e.jsx("div",{className:"todo-view-header",children:e.jsxs("div",{children:[e.jsx("h2",{children:"Todos"}),e.jsx("p",{className:"todo-view-description",children:"Manage reusable todo lists for your project."})]})}),e.jsxs("div",{className:"todo-view-layout",children:[e.jsxs("aside",{className:"todo-view-sidebar","aria-label":"Todo lists sidebar",children:[e.jsxs("div",{className:"todo-sidebar-header",children:[e.jsx("h3",{className:"todo-sidebar-title",children:"Lists"}),e.jsx("button",{type:"button",className:"btn btn-sm btn-icon todo-add-list-btn",onClick:()=>{z(),a(!0),A(null)},"aria-label":"Add list","data-testid":"add-list-button",children:e.jsx(Ot,{})})]}),u&&e.jsxs("div",{className:"todo-list-item",children:[e.jsx("input",{className:"input todo-inline-edit-input",placeholder:"New list title",value:c,onChange:t=>r(t.target.value),onKeyDown:t=>{t.key==="Enter"&&ot(),t.key==="Escape"&&(r(""),a(!1))},autoFocus:!0,"data-testid":"new-list-input"}),e.jsx("button",{type:"button",className:"btn btn-sm btn-icon todo-icon-btn",onClick:()=>{ot()},"aria-label":"Save list",children:e.jsx(G,{})}),e.jsx("button",{type:"button",className:"btn btn-sm btn-icon todo-icon-btn",onClick:()=>{r(""),a(!1)},"aria-label":"Cancel list",children:e.jsx(Q,{})})]}),I.length===0&&!u?e.jsxs("div",{className:"todo-empty-state",children:[e.jsx(bt,{"aria-hidden":"true"}),e.jsx("p",{children:"No todo lists yet. Create one to get started."}),e.jsx("button",{type:"button",className:"btn btn-sm",onClick:()=>{z(),a(!0)},children:"Create List"})]}):e.jsx("div",{className:"todo-list-items",role:"list","aria-label":"Todo lists",children:I.map(t=>{const p=t.id===S,j=t.id===T;return e.jsx("div",{className:`todo-list-item${p?" todo-list-item--active":""}`,role:"listitem",children:j?e.jsxs(e.Fragment,{children:[e.jsx("input",{className:"input todo-inline-edit-input",value:K,onChange:m=>w(m.target.value),onKeyDown:m=>{m.key==="Enter"&&et(),m.key==="Escape"&&st()},autoFocus:!0,"data-testid":`rename-list-input-${t.id}`}),e.jsx("button",{type:"button",className:"btn btn-sm btn-icon todo-icon-btn",onClick:()=>{et()},"aria-label":"Save list rename",children:e.jsx(G,{})}),e.jsx("button",{type:"button",className:"btn btn-sm btn-icon todo-icon-btn",onClick:st,"aria-label":"Cancel list rename",children:e.jsx(Q,{})})]}):e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:"todo-list-select-btn",onClick:()=>ft(t.id),"aria-label":`Select list ${t.title}`,"aria-current":p?"true":void 0,"data-testid":`todo-list-${t.id}`,children:e.jsx("span",{className:"todo-list-item-name",children:t.title})}),e.jsxs("div",{className:"todo-list-item-actions",children:[e.jsx("button",{type:"button",className:"btn btn-sm btn-icon todo-icon-btn",onClick:()=>{gt(t)},"aria-label":`Rename ${t.title}`,"data-testid":`rename-list-button-${t.id}`,children:e.jsx(lt,{})}),e.jsx("button",{type:"button",className:"btn btn-sm btn-icon btn-danger todo-icon-btn",onClick:()=>{vt(t.id)},"aria-label":`Delete ${t.title}`,"data-testid":`delete-list-button-${t.id}`,children:e.jsx(ut,{})})]})]})},t.id)})})]}),e.jsxs("section",{className:"todo-view-main","aria-label":"Todo items",children:[y&&e.jsxs("div",{className:"todo-error-banner",role:"alert",children:[e.jsx("span",{className:"todo-error-message",children:y}),e.jsx("button",{type:"button",className:"btn btn-sm",onClick:()=>window.location.reload(),children:"Retry"})]}),Z?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"todo-items-header",children:e.jsx("h3",{children:Z.title})}),e.jsxs("div",{className:"todo-add-item-row",children:[e.jsx("input",{className:"input",placeholder:"Add a todo item",value:n,onChange:t=>i(t.target.value),onKeyDown:t=>{t.key==="Enter"&&dt(),t.key==="Escape"&&i("")},"data-testid":"new-item-input"}),e.jsx("button",{type:"button",className:"btn btn-primary",onClick:()=>{dt()},children:"Add"})]}),V.length===0?e.jsx("div",{className:"todo-empty-state",children:e.jsx("p",{children:"No items in this list. Add one above."})}):e.jsx("div",{className:"todo-items-list",children:V.map((t,p)=>{const j=t.id===M;return e.jsxs("div",{className:"todo-item","data-testid":`todo-item-${t.id}`,children:[e.jsxs("div",{className:"todo-item-main-row",children:[e.jsx("input",{type:"checkbox",checked:t.completed,onChange:()=>{h(t.id)},className:"todo-item-checkbox","aria-label":`Toggle ${t.text}`,"data-testid":`toggle-item-${t.id}`}),j?e.jsx("input",{className:"input todo-inline-edit-input",value:B,onChange:m=>s(m.target.value),onKeyDown:m=>{m.key==="Enter"&&at(),m.key==="Escape"&&it()},autoFocus:!0,"data-testid":`edit-item-input-${t.id}`}):e.jsx("button",{type:"button",className:`todo-item-text${t.completed?" todo-item-text--completed":""}`,onClick:()=>nt(t),children:t.text})]}),e.jsx("div",{className:"todo-item-actions","data-testid":`todo-item-actions-${t.id}`,children:j?e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:"btn btn-sm btn-icon todo-icon-btn",onClick:()=>{at()},"aria-label":"Save item edit",children:e.jsx(G,{})}),e.jsx("button",{type:"button",className:"btn btn-sm btn-icon todo-icon-btn",onClick:it,"aria-label":"Cancel item edit",children:e.jsx(Q,{})})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"todo-item-reorder-btns",children:[e.jsx("button",{type:"button",className:"btn btn-sm btn-icon todo-item-reorder-btn",onClick:()=>{rt(t.id,"up")},disabled:p===0,"aria-label":`Move ${t.text} up`,"data-testid":`move-up-${t.id}`,children:e.jsx(Rt,{})}),e.jsx("button",{type:"button",className:"btn btn-sm btn-icon todo-item-reorder-btn",onClick:()=>{rt(t.id,"down")},disabled:p===V.length-1,"aria-label":`Move ${t.text} down`,"data-testid":`move-down-${t.id}`,children:e.jsx(Pt,{})})]}),e.jsx("button",{type:"button",className:"btn btn-sm btn-icon todo-icon-btn",onClick:()=>{f?.(t.text)},"aria-label":`Start planning from ${t.text}`,"data-testid":`planning-from-${t.id}`,children:e.jsx(Ut,{})}),e.jsx("button",{type:"button",className:"btn btn-sm btn-icon todo-icon-btn",onClick:()=>{yt(t)},"aria-label":`Create task from ${t.text}`,"data-testid":`create-task-from-${t.id}`,children:e.jsx(Kt,{})}),e.jsxs("div",{className:"todo-agent-picker-trigger",ref:Y===t.id?X:void 0,children:[e.jsx("button",{type:"button",className:"btn btn-sm btn-icon todo-icon-btn",onClick:()=>{R(t.id),xt()},"aria-label":`Assign ${t.text} to agent`,"data-testid":`assign-agent-for-${t.id}`,children:e.jsx(mt,{})}),W&&Y===t.id&&e.jsx("div",{className:"todo-agent-picker-dropdown",onMouseDown:m=>{m.preventDefault()},children:x?e.jsx("div",{className:"todo-agent-picker-loading",children:"Loading agents..."}):o.filter(m=>m.state!=="terminated").length>0?o.filter(m=>m.state!=="terminated").map(m=>e.jsxs("button",{type:"button",className:"todo-agent-picker-item",onClick:()=>{Lt(t,m.id)},children:[e.jsx(mt,{}),e.jsx("span",{children:m.name}),e.jsx("span",{className:"todo-agent-picker-role",children:m.role})]},m.id)):e.jsx("div",{className:"todo-agent-picker-empty",children:"No agents available"})})]}),e.jsx("button",{type:"button",className:"btn btn-sm btn-icon todo-icon-btn",onClick:()=>nt(t),"aria-label":`Edit ${t.text}`,"data-testid":`edit-item-${t.id}`,children:e.jsx(lt,{})}),e.jsx("button",{type:"button",className:"btn btn-sm btn-icon btn-danger todo-icon-btn",onClick:()=>{jt(t.id)},"aria-label":`Delete ${t.text}`,"data-testid":`delete-item-${t.id}`,children:e.jsx(ut,{})})]})})]},t.id)})})]}):e.jsxs("div",{className:"todo-empty-state",children:[e.jsx(bt,{"aria-hidden":"true"}),e.jsx("p",{children:"Select a list from the sidebar"})]})]})]})]})}export{qt as TodoView};