@axiom-lattice/gateway 4.2.5 → 4.3.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 (28) hide show
  1. package/dist/embed/agent-chat-loader.js +1 -1
  2. package/dist/embed/{embed-page-AgentDetailSideApp-YPN3NDEA.js → embed-page-AgentDetailSideApp-ONXG4B3D.js} +1 -1
  3. package/dist/embed/{embed-page-AgentGovernanceWorkbench-FAZQNPAM.js → embed-page-AgentGovernanceWorkbench-LCIQ5UF3.js} +1 -1
  4. package/dist/embed/{embed-page-MessageGraph-CEOPX4GM.js → embed-page-MessageGraph-P7DBTZCL.js} +1 -1
  5. package/dist/embed/{embed-page-ReactChart-NZAYQOQH.js → embed-page-ReactChart-XS7D26VP.js} +1 -1
  6. package/dist/embed/{embed-page-SkillFlow-TPESM4DI.js → embed-page-SkillFlow-HPH37PZH.js} +1 -1
  7. package/dist/embed/{embed-page-TasksSideApp-3EAPMISU.js → embed-page-TasksSideApp-MQTUCJO4.js} +1 -1
  8. package/dist/embed/{embed-page-TeamWorkspace-HB7ER45L.js → embed-page-TeamWorkspace-7T2HRXLG.js} +1 -1
  9. package/dist/embed/{embed-page-TopologyRuntimeView-O7JPR22B.js → embed-page-TopologyRuntimeView-PU2D7VZ7.js} +1 -1
  10. package/dist/embed/{embed-page-WorkflowAutomationView-OUXOBHXC.js → embed-page-WorkflowAutomationView-ST76M33F.js} +1 -1
  11. package/dist/embed/{embed-page-chunk-ZTRCHYWV.js → embed-page-chunk-4ZSGPIBZ.js} +1 -1
  12. package/dist/embed/{embed-page-chunk-4SKSUBXL.js → embed-page-chunk-BRETUPSG.js} +110 -109
  13. package/dist/embed/{embed-page-chunk-U6JBLAYD.js → embed-page-chunk-LE6OFJ7R.js} +1 -1
  14. package/dist/embed/{embed-page-chunk-KFUAWYJ7.js → embed-page-chunk-T25T2YE6.js} +1 -1
  15. package/dist/embed/{embed-page-chunk-ILNGM4RN.js → embed-page-chunk-U6SL5TG6.js} +89 -38
  16. package/dist/embed/embed-page-chunk-VRV57DFE.js +466 -0
  17. package/dist/embed/embed-page-chunk-YPV4BAWI.js +245 -0
  18. package/dist/embed/{embed-page-chunk-6C2UZV63.js → embed-page-chunk-Z4S4OYA4.js} +1 -1
  19. package/dist/embed/{embed-page-chunk-TQPMRDLI.js → embed-page-chunk-ZKJ7Z7P3.js} +1 -1
  20. package/dist/embed/{embed-page-chunk-RTVQJYET.js → embed-page-chunk-ZXFZANZM.js} +1 -1
  21. package/dist/embed/embed-page.js +3 -3
  22. package/dist/index.js +140 -146
  23. package/dist/index.js.map +1 -1
  24. package/dist/index.mjs +18 -24
  25. package/dist/index.mjs.map +1 -1
  26. package/package.json +7 -7
  27. package/dist/embed/embed-page-chunk-5XKUKLZQ.js +0 -467
  28. package/dist/embed/embed-page-chunk-GCDGRO6A.js +0 -245
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axiom-lattice/gateway",
3
- "version": "4.2.5",
3
+ "version": "4.3.1",
4
4
  "main": "dist/index.js",
5
5
  "files": [
6
6
  "dist"
@@ -48,11 +48,11 @@
48
48
  "uuid": "^9.0.1",
49
49
  "web-push": "^3.6.7",
50
50
  "zod": "3.25.76",
51
- "@axiom-lattice/cli-a2a": "0.2.9",
52
- "@axiom-lattice/core": "4.2.13",
53
- "@axiom-lattice/pg-stores": "3.1.13",
54
- "@axiom-lattice/protocols": "4.2.3",
55
- "@axiom-lattice/queue-redis": "1.1.9"
51
+ "@axiom-lattice/cli-a2a": "0.2.10",
52
+ "@axiom-lattice/core": "4.2.15",
53
+ "@axiom-lattice/pg-stores": "3.1.15",
54
+ "@axiom-lattice/protocols": "4.3.0",
55
+ "@axiom-lattice/queue-redis": "1.1.10"
56
56
  },
57
57
  "devDependencies": {
58
58
  "@types/bcrypt": "^6.0.0",
@@ -74,7 +74,7 @@
74
74
  "tsconfig-paths": "^4.2.0",
75
75
  "tsup": "^8.5.0",
76
76
  "typescript": "^5.8.2",
77
- "@axiom-lattice/react-sdk": "4.1.5"
77
+ "@axiom-lattice/react-sdk": "4.2.1"
78
78
  },
79
79
  "scripts": {
80
80
  "build": "tsup src/index.ts --format cjs,esm --dts --clean --sourcemap && pnpm copy:embed-assets",
@@ -1,467 +0,0 @@
1
- import{D as Oe,Ha as _,Pa as Me,Q as Be,Va as j,da as W,e as Se,g as De,ha as je,p as ue,qa as me,s as _e,t as ee,w as $e,z as Pe}from"./embed-page-chunk-4SKSUBXL.js";import{a as D}from"./embed-page-chunk-MB65DZAX.js";import{W as Ae,Z as ce,pa as Ce,va as pe}from"./embed-page-chunk-O4QK5LWZ.js";import{a as Z}from"./embed-page-chunk-4BKXE5ON.js";import{e as k}from"./embed-page-chunk-6Y3UYJ6Z.js";var ie=k(Z());var I=k(Z());var V=k(Z());var U={HUMAN:"human",AI:"ai",TOOL:"tool",INTERRUPT:"interrupt",ERROR:"error",MESSAGE_COMPLETED:"message_completed",MESSAGE_FAILED:"message_failed",THREAD_IDLE:"thread_idle"};var vt="^execution-result:[A-Za-z0-9._:-]+$",Gt=new RegExp(vt);var xt="## Belief State";var fe=["Belief Key","Probability","Target","Basis"],It=/^[a-z0-9]+(?:-[a-z0-9]+)*$/,Tt=/^(?:100|[0-9]{1,2})%$/;function Ge(e){let t=[],n=0,a;for(;n<=e.length;){let o=e.indexOf(`
2
- `,n),p=o===-1?e.length:o+1,g=o===-1?e.length:o,d=e.slice(n,g),c=d.endsWith("\r")?d.slice(0,-1):d,m=c.match(/^ {0,3}(`{3,}|~{3,})/),y=a!==void 0;if(!a&&m?a={marker:m[1][0],length:m[1].length}:a&&new RegExp(`^ {0,3}\\${a.marker}{${a.length},}[ \\t]*$`).test(c)&&(a=void 0),t.push({text:c,start:n,end:p,fenced:y||m!==null,lineNumber:t.length+1}),o===-1)break;n=p}return t}function wt(e,t){let n=Ge(e),a=[];for(let o=0;o<n.length;o+=1){let p=n[o];if(p.fenced||p.text.trimEnd().replace(/^ {0,3}/,"")!==t)continue;let g=e.length;for(let d=o+1;d<n.length;d+=1)if(!n[d].fenced&&/^ {0,3}#{1,2}(?:[ \t]+|$)/.test(n[d].text)){g=n[d].start;break}a.push({headingLine:o,start:p.start,end:g})}return a}function ge(e){let t=e.trim(),n=t.length-1;if(!t.startsWith("|")||!t.endsWith("|")||Fe(t,n))return;let a=[],o="";for(let p=1;p<t.length-1;p+=1){let g=t[p];g==="|"&&Fe(t,p)?o+=g:g==="|"?(a.push(Le(o.trim())),o=""):o+=g}return a.push(Le(o.trim())),a}function Le(e){let t="";for(let n=0;n<e.length;n+=1)e[n]==="\\"&&(e[n+1]==="\\"||e[n+1]==="|")&&(n+=1),t+=e[n];return t}function Fe(e,t){let n=0;for(let a=t-1;a>=0&&e[a]==="\\";a-=1)n+=1;return n%2===1}function F(e,t,n={}){return{success:!1,code:e,message:t,...n}}function ye(e){let t=wt(e,xt);if(t.length===0)return F("MISSING_BELIEF_STATE","Markdown does not contain a Belief State section.");if(t.length>1)return F("DUPLICATE_BELIEF_STATE","Markdown contains more than one Belief State section.");let n=Ge(e),a=t[0],o=n.slice(a.headingLine+1).filter(m=>m.start<a.end&&m.text.trim()!==""),p=o[0]&&ge(o[0].text),g=o[1]&&ge(o[1].text);if(!p||p.length!==fe.length||p.some((m,y)=>m!==fe[y])||!g||g.length!==fe.length||g.some(m=>!/^:?-{3,}:?$/.test(m)))return F("INVALID_BELIEF_HEADERS","Belief State must use the canonical four-column headers.");let d=[],c=new Set;for(let m of o.slice(2)){let y=ge(m.text);if(!y||y.length!==4||y[3].length===0)return F("MALFORMED_BELIEF_ROW","Belief State contains a malformed row.",{line:m.lineNumber});let h=y[0].match(/^`([^`]+)`$/);if(!h||!It.test(h[1]))return F("INVALID_BELIEF_KEY","Belief keys must be backtick-wrapped kebab-case.",{line:m.lineNumber});let f=h[1];if(c.has(f))return F("DUPLICATE_BELIEF_KEY",`Belief key '${f}' appears more than once.`,{line:m.lineNumber,key:f});for(let[E,N]of[[1,"probability"],[2,"target"]])if(!Tt.test(y[E]))return F("INVALID_BELIEF_PERCENT",`Belief ${N} must be an integer from 0% to 100%.`,{line:m.lineNumber,column:N});c.add(f),d.push({key:f,probability:Number.parseInt(y[1],10),target:Number.parseInt(y[2],10),basis:y[3]})}return{success:!0,state:{entries:d}}}var Nt=2e3,kt=12,Et=100;function Rt(e){if(!At(e,["type","widget"])||e.type!=="widget"||!Ke(e.widget))return;let t=e.widget;if(t.kind==="callout")return!ze(t,["kind","text"],["title","tone"])||!H(t.text)||t.title!==void 0&&!H(t.title)||t.tone!==void 0&&t.tone!=="info"&&t.tone!=="success"&&t.tone!=="warning"?void 0:{type:"widget",widget:{kind:"callout",text:t.text,...typeof t.title=="string"?{title:t.title}:{},...t.tone?{tone:t.tone}:{}}};if(t.kind==="table"){if(!ze(t,["kind","columns","rows"],["caption"])||!Array.isArray(t.columns)||!Array.isArray(t.rows))return;let n=t.columns,a=t.rows;return n.length===0||n.length>kt||!n.every(H)||a.length>Et||!a.every(o=>Array.isArray(o)&&o.length===n.length&&o.every(H))||t.caption!==void 0&&!H(t.caption)?void 0:{type:"widget",widget:{kind:"table",columns:[...n],rows:a.map(o=>[...o]),...typeof t.caption=="string"?{caption:t.caption}:{}}}}}function H(e){return typeof e=="string"&&e.length<=Nt}function Ke(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function At(e,t){return Ke(e)&&Object.keys(e).length===t.length&&t.every(n=>n in e)}function ze(e,t,n){let a=Object.keys(e);return t.every(o=>o in e)&&a.every(o=>t.includes(o)||n.includes(o))}function Kt(e={}){return{startedToolIds:new Set,allowInterrupts:e.allowInterrupts??!0,allowGenUI:e.allowGenUI??!1}}function Wt(e,t){if(e.type===U.AI){let n=[],a=t?.startedToolIds??new Set;if(typeof e.data.content=="string"&&e.data.content&&n.push({type:"message.delta",text:e.data.content}),t?.allowGenUI&&Array.isArray(e.data.content))for(let o of e.data.content){let p=Rt(o);p&&n.push({type:"genui.render",block:p})}for(let o of e.data.tool_call_chunks??[])o.id&&o.name&&!a.has(o.id)&&(a.add(o.id),n.push({type:"tool.started",id:o.id,name:o.name}));for(let o of e.data.tool_calls??[])a.has(o.id)||(a.add(o.id),n.push({type:"tool.started",id:o.id,name:o.name}));return n}if(e.type===U.TOOL&&e.data.tool_call_id)return[{type:"tool.completed",id:e.data.tool_call_id}];if(e.type===U.INTERRUPT){if(t&&!t.allowInterrupts)return[{type:"stream.completed"}];let n=Ct(e);return n?[{type:"interrupt.created",interrupt:n},{type:"stream.completed"}]:[{type:"stream.completed"}]}if(e.type===U.MESSAGE_COMPLETED)return[{type:"message.completed",messageId:e.data.id},{type:"stream.completed"}];if(e.type===U.ERROR){let n=typeof e.data.code=="string"?e.data.code:"stream_error";return n==="aborted"||n==="superseded"?[{type:"stream.completed"}]:[{type:"error",error:{code:"STREAM_FAILED",message:typeof e.data.content=="string"&&e.data.content?e.data.content:"Stream failed",retryable:!1}},{type:"stream.completed"}]}return e.type===U.MESSAGE_FAILED?[{type:"error",error:{code:"STREAM_FAILED",message:"Stream failed",retryable:!0}},{type:"stream.completed"}]:[]}function Ct(e){let t=St(e.data.content);if(!t)return;let n=e.id,a=typeof n=="string"?n:e.data.id;if(a)return{id:a,type:typeof t.type=="string"?t.type:"input",prompt:typeof t.prompt=="string"?t.prompt:typeof t.message=="string"?t.message:"Input required",...he(t.data)?{data:t.data}:{}}}function St(e){if(!e)return{};if(he(e))return e;if(typeof e=="string")try{let t=JSON.parse(e);return he(t)?t:{prompt:e}}catch{return{prompt:e}}}function he(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var T=k(D());function We(e){if(!e||!ye(e).success)return e??"";let t=e.split(`
3
- `),n,a=t.map(d=>{let c=d.match(/^ {0,3}(`{3,}|~{3,})/),m=n!==void 0;return!n&&c?n={marker:c[1][0],length:c[1].length}:n&&new RegExp(`^ {0,3}\\${n.marker}{${n.length},}[ \\t]*$`).test(d)&&(n=void 0),m||c!==null}),o=t.findIndex((d,c)=>!a[c]&&/^ {0,3}##\s+Belief State\s*$/i.test(d.trimEnd()));if(o<0)return e;let p=t.slice(o+1).findIndex((d,c)=>!a[o+1+c]&&/^ {0,3}#{1,2}(?:[ \t]+|$)/.test(d)),g=p<0?t.length:o+1+p;return[...t.slice(0,o),...t.slice(g)].join(`
4
- `).replace(/\n{3,}/g,`
5
-
6
- `).trim()}var Dt=_(({token:e,css:t})=>({block:t`
7
- display: flex;
8
- flex-direction: column;
9
- gap: 8px;
10
- `,label:t`
11
- margin: 0;
12
- font-size: 13px;
13
- font-weight: 600;
14
- color: ${e.colorTextSecondary};
15
- `,table:t`
16
- width: 100%;
17
- border-collapse: collapse;
18
- font-size: 13px;
19
- line-height: 1.5;
20
- `,th:t`
21
- text-align: left;
22
- font-weight: 600;
23
- color: ${e.colorTextTertiary};
24
- padding: 4px 8px;
25
- border-bottom: 1px solid ${e.colorBorderSecondary};
26
- `,td:t`
27
- padding: 4px 8px;
28
- border-bottom: 1px solid ${e.colorBorderSecondary};
29
- color: ${e.colorText};
30
- vertical-align: top;
31
- `,keyCell:t`
32
- font-family: ${e.fontFamilyCode};
33
- `,basisCell:t`
34
- color: ${e.colorTextSecondary};
35
- `})),Ue=({description:e})=>{let{styles:t}=Dt(),n=(0,V.useMemo)(()=>ye(e??""),[e]),a=(0,V.useRef)(!1);return(0,V.useEffect)(()=>{!n.success&&!a.current&&(a.current=!0,console.warn(`[TaskBeliefState] ${n.code}: ${n.message}`))},[n]),n.success?(0,T.jsxs)("div",{"data-testid":"belief-state",className:t.block,children:[(0,T.jsx)("div",{className:t.label,children:"Belief State (Last reconciled snapshot)"}),(0,T.jsxs)("table",{className:t.table,children:[(0,T.jsx)("thead",{children:(0,T.jsxs)("tr",{children:[(0,T.jsx)("th",{className:t.th,children:"Key"}),(0,T.jsx)("th",{className:t.th,style:{textAlign:"right"},children:"Probability"}),(0,T.jsx)("th",{className:t.th,style:{textAlign:"right"},children:"Target"}),(0,T.jsx)("th",{className:t.th,children:"Basis"})]})}),(0,T.jsx)("tbody",{children:n.state.entries.map(o=>(0,T.jsxs)("tr",{children:[(0,T.jsx)("td",{className:`${t.td} ${t.keyCell}`,children:o.key}),(0,T.jsxs)("td",{className:t.td,style:{textAlign:"right"},children:[o.probability,"%"]}),(0,T.jsxs)("td",{className:t.td,style:{textAlign:"right"},children:[o.target,"%"]}),(0,T.jsx)("td",{className:`${t.td} ${t.basisCell}`,children:o.basis})]},o.key))})]})]}):null};var x=k(D()),_t=_(({token:e,css:t})=>({root:t`
36
- display: flex;
37
- flex-direction: column;
38
- gap: 6px;
39
- margin-top: 6px;
40
- padding-left: 2px;
41
- `,markdown:t`
42
- font-size: 13px;
43
- color: ${e.colorText};
44
- `,resultLabel:t`
45
- font-size: 12px;
46
- font-weight: 600;
47
- color: ${e.colorTextSecondary};
48
- `,impactList:t`
49
- display: flex;
50
- flex-direction: column;
51
- gap: 4px;
52
- `,impactRow:t`
53
- display: inline-flex;
54
- align-items: center;
55
- gap: 6px;
56
- font-size: 12px;
57
- color: ${e.colorText};
58
- background: ${e.colorFillTertiary};
59
- border-radius: 6px;
60
- padding: 3px 8px;
61
- align-self: flex-start;
62
- `,impactKey:t`
63
- font-weight: 600;
64
- color: ${e.colorInfo};
65
- `,impactBasis:t`
66
- color: ${e.colorTextTertiary};
67
- `,viewChat:t`
68
- display: inline-flex;
69
- align-items: center;
70
- gap: 4px;
71
- font-size: 12px;
72
- color: ${e.colorInfo};
73
- cursor: pointer;
74
- appearance: none;
75
- background: transparent;
76
- border: 0;
77
- font-family: inherit;
78
- margin: 0;
79
- min-height: 24px;
80
- padding: 2px 4px;
81
- align-self: flex-start;
82
- &:hover {
83
- text-decoration: underline;
84
- }
85
- &:active {
86
- opacity: 0.75;
87
- }
88
- &:focus-visible {
89
- outline: 2px solid ${e.colorPrimaryBorder};
90
- outline-offset: 2px;
91
- border-radius: 4px;
92
- }
93
- `})),be=({item:e,viewChat:t})=>{let{styles:n}=_t(),a=typeof e.detail?.markdown=="string"&&e.detail.markdown.length>0?e.detail.markdown:void 0,o=typeof e.detail?.result=="string"&&e.detail.result.length>0?e.detail.result:void 0,p=e.detail?.beliefImpact,g=(Array.isArray(p)?p:[]).filter(c=>typeof c=="object"&&c!==null).map(c=>({key:typeof c.key=="string"?c.key:"",after:typeof c.after=="number"?c.after:Number.NaN,basis:typeof c.basis=="string"?c.basis:""})).filter(c=>c.key.length>0),d=!!(e.threadId&&t);return!a&&!o&&g.length===0&&!d?null:(0,x.jsxs)("div",{className:n.root,"data-testid":"task-activity-detail",children:[a&&(0,x.jsx)("div",{className:n.markdown,children:(0,x.jsx)(j,{content:a})}),o&&(0,x.jsxs)("div",{className:n.markdown,children:[(0,x.jsx)("div",{className:n.resultLabel,children:"Result"}),(0,x.jsx)(j,{content:o})]}),g.length>0&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)("div",{className:n.resultLabel,children:"Belief Impact"}),(0,x.jsx)("div",{className:n.impactList,children:g.map((c,m)=>(0,x.jsxs)("span",{className:n.impactRow,children:[(0,x.jsxs)("span",{className:n.impactKey,children:[c.key,":"]}),(0,x.jsxs)("span",{children:["reported ",Number.isFinite(c.after)?`${c.after}%`:"n/a"]}),c.basis&&(0,x.jsxs)("span",{className:n.impactBasis,children:["\u2014 ",c.basis]})]},`${c.key}-${m}`))})]}),d&&(0,x.jsxs)("button",{type:"button",className:n.viewChat,onClick:t,children:[(0,x.jsx)(W,{size:12}),"View Chat"]})]})};var l=k(D()),Ve=_(({token:e,css:t})=>({workbench:t`
94
- min-width: 0;
95
- max-width: 100%;
96
- color: ${e.colorText};
97
- container-name: task-detail-workbench;
98
- container-type: inline-size;
99
- `,command:t`
100
- display: flex;
101
- align-items: center;
102
- gap: 12px;
103
- margin-bottom: 18px;
104
- min-width: 0;
105
- `,commandMain:t`
106
- flex: 1 1 auto;
107
- min-width: 0;
108
- `,parentPath:t`
109
- appearance: none;
110
- display: inline-flex;
111
- align-items: center;
112
- min-height: 32px;
113
- margin-bottom: 4px;
114
- padding: 0 4px;
115
- border: 0;
116
- border-radius: 6px;
117
- background: transparent;
118
- color: ${e.colorTextTertiary};
119
- font: inherit;
120
- font-size: 12px;
121
- cursor: default;
122
- &:focus-visible {
123
- outline: 2px solid ${e.colorPrimaryBorder};
124
- outline-offset: 2px;
125
- }
126
- `,parentAction:t`
127
- cursor: pointer;
128
- &:hover { color: ${e.colorPrimary}; }
129
- `,title:t`
130
- margin: 0;
131
- color: ${e.colorText};
132
- font-size: 22px;
133
- font-weight: 650;
134
- line-height: 1.25;
135
- overflow-wrap: anywhere;
136
- &:focus-visible {
137
- outline: 2px solid ${e.colorPrimaryBorder};
138
- outline-offset: 3px;
139
- border-radius: 4px;
140
- }
141
- `,commandMeta:t`
142
- display: flex;
143
- flex-wrap: wrap;
144
- gap: 10px;
145
- margin-top: 6px;
146
- color: ${e.colorTextSecondary};
147
- font-size: 12px;
148
- `,commandActions:t`
149
- display: flex;
150
- align-items: center;
151
- gap: 8px;
152
- flex: 0 0 auto;
153
- `,backButton:t`
154
- appearance: none;
155
- display: inline-flex;
156
- align-items: center;
157
- justify-content: center;
158
- width: 32px;
159
- height: 32px;
160
- padding: 0;
161
- border: 1px solid ${e.colorBorderSecondary};
162
- border-radius: ${e.borderRadius}px;
163
- background: ${e.colorBgContainer};
164
- color: ${e.colorTextSecondary};
165
- cursor: pointer;
166
- flex: 0 0 auto;
167
- &:hover {
168
- color: ${e.colorText};
169
- border-color: ${e.colorBorder};
170
- background: ${e.colorBgTextHover};
171
- }
172
- &:focus-visible {
173
- outline: 2px solid ${e.colorPrimary};
174
- outline-offset: 2px;
175
- }
176
- `,commandAction:t`
177
- min-height: 32px;
178
- white-space: normal;
179
- `,factStrip:t`
180
- display: grid;
181
- grid-template-columns: repeat(3, minmax(0, 1fr));
182
- gap: 12px;
183
- margin-bottom: 16px;
184
- @container task-detail-workbench (min-width: 640px) and (max-width: ${899}px) {
185
- grid-template-columns: repeat(2, minmax(0, 1fr));
186
- > :first-child { grid-column: 1 / -1; }
187
- }
188
- @container task-detail-workbench (max-width: 639px) {
189
- grid-template-columns: minmax(0, 1fr);
190
- }
191
- `,factCard:t`
192
- min-width: 0;
193
- padding: 14px 16px;
194
- border: 1px solid ${e.colorBorderSecondary};
195
- border-radius: 14px;
196
- background: ${e.colorBgContainer};
197
- &:first-child { border-top: 2px solid ${e.colorPrimary}; }
198
- `,heading:t`
199
- margin: 0 0 10px;
200
- color: ${e.colorTextSecondary};
201
- font-size: 12px;
202
- font-weight: 700;
203
- letter-spacing: 0.04em;
204
- text-transform: uppercase;
205
- `,facts:t`
206
- display: grid;
207
- grid-template-columns: minmax(0, 1fr) auto;
208
- gap: 7px 12px;
209
- margin: 0;
210
- font-size: 12px;
211
- dt { color: ${e.colorTextTertiary}; }
212
- dd {
213
- min-width: 0;
214
- margin: 0;
215
- color: ${e.colorText};
216
- font-weight: 650;
217
- text-align: right;
218
- overflow-wrap: anywhere;
219
- }
220
- `,overdue:t`
221
- color: ${e.colorError};
222
- font-weight: 700;
223
- `,grid:t`
224
- display: grid;
225
- grid-template-columns: 2fr 1fr;
226
- gap: 16px;
227
- align-items: start;
228
- @container task-detail-workbench (max-width: ${899}px) {
229
- grid-template-columns: minmax(0, 1fr);
230
- }
231
- `,card:t`
232
- min-width: 0;
233
- padding: 18px;
234
- border: 1px solid ${e.colorBorderSecondary};
235
- border-radius: 16px;
236
- background: ${e.colorBgContainer};
237
- `,contextCard:t`
238
- @container task-detail-workbench (min-width: 640px) and (max-width: ${899}px) {
239
- padding: 14px 18px;
240
- }
241
- `,contextContent:t`
242
- min-width: 0;
243
- @container task-detail-workbench (min-width: 640px) and (max-width: ${899}px) {
244
- > * {
245
- display: grid;
246
- grid-template-columns: repeat(2, minmax(0, 1fr));
247
- column-gap: 24px;
248
- }
249
- }
250
- `,activity:t`
251
- grid-column: 1 / -1;
252
- `,commandResponsive:t`
253
- @container task-detail-workbench (max-width: 639px) {
254
- flex-wrap: wrap;
255
- align-items: flex-start;
256
- .ant-btn { min-height: 32px; }
257
- }
258
- `,actionsResponsive:t`
259
- @container task-detail-workbench (max-width: 639px) {
260
- width: 100%;
261
- > * { min-height: 32px; }
262
- }
263
- `}));function ve(e){return new Date(e).toLocaleString("en-US",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}function $t(e){let t=e instanceof Date?e:new Date(e),n=Date.now()-t.getTime();return n<60*1e3?"just now":n<3600*1e3?`${Math.floor(n/(60*1e3))}m ago`:n<1440*60*1e3?`${Math.floor(n/(3600*1e3))}h ago`:n<10080*60*1e3?`${Math.floor(n/(1440*60*1e3))}d ago`:t.toLocaleDateString("en-US",{year:"numeric",month:"2-digit",day:"2-digit"})}function Pt(e){let t=Object.entries(e).filter(n=>n[1]);return t.length===0?"None":t.map(([n,a])=>`${n.replaceAll("_"," ")} ${a}`).join(" \xB7 ")}var w=({label:e,children:t})=>(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("dt",{children:e}),(0,l.jsx)("dd",{children:t})]}),q=({name:e,children:t,className:n,showHeading:a=!0})=>{let{styles:o}=Ve();return(0,l.jsxs)("section",{role:"region","aria-label":e,className:`${o.card} ${n??""}`,children:[a&&(0,l.jsx)("h3",{className:o.heading,children:e}),t]})},He=({task:e,facts:t,parent:n,canGoBack:a=!1,onBack:o,onParentClick:p,headingRef:g,statusControl:d,priorityControl:c,regions:m,threadId:y,onViewChat:h})=>{let{styles:f}=Ve(),E=e.ownerType==="agent"?`@${e.ownerId}`:e.ownerId,N=t.execution.dependencies;return(0,l.jsxs)("div",{className:f.workbench,"data-testid":"task-detail-workbench",children:[(0,l.jsxs)("header",{"aria-label":"Task command",className:`${f.command} ${f.commandResponsive}`,children:[a&&o&&(0,l.jsx)("button",{type:"button",className:f.backButton,"data-testid":"task-detail-back",onClick:o,"aria-label":"Back",children:(0,l.jsx)(Se,{size:16})}),(0,l.jsxs)("div",{className:f.commandMain,children:[n&&(p?(0,l.jsxs)("button",{type:"button",className:`${f.parentPath} ${f.parentAction}`,"data-testid":"parent-row","aria-label":`Parent: ${n.title}`,onClick:()=>p(n),children:[n.title," /"]}):(0,l.jsxs)("div",{className:f.parentPath,"data-testid":"parent-row",children:[n.title," /"]})),(0,l.jsx)("h2",{ref:g,className:f.title,tabIndex:g?-1:void 0,"data-testid":"task-detail-heading",children:e.title}),(0,l.jsxs)("div",{className:f.commandMeta,children:[(0,l.jsx)("span",{children:E}),(0,l.jsx)("span",{children:"Updated"}),(0,l.jsx)("span",{title:ve(e.updatedAt),children:$t(e.updatedAt)})]})]}),(0,l.jsx)("div",{className:`${f.commandActions} ${f.actionsResponsive}`,children:y&&h&&(0,l.jsx)(Ae,{className:`${f.commandAction} task-detail-compact-action`,"data-testid":"thread-row","aria-label":"View agent work",icon:(0,l.jsx)(W,{size:14}),onClick:()=>h(y),children:"View agent work"})})]}),(0,l.jsxs)("div",{className:f.factStrip,children:[(0,l.jsxs)("section",{role:"region","aria-label":"State",className:f.factCard,children:[(0,l.jsx)("h3",{className:f.heading,children:"State"}),(0,l.jsxs)("dl",{className:f.facts,children:[(0,l.jsx)(w,{label:"Status",children:d}),(0,l.jsx)(w,{label:"Priority",children:c}),(0,l.jsx)(w,{label:"Due",children:t.state.dueDate?(0,l.jsxs)(l.Fragment,{children:[ve(t.state.dueDate),t.state.overdue&&(0,l.jsx)("span",{className:f.overdue,"data-testid":"overdue-marker",children:" \xB7 Overdue"})]}):"Not set"}),(0,l.jsx)(w,{label:"Review policy",children:t.state.requiresReview?"Yes":"No"}),(0,l.jsx)(w,{label:"Waiting approval",children:t.state.awaitingReview?"Yes":"No"}),(0,l.jsx)(w,{label:"Failure reason recorded",children:t.state.hasFailureReason?"Yes":"No"})]})]}),(0,l.jsxs)("section",{role:"region","aria-label":"Execution",className:f.factCard,children:[(0,l.jsx)("h3",{className:f.heading,children:"Execution"}),(0,l.jsxs)("dl",{className:f.facts,children:[(0,l.jsxs)(w,{label:"Subtasks",children:[t.execution.subtasks.completed," / ",t.execution.subtasks.total]}),(0,l.jsx)(w,{label:"Status distribution",children:Pt(t.execution.subtasks.byStatus)}),(0,l.jsx)(w,{label:"Dependencies",children:N.total===0?"None":`${N.completed} completed / ${N.known} known / ${N.unavailable} unavailable`}),(0,l.jsx)(w,{label:"Latest activity",children:t.execution.latestActivityAt?ve(t.execution.latestActivityAt):"None"}),(0,l.jsx)(w,{label:"Maximum attempt",children:t.execution.maxAttempt??"None"})]})]}),(0,l.jsxs)("section",{role:"region","aria-label":"Output",className:f.factCard,children:[(0,l.jsx)("h3",{className:f.heading,children:"Output"}),(0,l.jsxs)("dl",{className:f.facts,children:[(0,l.jsx)(w,{label:"Result recorded",children:t.output.hasResult?"Yes":"No"}),(0,l.jsx)(w,{label:"Failure recorded",children:t.output.hasFailureReason?"Yes":"No"}),(0,l.jsx)(w,{label:"Files",children:t.output.files}),(0,l.jsx)(w,{label:"Artifacts",children:t.output.artifacts}),(0,l.jsx)(w,{label:"References",children:t.output.references}),(0,l.jsx)(w,{label:"Conversation",children:t.output.hasConversation?"Yes":"No"})]})]})]}),(0,l.jsxs)("div",{className:f.grid,children:[(0,l.jsx)(q,{name:"Task Content",children:m.taskContent}),(0,l.jsx)(q,{name:"Context",className:f.contextCard,children:(0,l.jsx)("div",{className:f.contextContent,children:m.context})}),(0,l.jsx)(q,{name:"Output details",children:m.output}),(0,l.jsx)(q,{name:"Subtasks",children:m.subtasks}),(0,l.jsx)(q,{name:"Activity",className:f.activity,showHeading:!1,children:m.activity})]})]})};function xe(e){return e==="completed"||e==="cancelled"}function sn(e,t){let a=t?.hideCompleted??!1?e.filter(d=>!xe(d.status)):e,o=new Set(a.map(d=>d.id)),p=[],g=new Set;for(let d of a){if(d.parentId&&o.has(d.parentId)&&d.parentId!==d.id){let c=`${d.parentId}|${d.id}|parent`;g.has(c)||(g.add(c),p.push({from:d.parentId,to:d.id,kind:"parent"}))}for(let c of d.dependencies??[])if(o.has(c)&&c!==d.id){let m=`${c}|${d.id}|dependency`;g.has(m)||(g.add(m),p.push({from:c,to:d.id,kind:"dependency"}))}}return{nodes:a.map(d=>({id:d.id,task:d})),edges:Ot(o,p)}}function Ot(e,t){let n=[...t];for(;;){let a=new Map,o=new Map;for(let h of e)a.set(h,0),o.set(h,[]);for(let h of n)a.set(h.to,(a.get(h.to)??0)+1),o.get(h.from)?.push(h.to);let p=[...a.entries()].filter(([,h])=>h===0).map(([h])=>h),g=0;for(;p.length>0;){let h=p.shift();g+=1;for(let f of o.get(h)??[]){let E=(a.get(f)??0)-1;a.set(f,E),E===0&&p.push(f)}}if(g>=e.size)return n;let d=new Set([...a.entries()].filter(([,h])=>h>0).map(([h])=>h)),c=h=>d.has(h.from)&&d.has(h.to),m=n.findIndex(h=>h.kind==="dependency"&&c(h)),y=m>=0?m:n.findIndex(c);if(y===-1)return n;n.splice(y,1)}}function Ye(e){let{task:t,workItems:n,subtasks:a,relatedTasks:o}=e,p=e.now??new Date,g=t.dueDate===void 0?Number.NaN:new Date(t.dueDate).getTime(),d=p.getTime(),c=t.failureReason!==void 0,m=t.context?.interruption,y=t.status==="interrupted"&&typeof m=="object"&&m!==null&&m.type==="review_required",h={};for(let v of a)h[v.status]=(h[v.status]??0)+1;let f=new Set(t.dependencies??[]),E=new Map(o.map(v=>[v.id,v])),N=0,P=0;for(let v of f){let R=E.get(v);R&&(N+=1,R.status==="completed"&&(P+=1))}let r,S;for(let v of n){let R=Xe(v.createdAt);R!==void 0&&(r===void 0||R>r.getTime())&&(r=new Date(R)),typeof v.attempt=="number"&&Number.isFinite(v.attempt)&&(S=S===void 0?v.attempt:Math.max(S,v.attempt))}let O=t.files??[],B=Ie(t,n);return{state:{status:t.status,priority:t.priority,dueDate:t.dueDate,overdue:Number.isFinite(g)&&Number.isFinite(d)&&g<d&&!xe(t.status),requiresReview:t.requireReview===!0,awaitingReview:y,hasFailureReason:c},execution:{subtasks:{total:a.length,completed:h.completed??0,byStatus:h},dependencies:{total:f.size,known:N,completed:P,unavailable:f.size-N},latestActivityAt:r,maxAttempt:S},output:{hasResult:t.result!==void 0,hasFailureReason:c,files:O.length,artifacts:O.filter(v=>v.addedBy==="agent").length,references:O.filter(v=>v.addedBy==="user").length,hasConversation:B!==void 0}}}function Ie(e,t){let n=e.context?.thread_id;if(qe(n))return n;let a,o=Number.NEGATIVE_INFINITY;for(let p of t){if(!qe(p.threadId))continue;let g=Xe(p.createdAt);g!==void 0&&g>o&&(a=p.threadId,o=g)}return a}function Xe(e){if(!(e instanceof Date)&&typeof e!="string")return;let t=e instanceof Date?e.getTime():new Date(e).getTime();return Number.isFinite(t)?t:void 0}function qe(e){return typeof e=="string"&&e.trim().length>0}var i=k(D()),Y={pending:{label:"Pending",color:"#7A7A7A"},in_progress:{label:"In Progress",color:"#3b82f6"},review:{label:"Review",color:"#f59e0b"},failed:{label:"Failed",color:"#ef4444"},interrupted:{label:"Interrupted",color:"#8b5cf6"},completed:{label:"Completed",color:"#22c55e"},cancelled:{label:"Cancelled",color:"#7A7A7A"}},Je={high:{label:"High",color:"#ef4444"},medium:{label:"Medium",color:"#f59e0b"},low:{label:"Low",color:"#22c55e"}},Bt={approved:(0,i.jsx)(ee,{size:14,style:{color:"#22c55e"}}),rejected:(0,i.jsx)(Pe,{size:14,style:{color:"#ef4444"}}),started:(0,i.jsx)(me,{size:14,style:{color:"#3b82f6"}}),failed:(0,i.jsx)(_e,{size:14,style:{color:"#ef4444"}}),completed:(0,i.jsx)(ee,{size:14,style:{color:"#22c55e"}}),retried:(0,i.jsx)(me,{size:14,style:{color:"#f59e0b"}}),cancelled:(0,i.jsx)(De,{size:14,style:{color:"#7A7A7A"}}),created:(0,i.jsx)($e,{size:14,style:{color:"#7A7A7A"}})};function Te(e){return(e instanceof Date?e:new Date(e)).toLocaleString("en-US",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}function Qe(e){let t=e instanceof Date?e:new Date(e),n=Date.now()-t.getTime();return n<60*1e3?"just now":n<3600*1e3?`${Math.floor(n/(60*1e3))}m ago`:n<1440*60*1e3?`${Math.floor(n/(3600*1e3))}h ago`:n<10080*60*1e3?`${Math.floor(n/(1440*60*1e3))}d ago`:t.toLocaleDateString("en-US",{year:"numeric",month:"2-digit",day:"2-digit"})}function jt(e){if(e.name)return e.name;let t=e.uri.split("/").filter(Boolean);return t[t.length-1]||e.uri}var Mt=_(({token:e,css:t})=>({main:t`
264
- flex: 1 1 380px;
265
- min-width: 0;
266
- display: flex;
267
- flex-direction: column;
268
- gap: 16px;
269
- `,rail:t`
270
- display: flex;
271
- flex-direction: column;
272
- `,sectionTitle:t`
273
- margin: 0 0 8px;
274
- font-size: 13px;
275
- font-weight: 600;
276
- color: ${e.colorTextSecondary};
277
- `,description:t`
278
- font-size: 14px;
279
- color: ${e.colorText};
280
- line-height: 1.7;
281
- `,resultCard:t`
282
- background: #f6ffed;
283
- border: 1px solid #b7eb8f;
284
- border-radius: 12px;
285
- padding: 16px;
286
- `,failureCard:t`
287
- background: #fff2f0;
288
- border: 1px solid #ffccc7;
289
- border-radius: 12px;
290
- padding: 16px;
291
- `,waitingCard:t`
292
- background: #fffbe6;
293
- border: 1px solid #ffe58f;
294
- border-radius: 12px;
295
- padding: 16px;
296
- display: flex;
297
- flex-direction: column;
298
- gap: 10px;
299
- `,propRow:t`
300
- display: flex;
301
- align-items: center;
302
- justify-content: space-between;
303
- gap: 8px;
304
- padding: 6px 0;
305
- font-size: 13px;
306
- `,propLabel:t`
307
- color: ${e.colorTextTertiary};
308
- flex-shrink: 0;
309
- `,propValue:t`
310
- color: ${e.colorText};
311
- display: flex;
312
- align-items: center;
313
- gap: 6px;
314
- min-width: 0;
315
- `,statusBadge:t`
316
- display: inline-flex;
317
- align-items: center;
318
- gap: 6px;
319
- font-weight: 600;
320
- `,quietButton:t`
321
- appearance: none;
322
- background: transparent;
323
- border: 0;
324
- color: inherit;
325
- font: inherit;
326
- margin: 0;
327
- padding: 0;
328
- text-align: inherit;
329
- cursor: pointer;
330
- &:active {
331
- background: ${e.colorFillSecondary};
332
- }
333
- &:focus-visible {
334
- outline: 2px solid ${e.colorPrimaryBorder};
335
- outline-offset: 2px;
336
- border-radius: 6px;
337
- }
338
- `,actionRow:t`
339
- width: 100%;
340
- &:hover {
341
- background: ${e.colorFillTertiary};
342
- }
343
- `,compactAction:t`
344
- min-height: 24px;
345
- padding: 2px 4px;
346
- @container task-detail-workbench (max-width: 639px) {
347
- min-height: 32px;
348
- }
349
- `,statusTrigger:t`
350
- border-radius: 6px;
351
- &:hover {
352
- background: ${e.colorFillTertiary};
353
- }
354
- `,statusDot:t`
355
- width: 8px;
356
- height: 8px;
357
- border-radius: 50%;
358
- flex-shrink: 0;
359
- `,checklistItem:t`
360
- display: flex;
361
- align-items: flex-start;
362
- gap: 8px;
363
- padding: 4px 0;
364
- font-size: 13px;
365
- line-height: 1.5;
366
- color: ${e.colorText};
367
- `,checklistDone:t`
368
- color: ${e.colorTextTertiary};
369
- `,subtaskRow:t`
370
- display: flex;
371
- align-items: center;
372
- gap: 8px;
373
- padding: 6px 8px;
374
- margin: 0 -8px;
375
- border-radius: 6px;
376
- font-size: 13px;
377
- color: ${e.colorText};
378
- transition: background 0.15s ease;
379
- `,subtaskStatus:t`
380
- flex-shrink: 0;
381
- font-size: 12px;
382
- white-space: nowrap;
383
- `,subtaskTitle:t`
384
- flex: 1;
385
- min-width: 0;
386
- overflow: hidden;
387
- text-overflow: ellipsis;
388
- white-space: nowrap;
389
- `,fileRow:t`
390
- display: flex;
391
- align-items: center;
392
- gap: 8px;
393
- padding: 4px 0;
394
- font-size: 13px;
395
- color: ${e.colorText};
396
- `,fileName:t`
397
- flex: 1;
398
- min-width: 0;
399
- overflow: hidden;
400
- text-overflow: ellipsis;
401
- white-space: nowrap;
402
- `,fileKind:t`
403
- flex-shrink: 0;
404
- font-size: 12px;
405
- color: ${e.colorTextTertiary};
406
- `,feedHeader:t`
407
- display: flex;
408
- align-items: center;
409
- gap: 6px;
410
- user-select: none;
411
- width: fit-content;
412
- min-height: 24px;
413
- padding: 2px 4px;
414
- &:hover {
415
- color: ${e.colorPrimary};
416
- }
417
- @container task-detail-workbench (max-width: 639px) {
418
- min-height: 32px;
419
- }
420
- `,feed:t`
421
- display: flex;
422
- flex-direction: column;
423
- gap: 10px;
424
- margin-top: 10px;
425
- `,feedItem:t`
426
- display: flex;
427
- gap: 8px;
428
- font-size: 13px;
429
- `,feedSummary:t`
430
- color: ${e.colorText};
431
- `,feedMeta:t`
432
- display: flex;
433
- gap: 8px;
434
- font-size: 12px;
435
- color: ${e.colorTextTertiary};
436
- `,threadLink:t`
437
- display: inline-flex;
438
- align-items: center;
439
- gap: 4px;
440
- color: ${e.colorInfo};
441
- min-height: 24px;
442
- padding: 2px 4px;
443
- &:hover {
444
- text-decoration: underline;
445
- }
446
- @container task-detail-workbench (max-width: 639px) {
447
- min-height: 32px;
448
- }
449
- `,spinner:t`
450
- display: flex;
451
- align-items: center;
452
- justify-content: center;
453
- padding: 48px 0;
454
- `})),Ze=({task:e,relatedTasks:t=[],onRelatedTaskClick:n,headingRef:a,workItems:o=[],loading:p=!1,activityError:g,actions:d,transitionPending:c=!1,subtaskProgress:m,subtasks:y,onSubtaskClick:h,parent:f,onParentClick:E,canGoBack:N=!1,onBack:P})=>{let{styles:r}=Mt(),[S,O]=(0,I.useState)(!1),[B,v]=(0,I.useState)(!1),[R,we]=(0,I.useState)(!1),Ne=(0,I.useId)(),ke=(0,I.useId)(),A=Y[e.status]||Y.pending,oe=Je[e.priority]||Je.medium,X=e.context?.interruption,M=e.status==="interrupted"&&typeof X=="object"&&X!==null&&X.type==="review_required",re=Ie(e,o),z=d?.onViewChat,tt=(0,I.useMemo)(()=>Ye({task:e,workItems:o,subtasks:y??[],relatedTasks:t}),[t,y,e,o]),J=M?X.evidenceId:void 0,ae=typeof J=="string"&&J.length>0,L=(0,I.useMemo)(()=>{let s=o.filter(u=>u.action==="completion_evidence");return ae?s.find(u=>u.id===J):[...s].sort((u,b)=>new Date(b.createdAt).getTime()-new Date(u.createdAt).getTime())[0]},[ae,J,o]),nt=typeof L?.detail?.result=="string"&&L.detail.result.length>0,{checklistItems:se,doneCount:it}=(0,I.useMemo)(()=>{if(!e.description)return{checklistItems:[],doneCount:0};let s=e.description.split(`
455
- `).filter(u=>/^\s*[-*]\s*\[[ x]\]/i.test(u)).map(u=>({text:u.replace(/^\s*[-*]\s*\[[ x]\]\s*/i,""),done:/^\s*[-*]\s*\[[x]\]/i.test(u)}));return s.sort((u,b)=>Number(u.done)-Number(b.done)),{checklistItems:s,doneCount:s.filter(u=>u.done).length}},[e.description]),Ee=(0,I.useMemo)(()=>e.description?We(e.description).split(`
456
- `).filter(s=>!/^\s*[-*]\s*\[[ x]\]/i.test(s)).join(`
457
- `).trim():"",[e.description]),ot=typeof e.description=="string"&&e.description.trim().length>0,rt=e.files?.filter(s=>s.addedBy==="agent")??[],at=e.files?.filter(s=>s.addedBy==="user")??[],st=e.files?.filter(s=>s.addedBy===void 0)??[],le=(0,I.useMemo)(()=>o.length>0?[...o].sort((s,u)=>new Date(s.createdAt).getTime()-new Date(u.createdAt).getTime()):[{id:"created",action:"created",actor:e.ownerId,summary:"Task created",createdAt:e.createdAt},{id:"status",action:e.status,actor:e.ownerId,summary:`Status: ${A.label}`,createdAt:e.updatedAt}],[o,e,A.label]),G=(0,I.useMemo)(()=>{let s=new Set,u=new Set;for(let b of le){if(b.action==="completion_evidence")continue;let C=b.detail?.eventKey??b.eventKey;typeof C=="string"&&C.length>0&&s.add(C);let $=b.detail?.evidenceId;typeof $=="string"&&$.length>0&&u.add($)}return le.filter(b=>{if(b.action!=="completion_evidence")return!0;if(M&&b.id===L?.id)return!1;let C=b.detail?.eventKey??b.eventKey;return u.has(b.id)?!1:typeof C!="string"||!s.has(C)})},[le,M,L?.id]),lt=g?0:G.length,dt=B?G:G.slice(-3),ct=S?y:y?.slice(0,5),de=(0,I.useMemo)(()=>y&&y.length>0?{done:y.filter(s=>s.status==="completed").length,total:y.length}:m,[y,m]),Q=(0,I.useMemo)(()=>{if(!d||e.ownerType==="agent")return[];let s=[];return e.status==="failed"&&(d.onRetry&&s.push({key:"retry",label:"Retry",onClick:d.onRetry}),d.onCancel&&s.push({key:"cancel",label:"Cancel task",danger:!0,onClick:d.onCancel})),s},[d,e.ownerType,e.status]);(0,I.useEffect)(()=>{we(!1)},[e.id,e.status,c]),(0,I.useEffect)(()=>{O(!1),v(!1)},[e.id]);let Re=Q.length>0?(0,i.jsxs)("button",{type:"button",className:`${r.statusBadge} ${r.quietButton} ${r.compactAction} ${r.statusTrigger}`,style:{color:A.color},"data-testid":"status-badge","aria-label":`Change status, current status ${A.label}`,"aria-haspopup":"menu","aria-expanded":R,children:[(0,i.jsx)("span",{className:r.statusDot,style:{background:A.color}}),A.label,(0,i.jsx)(ue,{size:12})]}):(0,i.jsxs)("span",{className:r.statusBadge,style:{color:A.color},"data-testid":"status-badge",children:[(0,i.jsx)("span",{className:r.statusDot,style:{background:A.color}}),A.label]}),pt=(0,i.jsxs)(i.Fragment,{children:[Ee?(0,i.jsx)("div",{className:r.description,children:(0,i.jsx)(j,{content:Ee})}):ot?null:(0,i.jsx)("div",{className:r.feedMeta,children:"No task description"}),se.length>0&&(0,i.jsxs)("div",{style:{marginTop:16},children:[(0,i.jsxs)("div",{className:r.sectionTitle,children:["Acceptance \u2713 ",it,"/",se.length]}),se.map((s,u)=>(0,i.jsxs)("div",{"data-testid":"checklist-item",className:`${r.checklistItem} ${s.done?r.checklistDone:""}`,children:[s.done?(0,i.jsx)(ee,{size:14,style:{color:"#22c55e",flexShrink:0,marginTop:2}}):(0,i.jsx)("div",{style:{width:14,height:14,border:"2px solid #d9d9d9",borderRadius:3,flexShrink:0,marginTop:2}}),(0,i.jsx)("span",{children:s.text})]},u))]}),(0,i.jsx)(Ue,{description:e.description})]}),ut=(0,i.jsxs)("div",{className:r.main,children:[M&&(0,i.jsxs)("div",{className:r.waitingCard,"data-testid":"approval-waiting",children:[(0,i.jsx)("div",{className:r.sectionTitle,style:{color:"#b45309",margin:0},children:"Waiting for approval"}),L&&(0,i.jsx)(be,{item:L}),!L&&ae&&(0,i.jsx)("div",{className:r.feedMeta,children:p?"Approval evidence is loading...":"Approval evidence is unavailable."}),e.result!==void 0&&!nt&&(0,i.jsxs)("div",{children:[(0,i.jsx)("div",{className:r.sectionTitle,children:"Result"}),(0,i.jsx)("div",{className:r.description,children:e.result.length>0?(0,i.jsx)(j,{content:e.result}):"No text provided"})]}),!re||!z?(0,i.jsx)("div",{className:r.feedMeta,children:"The agent conversation is unavailable because no thread is associated with this task."}):null]}),e.result!==void 0&&!M?(0,i.jsxs)("div",{className:r.resultCard,children:[(0,i.jsx)("h4",{className:r.sectionTitle,children:"Result"}),(0,i.jsx)("div",{className:r.description,children:e.result.length>0?(0,i.jsx)(j,{content:e.result}):"No text provided"})]}):M?null:(0,i.jsx)("div",{className:r.feedMeta,children:"No result recorded"}),e.failureReason!==void 0&&(0,i.jsxs)("div",{className:r.failureCard,children:[(0,i.jsx)("h4",{className:r.sectionTitle,style:{color:"#ef4444"},children:"Failure Reason"}),(0,i.jsx)("div",{className:r.description,children:e.failureReason.length>0?(0,i.jsx)(j,{content:e.failureReason}):"No text provided"})]}),e.failureReason===void 0&&(0,i.jsx)("div",{className:r.feedMeta,children:"No failure reason recorded"}),e.files&&e.files.length>0?(0,i.jsx)("div",{"data-testid":"files-section",children:[["Artifacts",rt],["References",at],["Other files",st]].map(([s,u])=>u.length>0&&(0,i.jsxs)("div",{style:{marginTop:8},children:[(0,i.jsx)("h4",{className:r.sectionTitle,children:s}),u.map((b,C)=>{let $=jt(b),K=/^https?:\/\//.test(b.uri);return(0,i.jsxs)("div",{"data-testid":"file-row",className:r.fileRow,children:[(0,i.jsx)(je,{size:13,style:{flexShrink:0,color:"#7A7A7A"}}),K?(0,i.jsx)("a",{href:b.uri,target:"_blank",rel:"noreferrer",className:r.fileName,children:$}):(0,i.jsx)("span",{className:r.fileName,title:b.uri,children:$})]},`${b.uri}-${C}`)})]},s))}):(0,i.jsx)("div",{className:r.feedMeta,children:"No files attached"}),!re&&!M&&(0,i.jsx)("div",{className:r.feedMeta,children:"No conversation associated"})]}),mt=(0,i.jsxs)("div",{children:[(0,i.jsxs)("h3",{className:r.sectionTitle,children:["Activity (",lt,")"]}),(0,i.jsx)("div",{id:Ne,children:p?(0,i.jsx)("div",{className:r.spinner,"data-testid":"feed-loading",children:(0,i.jsx)(pe,{size:"small"})}):g?(0,i.jsx)("div",{role:"alert",className:r.feedMeta,children:g}):G.length===0?(0,i.jsx)(ce,{description:"No activity yet",image:ce.PRESENTED_IMAGE_SIMPLE}):(0,i.jsx)("div",{className:r.feed,"data-testid":"activity-feed",children:dt.map(s=>{let u=s.action==="activity"&&typeof s.detail?.markdown=="string",b=s.action==="completion_evidence",C=typeof s.detail?.result=="string"||Array.isArray(s.detail?.beliefImpact),$=u||b||C,K=s.threadId,bt=K&&z?()=>z(K):void 0;return(0,i.jsxs)("div",{className:r.feedItem,"data-testid":s.action==="update_agent"?"feed-item-update_agent":"activity-item",style:s.action==="update_agent"?{borderLeft:"2px solid #6366f1",paddingLeft:8}:void 0,children:[(0,i.jsx)("span",{style:{flexShrink:0,marginTop:2},children:Bt[s.action]||(0,i.jsx)(Be,{size:14,style:{color:"#7A7A7A"}})}),(0,i.jsxs)("div",{children:[(0,i.jsx)("div",{className:r.feedSummary,children:b?"Completion evidence recorded":s.summary||s.action}),$&&(0,i.jsx)(be,{item:s,viewChat:bt}),(0,i.jsxs)("div",{className:r.feedMeta,children:[(0,i.jsx)("span",{children:s.actor}),(0,i.jsx)("span",{title:Te(s.createdAt),children:Qe(s.createdAt)}),s.attempt!==void 0&&s.attempt>1&&(0,i.jsxs)("span",{children:["Attempt #",s.attempt]}),K&&z&&!$&&(0,i.jsxs)("button",{type:"button",className:`${r.threadLink} ${r.quietButton}`,onClick:()=>z(K),children:[(0,i.jsx)(W,{size:12}),"View Chat"]})]})]})]},s.id)})})}),!p&&!g&&G.length>3&&(0,i.jsxs)("button",{type:"button",className:`${r.feedHeader} ${r.quietButton}`,onClick:()=>v(s=>!s),"aria-expanded":B,"aria-controls":Ne,children:[B?(0,i.jsx)(ue,{size:14}):null,B?"Show fewer activity items":`View all ${G.length} activity items`]})]}),ft=c?(0,i.jsxs)("span",{className:r.statusBadge,style:{color:A.color},"data-testid":"status-pending",role:"status","aria-live":"polite","aria-label":`Updating task status; current status ${A.label}`,children:[(0,i.jsx)(pe,{size:"small"}),"Updating \xB7 ",A.label]}):Q.length>0?(0,i.jsx)(Ce,{menu:{items:Q.map(({key:s,label:u,danger:b})=>({key:s,label:u,danger:b})),onClick:({key:s})=>Q.find(u=>u.key===s)?.onClick()},trigger:["click"],open:R,onOpenChange:we,children:Re}):Re,gt=(0,i.jsxs)("span",{className:r.propValue,"data-testid":"priority-row",children:[(0,i.jsx)("span",{className:r.statusDot,style:{background:oe.color}}),(0,i.jsx)("span",{style:{color:oe.color,fontWeight:600},children:oe.label})]}),ht=(0,i.jsxs)("div",{className:r.rail,"data-testid":"rail",children:[(0,i.jsxs)("div",{className:r.propRow,children:[(0,i.jsx)("span",{className:r.propLabel,children:"Created"}),(0,i.jsxs)("span",{className:r.propValue,children:[(0,i.jsx)(Oe,{size:13}),(0,i.jsx)("span",{title:Te(e.createdAt),children:Qe(e.createdAt)})]})]}),e.dueDate&&(0,i.jsxs)("div",{className:r.propRow,children:[(0,i.jsx)("span",{className:r.propLabel,children:"Due"}),(0,i.jsx)("span",{className:r.propValue,children:Te(e.dueDate)})]}),e.dependencies&&e.dependencies.length>0?[...new Set(e.dependencies)].map(s=>{let u=t.find(C=>C.id===s),b=u?Y[u.status]?.label??u.status:void 0;return(0,i.jsxs)("div",{className:r.propRow,children:[(0,i.jsx)("span",{className:r.propLabel,children:"Dependency"}),u&&n?(0,i.jsxs)("button",{type:"button",className:`${r.propValue} ${r.quietButton} ${r.compactAction}`,"aria-label":`Dependency: ${u.title}, status ${b}`,onClick:()=>n(u),children:[u.title," \xB7 ",b]}):(0,i.jsx)("span",{className:r.propValue,children:u?`${u.title} \xB7 ${b}`:"Dependency unavailable"})]},s)}):(0,i.jsx)("div",{className:r.feedMeta,children:"No dependencies"})]}),yt=y&&y.length>0?(0,i.jsxs)("div",{"data-testid":"subtasks-section",children:[de&&(0,i.jsxs)("div",{className:r.sectionTitle,children:[de.done,"/",de.total," completed"]}),(0,i.jsx)("div",{id:ke,children:ct?.map(s=>{let u=Y[s.status]||Y.pending,b=(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("span",{className:r.statusDot,style:{background:u.color}}),(0,i.jsx)("span",{className:r.subtaskTitle,children:s.title}),(0,i.jsx)("span",{className:r.subtaskStatus,style:{color:u.color},children:u.label})]});return h?(0,i.jsx)("button",{type:"button","data-testid":"subtask-row",className:`${r.subtaskRow} ${r.quietButton} ${r.actionRow}`,title:`${u.label} \xB7 ${s.title}`,"aria-label":`${s.title}, status ${u.label}`,onClick:()=>h(s),children:b},s.id):(0,i.jsx)("div",{"data-testid":"subtask-row",className:r.subtaskRow,title:`${u.label} \xB7 ${s.title}`,children:b},s.id)})}),y.length>5&&(0,i.jsx)("button",{type:"button",className:`${r.feedHeader} ${r.quietButton}`,onClick:()=>O(s=>!s),"aria-expanded":S,"aria-controls":ke,children:S?"Show fewer subtasks":`View all ${y.length} subtasks`})]}):m&&m.total>0?(0,i.jsxs)("div",{children:[m.done,"/",m.total," completed"]}):(0,i.jsx)("div",{className:r.feedMeta,children:"No subtasks"});return(0,i.jsx)(He,{task:e,facts:tt,parent:f,canGoBack:N,onBack:P,onParentClick:E,headingRef:a,statusControl:ft,priorityControl:gt,regions:{taskContent:pt,context:ht,output:ut,subtasks:yt,activity:mt},threadId:re,onViewChat:z})};var ne=k(D()),Ft=_(({css:e})=>({container:e`
458
- display: flex;
459
- flex-direction: column;
460
- height: 100%;
461
- overflow: hidden;
462
- `,body:e`
463
- flex: 1 1 auto;
464
- min-height: 0;
465
- overflow-y: auto;
466
- padding: clamp(12px, 3cqi, 16px) clamp(16px, 4cqi, ${24}px);
467
- `})),kn=({task:e,relatedTasks:t,onRelatedTaskClick:n,workItems:a,loading:o,activityError:p,transitionPending:g=!1,onApprove:d,onReject:c,onRetry:m,onCancel:y,onViewChat:h,onBack:f,canGoBack:E=!0,maxHeight:N,focusKey:P,subtasks:r,onSubtaskClick:S,parent:O,onParentClick:B})=>{let{styles:v}=Ft(),R=(0,ie.useRef)(null);return(0,ie.useEffect)(()=>{P!==void 0&&R.current?.focus()},[P]),(0,ne.jsx)("div",{className:v.container,"data-testid":"task-detail-panel",style:N===void 0?void 0:{maxHeight:N},children:(0,ne.jsx)("div",{className:v.body,children:(0,ne.jsx)(Ze,{task:e,relatedTasks:t,onRelatedTaskClick:n,headingRef:P===void 0?void 0:R,workItems:a,loading:o,activityError:p,transitionPending:g,actions:{onApprove:d,onReject:c,onRetry:m,onCancel:y,onViewChat:h},subtasks:r,onSubtaskClick:S,parent:O,onParentClick:B,canGoBack:E,onBack:f})})})};var et=k(Z());function zt(e,t){let n=e.ownerType==="agent"?e.ownerId:"general-purpose";return{component_key:"task",message:e.title||"Task",data:{thread_id:t,description:e.description||"",subagent_type:n}}}var An=e=>{let{openSideApp:t}=Me();return(0,et.useCallback)(n=>{if(e)try{t(zt(e,n))}catch{console.warn("Cannot open task chat: ChatUIContextProvider is not mounted")}},[t,e])};export{U as a,Rt as b,Kt as c,Wt as d,xe as e,sn as f,kn as g,An as h};