@axiom-lattice/react-sdk 4.1.2 → 4.1.4

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 (57) hide show
  1. package/dist/{AgentDetailSideApp-BANXDHGC.mjs → AgentDetailSideApp-KVL27KAF.mjs} +6 -6
  2. package/dist/{AgentGovernanceWorkbench-PNF7MG6Q.mjs → AgentGovernanceWorkbench-I6S4XU3T.mjs} +7 -7
  3. package/dist/{MessageGraph-JYJJGID6.mjs → MessageGraph-LOSAZQ2V.mjs} +2 -2
  4. package/dist/{ReactChart-YSVXA36V.mjs → ReactChart-NDLIHCJJ.mjs} +2 -2
  5. package/dist/{TasksSideApp-BHSO6MME.mjs → TasksSideApp-37YKH7HV.mjs} +3 -3
  6. package/dist/{TeamWorkspace-UX5XZOBG.mjs → TeamWorkspace-EAFZU3KS.mjs} +2 -2
  7. package/dist/{TopologyRuntimeView-7RTCOJL6.mjs → TopologyRuntimeView-53OCKDYA.mjs} +3 -3
  8. package/dist/{WorkflowAutomationView-ZXWX7KAO.mjs → WorkflowAutomationView-R4EHXT7I.mjs} +5 -5
  9. package/dist/{chunk-2ZHLPYFM.mjs → chunk-EWLXRAWY.mjs} +64 -10
  10. package/dist/chunk-EWLXRAWY.mjs.map +1 -0
  11. package/dist/{chunk-PCVIQHMU.mjs → chunk-FKK4AXDU.mjs} +4 -4
  12. package/dist/{chunk-U3IFNUHY.mjs → chunk-N4C7TX7T.mjs} +2 -2
  13. package/dist/{chunk-TIJF2N43.mjs → chunk-OT7IZRSM.mjs} +2 -2
  14. package/dist/{chunk-YHTQIFV7.mjs → chunk-SLXJAOF2.mjs} +2 -2
  15. package/dist/{chunk-XVKJMRHA.mjs → chunk-WQBBDRPU.mjs} +11 -11
  16. package/dist/{chunk-V4IPV2ZK.mjs → chunk-YYP5ASCR.mjs} +4 -4
  17. package/dist/{embed-page-AgentDetailSideApp-2LI6OOO7.js → embed-page-AgentDetailSideApp-3LBCEKFU.js} +1 -1
  18. package/dist/{embed-page-AgentGovernanceWorkbench-M4H7NQNZ.js → embed-page-AgentGovernanceWorkbench-K3JUQNBW.js} +1 -1
  19. package/dist/{embed-page-MessageGraph-C3WBV4X7.js → embed-page-MessageGraph-3X4ROEN6.js} +1 -1
  20. package/dist/{embed-page-ReactChart-7K7Z2GKH.js → embed-page-ReactChart-F6VYCIYY.js} +1 -1
  21. package/dist/{embed-page-SkillFlow-MAXK7HAQ.js → embed-page-SkillFlow-3CF7R3CW.js} +1 -1
  22. package/dist/{embed-page-TasksSideApp-LJDTRCAB.js → embed-page-TasksSideApp-3WRDBZU3.js} +1 -1
  23. package/dist/{embed-page-TeamWorkspace-GXWDJBUR.js → embed-page-TeamWorkspace-6JSMZYUF.js} +1 -1
  24. package/dist/{embed-page-TopologyRuntimeView-JCAZCHS7.js → embed-page-TopologyRuntimeView-YDFENLHH.js} +1 -1
  25. package/dist/{embed-page-WorkflowAutomationView-4MAB62HK.js → embed-page-WorkflowAutomationView-MP5B7Q2Q.js} +1 -1
  26. package/dist/{embed-page-chunk-GZXI22WX.js → embed-page-chunk-B2E2XOH2.js} +8 -8
  27. package/dist/{embed-page-chunk-UVYHBMEW.js → embed-page-chunk-FFO7CAYL.js} +1 -1
  28. package/dist/{embed-page-chunk-HCLU6MDW.js → embed-page-chunk-GDTBDOUE.js} +4 -4
  29. package/dist/{embed-page-chunk-YPHDGMDG.js → embed-page-chunk-IRP6JSSX.js} +1 -1
  30. package/dist/{embed-page-chunk-Z6HFQXM5.js → embed-page-chunk-PAJ5NG2Z.js} +1 -1
  31. package/dist/{embed-page-chunk-DFJ7Y4ID.js → embed-page-chunk-QEYWJHEK.js} +1 -1
  32. package/dist/{embed-page-chunk-E7PTLQAG.js → embed-page-chunk-RVXX5HKF.js} +1 -1
  33. package/dist/{embed-page-chunk-7LQKELZI.js → embed-page-chunk-UOL6CUAL.js} +1 -1
  34. package/dist/{embed-page-chunk-J2VPD2GD.js → embed-page-chunk-URNZX66S.js} +1 -1
  35. package/dist/{embed-page-chunk-E46G4ZHX.js → embed-page-chunk-YMJGPA3F.js} +118 -118
  36. package/dist/embed-page.js +1 -1
  37. package/dist/index.d.mts +6 -0
  38. package/dist/index.d.ts +6 -0
  39. package/dist/index.js +59 -5
  40. package/dist/index.js.map +1 -1
  41. package/dist/index.mjs +7 -7
  42. package/package.json +3 -3
  43. package/dist/chunk-2ZHLPYFM.mjs.map +0 -1
  44. /package/dist/{AgentDetailSideApp-BANXDHGC.mjs.map → AgentDetailSideApp-KVL27KAF.mjs.map} +0 -0
  45. /package/dist/{AgentGovernanceWorkbench-PNF7MG6Q.mjs.map → AgentGovernanceWorkbench-I6S4XU3T.mjs.map} +0 -0
  46. /package/dist/{MessageGraph-JYJJGID6.mjs.map → MessageGraph-LOSAZQ2V.mjs.map} +0 -0
  47. /package/dist/{ReactChart-YSVXA36V.mjs.map → ReactChart-NDLIHCJJ.mjs.map} +0 -0
  48. /package/dist/{TasksSideApp-BHSO6MME.mjs.map → TasksSideApp-37YKH7HV.mjs.map} +0 -0
  49. /package/dist/{TeamWorkspace-UX5XZOBG.mjs.map → TeamWorkspace-EAFZU3KS.mjs.map} +0 -0
  50. /package/dist/{TopologyRuntimeView-7RTCOJL6.mjs.map → TopologyRuntimeView-53OCKDYA.mjs.map} +0 -0
  51. /package/dist/{WorkflowAutomationView-ZXWX7KAO.mjs.map → WorkflowAutomationView-R4EHXT7I.mjs.map} +0 -0
  52. /package/dist/{chunk-PCVIQHMU.mjs.map → chunk-FKK4AXDU.mjs.map} +0 -0
  53. /package/dist/{chunk-U3IFNUHY.mjs.map → chunk-N4C7TX7T.mjs.map} +0 -0
  54. /package/dist/{chunk-TIJF2N43.mjs.map → chunk-OT7IZRSM.mjs.map} +0 -0
  55. /package/dist/{chunk-YHTQIFV7.mjs.map → chunk-SLXJAOF2.mjs.map} +0 -0
  56. /package/dist/{chunk-XVKJMRHA.mjs.map → chunk-WQBBDRPU.mjs.map} +0 -0
  57. /package/dist/{chunk-V4IPV2ZK.mjs.map → chunk-YYP5ASCR.mjs.map} +0 -0
@@ -1,5 +1,5 @@
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-E46G4ZHX.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 N}from"./embed-page-chunk-6Y3UYJ6Z.js";var ie=N(Z());var I=N(Z());var U=N(Z());var V={HUMAN:"human",AI:"ai",TOOL:"tool",INTERRUPT:"interrupt",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,k]of[[1,"probability"],[2,"target"]])if(!Tt.test(y[E]))return F("INVALID_BELIEF_PERCENT",`Belief ${k} must be an integer from 0% to 100%.`,{line:m.lineNumber,column:k});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 kt=2e3,Nt=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>Nt||!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<=kt}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===V.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===V.TOOL&&e.data.tool_call_id)return[{type:"tool.completed",id:e.data.tool_call_id}];if(e.type===V.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"}]}return e.type===V.MESSAGE_COMPLETED?[{type:"message.completed",messageId:e.data.id},{type:"stream.completed"}]:e.type===V.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=N(D());function We(e){if(!e||!ye(e).success)return e??"";let t=e.split(`
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-YMJGPA3F.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
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
4
  `).replace(/\n{3,}/g,`
5
5
 
@@ -32,7 +32,7 @@ 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
32
32
  font-family: ${e.fontFamilyCode};
33
33
  `,basisCell:t`
34
34
  color: ${e.colorTextSecondary};
35
- `})),Ue=({description:e})=>{let{styles:t}=Dt(),n=(0,U.useMemo)(()=>ye(e??""),[e]),a=(0,U.useRef)(!1);return(0,U.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=N(D()),_t=_(({token:e,css:t})=>({root:t`
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
36
  display: flex;
37
37
  flex-direction: column;
38
38
  gap: 6px;
@@ -90,7 +90,7 @@ 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
90
90
  outline-offset: 2px;
91
91
  border-radius: 4px;
92
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=N(D()),Ve=_(({token:e,css:t})=>({workbench:t`
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
94
  min-width: 0;
95
95
  max-width: 100%;
96
96
  color: ${e.colorText};
@@ -260,7 +260,7 @@ 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
260
260
  width: 100%;
261
261
  > * { min-height: 32px; }
262
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,k=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:k.total===0?"None":`${k.completed} completed / ${k.known} known / ${k.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])),k=0,P=0;for(let v of f){let R=E.get(v);R&&(k+=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:k,completed:P,unavailable:f.size-k},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=N(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`
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
264
  flex: 1 1 380px;
265
265
  min-width: 0;
266
266
  display: flex;
@@ -451,10 +451,10 @@ 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
451
451
  align-items: center;
452
452
  justify-content: center;
453
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:k=!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),ke=(0,I.useId)(),Ne=(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(`
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
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
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:ke,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":ke,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:Ne,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":Ne,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:k,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=N(D()),Ft=_(({css:e})=>({container:e`
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
458
  display: flex;
459
459
  flex-direction: column;
460
460
  height: 100%;
@@ -464,4 +464,4 @@ 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
464
464
  min-height: 0;
465
465
  overflow-y: auto;
466
466
  padding: clamp(12px, 3cqi, 16px) clamp(16px, 4cqi, ${24}px);
467
- `})),Nn=({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:k,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:k===void 0?void 0:{maxHeight:k},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=N(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{V as a,Rt as b,Kt as c,Wt as d,xe as e,sn as f,Nn as g,An as h};
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};
@@ -1 +1 @@
1
- import{Ka as n}from"./embed-page-chunk-E46G4ZHX.js";import{k as i,l as p,p as s}from"./embed-page-chunk-J2VPD2GD.js";import{a as d}from"./embed-page-chunk-MB65DZAX.js";import{e as a}from"./embed-page-chunk-6Y3UYJ6Z.js";var e=a(d()),P=({defaultWorkspaceId:t,defaultProjectId:o,children:r})=>{let c=p("__GLOBAL__");return(0,e.jsx)(n,{workspaceId:t,projectId:o,client:c,children:r})},f=({children:t,defaultProjectId:o,defaultWorkspaceId:r})=>{let{config:{baseURL:c}}=s();return(0,e.jsx)(i,{config:{baseURL:c,apiKey:"",assistantId:"__GLOBAL__",transport:"sse"},children:(0,e.jsx)(P,{defaultWorkspaceId:r,defaultProjectId:o,children:t})})},I=f;export{f as a,I as b};
1
+ import{Ka as n}from"./embed-page-chunk-YMJGPA3F.js";import{k as i,l as p,p as s}from"./embed-page-chunk-URNZX66S.js";import{a as d}from"./embed-page-chunk-MB65DZAX.js";import{e as a}from"./embed-page-chunk-6Y3UYJ6Z.js";var e=a(d()),P=({defaultWorkspaceId:t,defaultProjectId:o,children:r})=>{let c=p("__GLOBAL__");return(0,e.jsx)(n,{workspaceId:t,projectId:o,client:c,children:r})},f=({children:t,defaultProjectId:o,defaultWorkspaceId:r})=>{let{config:{baseURL:c}}=s();return(0,e.jsx)(i,{config:{baseURL:c,apiKey:"",assistantId:"__GLOBAL__",transport:"sse"},children:(0,e.jsx)(P,{defaultWorkspaceId:r,defaultProjectId:o,children:t})})},I=f;export{f as a,I as b};
@@ -1,4 +1,4 @@
1
- import{a as it,b as Gt,c as Hn,d as qn}from"./embed-page-chunk-GZXI22WX.js";import{a as zr}from"./embed-page-chunk-UVYHBMEW.js";import{$ as to,$a as Dt,Ea as Ir,F as jo,Fa as Bt,G as ur,Ga as Ar,Ha as C,Ia as Er,J as gr,Ja as Ie,K as fr,L as at,La as no,M as Lo,Ma as tt,Na as Wo,Oa as st,Pa as Se,Qa as ro,R as yr,Ra as Nr,Sa as io,T as kt,U as hr,V as br,W as vr,a as Gn,b as Do,c as et,d as Zt,da as xr,f as cr,fa as oo,ga as wr,ib as Mr,j as Nt,ka as Cr,l as dr,la as Ve,mb as Br,na as _o,o as pr,oa as Sr,ob as Dr,p as eo,pa as kr,qb as Uo,r as Mt,ua as Oo,va as Rr,w as mr,ya as Tr,za as Pr}from"./embed-page-chunk-E46G4ZHX.js";import{f as Kn,i as Oe,k as Vn,m as Qn,o as Yn,p as Ce,q as me}from"./embed-page-chunk-J2VPD2GD.js";import{a}from"./embed-page-chunk-MB65DZAX.js";import{$ as Vt,$b as tr,Ac as ir,Ca as Wn,Eb as Qt,Fa as Ct,Gc as ar,Ia as be,Ic as sr,Ja as _e,Kc as Xt,La as P,Lc as Jt,Ma as Un,Nc as lr,Tb as er,V as Et,Va as zo,W as F,Y as Mo,Z as xe,_ as Ee,aa as Fe,bc as or,fc as nr,ia as Le,la as On,mb as St,mc as Yt,na as Bo,oa as ce,ob as Xn,pa as qe,qb as Jn,rc as yt,sb as Fo,ta as H,tb as Zn,va as ne,wa as Te,xa as q,ya as pe,yb as $o,yc as rr}from"./embed-page-chunk-O4QK5LWZ.js";import{a as w}from"./embed-page-chunk-4BKXE5ON.js";import{e as n}from"./embed-page-chunk-6Y3UYJ6Z.js";var Fr=n(a()),ma=C(({token:e,css:t})=>({button:t`
1
+ import{a as it,b as Gt,c as Hn,d as qn}from"./embed-page-chunk-B2E2XOH2.js";import{a as zr}from"./embed-page-chunk-FFO7CAYL.js";import{$ as to,$a as Dt,Ea as Ir,F as jo,Fa as Bt,G as ur,Ga as Ar,Ha as C,Ia as Er,J as gr,Ja as Ie,K as fr,L as at,La as no,M as Lo,Ma as tt,Na as Wo,Oa as st,Pa as Se,Qa as ro,R as yr,Ra as Nr,Sa as io,T as kt,U as hr,V as br,W as vr,a as Gn,b as Do,c as et,d as Zt,da as xr,f as cr,fa as oo,ga as wr,ib as Mr,j as Nt,ka as Cr,l as dr,la as Ve,mb as Br,na as _o,o as pr,oa as Sr,ob as Dr,p as eo,pa as kr,qb as Uo,r as Mt,ua as Oo,va as Rr,w as mr,ya as Tr,za as Pr}from"./embed-page-chunk-YMJGPA3F.js";import{f as Kn,i as Oe,k as Vn,m as Qn,o as Yn,p as Ce,q as me}from"./embed-page-chunk-URNZX66S.js";import{a}from"./embed-page-chunk-MB65DZAX.js";import{$ as Vt,$b as tr,Ac as ir,Ca as Wn,Eb as Qt,Fa as Ct,Gc as ar,Ia as be,Ic as sr,Ja as _e,Kc as Xt,La as P,Lc as Jt,Ma as Un,Nc as lr,Tb as er,V as Et,Va as zo,W as F,Y as Mo,Z as xe,_ as Ee,aa as Fe,bc as or,fc as nr,ia as Le,la as On,mb as St,mc as Yt,na as Bo,oa as ce,ob as Xn,pa as qe,qb as Jn,rc as yt,sb as Fo,ta as H,tb as Zn,va as ne,wa as Te,xa as q,ya as pe,yb as $o,yc as rr}from"./embed-page-chunk-O4QK5LWZ.js";import{a as w}from"./embed-page-chunk-4BKXE5ON.js";import{e as n}from"./embed-page-chunk-6Y3UYJ6Z.js";var Fr=n(a()),ma=C(({token:e,css:t})=>({button:t`
2
2
  display: inline-flex;
3
3
  align-items: center;
4
4
  justify-content: center;
@@ -1742,7 +1742,7 @@ import{a as it,b as Gt,c as Hn,d as qn}from"./embed-page-chunk-GZXI22WX.js";impo
1742
1742
  margin-bottom: 6px;
1743
1743
  font-weight: 500;
1744
1744
  font-size: 13px;
1745
- `}));var gs=n(a()),{Text:Rf}=P;var Pi=n(w());var fs=n(w());var Ti=n(a());var hn=n(a()),{Text:Ff}=P,{TextArea:$f}=H,{useToken:jf}=_e,{Panel:Lf}=Et;var xt=n(w());var bn=n(a()),Vf=(0,xt.lazy)(()=>import("./embed-page-SkillFlow-MAXK7HAQ.js")),{Text:Gf}=P,{TextArea:Qf}=H;var Ii=n(w());var xn=n(w());var wn=n(a()),{Text:ny,Paragraph:ry}=P,iy=C(({token:e,css:t})=>({root:t`
1745
+ `}));var gs=n(a()),{Text:Rf}=P;var Pi=n(w());var fs=n(w());var Ti=n(a());var hn=n(a()),{Text:Ff}=P,{TextArea:$f}=H,{useToken:jf}=_e,{Panel:Lf}=Et;var xt=n(w());var bn=n(a()),Vf=(0,xt.lazy)(()=>import("./embed-page-SkillFlow-3CF7R3CW.js")),{Text:Gf}=P,{TextArea:Qf}=H;var Ii=n(w());var xn=n(w());var wn=n(a()),{Text:ny,Paragraph:ry}=P,iy=C(({token:e,css:t})=>({root:t`
1746
1746
  height: 100%;
1747
1747
  display: flex;
1748
1748
  flex-direction: column;
@@ -1830,7 +1830,7 @@ import{a as it,b as Gt,c as Hn,d as qn}from"./embed-page-chunk-GZXI22WX.js";impo
1830
1830
  gap: ${e.marginSM}px;
1831
1831
  margin-bottom: ${e.marginSM}px;
1832
1832
  align-items: center;
1833
- `}));var kn=n(w());var Ai=n(a());var Ei=n(w());var Ni=n(a()),{Text:Ry,Title:Ty}=P;var bo=n(w());var ho=n(w());var Mi=n(w());var Bi=n(a()),{Text:zy}=P;var Di=n(a()),{Text:Ky}=P;var Rn=n(w());var Tn=n(a()),{Text:eh,Paragraph:th}=P;var Pn=n(a()),{Text:mh}=P;var In=n(w());var zi=n(a()),{Text:hh}=P;var An=n(w());var vo=n(w());var Fi=n(w());var $i=n(a()),{Text:Ih}=P;var En=n(a()),{Text:jh}=P;var wo=n(w());var xo=n(w());var Pt=n(a()),hs=(0,xo.lazy)(()=>import("./embed-page-TasksSideApp-LJDTRCAB.js").then(e=>({default:e.TasksSideApp}))),Nn=()=>{let{openSideApp:e,sideAppVisible:t,sideAppSelectedCard:o}=Se(),r=t&&o?.component_key==="tasks_side_app_pin";return(0,Pt.jsx)(Rt,{ariaLabel:"Open tasks",icon:(0,Pt.jsx)(to,{size:16}),onClick:()=>{r||e({component_key:"tasks_side_app_pin",message:"Tasks",data:{component:(0,Pt.jsx)(xo.Suspense,{fallback:(0,Pt.jsx)(ne,{style:{display:"block",margin:"auto"}}),children:(0,Pt.jsx)(hs,{showProjectFilter:!1})})}})}})};var Ut=n(w());var Mn=n(a()),{Text:Jh}=P;var Zh=C(({css:e,token:t})=>({body:e`
1833
+ `}));var kn=n(w());var Ai=n(a());var Ei=n(w());var Ni=n(a()),{Text:Ry,Title:Ty}=P;var bo=n(w());var ho=n(w());var Mi=n(w());var Bi=n(a()),{Text:zy}=P;var Di=n(a()),{Text:Ky}=P;var Rn=n(w());var Tn=n(a()),{Text:eh,Paragraph:th}=P;var Pn=n(a()),{Text:mh}=P;var In=n(w());var zi=n(a()),{Text:hh}=P;var An=n(w());var vo=n(w());var Fi=n(w());var $i=n(a()),{Text:Ih}=P;var En=n(a()),{Text:jh}=P;var wo=n(w());var xo=n(w());var Pt=n(a()),hs=(0,xo.lazy)(()=>import("./embed-page-TasksSideApp-3WRDBZU3.js").then(e=>({default:e.TasksSideApp}))),Nn=()=>{let{openSideApp:e,sideAppVisible:t,sideAppSelectedCard:o}=Se(),r=t&&o?.component_key==="tasks_side_app_pin";return(0,Pt.jsx)(Rt,{ariaLabel:"Open tasks",icon:(0,Pt.jsx)(to,{size:16}),onClick:()=>{r||e({component_key:"tasks_side_app_pin",message:"Tasks",data:{component:(0,Pt.jsx)(xo.Suspense,{fallback:(0,Pt.jsx)(ne,{style:{display:"block",margin:"auto"}}),children:(0,Pt.jsx)(hs,{showProjectFilter:!1})})}})}})};var Ut=n(w());var Mn=n(a()),{Text:Jh}=P;var Zh=C(({css:e,token:t})=>({body:e`
1834
1834
  display: flex;
1835
1835
  height: 460px;
1836
1836
  `,leftPanel:e`
@@ -2131,7 +2131,7 @@ import{a as it,b as Gt,c as Hn,d as qn}from"./embed-page-chunk-GZXI22WX.js";impo
2131
2131
  text-align: center;
2132
2132
  color: ${e.colorTextSecondary};
2133
2133
  font-size: 12px;
2134
- `})),Dn=()=>{let{styles:e}=bs(),{threads:t,threadId:o,selectThread:r,deleteThread:s,updateThread:i,isLoading:d}=tt(),[c,p]=(0,ve.useState)(null),[g,v]=(0,ve.useState)(!1),[x,h]=(0,ve.useState)(null),[u,m]=(0,ve.useState)(""),[b,O]=(0,ve.useState)(!1),[L,N]=(0,ve.useState)(""),[X,ee]=(0,ve.useState)("updated"),[de,Q]=(0,ve.useState)("desc"),S=(0,ve.useRef)(!1),B=(0,ve.useRef)(!1),J=(0,ve.useCallback)((R,I)=>{R.stopPropagation(),p(I)},[]),Z=(0,ve.useCallback)(async()=>{if(c){v(!0);try{await s(c),q.success("Conversation deleted"),p(null)}catch{q.error("Failed to delete conversation")}finally{v(!1)}}},[c,s]),A=(0,ve.useCallback)((R,I)=>{R.stopPropagation(),h(I.id),m(I.label)},[]),ae=(0,ve.useCallback)(async R=>{if(B.current)return;let I=u.trim();if(!I||I===R.label){h(null);return}B.current=!0,O(!0);try{await i({...R,label:I}),q.success("Conversation renamed")}catch{q.error("Failed to rename conversation")}finally{B.current=!1,O(!1),h(null)}},[u,i]),D=(0,ve.useCallback)(()=>{S.current=!0,h(null)},[]),$=(0,ve.useCallback)(R=>{R.key==="Enter"?(R.preventDefault(),R.currentTarget.blur()):R.key==="Escape"&&(R.preventDefault(),D())},[D]),se=(0,ve.useCallback)(R=>{if(S.current){S.current=!1;return}ae(R)},[ae]),_=ve.default.useMemo(()=>Oi(_i(t,L),X,de),[t,L,X,de]);return(0,V.jsxs)("div",{className:e.container,children:[(0,V.jsxs)("div",{className:e.toolbar,children:[(0,V.jsx)(H,{size:"small",placeholder:"Search conversations\u2026",allowClear:!0,value:L,onChange:R=>N(R.target.value)}),(0,V.jsxs)("div",{className:e.toolbarRow,children:[(0,V.jsx)(Ee,{size:"small",style:{flex:1,minWidth:0},value:X,onChange:R=>ee(R),options:[{value:"name",label:"Name"},{value:"updated",label:"Updated"},{value:"created",label:"Created"}]}),(0,V.jsx)(F,{size:"small",icon:de==="asc"?(0,V.jsx)(Xt,{}):(0,V.jsx)(Jt,{}),onClick:()=>Q(R=>R==="asc"?"desc":"asc"),title:de==="asc"?"Ascending":"Descending"})]})]}),d?(0,V.jsx)("div",{className:e.loading,children:"Loading conversations..."}):_.length===0?(0,V.jsx)("div",{className:e.emptyState,children:L.trim()?`No conversations match "${L.trim()}"`:"No conversations yet"}):(0,V.jsx)("div",{className:e.threadList,children:_.map(R=>(0,V.jsxs)("div",{className:`${e.threadItem} ${R.id===o?"active":""}`,onClick:()=>r(R.id),title:R.label,children:[(0,V.jsx)("div",{className:e.threadIcon,children:(0,V.jsx)(xr,{size:14})}),x===R.id?(0,V.jsx)("input",{className:e.renameInput,"aria-label":"Conversation name",value:u,autoFocus:!0,disabled:b,onClick:I=>I.stopPropagation(),onFocus:I=>I.target.select(),onChange:I=>m(I.target.value),onKeyDown:I=>$(I),onBlur:()=>se(R)}):(0,V.jsx)("div",{className:R.id===o?e.threadNameActive:e.threadName,children:R.label}),x===R.id?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)("button",{className:`${e.actionBtn} ${e.actionBtnVisible}`,title:"Save name",disabled:b,onMouseDown:I=>I.preventDefault(),onClick:I=>{I.stopPropagation(),ae(R)},children:(0,V.jsx)(pr,{size:12})}),(0,V.jsx)("button",{className:`${e.actionBtn} ${e.actionBtnVisible}`,title:"Cancel rename",disabled:b,onMouseDown:I=>I.preventDefault(),onClick:I=>{I.stopPropagation(),D()},children:(0,V.jsx)(Bt,{size:12})})]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)("button",{className:e.actionBtn,onClick:I=>A(I,R),title:"Rename conversation",children:(0,V.jsx)(Cr,{size:12})}),(0,V.jsx)("button",{className:e.actionBtn,onClick:I=>J(I,R.id),title:"Delete conversation",children:(0,V.jsx)(Tr,{size:12})})]})]},R.id))}),(0,V.jsx)(pe,{title:"Delete Conversation",open:c!==null,onCancel:()=>p(null),onOk:Z,okText:"Delete",okButtonProps:{danger:!0,loading:g},cancelText:"Cancel",children:(0,V.jsx)("p",{children:"Are you sure you want to delete this conversation? This action cannot be undone."})})]})};var Ui=n(a());var Hi=n(a());var qi=n(w());var Vi=n(a()),{Text:nv}=P;var ks=n(w());var zn=n(w());var Gi=n(a()),{Text:cv}=P;var Ss=n(w());var Cs=n(w());var Fn=n(a());var $n=n(a()),{Dragger:bv}=Un,{Text:vv,Title:xv}=P;var Qi=n(a()),{Title:Iv,Text:Av}=P;var ye=n(a()),Yi=[{id:"personal_assistant",type:"route",name:"Personal Assistant",icon:(0,ye.jsx)(Nt,{size:20}),order:-10},{id:"workspace_projects",type:"route",name:"Projects",icon:(0,ye.jsx)(at,{size:20}),order:0},{id:"metrics",builtin:"metrics",type:"route",name:"Metrics",icon:(0,ye.jsx)(Zt,{size:20}),order:10,group:"DataSource"},{id:"database",builtin:"database",type:"route",name:"Database",icon:(0,ye.jsx)(ur,{size:20}),order:20,group:"DataSource"},{id:"connections",builtin:"connections",type:"route",name:"Plugins",icon:(0,ye.jsx)(_o,{size:20}),order:21},{id:"topology-runtimes",type:"route",name:"Runtime",icon:(0,ye.jsx)(kt,{size:20}),order:26,group:"Process"},{id:"topology-inbox",type:"route",name:"Inbox",icon:(0,ye.jsx)(hr,{size:20}),order:27,group:"Process"},{id:"workflows",type:"route",name:"Automations",icon:(0,ye.jsx)(Oo,{size:20}),order:25,group:"Process"},{id:"shares",type:"route",name:"Shares",icon:(0,ye.jsx)(Oo,{size:20}),order:55,group:"Settings"},{id:"workspace_migration",type:"route",name:"Migration",icon:(0,ye.jsx)(cr,{size:20}),order:56,group:"Settings"},{id:"eval",type:"route",name:"Eval",icon:(0,ye.jsx)(fr,{size:20}),order:28,group:"Process"},{id:"assistants",builtin:"assistants",type:"route",name:"Assistants",icon:(0,ye.jsx)(Nt,{size:20}),order:30,group:"Settings"},{id:"skills",builtin:"skills",type:"route",name:"Skills",icon:(0,ye.jsx)(Ar,{size:20}),order:35,group:"Settings"},{id:"collections",type:"route",name:"Collections",icon:(0,ye.jsx)(vr,{size:20}),order:29,group:"Knowledge"},{id:"mcp",builtin:"mcp",type:"route",name:"MCP",icon:(0,ye.jsx)(_o,{size:20}),order:40,group:"Settings"},{id:"a2a-keys",type:"route",name:"API Keys",icon:(0,ye.jsx)(br,{size:20}),order:45,group:"Settings"},{id:"open-audit",type:"route",name:"Audit Log",icon:(0,ye.jsx)(kt,{size:20}),order:47,group:"Settings"},{id:"capability-bundles",type:"route",name:"Runtime Profiles",icon:(0,ye.jsx)(Rr,{size:20}),order:46,group:"Settings"},{id:"tools",builtin:"tools",type:"route",name:"Tools",icon:(0,ye.jsx)(Ir,{size:20}),order:50,group:"Settings"},{id:"tasks",type:"route",name:"Tasks",icon:(0,ye.jsx)(to,{size:20}),order:100}];var Vx=(0,Ue.lazy)(()=>import("./embed-page-AgentGovernanceWorkbench-M4H7NQNZ.js").then(e=>({default:e.AgentGovernanceWorkbench}))),Gx=(0,Ue.lazy)(()=>import("./embed-page-TopologyRuntimeView-JCAZCHS7.js").then(e=>({default:e.TopologyRuntimeView}))),Qx=(0,Ue.lazy)(()=>import("./embed-page-WorkflowAutomationView-4MAB62HK.js").then(e=>({default:e.WorkflowAutomationView}))),Yx=(0,Ue.lazy)(()=>import("./embed-page-TasksSideApp-LJDTRCAB.js").then(e=>({default:e.TasksSideApp}))),Xx=(0,Ue.lazy)(()=>import("./embed-page-AgentDetailSideApp-2LI6OOO7.js").then(e=>({default:e.AgentDetailSideApp})));var Ne=n(a());function Rs(e){let{contentType:t,assistantId:o,contentConfig:r,workspaceId:s,projectId:i}=e;return t==="agent"?{agentId:o,workspaceId:s||void 0,projectId:i||void 0}:{...r,workspaceId:s||void 0,projectId:i||void 0}}async function Ts(e,t,o){let{contentType:r,assistantId:s,contentConfig:i,isMatch:d}=t;if(!(r==="agent"?!!s:!!i)||!o)return{isPinned:!1,pinnedId:null};let p=await e("/api/menu-items?menuTarget=workspace");if(p.success&&p.data?.records){let g=d??(x=>r==="agent"&&x.agentId===s),v=p.data.records.find(x=>x.contentType===r&&g(x.contentConfig));if(v)return{isPinned:!0,pinnedId:v.id}}return{isPinned:!1,pinnedId:null}}async function Ps(e,t){let{contentType:o,name:r,group:s}=t,i=Rs(t),d={menuTarget:"workspace",contentType:o,contentConfig:i,group:s?.trim()||void 0,name:r.trim(),sortOrder:0},c=await e("/api/menu-items",d);if(!c.success)throw new Error(c.message||"Failed to pin");return{id:c.data.id}}async function Is(e,t){let o=await e(`/api/menu-items/${t}`);if(!o.success)throw new Error(o.message||"Failed to unpin")}function po(){let e=he.default.useContext(Er),{config:t}=Ce(),{post:o,get:r,del:s}=me(),i=t.enableCustomMenu??!1,d=(0,he.useCallback)(async g=>Ts(r,g,i),[r,i]),c=(0,he.useCallback)(async g=>Ps(o,{...g,workspaceId:e?.workspaceId,projectId:e?.projectId}),[o,e]),p=(0,he.useCallback)(async g=>Is(s,g),[s]);return{check:d,pin:c,unpin:p,enableCustomMenu:i,get:r}}function Xi(e){let t=new Set;for(let o of e)o.group?.trim()&&t.add(o.group.trim());return Array.from(t).sort()}function rn(){let{config:e}=Ce(),t=he.default.useMemo(()=>Xi(Yi),[]),o=he.default.useMemo(()=>Xi(e.workspaceMenuItems??[]),[e.workspaceMenuItems]);return he.default.useMemo(()=>Array.from(new Set([...t,...o])).sort(),[t,o])}async function an(e){let t=await e("/api/menu-items?menuTarget=workspace");if(t.success&&t.data?.records){let o=new Set;for(let r of t.data.records)r.group?.trim()&&o.add(r.group.trim());return Array.from(o).sort()}return[]}var As={display:"flex",flexDirection:"column",gap:12},Cn=({assistantId:e,contentType:t="agent",contentConfig:o,isMatch:r,size:s="small",label:i,block:d})=>{let{check:c,pin:p,unpin:g,enableCustomMenu:v,get:x}=po(),[h,u]=(0,he.useState)(!1),[m,b]=(0,he.useState)(""),[O,L]=(0,he.useState)(""),[N,X]=(0,he.useState)(!1),[ee,de]=(0,he.useState)(!1),[Q,S]=(0,he.useState)(null),[B,J]=(0,he.useState)(!0),Z=rn(),[A,ae]=(0,he.useState)(Z);(0,he.useEffect)(()=>{ae(Z)},[Z]),(0,he.useEffect)(()=>{h&&an(x).then(I=>{ae(Array.from(new Set([...Z,...I])).sort())})},[h]);let D=t==="agent"?!!e:!!o,$=(0,he.useCallback)(async()=>{if(!D||!v){J(!1);return}J(!0);try{let I=await c({contentType:t,assistantId:e,contentConfig:o,isMatch:r});de(I.isPinned),S(I.pinnedId)}catch{}finally{J(!1)}},[D,v,c,t,e,o,r]);if((0,he.useEffect)(()=>{$()},[$]),!D||!v)return null;let se=async()=>{if(!O.trim()){q.warning("Please enter a menu name");return}X(!0);try{await p({contentType:t,assistantId:e,contentConfig:o,isMatch:r,name:O.trim(),group:m.trim()||void 0}),q.success("Pinned to menu"),window.dispatchEvent(new CustomEvent("menu:refresh")),u(!1),b(""),L(""),$()}catch(I){q.error(I.message||"Failed to pin to menu")}finally{X(!1)}},_=async()=>{if(Q){X(!0);try{await g(Q),q.success("Unpinned from menu"),window.dispatchEvent(new CustomEvent("menu:refresh")),de(!1),S(null)}catch(I){q.error(I.message||"Failed to unpin from menu")}finally{X(!1)}}},R=()=>{ee?_():u(!0)};return(0,Ne.jsxs)(Ne.Fragment,{children:[(0,Ne.jsx)(Fe,{title:ee?"Unpin from Menu":"Pin to Menu",children:i?(0,Ne.jsx)(F,{type:"text",size:s,block:d,icon:ee?(0,Ne.jsx)(Ve,{size:14,fill:"currentColor"}):(0,Ne.jsx)(Ve,{size:14}),onClick:R,loading:B||N&&ee,children:i}):(0,Ne.jsx)(F,{type:"text",size:s,block:d,icon:ee?(0,Ne.jsx)(Ve,{size:14,fill:"currentColor"}):(0,Ne.jsx)(Ve,{size:14}),onClick:R,loading:B||N&&ee})}),(0,Ne.jsx)(pe,{title:"Pin to Menu",open:h,onOk:se,onCancel:()=>u(!1),confirmLoading:N,okText:"Pin",children:(0,Ne.jsxs)("div",{style:As,children:[(0,Ne.jsx)(H,{placeholder:"Menu name (required)",value:O,onChange:I=>L(I.target.value)}),(0,Ne.jsx)(Vt,{placeholder:"Group (optional, select or type new)",value:m,options:A.map(I=>({value:I})),onChange:I=>b(I),filterOption:(I,T)=>T?.value?.toUpperCase().includes(I.toUpperCase())??!1})]})})]})};var ie=n(w());var G=n(a()),jn=50,Es=C(({token:e,css:t})=>({container:t`
2134
+ `})),Dn=()=>{let{styles:e}=bs(),{threads:t,threadId:o,selectThread:r,deleteThread:s,updateThread:i,isLoading:d}=tt(),[c,p]=(0,ve.useState)(null),[g,v]=(0,ve.useState)(!1),[x,h]=(0,ve.useState)(null),[u,m]=(0,ve.useState)(""),[b,O]=(0,ve.useState)(!1),[L,N]=(0,ve.useState)(""),[X,ee]=(0,ve.useState)("updated"),[de,Q]=(0,ve.useState)("desc"),S=(0,ve.useRef)(!1),B=(0,ve.useRef)(!1),J=(0,ve.useCallback)((R,I)=>{R.stopPropagation(),p(I)},[]),Z=(0,ve.useCallback)(async()=>{if(c){v(!0);try{await s(c),q.success("Conversation deleted"),p(null)}catch{q.error("Failed to delete conversation")}finally{v(!1)}}},[c,s]),A=(0,ve.useCallback)((R,I)=>{R.stopPropagation(),h(I.id),m(I.label)},[]),ae=(0,ve.useCallback)(async R=>{if(B.current)return;let I=u.trim();if(!I||I===R.label){h(null);return}B.current=!0,O(!0);try{await i({...R,label:I}),q.success("Conversation renamed")}catch{q.error("Failed to rename conversation")}finally{B.current=!1,O(!1),h(null)}},[u,i]),D=(0,ve.useCallback)(()=>{S.current=!0,h(null)},[]),$=(0,ve.useCallback)(R=>{R.key==="Enter"?(R.preventDefault(),R.currentTarget.blur()):R.key==="Escape"&&(R.preventDefault(),D())},[D]),se=(0,ve.useCallback)(R=>{if(S.current){S.current=!1;return}ae(R)},[ae]),_=ve.default.useMemo(()=>Oi(_i(t,L),X,de),[t,L,X,de]);return(0,V.jsxs)("div",{className:e.container,children:[(0,V.jsxs)("div",{className:e.toolbar,children:[(0,V.jsx)(H,{size:"small",placeholder:"Search conversations\u2026",allowClear:!0,value:L,onChange:R=>N(R.target.value)}),(0,V.jsxs)("div",{className:e.toolbarRow,children:[(0,V.jsx)(Ee,{size:"small",style:{flex:1,minWidth:0},value:X,onChange:R=>ee(R),options:[{value:"name",label:"Name"},{value:"updated",label:"Updated"},{value:"created",label:"Created"}]}),(0,V.jsx)(F,{size:"small",icon:de==="asc"?(0,V.jsx)(Xt,{}):(0,V.jsx)(Jt,{}),onClick:()=>Q(R=>R==="asc"?"desc":"asc"),title:de==="asc"?"Ascending":"Descending"})]})]}),d?(0,V.jsx)("div",{className:e.loading,children:"Loading conversations..."}):_.length===0?(0,V.jsx)("div",{className:e.emptyState,children:L.trim()?`No conversations match "${L.trim()}"`:"No conversations yet"}):(0,V.jsx)("div",{className:e.threadList,children:_.map(R=>(0,V.jsxs)("div",{className:`${e.threadItem} ${R.id===o?"active":""}`,onClick:()=>r(R.id),title:R.label,children:[(0,V.jsx)("div",{className:e.threadIcon,children:(0,V.jsx)(xr,{size:14})}),x===R.id?(0,V.jsx)("input",{className:e.renameInput,"aria-label":"Conversation name",value:u,autoFocus:!0,disabled:b,onClick:I=>I.stopPropagation(),onFocus:I=>I.target.select(),onChange:I=>m(I.target.value),onKeyDown:I=>$(I),onBlur:()=>se(R)}):(0,V.jsx)("div",{className:R.id===o?e.threadNameActive:e.threadName,children:R.label}),x===R.id?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)("button",{className:`${e.actionBtn} ${e.actionBtnVisible}`,title:"Save name",disabled:b,onMouseDown:I=>I.preventDefault(),onClick:I=>{I.stopPropagation(),ae(R)},children:(0,V.jsx)(pr,{size:12})}),(0,V.jsx)("button",{className:`${e.actionBtn} ${e.actionBtnVisible}`,title:"Cancel rename",disabled:b,onMouseDown:I=>I.preventDefault(),onClick:I=>{I.stopPropagation(),D()},children:(0,V.jsx)(Bt,{size:12})})]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)("button",{className:e.actionBtn,onClick:I=>A(I,R),title:"Rename conversation",children:(0,V.jsx)(Cr,{size:12})}),(0,V.jsx)("button",{className:e.actionBtn,onClick:I=>J(I,R.id),title:"Delete conversation",children:(0,V.jsx)(Tr,{size:12})})]})]},R.id))}),(0,V.jsx)(pe,{title:"Delete Conversation",open:c!==null,onCancel:()=>p(null),onOk:Z,okText:"Delete",okButtonProps:{danger:!0,loading:g},cancelText:"Cancel",children:(0,V.jsx)("p",{children:"Are you sure you want to delete this conversation? This action cannot be undone."})})]})};var Ui=n(a());var Hi=n(a());var qi=n(w());var Vi=n(a()),{Text:nv}=P;var ks=n(w());var zn=n(w());var Gi=n(a()),{Text:cv}=P;var Ss=n(w());var Cs=n(w());var Fn=n(a());var $n=n(a()),{Dragger:bv}=Un,{Text:vv,Title:xv}=P;var Qi=n(a()),{Title:Iv,Text:Av}=P;var ye=n(a()),Yi=[{id:"personal_assistant",type:"route",name:"Personal Assistant",icon:(0,ye.jsx)(Nt,{size:20}),order:-10},{id:"workspace_projects",type:"route",name:"Projects",icon:(0,ye.jsx)(at,{size:20}),order:0},{id:"metrics",builtin:"metrics",type:"route",name:"Metrics",icon:(0,ye.jsx)(Zt,{size:20}),order:10,group:"DataSource"},{id:"database",builtin:"database",type:"route",name:"Database",icon:(0,ye.jsx)(ur,{size:20}),order:20,group:"DataSource"},{id:"connections",builtin:"connections",type:"route",name:"Plugins",icon:(0,ye.jsx)(_o,{size:20}),order:21},{id:"topology-runtimes",type:"route",name:"Runtime",icon:(0,ye.jsx)(kt,{size:20}),order:26,group:"Process"},{id:"topology-inbox",type:"route",name:"Inbox",icon:(0,ye.jsx)(hr,{size:20}),order:27,group:"Process"},{id:"workflows",type:"route",name:"Automations",icon:(0,ye.jsx)(Oo,{size:20}),order:25,group:"Process"},{id:"shares",type:"route",name:"Shares",icon:(0,ye.jsx)(Oo,{size:20}),order:55,group:"Settings"},{id:"workspace_migration",type:"route",name:"Migration",icon:(0,ye.jsx)(cr,{size:20}),order:56,group:"Settings"},{id:"eval",type:"route",name:"Eval",icon:(0,ye.jsx)(fr,{size:20}),order:28,group:"Process"},{id:"assistants",builtin:"assistants",type:"route",name:"Assistants",icon:(0,ye.jsx)(Nt,{size:20}),order:30,group:"Settings"},{id:"skills",builtin:"skills",type:"route",name:"Skills",icon:(0,ye.jsx)(Ar,{size:20}),order:35,group:"Settings"},{id:"collections",type:"route",name:"Collections",icon:(0,ye.jsx)(vr,{size:20}),order:29,group:"Knowledge"},{id:"mcp",builtin:"mcp",type:"route",name:"MCP",icon:(0,ye.jsx)(_o,{size:20}),order:40,group:"Settings"},{id:"a2a-keys",type:"route",name:"API Keys",icon:(0,ye.jsx)(br,{size:20}),order:45,group:"Settings"},{id:"open-audit",type:"route",name:"Audit Log",icon:(0,ye.jsx)(kt,{size:20}),order:47,group:"Settings"},{id:"capability-bundles",type:"route",name:"Runtime Profiles",icon:(0,ye.jsx)(Rr,{size:20}),order:46,group:"Settings"},{id:"tools",builtin:"tools",type:"route",name:"Tools",icon:(0,ye.jsx)(Ir,{size:20}),order:50,group:"Settings"},{id:"tasks",type:"route",name:"Tasks",icon:(0,ye.jsx)(to,{size:20}),order:100}];var Vx=(0,Ue.lazy)(()=>import("./embed-page-AgentGovernanceWorkbench-K3JUQNBW.js").then(e=>({default:e.AgentGovernanceWorkbench}))),Gx=(0,Ue.lazy)(()=>import("./embed-page-TopologyRuntimeView-YDFENLHH.js").then(e=>({default:e.TopologyRuntimeView}))),Qx=(0,Ue.lazy)(()=>import("./embed-page-WorkflowAutomationView-MP5B7Q2Q.js").then(e=>({default:e.WorkflowAutomationView}))),Yx=(0,Ue.lazy)(()=>import("./embed-page-TasksSideApp-3WRDBZU3.js").then(e=>({default:e.TasksSideApp}))),Xx=(0,Ue.lazy)(()=>import("./embed-page-AgentDetailSideApp-3LBCEKFU.js").then(e=>({default:e.AgentDetailSideApp})));var Ne=n(a());function Rs(e){let{contentType:t,assistantId:o,contentConfig:r,workspaceId:s,projectId:i}=e;return t==="agent"?{agentId:o,workspaceId:s||void 0,projectId:i||void 0}:{...r,workspaceId:s||void 0,projectId:i||void 0}}async function Ts(e,t,o){let{contentType:r,assistantId:s,contentConfig:i,isMatch:d}=t;if(!(r==="agent"?!!s:!!i)||!o)return{isPinned:!1,pinnedId:null};let p=await e("/api/menu-items?menuTarget=workspace");if(p.success&&p.data?.records){let g=d??(x=>r==="agent"&&x.agentId===s),v=p.data.records.find(x=>x.contentType===r&&g(x.contentConfig));if(v)return{isPinned:!0,pinnedId:v.id}}return{isPinned:!1,pinnedId:null}}async function Ps(e,t){let{contentType:o,name:r,group:s}=t,i=Rs(t),d={menuTarget:"workspace",contentType:o,contentConfig:i,group:s?.trim()||void 0,name:r.trim(),sortOrder:0},c=await e("/api/menu-items",d);if(!c.success)throw new Error(c.message||"Failed to pin");return{id:c.data.id}}async function Is(e,t){let o=await e(`/api/menu-items/${t}`);if(!o.success)throw new Error(o.message||"Failed to unpin")}function po(){let e=he.default.useContext(Er),{config:t}=Ce(),{post:o,get:r,del:s}=me(),i=t.enableCustomMenu??!1,d=(0,he.useCallback)(async g=>Ts(r,g,i),[r,i]),c=(0,he.useCallback)(async g=>Ps(o,{...g,workspaceId:e?.workspaceId,projectId:e?.projectId}),[o,e]),p=(0,he.useCallback)(async g=>Is(s,g),[s]);return{check:d,pin:c,unpin:p,enableCustomMenu:i,get:r}}function Xi(e){let t=new Set;for(let o of e)o.group?.trim()&&t.add(o.group.trim());return Array.from(t).sort()}function rn(){let{config:e}=Ce(),t=he.default.useMemo(()=>Xi(Yi),[]),o=he.default.useMemo(()=>Xi(e.workspaceMenuItems??[]),[e.workspaceMenuItems]);return he.default.useMemo(()=>Array.from(new Set([...t,...o])).sort(),[t,o])}async function an(e){let t=await e("/api/menu-items?menuTarget=workspace");if(t.success&&t.data?.records){let o=new Set;for(let r of t.data.records)r.group?.trim()&&o.add(r.group.trim());return Array.from(o).sort()}return[]}var As={display:"flex",flexDirection:"column",gap:12},Cn=({assistantId:e,contentType:t="agent",contentConfig:o,isMatch:r,size:s="small",label:i,block:d})=>{let{check:c,pin:p,unpin:g,enableCustomMenu:v,get:x}=po(),[h,u]=(0,he.useState)(!1),[m,b]=(0,he.useState)(""),[O,L]=(0,he.useState)(""),[N,X]=(0,he.useState)(!1),[ee,de]=(0,he.useState)(!1),[Q,S]=(0,he.useState)(null),[B,J]=(0,he.useState)(!0),Z=rn(),[A,ae]=(0,he.useState)(Z);(0,he.useEffect)(()=>{ae(Z)},[Z]),(0,he.useEffect)(()=>{h&&an(x).then(I=>{ae(Array.from(new Set([...Z,...I])).sort())})},[h]);let D=t==="agent"?!!e:!!o,$=(0,he.useCallback)(async()=>{if(!D||!v){J(!1);return}J(!0);try{let I=await c({contentType:t,assistantId:e,contentConfig:o,isMatch:r});de(I.isPinned),S(I.pinnedId)}catch{}finally{J(!1)}},[D,v,c,t,e,o,r]);if((0,he.useEffect)(()=>{$()},[$]),!D||!v)return null;let se=async()=>{if(!O.trim()){q.warning("Please enter a menu name");return}X(!0);try{await p({contentType:t,assistantId:e,contentConfig:o,isMatch:r,name:O.trim(),group:m.trim()||void 0}),q.success("Pinned to menu"),window.dispatchEvent(new CustomEvent("menu:refresh")),u(!1),b(""),L(""),$()}catch(I){q.error(I.message||"Failed to pin to menu")}finally{X(!1)}},_=async()=>{if(Q){X(!0);try{await g(Q),q.success("Unpinned from menu"),window.dispatchEvent(new CustomEvent("menu:refresh")),de(!1),S(null)}catch(I){q.error(I.message||"Failed to unpin from menu")}finally{X(!1)}}},R=()=>{ee?_():u(!0)};return(0,Ne.jsxs)(Ne.Fragment,{children:[(0,Ne.jsx)(Fe,{title:ee?"Unpin from Menu":"Pin to Menu",children:i?(0,Ne.jsx)(F,{type:"text",size:s,block:d,icon:ee?(0,Ne.jsx)(Ve,{size:14,fill:"currentColor"}):(0,Ne.jsx)(Ve,{size:14}),onClick:R,loading:B||N&&ee,children:i}):(0,Ne.jsx)(F,{type:"text",size:s,block:d,icon:ee?(0,Ne.jsx)(Ve,{size:14,fill:"currentColor"}):(0,Ne.jsx)(Ve,{size:14}),onClick:R,loading:B||N&&ee})}),(0,Ne.jsx)(pe,{title:"Pin to Menu",open:h,onOk:se,onCancel:()=>u(!1),confirmLoading:N,okText:"Pin",children:(0,Ne.jsxs)("div",{style:As,children:[(0,Ne.jsx)(H,{placeholder:"Menu name (required)",value:O,onChange:I=>L(I.target.value)}),(0,Ne.jsx)(Vt,{placeholder:"Group (optional, select or type new)",value:m,options:A.map(I=>({value:I})),onChange:I=>b(I),filterOption:(I,T)=>T?.value?.toUpperCase().includes(I.toUpperCase())??!1})]})})]})};var ie=n(w());var G=n(a()),jn=50,Es=C(({token:e,css:t})=>({container:t`
2135
2135
  position: relative;
2136
2136
  `,projectTrigger:t`
2137
2137
  display: flex;
@@ -1,4 +1,4 @@
1
- import{e as Mi}from"./embed-page-chunk-Z6HFQXM5.js";import{a as dr,b as Cn}from"./embed-page-chunk-7LQKELZI.js";import{b as _i,c as zi}from"./embed-page-chunk-DFJ7Y4ID.js";import{c as bo,d as vo}from"./embed-page-chunk-KEL6XU6R.js";import{b as ot,c as Ai,d as yo,e as wt,f as ho,g as Ei,h as Rn,i as In,j as Pi,l as Di,m as Li}from"./embed-page-chunk-AC6X2XRH.js";import{a as xi,b as To,c as Oi,d as Fi,e as Ro,f as lr,g as Wi,h as Bi}from"./embed-page-chunk-HCLU6MDW.js";import{e as Ni,f as ko,g as wo,h as xo}from"./embed-page-chunk-GZXI22WX.js";import{a as Sn}from"./embed-page-chunk-UVYHBMEW.js";import{$a as fo,C as ai,Da as po,E as si,Ea as vi,F as li,Fa as ki,H as di,Ha as wi,I as ci,Ja as Ct,K as uo,S as ui,Va as xn,Za as Tn,_a as go,ab as Ti,bb as Ri,eb as Ii,fb as Si,g as oi,gb as Ci,ha as pi,hb as mo,i as ri,ia as gi,j as Gn,ja as fi,la as mi,ma as yi,sa as hi,u as ii,ya as bi}from"./embed-page-chunk-E46G4ZHX.js";import{b as Ur,i as Zr,l as mt,p as ao,q as Ve}from"./embed-page-chunk-J2VPD2GD.js";import{a as z}from"./embed-page-chunk-MB65DZAX.js";import{Cb as lo,Db as Jr,Dc as ei,Fc as ti,Gc as ar,Ha as io,Hc as sr,Ia as qe,Ja as Kr,La as _e,Ma as Hr,Sc as ni,Tb as ir,U as Ht,W as oe,Wa as Vr,Y as wn,Z as Ot,_ as ft,aa as Ut,ca as or,da as rr,eb as Qr,fa as Gr,fc as co,ia as dn,la as $r,mb as Yr,na as qr,oa as Ft,ob as Xr,ra as fe,ta as Fe,tb as so,va as kt,xa as nt,ya as We,yc as Zt}from"./embed-page-chunk-O4QK5LWZ.js";import{a as Te}from"./embed-page-chunk-4BKXE5ON.js";import{e as T}from"./embed-page-chunk-6Y3UYJ6Z.js";var Ws={react:{label:"capability",color:"blue"},capability:{label:"capability",color:"blue"},deep_agent:{label:"orchestrator",color:"orange"},orchestrator:{label:"orchestrator",color:"orange"},team:{label:"team",color:"green"},processing:{label:"workflow",color:"purple"},workflow:{label:"workflow",color:"purple"},a2a_remote:{label:"remote",color:"cyan"},remote:{label:"remote",color:"cyan"}};function An(e){return Ws[e]??{label:"capability",color:"blue"}}var _s={enabled:"green",draft:"orange",disabled:"default"};function Gi(e){return _s[e]??"default"}var ji={blue:"#3b82f6",orange:"#f59e0b",green:"#22c55e",purple:"#a855f7",cyan:"#06b6d4"};function $n(e){return ji[e]??ji.cyan}function Bd(e){let t={enabled:"#22c55e",draft:"#f59e0b",disabled:"#d9d9d9"};return t[e]??t.disabled}function En(e){return typeof e.graphDefinition=="object"&&e.graphDefinition!==null?e.graphDefinition:{}}function ur(e){return((En(e).metadata??{}).tags??"").split(",").map(r=>r.trim()).filter(Boolean)}function pr(e){let o=(En(e).metadata??{}).version;return o?o.startsWith("v")?o:`v${o}`:"v1"}function gr(e){let o=(En(e).metadata??{}).status??"enabled";return o==="draft"||o==="disabled"?o:"enabled"}function cr(e){let n=En(e).subAgents??[],o=Array.isArray(n)?n.filter(Boolean):[];return Array.from(new Set(o))}function jd(e){return e.map(t=>{let n=En(t),o=String(n.type??"react");return{id:t.id,name:t.name,description:t.description,type:An(o).label,tags:ur(t),version:pr(t),status:gr(t),subAgents:cr(t)}})}function Gd(e){let t=new Set(e.map(r=>r.id)),n=e.map(r=>({id:r.id,label:r.name,type:An(String(En(r).type??"react")).label,subAgentCount:cr(r).length})),o=[];for(let r of e)for(let i of cr(r))t.has(i)&&o.push({source:r.id,target:i});return{nodes:n,edges:o}}var Re=T(Te());var ee=T(Te());var h=T(z()),{TextArea:zs}=Fe,{Text:xt}=_e,$i=["data","execution","workflow","assistant"],Bs={data:"Data & Knowledge",execution:"Execution & Interaction",workflow:"Workflow & Orchestration",assistant:"Assistant & Evaluation",other:"Other"},qn=(e,t)=>{if(Array.isArray(e)){let n=e.map(o=>qn(o));return(t==="tools"||t==="subAgents")&&n.every(o=>typeof o=="string")?[...n].sort():n}return e!==null&&typeof e=="object"?Object.fromEntries(Object.entries(e).sort(([n],[o])=>n.localeCompare(o)).map(([n,o])=>[n,qn(o,n)])):e},qi=e=>{if(typeof e!="string")return qn(e??null);try{return qn(JSON.parse(e))}catch{return e}},Ki=e=>JSON.stringify(qn({...e,tools:[...e.tools].sort(),subAgents:[...e.subAgents].sort()})),js=wi(({token:e,css:t})=>({modalBody:t`
1
+ import{e as Mi}from"./embed-page-chunk-PAJ5NG2Z.js";import{a as dr,b as Cn}from"./embed-page-chunk-UOL6CUAL.js";import{b as _i,c as zi}from"./embed-page-chunk-QEYWJHEK.js";import{c as bo,d as vo}from"./embed-page-chunk-KEL6XU6R.js";import{b as ot,c as Ai,d as yo,e as wt,f as ho,g as Ei,h as Rn,i as In,j as Pi,l as Di,m as Li}from"./embed-page-chunk-AC6X2XRH.js";import{a as xi,b as To,c as Oi,d as Fi,e as Ro,f as lr,g as Wi,h as Bi}from"./embed-page-chunk-GDTBDOUE.js";import{e as Ni,f as ko,g as wo,h as xo}from"./embed-page-chunk-B2E2XOH2.js";import{a as Sn}from"./embed-page-chunk-FFO7CAYL.js";import{$a as fo,C as ai,Da as po,E as si,Ea as vi,F as li,Fa as ki,H as di,Ha as wi,I as ci,Ja as Ct,K as uo,S as ui,Va as xn,Za as Tn,_a as go,ab as Ti,bb as Ri,eb as Ii,fb as Si,g as oi,gb as Ci,ha as pi,hb as mo,i as ri,ia as gi,j as Gn,ja as fi,la as mi,ma as yi,sa as hi,u as ii,ya as bi}from"./embed-page-chunk-YMJGPA3F.js";import{b as Ur,i as Zr,l as mt,p as ao,q as Ve}from"./embed-page-chunk-URNZX66S.js";import{a as z}from"./embed-page-chunk-MB65DZAX.js";import{Cb as lo,Db as Jr,Dc as ei,Fc as ti,Gc as ar,Ha as io,Hc as sr,Ia as qe,Ja as Kr,La as _e,Ma as Hr,Sc as ni,Tb as ir,U as Ht,W as oe,Wa as Vr,Y as wn,Z as Ot,_ as ft,aa as Ut,ca as or,da as rr,eb as Qr,fa as Gr,fc as co,ia as dn,la as $r,mb as Yr,na as qr,oa as Ft,ob as Xr,ra as fe,ta as Fe,tb as so,va as kt,xa as nt,ya as We,yc as Zt}from"./embed-page-chunk-O4QK5LWZ.js";import{a as Te}from"./embed-page-chunk-4BKXE5ON.js";import{e as T}from"./embed-page-chunk-6Y3UYJ6Z.js";var Ws={react:{label:"capability",color:"blue"},capability:{label:"capability",color:"blue"},deep_agent:{label:"orchestrator",color:"orange"},orchestrator:{label:"orchestrator",color:"orange"},team:{label:"team",color:"green"},processing:{label:"workflow",color:"purple"},workflow:{label:"workflow",color:"purple"},a2a_remote:{label:"remote",color:"cyan"},remote:{label:"remote",color:"cyan"}};function An(e){return Ws[e]??{label:"capability",color:"blue"}}var _s={enabled:"green",draft:"orange",disabled:"default"};function Gi(e){return _s[e]??"default"}var ji={blue:"#3b82f6",orange:"#f59e0b",green:"#22c55e",purple:"#a855f7",cyan:"#06b6d4"};function $n(e){return ji[e]??ji.cyan}function Bd(e){let t={enabled:"#22c55e",draft:"#f59e0b",disabled:"#d9d9d9"};return t[e]??t.disabled}function En(e){return typeof e.graphDefinition=="object"&&e.graphDefinition!==null?e.graphDefinition:{}}function ur(e){return((En(e).metadata??{}).tags??"").split(",").map(r=>r.trim()).filter(Boolean)}function pr(e){let o=(En(e).metadata??{}).version;return o?o.startsWith("v")?o:`v${o}`:"v1"}function gr(e){let o=(En(e).metadata??{}).status??"enabled";return o==="draft"||o==="disabled"?o:"enabled"}function cr(e){let n=En(e).subAgents??[],o=Array.isArray(n)?n.filter(Boolean):[];return Array.from(new Set(o))}function jd(e){return e.map(t=>{let n=En(t),o=String(n.type??"react");return{id:t.id,name:t.name,description:t.description,type:An(o).label,tags:ur(t),version:pr(t),status:gr(t),subAgents:cr(t)}})}function Gd(e){let t=new Set(e.map(r=>r.id)),n=e.map(r=>({id:r.id,label:r.name,type:An(String(En(r).type??"react")).label,subAgentCount:cr(r).length})),o=[];for(let r of e)for(let i of cr(r))t.has(i)&&o.push({source:r.id,target:i});return{nodes:n,edges:o}}var Re=T(Te());var ee=T(Te());var h=T(z()),{TextArea:zs}=Fe,{Text:xt}=_e,$i=["data","execution","workflow","assistant"],Bs={data:"Data & Knowledge",execution:"Execution & Interaction",workflow:"Workflow & Orchestration",assistant:"Assistant & Evaluation",other:"Other"},qn=(e,t)=>{if(Array.isArray(e)){let n=e.map(o=>qn(o));return(t==="tools"||t==="subAgents")&&n.every(o=>typeof o=="string")?[...n].sort():n}return e!==null&&typeof e=="object"?Object.fromEntries(Object.entries(e).sort(([n],[o])=>n.localeCompare(o)).map(([n,o])=>[n,qn(o,n)])):e},qi=e=>{if(typeof e!="string")return qn(e??null);try{return qn(JSON.parse(e))}catch{return e}},Ki=e=>JSON.stringify(qn({...e,tools:[...e.tools].sort(),subAgents:[...e.subAgents].sort()})),js=wi(({token:e,css:t})=>({modalBody:t`
2
2
  padding: 0;
3
3
  height: 92vh;
4
4
  width: 100%;
@@ -1,4 +1,4 @@
1
- import{e as T}from"./embed-page-chunk-GZXI22WX.js";import{Ha as L,p as O,r as P}from"./embed-page-chunk-E46G4ZHX.js";import{a as $}from"./embed-page-chunk-MB65DZAX.js";import{Fa as N,La as C,Z as v,va as S}from"./embed-page-chunk-O4QK5LWZ.js";import{a as z}from"./embed-page-chunk-4BKXE5ON.js";import{e as b}from"./embed-page-chunk-6Y3UYJ6Z.js";var u=b(z());var k={pending:"#7A7A7A",in_progress:"#3b82f6",review:"#f59e0b",failed:"#ef4444",interrupted:"#8b5cf6",completed:"#22c55e",cancelled:"#9ca3af"},w={high:{label:"High",color:"#ef4444"},medium:{label:"Medium",color:"#f59e0b"},low:{label:"Low",color:"#22c55e"}},Y=240,V=72;function F(e,o){if(e.parentId&&e.parentId!==e.id&&o.has(e.parentId))return e.parentId;for(let g of e.dependencies??[])if(g!==e.id&&o.has(g))return g}function R(e,o){let c=o?.hideCompleted??!1?e.filter(t=>!T(t.status)):e,m=new Map(c.map(t=>[t.id,t])),a=new Map;for(let t of c)a.set(t.id,F(t,m));let h=new Set;for(let t of a.keys()){if(h.has(t))continue;let f=new Map,l=t,x=0;for(;l!==void 0&&!h.has(l)&&!f.has(l);)f.set(l,x),x+=1,l=a.get(l);if(l!==void 0&&f.has(l)){let i=f.get(l);for(let[s,p]of f)p>=i&&h.add(s)}}for(let t of h)a.set(t,void 0);let r=new Map;for(let t of c)r.set(t.id,[]);for(let t of c){let f=a.get(t.id);f!==void 0&&r.get(f).push(t.id)}let d=t=>({task:m.get(t),children:(r.get(t)??[]).map(d)});return c.filter(t=>a.get(t.id)===void 0).map(t=>d(t.id))}var n=b($()),{Text:B}=C,U=16,j=3,G=L(({css:e,token:o})=>({root:e`
1
+ import{e as T}from"./embed-page-chunk-B2E2XOH2.js";import{Ha as L,p as O,r as P}from"./embed-page-chunk-YMJGPA3F.js";import{a as $}from"./embed-page-chunk-MB65DZAX.js";import{Fa as N,La as C,Z as v,va as S}from"./embed-page-chunk-O4QK5LWZ.js";import{a as z}from"./embed-page-chunk-4BKXE5ON.js";import{e as b}from"./embed-page-chunk-6Y3UYJ6Z.js";var u=b(z());var k={pending:"#7A7A7A",in_progress:"#3b82f6",review:"#f59e0b",failed:"#ef4444",interrupted:"#8b5cf6",completed:"#22c55e",cancelled:"#9ca3af"},w={high:{label:"High",color:"#ef4444"},medium:{label:"Medium",color:"#f59e0b"},low:{label:"Low",color:"#22c55e"}},Y=240,V=72;function F(e,o){if(e.parentId&&e.parentId!==e.id&&o.has(e.parentId))return e.parentId;for(let g of e.dependencies??[])if(g!==e.id&&o.has(g))return g}function R(e,o){let c=o?.hideCompleted??!1?e.filter(t=>!T(t.status)):e,m=new Map(c.map(t=>[t.id,t])),a=new Map;for(let t of c)a.set(t.id,F(t,m));let h=new Set;for(let t of a.keys()){if(h.has(t))continue;let f=new Map,l=t,x=0;for(;l!==void 0&&!h.has(l)&&!f.has(l);)f.set(l,x),x+=1,l=a.get(l);if(l!==void 0&&f.has(l)){let i=f.get(l);for(let[s,p]of f)p>=i&&h.add(s)}}for(let t of h)a.set(t,void 0);let r=new Map;for(let t of c)r.set(t.id,[]);for(let t of c){let f=a.get(t.id);f!==void 0&&r.get(f).push(t.id)}let d=t=>({task:m.get(t),children:(r.get(t)??[]).map(d)});return c.filter(t=>a.get(t.id)===void 0).map(t=>d(t.id))}var n=b($()),{Text:B}=C,U=16,j=3,G=L(({css:e,token:o})=>({root:e`
2
2
  display: flex;
3
3
  flex-direction: column;
4
4
  height: 100%;
@@ -1,4 +1,4 @@
1
- import{b as cn,c as sn,d as _n}from"./embed-page-chunk-KEL6XU6R.js";import{a as ln,b as be,e as Ae,f as vn,h as Cn,i as kn}from"./embed-page-chunk-AC6X2XRH.js";import{A as Me,Aa as wn,Da as Tn,O as xn,Va as on,Z as Sn,ba as bn,ra as An,t as Re,v as mn,y as yn,z as Oe}from"./embed-page-chunk-E46G4ZHX.js";import{a as Xe}from"./embed-page-chunk-MB65DZAX.js";import{Ia as se,La as Ke,Z as fn,aa as ve,ba as dn,fa as gn,va as hn}from"./embed-page-chunk-O4QK5LWZ.js";import{a as or}from"./embed-page-chunk-4BKXE5ON.js";import{e as Le}from"./embed-page-chunk-6Y3UYJ6Z.js";var te=Le(or());var _=Le(Xe());if(typeof document<"u"){let p="workflow-node-spin-keyframes";if(!document.getElementById(p)){let o=document.createElement("style");o.id=p,o.textContent="@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }",document.head.appendChild(o)}}var{Text:ue}=Ke,Ve={opacity:0},Fe={running:{color:"#1677ff",icon:(0,_.jsx)(bn,{size:14,style:{animation:"spin 1s linear infinite"}})},completed:{color:"#52c41a",icon:(0,_.jsx)(Re,{size:14})},failed:{color:"#ff4d4f",icon:(0,_.jsx)(Oe,{size:14})},interrupted:{color:"#faad14",icon:(0,_.jsx)(mn,{size:14})},skipped:{color:"#8c8c8c",icon:(0,_.jsx)(Me,{size:14})}},En={running:"This step is currently executing",completed:"This step completed successfully",failed:"This step encountered an error",interrupted:"This step is waiting for human input",skipped:"This step was skipped (condition not met)"},In={color:"#d9d9d9",icon:(0,_.jsx)(Me,{size:14})},Nn={agent:{color:"#6366f1",bg:"#EEF2FF",border:"#6366f1"},map:{color:"#10b981",bg:"#ECFDF5",border:"#10b981"},terminal:{color:"#64748b",bg:"#F8FAFC",border:"#94a3b8"}},Ln={success:{color:"#22c55e",bg:"#F0FDF4",label:"Success"},failed:{color:"#ef4444",bg:"#FEF2F2",label:"Failed"},__default:{color:"#94a3b8",bg:"#F8FAFC",label:"Stop"}};function lr(p){return(p||"?").split(/[\s_-]+/).filter(Boolean).map(o=>o[0]).join("").toUpperCase().slice(0,2)}function un({schema:p}){let o=p;if(!o||typeof o!="object")return(0,_.jsx)(ue,{type:"secondary",style:{fontSize:11},children:"No schema defined"});let d=o.properties,S=o.required||[],b=o.items,O=l=>l==="string"?"green":l==="number"||l==="integer"?"orange":l==="boolean"?"purple":l==="array"?"cyan":l==="object"?"blue":"default",a=l=>{let u=l.type;if(u==="array"&&l.items){let c=l.items.type;return c?`Array<${c}>`:"Array"}return u||"any"};return(0,_.jsxs)("div",{style:{maxWidth:340,maxHeight:360,overflow:"auto",fontSize:12},children:[d&&(0,_.jsxs)("div",{children:[(0,_.jsx)(ue,{type:"secondary",style:{fontSize:10,textTransform:"uppercase",letterSpacing:.5,display:"block",marginBottom:6},children:"Properties"}),Object.entries(d).map(([l,u])=>{let c=S.includes(l),h=u.description,r=a(u),s=u.properties,w=u.items,I=!!(s||w);return(0,_.jsx)(ve,{title:I?(0,_.jsx)(un,{schema:I?s?u:w:void 0}):h||void 0,placement:"left",overlayStyle:{maxWidth:360},children:(0,_.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"3px 6px",borderRadius:4,marginBottom:2,background:c?"rgba(99,102,241,0.04)":"transparent",cursor:I?"pointer":"default"},children:[(0,_.jsx)(ue,{style:{fontSize:11,fontWeight:c?600:400,fontFamily:"monospace"},children:l}),c&&(0,_.jsx)("span",{style:{color:"#ef4444",fontSize:9},children:"*"}),h&&!I&&(0,_.jsx)(ue,{type:"secondary",style:{fontSize:10,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:h}),(0,_.jsx)(se,{color:O(r),style:{margin:0,fontSize:9,padding:"0 4px",lineHeight:"16px",marginLeft:"auto"},children:r})]})},l)})]}),!d&&b&&(0,_.jsxs)("div",{children:[(0,_.jsx)(ue,{type:"secondary",style:{fontSize:10,textTransform:"uppercase",letterSpacing:.5,display:"block",marginBottom:4},children:"Items"}),(0,_.jsx)(un,{schema:b})]})]})}var Rn=72,cr=3,sr=({data:p})=>{if(!p)return null;let{nodeType:o,name:d,description:S,ref:b,refAgentName:O,refAgentType:a,refDeleted:l,outputKey:u,nodeSchema:c,config:h,status:r,source:s,innerRef:w,inputTemplate:I,ask:B,condition:X,runState:P,pending:L}=p,z=Nn[o]||Nn.agent,k=Ln[r||""]||Ln.__default,j=P?Fe[P.status]||Fe.running:null,M=j?.color,Y=j?.icon,q=r==="success"?(0,_.jsx)(Re,{size:14,color:"#22c55e"}):r==="failed"?(0,_.jsx)(Oe,{size:14,color:"#ef4444"}):(0,_.jsx)(Me,{size:14,color:"#94a3b8"}),ne=r==="success"?(0,_.jsx)(Re,{size:32,color:k.color}):r==="failed"?(0,_.jsx)(Oe,{size:32,color:k.color}):(0,_.jsx)(yn,{size:32,color:k.color}),de=h?.title,ie=h?.maxRetries,oe=h?.timeout,J=h?.batchSize,le=h?.maxConcurrency,V=h?.innerConcurrency,G=P?.selected,U=!!P||L;function E($){return $==null?"-":$<1e3?`${$}ms`:`${($/1e3).toFixed(1)}s`}if(o==="terminal"){let $=k.color,Te=k.bg,ee=k.label,ae=ne;U&&(P?($=M||$,ee=P.status,ae=(0,_.jsx)("span",{style:{fontSize:18},children:Y})):L&&($=In.color,Te="#fafafa",ee="pending",ae=(0,_.jsx)(Me,{size:18,style:{color:In.color}})));let pe=G&&M?`0 4px 16px ${M}30`:"0 2px 8px rgba(0,0,0,0.06)";return(0,_.jsxs)("div",{style:{padding:4,display:"flex",flexDirection:"column",alignItems:"center",opacity:L?.5:1},children:[(0,_.jsx)(Ae,{type:"target",position:be.Top,style:Ve}),(0,_.jsx)(ve,{title:U&&P?En[P.status]:d,children:(0,_.jsx)("div",{style:{width:Rn,height:Rn,borderRadius:"50%",background:Te,border:`${cr}px solid ${L?`${$}80`:$}`,borderStyle:L?"dashed":"solid",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:pe,transition:"all 0.2s ease",cursor:"default"},onMouseEnter:L?void 0:fe=>{fe.currentTarget.style.transform="scale(1.08)",fe.currentTarget.style.boxShadow=`0 4px 16px ${$}30`},onMouseLeave:L?void 0:fe=>{fe.currentTarget.style.transform="scale(1)",fe.currentTarget.style.boxShadow=pe},children:ae})}),(0,_.jsx)(ue,{style:{fontSize:11,color:$,marginTop:6,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.5px"},children:ee}),(0,_.jsx)(Ae,{type:"source",position:be.Bottom,style:Ve})]})}let ge=U&&M?M:z.border,ce=U&&M?M:z.color,_e=o==="agent"?(0,_.jsx)(Tn,{size:14}):o==="map"?(0,_.jsx)(An,{size:14}):lr(d),he=P?E(P.durationMs):null,Ce=G&&M?`0 4px 14px ${M}20`:"0 1px 6px rgba(0,0,0,0.08)",we=U&&M?M:z.color;return(0,_.jsxs)("div",{style:{padding:4},children:[(0,_.jsx)(Ae,{type:"target",position:be.Top,style:Ve}),(0,_.jsxs)("div",{style:{width:260,minHeight:90,boxSizing:"border-box",background:"#fff",borderRadius:12,boxShadow:Ce,border:"1px solid #e5e7eb",borderLeft:`3px solid ${ge}`,borderStyle:b?"dashed":"solid",overflow:"hidden",transition:"all 0.2s ease",...L?{opacity:.5,borderStyle:"dashed"}:{}},onMouseEnter:L?void 0:$=>{$.currentTarget.style.transform="translateY(-2px)",$.currentTarget.style.boxShadow=`0 4px 12px ${we}20`},onMouseLeave:L?void 0:$=>{$.currentTarget.style.transform="translateY(0)",$.currentTarget.style.boxShadow=Ce},children:[(0,_.jsxs)("div",{style:{background:z.bg,padding:"6px 12px",display:"flex",alignItems:"center",gap:6,borderBottom:"1px solid #f1f5f9"},children:[(0,_.jsx)("div",{style:{width:24,height:24,borderRadius:"50%",backgroundColor:ce,color:"#fff",display:"flex",alignItems:"center",justifyContent:"center",fontSize:10,fontWeight:600,flexShrink:0},children:_e}),(0,_.jsx)("div",{style:{flex:1,minWidth:0},children:(0,_.jsx)(ue,{strong:!0,style:{fontSize:12,color:z.color},ellipsis:{tooltip:d},children:d})}),U&&Y&&(0,_.jsx)(ve,{title:P?En[P.status]:void 0,children:(0,_.jsx)("span",{style:{color:M,fontSize:12,display:"flex",flexShrink:0},children:Y})})]}),(0,_.jsxs)("div",{style:{padding:"10px 12px"},children:[S&&(0,_.jsx)(ue,{type:"secondary",style:{fontSize:11,display:"block",marginTop:2,lineHeight:1.4},ellipsis:{tooltip:S},children:S}),o==="map"&&s&&(0,_.jsxs)(ue,{type:"secondary",style:{fontSize:11,display:"block",marginTop:4,lineHeight:1.4,color:z.color,background:z.bg,padding:"2px 6px",borderRadius:4,maxHeight:32,overflow:"hidden"},ellipsis:{tooltip:s},children:["\u2190 ",s]}),o!=="map"&&I&&(0,_.jsx)(ue,{type:"secondary",style:{fontSize:11,display:"block",marginTop:4,lineHeight:1.4,color:z.color,background:z.bg,padding:"2px 6px",borderRadius:4,maxHeight:32,overflow:"hidden"},ellipsis:{tooltip:I},children:I}),(0,_.jsxs)("div",{style:{display:"flex",gap:4,marginTop:6,flexWrap:"wrap"},children:[!U&&o==="agent"&&b&&(0,_.jsx)(ve,{title:l?`Agent "${b}" no longer exists`:`Delegated to agent: ${O??b}`,children:(0,_.jsx)(se,{color:l?"red":"purple",style:{margin:0,fontSize:10,padding:"0 5px",lineHeight:"16px"},icon:(0,_.jsx)(Sn,{size:10}),children:l?`[\u5DF2\u5220\u9664] ${b}`:`\u2192 ${O??b}`})}),!U&&o==="agent"&&!b&&(0,_.jsx)(se,{color:"default",style:{margin:0,fontSize:10,padding:"0 5px",lineHeight:"16px"},children:"inline"}),B&&(0,_.jsx)(ve,{title:"This step requires human approval before continuing",children:(0,_.jsx)("div",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:20,height:20,borderRadius:"50%",background:"#fff7e6",border:"1px solid #ffd591",cursor:"default"},children:(0,_.jsx)(wn,{size:12,style:{color:"#fa8c16"}})})}),X&&(0,_.jsx)(ve,{title:`When: ${X}`,children:(0,_.jsx)("div",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:20,height:20,borderRadius:"50%",background:"#f0f5ff",border:"1px solid #adc6ff",cursor:"default"},children:(0,_.jsx)(xn,{size:12,style:{color:"#2f54eb"}})})}),!U&&o==="map"&&w&&(0,_.jsx)(se,{color:"purple",style:{margin:0,fontSize:10,padding:"0 5px",lineHeight:"16px"},children:w}),!U&&o==="map"&&I&&(0,_.jsx)(se,{color:"default",style:{margin:0,fontSize:10,padding:"0 5px",lineHeight:"16px",maxWidth:120},title:I,children:I.length>20?I.slice(0,18)+"\u2026":I}),!U&&o==="map"&&(J||le||V)&&(0,_.jsxs)(se,{color:"cyan",style:{margin:0,fontSize:10,padding:"0 5px",lineHeight:"16px"},children:[J??50,"\xD7",le??10,"\xD7",V??5]}),!U&&ie?(0,_.jsxs)(se,{style:{margin:0,fontSize:10,padding:"0 5px",lineHeight:"16px"},children:["\u21BB ",ie]}):null,!U&&oe?(0,_.jsxs)(se,{style:{margin:0,fontSize:10,padding:"0 5px",lineHeight:"16px"},children:["\u23F1 ",oe,"s"]}):null,he&&(0,_.jsx)(se,{color:P?"blue":"default",style:{margin:0,fontSize:10,padding:"0 5px",lineHeight:"16px"},children:he}),u&&(0,_.jsx)("span",{style:{marginLeft:"auto"}}),u&&(0,_.jsx)(dn,{trigger:"hover",placement:"right",mouseEnterDelay:.2,title:(0,_.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6},children:[(0,_.jsx)(ue,{strong:!0,style:{fontSize:12},children:"Output"}),(0,_.jsx)(ue,{style:{fontSize:11,fontFamily:"monospace",color:"#6366f1"},children:u})]}),content:c?(0,_.jsx)(un,{schema:c}):(0,_.jsx)(ue,{type:"secondary",style:{fontSize:11},children:"No schema defined"}),children:(0,_.jsxs)(se,{style:{margin:0,fontSize:10,padding:"0 5px",lineHeight:"16px",flexShrink:0,cursor:"default"},children:["\u2192 ",u]})})]})]})]}),(0,_.jsx)(Ae,{type:"source",position:be.Bottom,style:Ve})]})},On=sr;var H=Le(Xe()),{Text:me}=Ke;function Mn(p){return new Date(p).toLocaleString()}function ur(p){return p.input?typeof p.input.rendered=="string"?p.input.rendered:typeof p.input.description=="string"?p.input.description:JSON.stringify(p.input,null,2):null}function ar(p){return p.output?typeof p.output.result=="string"?p.output.result:typeof p.output=="object"?JSON.stringify(p.output,null,2):String(p.output):null}function pr({step:p}){let o=ur(p),d=ar(p),S=Fe[p.status]||Fe.running,b=[{key:"io",label:"Input / Output",children:(0,H.jsxs)(H.Fragment,{children:[o&&(0,H.jsxs)("div",{style:{marginBottom:d?12:0},children:[(0,H.jsx)(me,{type:"secondary",style:{fontSize:10,textTransform:"uppercase",letterSpacing:.5},children:"Input"}),(0,H.jsx)("div",{style:{background:"rgba(0,0,0,0.02)",borderRadius:8,padding:"8px 10px",marginTop:4,maxHeight:200,overflow:"auto"},children:p.input?.description?(0,H.jsx)(on,{content:o}):(0,H.jsx)("pre",{style:{margin:0,fontSize:11,whiteSpace:"pre-wrap",wordBreak:"break-word",fontFamily:"monospace"},children:o})})]}),d&&(0,H.jsxs)("div",{children:[(0,H.jsx)(me,{type:"secondary",style:{fontSize:10,textTransform:"uppercase",letterSpacing:.5},children:"Output"}),(0,H.jsx)("div",{style:{background:"linear-gradient(135deg, rgba(99,102,241,0.04) 0%, rgba(99,102,241,0.01) 100%)",borderRadius:8,padding:"8px 10px",marginTop:4,maxHeight:200,overflow:"auto"},children:p.output?.result?(0,H.jsx)(on,{content:d}):(0,H.jsx)("pre",{style:{margin:0,fontSize:11,whiteSpace:"pre-wrap",wordBreak:"break-word",fontFamily:"monospace"},children:d})})]}),!o&&!d&&(0,H.jsx)(me,{type:"secondary",style:{fontSize:11},children:"No input/output data"})]})}];return(0,H.jsxs)("div",{style:{maxWidth:480},children:[(0,H.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:12},children:[(0,H.jsx)("span",{style:{color:S.color,fontSize:14},children:S.icon}),(0,H.jsx)(me,{strong:!0,style:{fontSize:14},children:p.stepName}),(0,H.jsx)(se,{color:"purple",style:{fontSize:11},children:p.stepType})]}),p.edgePurpose&&(0,H.jsx)("div",{style:{marginBottom:10},children:(0,H.jsxs)(me,{type:"secondary",style:{fontSize:11},children:["Purpose: ",p.edgePurpose]})}),p.errorMessage&&(0,H.jsx)("div",{style:{background:"#FEF2F2",border:"1px solid #FECACA",borderRadius:8,padding:"8px 12px",marginBottom:12,overflow:"hidden"},children:(0,H.jsx)(me,{type:"danger",style:{fontSize:11,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:p.errorMessage})}),(0,H.jsx)(gn,{activeKey:"io",items:b,size:"small",style:{marginBottom:-8}}),(0,H.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",marginTop:12,paddingTop:8,borderTop:"1px solid #f0f0f0"},children:[(0,H.jsxs)(me,{type:"secondary",style:{fontSize:10},children:["Started: ",Mn(p.startedAt)]}),p.completedAt&&(0,H.jsxs)(me,{type:"secondary",style:{fontSize:10},children:["Ended: ",Mn(p.completedAt)]})]})]})}function De(p,o){return p.find(d=>d.stepName===o.name)??null}function Qe(p,o,d,S){let b=p.ref&&S?S.get(p.ref):void 0;return{nodeType:p.type,name:p.name,description:p.description,ref:p.ref,refAgentName:b?.name,refAgentType:b?.type,refDeleted:p.ref&&S?!b:void 0,outputKey:p.output?.key,nodeSchema:p.output?.schema,config:p.config,status:p.status,source:p.source,innerRef:p.node?.ref,inputTemplate:p.input?.template,ask:p.ask,condition:p.condition,runState:o,pending:d}}function Fn(p){let o=new Map;for(let d of p)if(d.parentGroup&&d.type!=="terminal"){let S=o.get(d.parentGroup)||[];S.push(d.id),o.set(d.parentGroup,S)}return Array.from(o.entries()).map(([d,S])=>({sourceId:d,childIds:S}))}function fr(){return(0,H.jsxs)("div",{style:{width:"100%",height:"100%",position:"relative",pointerEvents:"none"},children:[(0,H.jsx)(Ae,{type:"target",position:be.Top,style:{opacity:0}}),(0,H.jsx)(Ae,{type:"source",position:be.Bottom,style:{opacity:0}}),(0,H.jsx)("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,border:"2px dashed #a78bfa",borderRadius:12,background:"rgba(167, 139, 250, 0.04)"}}),(0,H.jsx)("div",{style:{position:"absolute",top:8,left:12,fontSize:12,fontWeight:600,color:"#7c3aed",padding:"2px 8px",background:"rgba(167, 139, 250, 0.08)",borderRadius:6,whiteSpace:"nowrap",zIndex:2},children:"Parallel"})]})}function dr(p,o){let d=p.nodes,S=p.edges,b=Fn(d),O=new Set(b.map(L=>L.sourceId)),a=new Set(b.flatMap(L=>L.childIds)),l=268,u=100,c=40;for(let L of b){let z=d.find(k=>k.id===L.sourceId);if(z){let k=L.childIds.length;z.width=k*l+(k-1)*c+40,z.height=u+100}}let h=d.filter(L=>!a.has(L.id)),r=sn(h,S,{nodeWidth:l,nodeHeight:u,ranksep:120}),s=h.find(L=>!O.has(L.id)&&L.type!=="terminal"),w=s?r.get(s.id):void 0,I=s?s.width??l:l,B=w?w.x+I/2:0;for(let L of h){if(O.has(L.id))continue;let z=r.get(L.id);if(!z)continue;let k=L.width??l;z.x=B-k/2}let X=h.filter(L=>r.has(L.id)&&!O.has(L.id)&&L.type!=="terminal").map(L=>{let z=r.get(L.id);return{id:L.id,type:"workflow",position:z,data:{...Qe(L,void 0,void 0,o)}}});for(let L of b){let z=d.find(J=>J.id===L.sourceId),k=r.get(L.sourceId);if(!z||!k)continue;let j=z.width,M=z.height,Y=L.childIds.length,q=B-j/2,ne=Y*l+(Y-1)*c,de=B-ne/2,ie=k.y+(M-u)/2;for(let J=0;J<Y;J++){let le=L.childIds[J],V=d.find(G=>G.id===le);V&&X.push({id:V.id,type:"workflow",position:{x:de+J*(l+c),y:ie},data:{...Qe(V,void 0,void 0,o),parallelGroup:!0},style:{zIndex:2}})}let oe=`group_${L.sourceId}`;X.push({id:oe,type:"groupLabel",position:{x:q,y:k.y},data:{},selectable:!1,draggable:!1,style:{zIndex:0,width:j,height:M}})}let P=[];for(let L of S){let z=cn(L);for(let k of z){let j=d.find(q=>q.id===k);if(j?.type==="terminal"&&j.name==="__end"||O.has(L.from)&&d.find(ne=>ne.id===k)?.parentGroup===L.from)continue;let M=O.has(L.from)?`group_${L.from}`:L.from,Y=O.has(k)?`group_${k}`:k;P.push({id:`${M}-${Y}`,source:M,target:Y,type:"straight",markerEnd:{type:ln.ArrowClosed}})}}return{nodes:X,edges:P}}function gr(p,o,d,S){let b=p.nodes,O=p.edges,a=Fn(b),l=new Set(a.map(k=>k.sourceId)),u=new Set(a.flatMap(k=>k.childIds)),c=268,h=100,r=40;for(let k of a){let j=b.find(M=>M.id===k.sourceId);if(j){let M=k.childIds.length;j.width=M*c+(M-1)*r+40,j.height=h+100}}let s=b.filter(k=>!u.has(k.id)),w=sn(s,O,{nodeWidth:c,nodeHeight:h,ranksep:120}),I=s.find(k=>!l.has(k.id)&&k.type!=="terminal"),B=I?w.get(I.id):void 0,X=I?I.width??c:c,P=B?B.x+X/2:0;for(let k of s){if(l.has(k.id))continue;let j=w.get(k.id);if(!j)continue;let M=k.width??c;j.x=P-M/2}let L=s.filter(k=>w.has(k.id)&&!l.has(k.id)).map(k=>{let j=w.get(k.id),M=De(o,k),Y=k.type==="terminal",q=M&&(!Y||M.status!=="running")?{status:M.status,stepType:M.stepType,durationMs:M.durationMs,selected:!1}:void 0;return{id:k.id,type:"workflow",position:j,style:Y?{width:c,height:h}:void 0,data:Qe(k,q,!M&&!Y,S)}});for(let k of a){let j=b.find(V=>V.id===k.sourceId),M=w.get(k.sourceId);if(!j||!M)continue;let Y=j.width,q=j.height,ne=k.childIds.length,de=ne*c+(ne-1)*r,ie=P-de/2,oe=M.y+(q-h)/2;for(let V=0;V<ne;V++){let G=k.childIds[V],U=b.find(ce=>ce.id===G);if(!U)continue;let E=De(o,U),ge=E?{status:E.status,stepType:E.stepType,durationMs:E.durationMs,selected:!1}:void 0;L.push({id:U.id,type:"workflow",position:{x:ie+V*(c+r),y:oe},data:{...Qe(U,ge,!E,S),parallelGroup:!0},style:{zIndex:2}})}let J=P-Y/2,le=`group_${k.sourceId}`;L.push({id:le,type:"groupLabel",position:{x:J,y:M.y},data:{},selectable:!1,draggable:!1,style:{zIndex:0,width:Y,height:q}})}let z=[];for(let k of O){let j=cn(k);for(let M of j){if(l.has(k.from)&&b.find(E=>E.id===M)?.parentGroup===k.from)continue;let Y=l.has(k.from)?`group_${k.from}`:k.from,q=l.has(M)?`group_${M}`:M,ne=b.find(U=>U.id===k.from),ie=(ne?De(o,ne):void 0)!==void 0,oe=b.find(U=>U.id===M),le=(oe?De(o,oe):void 0)!==void 0,V=ie&&le,G=V?"#6366f1":"#d9d9d9";z.push({id:`${Y}-${q}`,source:Y,target:q,type:"straight",animated:V,style:V?{stroke:G,strokeWidth:2}:{stroke:G,strokeWidth:2,strokeDasharray:"6 4",opacity:.25},markerEnd:{type:ln.ArrowClosed,color:G,width:20,height:20}})}}return{nodes:L,edges:z}}var hr=({dsl:p,steps:o,assistantId:d,agentNameMap:S,onNodeClick:b,height:O="100%"})=>{let a=!!o,l=(0,te.useMemo)(()=>({workflow:On,groupLabel:fr}),[]),{nodes:u,edges:c}=(0,te.useMemo)(()=>a?gr(p,o,void 0,S):dr(p,S),[p,o,a,S]),[h,r,s]=Cn(u),[w,I,B]=kn(c),[X,P]=(0,te.useState)(null),L=(0,te.useMemo)(()=>{if(!a||!X)return null;let Y=p.nodes.find(q=>q.id===X);return Y?De(o,Y):null},[p.nodes,o,X,a]);(0,te.useEffect)(()=>{r(u),I(c)},[u,c,r,I]);let z=(0,te.useCallback)(()=>{r(Y=>Y.map(q=>({...q,data:{...q.data,runState:q.data.runState?{...q.data.runState,selected:!1}:void 0}})))},[r]);(0,te.useEffect)(()=>{a&&r(Y=>Y.map(q=>({...q,data:{...q.data,runState:q.data.runState?{...q.data.runState,selected:q.id===X}:void 0}})))},[X,r,a]);let k=(0,te.useCallback)((Y,q)=>{a?P(q.id):b?.(q.id)},[a,b]),j=(0,te.useCallback)(()=>{a&&(z(),P(null))},[a,z]),M=(0,te.useCallback)(()=>{z(),P(null)},[z]);return!p.nodes||p.nodes.length===0?a?(0,H.jsx)("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:300},children:(0,H.jsx)(hn,{size:"large"})}):(0,H.jsx)(fn,{description:"No nodes in workflow"}):(0,H.jsx)(vn,{children:(0,H.jsx)(_n,{nodes:h,edges:w,nodeTypes:l,onNodesChange:s,onEdgesChange:B,onNodeClick:k,onPaneClick:a?j:void 0,height:O,fitView:!0,fitViewOptions:a?{padding:.3}:void 0,minZoom:a?.3:void 0,maxZoom:a?1.5:void 0,nodesDraggable:!1,nodesConnectable:a?!1:void 0,defaultEdgeOptions:a?void 0:{style:{strokeWidth:2}},backgroundGap:a?20:void 0,miniMap:a?{nodeStrokeWidth:3,pannable:!0,zoomable:!0,style:{backgroundColor:"#f5f5f5"}}:void 0,children:a&&L&&X&&(0,H.jsxs)("div",{style:{position:"absolute",right:24,top:24,width:460,maxHeight:"calc(100% - 48px)",background:"#fff",borderRadius:16,boxShadow:"0 8px 30px rgba(0,0,0,0.12)",border:"1px solid #e5e7eb",zIndex:10,overflow:"auto",padding:20},children:[(0,H.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:8},children:[(0,H.jsx)(me,{type:"secondary",style:{fontSize:11,textTransform:"uppercase",letterSpacing:.5},children:"Step Detail"}),(0,H.jsx)(me,{type:"secondary",style:{fontSize:11,cursor:"pointer"},onClick:M,children:"Close"})]}),(0,H.jsx)(pr,{step:L})]})})})},Yr=hr;var mr=Object.create,Dn=Object.defineProperty,yr=Object.getOwnPropertyDescriptor,xr=Object.getOwnPropertyNames,Sr=Object.getPrototypeOf,br=Object.prototype.hasOwnProperty,K=(p,o)=>()=>(o||(p((o={exports:{}}).exports,o),p=null),o.exports),Ar=(p,o,d,S)=>{if(o&&typeof o=="object"||typeof o=="function")for(var b=xr(o),O=0,a=b.length,l;O<a;O++)l=b[O],!br.call(p,l)&&l!==d&&Dn(p,l,{get:(u=>o[u]).bind(null,l),enumerable:!(S=yr(o,l))||S.enumerable});return p},wr=(p,o,d)=>(d=p!=null?mr(Sr(p)):{},Ar(o||!p||!p.__esModule?Dn(d,"default",{value:p,enumerable:!0}):d,p)),Pe=K(((p,o)=>{function d(u){return typeof u>"u"||u===null}function S(u){return typeof u=="object"&&u!==null}function b(u){return Array.isArray(u)?u:d(u)?[]:[u]}function O(u,c){if(c){let h=Object.keys(c);for(let r=0,s=h.length;r<s;r+=1){let w=h[r];u[w]=c[w]}}return u}function a(u,c){let h="";for(let r=0;r<c;r+=1)h+=u;return h}function l(u){return u===0&&Number.NEGATIVE_INFINITY===1/u}o.exports.isNothing=d,o.exports.isObject=S,o.exports.toArray=b,o.exports.repeat=a,o.exports.isNegativeZero=l,o.exports.extend=O})),He=K(((p,o)=>{function d(b,O){let a="",l=b.reason||"(unknown reason)";return b.mark?(b.mark.name&&(a+='in "'+b.mark.name+'" '),a+="("+(b.mark.line+1)+":"+(b.mark.column+1)+")",!O&&b.mark.snippet&&(a+=`
1
+ import{b as cn,c as sn,d as _n}from"./embed-page-chunk-KEL6XU6R.js";import{a as ln,b as be,e as Ae,f as vn,h as Cn,i as kn}from"./embed-page-chunk-AC6X2XRH.js";import{A as Me,Aa as wn,Da as Tn,O as xn,Va as on,Z as Sn,ba as bn,ra as An,t as Re,v as mn,y as yn,z as Oe}from"./embed-page-chunk-YMJGPA3F.js";import{a as Xe}from"./embed-page-chunk-MB65DZAX.js";import{Ia as se,La as Ke,Z as fn,aa as ve,ba as dn,fa as gn,va as hn}from"./embed-page-chunk-O4QK5LWZ.js";import{a as or}from"./embed-page-chunk-4BKXE5ON.js";import{e as Le}from"./embed-page-chunk-6Y3UYJ6Z.js";var te=Le(or());var _=Le(Xe());if(typeof document<"u"){let p="workflow-node-spin-keyframes";if(!document.getElementById(p)){let o=document.createElement("style");o.id=p,o.textContent="@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }",document.head.appendChild(o)}}var{Text:ue}=Ke,Ve={opacity:0},Fe={running:{color:"#1677ff",icon:(0,_.jsx)(bn,{size:14,style:{animation:"spin 1s linear infinite"}})},completed:{color:"#52c41a",icon:(0,_.jsx)(Re,{size:14})},failed:{color:"#ff4d4f",icon:(0,_.jsx)(Oe,{size:14})},interrupted:{color:"#faad14",icon:(0,_.jsx)(mn,{size:14})},skipped:{color:"#8c8c8c",icon:(0,_.jsx)(Me,{size:14})}},En={running:"This step is currently executing",completed:"This step completed successfully",failed:"This step encountered an error",interrupted:"This step is waiting for human input",skipped:"This step was skipped (condition not met)"},In={color:"#d9d9d9",icon:(0,_.jsx)(Me,{size:14})},Nn={agent:{color:"#6366f1",bg:"#EEF2FF",border:"#6366f1"},map:{color:"#10b981",bg:"#ECFDF5",border:"#10b981"},terminal:{color:"#64748b",bg:"#F8FAFC",border:"#94a3b8"}},Ln={success:{color:"#22c55e",bg:"#F0FDF4",label:"Success"},failed:{color:"#ef4444",bg:"#FEF2F2",label:"Failed"},__default:{color:"#94a3b8",bg:"#F8FAFC",label:"Stop"}};function lr(p){return(p||"?").split(/[\s_-]+/).filter(Boolean).map(o=>o[0]).join("").toUpperCase().slice(0,2)}function un({schema:p}){let o=p;if(!o||typeof o!="object")return(0,_.jsx)(ue,{type:"secondary",style:{fontSize:11},children:"No schema defined"});let d=o.properties,S=o.required||[],b=o.items,O=l=>l==="string"?"green":l==="number"||l==="integer"?"orange":l==="boolean"?"purple":l==="array"?"cyan":l==="object"?"blue":"default",a=l=>{let u=l.type;if(u==="array"&&l.items){let c=l.items.type;return c?`Array<${c}>`:"Array"}return u||"any"};return(0,_.jsxs)("div",{style:{maxWidth:340,maxHeight:360,overflow:"auto",fontSize:12},children:[d&&(0,_.jsxs)("div",{children:[(0,_.jsx)(ue,{type:"secondary",style:{fontSize:10,textTransform:"uppercase",letterSpacing:.5,display:"block",marginBottom:6},children:"Properties"}),Object.entries(d).map(([l,u])=>{let c=S.includes(l),h=u.description,r=a(u),s=u.properties,w=u.items,I=!!(s||w);return(0,_.jsx)(ve,{title:I?(0,_.jsx)(un,{schema:I?s?u:w:void 0}):h||void 0,placement:"left",overlayStyle:{maxWidth:360},children:(0,_.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"3px 6px",borderRadius:4,marginBottom:2,background:c?"rgba(99,102,241,0.04)":"transparent",cursor:I?"pointer":"default"},children:[(0,_.jsx)(ue,{style:{fontSize:11,fontWeight:c?600:400,fontFamily:"monospace"},children:l}),c&&(0,_.jsx)("span",{style:{color:"#ef4444",fontSize:9},children:"*"}),h&&!I&&(0,_.jsx)(ue,{type:"secondary",style:{fontSize:10,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:h}),(0,_.jsx)(se,{color:O(r),style:{margin:0,fontSize:9,padding:"0 4px",lineHeight:"16px",marginLeft:"auto"},children:r})]})},l)})]}),!d&&b&&(0,_.jsxs)("div",{children:[(0,_.jsx)(ue,{type:"secondary",style:{fontSize:10,textTransform:"uppercase",letterSpacing:.5,display:"block",marginBottom:4},children:"Items"}),(0,_.jsx)(un,{schema:b})]})]})}var Rn=72,cr=3,sr=({data:p})=>{if(!p)return null;let{nodeType:o,name:d,description:S,ref:b,refAgentName:O,refAgentType:a,refDeleted:l,outputKey:u,nodeSchema:c,config:h,status:r,source:s,innerRef:w,inputTemplate:I,ask:B,condition:X,runState:P,pending:L}=p,z=Nn[o]||Nn.agent,k=Ln[r||""]||Ln.__default,j=P?Fe[P.status]||Fe.running:null,M=j?.color,Y=j?.icon,q=r==="success"?(0,_.jsx)(Re,{size:14,color:"#22c55e"}):r==="failed"?(0,_.jsx)(Oe,{size:14,color:"#ef4444"}):(0,_.jsx)(Me,{size:14,color:"#94a3b8"}),ne=r==="success"?(0,_.jsx)(Re,{size:32,color:k.color}):r==="failed"?(0,_.jsx)(Oe,{size:32,color:k.color}):(0,_.jsx)(yn,{size:32,color:k.color}),de=h?.title,ie=h?.maxRetries,oe=h?.timeout,J=h?.batchSize,le=h?.maxConcurrency,V=h?.innerConcurrency,G=P?.selected,U=!!P||L;function E($){return $==null?"-":$<1e3?`${$}ms`:`${($/1e3).toFixed(1)}s`}if(o==="terminal"){let $=k.color,Te=k.bg,ee=k.label,ae=ne;U&&(P?($=M||$,ee=P.status,ae=(0,_.jsx)("span",{style:{fontSize:18},children:Y})):L&&($=In.color,Te="#fafafa",ee="pending",ae=(0,_.jsx)(Me,{size:18,style:{color:In.color}})));let pe=G&&M?`0 4px 16px ${M}30`:"0 2px 8px rgba(0,0,0,0.06)";return(0,_.jsxs)("div",{style:{padding:4,display:"flex",flexDirection:"column",alignItems:"center",opacity:L?.5:1},children:[(0,_.jsx)(Ae,{type:"target",position:be.Top,style:Ve}),(0,_.jsx)(ve,{title:U&&P?En[P.status]:d,children:(0,_.jsx)("div",{style:{width:Rn,height:Rn,borderRadius:"50%",background:Te,border:`${cr}px solid ${L?`${$}80`:$}`,borderStyle:L?"dashed":"solid",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:pe,transition:"all 0.2s ease",cursor:"default"},onMouseEnter:L?void 0:fe=>{fe.currentTarget.style.transform="scale(1.08)",fe.currentTarget.style.boxShadow=`0 4px 16px ${$}30`},onMouseLeave:L?void 0:fe=>{fe.currentTarget.style.transform="scale(1)",fe.currentTarget.style.boxShadow=pe},children:ae})}),(0,_.jsx)(ue,{style:{fontSize:11,color:$,marginTop:6,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.5px"},children:ee}),(0,_.jsx)(Ae,{type:"source",position:be.Bottom,style:Ve})]})}let ge=U&&M?M:z.border,ce=U&&M?M:z.color,_e=o==="agent"?(0,_.jsx)(Tn,{size:14}):o==="map"?(0,_.jsx)(An,{size:14}):lr(d),he=P?E(P.durationMs):null,Ce=G&&M?`0 4px 14px ${M}20`:"0 1px 6px rgba(0,0,0,0.08)",we=U&&M?M:z.color;return(0,_.jsxs)("div",{style:{padding:4},children:[(0,_.jsx)(Ae,{type:"target",position:be.Top,style:Ve}),(0,_.jsxs)("div",{style:{width:260,minHeight:90,boxSizing:"border-box",background:"#fff",borderRadius:12,boxShadow:Ce,border:"1px solid #e5e7eb",borderLeft:`3px solid ${ge}`,borderStyle:b?"dashed":"solid",overflow:"hidden",transition:"all 0.2s ease",...L?{opacity:.5,borderStyle:"dashed"}:{}},onMouseEnter:L?void 0:$=>{$.currentTarget.style.transform="translateY(-2px)",$.currentTarget.style.boxShadow=`0 4px 12px ${we}20`},onMouseLeave:L?void 0:$=>{$.currentTarget.style.transform="translateY(0)",$.currentTarget.style.boxShadow=Ce},children:[(0,_.jsxs)("div",{style:{background:z.bg,padding:"6px 12px",display:"flex",alignItems:"center",gap:6,borderBottom:"1px solid #f1f5f9"},children:[(0,_.jsx)("div",{style:{width:24,height:24,borderRadius:"50%",backgroundColor:ce,color:"#fff",display:"flex",alignItems:"center",justifyContent:"center",fontSize:10,fontWeight:600,flexShrink:0},children:_e}),(0,_.jsx)("div",{style:{flex:1,minWidth:0},children:(0,_.jsx)(ue,{strong:!0,style:{fontSize:12,color:z.color},ellipsis:{tooltip:d},children:d})}),U&&Y&&(0,_.jsx)(ve,{title:P?En[P.status]:void 0,children:(0,_.jsx)("span",{style:{color:M,fontSize:12,display:"flex",flexShrink:0},children:Y})})]}),(0,_.jsxs)("div",{style:{padding:"10px 12px"},children:[S&&(0,_.jsx)(ue,{type:"secondary",style:{fontSize:11,display:"block",marginTop:2,lineHeight:1.4},ellipsis:{tooltip:S},children:S}),o==="map"&&s&&(0,_.jsxs)(ue,{type:"secondary",style:{fontSize:11,display:"block",marginTop:4,lineHeight:1.4,color:z.color,background:z.bg,padding:"2px 6px",borderRadius:4,maxHeight:32,overflow:"hidden"},ellipsis:{tooltip:s},children:["\u2190 ",s]}),o!=="map"&&I&&(0,_.jsx)(ue,{type:"secondary",style:{fontSize:11,display:"block",marginTop:4,lineHeight:1.4,color:z.color,background:z.bg,padding:"2px 6px",borderRadius:4,maxHeight:32,overflow:"hidden"},ellipsis:{tooltip:I},children:I}),(0,_.jsxs)("div",{style:{display:"flex",gap:4,marginTop:6,flexWrap:"wrap"},children:[!U&&o==="agent"&&b&&(0,_.jsx)(ve,{title:l?`Agent "${b}" no longer exists`:`Delegated to agent: ${O??b}`,children:(0,_.jsx)(se,{color:l?"red":"purple",style:{margin:0,fontSize:10,padding:"0 5px",lineHeight:"16px"},icon:(0,_.jsx)(Sn,{size:10}),children:l?`[\u5DF2\u5220\u9664] ${b}`:`\u2192 ${O??b}`})}),!U&&o==="agent"&&!b&&(0,_.jsx)(se,{color:"default",style:{margin:0,fontSize:10,padding:"0 5px",lineHeight:"16px"},children:"inline"}),B&&(0,_.jsx)(ve,{title:"This step requires human approval before continuing",children:(0,_.jsx)("div",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:20,height:20,borderRadius:"50%",background:"#fff7e6",border:"1px solid #ffd591",cursor:"default"},children:(0,_.jsx)(wn,{size:12,style:{color:"#fa8c16"}})})}),X&&(0,_.jsx)(ve,{title:`When: ${X}`,children:(0,_.jsx)("div",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:20,height:20,borderRadius:"50%",background:"#f0f5ff",border:"1px solid #adc6ff",cursor:"default"},children:(0,_.jsx)(xn,{size:12,style:{color:"#2f54eb"}})})}),!U&&o==="map"&&w&&(0,_.jsx)(se,{color:"purple",style:{margin:0,fontSize:10,padding:"0 5px",lineHeight:"16px"},children:w}),!U&&o==="map"&&I&&(0,_.jsx)(se,{color:"default",style:{margin:0,fontSize:10,padding:"0 5px",lineHeight:"16px",maxWidth:120},title:I,children:I.length>20?I.slice(0,18)+"\u2026":I}),!U&&o==="map"&&(J||le||V)&&(0,_.jsxs)(se,{color:"cyan",style:{margin:0,fontSize:10,padding:"0 5px",lineHeight:"16px"},children:[J??50,"\xD7",le??10,"\xD7",V??5]}),!U&&ie?(0,_.jsxs)(se,{style:{margin:0,fontSize:10,padding:"0 5px",lineHeight:"16px"},children:["\u21BB ",ie]}):null,!U&&oe?(0,_.jsxs)(se,{style:{margin:0,fontSize:10,padding:"0 5px",lineHeight:"16px"},children:["\u23F1 ",oe,"s"]}):null,he&&(0,_.jsx)(se,{color:P?"blue":"default",style:{margin:0,fontSize:10,padding:"0 5px",lineHeight:"16px"},children:he}),u&&(0,_.jsx)("span",{style:{marginLeft:"auto"}}),u&&(0,_.jsx)(dn,{trigger:"hover",placement:"right",mouseEnterDelay:.2,title:(0,_.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6},children:[(0,_.jsx)(ue,{strong:!0,style:{fontSize:12},children:"Output"}),(0,_.jsx)(ue,{style:{fontSize:11,fontFamily:"monospace",color:"#6366f1"},children:u})]}),content:c?(0,_.jsx)(un,{schema:c}):(0,_.jsx)(ue,{type:"secondary",style:{fontSize:11},children:"No schema defined"}),children:(0,_.jsxs)(se,{style:{margin:0,fontSize:10,padding:"0 5px",lineHeight:"16px",flexShrink:0,cursor:"default"},children:["\u2192 ",u]})})]})]})]}),(0,_.jsx)(Ae,{type:"source",position:be.Bottom,style:Ve})]})},On=sr;var H=Le(Xe()),{Text:me}=Ke;function Mn(p){return new Date(p).toLocaleString()}function ur(p){return p.input?typeof p.input.rendered=="string"?p.input.rendered:typeof p.input.description=="string"?p.input.description:JSON.stringify(p.input,null,2):null}function ar(p){return p.output?typeof p.output.result=="string"?p.output.result:typeof p.output=="object"?JSON.stringify(p.output,null,2):String(p.output):null}function pr({step:p}){let o=ur(p),d=ar(p),S=Fe[p.status]||Fe.running,b=[{key:"io",label:"Input / Output",children:(0,H.jsxs)(H.Fragment,{children:[o&&(0,H.jsxs)("div",{style:{marginBottom:d?12:0},children:[(0,H.jsx)(me,{type:"secondary",style:{fontSize:10,textTransform:"uppercase",letterSpacing:.5},children:"Input"}),(0,H.jsx)("div",{style:{background:"rgba(0,0,0,0.02)",borderRadius:8,padding:"8px 10px",marginTop:4,maxHeight:200,overflow:"auto"},children:p.input?.description?(0,H.jsx)(on,{content:o}):(0,H.jsx)("pre",{style:{margin:0,fontSize:11,whiteSpace:"pre-wrap",wordBreak:"break-word",fontFamily:"monospace"},children:o})})]}),d&&(0,H.jsxs)("div",{children:[(0,H.jsx)(me,{type:"secondary",style:{fontSize:10,textTransform:"uppercase",letterSpacing:.5},children:"Output"}),(0,H.jsx)("div",{style:{background:"linear-gradient(135deg, rgba(99,102,241,0.04) 0%, rgba(99,102,241,0.01) 100%)",borderRadius:8,padding:"8px 10px",marginTop:4,maxHeight:200,overflow:"auto"},children:p.output?.result?(0,H.jsx)(on,{content:d}):(0,H.jsx)("pre",{style:{margin:0,fontSize:11,whiteSpace:"pre-wrap",wordBreak:"break-word",fontFamily:"monospace"},children:d})})]}),!o&&!d&&(0,H.jsx)(me,{type:"secondary",style:{fontSize:11},children:"No input/output data"})]})}];return(0,H.jsxs)("div",{style:{maxWidth:480},children:[(0,H.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:12},children:[(0,H.jsx)("span",{style:{color:S.color,fontSize:14},children:S.icon}),(0,H.jsx)(me,{strong:!0,style:{fontSize:14},children:p.stepName}),(0,H.jsx)(se,{color:"purple",style:{fontSize:11},children:p.stepType})]}),p.edgePurpose&&(0,H.jsx)("div",{style:{marginBottom:10},children:(0,H.jsxs)(me,{type:"secondary",style:{fontSize:11},children:["Purpose: ",p.edgePurpose]})}),p.errorMessage&&(0,H.jsx)("div",{style:{background:"#FEF2F2",border:"1px solid #FECACA",borderRadius:8,padding:"8px 12px",marginBottom:12,overflow:"hidden"},children:(0,H.jsx)(me,{type:"danger",style:{fontSize:11,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:p.errorMessage})}),(0,H.jsx)(gn,{activeKey:"io",items:b,size:"small",style:{marginBottom:-8}}),(0,H.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",marginTop:12,paddingTop:8,borderTop:"1px solid #f0f0f0"},children:[(0,H.jsxs)(me,{type:"secondary",style:{fontSize:10},children:["Started: ",Mn(p.startedAt)]}),p.completedAt&&(0,H.jsxs)(me,{type:"secondary",style:{fontSize:10},children:["Ended: ",Mn(p.completedAt)]})]})]})}function De(p,o){return p.find(d=>d.stepName===o.name)??null}function Qe(p,o,d,S){let b=p.ref&&S?S.get(p.ref):void 0;return{nodeType:p.type,name:p.name,description:p.description,ref:p.ref,refAgentName:b?.name,refAgentType:b?.type,refDeleted:p.ref&&S?!b:void 0,outputKey:p.output?.key,nodeSchema:p.output?.schema,config:p.config,status:p.status,source:p.source,innerRef:p.node?.ref,inputTemplate:p.input?.template,ask:p.ask,condition:p.condition,runState:o,pending:d}}function Fn(p){let o=new Map;for(let d of p)if(d.parentGroup&&d.type!=="terminal"){let S=o.get(d.parentGroup)||[];S.push(d.id),o.set(d.parentGroup,S)}return Array.from(o.entries()).map(([d,S])=>({sourceId:d,childIds:S}))}function fr(){return(0,H.jsxs)("div",{style:{width:"100%",height:"100%",position:"relative",pointerEvents:"none"},children:[(0,H.jsx)(Ae,{type:"target",position:be.Top,style:{opacity:0}}),(0,H.jsx)(Ae,{type:"source",position:be.Bottom,style:{opacity:0}}),(0,H.jsx)("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,border:"2px dashed #a78bfa",borderRadius:12,background:"rgba(167, 139, 250, 0.04)"}}),(0,H.jsx)("div",{style:{position:"absolute",top:8,left:12,fontSize:12,fontWeight:600,color:"#7c3aed",padding:"2px 8px",background:"rgba(167, 139, 250, 0.08)",borderRadius:6,whiteSpace:"nowrap",zIndex:2},children:"Parallel"})]})}function dr(p,o){let d=p.nodes,S=p.edges,b=Fn(d),O=new Set(b.map(L=>L.sourceId)),a=new Set(b.flatMap(L=>L.childIds)),l=268,u=100,c=40;for(let L of b){let z=d.find(k=>k.id===L.sourceId);if(z){let k=L.childIds.length;z.width=k*l+(k-1)*c+40,z.height=u+100}}let h=d.filter(L=>!a.has(L.id)),r=sn(h,S,{nodeWidth:l,nodeHeight:u,ranksep:120}),s=h.find(L=>!O.has(L.id)&&L.type!=="terminal"),w=s?r.get(s.id):void 0,I=s?s.width??l:l,B=w?w.x+I/2:0;for(let L of h){if(O.has(L.id))continue;let z=r.get(L.id);if(!z)continue;let k=L.width??l;z.x=B-k/2}let X=h.filter(L=>r.has(L.id)&&!O.has(L.id)&&L.type!=="terminal").map(L=>{let z=r.get(L.id);return{id:L.id,type:"workflow",position:z,data:{...Qe(L,void 0,void 0,o)}}});for(let L of b){let z=d.find(J=>J.id===L.sourceId),k=r.get(L.sourceId);if(!z||!k)continue;let j=z.width,M=z.height,Y=L.childIds.length,q=B-j/2,ne=Y*l+(Y-1)*c,de=B-ne/2,ie=k.y+(M-u)/2;for(let J=0;J<Y;J++){let le=L.childIds[J],V=d.find(G=>G.id===le);V&&X.push({id:V.id,type:"workflow",position:{x:de+J*(l+c),y:ie},data:{...Qe(V,void 0,void 0,o),parallelGroup:!0},style:{zIndex:2}})}let oe=`group_${L.sourceId}`;X.push({id:oe,type:"groupLabel",position:{x:q,y:k.y},data:{},selectable:!1,draggable:!1,style:{zIndex:0,width:j,height:M}})}let P=[];for(let L of S){let z=cn(L);for(let k of z){let j=d.find(q=>q.id===k);if(j?.type==="terminal"&&j.name==="__end"||O.has(L.from)&&d.find(ne=>ne.id===k)?.parentGroup===L.from)continue;let M=O.has(L.from)?`group_${L.from}`:L.from,Y=O.has(k)?`group_${k}`:k;P.push({id:`${M}-${Y}`,source:M,target:Y,type:"straight",markerEnd:{type:ln.ArrowClosed}})}}return{nodes:X,edges:P}}function gr(p,o,d,S){let b=p.nodes,O=p.edges,a=Fn(b),l=new Set(a.map(k=>k.sourceId)),u=new Set(a.flatMap(k=>k.childIds)),c=268,h=100,r=40;for(let k of a){let j=b.find(M=>M.id===k.sourceId);if(j){let M=k.childIds.length;j.width=M*c+(M-1)*r+40,j.height=h+100}}let s=b.filter(k=>!u.has(k.id)),w=sn(s,O,{nodeWidth:c,nodeHeight:h,ranksep:120}),I=s.find(k=>!l.has(k.id)&&k.type!=="terminal"),B=I?w.get(I.id):void 0,X=I?I.width??c:c,P=B?B.x+X/2:0;for(let k of s){if(l.has(k.id))continue;let j=w.get(k.id);if(!j)continue;let M=k.width??c;j.x=P-M/2}let L=s.filter(k=>w.has(k.id)&&!l.has(k.id)).map(k=>{let j=w.get(k.id),M=De(o,k),Y=k.type==="terminal",q=M&&(!Y||M.status!=="running")?{status:M.status,stepType:M.stepType,durationMs:M.durationMs,selected:!1}:void 0;return{id:k.id,type:"workflow",position:j,style:Y?{width:c,height:h}:void 0,data:Qe(k,q,!M&&!Y,S)}});for(let k of a){let j=b.find(V=>V.id===k.sourceId),M=w.get(k.sourceId);if(!j||!M)continue;let Y=j.width,q=j.height,ne=k.childIds.length,de=ne*c+(ne-1)*r,ie=P-de/2,oe=M.y+(q-h)/2;for(let V=0;V<ne;V++){let G=k.childIds[V],U=b.find(ce=>ce.id===G);if(!U)continue;let E=De(o,U),ge=E?{status:E.status,stepType:E.stepType,durationMs:E.durationMs,selected:!1}:void 0;L.push({id:U.id,type:"workflow",position:{x:ie+V*(c+r),y:oe},data:{...Qe(U,ge,!E,S),parallelGroup:!0},style:{zIndex:2}})}let J=P-Y/2,le=`group_${k.sourceId}`;L.push({id:le,type:"groupLabel",position:{x:J,y:M.y},data:{},selectable:!1,draggable:!1,style:{zIndex:0,width:Y,height:q}})}let z=[];for(let k of O){let j=cn(k);for(let M of j){if(l.has(k.from)&&b.find(E=>E.id===M)?.parentGroup===k.from)continue;let Y=l.has(k.from)?`group_${k.from}`:k.from,q=l.has(M)?`group_${M}`:M,ne=b.find(U=>U.id===k.from),ie=(ne?De(o,ne):void 0)!==void 0,oe=b.find(U=>U.id===M),le=(oe?De(o,oe):void 0)!==void 0,V=ie&&le,G=V?"#6366f1":"#d9d9d9";z.push({id:`${Y}-${q}`,source:Y,target:q,type:"straight",animated:V,style:V?{stroke:G,strokeWidth:2}:{stroke:G,strokeWidth:2,strokeDasharray:"6 4",opacity:.25},markerEnd:{type:ln.ArrowClosed,color:G,width:20,height:20}})}}return{nodes:L,edges:z}}var hr=({dsl:p,steps:o,assistantId:d,agentNameMap:S,onNodeClick:b,height:O="100%"})=>{let a=!!o,l=(0,te.useMemo)(()=>({workflow:On,groupLabel:fr}),[]),{nodes:u,edges:c}=(0,te.useMemo)(()=>a?gr(p,o,void 0,S):dr(p,S),[p,o,a,S]),[h,r,s]=Cn(u),[w,I,B]=kn(c),[X,P]=(0,te.useState)(null),L=(0,te.useMemo)(()=>{if(!a||!X)return null;let Y=p.nodes.find(q=>q.id===X);return Y?De(o,Y):null},[p.nodes,o,X,a]);(0,te.useEffect)(()=>{r(u),I(c)},[u,c,r,I]);let z=(0,te.useCallback)(()=>{r(Y=>Y.map(q=>({...q,data:{...q.data,runState:q.data.runState?{...q.data.runState,selected:!1}:void 0}})))},[r]);(0,te.useEffect)(()=>{a&&r(Y=>Y.map(q=>({...q,data:{...q.data,runState:q.data.runState?{...q.data.runState,selected:q.id===X}:void 0}})))},[X,r,a]);let k=(0,te.useCallback)((Y,q)=>{a?P(q.id):b?.(q.id)},[a,b]),j=(0,te.useCallback)(()=>{a&&(z(),P(null))},[a,z]),M=(0,te.useCallback)(()=>{z(),P(null)},[z]);return!p.nodes||p.nodes.length===0?a?(0,H.jsx)("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:300},children:(0,H.jsx)(hn,{size:"large"})}):(0,H.jsx)(fn,{description:"No nodes in workflow"}):(0,H.jsx)(vn,{children:(0,H.jsx)(_n,{nodes:h,edges:w,nodeTypes:l,onNodesChange:s,onEdgesChange:B,onNodeClick:k,onPaneClick:a?j:void 0,height:O,fitView:!0,fitViewOptions:a?{padding:.3}:void 0,minZoom:a?.3:void 0,maxZoom:a?1.5:void 0,nodesDraggable:!1,nodesConnectable:a?!1:void 0,defaultEdgeOptions:a?void 0:{style:{strokeWidth:2}},backgroundGap:a?20:void 0,miniMap:a?{nodeStrokeWidth:3,pannable:!0,zoomable:!0,style:{backgroundColor:"#f5f5f5"}}:void 0,children:a&&L&&X&&(0,H.jsxs)("div",{style:{position:"absolute",right:24,top:24,width:460,maxHeight:"calc(100% - 48px)",background:"#fff",borderRadius:16,boxShadow:"0 8px 30px rgba(0,0,0,0.12)",border:"1px solid #e5e7eb",zIndex:10,overflow:"auto",padding:20},children:[(0,H.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:8},children:[(0,H.jsx)(me,{type:"secondary",style:{fontSize:11,textTransform:"uppercase",letterSpacing:.5},children:"Step Detail"}),(0,H.jsx)(me,{type:"secondary",style:{fontSize:11,cursor:"pointer"},onClick:M,children:"Close"})]}),(0,H.jsx)(pr,{step:L})]})})})},Yr=hr;var mr=Object.create,Dn=Object.defineProperty,yr=Object.getOwnPropertyDescriptor,xr=Object.getOwnPropertyNames,Sr=Object.getPrototypeOf,br=Object.prototype.hasOwnProperty,K=(p,o)=>()=>(o||(p((o={exports:{}}).exports,o),p=null),o.exports),Ar=(p,o,d,S)=>{if(o&&typeof o=="object"||typeof o=="function")for(var b=xr(o),O=0,a=b.length,l;O<a;O++)l=b[O],!br.call(p,l)&&l!==d&&Dn(p,l,{get:(u=>o[u]).bind(null,l),enumerable:!(S=yr(o,l))||S.enumerable});return p},wr=(p,o,d)=>(d=p!=null?mr(Sr(p)):{},Ar(o||!p||!p.__esModule?Dn(d,"default",{value:p,enumerable:!0}):d,p)),Pe=K(((p,o)=>{function d(u){return typeof u>"u"||u===null}function S(u){return typeof u=="object"&&u!==null}function b(u){return Array.isArray(u)?u:d(u)?[]:[u]}function O(u,c){if(c){let h=Object.keys(c);for(let r=0,s=h.length;r<s;r+=1){let w=h[r];u[w]=c[w]}}return u}function a(u,c){let h="";for(let r=0;r<c;r+=1)h+=u;return h}function l(u){return u===0&&Number.NEGATIVE_INFINITY===1/u}o.exports.isNothing=d,o.exports.isObject=S,o.exports.toArray=b,o.exports.repeat=a,o.exports.isNegativeZero=l,o.exports.extend=O})),He=K(((p,o)=>{function d(b,O){let a="",l=b.reason||"(unknown reason)";return b.mark?(b.mark.name&&(a+='in "'+b.mark.name+'" '),a+="("+(b.mark.line+1)+":"+(b.mark.column+1)+")",!O&&b.mark.snippet&&(a+=`
2
2
 
3
3
  `+b.mark.snippet),l+" "+a):l}function S(b,O){Error.call(this),this.name="YAMLException",this.reason=b,this.mark=O,this.message=d(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}S.prototype=Object.create(Error.prototype),S.prototype.constructor=S,S.prototype.toString=function(O){return this.name+": "+d(this,O)},o.exports=S})),Tr=K(((p,o)=>{var d=Pe();function S(a,l,u,c,h){let r="",s="",w=Math.floor(h/2)-1;return c-l>w&&(r=" ... ",l=c-w+r.length),u-c>w&&(s=" ...",u=c+w-s.length),{str:r+a.slice(l,u).replace(/\t/g,"\u2192")+s,pos:c-l+r.length}}function b(a,l){return d.repeat(" ",l-a.length)+a}function O(a,l){if(l=Object.create(l||null),!a.buffer)return null;l.maxLength||(l.maxLength=79),typeof l.indent!="number"&&(l.indent=1),typeof l.linesBefore!="number"&&(l.linesBefore=3),typeof l.linesAfter!="number"&&(l.linesAfter=2);let u=/\r?\n|\r|\0/g,c=[0],h=[],r,s=-1;for(;r=u.exec(a.buffer);)h.push(r.index),c.push(r.index+r[0].length),a.position<=r.index&&s<0&&(s=c.length-2);s<0&&(s=c.length-1);let w="",I=Math.min(a.line+l.linesAfter,h.length).toString().length,B=l.maxLength-(l.indent+I+3);for(let P=1;P<=l.linesBefore&&!(s-P<0);P++){let L=S(a.buffer,c[s-P],h[s-P],a.position-(c[s]-c[s-P]),B);w=d.repeat(" ",l.indent)+b((a.line-P+1).toString(),I)+" | "+L.str+`
4
4
  `+w}let X=S(a.buffer,c[s],h[s],a.position,B);w+=d.repeat(" ",l.indent)+b((a.line+1).toString(),I)+" | "+X.str+`
@@ -1 +1 @@
1
- import{q as D}from"./embed-page-chunk-J2VPD2GD.js";import{a as M}from"./embed-page-chunk-MB65DZAX.js";import{Ja as I,La as R,W as x,oa as k,ra as n,ta as m,xa as h,ya as z,yc as B}from"./embed-page-chunk-O4QK5LWZ.js";import{a as L}from"./embed-page-chunk-4BKXE5ON.js";import{e as S}from"./embed-page-chunk-6Y3UYJ6Z.js";var f=S(L());var e=S(M()),{TextArea:A}=m,{Text:r}=R,V=({open:g,onCancel:C,onSuccess:q,skill:a})=>{let[y]=n.useForm(),[N,T]=(0,f.useState)(!1),{post:P,put:O}=D(),{token:o}=I.useToken(),c=!!a,p=[{key:"category",value:"global"}],[u,d]=(0,f.useState)(p);(0,f.useEffect)(()=>{g&&a?(y.setFieldsValue({name:a.name,description:a.description,license:a.license||"",compatibility:a.compatibility||"",content:a.content||""}),a.metadata?d(Object.entries(a.metadata).map(([t,l])=>({key:t,value:l}))):d(p)):g&&!a&&(y.resetFields(),d(p))},[g,a]);let j=async()=>{try{let t=await y.validateFields();T(!0);let l=u.length>0?u.reduce((F,v)=>(v.key&&(F[v.key]=v.value),F),{}):void 0,i={id:t.name,name:t.name,description:t.description,license:t.license||void 0,compatibility:t.compatibility||void 0,metadata:l,content:t.content||void 0,subSkills:void 0},s;c?s=await O(`/api/skills/${a.id}`,i):s=await P("/api/skills",i),s.success?(h.success(c?"Skill updated successfully":"Skill created successfully"),y.resetFields(),d(p),q?.(),C()):h.error(s.message||(c?"Failed to update skill":"Failed to create skill"))}catch(t){if(t.errorFields)return;h.error(t.message||(c?"An error occurred while updating the skill":"An error occurred while creating the skill"))}finally{T(!1)}},b=()=>{y.resetFields(),d(p),C()},w=(t,l,i)=>{let s=[...u];s[t]={...s[t],[l]:i},d(s)},E=()=>{d([...u,{key:"",value:""}])};return(0,e.jsx)(z,{title:c?"Edit Skill":"Create New Skill",open:g,onCancel:b,footer:null,width:520,destroyOnClose:!0,styles:{body:{padding:16}},children:(0,e.jsx)(n,{form:y,layout:"vertical",onFinish:j,autoComplete:"off",children:(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[(0,e.jsx)(r,{style:{fontSize:12,color:o.colorTextSecondary},children:"Name"}),(0,e.jsx)(n.Item,{name:"name",rules:[{required:!0,message:"Please enter skill name"},{pattern:/^[a-z0-9]+(-[a-z0-9]+)*$/,message:"Name must be lowercase alphanumeric with single hyphens (e.g., 'my-skill')"},{min:1,max:64,message:"Name must be 1-64 characters"}],style:{marginBottom:0},children:(0,e.jsx)(m,{placeholder:"e.g., data-analysis",disabled:c})})]}),(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[(0,e.jsx)(r,{style:{fontSize:12,color:o.colorTextSecondary},children:"Description"}),(0,e.jsx)(n.Item,{name:"description",rules:[{required:!0,message:"Please enter skill description"}],style:{marginBottom:0},children:(0,e.jsx)(A,{placeholder:"Description",autoSize:{minRows:2,maxRows:4}})})]}),(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[(0,e.jsx)(r,{style:{fontSize:12,color:o.colorTextSecondary},children:"License"}),(0,e.jsx)(n.Item,{name:"license",style:{marginBottom:0},children:(0,e.jsx)(m,{placeholder:"License"})})]}),(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[(0,e.jsx)(r,{style:{fontSize:12,color:o.colorTextSecondary},children:"Compatibility"}),(0,e.jsx)(n.Item,{name:"compatibility",style:{marginBottom:0},children:(0,e.jsx)(m,{placeholder:"Compatibility"})})]}),(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8},children:[(0,e.jsx)(r,{style:{fontSize:12,color:o.colorTextSecondary,fontWeight:500},children:"Metadata"}),(0,e.jsx)(x,{size:"small",icon:(0,e.jsx)(B,{}),onClick:E,children:"Add"})]}),(0,e.jsxs)(k,{direction:"vertical",size:8,style:{width:"100%"},children:[u.length===0&&(0,e.jsx)(r,{style:{fontSize:11,color:o.colorTextTertiary},children:"No metadata yet. Use Add to create one."}),u.map((t,l)=>(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:4,width:"100%"},children:[(0,e.jsxs)(r,{style:{fontSize:11,color:o.colorTextSecondary},children:["Meta ",l+1]}),(0,e.jsxs)(k,{style:{width:"100%"},size:8,wrap:!0,children:[(0,e.jsx)(m,{value:t.key,placeholder:"Key",style:{width:140},onChange:i=>w(l,"key",i.target.value)}),(0,e.jsx)(m,{value:t.value,placeholder:"Value",style:{flex:1,minWidth:200},onChange:i=>w(l,"value",i.target.value)})]})]},l))]})]}),(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[(0,e.jsx)(r,{style:{fontSize:12,color:o.colorTextSecondary},children:"Content"}),(0,e.jsx)(n.Item,{name:"content",style:{marginBottom:0},children:(0,e.jsx)(A,{placeholder:"Content",autoSize:{minRows:4,maxRows:8}})})]}),(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:8,marginTop:8},children:[(0,e.jsx)(x,{onClick:b,children:"Cancel"}),(0,e.jsx)(x,{type:"primary",htmlType:"submit",loading:N,children:c?"Save Changes":"Create Skill"})]})]})})})},H=V;export{H as a};
1
+ import{q as D}from"./embed-page-chunk-URNZX66S.js";import{a as M}from"./embed-page-chunk-MB65DZAX.js";import{Ja as I,La as R,W as x,oa as k,ra as n,ta as m,xa as h,ya as z,yc as B}from"./embed-page-chunk-O4QK5LWZ.js";import{a as L}from"./embed-page-chunk-4BKXE5ON.js";import{e as S}from"./embed-page-chunk-6Y3UYJ6Z.js";var f=S(L());var e=S(M()),{TextArea:A}=m,{Text:r}=R,V=({open:g,onCancel:C,onSuccess:q,skill:a})=>{let[y]=n.useForm(),[N,T]=(0,f.useState)(!1),{post:P,put:O}=D(),{token:o}=I.useToken(),c=!!a,p=[{key:"category",value:"global"}],[u,d]=(0,f.useState)(p);(0,f.useEffect)(()=>{g&&a?(y.setFieldsValue({name:a.name,description:a.description,license:a.license||"",compatibility:a.compatibility||"",content:a.content||""}),a.metadata?d(Object.entries(a.metadata).map(([t,l])=>({key:t,value:l}))):d(p)):g&&!a&&(y.resetFields(),d(p))},[g,a]);let j=async()=>{try{let t=await y.validateFields();T(!0);let l=u.length>0?u.reduce((F,v)=>(v.key&&(F[v.key]=v.value),F),{}):void 0,i={id:t.name,name:t.name,description:t.description,license:t.license||void 0,compatibility:t.compatibility||void 0,metadata:l,content:t.content||void 0,subSkills:void 0},s;c?s=await O(`/api/skills/${a.id}`,i):s=await P("/api/skills",i),s.success?(h.success(c?"Skill updated successfully":"Skill created successfully"),y.resetFields(),d(p),q?.(),C()):h.error(s.message||(c?"Failed to update skill":"Failed to create skill"))}catch(t){if(t.errorFields)return;h.error(t.message||(c?"An error occurred while updating the skill":"An error occurred while creating the skill"))}finally{T(!1)}},b=()=>{y.resetFields(),d(p),C()},w=(t,l,i)=>{let s=[...u];s[t]={...s[t],[l]:i},d(s)},E=()=>{d([...u,{key:"",value:""}])};return(0,e.jsx)(z,{title:c?"Edit Skill":"Create New Skill",open:g,onCancel:b,footer:null,width:520,destroyOnClose:!0,styles:{body:{padding:16}},children:(0,e.jsx)(n,{form:y,layout:"vertical",onFinish:j,autoComplete:"off",children:(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[(0,e.jsx)(r,{style:{fontSize:12,color:o.colorTextSecondary},children:"Name"}),(0,e.jsx)(n.Item,{name:"name",rules:[{required:!0,message:"Please enter skill name"},{pattern:/^[a-z0-9]+(-[a-z0-9]+)*$/,message:"Name must be lowercase alphanumeric with single hyphens (e.g., 'my-skill')"},{min:1,max:64,message:"Name must be 1-64 characters"}],style:{marginBottom:0},children:(0,e.jsx)(m,{placeholder:"e.g., data-analysis",disabled:c})})]}),(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[(0,e.jsx)(r,{style:{fontSize:12,color:o.colorTextSecondary},children:"Description"}),(0,e.jsx)(n.Item,{name:"description",rules:[{required:!0,message:"Please enter skill description"}],style:{marginBottom:0},children:(0,e.jsx)(A,{placeholder:"Description",autoSize:{minRows:2,maxRows:4}})})]}),(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[(0,e.jsx)(r,{style:{fontSize:12,color:o.colorTextSecondary},children:"License"}),(0,e.jsx)(n.Item,{name:"license",style:{marginBottom:0},children:(0,e.jsx)(m,{placeholder:"License"})})]}),(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[(0,e.jsx)(r,{style:{fontSize:12,color:o.colorTextSecondary},children:"Compatibility"}),(0,e.jsx)(n.Item,{name:"compatibility",style:{marginBottom:0},children:(0,e.jsx)(m,{placeholder:"Compatibility"})})]}),(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8},children:[(0,e.jsx)(r,{style:{fontSize:12,color:o.colorTextSecondary,fontWeight:500},children:"Metadata"}),(0,e.jsx)(x,{size:"small",icon:(0,e.jsx)(B,{}),onClick:E,children:"Add"})]}),(0,e.jsxs)(k,{direction:"vertical",size:8,style:{width:"100%"},children:[u.length===0&&(0,e.jsx)(r,{style:{fontSize:11,color:o.colorTextTertiary},children:"No metadata yet. Use Add to create one."}),u.map((t,l)=>(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:4,width:"100%"},children:[(0,e.jsxs)(r,{style:{fontSize:11,color:o.colorTextSecondary},children:["Meta ",l+1]}),(0,e.jsxs)(k,{style:{width:"100%"},size:8,wrap:!0,children:[(0,e.jsx)(m,{value:t.key,placeholder:"Key",style:{width:140},onChange:i=>w(l,"key",i.target.value)}),(0,e.jsx)(m,{value:t.value,placeholder:"Value",style:{flex:1,minWidth:200},onChange:i=>w(l,"value",i.target.value)})]})]},l))]})]}),(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[(0,e.jsx)(r,{style:{fontSize:12,color:o.colorTextSecondary},children:"Content"}),(0,e.jsx)(n.Item,{name:"content",style:{marginBottom:0},children:(0,e.jsx)(A,{placeholder:"Content",autoSize:{minRows:4,maxRows:8}})})]}),(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:8,marginTop:8},children:[(0,e.jsx)(x,{onClick:b,children:"Cancel"}),(0,e.jsx)(x,{type:"primary",htmlType:"submit",loading:N,children:c?"Save Changes":"Create Skill"})]})]})})})},H=V;export{H as a};
@@ -1,3 +1,3 @@
1
- import{Na as I,db as S,nb as x,ob as P}from"./embed-page-chunk-E46G4ZHX.js";import{l as v}from"./embed-page-chunk-J2VPD2GD.js";import{a as s}from"./embed-page-chunk-MB65DZAX.js";import{La as y,U as f,W as h,mb as b}from"./embed-page-chunk-O4QK5LWZ.js";import{a as $}from"./embed-page-chunk-4BKXE5ON.js";import{e as a}from"./embed-page-chunk-6Y3UYJ6Z.js";var m=a($());var t=a(s()),{Text:l}=y,z=({workflowContext:e,onClose:d,onToolCompleted:p,initialMessageRequest:i,onInitialMessageSubmitted:g,attemptedInitialMessageRequestIdsRef:c,rawInitialMessage:r,showHeader:C=!0})=>{let T=v("agent-architect"),u=e?.id?`${T.tenantId}:${e.id}`:null,A=(0,m.useMemo)(()=>{if(e?.id&&e?.name)return e.type==="agent"?`[Context: You're viewing agent "${e.name}" (assistant: ${e.id})]`:`[Context: You're viewing workflow "${e.name}" (agent: ${e.id})]`},[e]),j=(0,m.useMemo)(()=>{if(!i||!e?.id)return null;if(r)return i;let o;return e.type==="workflow"?o=[`Purpose: ${i.content.trim()}`,"",`Workflow "${e.id}" has been created with an empty YAML DSL. Based on the purpose above, load the 'create-workflow' skill, design the workflow using the YAML needs+if DSL, and update it via update_workflow. Make sure to include a descriptive name.`].join(`
1
+ import{Na as I,db as S,nb as x,ob as P}from"./embed-page-chunk-YMJGPA3F.js";import{l as v}from"./embed-page-chunk-URNZX66S.js";import{a as s}from"./embed-page-chunk-MB65DZAX.js";import{La as y,U as f,W as h,mb as b}from"./embed-page-chunk-O4QK5LWZ.js";import{a as $}from"./embed-page-chunk-4BKXE5ON.js";import{e as a}from"./embed-page-chunk-6Y3UYJ6Z.js";var m=a($());var t=a(s()),{Text:l}=y,z=({workflowContext:e,onClose:d,onToolCompleted:p,initialMessageRequest:i,onInitialMessageSubmitted:g,attemptedInitialMessageRequestIdsRef:c,rawInitialMessage:r,showHeader:C=!0})=>{let T=v("agent-architect"),u=e?.id?`${T.tenantId}:${e.id}`:null,A=(0,m.useMemo)(()=>{if(e?.id&&e?.name)return e.type==="agent"?`[Context: You're viewing agent "${e.name}" (assistant: ${e.id})]`:`[Context: You're viewing workflow "${e.name}" (agent: ${e.id})]`},[e]),j=(0,m.useMemo)(()=>{if(!i||!e?.id)return null;if(r)return i;let o;return e.type==="workflow"?o=[`Purpose: ${i.content.trim()}`,"",`Workflow "${e.id}" has been created with an empty YAML DSL. Based on the purpose above, load the 'create-workflow' skill, design the workflow using the YAML needs+if DSL, and update it via update_workflow. Make sure to include a descriptive name.`].join(`
2
2
  `):o=[`Purpose: ${i.content.trim()}`,"",`Configure the topology for workflow "${e.id}" based on this purpose. Create sub-agents, set up the processing pipeline, and wire them together with topology edges.`,"The current name is a placeholder \u2014 feel free to update it via update_processing_agent if you have a better one."].join(`
3
3
  `),{...i,content:o}},[i?.requestId,i?.content,e?.id,e?.type,r]);return(0,t.jsxs)("div",{style:{height:"100%",display:"flex",flexDirection:"column",borderLeft:"1px solid #f0f0f0",background:"rgba(255, 255, 255, 0.92)"},children:[C&&(0,t.jsxs)("div",{style:{padding:"12px 12px",borderBottom:"1px solid #f0f0f0",display:"flex",justifyContent:"space-between",alignItems:"flex-start"},children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(l,{strong:!0,children:"Agent Builder"}),e&&(0,t.jsx)("div",{children:(0,t.jsxs)(l,{type:"secondary",style:{fontSize:12},children:["Viewing: ",e.name]})})]}),d&&(0,t.jsx)(h,{type:"text",size:"small","aria-label":"Close copilot",icon:(0,t.jsx)(b,{}),onClick:d})]}),u?(0,t.jsxs)(I,{threadId:u,assistantId:"agent-architect",options:{streaming:!0},onToolCompleted:p,children:[(0,t.jsx)(x,{request:j,onSubmitted:g,attemptedRequestIdsRef:c}),(0,t.jsx)(P,{showHeader:!1,showEmptyState:!1,showDatabaseSlot:!1,showSkillSlot:!1,showAgentSlot:!1,showMetricsDataSourceSlot:!1,systemContext:A})]}):(0,t.jsxs)("div",{style:{flex:1,minHeight:0,display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",height:"100%",textAlign:"center",gap:4,padding:"0 8px"},children:[(0,t.jsx)(l,{strong:!0,children:"Agent Builder"}),(0,t.jsx)(l,{type:"secondary",children:"Select a workflow to start"})]})]})};var n=a(s()),_=({project:e,projects:d,value:p,onChange:i,selectable:g=!0,loading:c})=>e?(0,n.jsxs)("div",{"data-testid":"training-context-card",style:{display:"flex",alignItems:"center",gap:8},children:[(0,n.jsx)("span",{style:{fontSize:12,color:"rgba(0,0,0,0.45)",flexShrink:0},children:"Learning project"}),g?(0,n.jsx)(S,{kind:"training",value:p??e.id,onChange:r=>{r&&i?.(r)},style:{minWidth:0}}):(0,n.jsx)("span",{style:{fontSize:12,fontWeight:500},children:e.name})]}):c?null:(0,n.jsx)(f,{type:"warning",showIcon:!0,message:"No learning project is available",description:"A learning project is required before starting a learning task."});export{_ as a,z as b};