@seele00/seele-work 0.1.152 → 0.1.153
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.
- package/libexec/seele-server +0 -0
- package/libexec/seele-worker +0 -0
- package/libexec/seele-workspace-observe +0 -0
- package/package.json +1 -1
- package/release-manifest.json +129 -129
- package/web/dist/assets/{abnfDiagram-VRR7QNED-BG3tyTmb.js → abnfDiagram-VRR7QNED-BXUnAYy1.js} +1 -1
- package/web/dist/assets/{arc-ezUSFuSo.js → arc-53wARNrl.js} +1 -1
- package/web/dist/assets/{architectureDiagram-ZJ3FMSHR-Ca20Hrh0.js → architectureDiagram-ZJ3FMSHR-SJZDDwYf.js} +1 -1
- package/web/dist/assets/{blockDiagram-677ZJIJ3-BLou1WTp.js → blockDiagram-677ZJIJ3-DbKO700n.js} +1 -1
- package/web/dist/assets/{c4Diagram-LMCZKHZV-bU3CVEAF.js → c4Diagram-LMCZKHZV-BYE7g-nB.js} +1 -1
- package/web/dist/assets/channel-CaTYr4r5.js +1 -0
- package/web/dist/assets/{chunk-2Q5K7J3B-DcU2w6jp.js → chunk-2Q5K7J3B-CqFppuhN.js} +1 -1
- package/web/dist/assets/{chunk-32BRIVSS-BLThj2Sc.js → chunk-32BRIVSS-eEusMDMJ.js} +1 -1
- package/web/dist/assets/{chunk-5VM5RSS4-DXardrlm.js → chunk-5VM5RSS4-CJ91qQ4w.js} +1 -1
- package/web/dist/assets/{chunk-EX3LRPZG-DuNQt8yE.js → chunk-EX3LRPZG-CbAAtSPb.js} +1 -1
- package/web/dist/assets/{chunk-JWPE2WC7-DJU6tBtW.js → chunk-JWPE2WC7-D3aDj1I0.js} +1 -1
- package/web/dist/assets/{chunk-MOJQB5TN-BB6I-HZx.js → chunk-MOJQB5TN-C8rdmILd.js} +1 -1
- package/web/dist/assets/{chunk-RYQCIY6F-DY2JbQCr.js → chunk-RYQCIY6F-D4KKJ2jI.js} +1 -1
- package/web/dist/assets/{chunk-V7JOEXUC-Dk77emkI.js → chunk-V7JOEXUC-_9Qung-i.js} +1 -1
- package/web/dist/assets/{chunk-VR4S4FIN-B2JIBcqk.js → chunk-VR4S4FIN-Cln1zitT.js} +1 -1
- package/web/dist/assets/{chunk-XXDRQBXY-DVsxHcYJ.js → chunk-XXDRQBXY-CMoxzK3k.js} +1 -1
- package/web/dist/assets/classDiagram-OUVF2IWQ-BISkPzyL.js +1 -0
- package/web/dist/assets/classDiagram-v2-EOCWNBFH-BISkPzyL.js +1 -0
- package/web/dist/assets/{core-CruSQzKn.js → core-ltv4hIDV.js} +1 -1
- package/web/dist/assets/{cose-bilkent-JH36ORCC-CwVXchn0.js → cose-bilkent-JH36ORCC-CFlxYoog.js} +1 -1
- package/web/dist/assets/{cynefin-VYW2F7L2-D2YMqMBJ.js → cynefin-VYW2F7L2-C5pA8NwW.js} +1 -1
- package/web/dist/assets/{cynefinDiagram-TSTJHNR4-DCP3Wx8r.js → cynefinDiagram-TSTJHNR4-BpeXw1Kv.js} +1 -1
- package/web/dist/assets/{dagre-VKFMJZFB-DE3TUaKQ.js → dagre-VKFMJZFB-BHq-ApmK.js} +1 -1
- package/web/dist/assets/{diagram-FQU43EPY-DKAkibrw.js → diagram-FQU43EPY-DOifkoYg.js} +1 -1
- package/web/dist/assets/{diagram-G47NLZAW-C5gNyQIG.js → diagram-G47NLZAW-BGIh9qDI.js} +1 -1
- package/web/dist/assets/{diagram-NH7WQ7WH-B-j207e6.js → diagram-NH7WQ7WH-DJ4xILn0.js} +1 -1
- package/web/dist/assets/{diagram-OA4YK3LP-BS1JdgBI.js → diagram-OA4YK3LP-B6XqE-l1.js} +1 -1
- package/web/dist/assets/{diagram-WEI45ONY-DZHwAtC_.js → diagram-WEI45ONY-D1NNR-Ab.js} +1 -1
- package/web/dist/assets/{ebnfDiagram-CCIWWBDH-CLp0LOen.js → ebnfDiagram-CCIWWBDH-DIr5vXCH.js} +1 -1
- package/web/dist/assets/{elk.bundled-BeVsvm14.js → elk.bundled-C7Zlu-gt.js} +1 -1
- package/web/dist/assets/{erDiagram-Q63AITRT-BpnDaZBr.js → erDiagram-Q63AITRT-BYFNAHpa.js} +1 -1
- package/web/dist/assets/{flowDiagram-23GEKE2U-C7oo_QiD.js → flowDiagram-23GEKE2U-DVi8Kk9a.js} +1 -1
- package/web/dist/assets/{ganttDiagram-NO4QXBWP-CRwT8WNN.js → ganttDiagram-NO4QXBWP-BxLkUvlf.js} +1 -1
- package/web/dist/assets/{gitGraphDiagram-IHSO6WYX--LjT75YM.js → gitGraphDiagram-IHSO6WYX-DdlkHLng.js} +1 -1
- package/web/dist/assets/{index-C38m3y6N.js → index-DNE6__zt.js} +2 -2
- package/web/dist/assets/index-DsrZ4q94.css +1 -0
- package/web/dist/assets/{infoDiagram-FWYZ7A6U-DVMB8alx.js → infoDiagram-FWYZ7A6U-BsdOHu2Q.js} +1 -1
- package/web/dist/assets/{ishikawaDiagram-FXEZZL3T-BjLjkotR.js → ishikawaDiagram-FXEZZL3T-DzzG-V3B.js} +1 -1
- package/web/dist/assets/{journeyDiagram-5HDEW3XC-CDo_kXmC.js → journeyDiagram-5HDEW3XC-DnPSVWTt.js} +1 -1
- package/web/dist/assets/{kanban-definition-HUTT4EX6-DvP-GhGo.js → kanban-definition-HUTT4EX6-BfpQqT8H.js} +1 -1
- package/web/dist/assets/{linear-B08q6gnY.js → linear-DluaDvSi.js} +1 -1
- package/web/dist/assets/{mermaid.core-DjEzKVHD.js → mermaid.core-CvqU6Jn1.js} +5 -5
- package/web/dist/assets/{mindmap-definition-LN4V7U3C-CxnaHyFy.js → mindmap-definition-LN4V7U3C-Cewm4A76.js} +1 -1
- package/web/dist/assets/{pegDiagram-2B236MQR-Cw55JTna.js → pegDiagram-2B236MQR-DECYl-R0.js} +1 -1
- package/web/dist/assets/{pieDiagram-ENE6RG2P-C8nPdf5A.js → pieDiagram-ENE6RG2P-UTyhNaUU.js} +1 -1
- package/web/dist/assets/{quadrantDiagram-ABIIQ3AL-B_mNVZdW.js → quadrantDiagram-ABIIQ3AL-B4CHxAaN.js} +1 -1
- package/web/dist/assets/{railroadDiagram-RFXS5EU6-BnYwT77J.js → railroadDiagram-RFXS5EU6-dBA0x_06.js} +1 -1
- package/web/dist/assets/{requirementDiagram-TGXJPOKE-QBybBaIE.js → requirementDiagram-TGXJPOKE-Ci7x7TRz.js} +1 -1
- package/web/dist/assets/{sankeyDiagram-HTMAVEWB-DsAvajPT.js → sankeyDiagram-HTMAVEWB-D8i79jfY.js} +1 -1
- package/web/dist/assets/{sequenceDiagram-DBY2YBRQ-CRYoGZnS.js → sequenceDiagram-DBY2YBRQ-ClS3Faqs.js} +1 -1
- package/web/dist/assets/{sizeCapture-X5ZJPWSS-BE4z-GxE.js → sizeCapture-X5ZJPWSS-iDkRzG0V.js} +1 -1
- package/web/dist/assets/{stateDiagram-2N3HPSRC-NrX-tFZp.js → stateDiagram-2N3HPSRC-BVXquUJ8.js} +1 -1
- package/web/dist/assets/stateDiagram-v2-6OUMAXLB-DVaftScu.js +1 -0
- package/web/dist/assets/{swimlanes-5IMT3BWC-BARYcuS1.js → swimlanes-5IMT3BWC-DjilNSuP.js} +2 -2
- package/web/dist/assets/swimlanesDiagram-G3AALYLV-DMr_hTdp.js +8 -0
- package/web/dist/assets/{timeline-definition-FHXFAJF6-Chc-uDR6.js → timeline-definition-FHXFAJF6-jJ8nZDG8.js} +1 -1
- package/web/dist/assets/{vennDiagram-L72KCM5P-P_37SINz.js → vennDiagram-L72KCM5P-CKWsQiLS.js} +1 -1
- package/web/dist/assets/{wardleyDiagram-EHGQE667-BQaXMER9.js → wardleyDiagram-EHGQE667-DU2J2pYa.js} +1 -1
- package/web/dist/assets/{xychartDiagram-FW5EYKEG-C7vAinN7.js → xychartDiagram-FW5EYKEG-DdGt7i9k.js} +1 -1
- package/web/dist/index.html +2 -2
- package/web/dist/assets/channel-DENgSH_9.js +0 -1
- package/web/dist/assets/classDiagram-OUVF2IWQ-BCmJGj6l.js +0 -1
- package/web/dist/assets/classDiagram-v2-EOCWNBFH-BCmJGj6l.js +0 -1
- package/web/dist/assets/index-Bt5CLMsA.css +0 -1
- package/web/dist/assets/stateDiagram-v2-6OUMAXLB-BUqWo-Fj.js +0 -1
- package/web/dist/assets/swimlanesDiagram-G3AALYLV-D93RbTMf.js +0 -8
|
@@ -343,7 +343,7 @@ $$
|
|
|
343
343
|
|
|
344
344
|
`:t)}const N3=/[#.]/g;function tA(e,t){const n=e||"",a={};let l=0,u,c;for(;l<n.length;){N3.lastIndex=l;const f=N3.exec(n),h=n.slice(l,f?f.index:n.length);h&&(u?u==="#"?a.id=h:Array.isArray(a.className)?a.className.push(h):a.className=[h]:c=h,l+=h.length),f&&(u=f[0],l++)}return{type:"element",tagName:c||t||"div",properties:a,children:[]}}function K6(e,t,n){const a=n?iA(n):void 0;function l(u,c,...f){let h;if(u==null){h={type:"root",children:[]};const m=c;f.unshift(m)}else{h=tA(u,t);const m=h.tagName.toLowerCase(),g=a?a.get(m):void 0;if(h.tagName=g||m,nA(c))f.unshift(c);else for(const[v,k]of Object.entries(c))rA(e,h.properties,v,k)}for(const m of f)Yp(h.children,m);return h.type==="element"&&h.tagName==="template"&&(h.content={type:"root",children:h.children},h.children=[]),h}return l}function nA(e){if(e===null||typeof e!="object"||Array.isArray(e))return!0;if(typeof e.type!="string")return!1;const t=e,n=Object.keys(e);for(const a of n){const l=t[a];if(l&&typeof l=="object"){if(!Array.isArray(l))return!0;const u=l;for(const c of u)if(typeof c!="number"&&typeof c!="string")return!0}}return!!("children"in e&&Array.isArray(e.children))}function rA(e,t,n,a){const l=Yv(e,n);let u;if(a!=null){if(typeof a=="number"){if(Number.isNaN(a))return;u=a}else typeof a=="boolean"?u=a:typeof a=="string"?l.spaceSeparated?u=a2(a):l.commaSeparated?u=Jy(a):l.commaOrSpaceSeparated?u=a2(Jy(a).join(" ")):u=M3(l,l.property,a):Array.isArray(a)?u=[...a]:u=l.property==="style"?aA(a):String(a);if(Array.isArray(u)){const c=[];for(const f of u)c.push(M3(l,l.property,f));u=c}l.property==="className"&&Array.isArray(t.className)&&(u=t.className.concat(u)),t[l.property]=u}}function Yp(e,t){if(t!=null)if(typeof t=="number"||typeof t=="string")e.push({type:"text",value:String(t)});else if(Array.isArray(t))for(const n of t)Yp(e,n);else if(typeof t=="object"&&"type"in t)t.type==="root"?Yp(e,t.children):e.push(t);else throw new Error("Expected node, nodes, or string, got `"+t+"`")}function M3(e,t,n){if(typeof n=="string"){if(e.number&&n&&!Number.isNaN(Number(n)))return Number(n);if((e.boolean||e.overloadedBoolean)&&(n===""||Wc(n)===Wc(t)))return!0}return n}function aA(e){const t=[];for(const[n,a]of Object.entries(e))t.push([n,a].join(": "));return t.join("; ")}function iA(e){const t=new Map;for(const n of e)t.set(n.toLowerCase(),n);return t}const lA=["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","glyphRef","linearGradient","radialGradient","solidColor","textArea","textPath"],sA=K6(Wv,"div"),oA=K6(yf,"g",lA),tp={html:"http://www.w3.org/1999/xhtml",svg:"http://www.w3.org/2000/svg"};function uA(e,t){return X6(e,{})||{type:"root",children:[]}}function X6(e,t){const n=cA(e,t);return n&&t.afterTransform&&t.afterTransform(e,n),n}function cA(e,t){switch(e.nodeType){case 1:return mA(e,t);case 3:return fA(e);case 8:return hA(e);case 9:return D3(e,t);case 10:return dA();case 11:return D3(e,t);default:return}}function D3(e,t){return{type:"root",children:Z6(e,t)}}function dA(){return{type:"doctype"}}function fA(e){return{type:"text",value:e.nodeValue||""}}function hA(e){return{type:"comment",value:e.nodeValue||""}}function mA(e,t){const n=e.namespaceURI,a=n===tp.svg?oA:sA,l=n===tp.html?e.tagName.toLowerCase():e.tagName,u=n===tp.html&&l==="template"?e.content:e,c=e.getAttributeNames(),f={};let h=-1;for(;++h<c.length;)f[c[h]]=e.getAttribute(c[h])||"";return a(l,f,Z6(u,t))}function Z6(e,t){const n=e.childNodes,a=[];let l=-1;for(;++l<n.length;){const u=X6(n[l],t);u!==void 0&&a.push(u)}return a}new DOMParser;function pA(e,t){const n=gA(e);return uA(n)}function gA(e){const t=document.createElement("template");return t.innerHTML=e,t.content}const z3=(function(e,t,n){const a=r0(n);if(!e||!e.type||!e.children)throw new Error("Expected parent node");if(typeof t=="number"){if(t<0||t===Number.POSITIVE_INFINITY)throw new Error("Expected positive finite number as index")}else if(t=e.children.indexOf(t),t<0)throw new Error("Expected child node or index");for(;++t<e.children.length;)if(a(e.children[t],t,e))return e.children[t]}),Qs=(function(e){if(e==null)return xA;if(typeof e=="string")return vA(e);if(typeof e=="object")return yA(e);if(typeof e=="function")return G1(e);throw new Error("Expected function, string, or array as `test`")});function yA(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Qs(e[n]);return G1(a);function a(...l){let u=-1;for(;++u<t.length;)if(t[u].apply(this,l))return!0;return!1}}function vA(e){return G1(t);function t(n){return n.tagName===e}}function G1(e){return t;function t(n,a,l){return!!(bA(n)&&e.call(this,n,typeof a=="number"?a:void 0,l||void 0))}}function xA(e){return!!(e&&typeof e=="object"&&"type"in e&&e.type==="element"&&"tagName"in e&&typeof e.tagName=="string")}function bA(e){return e!==null&&typeof e=="object"&&"type"in e&&"tagName"in e}const R3=/\n/g,O3=/[\t ]+/g,Wp=Qs("br"),I3=Qs(EA),wA=Qs("p"),_3=Qs("tr"),kA=Qs(["datalist","head","noembed","noframes","noscript","rp","script","style","template","title",AA,NA]),Q6=Qs(["address","article","aside","blockquote","body","caption","center","dd","dialog","dir","dl","dt","div","figure","figcaption","footer","form,","h1","h2","h3","h4","h5","h6","header","hgroup","hr","html","legend","li","listing","main","menu","nav","ol","p","plaintext","pre","section","ul","xmp"]);function SA(e,t){const n=t||{},a="children"in e?e.children:[],l=Q6(e),u=tx(e,{whitespace:n.whitespace||"normal"}),c=[];(e.type==="text"||e.type==="comment")&&c.push(...ex(e,{breakBefore:!0,breakAfter:!0}));let f=-1;for(;++f<a.length;)c.push(...J6(a[f],e,{whitespace:u,breakBefore:f?void 0:l,breakAfter:f<a.length-1?Wp(a[f+1]):l}));const h=[];let m;for(f=-1;++f<c.length;){const g=c[f];typeof g=="number"?m!==void 0&&g>m&&(m=g):g&&(m!==void 0&&m>-1&&h.push(`
|
|
345
345
|
`.repeat(m)||" "),m=-1,h.push(g))}return h.join("")}function J6(e,t,n){return e.type==="element"?jA(e,t,n):e.type==="text"?n.whitespace==="normal"?ex(e,n):CA(e):[]}function jA(e,t,n){const a=tx(e,n),l=e.children||[];let u=-1,c=[];if(kA(e))return c;let f,h;for(Wp(e)||_3(e)&&z3(t,e,_3)?h=`
|
|
346
|
-
`:wA(e)?(f=2,h=2):Q6(e)&&(f=1,h=1);++u<l.length;)c=c.concat(J6(l[u],e,{whitespace:a,breakBefore:u?void 0:f,breakAfter:u<l.length-1?Wp(l[u+1]):h}));return I3(e)&&z3(t,e,I3)&&c.push(" "),f&&c.unshift(f),h&&c.push(h),c}function ex(e,t){const n=String(e.value),a=[],l=[];let u=0;for(;u<=n.length;){R3.lastIndex=u;const h=R3.exec(n),m=h&&"index"in h?h.index:n.length;a.push(TA(n.slice(u,m).replace(/[\u061C\u200E\u200F\u202A-\u202E\u2066-\u2069]/g,""),u===0?t.breakBefore:!0,m===n.length?t.breakAfter:!0)),u=m+1}let c=-1,f;for(;++c<a.length;)a[c].charCodeAt(a[c].length-1)===8203||c<a.length-1&&a[c+1].charCodeAt(0)===8203?(l.push(a[c]),f=void 0):a[c]?(typeof f=="number"&&l.push(f),l.push(a[c]),f=0):(c===0||c===a.length-1)&&l.push(0);return l}function CA(e){return[String(e.value)]}function TA(e,t,n){const a=[];let l=0,u;for(;l<e.length;){O3.lastIndex=l;const c=O3.exec(e);u=c?c.index:e.length,!l&&!u&&c&&!t&&a.push(""),l!==u&&a.push(e.slice(l,u)),l=c?u+c[0].length:u}return l!==u&&!n&&a.push(""),a.join(" ")}function tx(e,t){if(e.type==="element"){const n=e.properties||{};switch(e.tagName){case"listing":case"plaintext":case"xmp":return"pre";case"nobr":return"nowrap";case"pre":return n.wrap?"pre-wrap":"pre";case"td":case"th":return n.noWrap?"nowrap":t.whitespace;case"textarea":return"pre-wrap"}}return t.whitespace}function AA(e){return!!(e.properties||{}).hidden}function EA(e){return e.tagName==="td"||e.tagName==="th"}function NA(e){return e.tagName==="dialog"&&!(e.properties||{}).open}const MA={},DA=[];function zA(e){const t=e||MA;return function(n,a){S1(n,"element",function(l,u){const c=Array.isArray(l.properties.className)?l.properties.className:DA,f=c.includes("language-math"),h=c.includes("math-display"),m=c.includes("math-inline");let g=h;if(!f&&!h&&!m)return;let v=u[u.length-1],k=l;if(l.tagName==="code"&&f&&v&&v.type==="element"&&v.tagName==="pre"&&(k=v,v=u[u.length-2],g=!0),!v)return;const b=SA(k,{whitespace:"pre"});let C;try{C=Vp.renderToString(b,{...t,displayMode:g,throwOnError:!0})}catch(L){const z=L,E=z.name.toLowerCase();a.message("Could not render math with KaTeX",{ancestors:[...u,l],cause:z,place:l.position,ruleId:E,source:"rehype-katex"});try{C=Vp.renderToString(b,{...t,displayMode:g,strict:"ignore",throwOnError:!1})}catch{C=[{type:"element",tagName:"span",properties:{className:["katex-error"],style:"color:"+(t.errorColor||"#cc0000"),title:String(L)},children:[{type:"text",value:b}]}]}}typeof C=="string"&&(C=pA(C).children);const D=v.children.indexOf(k);return v.children.splice(D,1,...C),w5})}}function RA(e,t,n){return e?t?n==="delta"?e+t:t.startsWith(e)?t:e:e:t}function OA(e,t,n){if(e.kind||e.status!=="pending")return e.status;const a=[...t].reverse().find(l=>l.nodeId===e.id);return a?a.status==="completed"?n.some(l=>l.executionId===a.id&&l.type==="result")?"delivered":"awaiting_review":["accepted","running","failed","cancelled"].includes(a.status)?a.status:e.status:e.status}function IA(e,t){var l;if(!["input:cotask_report","input:cotask_execution"].includes(e.subtype))return null;const n=Date.parse(e.createdAt);return((l=t.filter(u=>(!e.turnId||e.turnId===u.id)&&Date.parse(u.startedAt)<n&&(!u.finishedAt||n<=Date.parse(u.finishedAt))).sort((u,c)=>Date.parse(c.startedAt)-Date.parse(u.startedAt))[0])==null?void 0:l.id)??null}const uu=224,_f=100,L3=e=>`${e.x},${e.y}`,np=(e,t)=>Math.hypot(e.x-t.x,e.y-t.y),_A=(e,t)=>({x:(e.x+t.x)/2,y:(e.y+t.y)/2});function Kp(e,t,n=0){const a=Math.min(...e.map(g=>g.x)),l=Math.max(...e.map(g=>g.x)),u=Math.min(...e.map(g=>g.y)),c=Math.max(...e.map(g=>g.y));if(l<t.x-4||a>t.x+uu+4||c<t.y-4||u>t.y+_f+4)return!1;if(n>=16||Math.max(l-a,c-u)<.25)return!0;const f=[e[0]],h=[e[e.length-1]];let m=e;for(;m.length>1;)m=m.slice(1).map((g,v)=>_A(m[v],g)),f.push(m[0]),h.unshift(m[m.length-1]);return Kp(f,t,n+1)||Kp(h,t,n+1)}function B3(e,t){return e.every(n=>t.every(a=>!Kp(n,a)))}function LA(e,t){const n=[];let a=e[0];const l=(u,c,f)=>{const h=f/np(u,c);return{x:u.x+(c.x-u.x)*h,y:u.y+(c.y-u.y)*h}};for(let u=1;u<e.length-1;u++){const c=e[u],f=e[u-1],h=e[u+1],m=Math.min(t,np(c,f)/2,np(c,h)/2);if(m<.001){n.push([a,c]),a=c;continue}const g=l(c,f,m),v=l(c,h,m);n.push([a,g],[g,c,v]),a=v}return n.push([a,e[e.length-1]]),n}function q3(e){return`M ${L3(e[0][0])} `+e.map(t=>`${t.length===4?"C":t.length===3?"Q":"L"} ${t.slice(1).map(L3).join(" ")}`).join(" ")}function nx(e,t){const n=e[0],a=e[e.length-1],l=(n.y+a.y)/2,u=[[n,{x:n.x,y:l},{x:a.x,y:l},a]];if(a.y>n.y&&B3(u,t))return{path:q3(u),segments:u};for(const c of[64,40,24,12,6,2,0]){const f=LA(e,c);if(B3(f,t))return{path:q3(f),segments:f}}throw new Error("No unobstructed CoTask route")}function BA(e){return JSON.stringify(e.map(t=>({id:t.id,dependencies:[...t.dependencies].sort()})).sort((t,n)=>t.id.localeCompare(n.id)))}function rx(e){const t=new Map,n=new Map,a=new Map(e.map(m=>[m.id,m])),l=[];for(;a.size;){const m=[...a.values()].filter(v=>v.dependencies.every(k=>n.has(k)||!a.has(k))),g=m.length?m:[...a.values()];l.push(g);for(const v of g)a.delete(v.id),n.set(v.id,l.length-1)}const u=Math.max(1,...l.map(m=>m.length))*296+24;l.forEach((m,g)=>m.forEach((v,k)=>t.set(v.id,{x:(u-(m.length*296-72))/2+k*296,y:48+g*200})));const c=[...t].map(([m,g])=>({id:m,...g})),f=[];let h=u;for(const m of e)for(const g of m.dependencies){const v=t.get(g),k=t.get(m.id);if(!v||!k)continue;const b={x:v.x+uu/2,y:v.y+_f},C={x:k.x+uu/2,y:k.y};h+=18;const D=[b,{x:b.x,y:b.y+25},{x:h,y:b.y+25},{x:h,y:C.y-25},{x:C.x,y:C.y-25},C],L=c.filter(z=>z.id!==g&&z.id!==m.id);f.push({source:g,target:m.id,path:nx(D,L).path})}return{positions:t,edges:f,width:h+48,height:Math.max(196,96+l.length*200-100)}}async function qA(e){var m;if(!e.length)return rx(e);const{default:t}=await rn(async()=>{const{default:g}=await import("./elk.bundled-BeVsvm14.js").then(v=>v.e);return{default:g}},[],import.meta.url),n=new Set(e.map(g=>g.id)),a=e.flatMap(g=>g.dependencies.filter(v=>n.has(v)).map(v=>({source:v,target:g.id}))),u=await new t().layout({id:"root",layoutOptions:{"elk.algorithm":"layered","elk.direction":"DOWN","elk.edgeRouting":"ORTHOGONAL","elk.spacing.nodeNode":"40","elk.layered.spacing.nodeNodeBetweenLayers":"80","elk.layered.spacing.edgeNodeBetweenLayers":"18","elk.padding":"[top=48,left=48,bottom=48,right=48]","elk.layered.crossingMinimization.strategy":"LAYER_SWEEP","elk.layered.nodePlacement.strategy":"NETWORK_SIMPLEX"},children:e.map(g=>({id:g.id,width:uu,height:_f})),edges:a.map((g,v)=>({id:`edge-${v}`,sources:[g.source],targets:[g.target]}))}),c=(u.children??[]).map(g=>({id:g.id,x:g.x??0,y:g.y??0})),f=new Map((m=u.edges)==null?void 0:m.map(g=>[g.id,g])),h=a.map((g,v)=>{var C,D;const k=(D=(C=f.get(`edge-${v}`))==null?void 0:C.sections)==null?void 0:D[0];if(!k)throw new Error("Missing CoTask dependency route");const b=[k.startPoint,...k.bendPoints??[],k.endPoint];return{...g,path:nx(b,c.filter(L=>L.id!==g.source&&L.id!==g.target)).path}});return{positions:new Map(c.map(g=>[g.id,g])),edges:h,width:u.width??320,height:u.height??196}}const U3={pending:"待开始",completed:"已确认完成",blocked:"已阻塞",cancelled:"已取消",running:"执行中",accepted:"等待执行",failed:"执行失败",delivered:"已交付,待确认",awaiting_review:"执行已结束,待确认"};function UA({nodes:e,members:t,executions:n,reports:a,selectedId:l,onSelect:u,onDismiss:c,detail:f,finalCheckpointId:h}){const m=e.some(ge=>ge.kind!==void 0),g=(ge,He)=>ge.kind==="checkpoint"?{pending:"等待前置完成",waiting:"等待 Owner 继续",completed:"已继续"}[He]??U3[He]??He:ge.kind&&He==="completed"?"已完成":U3[He]??He,v=BA(e),k=M.useMemo(()=>rx(JSON.parse(v)),[v]),[b,C]=M.useState(null),[D,L]=M.useState(!1),z=(b==null?void 0:b.topology)===v?b.graph:k;M.useEffect(()=>{let ge=!0;return L(!1),qA(JSON.parse(v)).then(He=>{ge&&C({topology:v,graph:He})}).catch(()=>{ge&&L(!0)}),()=>{ge=!1}},[v]);const E=M.useRef(null),[B,q]=M.useState({width:900,height:560}),[X,G]=M.useState(null),[U,Z]=M.useState({left:0,top:0}),[J,F]=M.useState(!1),[pe,ce]=M.useState(!1),Oe=M.useRef(!1),we=M.useRef(null);M.useEffect(()=>{F(!1)},[l]);const de=M.useId().replace(/:/g,"");M.useEffect(()=>{if(!E.current)return;const ge=new ResizeObserver(([He])=>q({width:He.contentRect.width,height:He.contentRect.height}));return ge.observe(E.current),()=>ge.disconnect()},[]);const ee=Math.min(1,Math.max(.15,Math.min((B.width-32)/z.width,(B.height-32)/z.height))),Y=X??ee,he=new Map(e.map(ge=>[ge.id,OA(ge,n,a)])),Te=e.find(ge=>ge.id===l),$=l?z.positions.get(l):void 0,I=Math.min(320,Math.max(0,B.width-24)),ae=Math.min(420,Math.max(0,B.height-24)),R=$?Math.max(0,(B.width-z.width*Y)/2)+$.x*Y-U.left:0,ne=$?Math.max(0,(B.height-z.height*Y)/2)+$.y*Y-U.top:0,Ce=R+uu*Y+12,Ie=Math.max(12,Math.min(B.width-I-12,Ce+I<=B.width-12?Ce:R-I-12)),Fe=Math.max(12,Math.min(B.height-ae-12,ne));return o.jsxs("section",{className:"cotask-graph","aria-label":"Task dependency graph",children:[o.jsxs("div",{className:"cotask-graph-toolbar",children:[o.jsxs("span",{children:["Arrows show dependencies ",o.jsxs("span",{className:"cotask-graph-count",children:["· ",e.length," nodes / ",z.edges.length," dependencies"]}),D&&o.jsx("small",{role:"status",children:" · 自动布局暂不可用,已显示基础布局"})]}),o.jsxs("div",{children:[o.jsx("button",{"aria-label":"Zoom out",onClick:()=>G(Math.max(.15,Y-.15)),children:"−"}),o.jsxs("span",{children:[Math.round(Y*100),"%"]}),o.jsx("button",{"aria-label":"Zoom in",onClick:()=>G(Math.min(2,Y+.15)),children:"+"}),o.jsx("button",{onClick:()=>G(null),children:"Fit to view"})]})]}),o.jsxs("div",{className:"cotask-graph-stage",children:[o.jsx("div",{className:`cotask-graph-viewport${pe?" dragging":""}`,ref:E,"data-layout":(b==null?void 0:b.topology)===v?"adaptive":"fallback",onScroll:ge=>Z({left:ge.currentTarget.scrollLeft,top:ge.currentTarget.scrollTop}),onClickCapture:ge=>{Oe.current&&(ge.preventDefault(),ge.stopPropagation())},onClick:ge=>{ge.target.closest("button")||c()},onPointerDown:ge=>{if(ge.button!==0||ge.target.closest(".cotask-node-text"))return;Oe.current=!1;const He=ge.currentTarget;we.current={id:ge.pointerId,x:ge.clientX,y:ge.clientY,left:He.scrollLeft,top:He.scrollTop,moved:!1}},onPointerMove:ge=>{if(!we.current||we.current.id!==ge.pointerId)return;const He=ge.clientX-we.current.x,me=ge.clientY-we.current.y;Math.abs(He)+Math.abs(me)>4&&(we.current.moved=!0,ce(!0),ge.currentTarget.setPointerCapture(ge.pointerId),ge.preventDefault()),we.current.moved&&(ge.currentTarget.scrollLeft=we.current.left-He,ge.currentTarget.scrollTop=we.current.top-me)},onPointerUp:ge=>{we.current&&(Oe.current=we.current.moved,we.current=null,ce(!1),ge.currentTarget.hasPointerCapture(ge.pointerId)&&ge.currentTarget.releasePointerCapture(ge.pointerId),window.setTimeout(()=>{Oe.current=!1},0))},onPointerCancel:()=>{we.current=null,ce(!1)},onLostPointerCapture:()=>{we.current=null,ce(!1)},children:o.jsx("div",{className:"cotask-graph-scroll",style:{width:Math.max(B.width,z.width*Y),height:Math.max(B.height,z.height*Y)},children:o.jsxs("div",{className:"cotask-graph-canvas",style:{width:z.width,height:z.height,transform:`scale(${Y})`,left:Math.max(0,(B.width-z.width*Y)/2),top:Math.max(0,(B.height-z.height*Y)/2)},children:[o.jsxs("svg",{width:z.width,height:z.height,className:"cotask-graph-edges","aria-hidden":"true",children:[o.jsx("defs",{children:["default","complete","selected"].map(ge=>o.jsx("marker",{id:`${de}-${ge}`,markerWidth:"8",markerHeight:"8",refX:"7",refY:"4",orient:"auto",markerUnits:"userSpaceOnUse",children:o.jsx("path",{d:"M 1 1 L 7 4 L 1 7 Z",className:`cotask-arrow-${ge}`})},ge))}),z.edges.map(ge=>{const He=l&&[ge.source,ge.target].includes(l)?"selected":he.get(ge.source)==="completed"?"complete":"default";return o.jsx("path",{"data-source":ge.source,"data-target":ge.target,d:ge.path,className:`cotask-edge ${He}`,markerEnd:`url(#${de}-${He})`},`${ge.source}:${ge.target}`)})]}),e.map(ge=>{var We;const He=z.positions.get(ge.id),me=he.get(ge.id);return o.jsxs("button",{className:`cotask-graph-node ${me}${l===ge.id?" selected":""}`,style:{left:He.x,top:He.y,width:uu,height:_f},"aria-pressed":l===ge.id,onClick:()=>u(ge),title:ge.dependencies.length?`Depends on: ${ge.dependencies.map(qe=>{var nt;return((nt=e.find(Ze=>Ze.id===qe))==null?void 0:nt.name)??qe}).join(", ")}`:"No dependencies",children:[ge.dependencies.length>0&&o.jsx("i",{className:"cotask-node-port input"}),o.jsxs("span",{className:"cotask-graph-node-status",children:[o.jsx("i",{}),o.jsx("span",{className:"cotask-node-text",children:g(ge,me)})]}),o.jsx("strong",{className:"cotask-node-text",children:ge.name}),o.jsx("span",{className:"cotask-graph-node-member cotask-node-text",children:ge.kind==="checkpoint"?ge.id===h?"最终检查点 · Owner":"检查点 · Owner":((We=t.find(qe=>qe.id===ge.memberId))==null?void 0:We.name)??ge.memberId}),z.edges.some(qe=>qe.source===ge.id)&&o.jsx("i",{className:"cotask-node-port output"})]},ge.id)})]})})}),Te&&$&&o.jsxs("aside",{className:`cotask-node-popover${J?" expanded":""}`,"aria-label":`Node details: ${Te.name}`,style:J?void 0:{left:Ie,top:Fe,width:I,maxHeight:ae},onKeyDown:ge=>{ge.key==="Escape"&&(ge.stopPropagation(),c())},children:[o.jsxs("header",{children:[o.jsx("strong",{children:Te.name}),o.jsx("button",{onClick:()=>F(!J),"aria-label":J?"Collapse node details":"Expand node details",children:J?"Collapse":"Expand"}),o.jsx("button",{onClick:c,"aria-label":"Close node details",children:"×"})]}),o.jsx("div",{className:"cotask-node-popover-content",children:f})]})]}),o.jsxs("div",{className:"cotask-graph-legend",children:[o.jsxs("span",{children:[o.jsx("i",{className:"running"}),"执行中"]}),o.jsxs("span",{children:[o.jsx("i",{className:"delivered"}),m?"检查点等待继续":"待 Owner 确认"]}),o.jsxs("span",{children:[o.jsx("i",{className:"completed"}),m?"已完成 / 已继续":"已确认完成"]}),o.jsxs("span",{children:[o.jsx("i",{className:"pending"}),"待开始"]}),o.jsx("span",{children:m?"执行节点报告结果并正常结束后自动完成;检查点由 Owner 检查后继续":"点击节点查看上下文与报告;成员执行结束不等于节点已确认完成"})]})]})}const Id=e=>({draft:"草稿",running:"运行中",pausing:"正在暂停",paused:"已暂停",waiting:"等待继续",finished:"已结束",pending:"Pending",completed:"Completed",blocked:"Blocked",cancelled:"Cancelled",accepted:"Accepted",failed:"Failed"})[e]??e;function HA({ownerId:e,ownerName:t,request:n,onExpanded:a,renderMember:l,renderMarkdown:u}){const[c,f]=M.useState([]),[h,m]=M.useState(null),[g,v]=M.useState(null),[k,b]=M.useState("graph"),[C,D]=M.useState(null),[L,z]=M.useState(null),[E,B]=M.useState(null),[q,X]=M.useState([]),[G,U]=M.useState(null),[Z,J]=M.useState(null),[F,pe]=M.useState([]),[ce,Oe]=M.useState(""),we=M.useRef(null),de=M.useRef(0),ee=M.useRef("");ee.current=`${h}:${g==null?void 0:g.task.revision}`;const Y=M.useRef(C);Y.current=C;const he=`conversations/${encodeURIComponent(e)}/cotasks`;M.useEffect(()=>{let me=!0;const We=async()=>{try{const nt=await n(he);me&&f(nt.tasks)}catch(nt){me&&Oe(String(nt))}};We();const qe=window.setInterval(()=>void We(),5e3);return()=>{me=!1,window.clearInterval(qe)}},[he,n]),M.useEffect(()=>(a(h!==null),()=>a(!1)),[h,a]),M.useEffect(()=>{if(!h)return;let me=!0;const We=async()=>{try{const nt=await n(`${he}/${encodeURIComponent(h)}`);if(me&&(v(nt),Oe("")),k==="operations"){const Ze=await n(`${he}/${encodeURIComponent(h)}`,{operations:!0});me&&pe(Ze.operations)}}catch(nt){me&&Oe(String(nt))}};We();const qe=window.setInterval(()=>void We(),3e3);return()=>{me=!1,window.clearInterval(qe)}},[h,he,n,k]),M.useEffect(()=>{var me;h&&((me=we.current)==null||me.focus())},[h]),M.useEffect(()=>{de.current++,U(null),J(null),X([])},[g==null?void 0:g.task.revision]);const Te=JSON.stringify(g==null?void 0:g.reports.map(me=>me.id)),$=JSON.stringify(g==null?void 0:g.nodes.map(me=>[me.id,me.status,me.reason]));M.useEffect(()=>{if(!h||!L||!g)return;let me=!0;if(!g.nodes.some(We=>We.id===L)){z(null),B(null);return}return n(`${he}/${encodeURIComponent(h)}`,{nodeIds:[L]}).then(We=>{me&&B(We.nodes[0]??null)}).catch(We=>{me&&Oe(String(We))}),()=>{me=!1}},[h,L,g==null?void 0:g.task.revision,Te,$,he,n]);const I=me=>{z(null),de.current++,U(null),J(null),pe([]),Oe(""),v(null),m(me),b("graph"),D(null),B(null),X([])},ae=()=>{de.current++,z(null),B(null),X([])},R=()=>{de.current++,m(null)},ne=c.find(me=>me.status==="running")??c.find(me=>me.status==="draft")??c[0];if(!h)return ne?o.jsxs("div",{className:"cotask-launcher",children:[o.jsxs("button",{className:"cotask-launch-primary",onClick:()=>I(ne.id),children:[o.jsx("span",{children:"CoTask"}),o.jsx("strong",{children:ne.name}),o.jsxs("small",{children:[Id(ne.phase??ne.status)," · ",ne.nodeCount," nodes ↗"]})]}),c.length>1&&o.jsxs("details",{className:"cotask-task-list",children:[o.jsxs("summary",{children:["Other tasks (",c.length-1,")"]}),c.filter(me=>me.id!==ne.id).map(me=>o.jsxs("button",{onClick:()=>I(me.id),children:[o.jsx("strong",{children:me.name}),o.jsx("small",{children:Id(me.phase??me.status)})]},me.id))]})]}):null;const Ce=me=>{L!==me.id&&(de.current++,Oe(""),B(null),X([]),z(me.id))},Ie=async me=>{const We=++de.current;try{const qe=await n(`${he}/${h}`,{reportIds:[me.id]});We===de.current&&X(qe.reports)}catch(qe){Oe(String(qe))}},Fe=g==null?void 0:g.bindings.find(me=>me.memberId===C),ge=g==null?void 0:g.members.find(me=>me.id===C),He=(me,We=e)=>o.jsx("div",{className:"cotask-markdown",children:u(me??"",We)});return o.jsx("div",{className:"context-panel-overlay settings-overlay cotask-overlay",children:o.jsxs("section",{className:"context-panel settings-panel cotask-frame",role:"dialog","aria-modal":"true","aria-label":"CoTask",tabIndex:-1,ref:we,onKeyDown:me=>{var We;if(me.stopPropagation(),me.key==="Escape"&&(me.preventDefault(),k==="graph"&&L?ae():R()),me.key==="Tab"){const qe=(We=we.current)==null?void 0:We.querySelectorAll('button:not(:disabled),select,input,a[href],textarea,[tabindex="0"]');if(!(qe!=null&&qe.length))return;const nt=qe[0],Ze=qe[qe.length-1];me.shiftKey&&(document.activeElement===nt||document.activeElement===we.current)?(me.preventDefault(),Ze.focus()):!me.shiftKey&&document.activeElement===Ze&&(me.preventDefault(),nt.focus())}},children:[o.jsxs("header",{className:"cotask-header settings-panel-header",children:[o.jsxs("div",{children:[o.jsxs("p",{children:["CoTask · ",t]}),o.jsx("h1",{children:(g==null?void 0:g.task.name)??"Loading task…"})]}),o.jsx("span",{children:g&&Id(g.task.phase??g.task.status)}),o.jsxs("button",{className:"cotask-back",onClick:R,title:`返回 ${t}`,children:[o.jsx("span",{"aria-hidden":"true",children:"← "}),"返回"]})]}),o.jsxs("aside",{className:"cotask-nav",children:[o.jsxs("section",{className:"workspace-group","aria-label":"Task navigation",children:[o.jsx("h2",{className:"cotask-nav-group-title",children:"Task"}),o.jsx("nav",{className:"workspace-group-items",children:[["graph","Task graph"],["operations","Activity"],["settings","Settings"]].map(([me,We])=>o.jsx("button",{className:`session-item${k===me?" active":""}`,"aria-current":k===me?"page":void 0,onClick:()=>{b(me),D(null)},children:o.jsx("span",{className:"session-title",children:We})},me))})]}),o.jsxs("section",{className:"workspace-group","aria-label":"Task members",children:[o.jsx("h2",{className:"cotask-nav-group-title",children:"Members"}),o.jsx("div",{className:"workspace-group-items cotask-member-list",children:g==null?void 0:g.members.map(me=>{const We=g.executions.some(nt=>nt.memberId===me.id&&["accepted","running"].includes(nt.status)),qe=We?"Running":g.bindings.some(nt=>nt.memberId===me.id&&nt.workspaceId)?"Idle":"Not created";return o.jsx("button",{className:`session-item${k==="member"&&C===me.id?" active":""}`,title:`${me.name} · ${qe}`,"aria-label":`${me.name} · ${qe}`,"aria-current":k==="member"&&C===me.id?"page":void 0,onClick:()=>{D(me.id),b("member")},children:o.jsxs("span",{className:"session-heading",children:[o.jsx("span",{className:`session-status${We?" running":""}`,"aria-hidden":"true"}),o.jsx("span",{className:"session-title",children:me.name})]})},me.id)})})]}),o.jsxs("button",{className:"cotask-return",onClick:R,children:["← Back to ",t]})]}),o.jsxs("section",{className:"cotask-main",children:[ce&&o.jsx("div",{className:"cotask-error",role:"alert",children:ce}),o.jsx("div",{className:`cotask-body${k==="graph"?" cotask-graph-body":""}`,children:g?o.jsxs(o.Fragment,{children:[g.warnings.length>0&&o.jsx("div",{className:"cotask-warning",children:g.warnings.map((me,We)=>o.jsxs("p",{children:[me.id?`${me.id}: `:"Common context: ","Context may exceed the injection limit. (estimated ",me.estimatedTokens," tokens)"]},We))}),k==="graph"&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"cotask-section-heading",children:[o.jsx("h2",{children:"Task graph"}),o.jsxs("span",{children:[g.nodes.filter(me=>me.status==="completed").length," / ",g.nodes.length," Completed"]})]}),!g.nodes.length&&o.jsx("p",{children:"No nodes yet. Discuss the plan with the initiating agent to define the graph."}),o.jsxs("details",{className:"cotask-context",onToggle:me=>{if(me.currentTarget.open&&G===null){const We=ee.current;n(`${he}/${h}`,{view:"definition"}).then(qe=>{ee.current===We&&U(qe.definition.commonContext)}).catch(qe=>{ee.current===We&&Oe(String(qe))})}},children:[o.jsx("summary",{children:"Common context"}),G===null?o.jsx("p",{children:"Loading…"}):He(G)]},g.task.revision),g.nodes.length>0&&o.jsx(UA,{finalCheckpointId:g.finalCheckpointId,nodes:g.nodes,members:g.members,executions:g.executions,reports:g.reports,selectedId:L??void 0,onSelect:me=>void Ce(me),onDismiss:ae,detail:(E==null?void 0:E.definition.id)===L?o.jsxs("div",{className:"cotask-node-detail",children:[E.runtime&&o.jsxs("p",{children:[Id(E.runtime.status),E.runtime.reason&&o.jsxs(o.Fragment,{children:[" · ",E.runtime.reason]})]}),He(E.definition.context),o.jsx("h4",{children:E.definition.kind==="checkpoint"?"检查点":"Reports"}),E.reports.length?E.reports.map(me=>o.jsxs("button",{onClick:()=>void Ie(me),children:[me.type," · ",me.summary]},me.id)):o.jsx("p",{children:E.definition.kind==="checkpoint"?"此节点不启动成员执行,也不生成成员报告。Owner 按上下文检查交付内容后继续。":"No reports yet."}),q.map(me=>{var We;return o.jsxs("article",{children:[o.jsx("h4",{children:me.summary}),He(me.content,((We=g.executions.find(qe=>qe.id===me.executionId))==null?void 0:We.workspaceId)??"")]},me.id)})]}):o.jsx("p",{children:"Loading node…"})}),g.task.conclusion&&o.jsxs("details",{className:"cotask-conclusion",children:[o.jsx("summary",{children:"Conclusion"}),He(g.task.conclusion)]})]}),k==="operations"&&o.jsxs(o.Fragment,{children:[o.jsx("h2",{children:"Activity"}),o.jsx("p",{children:"Changes are saved immediately and retained if a turn fails."}),F.length?F.map((me,We)=>o.jsxs("details",{className:"cotask-operation",children:[o.jsxs("summary",{children:[String(me.action)," · ",String(me.status)," · Turn ",String(me.turnStatus)]}),o.jsx("pre",{children:JSON.stringify(me,null,2)})]},We)):o.jsx("p",{children:"No activity yet."})]}),k==="settings"&&o.jsx($A,{task:g.task,path:`${he}/${h}/settings`,request:n,onSaved:me=>v({...g,task:me})},h),k==="member"&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"cotask-section-heading",children:[o.jsx("h2",{children:ge==null?void 0:ge.name}),o.jsx("span",{children:"CoTask member"})]}),o.jsxs("details",{className:"cotask-context",onToggle:me=>{if(me.currentTarget.open&&C&&(Z==null?void 0:Z.id)!==C){const We=C,qe=ee.current;n(`${he}/${h}`,{memberIds:[We]}).then(nt=>{var Ze;ee.current===qe&&Y.current===We&&J({id:We,context:((Ze=nt.members[0])==null?void 0:Ze.context)??""})}).catch(nt=>{ee.current===qe&&Y.current===We&&Oe(String(nt))})}},children:[o.jsx("summary",{children:"Member context"}),(Z==null?void 0:Z.id)===C?He(Z.context):o.jsx("p",{children:"Loading…"})]},`${C}:${g.task.revision}`),Fe!=null&&Fe.workspaceId?l(Fe.workspaceId):o.jsx("p",{children:g.executions.some(me=>me.memberId===C)?"This member instance was removed. Execution history is retained.":g.task.executionMode==="self_driving"?"首次符合执行条件时,平台自动创建此成员实例。":"This member will be created when its first node is driven."})]})]}):o.jsx("p",{children:"Loading task…"})})]})]})})}function $A({task:e,path:t,request:n,onSaved:a}){var E,B;const[l,u]=M.useState({...e.runtimeSettings,mode:e.runtimeSettings.mode??"custom",fastMode:e.runtimeSettings.fastMode??!1}),[c,f]=M.useState(e.revision),[h,m]=M.useState([]),[g,v]=M.useState([]),[k,b]=M.useState(!1),[C,D]=M.useState("");M.useEffect(()=>{let q=!0;return Promise.all([n("settings/runtime/models?refresh=0"),n("settings/model-providers/options")]).then(([X,G])=>{q&&(m(X.models),v(G.channels))}).catch(X=>{q&&D(String(X))}),()=>{q=!1}},[n]);const L=h.find(q=>q.model===l.model||q.id===l.model),z=((E=L==null?void 0:L.supportedReasoningEfforts)==null?void 0:E.map(q=>q.reasoningEffort))??["none","minimal","low","medium","high","xhigh","max"];return o.jsxs("section",{className:"cotask-settings",children:[o.jsx("h2",{children:"Settings"}),o.jsx("p",{children:"Settings apply to the whole CoTask and take effect on each member’s next turn."}),o.jsxs("label",{children:["配置模式",o.jsxs("select",{value:l.mode,onChange:q=>u({...l,mode:q.target.value}),children:[o.jsx("option",{value:"global",children:"沿用全局配置"}),o.jsx("option",{value:"custom",children:"CoTask 自定义配置"})]})]}),l.mode==="global"?o.jsx("p",{children:"每个成员在下一次 turn 读取最新全局模型、推理强度和倍速设置;正在运行的 turn 不受影响。"}):o.jsxs(o.Fragment,{children:[o.jsxs("label",{children:["Model source",o.jsxs("select",{value:l.modelSource.type==="codex"?"codex":l.modelSource.channelId,onChange:q=>u({...l,modelSource:q.target.value==="codex"?{type:"codex"}:{type:"custom",channelId:q.target.value}}),children:[o.jsx("option",{value:"codex",children:"Codex"}),l.modelSource.type==="custom"&&!g.some(q=>q.id===l.modelSource.channelId)&&o.jsx("option",{value:l.modelSource.channelId,children:"Current channel unavailable"}),g.map(q=>o.jsx("option",{value:q.id,children:q.name},q.id))]})]}),l.modelSource.type==="codex"?o.jsxs(o.Fragment,{children:[o.jsxs("label",{children:[o.jsx("span",{children:"1.5 倍速(Fast mode)"}),o.jsx("input",{type:"checkbox",checked:l.fastMode,onChange:q=>u({...l,fastMode:q.target.checked})})]}),o.jsxs("label",{children:["Model",o.jsxs("select",{value:l.model,onChange:q=>u({...l,model:q.target.value}),children:[o.jsx("option",{value:"",children:"Default model"}),l.model&&!h.some(q=>q.model===l.model)&&o.jsx("option",{children:l.model}),h.map(q=>o.jsx("option",{value:q.model,children:q.displayName},q.id))]})]}),o.jsxs("label",{children:["Reasoning effort",o.jsxs("select",{value:l.reasoningEffort,onChange:q=>u({...l,reasoningEffort:q.target.value}),children:[o.jsx("option",{value:"",children:"Default"}),l.reasoningEffort&&!z.includes(l.reasoningEffort)&&o.jsx("option",{children:l.reasoningEffort}),z.map(q=>o.jsx("option",{children:q},q))]})]})]}):o.jsxs("p",{children:["Channel model: ",((B=g.find(q=>q.id===l.modelSource.channelId))==null?void 0:B.model)??"Channel unavailable",". Codex reasoning effort does not apply to custom channels."]})]}),o.jsx("button",{disabled:k,onClick:async()=>{b(!0),D("");try{const q=await n(t,{expectedRevision:c,runtimeSettings:l},"PUT");f(q.task.revision),a(q.task),D("Saved. Changes take effect on the next turn.")}catch(q){D(`${String(q)}. If the task changed, reopen Settings before saving.`)}finally{b(!1)}},children:k?"Saving…":"Save settings"}),C&&o.jsx("p",{role:"status",children:C})]})}function FA(e,t=new Date){if(e==null||!Number.isInteger(e)||e<1||e>31)return null;const n=new Date(t.getTime()+480*60*1e3),a=n.getUTCFullYear(),l=n.getUTCMonth(),u=Date.UTC(a,l,n.getUTCDate()),c=h=>Date.UTC(a,l+h,Math.min(e,new Date(Date.UTC(a,l+h+1,0)).getUTCDate()));let f=c(0);return f<u&&(f=c(1)),{date:new Date(f).toISOString().slice(0,10),days:(f-u)/864e5}}function PA({content:e,streaming:t}){const[n,a]=M.useState(!1),l=M.useId();return o.jsxs("section",{className:`message reasoning${t?" is-streaming":""}${n?" is-expanded":""}`,children:[o.jsxs("button",{className:"reasoning-toggle",type:"button","aria-expanded":n,"aria-controls":l,onClick:()=>a(u=>!u),children:[o.jsx("span",{className:"reasoning-indicator","aria-hidden":"true"}),o.jsx("span",{children:t?"思考中":"思考过程"}),o.jsx("span",{className:"reasoning-action",children:n?"收起":"展开"}),o.jsx("svg",{className:"reasoning-chevron",width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true",children:o.jsx("path",{d:"m4 2 4 4-4 4",fill:"none",stroke:"currentColor",strokeWidth:"1.4"})})]}),o.jsx("div",{id:l,hidden:!n&&!t,className:`reasoning-content${n?"":" reasoning-preview"}`,children:o.jsx("div",{className:"message-body",children:n?e:e.slice(-600)})})]})}function GA(e,t){if(!t||typeof t!="object")return null;const{method:n,params:a}=t;if(!a)return null;if(n==="item/completed"){const m=a.item;if((m==null?void 0:m.type)!=="reasoning"||typeof m.id!="string")return null;const g=e.get(m.id)??{itemId:m.id,text:new Map,summary:new Map,completed:!1};for(const v of["text","summary"]){const k=m[v];Array.isArray(k)&&k.forEach((b,C)=>{typeof b=="string"&&b&&g[v].set(C,b)})}return g.completed=!0,e.set(m.id,g),g}const l=/^item\/reasoning\/(text|summaryText)(Delta|Snapshot)$/.exec(n??"");if(!l||typeof a.itemId!="string")return null;const u=l[1]==="text"?"text":"summary",c=a[u==="text"?"contentIndex":"summaryIndex"],f=a[l[2]==="Delta"?"delta":"text"];if(typeof c!="number"||!Number.isSafeInteger(c)||c<0||typeof f!="string")return null;const h=e.get(a.itemId)??{itemId:a.itemId,text:new Map,summary:new Map,completed:!1};return h[u].set(c,l[2]==="Snapshot"?f:(h[u].get(c)??"")+f),e.set(a.itemId,h),h}function VA(e){return[...e.text.size?e.text:e.summary].sort(([n],[a])=>n-a).map(([,n])=>n).join(`
|
|
346
|
+
`:wA(e)?(f=2,h=2):Q6(e)&&(f=1,h=1);++u<l.length;)c=c.concat(J6(l[u],e,{whitespace:a,breakBefore:u?void 0:f,breakAfter:u<l.length-1?Wp(l[u+1]):h}));return I3(e)&&z3(t,e,I3)&&c.push(" "),f&&c.unshift(f),h&&c.push(h),c}function ex(e,t){const n=String(e.value),a=[],l=[];let u=0;for(;u<=n.length;){R3.lastIndex=u;const h=R3.exec(n),m=h&&"index"in h?h.index:n.length;a.push(TA(n.slice(u,m).replace(/[\u061C\u200E\u200F\u202A-\u202E\u2066-\u2069]/g,""),u===0?t.breakBefore:!0,m===n.length?t.breakAfter:!0)),u=m+1}let c=-1,f;for(;++c<a.length;)a[c].charCodeAt(a[c].length-1)===8203||c<a.length-1&&a[c+1].charCodeAt(0)===8203?(l.push(a[c]),f=void 0):a[c]?(typeof f=="number"&&l.push(f),l.push(a[c]),f=0):(c===0||c===a.length-1)&&l.push(0);return l}function CA(e){return[String(e.value)]}function TA(e,t,n){const a=[];let l=0,u;for(;l<e.length;){O3.lastIndex=l;const c=O3.exec(e);u=c?c.index:e.length,!l&&!u&&c&&!t&&a.push(""),l!==u&&a.push(e.slice(l,u)),l=c?u+c[0].length:u}return l!==u&&!n&&a.push(""),a.join(" ")}function tx(e,t){if(e.type==="element"){const n=e.properties||{};switch(e.tagName){case"listing":case"plaintext":case"xmp":return"pre";case"nobr":return"nowrap";case"pre":return n.wrap?"pre-wrap":"pre";case"td":case"th":return n.noWrap?"nowrap":t.whitespace;case"textarea":return"pre-wrap"}}return t.whitespace}function AA(e){return!!(e.properties||{}).hidden}function EA(e){return e.tagName==="td"||e.tagName==="th"}function NA(e){return e.tagName==="dialog"&&!(e.properties||{}).open}const MA={},DA=[];function zA(e){const t=e||MA;return function(n,a){S1(n,"element",function(l,u){const c=Array.isArray(l.properties.className)?l.properties.className:DA,f=c.includes("language-math"),h=c.includes("math-display"),m=c.includes("math-inline");let g=h;if(!f&&!h&&!m)return;let v=u[u.length-1],k=l;if(l.tagName==="code"&&f&&v&&v.type==="element"&&v.tagName==="pre"&&(k=v,v=u[u.length-2],g=!0),!v)return;const b=SA(k,{whitespace:"pre"});let C;try{C=Vp.renderToString(b,{...t,displayMode:g,throwOnError:!0})}catch(L){const z=L,E=z.name.toLowerCase();a.message("Could not render math with KaTeX",{ancestors:[...u,l],cause:z,place:l.position,ruleId:E,source:"rehype-katex"});try{C=Vp.renderToString(b,{...t,displayMode:g,strict:"ignore",throwOnError:!1})}catch{C=[{type:"element",tagName:"span",properties:{className:["katex-error"],style:"color:"+(t.errorColor||"#cc0000"),title:String(L)},children:[{type:"text",value:b}]}]}}typeof C=="string"&&(C=pA(C).children);const D=v.children.indexOf(k);return v.children.splice(D,1,...C),w5})}}function RA(e,t,n){return e?t?n==="delta"?e+t:t.startsWith(e)?t:e:e:t}function OA(e,t,n){if(e.kind||e.status!=="pending")return e.status;const a=[...t].reverse().find(l=>l.nodeId===e.id);return a?a.status==="completed"?n.some(l=>l.executionId===a.id&&l.type==="result")?"delivered":"awaiting_review":["accepted","running","failed","cancelled"].includes(a.status)?a.status:e.status:e.status}function IA(e,t){var l;if(!["input:cotask_report","input:cotask_execution"].includes(e.subtype))return null;const n=Date.parse(e.createdAt);return((l=t.filter(u=>(!e.turnId||e.turnId===u.id)&&Date.parse(u.startedAt)<n&&(!u.finishedAt||n<=Date.parse(u.finishedAt))).sort((u,c)=>Date.parse(c.startedAt)-Date.parse(u.startedAt))[0])==null?void 0:l.id)??null}const uu=224,_f=100,L3=e=>`${e.x},${e.y}`,np=(e,t)=>Math.hypot(e.x-t.x,e.y-t.y),_A=(e,t)=>({x:(e.x+t.x)/2,y:(e.y+t.y)/2});function Kp(e,t,n=0){const a=Math.min(...e.map(g=>g.x)),l=Math.max(...e.map(g=>g.x)),u=Math.min(...e.map(g=>g.y)),c=Math.max(...e.map(g=>g.y));if(l<t.x-4||a>t.x+uu+4||c<t.y-4||u>t.y+_f+4)return!1;if(n>=16||Math.max(l-a,c-u)<.25)return!0;const f=[e[0]],h=[e[e.length-1]];let m=e;for(;m.length>1;)m=m.slice(1).map((g,v)=>_A(m[v],g)),f.push(m[0]),h.unshift(m[m.length-1]);return Kp(f,t,n+1)||Kp(h,t,n+1)}function B3(e,t){return e.every(n=>t.every(a=>!Kp(n,a)))}function LA(e,t){const n=[];let a=e[0];const l=(u,c,f)=>{const h=f/np(u,c);return{x:u.x+(c.x-u.x)*h,y:u.y+(c.y-u.y)*h}};for(let u=1;u<e.length-1;u++){const c=e[u],f=e[u-1],h=e[u+1],m=Math.min(t,np(c,f)/2,np(c,h)/2);if(m<.001){n.push([a,c]),a=c;continue}const g=l(c,f,m),v=l(c,h,m);n.push([a,g],[g,c,v]),a=v}return n.push([a,e[e.length-1]]),n}function q3(e){return`M ${L3(e[0][0])} `+e.map(t=>`${t.length===4?"C":t.length===3?"Q":"L"} ${t.slice(1).map(L3).join(" ")}`).join(" ")}function nx(e,t){const n=e[0],a=e[e.length-1],l=(n.y+a.y)/2,u=[[n,{x:n.x,y:l},{x:a.x,y:l},a]];if(a.y>n.y&&B3(u,t))return{path:q3(u),segments:u};for(const c of[64,40,24,12,6,2,0]){const f=LA(e,c);if(B3(f,t))return{path:q3(f),segments:f}}throw new Error("No unobstructed CoTask route")}function BA(e){return JSON.stringify(e.map(t=>({id:t.id,dependencies:[...t.dependencies].sort()})).sort((t,n)=>t.id.localeCompare(n.id)))}function rx(e){const t=new Map,n=new Map,a=new Map(e.map(m=>[m.id,m])),l=[];for(;a.size;){const m=[...a.values()].filter(v=>v.dependencies.every(k=>n.has(k)||!a.has(k))),g=m.length?m:[...a.values()];l.push(g);for(const v of g)a.delete(v.id),n.set(v.id,l.length-1)}const u=Math.max(1,...l.map(m=>m.length))*296+24;l.forEach((m,g)=>m.forEach((v,k)=>t.set(v.id,{x:(u-(m.length*296-72))/2+k*296,y:48+g*200})));const c=[...t].map(([m,g])=>({id:m,...g})),f=[];let h=u;for(const m of e)for(const g of m.dependencies){const v=t.get(g),k=t.get(m.id);if(!v||!k)continue;const b={x:v.x+uu/2,y:v.y+_f},C={x:k.x+uu/2,y:k.y};h+=18;const D=[b,{x:b.x,y:b.y+25},{x:h,y:b.y+25},{x:h,y:C.y-25},{x:C.x,y:C.y-25},C],L=c.filter(z=>z.id!==g&&z.id!==m.id);f.push({source:g,target:m.id,path:nx(D,L).path})}return{positions:t,edges:f,width:h+48,height:Math.max(196,96+l.length*200-100)}}async function qA(e){var m;if(!e.length)return rx(e);const{default:t}=await rn(async()=>{const{default:g}=await import("./elk.bundled-C7Zlu-gt.js").then(v=>v.e);return{default:g}},[],import.meta.url),n=new Set(e.map(g=>g.id)),a=e.flatMap(g=>g.dependencies.filter(v=>n.has(v)).map(v=>({source:v,target:g.id}))),u=await new t().layout({id:"root",layoutOptions:{"elk.algorithm":"layered","elk.direction":"DOWN","elk.edgeRouting":"ORTHOGONAL","elk.spacing.nodeNode":"40","elk.layered.spacing.nodeNodeBetweenLayers":"80","elk.layered.spacing.edgeNodeBetweenLayers":"18","elk.padding":"[top=48,left=48,bottom=48,right=48]","elk.layered.crossingMinimization.strategy":"LAYER_SWEEP","elk.layered.nodePlacement.strategy":"NETWORK_SIMPLEX"},children:e.map(g=>({id:g.id,width:uu,height:_f})),edges:a.map((g,v)=>({id:`edge-${v}`,sources:[g.source],targets:[g.target]}))}),c=(u.children??[]).map(g=>({id:g.id,x:g.x??0,y:g.y??0})),f=new Map((m=u.edges)==null?void 0:m.map(g=>[g.id,g])),h=a.map((g,v)=>{var C,D;const k=(D=(C=f.get(`edge-${v}`))==null?void 0:C.sections)==null?void 0:D[0];if(!k)throw new Error("Missing CoTask dependency route");const b=[k.startPoint,...k.bendPoints??[],k.endPoint];return{...g,path:nx(b,c.filter(L=>L.id!==g.source&&L.id!==g.target)).path}});return{positions:new Map(c.map(g=>[g.id,g])),edges:h,width:u.width??320,height:u.height??196}}const U3={pending:"待开始",completed:"已确认完成",blocked:"已阻塞",cancelled:"已取消",running:"执行中",accepted:"等待执行",failed:"执行失败",delivered:"已交付,待确认",awaiting_review:"执行已结束,待确认"};function UA({nodes:e,members:t,executions:n,reports:a,selectedId:l,onSelect:u,onDismiss:c,detail:f,finalCheckpointId:h}){const m=e.some(ge=>ge.kind!==void 0),g=(ge,He)=>ge.kind==="checkpoint"?{pending:"等待前置完成",waiting:"等待 Owner 继续",completed:"已继续"}[He]??U3[He]??He:ge.kind&&He==="completed"?"已完成":U3[He]??He,v=BA(e),k=M.useMemo(()=>rx(JSON.parse(v)),[v]),[b,C]=M.useState(null),[D,L]=M.useState(!1),z=(b==null?void 0:b.topology)===v?b.graph:k;M.useEffect(()=>{let ge=!0;return L(!1),qA(JSON.parse(v)).then(He=>{ge&&C({topology:v,graph:He})}).catch(()=>{ge&&L(!0)}),()=>{ge=!1}},[v]);const E=M.useRef(null),[B,q]=M.useState({width:900,height:560}),[X,G]=M.useState(null),[U,Z]=M.useState({left:0,top:0}),[J,F]=M.useState(!1),[pe,ce]=M.useState(!1),Oe=M.useRef(!1),we=M.useRef(null);M.useEffect(()=>{F(!1)},[l]);const de=M.useId().replace(/:/g,"");M.useEffect(()=>{if(!E.current)return;const ge=new ResizeObserver(([He])=>q({width:He.contentRect.width,height:He.contentRect.height}));return ge.observe(E.current),()=>ge.disconnect()},[]);const ee=Math.min(1,Math.max(.15,Math.min((B.width-32)/z.width,(B.height-32)/z.height))),Y=X??ee,he=new Map(e.map(ge=>[ge.id,OA(ge,n,a)])),Te=e.find(ge=>ge.id===l),$=l?z.positions.get(l):void 0,I=Math.min(320,Math.max(0,B.width-24)),ae=Math.min(420,Math.max(0,B.height-24)),R=$?Math.max(0,(B.width-z.width*Y)/2)+$.x*Y-U.left:0,ne=$?Math.max(0,(B.height-z.height*Y)/2)+$.y*Y-U.top:0,Ce=R+uu*Y+12,Ie=Math.max(12,Math.min(B.width-I-12,Ce+I<=B.width-12?Ce:R-I-12)),Fe=Math.max(12,Math.min(B.height-ae-12,ne));return o.jsxs("section",{className:"cotask-graph","aria-label":"Task dependency graph",children:[o.jsxs("div",{className:"cotask-graph-toolbar",children:[o.jsxs("span",{children:["Arrows show dependencies ",o.jsxs("span",{className:"cotask-graph-count",children:["· ",e.length," nodes / ",z.edges.length," dependencies"]}),D&&o.jsx("small",{role:"status",children:" · 自动布局暂不可用,已显示基础布局"})]}),o.jsxs("div",{children:[o.jsx("button",{"aria-label":"Zoom out",onClick:()=>G(Math.max(.15,Y-.15)),children:"−"}),o.jsxs("span",{children:[Math.round(Y*100),"%"]}),o.jsx("button",{"aria-label":"Zoom in",onClick:()=>G(Math.min(2,Y+.15)),children:"+"}),o.jsx("button",{onClick:()=>G(null),children:"Fit to view"})]})]}),o.jsxs("div",{className:"cotask-graph-stage",children:[o.jsx("div",{className:`cotask-graph-viewport${pe?" dragging":""}`,ref:E,"data-layout":(b==null?void 0:b.topology)===v?"adaptive":"fallback",onScroll:ge=>Z({left:ge.currentTarget.scrollLeft,top:ge.currentTarget.scrollTop}),onClickCapture:ge=>{Oe.current&&(ge.preventDefault(),ge.stopPropagation())},onClick:ge=>{ge.target.closest("button")||c()},onPointerDown:ge=>{if(ge.button!==0||ge.target.closest(".cotask-node-text"))return;Oe.current=!1;const He=ge.currentTarget;we.current={id:ge.pointerId,x:ge.clientX,y:ge.clientY,left:He.scrollLeft,top:He.scrollTop,moved:!1}},onPointerMove:ge=>{if(!we.current||we.current.id!==ge.pointerId)return;const He=ge.clientX-we.current.x,me=ge.clientY-we.current.y;Math.abs(He)+Math.abs(me)>4&&(we.current.moved=!0,ce(!0),ge.currentTarget.setPointerCapture(ge.pointerId),ge.preventDefault()),we.current.moved&&(ge.currentTarget.scrollLeft=we.current.left-He,ge.currentTarget.scrollTop=we.current.top-me)},onPointerUp:ge=>{we.current&&(Oe.current=we.current.moved,we.current=null,ce(!1),ge.currentTarget.hasPointerCapture(ge.pointerId)&&ge.currentTarget.releasePointerCapture(ge.pointerId),window.setTimeout(()=>{Oe.current=!1},0))},onPointerCancel:()=>{we.current=null,ce(!1)},onLostPointerCapture:()=>{we.current=null,ce(!1)},children:o.jsx("div",{className:"cotask-graph-scroll",style:{width:Math.max(B.width,z.width*Y),height:Math.max(B.height,z.height*Y)},children:o.jsxs("div",{className:"cotask-graph-canvas",style:{width:z.width,height:z.height,transform:`scale(${Y})`,left:Math.max(0,(B.width-z.width*Y)/2),top:Math.max(0,(B.height-z.height*Y)/2)},children:[o.jsxs("svg",{width:z.width,height:z.height,className:"cotask-graph-edges","aria-hidden":"true",children:[o.jsx("defs",{children:["default","complete","selected"].map(ge=>o.jsx("marker",{id:`${de}-${ge}`,markerWidth:"8",markerHeight:"8",refX:"7",refY:"4",orient:"auto",markerUnits:"userSpaceOnUse",children:o.jsx("path",{d:"M 1 1 L 7 4 L 1 7 Z",className:`cotask-arrow-${ge}`})},ge))}),z.edges.map(ge=>{const He=l&&[ge.source,ge.target].includes(l)?"selected":he.get(ge.source)==="completed"?"complete":"default";return o.jsx("path",{"data-source":ge.source,"data-target":ge.target,d:ge.path,className:`cotask-edge ${He}`,markerEnd:`url(#${de}-${He})`},`${ge.source}:${ge.target}`)})]}),e.map(ge=>{var We;const He=z.positions.get(ge.id),me=he.get(ge.id);return o.jsxs("button",{className:`cotask-graph-node ${me}${ge.kind==="checkpoint"?" checkpoint":""}${l===ge.id?" selected":""}`,style:{left:He.x,top:He.y,width:uu,height:_f},"aria-pressed":l===ge.id,onClick:()=>u(ge),title:ge.dependencies.length?`Depends on: ${ge.dependencies.map(qe=>{var nt;return((nt=e.find(Ze=>Ze.id===qe))==null?void 0:nt.name)??qe}).join(", ")}`:"No dependencies",children:[ge.dependencies.length>0&&o.jsx("i",{className:"cotask-node-port input"}),o.jsxs("span",{className:"cotask-graph-node-status",children:[o.jsx("i",{}),o.jsx("span",{className:"cotask-node-text",children:g(ge,me)})]}),o.jsx("strong",{className:"cotask-node-text",children:ge.name}),o.jsx("span",{className:"cotask-graph-node-member cotask-node-text",children:ge.kind==="checkpoint"?o.jsxs(o.Fragment,{children:[o.jsxs("span",{className:"cotask-checkpoint-type",children:[o.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true",children:o.jsx("path",{d:"M6 1 11 6 6 11 1 6Z",fill:"none",stroke:"currentColor",strokeWidth:"1.5"})}),ge.id===h?"最终检查点":"检查点"]}),o.jsx("span",{className:"cotask-checkpoint-owner",children:"Owner 检查"})]}):((We=t.find(qe=>qe.id===ge.memberId))==null?void 0:We.name)??ge.memberId}),z.edges.some(qe=>qe.source===ge.id)&&o.jsx("i",{className:"cotask-node-port output"})]},ge.id)})]})})}),Te&&$&&o.jsxs("aside",{className:`cotask-node-popover${J?" expanded":""}`,"aria-label":`Node details: ${Te.name}`,style:J?void 0:{left:Ie,top:Fe,width:I,maxHeight:ae},onKeyDown:ge=>{ge.key==="Escape"&&(ge.stopPropagation(),c())},children:[o.jsxs("header",{children:[o.jsx("strong",{children:Te.name}),o.jsx("button",{onClick:()=>F(!J),"aria-label":J?"Collapse node details":"Expand node details",children:J?"Collapse":"Expand"}),o.jsx("button",{onClick:c,"aria-label":"Close node details",children:"×"})]}),o.jsx("div",{className:"cotask-node-popover-content",children:f})]})]}),o.jsxs("div",{className:"cotask-graph-legend",children:[o.jsxs("span",{children:[o.jsx("i",{className:"running"}),"执行中"]}),o.jsxs("span",{children:[o.jsx("i",{className:"delivered"}),m?"检查点等待继续":"待 Owner 确认"]}),o.jsxs("span",{children:[o.jsx("i",{className:"completed"}),m?"已完成 / 已继续":"已确认完成"]}),o.jsxs("span",{children:[o.jsx("i",{className:"pending"}),"待开始"]}),o.jsx("span",{children:m?"执行节点报告结果并正常结束后自动完成;检查点由 Owner 检查后继续":"点击节点查看上下文与报告;成员执行结束不等于节点已确认完成"})]})]})}const Id=e=>({draft:"草稿",running:"运行中",pausing:"正在暂停",paused:"已暂停",waiting:"等待继续",finished:"已结束",pending:"Pending",completed:"Completed",blocked:"Blocked",cancelled:"Cancelled",accepted:"Accepted",failed:"Failed"})[e]??e;function HA({ownerId:e,ownerName:t,request:n,onExpanded:a,renderMember:l,renderMarkdown:u}){const[c,f]=M.useState([]),[h,m]=M.useState(null),[g,v]=M.useState(null),[k,b]=M.useState("graph"),[C,D]=M.useState(null),[L,z]=M.useState(null),[E,B]=M.useState(null),[q,X]=M.useState([]),[G,U]=M.useState(null),[Z,J]=M.useState(null),[F,pe]=M.useState([]),[ce,Oe]=M.useState(""),we=M.useRef(null),de=M.useRef(0),ee=M.useRef("");ee.current=`${h}:${g==null?void 0:g.task.revision}`;const Y=M.useRef(C);Y.current=C;const he=`conversations/${encodeURIComponent(e)}/cotasks`;M.useEffect(()=>{let me=!0;const We=async()=>{try{const nt=await n(he);me&&f(nt.tasks)}catch(nt){me&&Oe(String(nt))}};We();const qe=window.setInterval(()=>void We(),5e3);return()=>{me=!1,window.clearInterval(qe)}},[he,n]),M.useEffect(()=>(a(h!==null),()=>a(!1)),[h,a]),M.useEffect(()=>{if(!h)return;let me=!0;const We=async()=>{try{const nt=await n(`${he}/${encodeURIComponent(h)}`);if(me&&(v(nt),Oe("")),k==="operations"){const Ze=await n(`${he}/${encodeURIComponent(h)}`,{operations:!0});me&&pe(Ze.operations)}}catch(nt){me&&Oe(String(nt))}};We();const qe=window.setInterval(()=>void We(),3e3);return()=>{me=!1,window.clearInterval(qe)}},[h,he,n,k]),M.useEffect(()=>{var me;h&&((me=we.current)==null||me.focus())},[h]),M.useEffect(()=>{de.current++,U(null),J(null),X([])},[g==null?void 0:g.task.revision]);const Te=JSON.stringify(g==null?void 0:g.reports.map(me=>me.id)),$=JSON.stringify(g==null?void 0:g.nodes.map(me=>[me.id,me.status,me.reason]));M.useEffect(()=>{if(!h||!L||!g)return;let me=!0;if(!g.nodes.some(We=>We.id===L)){z(null),B(null);return}return n(`${he}/${encodeURIComponent(h)}`,{nodeIds:[L]}).then(We=>{me&&B(We.nodes[0]??null)}).catch(We=>{me&&Oe(String(We))}),()=>{me=!1}},[h,L,g==null?void 0:g.task.revision,Te,$,he,n]);const I=me=>{z(null),de.current++,U(null),J(null),pe([]),Oe(""),v(null),m(me),b("graph"),D(null),B(null),X([])},ae=()=>{de.current++,z(null),B(null),X([])},R=()=>{de.current++,m(null)},ne=c.find(me=>me.status==="running")??c.find(me=>me.status==="draft")??c[0];if(!h)return ne?o.jsxs("div",{className:"cotask-launcher",children:[o.jsxs("button",{className:"cotask-launch-primary",onClick:()=>I(ne.id),children:[o.jsx("span",{children:"CoTask"}),o.jsx("strong",{children:ne.name}),o.jsxs("small",{children:[Id(ne.phase??ne.status)," · ",ne.nodeCount," nodes ↗"]})]}),c.length>1&&o.jsxs("details",{className:"cotask-task-list",children:[o.jsxs("summary",{children:["Other tasks (",c.length-1,")"]}),c.filter(me=>me.id!==ne.id).map(me=>o.jsxs("button",{onClick:()=>I(me.id),children:[o.jsx("strong",{children:me.name}),o.jsx("small",{children:Id(me.phase??me.status)})]},me.id))]})]}):null;const Ce=me=>{L!==me.id&&(de.current++,Oe(""),B(null),X([]),z(me.id))},Ie=async me=>{const We=++de.current;try{const qe=await n(`${he}/${h}`,{reportIds:[me.id]});We===de.current&&X(qe.reports)}catch(qe){Oe(String(qe))}},Fe=g==null?void 0:g.bindings.find(me=>me.memberId===C),ge=g==null?void 0:g.members.find(me=>me.id===C),He=(me,We=e)=>o.jsx("div",{className:"cotask-markdown",children:u(me??"",We)});return o.jsx("div",{className:"context-panel-overlay settings-overlay cotask-overlay",children:o.jsxs("section",{className:"context-panel settings-panel cotask-frame",role:"dialog","aria-modal":"true","aria-label":"CoTask",tabIndex:-1,ref:we,onKeyDown:me=>{var We;if(me.stopPropagation(),me.key==="Escape"&&(me.preventDefault(),k==="graph"&&L?ae():R()),me.key==="Tab"){const qe=(We=we.current)==null?void 0:We.querySelectorAll('button:not(:disabled),select,input,a[href],textarea,[tabindex="0"]');if(!(qe!=null&&qe.length))return;const nt=qe[0],Ze=qe[qe.length-1];me.shiftKey&&(document.activeElement===nt||document.activeElement===we.current)?(me.preventDefault(),Ze.focus()):!me.shiftKey&&document.activeElement===Ze&&(me.preventDefault(),nt.focus())}},children:[o.jsxs("header",{className:"cotask-header settings-panel-header",children:[o.jsxs("div",{children:[o.jsxs("p",{children:["CoTask · ",t]}),o.jsx("h1",{children:(g==null?void 0:g.task.name)??"Loading task…"})]}),o.jsx("span",{children:g&&Id(g.task.phase??g.task.status)}),o.jsxs("button",{className:"cotask-back",onClick:R,title:`返回 ${t}`,children:[o.jsx("span",{"aria-hidden":"true",children:"← "}),"返回"]})]}),o.jsxs("aside",{className:"cotask-nav",children:[o.jsxs("section",{className:"workspace-group","aria-label":"Task navigation",children:[o.jsx("h2",{className:"cotask-nav-group-title",children:"Task"}),o.jsx("nav",{className:"workspace-group-items",children:[["graph","Task graph"],["operations","Activity"],["settings","Settings"]].map(([me,We])=>o.jsx("button",{className:`session-item${k===me?" active":""}`,"aria-current":k===me?"page":void 0,onClick:()=>{b(me),D(null)},children:o.jsx("span",{className:"session-title",children:We})},me))})]}),o.jsxs("section",{className:"workspace-group","aria-label":"Task members",children:[o.jsx("h2",{className:"cotask-nav-group-title",children:"Members"}),o.jsx("div",{className:"workspace-group-items cotask-member-list",children:g==null?void 0:g.members.map(me=>{const We=g.executions.some(nt=>nt.memberId===me.id&&["accepted","running"].includes(nt.status)),qe=We?"Running":g.bindings.some(nt=>nt.memberId===me.id&&nt.workspaceId)?"Idle":"Not created";return o.jsx("button",{className:`session-item${k==="member"&&C===me.id?" active":""}`,title:`${me.name} · ${qe}`,"aria-label":`${me.name} · ${qe}`,"aria-current":k==="member"&&C===me.id?"page":void 0,onClick:()=>{D(me.id),b("member")},children:o.jsxs("span",{className:"session-heading",children:[o.jsx("span",{className:`session-status${We?" running":""}`,"aria-hidden":"true"}),o.jsx("span",{className:"session-title",children:me.name})]})},me.id)})})]}),o.jsxs("button",{className:"cotask-return",onClick:R,children:["← Back to ",t]})]}),o.jsxs("section",{className:"cotask-main",children:[ce&&o.jsx("div",{className:"cotask-error",role:"alert",children:ce}),o.jsx("div",{className:`cotask-body${k==="graph"?" cotask-graph-body":""}`,children:g?o.jsxs(o.Fragment,{children:[g.warnings.length>0&&o.jsx("div",{className:"cotask-warning",children:g.warnings.map((me,We)=>o.jsxs("p",{children:[me.id?`${me.id}: `:"Common context: ","Context may exceed the injection limit. (estimated ",me.estimatedTokens," tokens)"]},We))}),k==="graph"&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"cotask-section-heading",children:[o.jsx("h2",{children:"Task graph"}),o.jsxs("span",{children:[g.nodes.filter(me=>me.status==="completed").length," / ",g.nodes.length," Completed"]})]}),!g.nodes.length&&o.jsx("p",{children:"No nodes yet. Discuss the plan with the initiating agent to define the graph."}),o.jsxs("details",{className:"cotask-context",onToggle:me=>{if(me.currentTarget.open&&G===null){const We=ee.current;n(`${he}/${h}`,{view:"definition"}).then(qe=>{ee.current===We&&U(qe.definition.commonContext)}).catch(qe=>{ee.current===We&&Oe(String(qe))})}},children:[o.jsx("summary",{children:"Common context"}),G===null?o.jsx("p",{children:"Loading…"}):He(G)]},g.task.revision),g.nodes.length>0&&o.jsx(UA,{finalCheckpointId:g.finalCheckpointId,nodes:g.nodes,members:g.members,executions:g.executions,reports:g.reports,selectedId:L??void 0,onSelect:me=>void Ce(me),onDismiss:ae,detail:(E==null?void 0:E.definition.id)===L?o.jsxs("div",{className:"cotask-node-detail",children:[E.runtime&&o.jsxs("p",{children:[Id(E.runtime.status),E.runtime.reason&&o.jsxs(o.Fragment,{children:[" · ",E.runtime.reason]})]}),He(E.definition.context),o.jsx("h4",{children:E.definition.kind==="checkpoint"?"检查点":"Reports"}),E.reports.length?E.reports.map(me=>o.jsxs("button",{onClick:()=>void Ie(me),children:[me.type," · ",me.summary]},me.id)):o.jsx("p",{children:E.definition.kind==="checkpoint"?"此节点不启动成员执行,也不生成成员报告。Owner 按上下文检查交付内容后继续。":"No reports yet."}),q.map(me=>{var We;return o.jsxs("article",{children:[o.jsx("h4",{children:me.summary}),He(me.content,((We=g.executions.find(qe=>qe.id===me.executionId))==null?void 0:We.workspaceId)??"")]},me.id)})]}):o.jsx("p",{children:"Loading node…"})}),g.task.conclusion&&o.jsxs("details",{className:"cotask-conclusion",children:[o.jsx("summary",{children:"Conclusion"}),He(g.task.conclusion)]})]}),k==="operations"&&o.jsxs(o.Fragment,{children:[o.jsx("h2",{children:"Activity"}),o.jsx("p",{children:"Changes are saved immediately and retained if a turn fails."}),F.length?F.map((me,We)=>o.jsxs("details",{className:"cotask-operation",children:[o.jsxs("summary",{children:[String(me.action)," · ",String(me.status)," · Turn ",String(me.turnStatus)]}),o.jsx("pre",{children:JSON.stringify(me,null,2)})]},We)):o.jsx("p",{children:"No activity yet."})]}),k==="settings"&&o.jsx($A,{task:g.task,path:`${he}/${h}/settings`,request:n,onSaved:me=>v({...g,task:me})},h),k==="member"&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"cotask-section-heading",children:[o.jsx("h2",{children:ge==null?void 0:ge.name}),o.jsx("span",{children:"CoTask member"})]}),o.jsxs("details",{className:"cotask-context",onToggle:me=>{if(me.currentTarget.open&&C&&(Z==null?void 0:Z.id)!==C){const We=C,qe=ee.current;n(`${he}/${h}`,{memberIds:[We]}).then(nt=>{var Ze;ee.current===qe&&Y.current===We&&J({id:We,context:((Ze=nt.members[0])==null?void 0:Ze.context)??""})}).catch(nt=>{ee.current===qe&&Y.current===We&&Oe(String(nt))})}},children:[o.jsx("summary",{children:"Member context"}),(Z==null?void 0:Z.id)===C?He(Z.context):o.jsx("p",{children:"Loading…"})]},`${C}:${g.task.revision}`),Fe!=null&&Fe.workspaceId?l(Fe.workspaceId):o.jsx("p",{children:g.executions.some(me=>me.memberId===C)?"This member instance was removed. Execution history is retained.":g.task.executionMode==="self_driving"?"首次符合执行条件时,平台自动创建此成员实例。":"This member will be created when its first node is driven."})]})]}):o.jsx("p",{children:"Loading task…"})})]})]})})}function $A({task:e,path:t,request:n,onSaved:a}){var E,B;const[l,u]=M.useState({...e.runtimeSettings,mode:e.runtimeSettings.mode??"custom",fastMode:e.runtimeSettings.fastMode??!1}),[c,f]=M.useState(e.revision),[h,m]=M.useState([]),[g,v]=M.useState([]),[k,b]=M.useState(!1),[C,D]=M.useState("");M.useEffect(()=>{let q=!0;return Promise.all([n("settings/runtime/models?refresh=0"),n("settings/model-providers/options")]).then(([X,G])=>{q&&(m(X.models),v(G.channels))}).catch(X=>{q&&D(String(X))}),()=>{q=!1}},[n]);const L=h.find(q=>q.model===l.model||q.id===l.model),z=((E=L==null?void 0:L.supportedReasoningEfforts)==null?void 0:E.map(q=>q.reasoningEffort))??["none","minimal","low","medium","high","xhigh","max"];return o.jsxs("section",{className:"cotask-settings",children:[o.jsx("h2",{children:"Settings"}),o.jsx("p",{children:"Settings apply to the whole CoTask and take effect on each member’s next turn."}),o.jsxs("label",{children:["配置模式",o.jsxs("select",{value:l.mode,onChange:q=>u({...l,mode:q.target.value}),children:[o.jsx("option",{value:"global",children:"沿用全局配置"}),o.jsx("option",{value:"custom",children:"CoTask 自定义配置"})]})]}),l.mode==="global"?o.jsx("p",{children:"每个成员在下一次 turn 读取最新全局模型、推理强度和倍速设置;正在运行的 turn 不受影响。"}):o.jsxs(o.Fragment,{children:[o.jsxs("label",{children:["Model source",o.jsxs("select",{value:l.modelSource.type==="codex"?"codex":l.modelSource.channelId,onChange:q=>u({...l,modelSource:q.target.value==="codex"?{type:"codex"}:{type:"custom",channelId:q.target.value}}),children:[o.jsx("option",{value:"codex",children:"Codex"}),l.modelSource.type==="custom"&&!g.some(q=>q.id===l.modelSource.channelId)&&o.jsx("option",{value:l.modelSource.channelId,children:"Current channel unavailable"}),g.map(q=>o.jsx("option",{value:q.id,children:q.name},q.id))]})]}),l.modelSource.type==="codex"?o.jsxs(o.Fragment,{children:[o.jsxs("label",{children:[o.jsx("span",{children:"1.5 倍速(Fast mode)"}),o.jsx("input",{type:"checkbox",checked:l.fastMode,onChange:q=>u({...l,fastMode:q.target.checked})})]}),o.jsxs("label",{children:["Model",o.jsxs("select",{value:l.model,onChange:q=>u({...l,model:q.target.value}),children:[o.jsx("option",{value:"",children:"Default model"}),l.model&&!h.some(q=>q.model===l.model)&&o.jsx("option",{children:l.model}),h.map(q=>o.jsx("option",{value:q.model,children:q.displayName},q.id))]})]}),o.jsxs("label",{children:["Reasoning effort",o.jsxs("select",{value:l.reasoningEffort,onChange:q=>u({...l,reasoningEffort:q.target.value}),children:[o.jsx("option",{value:"",children:"Default"}),l.reasoningEffort&&!z.includes(l.reasoningEffort)&&o.jsx("option",{children:l.reasoningEffort}),z.map(q=>o.jsx("option",{children:q},q))]})]})]}):o.jsxs("p",{children:["Channel model: ",((B=g.find(q=>q.id===l.modelSource.channelId))==null?void 0:B.model)??"Channel unavailable",". Codex reasoning effort does not apply to custom channels."]})]}),o.jsx("button",{disabled:k,onClick:async()=>{b(!0),D("");try{const q=await n(t,{expectedRevision:c,runtimeSettings:l},"PUT");f(q.task.revision),a(q.task),D("Saved. Changes take effect on the next turn.")}catch(q){D(`${String(q)}. If the task changed, reopen Settings before saving.`)}finally{b(!1)}},children:k?"Saving…":"Save settings"}),C&&o.jsx("p",{role:"status",children:C})]})}function FA(e,t=new Date){if(e==null||!Number.isInteger(e)||e<1||e>31)return null;const n=new Date(t.getTime()+480*60*1e3),a=n.getUTCFullYear(),l=n.getUTCMonth(),u=Date.UTC(a,l,n.getUTCDate()),c=h=>Date.UTC(a,l+h,Math.min(e,new Date(Date.UTC(a,l+h+1,0)).getUTCDate()));let f=c(0);return f<u&&(f=c(1)),{date:new Date(f).toISOString().slice(0,10),days:(f-u)/864e5}}function PA({content:e,streaming:t}){const[n,a]=M.useState(!1),l=M.useId();return o.jsxs("section",{className:`message reasoning${t?" is-streaming":""}${n?" is-expanded":""}`,children:[o.jsxs("button",{className:"reasoning-toggle",type:"button","aria-expanded":n,"aria-controls":l,onClick:()=>a(u=>!u),children:[o.jsx("span",{className:"reasoning-indicator","aria-hidden":"true"}),o.jsx("span",{children:t?"思考中":"思考过程"}),o.jsx("span",{className:"reasoning-action",children:n?"收起":"展开"}),o.jsx("svg",{className:"reasoning-chevron",width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true",children:o.jsx("path",{d:"m4 2 4 4-4 4",fill:"none",stroke:"currentColor",strokeWidth:"1.4"})})]}),o.jsx("div",{id:l,hidden:!n&&!t,className:`reasoning-content${n?"":" reasoning-preview"}`,children:o.jsx("div",{className:"message-body",children:n?e:e.slice(-600)})})]})}function GA(e,t){if(!t||typeof t!="object")return null;const{method:n,params:a}=t;if(!a)return null;if(n==="item/completed"){const m=a.item;if((m==null?void 0:m.type)!=="reasoning"||typeof m.id!="string")return null;const g=e.get(m.id)??{itemId:m.id,text:new Map,summary:new Map,completed:!1};for(const v of["text","summary"]){const k=m[v];Array.isArray(k)&&k.forEach((b,C)=>{typeof b=="string"&&b&&g[v].set(C,b)})}return g.completed=!0,e.set(m.id,g),g}const l=/^item\/reasoning\/(text|summaryText)(Delta|Snapshot)$/.exec(n??"");if(!l||typeof a.itemId!="string")return null;const u=l[1]==="text"?"text":"summary",c=a[u==="text"?"contentIndex":"summaryIndex"],f=a[l[2]==="Delta"?"delta":"text"];if(typeof c!="number"||!Number.isSafeInteger(c)||c<0||typeof f!="string")return null;const h=e.get(a.itemId)??{itemId:a.itemId,text:new Map,summary:new Map,completed:!1};return h[u].set(c,l[2]==="Snapshot"?f:(h[u].get(c)??"")+f),e.set(a.itemId,h),h}function VA(e){return[...e.text.size?e.text:e.summary].sort(([n],[a])=>n-a).map(([,n])=>n).join(`
|
|
347
347
|
|
|
348
348
|
`)}function YA({id:e,baseUrl:t,query:n}){var g;const[a,l]=M.useState(null),[u,c]=M.useState(!1),[f,h]=M.useState(!1),m=async()=>{c(!0),h(!1);try{const v=await n(e);v.status==="ok"||v.status==="unsupported"?l(v):(h(!0),l(k=>(k==null?void 0:k.status)==="ok"?k:v))}catch{h(!0)}finally{c(!1)}};return M.useEffect(()=>{let v=!1;return c(!0),n(e).then(k=>{v||l(k)}).catch(()=>{v||h(!0)}).finally(()=>{v||c(!1)}),()=>{v=!0}},[e,n]),o.jsxs("div",{className:"channel-balance-inline",children:[o.jsx("span",{className:"channel-balance-total",title:"Available balance",children:(a==null?void 0:a.status)==="ok"&&a.balance?a.balance.balance_infos.map(v=>`${v.currency} ${v.total_balance}`).join(" / "):u?"Checking…":(a==null?void 0:a.status)==="unsupported"?"Balance —":"Balance unavailable"}),f?o.jsx("span",{className:"channel-balance-warning",title:"Refresh failed; the displayed amount may be stale",role:"status",children:"Stale"}):null,a!=null&&a.balance&&!a.balance.is_available?o.jsx("span",{className:"channel-balance-warning",children:"Insufficient"}):null,o.jsx("button",{type:"button","aria-label":"Refresh balance",title:"Refresh balance",disabled:u,onClick:()=>void m(),children:"↻"}),o.jsxs("details",{className:"channel-balance-details",children:[o.jsx("summary",{children:"Details"}),o.jsxs("div",{children:[o.jsxs("p",{className:"channel-endpoint",children:[t," · Responses API"]}),(g=a==null?void 0:a.balance)==null?void 0:g.balance_infos.map(v=>o.jsxs("p",{children:[v.currency," · Granted ",v.granted_balance," · Topped up ",v.topped_up_balance]},v.currency)),a?o.jsxs("small",{children:["Checked ",new Date(a.checkedAt).toLocaleString()]}):null,f?o.jsx("small",{children:"Refresh failed. Any amount shown is the last successful result."}):null,(a==null?void 0:a.status)==="unsupported"?o.jsx("small",{children:"This channel does not support balance queries."}):null,o.jsx("small",{children:"Uses saved credentials; unsaved edits are not queried."})]})]})]})}function ax(e,t){const n=e??{type:"codex"},a=t??{type:"codex"};return n.type===a.type&&(n.type!=="custom"||a.type==="custom"&&n.channelId===a.channelId)}function WA({load:e,save:t,queryBalance:n}){const[a,l]=M.useState(null),[u,c]=M.useState([]),[f,h]=M.useState(!1),[m,g]=M.useState(""),[v,k]=M.useState(!1),[b,C]=M.useState(null),D=JSON.stringify(u)!==JSON.stringify((a==null?void 0:a.channels.map(E=>({channel:E})))??[]);M.useEffect(()=>{let E=!1;return e().then(B=>{E||(l(B),c(B.channels.map(q=>({channel:q}))))}).catch(()=>{E||g("Unable to load channels. Reopen this panel to retry.")}),()=>{E=!0}},[e]);const L=(E,B)=>{k(!1),c(q=>q.map((X,G)=>G===E?{...X,channel:{...X.channel,...B}}:X))},z=async E=>{if(E.preventDefault(),!(!a||f)){h(!0),g(""),k(!1);try{const B=await t({expectedRevision:a.revision,channels:u.map(q=>({channel:q.channel,...q.apiKey?{apiKey:q.apiKey}:{}}))});l(B),c(B.channels.map(q=>({channel:q}))),k(!0),C(null)}catch{g("Channels were not saved. Check the fields. If another administrator changed them, reopen this panel to load the latest version.")}finally{h(!1)}}};return o.jsxs("section",{children:[o.jsx("header",{className:"settings-section-header",children:o.jsxs("div",{children:[o.jsx("h3",{children:"Custom model channels"}),o.jsx("p",{children:"Select a configured channel in Runtime."})]})}),o.jsxs("form",{className:"settings-form",onSubmit:E=>void z(E),children:[!a&&!m?o.jsx("p",{children:"Loading channels…"}):null,o.jsxs("div",{className:"settings-field-wide channel-summary-list",children:[u.map(E=>o.jsxs("article",{className:"channel-summary-card",children:[o.jsxs("div",{className:"channel-summary-identity",children:[o.jsx("h4",{children:E.channel.name||"New channel"}),o.jsx("p",{children:E.channel.model||"Model not configured"})]}),n&&(a!=null&&a.channels.some(B=>B.id===E.channel.id))?o.jsx(YA,{id:E.channel.id,baseUrl:a.channels.find(B=>B.id===E.channel.id).baseUrl,query:n},`${E.channel.id}:${a.revision}`):o.jsx("small",{children:"Not saved"}),o.jsx("button",{type:"button",disabled:f||b!==null&&b!==E.channel.id,onClick:()=>{C(E.channel.id),k(!1)},children:"Edit channel"})]},E.channel.id)),a&&u.length===0?o.jsx("p",{children:"No custom channels yet. Add a channel to get started."}):null]}),u.map((E,B)=>b===E.channel.id?o.jsxs("fieldset",{disabled:f,className:"settings-field-wide model-channel-card",children:[o.jsx("legend",{children:a!=null&&a.channels.some(q=>q.id===E.channel.id)?"Edit channel":"Add channel"}),o.jsxs("label",{className:"settings-field",children:[o.jsx("span",{children:"Name"}),o.jsx("input",{"aria-label":`Channel ${B+1} name`,required:!0,maxLength:128,value:E.channel.name,onChange:q=>L(B,{name:q.target.value})})]}),o.jsxs("label",{className:"settings-field",children:[o.jsx("span",{children:"Type"}),o.jsx("select",{"aria-label":`Channel ${B+1} type`,value:E.channel.kind,onChange:()=>{},children:o.jsx("option",{value:"responses",children:"Responses API"})})]}),o.jsxs("label",{className:"settings-field",children:[o.jsx("span",{children:"Base URL"}),o.jsx("input",{"aria-label":`Channel ${B+1} URL`,type:"url",required:!0,placeholder:"https://api.example.com/v1",value:E.channel.baseUrl,onChange:q=>L(B,{baseUrl:q.target.value})})]}),o.jsxs("label",{className:"settings-field",children:[o.jsx("span",{children:"Model ID"}),o.jsx("input",{"aria-label":`Channel ${B+1} model`,required:!0,maxLength:256,placeholder:"Model ID from your service",value:E.channel.model,onChange:q=>L(B,{model:q.target.value})})]}),o.jsxs("label",{className:"settings-field",children:[o.jsx("span",{children:"API key"}),o.jsx("input",{"aria-label":`Channel ${B+1} API key`,type:"password",autoComplete:"new-password",required:!(a!=null&&a.channels.some(q=>q.id===E.channel.id)),value:E.apiKey??"",placeholder:a!=null&&a.channels.some(q=>q.id===E.channel.id)?"Configured · leave blank to keep":"Enter API key",onChange:q=>{const X=q.target.value;k(!1),c(G=>G.map((U,Z)=>Z===B?{...U,apiKey:X}:U))}})]}),o.jsx("button",{type:"button",onClick:()=>{c(q=>q.filter((X,G)=>G!==B)),k(!1),C(null)},children:"Remove channel on save"}),o.jsx("small",{children:"Changes take effect only after Save channels. Leave the API key blank to keep the saved key."})]},E.channel.id):null),m?o.jsx("p",{role:"alert",children:m}):null,v?o.jsx("p",{role:"status",children:"Channels saved. New executions use the updated configuration."}):null,o.jsxs("div",{className:"settings-form-actions",children:[o.jsx("button",{type:"button",disabled:!a||f||b!==null||u.length>=100,onClick:()=>{const E=crypto.randomUUID().replaceAll("-","");C(E),k(!1),c(B=>[...B,{channel:{id:E,name:"",kind:"responses",baseUrl:"",model:""}}])},children:"Add channel"}),b||JSON.stringify(u)!==JSON.stringify(a==null?void 0:a.channels.map(E=>({channel:E})))?o.jsx("button",{type:"button",disabled:f,onClick:()=>{c((a==null?void 0:a.channels.map(E=>({channel:E})))??[]),C(null),g("")},children:"Discard changes"}):null,b||D?o.jsx("button",{type:"submit",disabled:!a||f,children:f?"Saving…":"Save channels"}):null]})]})]})}function KA(e){const t=new Map;for(const n of e){if(!n.turnId)continue;if(n.event==="server.wakeup.started"){t.set(n.turnId,"wakeup");continue}if(n.event!=="server.turn")continue;const a=ZA(n.data);t.set(n.turnId,typeof a.source=="string"?a.source:"web")}return t}function Pc(e,t){return!!(t&&e.includes(t))}function XA(e){var n;if((e==null?void 0:e.status)!=="failed")return null;const t=(n=e.error)==null?void 0:n.trim();return t?{turnId:e.id,content:t,createdAt:e.finishedAt??e.startedAt}:null}function ZA(e){return e&&typeof e=="object"?e:{}}const QA=["summary","message","status","instruction","description","reason","error","text"],H3=96,JA=new Set(["codex.dynamic_tool_request","codex.process_exited","codex.protocol_error"]),eE=new Set(["server.item.snapshot","server.status","runtime.worker_stderr","codex.dynamic_tool_request"]),tE=new Set(["agentMessage","commandExecution","contextCompaction","fileChange","mcpToolCall","reasoning","userMessage","webSearch"]),ix=new Set(["item/commandExecution/terminalInteraction"]),nE=new Map([["server.wakeup.retry_scheduled","Wakeup retry scheduled"],["runtime.worker_exit","Runtime worker exited"]]);function rE(e){if(e.event!=="codex.notification")return!1;const t=oi(e.data);return typeof t.method=="string"&&ix.has(t.method)}function aE(e){if(eE.has(e.event))return null;if(e.event.startsWith("server.")||e.event.startsWith("runtime.")||JA.has(e.event))return e.event;if(e.event!=="codex.notification")return null;const t=oi(e.data),n=typeof t.method=="string"?t.method:"",a=oi(t.params),l=oi(a.item),u=typeof l.type=="string"?l.type:"";return!n.startsWith("item/")||ix.has(n)||/(?:\/delta|Delta)$/.test(n)||tE.has(u)?null:n}function lx(e,t){const n=t.replace(/^input:/,""),a=(e==null?void 0:e.trim())??"";return!a||a===t||a===n?nE.get(n)??sx(n):a}function Ws(e,t=[]){const n=oi(e),l=[...t,...QA.map(u=>Gc(n[u]))].map(u=>(u==null?void 0:u.replace(/\s+/g," ").trim())??"").find(Boolean);return l?l.length<=H3?l:`${l.slice(0,H3-3)}...`:"查看详情"}function Xp(e,t=new Map){const n=oi(e),a=typeof n.unreadCount=="number"&&n.unreadCount>0?Math.floor(n.unreadCount):0,u=(Array.isArray(n.senderWorkspaceIds)?Array.from(new Set(n.senderWorkspaceIds.filter(h=>typeof h=="string").map(h=>h.trim()).filter(Boolean))):[]).map(h=>t.get(h)??h),c="Messages",f=[a>0?String(a):"",u.length>0?`from ${u.join(", ")}`:""].filter(Boolean).join(" ");return{title:c,detail:Ws({},[f])}}function iE(e){const t=oi(e),n=Array.isArray(t.offers)?t.offers.map(oi).filter(u=>Object.keys(u).length>0):[],a=n.map(u=>{var c;return(c=Gc(u.previewText))==null?void 0:c.trim()}).filter(u=>!!u),l=n.length;return{title:l===1?"New input available":`${l} new inputs available`,detail:Ws({},a.slice(0,2)),meta:l===1?"preview":`${l} previews`}}function lE(e){const t=oi(e),n=Gc(t.actionType)??"",a=oi(t.payload);return n==="seele_wakeup"||n==="seele_workspace_schedule_wakeup"?{title:(Gc(a.action)??"schedule")==="cancel"?"Wakeup cancellation requested":"Wakeup requested",detail:Ws(a,[Gc(a.instruction)]),meta:"after turn"}:{title:"Action requested",detail:Ws(a,[sx(n||"agent action")]),meta:"after turn"}}function sx(e){const n=(e.split(/[./]/).filter(Boolean).pop()??e).replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[_-]+/g," ").trim();return n?n.charAt(0).toUpperCase()+n.slice(1):"System event"}function Gc(e){if(typeof e=="string")return e;if(typeof e=="number"||typeof e=="boolean")return String(e)}function oi(e){return e&&typeof e=="object"?e:{}}function Zp(e){const t=Qp(e);return(Array.isArray(t.changes)?t.changes:[]).flatMap(a=>{const l=Qp(a);if(typeof l.path!="string"||!l.path.trim())return[];const u=cE(l.kind),c=typeof l.diff=="string"?l.diff:"",f=uE(c,u);return[{path:l.path,kind:u,additions:f.additions,deletions:f.deletions}]})}function ox(e,t){const n=F3(e),a=F3(t??"").replace(/\/+$/,"");return a&&(n===a||n.startsWith(`${a}/`))?n.slice(a.length+1)||".":n}function sE(e,t){if(e.length===0)return"File changed";const n=ox(e[0].path,t);return e.length===1?n:`${n} +${e.length-1}`}function oE(e){return e.reduce((t,n)=>({additions:t.additions+n.additions,deletions:t.deletions+n.deletions}),{additions:0,deletions:0})}function uE(e,t){if(!e)return{additions:0,deletions:0};if(t==="add")return{additions:$3(e),deletions:0};if(t==="delete")return{additions:0,deletions:$3(e)};let n=0,a=0;for(const l of e.split(`
|
|
349
349
|
`))l.startsWith("+")&&!l.startsWith("+++")?n+=1:l.startsWith("-")&&!l.startsWith("---")&&(a+=1);return{additions:n,deletions:a}}function $3(e){const t=e.split(`
|
|
@@ -381,7 +381,7 @@ ${e.content}`:e.type==="system"?[e.title,e.fullDetail??e.detail].filter(t=>!!(t!
|
|
|
381
381
|
`);if(t<0)return 0;const n=[0];for(let l=0;l<e.length;l+=1)e[l]===`
|
|
382
382
|
`&&l+1<e.length&&n.push(l+1);let a=-1;for(const l of n){const u=e.indexOf(`
|
|
383
383
|
`,l),c=e.slice(l,u===-1?e.length:u);/^\s*(```|~~~)/.test(c)&&(a=a===-1?l:-1)}return a>=0?a:t+1}function BM({artifact:e,onPreview:t,onCopyUrl:n,copied:a}){return e?o.jsxs("figure",{className:"artifact-preview",children:[o.jsx("button",{className:"artifact-preview-media",onClick:()=>t(e),type:"button",children:o.jsx("img",{alt:e.name,src:e.url})}),o.jsxs("figcaption",{children:[o.jsx("span",{children:e.name}),o.jsxs("div",{className:"artifact-preview-actions",children:[o.jsx("button",{onClick:()=>t(e),type:"button",children:"Preview"}),o.jsx("a",{href:e.url,rel:"noreferrer",target:"_blank",children:"Open"}),o.jsx("button",{onClick:()=>n(e),type:"button",children:a?"Copied":"Copy"})]})]})]}):null}function qM(e,t){const n=new Map;for(const a of UM(e)){const l=Ox(a);if(l){const u=Ix(l).toLowerCase(),c=n.get(u);(!c||FM(l,c))&&n.set(u,l)}}return Array.from(n.values()).map(a=>HM(a,t)).filter(a=>a!==null)}function UM(e){const t=[],n=/!\[[^\]]*]\(([^)]+)\)/g,a=/\[[^\]]+]\(([^)]+)\)/g,l=/(?:artifact|preview|image|file)\s*:\s*(`?[^`\n]+?\.(?:svg|png|jpe?g|webp|gif)`?)/gim;for(const u of[n,a,l]){let c;for(;(c=u.exec(e))!==null;)t.push(c[1])}return t}function HM(e,t){const n=Ox(e);if(!n||!$M(n))return null;const a=dx(n,t.workspacePath);return{id:`${t.id}:${a}`,path:a,name:Ix(a),url:Ee(`conversations/${t.id}/files?path=${encodeURIComponent(a)}`)}}function Ox(e){const t=e.trim().replace(/^`+|`+$/g,"").replace(/[),.;:,。;:]+$/g,"");return t||null}function $M(e){return/\.(?:svg|png|jpe?g|webp|gif)$/i.test(e)}function Ix(e){return e.replace(/\\/g,"/").split("/").filter(Boolean).pop()??e}function FM(e,t){return e.startsWith("/")&&!t.startsWith("/")?!0:e.length>t.length}function e0(e){return e.trim()}function _x(e){return e.trim()}function vv(e){return e instanceof DOMException&&e.name==="AbortError"||e instanceof Error&&e.name==="AbortError"}function PM(e){return{a({children:t,href:n}){if(!n)return o.jsx(o.Fragment,{children:t});const a=/^[a-z][a-z\d+.-]*:/i.test(n),l=cx(n);if(n.startsWith("seele-public:")&&!l)return o.jsxs("span",{title:"无效的 Seele Public URL 地址",children:[t,"(地址格式无效)"]});const u=!a&&e?GM(n,e):null,c=l?Ee(`deployment/public-link?path=${encodeURIComponent(l)}`):u??n,f=a||!!u;return o.jsx("a",{className:"markdown-link",href:c,rel:f?"noreferrer":void 0,target:f?"_blank":void 0,children:t})},img(){return null},pre({children:t}){const n=YM(t);return n?J1(n.language)==="mermaid"?o.jsx(WM,{code:n.code}):o.jsx(ZM,{code:n.code,language:n.language}):o.jsx("pre",{children:t})},table({children:t}){return o.jsx("div",{className:"markdown-table-wrap",children:o.jsx("table",{className:"markdown-table",children:t})})},td({align:t,children:n}){return o.jsx("td",{style:xv(t),children:n})},th({align:t,children:n}){return o.jsx("th",{style:xv(t),children:n})}}}function GM(e,t){if(!e||e.startsWith("#")||e.startsWith("/api/")||e.startsWith("?"))return null;const n=zE(e,t.workspacePath);if(!n)return null;const a=n.line?`#L${n.line}${n.column?`C${n.column}`:""}`:"";return`${Ee(`conversations/${t.id}/files?path=${encodeURIComponent(n.path)}`)}${a}`}function xv(e){return e&&e!=="char"?{textAlign:e}:void 0}function Ql(e,t){const n=eA(VM(e));return o.jsx(Uk,{urlTransform:a=>cx(a)?a:S5(a),components:PM(t),remarkPlugins:[Zj,JT],rehypePlugins:[[zA,{trust:!1,strict:"ignore"}]],skipHtml:!0,children:n})}function VM(e){return e.replace(/([^\n])(```[^\n`]*(?:\r?\n|$))/g,`$1
|
|
384
|
-
$2`)}function YM(e){var u;const t=M.Children.toArray(e),n=t.length===1&&M.isValidElement(t[0])?t[0]:null;if(!n||n.type!=="code")return null;const l=((u=(n.props.className??"").match(/(?:^|\s)language-([^\s]+)/))==null?void 0:u[1])??"";return{code:a1(n.props.children).replace(/\n$/,""),language:l}}function a1(e){return e==null||typeof e=="boolean"?"":typeof e=="string"||typeof e=="number"||typeof e=="bigint"?String(e):Array.isArray(e)?e.map(a1).join(""):M.isValidElement(e)?a1(e.props.children):""}const Lx="github-light",dp=new Map,fp=new Map;let hp=null,mp=null;const Bx=new Set(["bash","css","diff","dockerfile","html","java","javascript","json","jsonc","jsx","markdown","python","shellscript","sql","toml","tsx","typescript","xml","yaml"]);function J1(e){const t=e.trim().toLowerCase().replace(/^\./,"");return{bash:"bash",cjs:"javascript",console:"shellscript",htm:"html",js:"javascript",jsx:"jsx",md:"markdown",mjs:"javascript",py:"python",rb:"ruby",shell:"bash",ts:"typescript",tsx:"tsx",yml:"yaml",zsh:"bash"}[t]??t}function qx(e){const t=J1(e);return!t||t==="text"||t==="txt"?"text":Bx.has(t)?t:"text"}function WM({code:e}){const n=`seele-mermaid-${M.useId().replace(/[^a-zA-Z0-9_-]/g,"")}`,[a,l]=M.useState(!1),[u,c]=M.useState(()=>fp.get(e)??null),[f,h]=M.useState(null);M.useEffect(()=>{let g=!1,v;const k=fp.get(e);return k?(c(k),h(null),()=>{g=!0}):(h(null),c(null),KM(n,e).then(b=>{g||(v!==void 0&&window.clearTimeout(v),fp.set(e,b),c(b),h(null))},b=>{if(!g){const C=b instanceof Error?b.message:String(b);v=window.setTimeout(()=>{g||h(C)},FE)}}),()=>{g=!0,v!==void 0&&window.clearTimeout(v)})},[e,n]);async function m(){await navigator.clipboard.writeText(e),l(!0),window.setTimeout(()=>l(!1),1200)}return o.jsxs("figure",{className:`mermaid-block${f?" error":""}`,children:[o.jsx("span",{className:"code-block-kind",children:"mermaid"}),o.jsx("div",{className:"code-block-tools",children:o.jsx("button",{"aria-label":a?"Copied Mermaid source":"Copy Mermaid source",className:a?"copied":"",onClick:()=>void m(),title:a?"Copied":"Copy",type:"button",children:o.jsx(eg,{})})}),u?o.jsx("div",{className:"mermaid-diagram",dangerouslySetInnerHTML:{__html:u}}):f?o.jsxs("div",{className:"mermaid-error",children:[o.jsx("strong",{children:"Mermaid render failed"}),o.jsx("pre",{children:f}),o.jsx("code",{children:e})]}):o.jsx("div",{className:"mermaid-loading",children:"Rendering diagram..."})]})}async function KM(e,t){return(await(await XM()).render(e,t)).svg}function XM(){return mp||(mp=rn(()=>import("./mermaid.core-DjEzKVHD.js").then(e=>e.bp),[],import.meta.url).then(e=>{const t=e.default;return t.initialize({startOnLoad:!1,securityLevel:"strict",theme:"base",themeVariables:{background:"#ffffff",primaryColor:"#f9fafa",primaryBorderColor:"#d8d9e8",primaryTextColor:"#0b0f16",lineColor:"#7a8294",secondaryColor:"#f5f5fb",tertiaryColor:"#ffffff",fontFamily:'Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif'}}),t})),mp}function ZM({code:e,language:t,reserveHeight:n=!1}){const[a,l]=M.useState(!1),[u,c]=M.useState(()=>{if(!kv(t))return null;const m=wv(e,t);return dp.get(m)??null}),f=n?{"--code-block-min-height":`${eN(e)}px`}:void 0;M.useEffect(()=>{let m=!1;if(!kv(t))return c(null),()=>{m=!0};const g=wv(e,t),v=dp.get(g);return v?(c(v),()=>{m=!0}):(c(null),aD(e,t).then(k=>{dp.set(g,k),m||c(k)}).catch(k=>{console.warn("Failed to highlight code block",k),m||c(null)}),()=>{m=!0})},[e,t]);async function h(){await navigator.clipboard.writeText(e),l(!0),window.setTimeout(()=>l(!1),1200)}return o.jsxs("figure",{className:"code-block",style:f,children:[t?o.jsx("span",{className:"code-block-kind",children:t}):null,o.jsx("div",{className:"code-block-tools",children:o.jsx("button",{"aria-label":a?"Copied code block":"Copy code block",className:a?"copied":"",onClick:()=>void h(),title:a?"Copied":"Copy",type:"button",children:o.jsx(eg,{})})}),u?o.jsx("div",{className:"code-block-shiki",dangerouslySetInnerHTML:{__html:u}}):o.jsx("pre",{children:o.jsx("code",{children:e})})]})}function eg(){return o.jsxs("svg",{"aria-hidden":"true",fill:"none",height:"13",viewBox:"0 0 24 24",width:"13",children:[o.jsx("rect",{height:"14",rx:"2",stroke:"currentColor",strokeWidth:"2",width:"14",x:"8",y:"8"}),o.jsx("path",{d:"M4 16V6a2 2 0 0 1 2-2h10",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"2"})]})}function Ux(){return o.jsxs("svg",{"aria-hidden":"true",fill:"none",height:"16",viewBox:"0 0 24 24",width:"16",children:[o.jsx("circle",{cx:"6",cy:"5",r:"2",stroke:"currentColor",strokeWidth:"2"}),o.jsx("circle",{cx:"18",cy:"5",r:"2",stroke:"currentColor",strokeWidth:"2"}),o.jsx("circle",{cx:"12",cy:"19",r:"2",stroke:"currentColor",strokeWidth:"2"}),o.jsx("path",{d:"M6 7v1a6 6 0 0 0 6 6v3M18 7v1a6 6 0 0 1-6 6",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"})]})}function tg(){return o.jsxs("svg",{"aria-hidden":"true",fill:"none",height:"12",viewBox:"0 0 24 24",width:"12",children:[o.jsx("circle",{cx:"12",cy:"12",r:"9",stroke:"currentColor",strokeWidth:"2.2"}),o.jsx("path",{d:"M12 7v6",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"2.4"}),o.jsx("circle",{cx:"12",cy:"17",fill:"currentColor",r:"1.25"})]})}function QM(){return o.jsx("svg",{"aria-hidden":"true",fill:"none",height:"18",viewBox:"0 0 24 24",width:"18",children:o.jsx("path",{d:"M4 7h16M4 12h16M4 17h16",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"2"})})}function JM(){return o.jsxs("svg",{"aria-hidden":"true",fill:"none",height:"14",viewBox:"0 0 24 24",width:"14",children:[o.jsx("path",{d:"M7 7h10M7 12h10M7 17h10",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"2"}),o.jsx("circle",{cx:"4",cy:"7",fill:"currentColor",r:"1.4"}),o.jsx("circle",{cx:"4",cy:"12",fill:"currentColor",r:"1.4"}),o.jsx("circle",{cx:"4",cy:"17",fill:"currentColor",r:"1.4"})]})}function bv(){return o.jsxs("svg",{"aria-hidden":"true",fill:"none",height:"14",viewBox:"0 0 24 24",width:"14",children:[o.jsx("circle",{cx:"12",cy:"12",r:"3",stroke:"currentColor",strokeWidth:"2"}),o.jsx("path",{d:"M19 12a7.8 7.8 0 0 0-.1-1l2-1.5-2-3.4-2.4 1a8 8 0 0 0-1.8-1l-.3-2.6h-4l-.3 2.6a8 8 0 0 0-1.8 1l-2.4-1-2 3.4 2 1.5a7.8 7.8 0 0 0 0 2l-2 1.5 2 3.4 2.4-1a8 8 0 0 0 1.8 1l.3 2.6h4l.3-2.6a8 8 0 0 0 1.8-1l2.4 1 2-3.4-2-1.5c.1-.3.1-.7.1-1Z",stroke:"currentColor",strokeLinejoin:"round",strokeWidth:"1.7"})]})}function eD(){return o.jsxs("svg",{"aria-hidden":"true",fill:"none",height:"14",viewBox:"0 0 24 24",width:"14",children:[o.jsx("rect",{height:"16",rx:"2.6",stroke:"currentColor",strokeWidth:"1.8",width:"18",x:"3",y:"4"}),o.jsx("path",{d:"m7 9 3 3-3 3M12.5 15h4.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.9"})]})}function Zd(){return o.jsxs("svg",{"aria-hidden":"true",fill:"none",height:"17",viewBox:"0 0 24 24",width:"17",children:[o.jsx("circle",{cx:"7",cy:"12",r:"2.4",stroke:"currentColor",strokeWidth:"1.8"}),o.jsx("circle",{cx:"17",cy:"7",r:"2.4",stroke:"currentColor",strokeWidth:"1.8"}),o.jsx("circle",{cx:"17",cy:"17",r:"2.4",stroke:"currentColor",strokeWidth:"1.8"}),o.jsx("path",{d:"m9.2 10.9 5.6-2.8M9.2 13.1l5.6 2.8",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"1.8"})]})}function Lf(){return o.jsxs("svg",{"aria-hidden":"true",fill:"none",height:"13",viewBox:"0 0 24 24",width:"13",children:[o.jsx("path",{d:"m4 16-.8 4 4-.8L18.4 8 15.2 4.8 4 16Z",stroke:"currentColor",strokeLinejoin:"round",strokeWidth:"2"}),o.jsx("path",{d:"m13.8 6.2 3.2 3.2",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"2"})]})}function tD(){return o.jsx("svg",{"aria-hidden":"true",fill:"none",height:"14",viewBox:"0 0 24 24",width:"14",children:o.jsx("path",{d:"M5 8v11h14V8M4 4h16v4H4zM9 12h6",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"})})}function nD(){return o.jsxs("svg",{"aria-hidden":"true",fill:"none",height:"14",viewBox:"0 0 24 24",width:"14",children:[o.jsx("path",{d:"M2.5 12s3.5-6 9.5-6 9.5 6 9.5 6-3.5 6-9.5 6-9.5-6-9.5-6Z",stroke:"currentColor",strokeLinejoin:"round",strokeWidth:"2"}),o.jsx("circle",{cx:"12",cy:"12",r:"3",stroke:"currentColor",strokeWidth:"2"})]})}function rD(){return o.jsxs("svg",{"aria-hidden":"true",fill:"none",height:"14",viewBox:"0 0 24 24",width:"14",children:[o.jsx("path",{d:"M3 3l18 18",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"2"}),o.jsx("path",{d:"M9.9 5.4A9.8 9.8 0 0 1 12 5c6 0 9.5 7 9.5 7a15.5 15.5 0 0 1-3 3.8M6.2 6.8C3.8 8.4 2.5 12 2.5 12s3.5 7 9.5 7a9.7 9.7 0 0 0 4-.8",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"})]})}function wv(e,t){return`${Lx}:${qx(t)}:${e}`}function kv(e){const t=J1(e);return!!t&&Bx.has(t)}async function aD(e,t){return(await iD()).codeToHtml(e,{lang:qx(t),theme:Lx})}function iD(){return hp||(hp=lD()),hp}async function lD(){const[{createHighlighterCore:e},{createJavaScriptRegexEngine:t},{default:n},{default:a},{default:l},{default:u},{default:c},{default:f},{default:h},{default:m},{default:g},{default:v},{default:k},{default:b},{default:C},{default:D},{default:L},{default:z},{default:E},{default:B},{default:q},{default:X}]=await Promise.all([rn(()=>import("./core-CruSQzKn.js"),[],import.meta.url),rn(()=>import("./engine-javascript-DBd1bXLz.js"),[],import.meta.url),rn(()=>import("./github-light-DAi9KRSo.js"),[],import.meta.url),rn(()=>import("./bash-BELqPA7S.js").then(G=>G.b),[],import.meta.url),rn(()=>import("./css-CLj8gQPS.js"),[],import.meta.url),rn(()=>import("./diff-D97Zzqfu.js"),[],import.meta.url),rn(()=>import("./dockerfile-BcOcwvcX.js"),[],import.meta.url),rn(()=>import("./html-pp8916En.js"),__vite__mapDeps([0,1,2]),import.meta.url),rn(()=>import("./java-CylS5w8V.js"),[],import.meta.url),rn(()=>import("./javascript-wDzz0qaB.js"),[],import.meta.url),rn(()=>import("./json-Cp-IABpG.js"),[],import.meta.url),rn(()=>import("./jsonc-Des-eS-w.js"),[],import.meta.url),rn(()=>import("./jsx-g9-lgVsj.js"),[],import.meta.url),rn(()=>import("./markdown-Cvjx9yec.js"),[],import.meta.url),rn(()=>import("./python-B6aJPvgy.js"),[],import.meta.url),rn(()=>import("./bash-BELqPA7S.js").then(G=>G.s),[],import.meta.url),rn(()=>import("./sql-CRqJ_cUM.js"),[],import.meta.url),rn(()=>import("./toml-vGWfd6FD.js"),[],import.meta.url),rn(()=>import("./tsx-COt5Ahok.js"),[],import.meta.url),rn(()=>import("./typescript-BPQ3VLAy.js"),[],import.meta.url),rn(()=>import("./xml-sdJ4AIDG.js"),__vite__mapDeps([3,4]),import.meta.url),rn(()=>import("./yaml-Buea-lGh.js"),[],import.meta.url)]);return e({engine:t(),themes:[n],langs:[a,l,u,c,f,h,m,g,v,k,b,C,D,L,z,E,B,q,X]})}async function Sv(){const e=Ee("conversations"),t=await fetch(e);return await Pe(t,{url:e}),(await t.json()).conversations}async function sD(){const e=Ee("workspace-states"),t=await fetch(e);return await Pe(t,{url:e}),(await t.json()).workspaces}async function jv(){const e=Ee("collaboration/topics"),t=await fetch(e);return await Pe(t,{url:e}),(await t.json()).topics}async function $d(e){const t=Ee(`collaboration/topics/${e}/messages?limit=100`),n=await fetch(t);return await Pe(n,{url:t}),(await n.json()).messages}async function oD(e){const t=Ee("collaboration/topics"),n=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});return await Pe(n,{method:"POST",url:t}),(await n.json()).topic}async function uD(e,t){const n=Ee(`collaboration/topics/${e}`),a=await fetch(n,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});return await Pe(a,{method:"PATCH",url:n}),(await a.json()).topic}async function cD(e,t){const n=Ee(`collaboration/topics/${e}/archive`),a=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({expectedVersion:t})});return await Pe(a,{method:"POST",url:n}),(await a.json()).topic}async function dD(e){const t=Ee(`conversations/${e}/read`),n=await fetch(t,{method:"POST"});await Pe(n,{method:"POST",url:t})}async function Cv(){const e=Ee("workspace-groups"),t=await fetch(e);return await Pe(t,{url:e}),(await t.json()).groups}async function fD(e){const t=Ee("workspace-groups"),n=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:e})});return await Pe(n,{method:"POST",url:t}),(await n.json()).group}async function hD(e,t){const n=Ee(`workspace-groups/${e}`),a=await fetch(n,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});return await Pe(a,{method:"PATCH",url:n}),(await a.json()).group}async function mD(e){const t=Ee(`workspace-groups/${e}`),n=await fetch(t,{method:"DELETE"});return await Pe(n,{method:"DELETE",url:t}),await n.json()}async function pD(){const e=Ee("settings/environment"),t=await fetch(e);return await Pe(t,{url:e}),(await t.json()).variables}async function gD(e){const t=Ee(`conversations/${e}/settings/environment`),n=await fetch(t);return await Pe(n,{url:t}),(await n.json()).variables}async function yD(e){const t=Ee(`conversations/${e}/knowledge`),n=await fetch(t);return await Pe(n,{url:t}),(await n.json()).items}async function vD(){const e=Ee("settings/model-providers"),t=await fetch(e);return await Pe(t,{url:e}),t.json()}async function xD(){const e=Ee("settings/model-providers/options"),t=await fetch(e);return await Pe(t,{url:e}),t.json()}async function bD(e){const t=Ee(`settings/model-providers/${encodeURIComponent(e)}/balance`),n=await fetch(t);return await Pe(n,{url:t}),n.json()}async function wD(e){const t=Ee("settings/model-providers"),n=await fetch(t,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});return await Pe(n,{url:t,method:"PUT"}),n.json()}async function kD(){const e=Ee("settings/runtime"),t=await fetch(e);return await Pe(t,{url:e}),(await t.json()).settings}async function SD(){const e=Ee("settings/deployment"),t=await fetch(e);return await Pe(t,{url:e}),(await t.json()).settings}async function jD(){const e=Ee("diagnostics"),t=await fetch(e);return await Pe(t,{url:e}),await t.json()}async function CD(){const e=Ee("settings/runtime/codex"),t=await fetch(e);return await Pe(t,{url:e}),await t.json()}async function i1(){const e=Ee("settings/runtime/accounts"),t=await fetch(e);await Pe(t,{url:e});const n=await t.json();return Js(),n}async function pp(e=!1){const t=Ee(`settings/runtime/accounts/refresh${e?"?force=1":""}`),n=await fetch(t,{method:"POST"});await Pe(n,{method:"POST",url:t});const a=await n.json();return Js(),a}async function TD(e){const t=Ee("settings/runtime/accounts"),n=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e})});await Pe(n,{method:"POST",url:t});const a=await n.json();return a.login.status==="succeeded"&&Js(),a.login}async function AD(e){const t=Ee(`settings/runtime/accounts/login/${e}`),n=await fetch(t);return await Pe(n,{url:t}),(await n.json()).login}async function ED(e){const t=Ee(`settings/runtime/accounts/login/${e}/cancel`),n=await fetch(t,{method:"POST"});return await Pe(n,{method:"POST",url:t}),(await n.json()).login}async function ND(e,t,n){const a=Ee(`settings/runtime/accounts/${e}`),l=await fetch(a,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:t,renewalDay:n})});await Pe(l,{method:"PATCH",url:a});const u=await l.json();return Js(),u.account}async function MD(e){const t=Ee(`settings/runtime/accounts/${e}`),n=await fetch(t,{method:"DELETE"});await Pe(n,{method:"DELETE",url:t}),Js()}async function DD(e){const t=Ee(`settings/runtime/accounts/${e}/switch`),n=await fetch(t,{method:"POST"});await Pe(n,{method:"POST",url:t});const a=await n.json();return Js(),a}async function zD(e=!0){const t=Ee(`settings/runtime/models?refresh=${e?"1":"0"}`),n=await fetch(t);return await Pe(n,{url:t}),await n.json()}async function RD(e=!1){const t=Ee(`settings/runtime/codex/update${e?"?refreshLatest=1":""}`),n=await fetch(t);return await Pe(n,{url:t}),await n.json()}async function OD(){const e=Ee("settings/runtime/codex/update"),t=await fetch(e,{method:"POST"});return await Pe(t,{method:"POST",url:e}),(await t.json()).job}async function ID(e){const t=Ee(`conversations/${e}/settings/runtime`),n=await fetch(t);return await Pe(n,{url:t}),(await n.json()).settings}async function _D(){const e=Ee("settings/memory"),t=await fetch(e);return await Pe(t,{url:e}),await t.json()}async function LD(e){const t=Ee("settings/runtime"),n=await fetch(t,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});return await Pe(n,{method:"PUT",url:t}),(await n.json()).settings}async function BD(e){const t=Ee("settings/deployment"),n=await fetch(t,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});return await Pe(n,{method:"PUT",url:t}),(await n.json()).settings}async function Tv(e,t){const n=Ee(`conversations/${e}/settings/runtime`),a=await fetch(n,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});return await Pe(a,{method:"PUT",url:n}),await a.json()}async function Av(e,t){const n=Ee(`conversations/${e}/runtime/reset`),a=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});return await Pe(a,{method:"POST",url:n}),(await a.json()).job}async function Ev(e){const t=Ee(`conversations/${e}/runtime/reset-preview`),n=await fetch(t);return await Pe(n,{url:t}),await n.json()}async function qD(e,t){const n=Ee(`conversations/${e}/runtime/reset-selection`),a=await fetch(n,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});await Pe(a,{method:"PUT",url:n})}async function UD(e){const t=Ee(`conversations/${e}/runtime/thread-read`),n=await fetch(t);return await Pe(n,{url:t}),(await n.json()).result}async function HD(e){const t=Ee(`conversations/${e}/runtime/token-usage`),n=await fetch(t);await Pe(n,{url:t});const a=await n.json();return a.event?Jx(a.event):null}async function $D(e){const t=Ee(`conversations/${e}/runtime/additional-context`),n=await fetch(t);return await Pe(n,{url:t}),await n.json()}async function FD(e){const t=Ee(`conversations/${e}/runtime/compactions`),n=await fetch(t);return await Pe(n,{url:t}),(await n.json()).compactions}function PD(e,t,n){return{modelSource:ax(e.modelSource,t.modelSource)&&(n==null?void 0:n.sources.modelSource)!=="workspace"?null:e.modelSource??{type:"codex"},model:e.model===t.model?null:e.model,reasoningEffort:mE(e.reasoningEffort,t.reasoningEffort,(n==null?void 0:n.sources.reasoningEffort)==="workspace"),fastMode:e.fastMode===t.fastMode?null:e.fastMode,sandbox:e.sandbox===t.sandbox?null:e.sandbox}}function GD(e){return{kind:e.kind,name:e.name,description:e.description,purpose:e.purpose,attention:e.attention,refreshPolicy:e.refreshPolicy,status:e.status,sourceClues:YD(e.sourceCluesText),requiredEnv:WD(e.requiredEnvText)}}function VD(e){return{id:e.id,kind:e.kind,name:e.name,description:e.description,purpose:e.purpose,attention:e.attention,refreshPolicy:e.refreshPolicy,status:e.status,sourceCluesText:e.sourceClues.map(t=>`${t.type}: ${t.value}`).join(`
|
|
384
|
+
$2`)}function YM(e){var u;const t=M.Children.toArray(e),n=t.length===1&&M.isValidElement(t[0])?t[0]:null;if(!n||n.type!=="code")return null;const l=((u=(n.props.className??"").match(/(?:^|\s)language-([^\s]+)/))==null?void 0:u[1])??"";return{code:a1(n.props.children).replace(/\n$/,""),language:l}}function a1(e){return e==null||typeof e=="boolean"?"":typeof e=="string"||typeof e=="number"||typeof e=="bigint"?String(e):Array.isArray(e)?e.map(a1).join(""):M.isValidElement(e)?a1(e.props.children):""}const Lx="github-light",dp=new Map,fp=new Map;let hp=null,mp=null;const Bx=new Set(["bash","css","diff","dockerfile","html","java","javascript","json","jsonc","jsx","markdown","python","shellscript","sql","toml","tsx","typescript","xml","yaml"]);function J1(e){const t=e.trim().toLowerCase().replace(/^\./,"");return{bash:"bash",cjs:"javascript",console:"shellscript",htm:"html",js:"javascript",jsx:"jsx",md:"markdown",mjs:"javascript",py:"python",rb:"ruby",shell:"bash",ts:"typescript",tsx:"tsx",yml:"yaml",zsh:"bash"}[t]??t}function qx(e){const t=J1(e);return!t||t==="text"||t==="txt"?"text":Bx.has(t)?t:"text"}function WM({code:e}){const n=`seele-mermaid-${M.useId().replace(/[^a-zA-Z0-9_-]/g,"")}`,[a,l]=M.useState(!1),[u,c]=M.useState(()=>fp.get(e)??null),[f,h]=M.useState(null);M.useEffect(()=>{let g=!1,v;const k=fp.get(e);return k?(c(k),h(null),()=>{g=!0}):(h(null),c(null),KM(n,e).then(b=>{g||(v!==void 0&&window.clearTimeout(v),fp.set(e,b),c(b),h(null))},b=>{if(!g){const C=b instanceof Error?b.message:String(b);v=window.setTimeout(()=>{g||h(C)},FE)}}),()=>{g=!0,v!==void 0&&window.clearTimeout(v)})},[e,n]);async function m(){await navigator.clipboard.writeText(e),l(!0),window.setTimeout(()=>l(!1),1200)}return o.jsxs("figure",{className:`mermaid-block${f?" error":""}`,children:[o.jsx("span",{className:"code-block-kind",children:"mermaid"}),o.jsx("div",{className:"code-block-tools",children:o.jsx("button",{"aria-label":a?"Copied Mermaid source":"Copy Mermaid source",className:a?"copied":"",onClick:()=>void m(),title:a?"Copied":"Copy",type:"button",children:o.jsx(eg,{})})}),u?o.jsx("div",{className:"mermaid-diagram",dangerouslySetInnerHTML:{__html:u}}):f?o.jsxs("div",{className:"mermaid-error",children:[o.jsx("strong",{children:"Mermaid render failed"}),o.jsx("pre",{children:f}),o.jsx("code",{children:e})]}):o.jsx("div",{className:"mermaid-loading",children:"Rendering diagram..."})]})}async function KM(e,t){return(await(await XM()).render(e,t)).svg}function XM(){return mp||(mp=rn(()=>import("./mermaid.core-CvqU6Jn1.js").then(e=>e.bp),[],import.meta.url).then(e=>{const t=e.default;return t.initialize({startOnLoad:!1,securityLevel:"strict",theme:"base",themeVariables:{background:"#ffffff",primaryColor:"#f9fafa",primaryBorderColor:"#d8d9e8",primaryTextColor:"#0b0f16",lineColor:"#7a8294",secondaryColor:"#f5f5fb",tertiaryColor:"#ffffff",fontFamily:'Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif'}}),t})),mp}function ZM({code:e,language:t,reserveHeight:n=!1}){const[a,l]=M.useState(!1),[u,c]=M.useState(()=>{if(!kv(t))return null;const m=wv(e,t);return dp.get(m)??null}),f=n?{"--code-block-min-height":`${eN(e)}px`}:void 0;M.useEffect(()=>{let m=!1;if(!kv(t))return c(null),()=>{m=!0};const g=wv(e,t),v=dp.get(g);return v?(c(v),()=>{m=!0}):(c(null),aD(e,t).then(k=>{dp.set(g,k),m||c(k)}).catch(k=>{console.warn("Failed to highlight code block",k),m||c(null)}),()=>{m=!0})},[e,t]);async function h(){await navigator.clipboard.writeText(e),l(!0),window.setTimeout(()=>l(!1),1200)}return o.jsxs("figure",{className:"code-block",style:f,children:[t?o.jsx("span",{className:"code-block-kind",children:t}):null,o.jsx("div",{className:"code-block-tools",children:o.jsx("button",{"aria-label":a?"Copied code block":"Copy code block",className:a?"copied":"",onClick:()=>void h(),title:a?"Copied":"Copy",type:"button",children:o.jsx(eg,{})})}),u?o.jsx("div",{className:"code-block-shiki",dangerouslySetInnerHTML:{__html:u}}):o.jsx("pre",{children:o.jsx("code",{children:e})})]})}function eg(){return o.jsxs("svg",{"aria-hidden":"true",fill:"none",height:"13",viewBox:"0 0 24 24",width:"13",children:[o.jsx("rect",{height:"14",rx:"2",stroke:"currentColor",strokeWidth:"2",width:"14",x:"8",y:"8"}),o.jsx("path",{d:"M4 16V6a2 2 0 0 1 2-2h10",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"2"})]})}function Ux(){return o.jsxs("svg",{"aria-hidden":"true",fill:"none",height:"16",viewBox:"0 0 24 24",width:"16",children:[o.jsx("circle",{cx:"6",cy:"5",r:"2",stroke:"currentColor",strokeWidth:"2"}),o.jsx("circle",{cx:"18",cy:"5",r:"2",stroke:"currentColor",strokeWidth:"2"}),o.jsx("circle",{cx:"12",cy:"19",r:"2",stroke:"currentColor",strokeWidth:"2"}),o.jsx("path",{d:"M6 7v1a6 6 0 0 0 6 6v3M18 7v1a6 6 0 0 1-6 6",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"})]})}function tg(){return o.jsxs("svg",{"aria-hidden":"true",fill:"none",height:"12",viewBox:"0 0 24 24",width:"12",children:[o.jsx("circle",{cx:"12",cy:"12",r:"9",stroke:"currentColor",strokeWidth:"2.2"}),o.jsx("path",{d:"M12 7v6",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"2.4"}),o.jsx("circle",{cx:"12",cy:"17",fill:"currentColor",r:"1.25"})]})}function QM(){return o.jsx("svg",{"aria-hidden":"true",fill:"none",height:"18",viewBox:"0 0 24 24",width:"18",children:o.jsx("path",{d:"M4 7h16M4 12h16M4 17h16",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"2"})})}function JM(){return o.jsxs("svg",{"aria-hidden":"true",fill:"none",height:"14",viewBox:"0 0 24 24",width:"14",children:[o.jsx("path",{d:"M7 7h10M7 12h10M7 17h10",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"2"}),o.jsx("circle",{cx:"4",cy:"7",fill:"currentColor",r:"1.4"}),o.jsx("circle",{cx:"4",cy:"12",fill:"currentColor",r:"1.4"}),o.jsx("circle",{cx:"4",cy:"17",fill:"currentColor",r:"1.4"})]})}function bv(){return o.jsxs("svg",{"aria-hidden":"true",fill:"none",height:"14",viewBox:"0 0 24 24",width:"14",children:[o.jsx("circle",{cx:"12",cy:"12",r:"3",stroke:"currentColor",strokeWidth:"2"}),o.jsx("path",{d:"M19 12a7.8 7.8 0 0 0-.1-1l2-1.5-2-3.4-2.4 1a8 8 0 0 0-1.8-1l-.3-2.6h-4l-.3 2.6a8 8 0 0 0-1.8 1l-2.4-1-2 3.4 2 1.5a7.8 7.8 0 0 0 0 2l-2 1.5 2 3.4 2.4-1a8 8 0 0 0 1.8 1l.3 2.6h4l.3-2.6a8 8 0 0 0 1.8-1l2.4 1 2-3.4-2-1.5c.1-.3.1-.7.1-1Z",stroke:"currentColor",strokeLinejoin:"round",strokeWidth:"1.7"})]})}function eD(){return o.jsxs("svg",{"aria-hidden":"true",fill:"none",height:"14",viewBox:"0 0 24 24",width:"14",children:[o.jsx("rect",{height:"16",rx:"2.6",stroke:"currentColor",strokeWidth:"1.8",width:"18",x:"3",y:"4"}),o.jsx("path",{d:"m7 9 3 3-3 3M12.5 15h4.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.9"})]})}function Zd(){return o.jsxs("svg",{"aria-hidden":"true",fill:"none",height:"17",viewBox:"0 0 24 24",width:"17",children:[o.jsx("circle",{cx:"7",cy:"12",r:"2.4",stroke:"currentColor",strokeWidth:"1.8"}),o.jsx("circle",{cx:"17",cy:"7",r:"2.4",stroke:"currentColor",strokeWidth:"1.8"}),o.jsx("circle",{cx:"17",cy:"17",r:"2.4",stroke:"currentColor",strokeWidth:"1.8"}),o.jsx("path",{d:"m9.2 10.9 5.6-2.8M9.2 13.1l5.6 2.8",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"1.8"})]})}function Lf(){return o.jsxs("svg",{"aria-hidden":"true",fill:"none",height:"13",viewBox:"0 0 24 24",width:"13",children:[o.jsx("path",{d:"m4 16-.8 4 4-.8L18.4 8 15.2 4.8 4 16Z",stroke:"currentColor",strokeLinejoin:"round",strokeWidth:"2"}),o.jsx("path",{d:"m13.8 6.2 3.2 3.2",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"2"})]})}function tD(){return o.jsx("svg",{"aria-hidden":"true",fill:"none",height:"14",viewBox:"0 0 24 24",width:"14",children:o.jsx("path",{d:"M5 8v11h14V8M4 4h16v4H4zM9 12h6",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"})})}function nD(){return o.jsxs("svg",{"aria-hidden":"true",fill:"none",height:"14",viewBox:"0 0 24 24",width:"14",children:[o.jsx("path",{d:"M2.5 12s3.5-6 9.5-6 9.5 6 9.5 6-3.5 6-9.5 6-9.5-6-9.5-6Z",stroke:"currentColor",strokeLinejoin:"round",strokeWidth:"2"}),o.jsx("circle",{cx:"12",cy:"12",r:"3",stroke:"currentColor",strokeWidth:"2"})]})}function rD(){return o.jsxs("svg",{"aria-hidden":"true",fill:"none",height:"14",viewBox:"0 0 24 24",width:"14",children:[o.jsx("path",{d:"M3 3l18 18",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"2"}),o.jsx("path",{d:"M9.9 5.4A9.8 9.8 0 0 1 12 5c6 0 9.5 7 9.5 7a15.5 15.5 0 0 1-3 3.8M6.2 6.8C3.8 8.4 2.5 12 2.5 12s3.5 7 9.5 7a9.7 9.7 0 0 0 4-.8",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"})]})}function wv(e,t){return`${Lx}:${qx(t)}:${e}`}function kv(e){const t=J1(e);return!!t&&Bx.has(t)}async function aD(e,t){return(await iD()).codeToHtml(e,{lang:qx(t),theme:Lx})}function iD(){return hp||(hp=lD()),hp}async function lD(){const[{createHighlighterCore:e},{createJavaScriptRegexEngine:t},{default:n},{default:a},{default:l},{default:u},{default:c},{default:f},{default:h},{default:m},{default:g},{default:v},{default:k},{default:b},{default:C},{default:D},{default:L},{default:z},{default:E},{default:B},{default:q},{default:X}]=await Promise.all([rn(()=>import("./core-ltv4hIDV.js"),[],import.meta.url),rn(()=>import("./engine-javascript-DBd1bXLz.js"),[],import.meta.url),rn(()=>import("./github-light-DAi9KRSo.js"),[],import.meta.url),rn(()=>import("./bash-BELqPA7S.js").then(G=>G.b),[],import.meta.url),rn(()=>import("./css-CLj8gQPS.js"),[],import.meta.url),rn(()=>import("./diff-D97Zzqfu.js"),[],import.meta.url),rn(()=>import("./dockerfile-BcOcwvcX.js"),[],import.meta.url),rn(()=>import("./html-pp8916En.js"),__vite__mapDeps([0,1,2]),import.meta.url),rn(()=>import("./java-CylS5w8V.js"),[],import.meta.url),rn(()=>import("./javascript-wDzz0qaB.js"),[],import.meta.url),rn(()=>import("./json-Cp-IABpG.js"),[],import.meta.url),rn(()=>import("./jsonc-Des-eS-w.js"),[],import.meta.url),rn(()=>import("./jsx-g9-lgVsj.js"),[],import.meta.url),rn(()=>import("./markdown-Cvjx9yec.js"),[],import.meta.url),rn(()=>import("./python-B6aJPvgy.js"),[],import.meta.url),rn(()=>import("./bash-BELqPA7S.js").then(G=>G.s),[],import.meta.url),rn(()=>import("./sql-CRqJ_cUM.js"),[],import.meta.url),rn(()=>import("./toml-vGWfd6FD.js"),[],import.meta.url),rn(()=>import("./tsx-COt5Ahok.js"),[],import.meta.url),rn(()=>import("./typescript-BPQ3VLAy.js"),[],import.meta.url),rn(()=>import("./xml-sdJ4AIDG.js"),__vite__mapDeps([3,4]),import.meta.url),rn(()=>import("./yaml-Buea-lGh.js"),[],import.meta.url)]);return e({engine:t(),themes:[n],langs:[a,l,u,c,f,h,m,g,v,k,b,C,D,L,z,E,B,q,X]})}async function Sv(){const e=Ee("conversations"),t=await fetch(e);return await Pe(t,{url:e}),(await t.json()).conversations}async function sD(){const e=Ee("workspace-states"),t=await fetch(e);return await Pe(t,{url:e}),(await t.json()).workspaces}async function jv(){const e=Ee("collaboration/topics"),t=await fetch(e);return await Pe(t,{url:e}),(await t.json()).topics}async function $d(e){const t=Ee(`collaboration/topics/${e}/messages?limit=100`),n=await fetch(t);return await Pe(n,{url:t}),(await n.json()).messages}async function oD(e){const t=Ee("collaboration/topics"),n=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});return await Pe(n,{method:"POST",url:t}),(await n.json()).topic}async function uD(e,t){const n=Ee(`collaboration/topics/${e}`),a=await fetch(n,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});return await Pe(a,{method:"PATCH",url:n}),(await a.json()).topic}async function cD(e,t){const n=Ee(`collaboration/topics/${e}/archive`),a=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({expectedVersion:t})});return await Pe(a,{method:"POST",url:n}),(await a.json()).topic}async function dD(e){const t=Ee(`conversations/${e}/read`),n=await fetch(t,{method:"POST"});await Pe(n,{method:"POST",url:t})}async function Cv(){const e=Ee("workspace-groups"),t=await fetch(e);return await Pe(t,{url:e}),(await t.json()).groups}async function fD(e){const t=Ee("workspace-groups"),n=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:e})});return await Pe(n,{method:"POST",url:t}),(await n.json()).group}async function hD(e,t){const n=Ee(`workspace-groups/${e}`),a=await fetch(n,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});return await Pe(a,{method:"PATCH",url:n}),(await a.json()).group}async function mD(e){const t=Ee(`workspace-groups/${e}`),n=await fetch(t,{method:"DELETE"});return await Pe(n,{method:"DELETE",url:t}),await n.json()}async function pD(){const e=Ee("settings/environment"),t=await fetch(e);return await Pe(t,{url:e}),(await t.json()).variables}async function gD(e){const t=Ee(`conversations/${e}/settings/environment`),n=await fetch(t);return await Pe(n,{url:t}),(await n.json()).variables}async function yD(e){const t=Ee(`conversations/${e}/knowledge`),n=await fetch(t);return await Pe(n,{url:t}),(await n.json()).items}async function vD(){const e=Ee("settings/model-providers"),t=await fetch(e);return await Pe(t,{url:e}),t.json()}async function xD(){const e=Ee("settings/model-providers/options"),t=await fetch(e);return await Pe(t,{url:e}),t.json()}async function bD(e){const t=Ee(`settings/model-providers/${encodeURIComponent(e)}/balance`),n=await fetch(t);return await Pe(n,{url:t}),n.json()}async function wD(e){const t=Ee("settings/model-providers"),n=await fetch(t,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});return await Pe(n,{url:t,method:"PUT"}),n.json()}async function kD(){const e=Ee("settings/runtime"),t=await fetch(e);return await Pe(t,{url:e}),(await t.json()).settings}async function SD(){const e=Ee("settings/deployment"),t=await fetch(e);return await Pe(t,{url:e}),(await t.json()).settings}async function jD(){const e=Ee("diagnostics"),t=await fetch(e);return await Pe(t,{url:e}),await t.json()}async function CD(){const e=Ee("settings/runtime/codex"),t=await fetch(e);return await Pe(t,{url:e}),await t.json()}async function i1(){const e=Ee("settings/runtime/accounts"),t=await fetch(e);await Pe(t,{url:e});const n=await t.json();return Js(),n}async function pp(e=!1){const t=Ee(`settings/runtime/accounts/refresh${e?"?force=1":""}`),n=await fetch(t,{method:"POST"});await Pe(n,{method:"POST",url:t});const a=await n.json();return Js(),a}async function TD(e){const t=Ee("settings/runtime/accounts"),n=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e})});await Pe(n,{method:"POST",url:t});const a=await n.json();return a.login.status==="succeeded"&&Js(),a.login}async function AD(e){const t=Ee(`settings/runtime/accounts/login/${e}`),n=await fetch(t);return await Pe(n,{url:t}),(await n.json()).login}async function ED(e){const t=Ee(`settings/runtime/accounts/login/${e}/cancel`),n=await fetch(t,{method:"POST"});return await Pe(n,{method:"POST",url:t}),(await n.json()).login}async function ND(e,t,n){const a=Ee(`settings/runtime/accounts/${e}`),l=await fetch(a,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:t,renewalDay:n})});await Pe(l,{method:"PATCH",url:a});const u=await l.json();return Js(),u.account}async function MD(e){const t=Ee(`settings/runtime/accounts/${e}`),n=await fetch(t,{method:"DELETE"});await Pe(n,{method:"DELETE",url:t}),Js()}async function DD(e){const t=Ee(`settings/runtime/accounts/${e}/switch`),n=await fetch(t,{method:"POST"});await Pe(n,{method:"POST",url:t});const a=await n.json();return Js(),a}async function zD(e=!0){const t=Ee(`settings/runtime/models?refresh=${e?"1":"0"}`),n=await fetch(t);return await Pe(n,{url:t}),await n.json()}async function RD(e=!1){const t=Ee(`settings/runtime/codex/update${e?"?refreshLatest=1":""}`),n=await fetch(t);return await Pe(n,{url:t}),await n.json()}async function OD(){const e=Ee("settings/runtime/codex/update"),t=await fetch(e,{method:"POST"});return await Pe(t,{method:"POST",url:e}),(await t.json()).job}async function ID(e){const t=Ee(`conversations/${e}/settings/runtime`),n=await fetch(t);return await Pe(n,{url:t}),(await n.json()).settings}async function _D(){const e=Ee("settings/memory"),t=await fetch(e);return await Pe(t,{url:e}),await t.json()}async function LD(e){const t=Ee("settings/runtime"),n=await fetch(t,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});return await Pe(n,{method:"PUT",url:t}),(await n.json()).settings}async function BD(e){const t=Ee("settings/deployment"),n=await fetch(t,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});return await Pe(n,{method:"PUT",url:t}),(await n.json()).settings}async function Tv(e,t){const n=Ee(`conversations/${e}/settings/runtime`),a=await fetch(n,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});return await Pe(a,{method:"PUT",url:n}),await a.json()}async function Av(e,t){const n=Ee(`conversations/${e}/runtime/reset`),a=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});return await Pe(a,{method:"POST",url:n}),(await a.json()).job}async function Ev(e){const t=Ee(`conversations/${e}/runtime/reset-preview`),n=await fetch(t);return await Pe(n,{url:t}),await n.json()}async function qD(e,t){const n=Ee(`conversations/${e}/runtime/reset-selection`),a=await fetch(n,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});await Pe(a,{method:"PUT",url:n})}async function UD(e){const t=Ee(`conversations/${e}/runtime/thread-read`),n=await fetch(t);return await Pe(n,{url:t}),(await n.json()).result}async function HD(e){const t=Ee(`conversations/${e}/runtime/token-usage`),n=await fetch(t);await Pe(n,{url:t});const a=await n.json();return a.event?Jx(a.event):null}async function $D(e){const t=Ee(`conversations/${e}/runtime/additional-context`),n=await fetch(t);return await Pe(n,{url:t}),await n.json()}async function FD(e){const t=Ee(`conversations/${e}/runtime/compactions`),n=await fetch(t);return await Pe(n,{url:t}),(await n.json()).compactions}function PD(e,t,n){return{modelSource:ax(e.modelSource,t.modelSource)&&(n==null?void 0:n.sources.modelSource)!=="workspace"?null:e.modelSource??{type:"codex"},model:e.model===t.model?null:e.model,reasoningEffort:mE(e.reasoningEffort,t.reasoningEffort,(n==null?void 0:n.sources.reasoningEffort)==="workspace"),fastMode:e.fastMode===t.fastMode?null:e.fastMode,sandbox:e.sandbox===t.sandbox?null:e.sandbox}}function GD(e){return{kind:e.kind,name:e.name,description:e.description,purpose:e.purpose,attention:e.attention,refreshPolicy:e.refreshPolicy,status:e.status,sourceClues:YD(e.sourceCluesText),requiredEnv:WD(e.requiredEnvText)}}function VD(e){return{id:e.id,kind:e.kind,name:e.name,description:e.description,purpose:e.purpose,attention:e.attention,refreshPolicy:e.refreshPolicy,status:e.status,sourceCluesText:e.sourceClues.map(t=>`${t.type}: ${t.value}`).join(`
|
|
385
385
|
`),requiredEnvText:e.fetch.requiredEnv.map(t=>t.description?`${t.key} - ${t.description}`:t.key).join(`
|
|
386
386
|
`)}}function YD(e){const t=new Date().toISOString();return e.split(/\r?\n/).map(n=>n.trim()).filter(Boolean).map(n=>{const a=n.match(/^([a-zA-Z][\w-]{0,31})\s*:\s*(.+)$/);return{type:a?a[1].toLowerCase():"text",value:a?a[2].trim():n,providedBy:"user",providedAt:t}})}function WD(e){return e.split(/\r?\n/).map(t=>t.trim()).filter(Boolean).map(t=>{const[n,...a]=t.split(/\s+-\s+/);return{key:n.trim().toUpperCase(),description:a.join(" - ").trim()}}).filter(t=>/^[A-Z_][A-Z0-9_]*$/.test(t.key))}function Nv(e,t){const n=Mv(t.attention)-Mv(e.attention);return n!==0?n:t.updatedAt.localeCompare(e.updatedAt)}function Mv(e){return e==="watch"?2:e==="tracked"?1:0}function Yc(e){return e.map(t=>({key:t.key??"",value:t.value??"",updatedAt:t.updatedAt}))}function KD(e){return e?/^[a-z_][a-z0-9_.-]*$/.test(e)?null:"Key must start with a lowercase English letter or underscore, and may contain lowercase letters, numbers, dots, underscores, and hyphens.":"Key is required."}function XD(e){return Yc(e).filter(t=>t.key.trim()&&t.value.trim()).map(t=>`${t.key.trim()}: ${t.value.trim()}`).join(`
|
|
387
387
|
`)}async function ZD(e){const t=Ee("settings/memory"),n=await fetch(t,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});return await Pe(n,{method:"PUT",url:t}),await n.json()}async function QD(e,t,n){const a=Ee("settings/environment"),l=await fetch(a,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({description:n,key:e,value:t})});return await Pe(l,{method:"PUT",url:a}),(await l.json()).variable}async function JD(e,t,n,a){const l=Ee(`conversations/${e}/settings/environment`),u=await fetch(l,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({description:a,key:t,value:n})});return await Pe(u,{method:"PUT",url:l}),await u.json()}async function ez(e){const t=Ee(`settings/environment/${encodeURIComponent(e)}/reveal`),n=await fetch(t);return await Pe(n,{url:t}),(await n.json()).variable.value}async function tz(e,t){const n=Ee(`conversations/${e}/settings/environment/${encodeURIComponent(t)}/reveal`),a=await fetch(n);return await Pe(a,{url:n}),(await a.json()).variable.value}async function nz(e){const t=Ee(`settings/environment/${encodeURIComponent(e)}`),n=await fetch(t,{method:"DELETE"});await Pe(n,{method:"DELETE",url:t})}async function rz(e,t){const n=Ee(`conversations/${e}/settings/environment/${encodeURIComponent(t)}`),a=await fetch(n,{method:"DELETE"});return await Pe(a,{method:"DELETE",url:n}),(await a.json()).conversation}async function az(e,t){const n=Ee(`conversations/${e}/knowledge`),a=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});return await Pe(a,{method:"POST",url:n}),(await a.json()).item}async function iz(e,t,n){const a=Ee(`conversations/${e}/knowledge/${encodeURIComponent(t)}`),l=await fetch(a,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});return await Pe(l,{method:"PATCH",url:a}),(await l.json()).item}async function lz(e,t){const n=Ee(`conversations/${e}/knowledge/${encodeURIComponent(t)}`),a=await fetch(n,{method:"DELETE"});await Pe(a,{method:"DELETE",url:n})}async function sz(){const e=Ee("meta"),t=await fetch(e);return await Pe(t,{url:e}),await t.json()}async function oz(e){const t=Ee(`settings/runtime/rate-limits?refresh=${e?"1":"0"}`),n=await fetch(t);return await Pe(n,{url:t}),(await n.json()).usage??null}async function uz(e,t){const n=Ee("conversations"),a=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:e,groupId:t})});return await Pe(a,{method:"POST",url:n}),(await a.json()).conversation}function cz(){if(typeof crypto.randomUUID=="function")return crypto.randomUUID();const e=crypto.getRandomValues(new Uint8Array(16));e[6]=e[6]&15|64,e[8]=e[8]&63|128;const t=Array.from(e,n=>n.toString(16).padStart(2,"0")).join("");return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}async function dz(e,t,n,a,l){const u=Ee(`conversations/${e}/clone`),c=await fetch(u,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:t,groupId:n,excludeTopicHistory:a,requestId:l})});return await Pe(c,{method:"POST",url:u}),await c.json()}async function fz(e){const t=Ee(`conversations/${e}/clone/retry`),n=await fetch(t,{method:"POST"});return await Pe(n,{method:"POST",url:t}),await n.json()}async function ru(e,t={}){const n=new URLSearchParams;n.set("limit",String(t.limit??fx)),t.before&&n.set("before",t.before);const a=Ee(`conversations/${e}?${n}`),l=await fetch(a);return await Pe(l,{url:a}),(await l.json()).conversation}async function Hx(e,t){const n=Ee(`conversations/${e}/turns/${t}/history-events`),a=await fetch(n);return await Pe(a,{url:n}),(await a.json()).events}async function Fd(e,t){const n=Ee(`conversations/${e}`),a=await fetch(n,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});return await Pe(a,{method:"PATCH",url:n}),(await a.json()).conversation}async function hz(e){const t=Ee(`conversations/${e}`),n=await fetch(t,{method:"DELETE"});await Pe(n,{method:"DELETE",url:t})}function mz(e){return e.title==="Phase boundary recommended"||e.title==="Long run in progress"}function $x(e){return e.length<=3?e.join(", "):`${e.slice(0,3).join(", ")} +${e.length-3}`}function pz(e,t){if(e.event==="server.error"||e.event==="client.error")return{id:e.id,kind:"error",title:"Error",body:_z(e.data),createdAt:e.createdAt??new Date().toISOString()};if(e.event==="server.collaboration.message_staged"||e.event==="server.collaboration.message_sent"||e.event==="server.collaboration.message_rejected"){const u=Ue(e.data),c=Je(u.toolCallId),f=typeof u.controlIndex=="number"?u.controlIndex:null;if(c||f!==null){const h=e.event==="server.collaboration.message_staged",m=e.event==="server.collaboration.message_sent",g=Je(u.audience),v=Je(u.recipientWorkspaceId),k=v?[v]:Array.isArray(u.recipientWorkspaceIds)?u.recipientWorkspaceIds.filter(L=>typeof L=="string"):Array.isArray(u.recipients)?u.recipients.filter(L=>typeof L=="string"):[],b=k.filter(L=>L!=="ALL").map(L=>t.get(L)).filter(L=>!!L);let C="Topic";b.length>0?C=$x(b):k.length===1?C=k[0]==="ALL"?"Topic participants":es(k[0]):k.length>1?C=`${k.length} workspaces`:g==="public"||g==="all"?C="Topic participants":g==="owner"&&(C="Topic owner");const D=Je(u.topicId);return{id:e.id,kind:"collaboration",title:`Send to ${C}`,body:D?`Topic ${es(D)}`:"Topic",createdAt:e.createdAt??new Date().toISOString(),itemId:c||`legacy-topic-message:${f}`,meta:h?"pending send":m?"done":"failed",output:h||m?Je(u.contentMarkdown)||void 0:Je(u.reason)||void 0,topicAction:"send",topicRecipientLabel:C,topicMessageContent:(h||m)&&Je(u.contentMarkdown)||void 0}}}if(e.event==="codex.input_request"||e.event==="codex.input_or_approval_request"){const u=Ue(e.data);if(e.event==="codex.input_request"||u.method==="item/tool/requestUserInput"){const c=Ue(u.params),h=(Array.isArray(c.questions)?c.questions:[]).map(m=>{const g=Ue(m),v=typeof g.question=="string"?g.question:"Please provide the missing information.",k=Array.isArray(g.options)?g.options.map(b=>{const C=Ue(b);return typeof C.label=="string"?`- ${C.label}${typeof C.description=="string"?`: ${C.description}`:""}`:""}).filter(Boolean).join(`
|