@tt-a1i/hive 2.1.15 → 2.1.16

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 (28) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/src/server/agent-run-bootstrap.d.ts +3 -0
  3. package/dist/src/server/agent-run-bootstrap.js +1 -0
  4. package/dist/src/server/agent-run-exit-handler.js +2 -7
  5. package/dist/src/server/agent-run-start-context.d.ts +4 -4
  6. package/dist/src/server/agent-run-starter.js +12 -5
  7. package/dist/src/server/resumed-session-cleanup.d.ts +15 -0
  8. package/dist/src/server/resumed-session-cleanup.js +26 -0
  9. package/dist/src/server/session-capture-codex.d.ts +1 -0
  10. package/dist/src/server/session-capture-codex.js +22 -2
  11. package/dist/src/server/session-capture.d.ts +1 -0
  12. package/dist/src/server/session-capture.js +5 -4
  13. package/package.json +1 -1
  14. package/web/dist/assets/{AddWorkerDialog-Dfg4e74k.js → AddWorkerDialog-CPQkMvDz.js} +2 -2
  15. package/web/dist/assets/{AddWorkspaceFlow-Bt5i_6p3.js → AddWorkspaceFlow-CkOOz4Kj.js} +1 -1
  16. package/web/dist/assets/{FirstRunWizard--NAbC5zC.js → FirstRunWizard-DzAnGniE.js} +1 -1
  17. package/web/dist/assets/{MarketplaceDrawer-CJhft0Xd.js → MarketplaceDrawer-DAWF9idk.js} +1 -1
  18. package/web/dist/assets/{TaskGraphDrawer-BUCR4zPH.js → TaskGraphDrawer-DRVJ4Z7z.js} +1 -1
  19. package/web/dist/assets/{WhatsNewDialog-B05r5jd4.js → WhatsNewDialog-BDsPg5Fa.js} +1 -1
  20. package/web/dist/assets/{WorkerModal-CSM87uaz.js → WorkerModal-BN3jQTBO.js} +1 -1
  21. package/web/dist/assets/{WorkflowsDrawer-pBezljLE.js → WorkflowsDrawer-Clv5ROhE.js} +1 -1
  22. package/web/dist/assets/{WorkspaceMemoryDrawer-Akq36Iaz.js → WorkspaceMemoryDrawer-DVZT9TqV.js} +1 -1
  23. package/web/dist/assets/{WorkspaceTaskDrawer-CDhs_vbw.js → WorkspaceTaskDrawer-C14sALb8.js} +1 -1
  24. package/web/dist/assets/{index-BTPjdp2B.js → index-DoOf8jsj.js} +5 -5
  25. package/web/dist/assets/{search-CWX42x_k.js → search-CPePg8x3.js} +1 -1
  26. package/web/dist/assets/{square-terminal-DoiN9oxG.js → square-terminal-DwJxHx2m.js} +1 -1
  27. package/web/dist/index.html +1 -1
  28. package/web/dist/sw.js +1 -1
@@ -1 +1 @@
1
- import{c as y,i as G,u as E,r as d,D as J,F as X,j as e,R as Y,P as Z,O as ee,k as se,m as te,T as j,X as re,L as w,G as P,E as B,H as W,J as ae,K as ne,N as ie,Q as le,U as F,V as oe}from"./index-BTPjdp2B.js";import{S as de}from"./search-CWX42x_k.js";const ce=[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]],me=y("archive",ce);const pe=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],xe=y("eye-off",pe);const he=[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89",key:"znwnzq"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11",key:"c9qhm2"}]],ue=y("pin-off",he);const be=[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]],fe=y("pin",be);const je=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],ye=y("settings-2",je),O={decision:"memory.kind.decision",fact:"memory.kind.fact",pitfall:"memory.kind.pitfall",preference:"memory.kind.preference",procedure_ref:"memory.kind.procedure_ref"},ge=new Intl.DateTimeFormat(void 0,{day:"2-digit",hour:"2-digit",minute:"2-digit",month:"short"}),k=(a,s)=>a?ge.format(new Date(a)):s("common.never"),V=(a,s=140)=>{const t=a.trim();return t.length<=s?t:`${t.slice(0,s-1)}…`},ve=a=>{const s=a.sources[0];return s?.actorNameSnapshot?`${a.source} · ${s.actorNameSnapshot}`:a.source},Ne=a=>a==="dreams"?null:a,we=({busy:a,memory:s,onArchive:t,onToggleDisabled:p,onTogglePinned:n})=>{const[i,c]=d.useState(!1),{t:l}=E();return e.jsxs("li",{className:"drawer-card p-3","data-testid":`memory-row-${s.id}`,"data-pinned":s.pinned,"data-disabled":s.disabled,children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsxs("button",{type:"button",onClick:()=>c(m=>!m),"aria-expanded":i,className:"min-w-0 flex-1 text-left focus-visible:outline focus-visible:outline-1 focus-visible:outline-offset-2 focus-visible:outline-[var(--accent)]",children:[e.jsxs("div",{className:"mb-1.5 flex flex-wrap items-center gap-2 text-[11px]",children:[e.jsx("span",{className:`drawer-kind-badge drawer-kind-badge--${s.kind}`,children:l(O[s.kind])}),s.pinned?e.jsx("span",{className:"font-medium text-accent",children:l("memory.pinned")}):null,s.scope==="user"?e.jsx("span",{className:"text-ter",children:l("memory.scopeUser")}):null,s.disabled?e.jsx("span",{className:"text-ter",children:l("memory.disabled")}):null,e.jsx("span",{className:"text-ter",children:ve(s)})]}),e.jsx("p",{className:"break-words text-sm text-pri leading-snug",children:i?s.body:V(s.body)}),e.jsxs("div",{className:"mt-2 flex flex-wrap gap-1 text-[11px] text-ter",children:[s.tags.map(m=>e.jsx("span",{className:"rounded border px-1.5 py-0.5",style:{borderColor:"var(--border)"},children:m},m)),e.jsx("span",{children:l("memory.updated",{time:k(s.updatedAt,l)})}),e.jsx("span",{children:l("memory.injected",{time:k(s.lastInjectedAt,l)})}),s.procedureRef?e.jsx("span",{children:`${s.procedureRef.type}: ${s.procedureRef.title??s.procedureRef.id}`}):null]})]}),e.jsx("div",{className:"flex shrink-0 items-center gap-1 drawer-card__actions",children:s.status==="active"?e.jsxs(e.Fragment,{children:[e.jsx(j,{label:s.pinned?l("memory.unpinTooltip"):l("memory.pinTooltip"),children:e.jsx("button",{type:"button",disabled:a,onClick:()=>n(s),"aria-label":s.pinned?l("memory.unpinTooltip"):l("memory.pinTooltip"),className:"icon-btn pointer-coarse:min-h-10 pointer-coarse:min-w-10",children:s.pinned?e.jsx(ue,{size:13}):e.jsx(fe,{size:13})})}),e.jsx(j,{label:s.disabled?l("memory.enableTooltip"):l("memory.disableTooltip"),children:e.jsx("button",{type:"button",disabled:a,onClick:()=>p(s),"aria-label":s.disabled?l("memory.enableTooltip"):l("memory.disableTooltip"),className:"icon-btn pointer-coarse:min-h-10 pointer-coarse:min-w-10",children:s.disabled?e.jsx(ie,{size:13}):e.jsx(xe,{size:13})})}),e.jsx(j,{label:l("memory.archiveButton"),children:e.jsx("button",{type:"button",disabled:a,onClick:()=>t(s),"aria-label":l("memory.archiveButton"),className:"icon-btn icon-btn--danger pointer-coarse:min-h-10 pointer-coarse:min-w-10",children:e.jsx(me,{size:13})})})]}):null})]}),i?e.jsxs("div",{className:"drawer-card__expanded",children:[e.jsx("h4",{className:"drawer-section-label",children:l("memory.sources")}),s.sources.length===0?e.jsx("p",{className:"text-ter",children:l("memory.noSources")}):e.jsx("ul",{className:"space-y-2",children:s.sources.map(m=>e.jsxs("li",{className:"break-words",children:[e.jsxs("div",{className:"text-ter",children:[m.sourceType,m.actorNameSnapshot?` · ${m.actorNameSnapshot}`:"",m.actorRoleSnapshot?` · ${m.actorRoleSnapshot}`:""]}),m.excerpt?e.jsx("p",{className:"mt-0.5",children:m.excerpt}):null]},m.id))})]}):null]})},ke=(a,s)=>a.report?[`${a.report.added.length} ${s("memory.reportAdded")}`,`${a.report.rewritten.length} ${s("memory.reportRewritten")}`,`${a.report.archived.length} ${s("memory.reportArchived")}`,`${a.report.merged.length} ${s("memory.reportMerged")}`].join(" · "):a.error?`${s("common.error")} · ${V(a.error,90)}`:s("memory.noReport"),Se=(a,s)=>a.inputSeqFrom===null||a.inputSeqTo===null?s("memory.noInput"):`${s("memory.seq")} ${a.inputSeqFrom}-${a.inputSeqTo}`,$e=({busy:a,onRevert:s,run:t})=>{const[p,n]=d.useState(!1),{t:i}=E();return e.jsxs("li",{className:"drawer-card p-3","data-testid":`dream-run-${t.id}`,"data-dream-status":t.status,children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsxs("button",{type:"button",onClick:()=>n(c=>!c),"aria-expanded":p,className:"min-w-0 flex-1 text-left focus-visible:outline focus-visible:outline-1 focus-visible:outline-offset-2 focus-visible:outline-[var(--accent)]",children:[e.jsxs("div",{className:"mb-1.5 flex flex-wrap items-center gap-2 text-[11px]",children:[e.jsx("span",{className:`drawer-status-badge drawer-status-badge--${t.status}`,children:i(`memory.status.${t.status}`)}),e.jsx("span",{className:"text-ter",children:i(`memory.trigger.${t.trigger}`)}),e.jsx("span",{className:"text-ter",children:Se(t,i)}),e.jsx("span",{className:"text-ter",children:i("memory.started",{time:k(t.startedAt,i)})})]}),e.jsx("p",{className:"break-words text-sm text-pri leading-snug",children:ke(t,i)}),t.finishedAt?e.jsx("p",{className:"mt-1 text-[11px] text-ter",children:i("memory.finished",{time:k(t.finishedAt,i)})}):null]}),t.status==="completed"?e.jsx("div",{className:"drawer-card__actions",children:e.jsx(j,{label:i("memory.revertButton"),children:e.jsx("button",{type:"button",disabled:a,onClick:()=>s(t),"aria-label":i("memory.revertTooltip"),className:"icon-btn icon-btn--danger pointer-coarse:min-h-10 pointer-coarse:min-w-10",children:a?e.jsx(w,{size:13,className:"animate-spin"}):e.jsx(ne,{size:13})})})}):null]}),p&&t.report?e.jsxs("div",{className:"drawer-card__expanded space-y-3",children:[t.report.added.length>0?e.jsxs("div",{className:"dream-diff-block border-l-2 border-l-status-green",children:[e.jsxs("h4",{className:"dream-diff-title dream-diff-added flex items-center gap-1.5 font-semibold",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-status-green"}),i("memory.diff.added")]}),e.jsx("ul",{className:"space-y-1.5 mt-1.5",children:t.report.added.map(c=>e.jsxs("li",{className:"break-words text-[11px] text-pri flex items-start gap-1",children:[e.jsx("span",{className:"text-status-green select-none font-semibold mr-1",children:"+"}),e.jsxs("span",{className:"flex-1",children:[e.jsx("span",{className:`drawer-kind-badge drawer-kind-badge--${c.kind} scale-90 origin-left inline-block mr-1`,children:i(O[c.kind])}),c.body]})]},c.id))})]}):null,t.report.rewritten.length>0?e.jsxs("div",{className:"dream-diff-block border-l-2 border-l-[#f59e0b]",children:[e.jsxs("h4",{className:"dream-diff-title dream-diff-rewritten flex items-center gap-1.5 font-semibold",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-[#f59e0b]"}),i("memory.diff.rewritten")]}),e.jsx("p",{className:"mt-1.5 text-[11px] text-sec leading-relaxed pl-3 break-all",children:t.report.rewritten.map(c=>c.id).join(", ")})]}):null,t.report.archived.length>0?e.jsxs("div",{className:"dream-diff-block border-l-2 border-l-status-red",children:[e.jsxs("h4",{className:"dream-diff-title dream-diff-archived flex items-center gap-1.5 font-semibold",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-status-red"}),i("memory.diff.archived")]}),e.jsx("p",{className:"mt-1.5 text-[11px] text-sec leading-relaxed pl-3 break-all",children:t.report.archived.map(c=>c.id).join(", ")})]}):null,t.report.merged.length>0?e.jsxs("div",{className:"dream-diff-block border-l-2 border-l-purple-500",children:[e.jsxs("h4",{className:"dream-diff-title dream-diff-merged flex items-center gap-1.5 font-semibold",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-purple-500"}),i("memory.diff.merged")]}),e.jsx("p",{className:"mt-1.5 text-[11px] text-sec leading-relaxed pl-3 break-all",children:t.report.merged.map(c=>c.into).join(", ")})]}):null]}):null,p&&t.error?e.jsx("p",{className:"drawer-card__error",children:t.error}):null]})},Me=({open:a,onClose:s,workspaceId:t})=>{const p=G(),{t:n}=E(),[i,c]=d.useState("active"),[l,m]=d.useState(""),[g,S]=d.useState([]),[v,$]=d.useState([]),[A,C]=d.useState(!1),[q,h]=d.useState(null),[H,L]=d.useState(null),[T,N]=d.useState(null),[M,R]=d.useState(null),[_,D]=d.useState(null),b=d.useRef(0),I=d.useMemo(()=>[{id:"active",label:n("memory.tabActive")},{id:"archived",label:n("memory.tabArchived")},{id:"dreams",label:n("memory.tabDreams")}],[n]),u=Ne(i),f=d.useCallback(async()=>{const r=b.current+1;if(b.current=r,!t||!a){S([]),$([]),C(!1);return}C(!0),h(null),S([]),$([]);try{const[o,x]=await Promise.all([u?J(t,{query:l,scope:"all",status:u}):Promise.resolve([]),u?Promise.resolve([]):X(t,{limit:20})]);if(b.current!==r)return;S(o),$(x)}catch(o){b.current===r&&h(o instanceof Error?o.message:String(o))}finally{b.current===r&&C(!1)}},[a,l,u,t]);d.useEffect(()=>{f()},[f]);const z=async(r,o)=>{if(t){L(r.id),h(null);try{await o(t),await f()}catch(x){h(x instanceof Error?x.message:String(x))}finally{L(null)}}},K=d.useMemo(()=>({current:u?g.length:v.length}),[v.length,g.length,u]),Q=async()=>{if(t){N("run-now"),h(null);try{await ae(t),await f()}catch(r){h(r instanceof Error?r.message:String(r))}finally{N(null)}}},U=async r=>{if(t){N(r.id),h(null);try{await le(t,r.id),await f()}catch(o){h(o instanceof Error?o.message:String(o))}finally{N(null)}}};return e.jsxs(e.Fragment,{children:[e.jsx(Y,{open:a,onOpenChange:r=>!r&&s(),children:e.jsxs(Z,{children:[e.jsx(ee,{"data-testid":"memory-overlay",className:"app-overlay fixed inset-0 z-40"}),e.jsx("div",{className:"pointer-events-none fixed inset-0 z-50 grid place-items-center p-4",children:e.jsxs(se,{"data-testid":"memory-drawer","aria-label":n("memory.title"),"data-mobile":p||void 0,className:"dialog-scale-pop elev-2 pointer-events-auto flex flex-col rounded-lg border",style:p?{background:"var(--bg-1)",borderColor:"var(--border-bright)"}:{background:"var(--bg-1)",borderColor:"var(--border-bright)",height:"min(720px, calc(100vh - 48px))",width:"min(780px, calc(100vw - 48px))"},children:[e.jsxs("header",{className:"flex items-center justify-between border-b px-4 py-2",style:{borderColor:"var(--border)"},children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx(te,{className:"text-base font-semibold text-pri",children:n("memory.title")}),e.jsx("p",{className:"text-xs text-ter",children:n("memory.subtitle")})]}),e.jsx(j,{label:n("common.close"),children:e.jsx("button",{type:"button",onClick:s,"aria-label":n("common.close"),className:"icon-btn pointer-coarse:min-h-11 pointer-coarse:min-w-11",children:e.jsx(re,{size:14})})})]}),e.jsxs("div",{className:`flex gap-2 border-b px-4 py-2 ${p?"flex-col items-stretch":"items-center gap-2"}`,style:{borderColor:"var(--border)"},children:[e.jsx("div",{className:"drawer-tabs",style:p?{width:"100%",justifyContent:"flex-start"}:void 0,children:I.map(r=>e.jsx("button",{type:"button",onClick:()=>c(r.id),"aria-pressed":i===r.id,className:`drawer-tab pointer-coarse:min-h-10 ${i===r.id?"drawer-tab--active":""}`,children:r.label},r.id))}),u?e.jsxs("label",{className:"drawer-search",style:p?{width:"100%",maxWidth:"none"}:{marginLeft:"auto"},children:[e.jsx("span",{className:"sr-only",children:n("memory.searchPlaceholder")}),e.jsx(de,{size:14,className:"pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-ter"}),e.jsx("input",{value:l,onChange:r=>m(r.currentTarget.value),placeholder:n("memory.searchPlaceholder"),name:"memory-search",autoComplete:"off",className:"h-8 w-full rounded-md border bg-transparent pl-8 pr-3 text-xs text-pri outline-none transition-colors placeholder:text-ter focus-visible:border-[var(--accent)]",style:{borderColor:"var(--border-bright)"}})]}):null]}),e.jsxs("div",{className:"scroll-y min-h-0 flex-1 px-4 py-3",children:[q?e.jsx("div",{className:"mb-3 rounded-md border px-3 py-2 text-xs",style:{borderColor:"color-mix(in oklab, var(--status-red) 30%, var(--border))",color:"var(--text-error)",background:"color-mix(in oklab, var(--status-red) 8%, transparent)"},children:q}):null,e.jsx("section",{className:"drawer-section",children:e.jsxs("div",{className:"drawer-section__header",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ye,{size:14,className:"text-sec"}),e.jsxs("span",{className:"font-medium text-sec",children:[K.current," ",n(u?"memory.entries":"memory.runs")]})]}),i==="dreams"?e.jsxs("button",{type:"button",onClick:Q,disabled:T!==null,className:"drawer-action-btn pointer-coarse:min-h-10",children:[T==="run-now"?e.jsx(w,{size:14,className:"animate-spin"}):e.jsx(P,{size:14}),n("memory.runNow")]}):null]})}),i==="dreams"?A?e.jsxs("div",{className:"flex h-[320px] items-center justify-center text-ter",children:[e.jsx(w,{size:18,className:"animate-spin"}),e.jsx("span",{className:"ml-2 text-sm",children:n("common.loading")})]}):v.length===0?e.jsx("div",{className:"flex h-[320px] items-center justify-center",children:e.jsx(B,{icon:e.jsx(P,{size:20}),title:n("memory.emptyDreams"),description:n("memory.emptyDreamsDesc")})}):e.jsx("ul",{className:"space-y-2",children:v.map(r=>e.jsx($e,{run:r,busy:T===r.id,onRevert:D},r.id))}):A?e.jsxs("div",{className:"flex h-[320px] items-center justify-center text-ter",children:[e.jsx(w,{size:18,className:"animate-spin"}),e.jsx("span",{className:"ml-2 text-sm",children:n("common.loading")})]}):g.length===0?e.jsx("div",{className:"flex h-[320px] items-center justify-center",children:e.jsx(B,{title:n("memory.emptyActive"),description:n("memory.emptyActiveDesc")})}):e.jsx("ul",{className:"space-y-2",children:g.map(r=>e.jsx(we,{memory:r,busy:H===r.id,onArchive:R,onToggleDisabled:o=>z(o,x=>F(x,o.id,{disabled:!o.disabled})),onTogglePinned:o=>z(o,x=>F(x,o.id,{pinned:!o.pinned}))},r.id))})]})]})})]})}),e.jsx(W,{open:M!==null,onOpenChange:r=>{r||R(null)},title:n("memory.archiveTitle"),description:n("memory.archiveDesc"),confirmLabel:n("memory.archiveButton"),confirmKind:"danger",onConfirm:()=>{if(!M)return;const r=M;R(null),z(r,o=>oe(o,r.id))}}),e.jsx(W,{open:_!==null,onOpenChange:r=>{r||D(null)},title:n("memory.revertTitle"),description:n("memory.revertDesc"),confirmLabel:n("memory.revertButton"),confirmKind:"danger",onConfirm:()=>{if(!_)return;const r=_;D(null),U(r)}})]})};export{Me as WorkspaceMemoryDrawer};
1
+ import{c as y,i as G,u as E,r as d,D as J,F as X,j as e,R as Y,P as Z,O as ee,k as se,m as te,T as j,X as re,L as w,G as P,E as B,H as W,J as ae,K as ne,N as ie,Q as le,U as F,V as oe}from"./index-DoOf8jsj.js";import{S as de}from"./search-CPePg8x3.js";const ce=[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]],me=y("archive",ce);const pe=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],xe=y("eye-off",pe);const he=[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89",key:"znwnzq"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11",key:"c9qhm2"}]],ue=y("pin-off",he);const be=[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]],fe=y("pin",be);const je=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],ye=y("settings-2",je),O={decision:"memory.kind.decision",fact:"memory.kind.fact",pitfall:"memory.kind.pitfall",preference:"memory.kind.preference",procedure_ref:"memory.kind.procedure_ref"},ge=new Intl.DateTimeFormat(void 0,{day:"2-digit",hour:"2-digit",minute:"2-digit",month:"short"}),k=(a,s)=>a?ge.format(new Date(a)):s("common.never"),V=(a,s=140)=>{const t=a.trim();return t.length<=s?t:`${t.slice(0,s-1)}…`},ve=a=>{const s=a.sources[0];return s?.actorNameSnapshot?`${a.source} · ${s.actorNameSnapshot}`:a.source},Ne=a=>a==="dreams"?null:a,we=({busy:a,memory:s,onArchive:t,onToggleDisabled:p,onTogglePinned:n})=>{const[i,c]=d.useState(!1),{t:l}=E();return e.jsxs("li",{className:"drawer-card p-3","data-testid":`memory-row-${s.id}`,"data-pinned":s.pinned,"data-disabled":s.disabled,children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsxs("button",{type:"button",onClick:()=>c(m=>!m),"aria-expanded":i,className:"min-w-0 flex-1 text-left focus-visible:outline focus-visible:outline-1 focus-visible:outline-offset-2 focus-visible:outline-[var(--accent)]",children:[e.jsxs("div",{className:"mb-1.5 flex flex-wrap items-center gap-2 text-[11px]",children:[e.jsx("span",{className:`drawer-kind-badge drawer-kind-badge--${s.kind}`,children:l(O[s.kind])}),s.pinned?e.jsx("span",{className:"font-medium text-accent",children:l("memory.pinned")}):null,s.scope==="user"?e.jsx("span",{className:"text-ter",children:l("memory.scopeUser")}):null,s.disabled?e.jsx("span",{className:"text-ter",children:l("memory.disabled")}):null,e.jsx("span",{className:"text-ter",children:ve(s)})]}),e.jsx("p",{className:"break-words text-sm text-pri leading-snug",children:i?s.body:V(s.body)}),e.jsxs("div",{className:"mt-2 flex flex-wrap gap-1 text-[11px] text-ter",children:[s.tags.map(m=>e.jsx("span",{className:"rounded border px-1.5 py-0.5",style:{borderColor:"var(--border)"},children:m},m)),e.jsx("span",{children:l("memory.updated",{time:k(s.updatedAt,l)})}),e.jsx("span",{children:l("memory.injected",{time:k(s.lastInjectedAt,l)})}),s.procedureRef?e.jsx("span",{children:`${s.procedureRef.type}: ${s.procedureRef.title??s.procedureRef.id}`}):null]})]}),e.jsx("div",{className:"flex shrink-0 items-center gap-1 drawer-card__actions",children:s.status==="active"?e.jsxs(e.Fragment,{children:[e.jsx(j,{label:s.pinned?l("memory.unpinTooltip"):l("memory.pinTooltip"),children:e.jsx("button",{type:"button",disabled:a,onClick:()=>n(s),"aria-label":s.pinned?l("memory.unpinTooltip"):l("memory.pinTooltip"),className:"icon-btn pointer-coarse:min-h-10 pointer-coarse:min-w-10",children:s.pinned?e.jsx(ue,{size:13}):e.jsx(fe,{size:13})})}),e.jsx(j,{label:s.disabled?l("memory.enableTooltip"):l("memory.disableTooltip"),children:e.jsx("button",{type:"button",disabled:a,onClick:()=>p(s),"aria-label":s.disabled?l("memory.enableTooltip"):l("memory.disableTooltip"),className:"icon-btn pointer-coarse:min-h-10 pointer-coarse:min-w-10",children:s.disabled?e.jsx(ie,{size:13}):e.jsx(xe,{size:13})})}),e.jsx(j,{label:l("memory.archiveButton"),children:e.jsx("button",{type:"button",disabled:a,onClick:()=>t(s),"aria-label":l("memory.archiveButton"),className:"icon-btn icon-btn--danger pointer-coarse:min-h-10 pointer-coarse:min-w-10",children:e.jsx(me,{size:13})})})]}):null})]}),i?e.jsxs("div",{className:"drawer-card__expanded",children:[e.jsx("h4",{className:"drawer-section-label",children:l("memory.sources")}),s.sources.length===0?e.jsx("p",{className:"text-ter",children:l("memory.noSources")}):e.jsx("ul",{className:"space-y-2",children:s.sources.map(m=>e.jsxs("li",{className:"break-words",children:[e.jsxs("div",{className:"text-ter",children:[m.sourceType,m.actorNameSnapshot?` · ${m.actorNameSnapshot}`:"",m.actorRoleSnapshot?` · ${m.actorRoleSnapshot}`:""]}),m.excerpt?e.jsx("p",{className:"mt-0.5",children:m.excerpt}):null]},m.id))})]}):null]})},ke=(a,s)=>a.report?[`${a.report.added.length} ${s("memory.reportAdded")}`,`${a.report.rewritten.length} ${s("memory.reportRewritten")}`,`${a.report.archived.length} ${s("memory.reportArchived")}`,`${a.report.merged.length} ${s("memory.reportMerged")}`].join(" · "):a.error?`${s("common.error")} · ${V(a.error,90)}`:s("memory.noReport"),Se=(a,s)=>a.inputSeqFrom===null||a.inputSeqTo===null?s("memory.noInput"):`${s("memory.seq")} ${a.inputSeqFrom}-${a.inputSeqTo}`,$e=({busy:a,onRevert:s,run:t})=>{const[p,n]=d.useState(!1),{t:i}=E();return e.jsxs("li",{className:"drawer-card p-3","data-testid":`dream-run-${t.id}`,"data-dream-status":t.status,children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsxs("button",{type:"button",onClick:()=>n(c=>!c),"aria-expanded":p,className:"min-w-0 flex-1 text-left focus-visible:outline focus-visible:outline-1 focus-visible:outline-offset-2 focus-visible:outline-[var(--accent)]",children:[e.jsxs("div",{className:"mb-1.5 flex flex-wrap items-center gap-2 text-[11px]",children:[e.jsx("span",{className:`drawer-status-badge drawer-status-badge--${t.status}`,children:i(`memory.status.${t.status}`)}),e.jsx("span",{className:"text-ter",children:i(`memory.trigger.${t.trigger}`)}),e.jsx("span",{className:"text-ter",children:Se(t,i)}),e.jsx("span",{className:"text-ter",children:i("memory.started",{time:k(t.startedAt,i)})})]}),e.jsx("p",{className:"break-words text-sm text-pri leading-snug",children:ke(t,i)}),t.finishedAt?e.jsx("p",{className:"mt-1 text-[11px] text-ter",children:i("memory.finished",{time:k(t.finishedAt,i)})}):null]}),t.status==="completed"?e.jsx("div",{className:"drawer-card__actions",children:e.jsx(j,{label:i("memory.revertButton"),children:e.jsx("button",{type:"button",disabled:a,onClick:()=>s(t),"aria-label":i("memory.revertTooltip"),className:"icon-btn icon-btn--danger pointer-coarse:min-h-10 pointer-coarse:min-w-10",children:a?e.jsx(w,{size:13,className:"animate-spin"}):e.jsx(ne,{size:13})})})}):null]}),p&&t.report?e.jsxs("div",{className:"drawer-card__expanded space-y-3",children:[t.report.added.length>0?e.jsxs("div",{className:"dream-diff-block border-l-2 border-l-status-green",children:[e.jsxs("h4",{className:"dream-diff-title dream-diff-added flex items-center gap-1.5 font-semibold",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-status-green"}),i("memory.diff.added")]}),e.jsx("ul",{className:"space-y-1.5 mt-1.5",children:t.report.added.map(c=>e.jsxs("li",{className:"break-words text-[11px] text-pri flex items-start gap-1",children:[e.jsx("span",{className:"text-status-green select-none font-semibold mr-1",children:"+"}),e.jsxs("span",{className:"flex-1",children:[e.jsx("span",{className:`drawer-kind-badge drawer-kind-badge--${c.kind} scale-90 origin-left inline-block mr-1`,children:i(O[c.kind])}),c.body]})]},c.id))})]}):null,t.report.rewritten.length>0?e.jsxs("div",{className:"dream-diff-block border-l-2 border-l-[#f59e0b]",children:[e.jsxs("h4",{className:"dream-diff-title dream-diff-rewritten flex items-center gap-1.5 font-semibold",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-[#f59e0b]"}),i("memory.diff.rewritten")]}),e.jsx("p",{className:"mt-1.5 text-[11px] text-sec leading-relaxed pl-3 break-all",children:t.report.rewritten.map(c=>c.id).join(", ")})]}):null,t.report.archived.length>0?e.jsxs("div",{className:"dream-diff-block border-l-2 border-l-status-red",children:[e.jsxs("h4",{className:"dream-diff-title dream-diff-archived flex items-center gap-1.5 font-semibold",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-status-red"}),i("memory.diff.archived")]}),e.jsx("p",{className:"mt-1.5 text-[11px] text-sec leading-relaxed pl-3 break-all",children:t.report.archived.map(c=>c.id).join(", ")})]}):null,t.report.merged.length>0?e.jsxs("div",{className:"dream-diff-block border-l-2 border-l-purple-500",children:[e.jsxs("h4",{className:"dream-diff-title dream-diff-merged flex items-center gap-1.5 font-semibold",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-purple-500"}),i("memory.diff.merged")]}),e.jsx("p",{className:"mt-1.5 text-[11px] text-sec leading-relaxed pl-3 break-all",children:t.report.merged.map(c=>c.into).join(", ")})]}):null]}):null,p&&t.error?e.jsx("p",{className:"drawer-card__error",children:t.error}):null]})},Me=({open:a,onClose:s,workspaceId:t})=>{const p=G(),{t:n}=E(),[i,c]=d.useState("active"),[l,m]=d.useState(""),[g,S]=d.useState([]),[v,$]=d.useState([]),[A,C]=d.useState(!1),[q,h]=d.useState(null),[H,L]=d.useState(null),[T,N]=d.useState(null),[M,R]=d.useState(null),[_,D]=d.useState(null),b=d.useRef(0),I=d.useMemo(()=>[{id:"active",label:n("memory.tabActive")},{id:"archived",label:n("memory.tabArchived")},{id:"dreams",label:n("memory.tabDreams")}],[n]),u=Ne(i),f=d.useCallback(async()=>{const r=b.current+1;if(b.current=r,!t||!a){S([]),$([]),C(!1);return}C(!0),h(null),S([]),$([]);try{const[o,x]=await Promise.all([u?J(t,{query:l,scope:"all",status:u}):Promise.resolve([]),u?Promise.resolve([]):X(t,{limit:20})]);if(b.current!==r)return;S(o),$(x)}catch(o){b.current===r&&h(o instanceof Error?o.message:String(o))}finally{b.current===r&&C(!1)}},[a,l,u,t]);d.useEffect(()=>{f()},[f]);const z=async(r,o)=>{if(t){L(r.id),h(null);try{await o(t),await f()}catch(x){h(x instanceof Error?x.message:String(x))}finally{L(null)}}},K=d.useMemo(()=>({current:u?g.length:v.length}),[v.length,g.length,u]),Q=async()=>{if(t){N("run-now"),h(null);try{await ae(t),await f()}catch(r){h(r instanceof Error?r.message:String(r))}finally{N(null)}}},U=async r=>{if(t){N(r.id),h(null);try{await le(t,r.id),await f()}catch(o){h(o instanceof Error?o.message:String(o))}finally{N(null)}}};return e.jsxs(e.Fragment,{children:[e.jsx(Y,{open:a,onOpenChange:r=>!r&&s(),children:e.jsxs(Z,{children:[e.jsx(ee,{"data-testid":"memory-overlay",className:"app-overlay fixed inset-0 z-40"}),e.jsx("div",{className:"pointer-events-none fixed inset-0 z-50 grid place-items-center p-4",children:e.jsxs(se,{"data-testid":"memory-drawer","aria-label":n("memory.title"),"data-mobile":p||void 0,className:"dialog-scale-pop elev-2 pointer-events-auto flex flex-col rounded-lg border",style:p?{background:"var(--bg-1)",borderColor:"var(--border-bright)"}:{background:"var(--bg-1)",borderColor:"var(--border-bright)",height:"min(720px, calc(100vh - 48px))",width:"min(780px, calc(100vw - 48px))"},children:[e.jsxs("header",{className:"flex items-center justify-between border-b px-4 py-2",style:{borderColor:"var(--border)"},children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx(te,{className:"text-base font-semibold text-pri",children:n("memory.title")}),e.jsx("p",{className:"text-xs text-ter",children:n("memory.subtitle")})]}),e.jsx(j,{label:n("common.close"),children:e.jsx("button",{type:"button",onClick:s,"aria-label":n("common.close"),className:"icon-btn pointer-coarse:min-h-11 pointer-coarse:min-w-11",children:e.jsx(re,{size:14})})})]}),e.jsxs("div",{className:`flex gap-2 border-b px-4 py-2 ${p?"flex-col items-stretch":"items-center gap-2"}`,style:{borderColor:"var(--border)"},children:[e.jsx("div",{className:"drawer-tabs",style:p?{width:"100%",justifyContent:"flex-start"}:void 0,children:I.map(r=>e.jsx("button",{type:"button",onClick:()=>c(r.id),"aria-pressed":i===r.id,className:`drawer-tab pointer-coarse:min-h-10 ${i===r.id?"drawer-tab--active":""}`,children:r.label},r.id))}),u?e.jsxs("label",{className:"drawer-search",style:p?{width:"100%",maxWidth:"none"}:{marginLeft:"auto"},children:[e.jsx("span",{className:"sr-only",children:n("memory.searchPlaceholder")}),e.jsx(de,{size:14,className:"pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-ter"}),e.jsx("input",{value:l,onChange:r=>m(r.currentTarget.value),placeholder:n("memory.searchPlaceholder"),name:"memory-search",autoComplete:"off",className:"h-8 w-full rounded-md border bg-transparent pl-8 pr-3 text-xs text-pri outline-none transition-colors placeholder:text-ter focus-visible:border-[var(--accent)]",style:{borderColor:"var(--border-bright)"}})]}):null]}),e.jsxs("div",{className:"scroll-y min-h-0 flex-1 px-4 py-3",children:[q?e.jsx("div",{className:"mb-3 rounded-md border px-3 py-2 text-xs",style:{borderColor:"color-mix(in oklab, var(--status-red) 30%, var(--border))",color:"var(--text-error)",background:"color-mix(in oklab, var(--status-red) 8%, transparent)"},children:q}):null,e.jsx("section",{className:"drawer-section",children:e.jsxs("div",{className:"drawer-section__header",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ye,{size:14,className:"text-sec"}),e.jsxs("span",{className:"font-medium text-sec",children:[K.current," ",n(u?"memory.entries":"memory.runs")]})]}),i==="dreams"?e.jsxs("button",{type:"button",onClick:Q,disabled:T!==null,className:"drawer-action-btn pointer-coarse:min-h-10",children:[T==="run-now"?e.jsx(w,{size:14,className:"animate-spin"}):e.jsx(P,{size:14}),n("memory.runNow")]}):null]})}),i==="dreams"?A?e.jsxs("div",{className:"flex h-[320px] items-center justify-center text-ter",children:[e.jsx(w,{size:18,className:"animate-spin"}),e.jsx("span",{className:"ml-2 text-sm",children:n("common.loading")})]}):v.length===0?e.jsx("div",{className:"flex h-[320px] items-center justify-center",children:e.jsx(B,{icon:e.jsx(P,{size:20}),title:n("memory.emptyDreams"),description:n("memory.emptyDreamsDesc")})}):e.jsx("ul",{className:"space-y-2",children:v.map(r=>e.jsx($e,{run:r,busy:T===r.id,onRevert:D},r.id))}):A?e.jsxs("div",{className:"flex h-[320px] items-center justify-center text-ter",children:[e.jsx(w,{size:18,className:"animate-spin"}),e.jsx("span",{className:"ml-2 text-sm",children:n("common.loading")})]}):g.length===0?e.jsx("div",{className:"flex h-[320px] items-center justify-center",children:e.jsx(B,{title:n("memory.emptyActive"),description:n("memory.emptyActiveDesc")})}):e.jsx("ul",{className:"space-y-2",children:g.map(r=>e.jsx(we,{memory:r,busy:H===r.id,onArchive:R,onToggleDisabled:o=>z(o,x=>F(x,o.id,{disabled:!o.disabled})),onTogglePinned:o=>z(o,x=>F(x,o.id,{pinned:!o.pinned}))},r.id))})]})]})})]})}),e.jsx(W,{open:M!==null,onOpenChange:r=>{r||R(null)},title:n("memory.archiveTitle"),description:n("memory.archiveDesc"),confirmLabel:n("memory.archiveButton"),confirmKind:"danger",onConfirm:()=>{if(!M)return;const r=M;R(null),z(r,o=>oe(o,r.id))}}),e.jsx(W,{open:_!==null,onOpenChange:r=>{r||D(null)},title:n("memory.revertTitle"),description:n("memory.revertDesc"),confirmLabel:n("memory.revertButton"),confirmKind:"danger",onConfirm:()=>{if(!_)return;const r=_;D(null),U(r)}})]})};export{Me as WorkspaceMemoryDrawer};
@@ -1 +1 @@
1
- import{r as k,j as h,Y as e}from"./index-BTPjdp2B.js";import{TaskGraphDrawer as g}from"./TaskGraphDrawer-BUCR4zPH.js";const u=({tasksFile:a,workspacePath:T,open:c,onClose:r,workers:n,onSelectOwner:p,connectionStale:d})=>{const s=k.useMemo(()=>n?.length?n.map(o=>o.name):void 0,[n]);return h.jsx(g,{content:a.content,hasConflict:a.hasConflict,onClose:r,onContentChange:a.onChange,onKeepLocal:a.onKeepLocal,onReload:a.onReload,onSave:a.onSave,onToggleTaskLine:o=>{a.toggleTaskAtLine(o).catch(e("tasks.toggleTaskAtLine"))},onAppendTask:o=>{a.appendTask(o).catch(e("tasks.appendTask"))},onAppendSubtask:(o,t)=>{a.appendSubtask(o,t).catch(e("tasks.appendSubtask"))},onUpdateTaskText:(o,t)=>{a.updateTaskText(o,t).catch(e("tasks.updateTaskText"))},onDeleteTask:o=>{a.deleteTask(o).catch(e("tasks.deleteTask"))},open:c,workspacePath:T,...s?{knownWorkerNames:s}:{},...p?{onSelectOwner:p}:{},...d!==void 0?{connectionStale:d}:{}})};export{u as WorkspaceTaskDrawer};
1
+ import{r as k,j as h,Y as e}from"./index-DoOf8jsj.js";import{TaskGraphDrawer as g}from"./TaskGraphDrawer-DRVJ4Z7z.js";const u=({tasksFile:a,workspacePath:T,open:c,onClose:r,workers:n,onSelectOwner:p,connectionStale:d})=>{const s=k.useMemo(()=>n?.length?n.map(o=>o.name):void 0,[n]);return h.jsx(g,{content:a.content,hasConflict:a.hasConflict,onClose:r,onContentChange:a.onChange,onKeepLocal:a.onKeepLocal,onReload:a.onReload,onSave:a.onSave,onToggleTaskLine:o=>{a.toggleTaskAtLine(o).catch(e("tasks.toggleTaskAtLine"))},onAppendTask:o=>{a.appendTask(o).catch(e("tasks.appendTask"))},onAppendSubtask:(o,t)=>{a.appendSubtask(o,t).catch(e("tasks.appendSubtask"))},onUpdateTaskText:(o,t)=>{a.updateTaskText(o,t).catch(e("tasks.updateTaskText"))},onDeleteTask:o=>{a.deleteTask(o).catch(e("tasks.deleteTask"))},open:c,workspacePath:T,...s?{knownWorkerNames:s}:{},...p?{onSelectOwner:p}:{},...d!==void 0?{connectionStale:d}:{}})};export{u as WorkspaceTaskDrawer};