@1agents/acp-service 0.10.9 → 0.10.10
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/dist/bin/a2a.js +12 -1
- package/dist/src/a2a/gateway.d.ts +268 -2
- package/dist/src/a2a/gateway.js +337 -25
- package/dist/src/a2a/job-directory.d.ts +5 -0
- package/dist/src/a2a/job-directory.js +15 -0
- package/dist/src/a2a/preflight.d.ts +38 -0
- package/dist/src/a2a/preflight.js +56 -8
- package/dist/src/a2a/types.d.ts +8 -0
- package/dist/src/execution/case-view.d.ts +109 -0
- package/dist/src/execution/case-view.js +125 -0
- package/dist/src/execution/cases.d.ts +56 -0
- package/dist/src/execution/cases.js +77 -0
- package/dist/src/execution/externals.d.ts +83 -0
- package/dist/src/execution/externals.js +61 -0
- package/dist/src/execution/handoff.d.ts +54 -1
- package/dist/src/execution/handoff.js +80 -15
- package/dist/src/execution/ledger.d.ts +35 -2
- package/dist/src/execution/ledger.js +72 -2
- package/dist/src/execution/snapshots.d.ts +28 -0
- package/dist/src/execution/snapshots.js +64 -0
- package/dist/src/execution/targets.d.ts +63 -0
- package/dist/src/execution/targets.js +15 -1
- package/dist/src/execution/workbench.d.ts +5 -1
- package/dist/src/execution/workbench.js +13 -4
- package/dist/workbench-ui/app.css +18 -0
- package/dist/workbench-ui/app.js +13 -13
- package/package.json +12 -13
- package/vendor/dsh/a2a-executor.d.ts +2 -2
- package/vendor/dsh/adapter.d.ts +4 -4
- package/vendor/dsh/cordis.patch.yml +6 -7
- package/vendor/dsh/handoff-executor.d.ts +7 -0
- package/vendor/dsh/handoff-executor.js +28 -0
- package/vendor/dsh/handoff-spec.d.ts +26 -0
- package/vendor/dsh/handoff-spec.js +14 -0
- package/vendor/dsh/handoff-tools.d.ts +4 -0
- package/vendor/dsh/handoff-tools.js +20 -0
- package/vendor/dsh/index.js +8 -0
- package/vendor/dsh/review-mcp.js +6 -2
- package/vendor/dsh/review.d.ts +3 -0
- package/vendor/dsh/review.js +19 -0
- package/vendor/dsh/ticket-tools.d.ts +1 -1
- package/vendor/runtime/dist/{cli-DXmYwv3U.js → cli-BwanDcOo.js} +4 -4
- package/vendor/runtime/dist/{cli-DXmYwv3U.js.map → cli-BwanDcOo.js.map} +1 -1
- package/vendor/runtime/dist/cli.js +8 -8
- package/vendor/runtime/dist/{client-VQsqcIOJ.d.ts → client-C5zneoBs.d.ts} +3 -1
- package/vendor/runtime/dist/{client-VQsqcIOJ.d.ts.map → client-C5zneoBs.d.ts.map} +1 -1
- package/vendor/runtime/dist/docs-site/.nojekyll +0 -0
- package/vendor/runtime/dist/docs-site/CLI.html +833 -0
- package/vendor/runtime/dist/docs-site/VISION.html +415 -0
- package/vendor/runtime/dist/docs-site/agents.html +391 -0
- package/vendor/runtime/dist/docs-site/compare.html +359 -0
- package/vendor/runtime/dist/docs-site/config.html +450 -0
- package/vendor/runtime/dist/docs-site/custom-agents.html +408 -0
- package/vendor/runtime/dist/docs-site/exit-codes.html +347 -0
- package/vendor/runtime/dist/docs-site/favicon.svg +21 -0
- package/vendor/runtime/dist/docs-site/flows.html +498 -0
- package/vendor/runtime/dist/docs-site/index.html +367 -0
- package/vendor/runtime/dist/docs-site/install.html +386 -0
- package/vendor/runtime/dist/docs-site/llms.txt +36 -0
- package/vendor/runtime/dist/docs-site/output-formats.html +407 -0
- package/vendor/runtime/dist/docs-site/permissions.html +422 -0
- package/vendor/runtime/dist/docs-site/prompting.html +460 -0
- package/vendor/runtime/dist/docs-site/quickstart.html +382 -0
- package/vendor/runtime/dist/docs-site/releasing.html +341 -0
- package/vendor/runtime/dist/docs-site/runtime-environment.html +329 -0
- package/vendor/runtime/dist/docs-site/runtime-process-lifecycle.html +336 -0
- package/vendor/runtime/dist/docs-site/safe-errors.html +323 -0
- package/vendor/runtime/dist/docs-site/session-control.html +408 -0
- package/vendor/runtime/dist/docs-site/session-watch.html +354 -0
- package/vendor/runtime/dist/docs-site/sessions.html +488 -0
- package/vendor/runtime/dist/docs-site/shared-sessions.html +377 -0
- package/vendor/runtime/dist/{flows-DJ17ajbw.js → flows-CzLUHUTS.js} +4 -4
- package/vendor/runtime/dist/{flows-DJ17ajbw.js.map → flows-CzLUHUTS.js.map} +1 -1
- package/vendor/runtime/dist/flows.d.ts +1 -1
- package/vendor/runtime/dist/flows.js +1 -1
- package/vendor/runtime/dist/{invocation-options-PBfCgrdi.js → invocation-options-B6pIpdpR.js} +4 -4
- package/vendor/runtime/dist/{invocation-options-PBfCgrdi.js.map → invocation-options-B6pIpdpR.js.map} +1 -1
- package/vendor/runtime/dist/{ipc-BQQpcEdP.js → ipc-ivLtSAdL.js} +21 -3
- package/vendor/runtime/dist/ipc-ivLtSAdL.js.map +1 -0
- package/vendor/runtime/dist/{output-B3MDn7kv.js → output-BqKnXXb0.js} +3 -3
- package/vendor/runtime/dist/{output-B3MDn7kv.js.map → output-BqKnXXb0.js.map} +1 -1
- package/vendor/runtime/dist/{queue-owner-runtime-DXCVngwU.js → queue-owner-runtime-DXJND10J.js} +11 -2
- package/vendor/runtime/dist/queue-owner-runtime-DXJND10J.js.map +1 -0
- package/vendor/runtime/dist/runtime.d.ts +1 -1
- package/vendor/runtime/dist/runtime.d.ts.map +1 -1
- package/vendor/runtime/dist/runtime.js +3 -3
- package/vendor/runtime/dist/{session-watch-DURyCw31.js → session-watch-BHB3_PXm.js} +4 -4
- package/vendor/runtime/dist/{session-watch-DURyCw31.js.map → session-watch-BHB3_PXm.js.map} +1 -1
- package/vendor/runtime/dist/{watch-CIpoMaWD.js → watch-UjokHUfS.js} +2 -2
- package/vendor/runtime/dist/{watch-CIpoMaWD.js.map → watch-UjokHUfS.js.map} +1 -1
- package/vendor/runtime/dist/ipc-BQQpcEdP.js.map +0 -1
- package/vendor/runtime/dist/queue-owner-runtime-DXCVngwU.js.map +0 -1
package/dist/workbench-ui/app.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import"./chunk-SQE76S5B.js";var Ge,S,Vt,zn,ie,Wt,Jt,Kt,pt,qe,Ee,Qt,ht,ft,mt,Vn,Je={},Ke=[],Jn=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Xe=Array.isArray;function te(e,n){for(var r in n)e[r]=n[r];return e}function vt(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Kn(e,n,r){var o,a,s,c={};for(s in n)s=="key"?o=n[s]:s=="ref"?a=n[s]:c[s]=n[s];if(arguments.length>2&&(c.children=arguments.length>3?Ge.call(arguments,2):r),typeof e=="function"&&e.defaultProps!=null)for(s in e.defaultProps)c[s]===void 0&&(c[s]=e.defaultProps[s]);return ze(e,c,o,a,null)}function ze(e,n,r,o,a){var s={type:e,props:n,key:r,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:a??++Vt,__i:-1,__u:0};return a==null&&S.vnode!=null&&S.vnode(s),s}function C(e){return e.children}function Ve(e,n){this.props=e,this.context=n}function Ie(e,n){if(n==null)return e.__?Ie(e.__,e.__i+1):null;for(var r;n<e.__k.length;n++)if((r=e.__k[n])!=null&&r.__e!=null)return r.__e;return typeof e.type=="function"?Ie(e):null}function Qn(e){if(e.__P&&e.__d){var n=e.__v,r=n.__e,o=[],a=[],s=te({},n);s.__v=n.__v+1,S.vnode&&S.vnode(s),_t(e.__P,s,n,e.__n,e.__P.namespaceURI,32&n.__u?[r]:null,o,r??Ie(n),!!(32&n.__u),a),s.__v=n.__v,s.__.__k[s.__i]=s,Yt(o,s,a),n.__e=n.__=null,s.__e!=r&&Gt(s)}}function Gt(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(n){if(n!=null&&n.__e!=null)return e.__e=e.__c.base=n.__e}),Gt(e)}function Bt(e){(!e.__d&&(e.__d=!0)&&ie.push(e)&&!Qe.__r++||Wt!=S.debounceRendering)&&((Wt=S.debounceRendering)||Jt)(Qe)}function Qe(){try{for(var e,n=1;ie.length;)ie.length>n&&ie.sort(Kt),e=ie.shift(),n=ie.length,Qn(e)}finally{ie.length=Qe.__r=0}}function Xt(e,n,r,o,a,s,c,l,d,u,f){var p,_,b,x,m,I,w,y=o&&o.__k||Ke,P=n.length;for(d=Gn(r,n,y,d,P),p=0;p<P;p++)(b=r.__k[p])!=null&&(_=b.__i!=-1&&y[b.__i]||Je,b.__i=p,I=_t(e,b,_,a,s,c,l,d,u,f),x=b.__e,b.ref&&_.ref!=b.ref&&(_.ref&&bt(_.ref,null,b),f.push(b.ref,b.__c||x,b)),m==null&&x!=null&&(m=x),(w=!!(4&b.__u))||_.__k===b.__k?(d=Zt(b,d,e,w),w&&_.__e&&(_.__e=null)):typeof b.type=="function"&&I!==void 0?d=I:x&&(d=x.nextSibling),b.__u&=-7);return r.__e=m,d}function Gn(e,n,r,o,a){var s,c,l,d,u,f=r.length,p=f,_=0;for(e.__k=new Array(a),s=0;s<a;s++)(c=n[s])!=null&&typeof c!="boolean"&&typeof c!="function"?(typeof c=="string"||typeof c=="number"||typeof c=="bigint"||c.constructor==String?c=e.__k[s]=ze(null,c,null,null,null):Xe(c)?c=e.__k[s]=ze(C,{children:c},null,null,null):c.constructor===void 0&&c.__b>0?c=e.__k[s]=ze(c.type,c.props,c.key,c.ref?c.ref:null,c.__v):e.__k[s]=c,d=s+_,c.__=e,c.__b=e.__b+1,l=null,(u=c.__i=Xn(c,r,d,p))!=-1&&(p--,(l=r[u])&&(l.__u|=2)),l==null||l.__v==null?(u==-1&&(a>f?_--:a<f&&_++),typeof c.type!="function"&&(c.__u|=4)):u!=d&&(u==d-1?_--:u==d+1?_++:(u>d?_--:_++,c.__u|=4))):e.__k[s]=null;if(p)for(s=0;s<f;s++)(l=r[s])!=null&&(2&l.__u)==0&&(l.__e==o&&(o=Ie(l)),tn(l,l));return o}function Zt(e,n,r,o){var a,s;if(typeof e.type=="function"){for(a=e.__k,s=0;a&&s<a.length;s++)a[s]&&(a[s].__=e,n=Zt(a[s],n,r,o));return n}e.__e!=n&&(o&&(n&&e.type&&!n.parentNode&&(n=Ie(e)),r.insertBefore(e.__e,n||null)),n=e.__e);do n=n&&n.nextSibling;while(n!=null&&n.nodeType==8);return n}function Xn(e,n,r,o){var a,s,c,l=e.key,d=e.type,u=n[r],f=u!=null&&(2&u.__u)==0;if(u===null&&l==null||f&&l==u.key&&d==u.type)return r;if(o>(f?1:0)){for(a=r-1,s=r+1;a>=0||s<n.length;)if((u=n[c=a>=0?a--:s++])!=null&&(2&u.__u)==0&&l==u.key&&d==u.type)return c}return-1}function qt(e,n,r){n[0]=="-"?e.setProperty(n,r??""):e[n]=r==null?"":typeof r!="number"||Jn.test(n)?r:r+"px"}function Be(e,n,r,o,a){var s,c;e:if(n=="style")if(typeof r=="string")e.style.cssText=r;else{if(typeof o=="string"&&(e.style.cssText=o=""),o)for(n in o)r&&n in r||qt(e.style,n,"");if(r)for(n in r)o&&r[n]==o[n]||qt(e.style,n,r[n])}else if(n[0]=="o"&&n[1]=="n")s=n!=(n=n.replace(Qt,"$1")),c=n.toLowerCase(),n=c in e||n=="onFocusOut"||n=="onFocusIn"?c.slice(2):n.slice(2),e.l||(e.l={}),e.l[n+s]=r,r?o?r[Ee]=o[Ee]:(r[Ee]=ht,e.addEventListener(n,s?mt:ft,s)):e.removeEventListener(n,s?mt:ft,s);else{if(a=="http://www.w3.org/2000/svg")n=n.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(n!="width"&&n!="height"&&n!="href"&&n!="list"&&n!="form"&&n!="tabIndex"&&n!="download"&&n!="rowSpan"&&n!="colSpan"&&n!="role"&&n!="popover"&&n in e)try{e[n]=r??"";break e}catch{}typeof r=="function"||(r==null||r===!1&&n[4]!="-"?e.removeAttribute(n):e.setAttribute(n,n=="popover"&&r==1?"":r))}}function zt(e){return function(n){if(this.l){var r=this.l[n.type+e];if(n[qe]==null)n[qe]=ht++;else if(n[qe]<r[Ee])return;return r(S.event?S.event(n):n)}}}function _t(e,n,r,o,a,s,c,l,d,u){var f,p,_,b,x,m,I,w,y,P,j,h,N,U,K,$=n.type;if(n.constructor!==void 0)return null;128&r.__u&&(d=!!(32&r.__u),s=[l=n.__e=r.__e]),(f=S.__b)&&f(n);e:if(typeof $=="function")try{if(w=n.props,y=$.prototype&&$.prototype.render,P=(f=$.contextType)&&o[f.__c],j=f?P?P.props.value:f.__:o,r.__c?I=(p=n.__c=r.__c).__=p.__E:(y?n.__c=p=new $(w,j):(n.__c=p=new Ve(w,j),p.constructor=$,p.render=Yn),P&&P.sub(p),p.state||(p.state={}),p.__n=o,_=p.__d=!0,p.__h=[],p._sb=[]),y&&p.__s==null&&(p.__s=p.state),y&&$.getDerivedStateFromProps!=null&&(p.__s==p.state&&(p.__s=te({},p.__s)),te(p.__s,$.getDerivedStateFromProps(w,p.__s))),b=p.props,x=p.state,p.__v=n,_)y&&$.getDerivedStateFromProps==null&&p.componentWillMount!=null&&p.componentWillMount(),y&&p.componentDidMount!=null&&p.__h.push(p.componentDidMount);else{if(y&&$.getDerivedStateFromProps==null&&w!==b&&p.componentWillReceiveProps!=null&&p.componentWillReceiveProps(w,j),n.__v==r.__v||!p.__e&&p.shouldComponentUpdate!=null&&p.shouldComponentUpdate(w,p.__s,j)===!1){n.__v!=r.__v&&(p.props=w,p.state=p.__s,p.__d=!1),n.__e=r.__e,n.__k=r.__k,n.__k.some(function(q){q&&(q.__=n)}),Ke.push.apply(p.__h,p._sb),p._sb=[],p.__h.length&&c.push(p);break e}p.componentWillUpdate!=null&&p.componentWillUpdate(w,p.__s,j),y&&p.componentDidUpdate!=null&&p.__h.push(function(){p.componentDidUpdate(b,x,m)})}if(p.context=j,p.props=w,p.__P=e,p.__e=!1,h=S.__r,N=0,y)p.state=p.__s,p.__d=!1,h&&h(n),f=p.render(p.props,p.state,p.context),Ke.push.apply(p.__h,p._sb),p._sb=[];else do p.__d=!1,h&&h(n),f=p.render(p.props,p.state,p.context),p.state=p.__s;while(p.__d&&++N<25);p.state=p.__s,p.getChildContext!=null&&(o=te(te({},o),p.getChildContext())),y&&!_&&p.getSnapshotBeforeUpdate!=null&&(m=p.getSnapshotBeforeUpdate(b,x)),U=f!=null&&f.type===C&&f.key==null?en(f.props.children):f,l=Xt(e,Xe(U)?U:[U],n,r,o,a,s,c,l,d,u),p.base=n.__e,n.__u&=-161,p.__h.length&&c.push(p),I&&(p.__E=p.__=null)}catch(q){if(n.__v=null,d||s!=null)if(q.then){for(n.__u|=d?160:128;l&&l.nodeType==8&&l.nextSibling;)l=l.nextSibling;s[s.indexOf(l)]=null,n.__e=l}else{for(K=s.length;K--;)vt(s[K]);gt(n)}else n.__e=r.__e,n.__k=r.__k,q.then||gt(n);S.__e(q,n,r)}else s==null&&n.__v==r.__v?(n.__k=r.__k,n.__e=r.__e):l=n.__e=Zn(r.__e,n,r,o,a,s,c,d,u);return(f=S.diffed)&&f(n),128&n.__u?void 0:l}function gt(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(gt))}function Yt(e,n,r){for(var o=0;o<r.length;o++)bt(r[o],r[++o],r[++o]);S.__c&&S.__c(n,e),e.some(function(a){try{e=a.__h,a.__h=[],e.some(function(s){s.call(a)})}catch(s){S.__e(s,a.__v)}})}function en(e){return typeof e!="object"||e==null||e.__b>0?e:Xe(e)?e.map(en):e.constructor!==void 0?null:te({},e)}function Zn(e,n,r,o,a,s,c,l,d){var u,f,p,_,b,x,m,I=r.props||Je,w=n.props,y=n.type;if(y=="svg"?a="http://www.w3.org/2000/svg":y=="math"?a="http://www.w3.org/1998/Math/MathML":a||(a="http://www.w3.org/1999/xhtml"),s!=null){for(u=0;u<s.length;u++)if((b=s[u])&&"setAttribute"in b==!!y&&(y?b.localName==y:b.nodeType==3)){e=b,s[u]=null;break}}if(e==null){if(y==null)return document.createTextNode(w);e=document.createElementNS(a,y,w.is&&w),l&&(S.__m&&S.__m(n,s),l=!1),s=null}if(y==null)I===w||l&&e.data==w||(e.data=w);else{if(s=y=="textarea"&&w.defaultValue!=null?null:s&&Ge.call(e.childNodes),!l&&s!=null)for(I={},u=0;u<e.attributes.length;u++)I[(b=e.attributes[u]).name]=b.value;for(u in I)b=I[u],u=="dangerouslySetInnerHTML"?p=b:u=="children"||u in w||u=="value"&&"defaultValue"in w||u=="checked"&&"defaultChecked"in w||Be(e,u,null,b,a);for(u in w)b=w[u],u=="children"?_=b:u=="dangerouslySetInnerHTML"?f=b:u=="value"?x=b:u=="checked"?m=b:l&&typeof b!="function"||I[u]===b||Be(e,u,b,I[u],a);if(f)l||p&&(f.__html==p.__html||f.__html==e.innerHTML)||(e.innerHTML=f.__html),n.__k=[];else if(p&&(e.innerHTML=""),Xt(n.type=="template"?e.content:e,Xe(_)?_:[_],n,r,o,y=="foreignObject"?"http://www.w3.org/1999/xhtml":a,s,c,s?s[0]:r.__k&&Ie(r,0),l,d),s!=null)for(u=s.length;u--;)vt(s[u]);l&&y!="textarea"||(u="value",y=="progress"&&x==null?e.removeAttribute("value"):x!=null&&(x!==e[u]||y=="progress"&&!x||y=="option"&&x!=I[u])&&Be(e,u,x,I[u],a),u="checked",m!=null&&m!=e[u]&&Be(e,u,m,I[u],a))}return e}function bt(e,n,r){try{if(typeof e=="function"){var o=typeof e.__u=="function";o&&e.__u(),o&&n==null||(e.__u=e(n))}else e.current=n}catch(a){S.__e(a,r)}}function tn(e,n,r){var o,a;if(S.unmount&&S.unmount(e),(o=e.ref)&&(o.current&&o.current!=e.__e||bt(o,null,n)),(o=e.__c)!=null){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(s){S.__e(s,n)}o.base=o.__P=null}if(o=e.__k)for(a=0;a<o.length;a++)o[a]&&tn(o[a],n,r||typeof e.type!="function");r||vt(e.__e),e.__c=e.__=e.__e=void 0}function Yn(e,n,r){return this.constructor(e,r)}function nn(e,n,r){var o,a,s,c;n==document&&(n=document.documentElement),S.__&&S.__(e,n),a=(o=typeof r=="function")?null:r&&r.__k||n.__k,s=[],c=[],_t(n,e=(!o&&r||n).__k=Kn(C,null,[e]),a||Je,Je,n.namespaceURI,!o&&r?[r]:a?null:n.firstChild?Ge.call(n.childNodes):null,s,!o&&r?r:a?a.__e:n.firstChild,o,c),Yt(s,e,c)}Ge=Ke.slice,S={__e:function(e,n,r,o){for(var a,s,c;n=n.__;)if((a=n.__c)&&!a.__)try{if((s=a.constructor)&&s.getDerivedStateFromError!=null&&(a.setState(s.getDerivedStateFromError(e)),c=a.__d),a.componentDidCatch!=null&&(a.componentDidCatch(e,o||{}),c=a.__d),c)return a.__E=a}catch(l){e=l}throw e}},Vt=0,zn=function(e){return e!=null&&e.constructor===void 0},Ve.prototype.setState=function(e,n){var r;r=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=te({},this.state),typeof e=="function"&&(e=e(te({},r),this.props)),e&&te(r,e),e!=null&&this.__v&&(n&&this._sb.push(n),Bt(this))},Ve.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Bt(this))},Ve.prototype.render=C,ie=[],Jt=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Kt=function(e,n){return e.__v.__b-n.__v.__b},Qe.__r=0,pt=Math.random().toString(8),qe="__d"+pt,Ee="__a"+pt,Qt=/(PointerCapture)$|Capture$/i,ht=0,ft=zt(!1),mt=zt(!0),Vn=0;var xe,D,yt,rn,je=0,pn=[],L=S,on=L.__b,sn=L.__r,an=L.diffed,cn=L.__c,ln=L.unmount,dn=L.__;function Ye(e,n){L.__h&&L.__h(D,e,je||n),je=0;var r=D.__H||(D.__H={__:[],__h:[]});return e>=r.__.length&&r.__.push({}),r.__[e]}function g(e){return je=1,er(mn,e)}function er(e,n,r){var o=Ye(xe++,2);if(o.t=e,!o.__c&&(o.__=[r?r(n):mn(void 0,n),function(l){var d=o.__N?o.__N[0]:o.__[0],u=o.t(d,l);d!==u&&(o.__N=[u,o.__[1]],o.__c.setState({}))}],o.__c=D,!D.__f)){var a=function(l,d,u){if(!o.__c.__H)return!0;var f=o.__c.__H.__.filter(function(_){return _.__c});if(f.every(function(_){return!_.__N}))return!s||s.call(this,l,d,u);var p=o.__c.props!==l;return f.some(function(_){if(_.__N){var b=_.__[0];_.__=_.__N,_.__N=void 0,b!==_.__[0]&&(p=!0)}}),s&&s.call(this,l,d,u)||p};D.__f=!0;var s=D.shouldComponentUpdate,c=D.componentWillUpdate;D.componentWillUpdate=function(l,d,u){if(this.__e){var f=s;s=void 0,a(l,d,u),s=f}c&&c.call(this,l,d,u)},D.shouldComponentUpdate=a}return o.__N||o.__}function T(e,n){var r=Ye(xe++,3);!L.__s&&kt(r.__H,n)&&(r.__=e,r.u=n,D.__H.__h.push(r))}function fn(e,n){var r=Ye(xe++,4);!L.__s&&kt(r.__H,n)&&(r.__=e,r.u=n,D.__h.push(r))}function E(e){return je=5,Me(function(){return{current:e}},[])}function Me(e,n){var r=Ye(xe++,7);return kt(r.__H,n)&&(r.__=e(),r.__H=n,r.__h=e),r.__}function ne(e,n){return je=8,Me(function(){return e},n)}function tr(){for(var e;e=pn.shift();){var n=e.__H;if(e.__P&&n)try{n.__h.some(Ze),n.__h.some(wt),n.__h=[]}catch(r){n.__h=[],L.__e(r,e.__v)}}}L.__b=function(e){D=null,on&&on(e)},L.__=function(e,n){e&&n.__k&&n.__k.__m&&(e.__m=n.__k.__m),dn&&dn(e,n)},L.__r=function(e){sn&&sn(e),xe=0;var n=(D=e.__c).__H;n&&(yt===D?(n.__h=[],D.__h=[],n.__.some(function(r){r.__N&&(r.__=r.__N),r.u=r.__N=void 0})):(n.__h.some(Ze),n.__h.some(wt),n.__h=[],xe=0)),yt=D},L.diffed=function(e){an&&an(e);var n=e.__c;n&&n.__H&&(n.__H.__h.length&&(pn.push(n)!==1&&rn===L.requestAnimationFrame||((rn=L.requestAnimationFrame)||nr)(tr)),n.__H.__.some(function(r){r.u&&(r.__H=r.u),r.u=void 0})),yt=D=null},L.__c=function(e,n){n.some(function(r){try{r.__h.some(Ze),r.__h=r.__h.filter(function(o){return!o.__||wt(o)})}catch(o){n.some(function(a){a.__h&&(a.__h=[])}),n=[],L.__e(o,r.__v)}}),cn&&cn(e,n)},L.unmount=function(e){ln&&ln(e);var n,r=e.__c;r&&r.__H&&(r.__H.__.some(function(o){try{Ze(o)}catch(a){n=a}}),r.__H=void 0,n&&L.__e(n,r.__v))};var un=typeof requestAnimationFrame=="function";function nr(e){var n,r=function(){clearTimeout(o),un&&cancelAnimationFrame(n),setTimeout(e)},o=setTimeout(r,35);un&&(n=requestAnimationFrame(r))}function Ze(e){var n=D,r=e.__c;typeof r=="function"&&(e.__c=void 0,r()),D=n}function wt(e){var n=D;e.__c=e.__(),D=n}function kt(e,n){return!e||e.length!==n.length||n.some(function(r,o){return r!==e[o]})}function mn(e,n){return typeof n=="function"?n(e):n}var rr="/workbench/ui/api",V=class extends Error{constructor(r,o,a){super(r);this.status=o;this.code=a}status;code},et=new EventTarget;async function ce(e,n={}){let r=await fetch(`${rr}${e}`,{...n,credentials:"same-origin",headers:n.body?{"Content-Type":"application/json"}:void 0});if(r.ok)return await r.json();let o=r.statusText,a,s=await r.text();try{let c=JSON.parse(s);o=c.message||(typeof c.error=="string"?c.error:c.error?.message)||o,a=typeof c.code=="string"?c.code:typeof c.error=="string"?c.error:void 0}catch{o=s||o}throw r.status===401&&a==="login_required"&&et.dispatchEvent(new Event("required")),new V(o,r.status,a)}var G=(e,n)=>ce(e,{method:"POST",body:JSON.stringify(n)}),tt={status:()=>ce("/session"),login:e=>G("/session",{token:e}),logout:()=>ce("/session",{method:"DELETE"})},O={list(e,n=0,r=100){let o=new URLSearchParams({filter:e,offset:String(n),limit:String(r)});return ce(`/tasks?${o}`)},get:e=>ce(`/tasks/${encodeURIComponent(e)}`),dshSession:e=>ce(`/dsh/tasks/${encodeURIComponent(e)}`),chat:(e,n,r)=>{let o=new URLSearchParams({limit:String(r)});return n!==void 0&&o.set("before",String(n)),ce(`/tasks/${encodeURIComponent(e)}/chat?${o}`)},decide:(e,n,r)=>G(`/tasks/${encodeURIComponent(e)}/reviews/${encodeURIComponent(n)}/decisions`,r),refresh:e=>G(`/tasks/${encodeURIComponent(e)}/refresh`,{}),continueTask:(e,n)=>G(`/tasks/${encodeURIComponent(e)}/continue`,{prompt:n}),accept:e=>G(`/tasks/${encodeURIComponent(e)}/acceptance`,{}),answerProcessRequest:(e,n,r)=>G(`/tasks/${encodeURIComponent(e)}/process-requests/${encodeURIComponent(n)}/answers`,r),listAgents:()=>ce("/agents"),createAgent:e=>G("/agents",e),updateAgent:(e,n)=>G(`/agents/${encodeURIComponent(e)}/settings`,n),publishAgent:(e,n)=>G(`/agents/${encodeURIComponent(e)}/publish`,n),registerAgentPath:e=>G("/agents/register-path",e)};function nt(e,n="zh-CN"){let r=(l,d)=>n==="zh-CN"?l:d,o=e?.serviceInfo,a=o?.connectionAlias||e?.service,s=r("\u672A\u8BB0\u5F55","Not recorded");if(o?.kind==="gateway_workflow")s=r("ACP \u5185\u7F6E\u534F\u8C03\u5668","ACP built-in coordinator");else if(o?.kind==="a2a"||o?.kind==="activepieces"){let l=o.kind==="a2a"?"A2A":"Activepieces",d=o.locality==="loopback"?r("\u672C\u673A","Loopback"):o.host?.includes(":")&&!o.host.startsWith("[")?`[${o.host}]`:o.host;s=o.host&&d?`${l} \xB7 ${d}${o.port?`:${o.port}`:""}`:`${l} \xB7 ${r("\u7AEF\u70B9\u672A\u8BB0\u5F55","Endpoint not recorded")}`}let c={backend_run:r("\u6267\u884C\u56DE\u6267","Execution receipt"),target_snapshot:r("\u6D3E\u5355\u5FEB\u7167","Dispatch snapshot"),workflow_run:r("\u6D41\u7A0B\u8BB0\u5F55","Workflow record"),unrecorded:r("\u672A\u8BB0\u5F55","Not recorded")};return{service:s,serviceNote:a&&o?.kind!=="gateway_workflow"?r(`\u8FDE\u63A5\u522B\u540D ${a}`,`Connection alias ${a}`):void 0,serviceSource:o&&c[o.source]||c.unrecorded,connectionAlias:a}}function le(e,n="zh-CN"){let r=(d,u)=>n==="zh-CN"?d:u,o=r("\u672A\u8BB0\u5F55","Not recorded"),a={temporary:r("\u4E34\u65F6\u4EFB\u52A1","Temporary task"),resident:r("\u5E38\u9A7B\u89D2\u8272","Resident role"),workflow:r("\u5DE5\u4F5C\u6D41","Workflow"),unknown:o},s=e&&a[e.kind]||o,c=o,l;return e?.kind==="resident"||e?.kind==="workflow"?(c=e.targetName||e.roleId||o,e.kind==="resident"&&e.agentPreset&&(l=r(`\u9884\u8BBE ${e.agentPreset}`,`Preset ${e.agentPreset}`))):e?.agentPreset?c=e.agentPreset:e?.kind==="temporary"&&e.presetStatus==="host_default"&&(c=r("\u5BBF\u4E3B\u9ED8\u8BA4","Host default"),l=r("\u5B9E\u9645\u9884\u8BBE\u672A\u8BB0\u5F55","Effective preset not recorded")),{mode:s,role:c,roleNote:l,service:nt(e,n).service}}function gn(e){let n=/^#acp\/tasks(?:\/([^?]+))?(?:\?(.*))?$/.exec(e);if(!n)return null;try{let r=n[1]?decodeURIComponent(n[1]):void 0;if(r&&(r.length>512||/[\u0000-\u001f/]/.test(r)))return null;let o=new URLSearchParams(n[2]||""),a=o.get("review")||void 0;return a&&(a.length>512||/[\u0000-\u001f]/.test(a))?null:{jobId:r,reviewId:a,full:!!r&&o.get("mode")!=="drawer"}}catch{return null}}function rt(e){if(!e.jobId)return"#acp/tasks";let n=new URLSearchParams;return e.reviewId&&n.set("review",e.reviewId),e.full||n.set("mode","drawer"),`#acp/tasks/${encodeURIComponent(e.jobId)}${n.size?`?${n}`:""}`}function At(e){return[...e].sort((n,r)=>r.createdAt.localeCompare(n.createdAt))[0]}function hn(e){if(e)try{let n=new URL(e);return["https:","http:"].includes(n.protocol)&&!n.username&&!n.password?n.href:void 0}catch{return}}function vn(e,n){let r=new Map(n.map(c=>[c.jobId,c])),o=new Set([e.jobId]),a=e,s=0;for(;a.parentJobRef&&!o.has(a.parentJobRef.jobId);){let c=r.get(a.parentJobRef.jobId);if(!c)break;o.add(c.jobId),s++,a=c}return s}var or=0;function t(e,n,r,o,a,s){n||(n={});var c,l,d=n;if("ref"in d)for(l in d={},n)l=="ref"?c=n[l]:d[l]=n[l];var u={type:e,props:d,key:r,ref:c,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--or,__i:-1,__u:0,__source:a,__self:s};if(typeof e=="function"&&(c=e.defaultProps))for(l in c)d[l]===void 0&&(d[l]=c[l]);return S.vnode&&S.vnode(u),u}var H=navigator.language?.toLowerCase().startsWith("zh")?"zh-CN":"en",i=(e,n)=>H==="zh-CN"?e:n,It=e=>e instanceof Error?e.message:String(e),ge=e=>e.title||e.jobId,ot=e=>e==="trial"?i("\u8BD5\u8DD1","Trial"):e==="formal"?i("\u6B63\u5F0F","Formal"):i("\u4E34\u65F6","Temporary");function _n(){let e=()=>gn(location.hash)??{full:!1},[n,r]=g(e);return T(()=>{let o=()=>r(e());return window.addEventListener("hashchange",o),()=>window.removeEventListener("hashchange",o)},[]),n}function B(e){location.hash=rt(e)}function xt(e){let r={not_started:["\u672A\u5F00\u59CB","Not started"],submitted:["\u5DF2\u63D0\u4EA4","Submitted"],working:["\u8FDB\u884C\u4E2D","Working"],completed:["\u5DF2\u5B8C\u6210","Completed"],failed:["\u5931\u8D25","Failed"],canceled:["\u5DF2\u53D6\u6D88","Canceled"],rejected:["\u5DF2\u62D2\u7EDD","Rejected"],unknown:["\u5F85\u6838\u5B9E","Unknown"],input_required:["\u9700\u8981\u5904\u7406","Needs input"],auth_required:["\u9700\u8981\u8BA4\u8BC1","Needs authentication"],waiting_human:["\u5F85\u4EBA\u5DE5\u786E\u8BA4","Awaiting review"],awaiting_human:["\u5F85\u4EBA\u5DE5\u786E\u8BA4","Awaiting review"],pending:["\u5F85\u786E\u8BA4","Pending"],approved:["\u5DF2\u901A\u8FC7","Approved"],changes_requested:["\u8981\u6C42\u4FEE\u6539","Changes requested"],superseded:["\u5DF2\u88AB\u66FF\u4EE3","Superseded"],awaiting_validation:["\u7B49\u5F85\u6821\u9A8C","Awaiting validation"],processing:["\u6B63\u5728\u7EED\u8DD1","Resuming"],resuming:["\u7B49\u5F85\u7EED\u8DD1","Waiting to resume"],applied:["\u5DF2\u5904\u7406","Applied"],tool_blocked:["\u5DE5\u5177\u672A\u83B7\u6279\u51C6","Tool not approved"],unwatched:["\u53D1\u8D77\u65B9\u5DF2\u505C\u6B62\u7B49\u5F85","Caller stopped waiting"],accepted:["\u5DF2\u9A8C\u6536","Accepted"],acceptance_changes:["\u9A8C\u6536\u8981\u6C42\u4FEE\u6539","Acceptance: changes requested"]}[e];return r?i(...r):e}function bn(e){let r={"job.created":["\u4EFB\u52A1\u521B\u5EFA","Task created"],"job.migrated":["\u5386\u53F2\u4EFB\u52A1\u8FC1\u5165","Imported from earlier record"],"job.acceptance_recorded":["\u4E1A\u52A1\u9A8C\u6536\u5DF2\u8BB0\u5F55","Business acceptance recorded"],"attempt.prepared":["\u65B0\u4E00\u8F6E\u6267\u884C\u5DF2\u51C6\u5907","New attempt prepared"],"attempt.dispatching":["\u6B63\u5728\u6D3E\u53D1\u7ED9\u6267\u884C\u7AEF","Dispatching to the executor"],"attempt.accepted":["\u6267\u884C\u7AEF\u5DF2\u63A5\u6536\u4EFB\u52A1","Executor accepted the task"],"attempt.submission_failed":["\u6D3E\u53D1\u5931\u8D25","Dispatch failed"],"attempt.submission_unknown":["\u6D3E\u53D1\u7ED3\u679C\u5F85\u6838\u5B9E","Dispatch result needs verification"],"attempt.state_changed":["\u6267\u884C\u72B6\u6001\u53D8\u5316","Execution status changed"],"attempt.result_updated":["\u6267\u884C\u7ED3\u679C\u66F4\u65B0","Result updated"],"attempt.observation_conflict":["\u72B6\u6001\u89C2\u6D4B\u51B2\u7A81","Conflicting status observation"],"attempt.cancellation_requested":["\u5DF2\u8BF7\u6C42\u53D6\u6D88","Cancellation requested"],"human_review.comment":["\u4EBA\u5DE5\u5BA1\u6838\uFF1A\u5DF2\u7559\u8A00","Review: comment added"],"human_review.approve":["\u4EBA\u5DE5\u5BA1\u6838\uFF1A\u5DF2\u901A\u8FC7","Review: approved"],"human_review.changes_requested":["\u4EBA\u5DE5\u5BA1\u6838\uFF1A\u8981\u6C42\u4FEE\u6539","Review: changes requested"],"human_review.cancel":["\u4EBA\u5DE5\u5BA1\u6838\uFF1A\u5DF2\u53D6\u6D88\u4EFB\u52A1","Review: task canceled"],"process.opened":["\u8FC7\u7A0B\u8BF7\u6C42\uFF1A\u7B49\u5F85\u5904\u7406","Process request opened"],"process.answered":["\u8FC7\u7A0B\u8BF7\u6C42\uFF1A\u5DF2\u5904\u7406","Process request answered"],"process.expired":["\u8FC7\u7A0B\u8BF7\u6C42\uFF1A\u5DF2\u8FC7\u671F","Process request expired"]}[e];return r?i(...r):e}function yn(e){let n={research:["\u4E34\u65F6\u667A\u80FD\u4F53\u5206\u6790","Project analysis"],file_check:["\u62A5\u544A\u6587\u4EF6\u68C0\u67E5","Report file check"],summary:["\u6587\u7A3F\u751F\u6210","Writing"],project_script:["\u6587\u7A3F\u751F\u6210","Writing"],human_review:["\u4EBA\u5DE5\u5BA1\u6838","Human review"],human_resume:["\u7EED\u8DD1\u5904\u7406","Resuming workflow"],awaiting_human:["\u4EBA\u5DE5\u5BA1\u6838","Human review"],make:["\u8BBE\u8BA1\u5236\u4F5C","Production"],ppt_production:["\u8BBE\u8BA1\u5236\u4F5C","Production"],validate:["\u673A\u5668\u6821\u9A8C","Validation"],review:["\u72EC\u7ACB\u9A8C\u6536","Independent review"],independent_review:["\u72EC\u7ACB\u9A8C\u6536","Independent review"],finished:["\u4EA4\u4ED8\u5B8C\u6210","Delivered"],waiting_children:["\u7B49\u5F85\u6267\u884C\u7ED3\u679C","Waiting for execution"]};return n[e]?i(...n[e]):e}function Ct(e){return e.displayStatus||(e.pendingReviewId?"waiting_human":e.executionStatus)}function re({value:e}){return t("span",{class:`acp-status acp-status-${e.replace(/[^a-z_]/gi,"")}`,children:xt(e)})}function st(e){let n=Ct(e),r=e.businessAcceptance?.reviewStatus;return n!=="completed"?n:r==="accepted"?"accepted":r==="changes_requested"?"acceptance_changes":n}function J(e){if(!e)return"\u2014";let n=new Date(e);return Number.isNaN(n.getTime())?e:n.toLocaleString(H,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function Tt(e){if(e===void 0)return"\u2014";let n=Math.floor(e/6e4);return n<60?i(`${n} \u5206\u949F`,`${n} min`):i(`${Math.floor(n/60)} \u5C0F\u65F6 ${n%60} \u5206\u949F`,`${Math.floor(n/60)} h ${n%60} min`)}function sr(e){return e.replace(/```[^\n]*\n?/g," ").replace(/^\s*\|?[\s:|-]+\|[\s:|-]*$/gm," ").replace(/!?\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/^\s{0,3}(#{1,6}|>|[-*+]|\d+\.)\s+/gm,"").replace(/[|*_`~]/g," ")}function wn(e){let n=Array.from(sr(e||"").replace(/\s+/g," ").trim());return n.length>50?`${n.slice(0,49).join("")}\u2026`:n.join("")||"\u2014"}function De({execution:e}){let n=le(e,H);return t("span",{class:"acp-execution-role",title:[n.role,n.roleNote].filter(Boolean).join(" \xB7 "),children:[t("span",{children:n.role}),n.roleNote&&t("small",{children:n.roleNote})]})}function Ce({execution:e}){let n=nt(e,H);return t("span",{class:"acp-execution-service",title:[n.service,n.serviceNote].filter(Boolean).join(" \xB7 "),children:[t("span",{children:n.service}),n.serviceNote&&t("small",{children:n.serviceNote})]})}function Rt({execution:e}){let n=nt(e,H);return t(C,{children:[t("dt",{children:i("\u670D\u52A1\u6765\u6E90\u4F9D\u636E","Service evidence")}),t("dd",{children:n.serviceSource}),n.connectionAlias&&t(C,{children:[t("dt",{children:i("\u914D\u7F6E\u8FDE\u63A5\u522B\u540D","Configured connection alias")}),t("dd",{children:n.connectionAlias})]})]})}function at({title:e,description:n}){return t("div",{class:"acp-empty",children:[t("strong",{children:e}),n&&t("p",{children:n})]})}function Te({title:e,message:n,onRetry:r}){return t("div",{class:"acp-error",role:"alert",children:[t("strong",{children:e}),t("p",{children:n}),r&&t("button",{type:"button",class:"acp-button",onClick:r,children:i("\u91CD\u8BD5","Retry")})]})}var ar={developing:[],published:[]};function kn(e){if(e instanceof V){if(e.code==="conflict")return i("\u8FD9\u4E2A\u540D\u5B57\u5DF2\u7ECF\u5728\u7528","That name is already in use");if(e.code==="not_found")return i("\u627E\u4E0D\u5230\u8FD9\u4EFD\u5F00\u53D1\u8349\u7A3F","Draft not found");if(e.code==="invalid")return i("\u8BBE\u7F6E\u683C\u5F0F\u4E0D\u6B63\u786E\u3002\u9009\u9879\u5199\u6210 id=value\uFF0C\u6A21\u578B\u9879\u53EF\u4EE5\u5199\u6210 model:id=value","Settings are not valid. Write options as id=value")}return e instanceof Error?e.message:String(e)}function ir(e){return e==="trial"?i("\u8BD5\u8DD1","Trial"):e==="formal"?i("\u6B63\u5F0F","Formal"):i("\u4E34\u65F6","Temporary")}function An(e){return e.map(n=>`${n.model&&n.id!=="model"?"model:":""}${n.id}=${n.value}`).join(`
|
|
2
|
-
`)}function
|
|
3
|
-
`).map(n=>n.trim()).filter(Boolean).map(n=>{let r=!1,o=n;o.startsWith("model:")&&(r=!0,o=o.slice(6));let a=o.indexOf("="),s=a>0?o.slice(0,a).trim():"",c=a>0?o.slice(a+1).trim():"";if(!s||!c)throw new Error(i("\u6BCF\u4E00\u884C\u5199\u6210 id=value","Write each option as id=value"));return s==="model"&&(r=!0),{id:s,value:c,...r?{model:!0}:{}}})}function lr(e,n){return n==="developing"?e.developing:e.published}function xn({refreshKey:e,onOpenTask:n}){let[r,o]=g(0),[a,s]=g("developing"),[c,l]=g(ar),[d,u]=g([]),[f,p]=g(""),[_,b]=g(!1),[x,m]=g(!1),[I,w]=g(""),[y,P]=g("grok-build"),[j,h]=g("acp"),[N,U]=g("standard"),[K,$]=g(""),[q,_e]=g(""),[Re,Se]=g(!0),[X,Z]=g(""),[de,oe]=g(""),[ue,be]=g(!1),[ye,Y]=g(""),[M,se]=g("grok-build"),[pe,R]=g(""),[ae,W]=g(""),[we,ke]=g(""),[Ae,ee]=g(""),[fe,me]=g(""),[Oe,Ue]=g(!1);T(()=>{let v=!1;return Se(!0),(async()=>{try{let[F,Pe]=await Promise.all([O.listAgents(),O.list("all",0,100)]);if(v)return;l(F),u(Pe.items),Z("")}catch(F){v||Z(kn(F))}finally{v||Se(!1)}})(),()=>{v=!0}},[e,r]);let k=lr(c,a),z=c.connections??[],Q=q||z[0]?.connectionId||"",A=[...c.developing,...c.published].find(v=>v.agentId===f),qn=A?[A.agentId,A.modeId,A.targetId,A.roleId,A.acpAgent,An(A.options)].join("|"):"";T(()=>{A&&(Y(A.name),se(A.acpAgent||""),R(A.roleId||""),W(A.targetId||""),ke(A.modeId||""),ee(An(A.options)),me(A.releaseName||A.name),Ue(!1))},[qn]);let Ht=()=>({name:ye.trim(),acpAgent:M.trim(),...pe.trim()?{roleId:pe.trim()}:{},...ae.trim()?{targetId:ae.trim()}:{},...we.trim()?{modeId:we.trim()}:{},...Ae.trim()?{options:cr(Ae)}:{}}),He=async v=>{be(!0),oe(""),Z("");try{await v()}catch(F){Z(kn(F))}finally{be(!1)}};return t("div",{class:"acp-agent-module",children:[t("p",{class:"acp-agent-note",children:i("\u53D1\u5E03\u51BB\u7ED3\u7684\u662F\u5DE5\u4F5C\u53F0\u91CC\u7684\u4E00\u884C\u540D\u5B57\u3002\u6267\u884C\u5BBF\u4E3B\u4ECD\u6309\u8BE5\u5DE5\u4F5C\u533A\u548C ACP Agent \u6700\u8FD1\u4E00\u6B21\u5DF2\u63A5\u53D7\u7684 ACP \u8BBE\u7F6E\u56DE\u653E\uFF0C\u53D1\u5E03\u7ED3\u679C\u5199\u8FDB\u5BBF\u4E3B\u7F13\u5B58\u8FD8\u6CA1\u63A5\u4E0A\u3002\u5BA1\u6838\u901A\u8FC7\u4E0D\u4F1A\u4E0A\u7EBF\u3002","Publishing freezes a workbench name. The execution host still replays the last accepted ACP settings for that workspace and ACP agent. Syncing a release into the host cache is not connected. Approving a review does not publish.")}),t("nav",{class:"acp-workbench-views","aria-label":i("\u667A\u80FD\u4F53\u9636\u6BB5","Agent phase"),children:[t("button",{type:"button","aria-pressed":a==="developing",onClick:()=>s("developing"),children:[i("\u5F00\u53D1\u4E2D","In development"),t("span",{children:c.developing.length})]}),t("button",{type:"button","aria-pressed":a==="published",onClick:()=>s("published"),children:[i("\u5DF2\u4E0A\u7EBF","Published"),t("span",{children:c.published.length})]})]}),X&&t(Te,{title:i("\u667A\u80FD\u4F53\u8BFB\u53D6\u6216\u4FDD\u5B58\u5931\u8D25","Could not load or save agents"),message:X,onRetry:()=>o(v=>v+1)}),Re&&t("p",{class:"acp-muted",children:i("\u6B63\u5728\u8F7D\u5165\u2026","Loading\u2026")}),!Re&&!X&&!k.length&&!_&&!x&&t(at,{title:a==="developing"?i("\u8FD8\u6CA1\u6709\u5F00\u53D1\u4E2D\u7684\u667A\u80FD\u4F53","No agents in development"):i("\u8FD8\u6CA1\u6709\u5DF2\u4E0A\u7EBF\u7684\u540D\u5B57","No published names"),description:i("\u5E38\u9A7B\u89D2\u8272\u4F1A\u76F4\u63A5\u51FA\u73B0\u5728\u5DF2\u4E0A\u7EBF\u3002\u65B0\u7684\u8BD5\u8DD1\u4ECE\u5F00\u53D1\u4E2D\u7684\u8349\u7A3F\u5F00\u59CB\u3002","Resident roles appear under Published. A new trial starts from a developing draft.")}),t("div",{class:"acp-agent-layout",children:[t("div",{class:"acp-agent-list",children:[a==="developing"&&t(C,{children:[t("button",{type:"button",class:"acp-button",onClick:()=>{b(!0),m(!1),p(""),Y(""),se("grok-build"),R(""),W(""),ke(""),ee("")},children:i("\u65B0\u5EFA\u8349\u7A3F","New draft")}),t("button",{type:"button",class:"acp-button",onClick:()=>{m(!0),b(!1),p("")},children:i("\u6309\u8DEF\u5F84\u767B\u8BB0","Register a path")})]}),k.map(v=>t("button",{type:"button",class:`acp-agent-row${f===v.agentId?" is-selected":""}`,onClick:()=>{p(v.agentId),b(!1),m(!1)},children:[t("strong",{children:v.name}),t("small",{children:v.acpAgent||v.agentPreset||v.origin}),t("small",{children:[i("\u4EFB\u52A1","Tasks")," ",v.taskCount," \xB7 ",i("\u5F85\u786E\u8BA4","Waiting")," ",v.pendingCount]})]},v.agentId))]}),t("div",{class:"acp-agent-detail",children:[x&&t("form",{class:"acp-agent-form",onSubmit:v=>{v.preventDefault(),He(async()=>{let F=K.trim(),Pe=F.indexOf("/");if(j==="native"&&F&&Pe<=0)throw new Error(i("\u6A21\u578B\u5199\u6210 provider/model\uFF0C\u4F8B\u5982 minimax-cn/MiniMax-M3.1-Flash","Write the model as provider/model"));let We=await O.registerAgentPath({path:I.trim(),connectionId:Q,...j==="acp"?{acpAgent:y.trim()}:{agentPreset:N.trim(),...F?{provider:F.slice(0,Pe),model:F.slice(Pe+1)}:{}}});l(We),m(!1),s("developing"),p(We.registered[0]?.agentId??""),oe(i(`\u5DF2\u767B\u8BB0 ${We.registered.map(ut=>ut.name).join("\u3001")}\u3002\u6BCF\u4E2A\u90FD\u6709\u81EA\u5DF1\u7684\u6267\u884C\u76EE\u6807\uFF0C\u6D3E\u53D1\u65F6\u5BBF\u4E3B\u8BFB\u53D6 agent \u6587\u4EF6\u4F5C\u4E3A\u89D2\u8272\u8BF4\u660E\u3002`,`Registered ${We.registered.map(ut=>ut.name).join(", ")}. Each has its own target; the host reads the agent file as its role at dispatch.`))})},children:[t("h3",{children:i("\u6309\u8DEF\u5F84\u767B\u8BB0","Register a path")}),t("p",{class:"acp-muted",children:i("\u8BFB\u53D6\u8FD9\u4E2A\u76EE\u5F55\u4E0B\u7684 agents/*.md\uFF0C\u6BCF\u4E2A\u6587\u4EF6\u767B\u8BB0\u6210\u4E00\u4E2A\u5F00\u53D1\u4E2D\u7684\u667A\u80FD\u4F53\uFF0C\u540D\u5B57\u662F\u201C\u6587\u4EF6\u540D@\u8FD0\u884C\u65B9\u5F0F\u201D\uFF0C\u5DE5\u4F5C\u76EE\u5F55\u5C31\u662F\u8FD9\u4E2A\u76EE\u5F55\u3002\u540C\u4E00\u4E2A\u76EE\u5F55\u53EF\u4EE5\u5206\u522B\u767B\u8BB0 grok\u3001DSH \u539F\u751F\u7B49\u591A\u79CD\u8FD0\u884C\u65B9\u5F0F\uFF1B\u540C\u4E00\u79CD\u8FD0\u884C\u65B9\u5F0F\u518D\u767B\u8BB0\u4E00\u6B21\u4F1A\u66F4\u65B0\u539F\u6709\u8BB0\u5F55\u3002","Each agents/*.md under the directory becomes a developing agent named name@runtime that runs in that directory. One directory can be registered on several runtimes; registering the same runtime again updates its records.")}),t("label",{children:[i("\u76EE\u5F55\u8DEF\u5F84","Directory"),t("input",{value:I,placeholder:"/absolute/path/to/scenario",onInput:v=>w(v.currentTarget.value)})]}),t("label",{children:[i("\u8FD0\u884C\u65B9\u5F0F","Runtime"),t("select",{value:j,onChange:v=>h(v.currentTarget.value==="native"?"native":"acp"),children:[t("option",{value:"acp",children:i("ACP Agent","ACP agent")}),t("option",{value:"native",children:i("DSH \u539F\u751F\u9884\u8BBE","DSH-native preset")})]})]}),j==="acp"?t("label",{children:["ACP Agent",t("input",{value:y,placeholder:"grok-build",onInput:v=>P(v.currentTarget.value)})]}):t(C,{children:[t("label",{children:[i("\u9884\u8BBE","Preset"),t("input",{value:N,placeholder:"standard",onInput:v=>U(v.currentTarget.value)})]}),t("label",{children:[i("\u6A21\u578B\uFF08\u53EF\u9009\uFF09","Model (optional)"),t("input",{value:K,placeholder:"minimax-cn/MiniMax-M3.1-Flash",onInput:v=>$(v.currentTarget.value)})]})]}),t("label",{children:[i("\u6267\u884C\u8FDE\u63A5","Connection"),t("select",{value:Q,onChange:v=>_e(v.currentTarget.value),children:z.map(v=>t("option",{value:v.connectionId,children:[v.connectionId," \xB7 ",v.remote]},v.connectionId))})]}),t("button",{type:"submit",class:"acp-button",disabled:ue||!I.trim()||!Q||!(j==="acp"?y.trim():N.trim()),children:i("\u767B\u8BB0","Register")})]}),_&&t("form",{class:"acp-agent-form",onSubmit:v=>{v.preventDefault(),He(async()=>{let F=await O.createAgent(Ht());l(F),b(!1),p(F.draft.agentId),s("developing"),oe(i("\u8349\u7A3F\u5DF2\u4FDD\u5B58\u3002\u6D3E\u53D1\u4ECD\u4E0D\u4F1A\u8BFB\u53D6\u8FD9\u4EFD\u8349\u7A3F\uFF0C\u8981\u53D1\u5E03\u540E\u65B0\u4EFB\u52A1\u624D\u6302\u5230\u8FD9\u4E2A\u540D\u5B57\u3002","Draft saved. Dispatch does not read it until you publish, and new tasks then use that name."))})},children:[t("h3",{children:i("\u65B0\u5EFA\u5F00\u53D1\u8349\u7A3F","New developing draft")}),t(In,{name:ye,acpAgent:M,roleId:pe,targetId:ae,modeId:we,optionText:Ae,onName:Y,onAgent:se,onRole:R,onTarget:W,onMode:ke,onOptions:ee}),t("button",{type:"submit",class:"acp-button",disabled:ue||!ye.trim()||!M.trim(),children:i("\u4FDD\u5B58\u8349\u7A3F","Save draft")})]}),A&&!_&&!x&&t(C,{children:[t("h3",{children:A.name}),t("p",{class:"acp-muted",children:A.origin==="resident"?i("\u8FD9\u662F\u5DF2\u7ECF\u5728\u8DD1\u7684\u5E38\u9A7B\u89D2\u8272\uFF0C\u4E0D\u8981\u6C42\u5148\u8865\u4E00\u6B21\u8BD5\u8DD1\u3002","This resident role is already running. It does not require a prior trial."):A.origin==="release"?i("\u8FD9\u662F\u5DF2\u53D1\u5E03\u7684\u540D\u5B57\u3002\u4E4B\u540E\u518D\u6539 ACP \u8BBE\u7F6E\uFF0C\u53EA\u6539\u5F00\u53D1\u4E2D\u7684\u8349\u7A3F\u3002","This is a published name. Later ACP setting edits update the developing draft."):i("\u8FD9\u662F\u5F00\u53D1\u8349\u7A3F\u3002\u8BD5\u8DD1\u4EFB\u52A1\u4F1A\u6302\u5728\u8FD9\u91CC\u3002\u5BA1\u6838\u901A\u8FC7\u4E0D\u4F1A\u81EA\u52A8\u4E0A\u7EBF\u3002","This is a developing draft. Trial tasks attach here. A passed review does not publish it.")}),A.counterpartId&&t("button",{type:"button",class:"acp-link",onClick:()=>{let v=[...c.developing,...c.published].find(F=>F.agentId===A.counterpartId);v&&(s(v.phase),p(v.agentId))},children:A.phase==="developing"?i("\u67E5\u770B\u5DF2\u4E0A\u7EBF\u7684\u540D\u5B57","Open the published name"):i("\u67E5\u770B\u5F00\u53D1\u4E2D\u7684\u8349\u7A3F","Open the developing draft")}),t("dl",{class:"acp-agent-facts",children:[t("div",{children:[t("dt",{children:"ACP Agent"}),t("dd",{children:A.acpAgent||"\u2014"})]}),A.origin!=="resident"&&A.agentPreset&&t("div",{children:[t("dt",{children:i("\u9884\u8BBE","Preset")}),t("dd",{children:A.agentPreset})]}),A.provider&&t("div",{children:[t("dt",{children:i("\u6A21\u578B","Model")}),t("dd",{children:[A.provider,"/",A.model]})]}),t("div",{children:[t("dt",{children:i("\u6A21\u5F0F","Mode")}),t("dd",{children:A.modeId||"\u2014"})]}),t("div",{children:[t("dt",{children:i("\u6267\u884C\u76EE\u6807","Target")}),t("dd",{children:A.targetId||"\u2014"})]}),t("div",{children:[t("dt",{children:i("\u89D2\u8272","Role")}),t("dd",{children:A.roleId||"\u2014"})]}),A.source&&t("div",{children:[t("dt",{children:i("\u6765\u6E90","Source")}),t("dd",{children:A.source.file})]})]}),A.description&&t("p",{children:A.description}),A.options.length>0&&t("ul",{children:A.options.map(v=>t("li",{children:[v.id,"=",v.value]},v.id))}),t("h4",{children:i("\u540D\u4E0B\u4EFB\u52A1","Tasks")}),d.filter(v=>v.agentId===A.agentId).length===0&&t("p",{class:"acp-muted",children:i("\u8FD8\u6CA1\u6709\u6302\u5230\u8FD9\u6761\u8BB0\u5F55\u4E0A\u7684\u4EFB\u52A1\u3002","No tasks are attached to this record yet.")}),t("ul",{children:d.filter(v=>v.agentId===A.agentId).map(v=>t("li",{children:t("button",{type:"button",class:"acp-link",onClick:()=>n(v.jobId),children:[ir(v.channel)," \xB7 ",v.title||v.jobId]})},v.jobId))}),A.origin==="draft"&&t("form",{class:"acp-agent-form",onSubmit:v=>{v.preventDefault(),He(async()=>{let F=await O.updateAgent(A.agentId,Ht());l(F),oe(i("\u8349\u7A3F\u5DF2\u66F4\u65B0\u3002\u6B63\u5728\u8DD1\u7684\u53D1\u5E03\u540D\u5B57\u6CA1\u6709\u53D8\u3002","Draft updated. The published name stays as it was."))})},children:[t("h4",{children:i("\u4FEE\u6539\u8349\u7A3F","Edit draft")}),t(In,{name:ye,acpAgent:M,roleId:pe,targetId:ae,modeId:we,optionText:Ae,onName:Y,onAgent:se,onRole:R,onTarget:W,onMode:ke,onOptions:ee}),t("small",{children:i("\u9009\u9879\u7559\u7A7A\u8868\u793A\u4E0D\u4FEE\u6539\u3002\u6A21\u578B\u9879\u5199 model=\u503C\uFF0C\u6216 model:\u9009\u9879id=\u503C\u3002","Leave options blank to keep them. Write a model as model=value, or model:id=value.")}),t("button",{type:"submit",class:"acp-button",disabled:ue,children:i("\u4FDD\u5B58\u4FEE\u6539","Save changes")})]}),A.origin==="draft"&&t("form",{class:"acp-agent-form",onSubmit:v=>{v.preventDefault(),He(async()=>{let F=await O.publishAgent(A.agentId,{releaseName:fe.trim(),...Oe?{replace:!0}:{}});l(F),s("published"),p(`release:${fe.trim()}`),oe(i("\u540D\u5B57\u5DF2\u53D1\u5E03\u3002\u65B0\u7684\u6B63\u5F0F\u4EFB\u52A1\u4F1A\u6302\u5230\u8FD9\u4E2A\u540D\u5B57\u3002\u5BBF\u4E3B\u56DE\u653E\u4ECD\u7528\u8BE5\u5DE5\u4F5C\u533A\u6700\u8FD1\u4E00\u6B21 ACP \u8BBE\u7F6E\u3002","Name published. New formal tasks use it. Host replay still uses the latest ACP settings for that workspace."))})},children:[t("h4",{children:i("\u53D1\u5E03\u4E00\u884C\u540D\u5B57","Publish a name")}),t("label",{children:[i("\u540D\u5B57","Name"),t("input",{value:fe,onInput:v=>me(v.currentTarget.value)})]}),t("label",{children:[t("input",{type:"checkbox",checked:Oe,onChange:v=>Ue(v.currentTarget.checked)}),i("\u8986\u76D6\u540C\u540D\u7684\u5DF2\u53D1\u5E03\u8BB0\u5F55","Replace the published record with this name")]}),t("button",{type:"submit",class:"acp-button",disabled:ue||!fe.trim(),children:i("\u53D1\u5E03","Publish")})]}),de&&t("p",{children:de})]})]})]})]})}function In(e){return t(C,{children:[t("label",{children:[i("\u540D\u79F0","Name"),t("input",{value:e.name,onInput:n=>e.onName(n.currentTarget.value)})]}),t("label",{children:["ACP Agent",t("input",{value:e.acpAgent,placeholder:"grok-build",onInput:n=>e.onAgent(n.currentTarget.value)})]}),t("label",{children:[i("\u89D2\u8272 ID","Role ID"),t("input",{value:e.roleId,onInput:n=>e.onRole(n.currentTarget.value)})]}),t("label",{children:[i("\u6267\u884C\u76EE\u6807 ID","Target ID"),t("input",{value:e.targetId,onInput:n=>e.onTarget(n.currentTarget.value)})]}),t("label",{children:["modeId",t("input",{value:e.modeId,placeholder:"mode id",onInput:n=>e.onMode(n.currentTarget.value)})]}),t("label",{children:[i("ACP \u9009\u9879","ACP options"),t("textarea",{rows:4,value:e.optionText,placeholder:`model=grok-2
|
|
4
|
-
reasoningEffort=high`,onInput:n=>e.onOptions(n.currentTarget.value)})]})]})}function
|
|
5
|
-
`),
|
|
6
|
-
`),
|
|
7
|
-
`||
|
|
8
|
-
`&&
|
|
9
|
-
`).map(
|
|
10
|
-
`)){let
|
|
11
|
-
`)}var
|
|
12
|
-
`))),()=>{
|
|
13
|
-
`),[e]);return t("div",{class:"fp-code",role:"region","aria-label":"code",children:(o??c).map((d,u)=>t("div",{ref:r===u+1?s:void 0,class:`fp-code-row${r===u+1?" fp-code-target":""}`,children:[t("span",{class:"fp-code-no",children:u+1}),o?t("span",{class:"fp-code-text hljs",dangerouslySetInnerHTML:{__html:d||" "}}):t("span",{class:"fp-code-text",children:d||" "})]},u))})}function kr({text:e,delimiter:n}){let{rows:r,truncated:o}=Me(()=>Rn(e,n),[e,n]);if(!r.length)return null;let[a,...s]=r;return t("div",{class:"fp-table-wrap",children:[t("table",{class:"fp-table",children:[t("thead",{children:t("tr",{children:a.map((c,l)=>t("th",{children:c},l))})}),t("tbody",{children:s.map((c,l)=>t("tr",{children:c.map((d,u)=>t("td",{children:d},u))},l))})]}),o&&t("p",{class:"fp-note",children:`Showing the first ${r.length} rows`})]})}function Ar(e){try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}function ct(e){let[n,r]=g(!1);T(()=>r(!1),[e.url]);let o={...hr,...e.labels},a=Sn(e.name,e.mediaType),s=br(e.theme),c=e.url&&Lt(e.url)?e.url:void 0,l=_r(a,c,e.content,e.maxTextBytes??vr,e.fetcher),d;if(Pt(a))if(l.status==="error")d=t("p",{class:"fp-note fp-error",role:"alert",children:[l.message||o.noSource,l.message?` \xB7 ${o.failed}`:""]});else if(l.status!=="ready")d=t("p",{class:"fp-note",role:"status",children:o.loading});else if(!l.text.trim())d=t("p",{class:"fp-note",children:o.empty});else{let u=a==="json"?Ar(l.text):l.text;d=t(C,{children:[a==="markdown"?t(yr,{text:u,theme:s,options:e.markdown,onOpenLink:e.onOpenLink,diagrams:e.diagrams??!0}):a==="csv"?t(kr,{text:u,delimiter:e.name.toLowerCase().endsWith(".tsv")?" ":","}):t(wr,{text:u,lang:a==="json"?"json":a==="text"?void 0:it(e.name),targetLine:e.targetLine}),l.truncated&&t("p",{class:"fp-note",children:o.truncated})]})}else c?n&&(a==="image"||a==="video"||a==="audio")?d=t("p",{class:"fp-note fp-error",role:"alert",children:o.failed}):a==="image"?d=t("div",{class:"fp-media",children:t("img",{src:c,alt:e.name,loading:"lazy",onError:()=>r(!0)})}):a==="video"?d=t("div",{class:"fp-media",children:t("video",{src:c,controls:!0,preload:"metadata",onError:()=>r(!0)})}):a==="audio"?d=t("div",{class:"fp-media",children:t("audio",{src:c,controls:!0,preload:"metadata",onError:()=>r(!0)})}):a==="pdf"?d=t("iframe",{class:"fp-frame",src:c,title:e.name}):a==="html"?d=t("iframe",{class:"fp-frame",src:c,title:e.name,sandbox:"",referrerpolicy:"no-referrer"}):d=t("p",{class:"fp-note",children:o.unsupported}):d=t("p",{class:"fp-note",children:a==="unsupported"?o.unsupported:o.noSource});return t("section",{class:`fp-root${e.class?` ${e.class}`:""}`,"data-fp-theme":s,"data-fp-kind":a,children:[!e.hideHeader&&t("header",{class:"fp-header",children:[t("strong",{class:"fp-name",title:e.path||e.name,children:e.name}),e.size!==void 0&&t("span",{class:"fp-size",children:Pn(e.size)}),c&&t("a",{class:"fp-open",href:c,target:"_blank",rel:"noopener noreferrer",children:o.open})]}),t("div",{class:"fp-body",children:d})]})}function lt({text:e,theme:n,onOpenFile:r,streaming:o,diagrams:a=!0}){let[s,c]=g(""),l=E(null);return T(()=>{let d=!0;return he(e).then(u=>d&&c(u)).catch(()=>d&&c("")),()=>{d=!1}},[e]),T(()=>{a&&s&&!o&&l.current&&Le(l.current,n)},[s,o,n,a]),t("div",{ref:l,class:"fp-md cv-md",dangerouslySetInnerHTML:{__html:s},onClick:d=>{let u=d.target.closest("a")?.getAttribute("href");if(!u||/^(https?:|mailto:|#)/i.test(u)||!r)return;d.preventDefault();let f=/^(.*?)(?::(\d+))?$/.exec(decodeURIComponent(u.split("#")[0]));r(f?.[1]||u,f?.[2]?Number(f[2]):void 0)}})}var Ir={empty:"No messages yet",loading:"Loading messages\u2026",loadEarlier:"Load earlier messages",loadingEarlier:"Loading\u2026",retry:"Retry",thinking:"Thinking",input:"Input",output:"Output",showMore:"Show all",allowed:"Allowed",denied:"Denied",waiting:"Waiting for an answer",plan:"Plan",you:"You",agent:"Agent"},dt=4e3;function Ne({label:e,children:n,open:r}){return t("details",{class:"cv-fold",open:r,children:[t("summary",{children:e}),n]})}function $e({text:e,limit:n,labels:r}){let[o,a]=g(!1),s=!o&&e.length>n;return t(C,{children:[t("pre",{class:"cv-pre",children:s?e.slice(0,n):e}),s&&t("button",{type:"button",class:"cv-link",onClick:()=>a(!0),children:r.showMore})]})}function xr({path:e,oldText:n,newText:r,onOpenFile:o}){let a=Tn(n,r);return t("div",{class:"cv-diff",children:[t("button",{type:"button",class:"cv-link cv-diff-path",onClick:()=>o?.(e),children:e}),t("pre",{class:"cv-pre",children:a.map((s,c)=>t("div",{class:`cv-diff-${s.type}`,children:[s.type==="add"?"+ ":s.type==="del"?"- ":" ",s.text]},c))})]})}function Cr(e){return e.isError||e.status==="failed"?"failed":e.status==="pending"||e.status==="in_progress"||e.status===void 0&&e.output===void 0?"running":"done"}function Nt({call:e,labels:n,onOpenFile:r}){let o=Cr(e),a=e.output===void 0?void 0:Cn(e.output);return t("div",{class:`cv-tool cv-tool-${o}`,children:[t("div",{class:"cv-tool-head",children:[t("span",{class:"cv-dot","aria-hidden":"true"}),t("strong",{children:e.toolName}),e.kind&&t("span",{class:"cv-tag",children:e.kind}),e.locations?.map(s=>t("button",{type:"button",class:"cv-chip",onClick:()=>r?.(s.path,s.line),children:[s.path.split("/").pop(),s.line?`:${s.line}`:""]},`${s.path}:${s.line??""}`))]}),e.diffs?.map((s,c)=>t(xr,{...s,onOpenFile:r},c)),e.input&&e.input!=="{}"&&t(Ne,{label:n.input,children:t($e,{text:e.input,limit:dt,labels:n})}),a!==void 0&&a!==""&&t(Ne,{label:n.output,children:t($e,{text:a,limit:dt,labels:n})}),e.permission&&t("p",{class:"cv-note",children:e.permission.resolved==="allow"?n.allowed:e.permission.resolved==="deny"?n.denied:n.waiting})]})}function Tr({item:e,results:n,theme:r,labels:o,onOpenFile:a,diagrams:s}){switch(e.kind){case"user":return t("div",{class:"cv-row cv-user",children:t("div",{class:"cv-bubble",children:t($e,{text:e.content,limit:2e4,labels:o})})});case"assistant_text":return t("div",{class:"cv-row cv-agent",children:t(lt,{diagrams:s,text:e.content,theme:r,streaming:e.streaming,onOpenFile:a})});case"thinking":return t("div",{class:"cv-row",children:t(Ne,{label:o.thinking,children:t($e,{text:e.content,limit:dt,labels:o})})});case"tool_use":{let c=e.calls.length?e.calls:[{toolName:e.toolName,input:e.input,toolCallId:e.toolCallId}];return t("div",{class:"cv-row",children:c.map((l,d)=>{let u=l.output===void 0&&l.toolCallId?n.get(l.toolCallId):void 0,f=u?{...l,output:u.content,isError:u.isError}:l;return t(Nt,{call:f,labels:o,onOpenFile:a},l.id||l.toolCallId||d)})})}case"tool_result":return t("div",{class:"cv-row",children:t(Nt,{call:{toolName:e.toolName||"tool",input:"",output:e.content,isError:e.isError},labels:o,onOpenFile:a})});case"permission_request":return t("div",{class:"cv-row",children:t("div",{class:"cv-tool",children:[t("div",{class:"cv-tool-head",children:t("strong",{children:e.toolName})}),t("p",{class:"cv-note",children:e.resolved==="allow"?o.allowed:e.resolved==="deny"?o.denied:o.waiting})]})});case"ask_user_question":return t("div",{class:"cv-row",children:t("div",{class:"cv-tool",children:[e.questions.map((c,l)=>t("div",{children:[t("strong",{children:[c.header?`${c.header} \xB7 `:"",c.question]}),c.options&&t("ul",{class:"cv-options",children:c.options.map(d=>t("li",{children:[d.label,d.description?` \u2014 ${d.description}`:""]},d.label))})]},l)),e.resolved===void 0&&t("p",{class:"cv-note",children:o.waiting})]})});case"exit_plan_mode":return t("div",{class:"cv-row",children:t(Ne,{label:o.plan,open:!0,children:t(lt,{diagrams:s,text:e.planContent,theme:r,onOpenFile:a})})});case"error":return t("div",{class:"cv-row",children:t("p",{class:"cv-error",role:"alert",children:e.content})});case"turn_receipt":return t("div",{class:"cv-row",children:t("p",{class:`cv-receipt cv-receipt-${e.status}`,children:e.content})});case"subagent_turn":return t("div",{class:"cv-row",children:t(Ne,{label:e.label,children:[e.thinking&&t($e,{text:e.thinking,limit:dt,labels:o}),e.calls.map((c,l)=>t(Nt,{call:c,labels:o,onOpenFile:a},l)),e.output&&t(lt,{diagrams:s,text:e.output,theme:r,streaming:e.streaming,onOpenFile:a})]})});default:return null}}function $t(e){let n={...Ir,...e.labels},r=e.theme??(typeof matchMedia=="function"&&matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),o=E(null),a=E(null),s=E(!0),c=E({height:0,firstId:"",count:0}),l=new Map;for(let f of e.items)f.kind==="tool_result"&&f.toolCallId&&l.set(f.toolCallId,f);let d=new Set(e.items.flatMap(f=>f.kind==="tool_use"?f.calls.filter(p=>p.output===void 0&&p.toolCallId&&l.has(p.toolCallId)).map(p=>p.toolCallId):[])),u=e.items.filter(f=>!(f.kind==="tool_result"&&f.toolCallId&&d.has(f.toolCallId)));return fn(()=>{let f=o.current;if(!f)return;let p=c.current;p.firstId!==""&&e.items.length>p.count&&e.items[0]?.id!==p.firstId?f.scrollTop+=f.scrollHeight-p.height:(e.stickToBottom??!0)&&s.current&&(f.scrollTop=f.scrollHeight),c.current={height:f.scrollHeight,firstId:e.items[0]?.id??"",count:e.items.length}},[e.items]),T(()=>{let f=a.current,p=o.current;if(!f||!p||!e.hasMore||e.loadingMore||!e.onLoadMore||typeof IntersectionObserver>"u")return;let _=new IntersectionObserver(b=>{b.some(x=>x.isIntersecting)&&e.onLoadMore?.()},{root:p,rootMargin:"200px 0px 0px 0px"});return _.observe(f),()=>_.disconnect()},[e.hasMore,e.loadingMore,e.onLoadMore,e.items.length]),t("div",{ref:o,class:`cv-root${e.class?` ${e.class}`:""}`,"data-fp-theme":r,onScroll:f=>{let p=f.currentTarget;s.current=p.scrollHeight-p.scrollTop-p.clientHeight<80},children:[t("div",{ref:a}),e.hasMore&&t("button",{type:"button",class:"cv-more",disabled:e.loadingMore,onClick:e.onLoadMore,children:e.loadingMore?n.loadingEarlier:n.loadEarlier}),e.loading&&t("p",{class:"cv-note",role:"status",children:n.loading}),e.error&&t("p",{class:"cv-error",role:"alert",children:[e.error," ",e.onRetry&&t("button",{type:"button",class:"cv-link",onClick:e.onRetry,children:n.retry})]}),!e.loading&&!e.error&&u.length===0&&t("p",{class:"cv-note",children:n.empty}),u.map(f=>t(Tr,{item:f,results:l,theme:r,labels:n,onOpenFile:e.onOpenFile,diagrams:e.diagrams??!0},f.id))]})}function Ft(e,{pageSize:n=40,enabled:r=!0}={}){let[o,a]=g([]),[s,c]=g({loading:!1,loadingMore:!1,hasMore:!1,error:void 0}),l=E(void 0),d=E(),u=E(0),f=E(!1),p=ne(x=>{if(f.current)return;f.current=!0;let m=u.current;d.current=new AbortController,c(I=>({...I,error:void 0,loading:x,loadingMore:!x})),e(x?void 0:l.current,n,d.current.signal).then(I=>{m===u.current&&(l.current=I.nextCursor,a(w=>{if(x)return I.items;let y=new Set(w.map(P=>P.id));return[...I.items.filter(P=>!y.has(P.id)),...w]}),c({loading:!1,loadingMore:!1,hasMore:I.hasMore,error:void 0}))}).catch(I=>{m===u.current&&c(w=>({...w,loading:!1,loadingMore:!1,error:I instanceof Error?I.message:String(I)}))}).finally(()=>{m===u.current&&(f.current=!1)})},[e,n]),_=ne(()=>{u.current++,d.current?.abort(),f.current=!1,l.current=void 0,a([]),p(!0)},[p]);T(()=>{if(r)return _(),()=>{u.current++,d.current?.abort(),f.current=!1}},[r,_]);let b=ne(()=>{s.hasMore&&!f.current&&p(!1)},[s.hasMore,p]);return{items:o,...s,loadMore:b,reload:_}}var Nn=H==="zh-CN"?{loading:"\u6B63\u5728\u8BFB\u53D6\u2026",failed:"\u65E0\u6CD5\u8BFB\u53D6\u8BE5\u6587\u4EF6",open:"\u65B0\u7A97\u53E3\u6253\u5F00",unsupported:"\u6B64\u7C7B\u578B\u6587\u4EF6\u6682\u4E0D\u652F\u6301\u9884\u89C8",truncated:"\u6587\u4EF6\u8F83\u5927\uFF0C\u4EC5\u663E\u793A\u5F00\u5934\u90E8\u5206",noSource:"\u8BE5\u4EA7\u7269\u6CA1\u6709\u53EF\u8BFB\u53D6\u7684\u5730\u5740",empty:"\u7A7A\u6587\u4EF6"}:void 0,Rr=H==="zh-CN"?{empty:"\u6682\u65E0\u5BF9\u8BDD\u5185\u5BB9",loading:"\u6B63\u5728\u8BFB\u53D6\u5BF9\u8BDD\u2026",loadEarlier:"\u52A0\u8F7D\u66F4\u65E9\u7684\u5BF9\u8BDD",loadingEarlier:"\u52A0\u8F7D\u4E2D\u2026",retry:"\u91CD\u8BD5",thinking:"\u601D\u8003",input:"\u8F93\u5165",output:"\u8F93\u51FA",showMore:"\u663E\u793A\u5168\u90E8",allowed:"\u5DF2\u5141\u8BB8",denied:"\u5DF2\u62D2\u7EDD",waiting:"\u7B49\u5F85\u56DE\u7B54",plan:"\u8BA1\u5212",you:"\u4F60",agent:"\u667A\u80FD\u4F53"}:void 0;function $n(e,n){let r=hn(n.url);if(r)return r;if(!(!n.sha256||!/^[a-f0-9]{64}$/.test(n.sha256)))return new URL(`/workbench/ui/api/tasks/${encodeURIComponent(e)}/artifacts/${n.sha256}`,location.origin).href}function Fn(e,n){return e.path?.split("/").pop()||(n?decodeURIComponent(new URL(n).pathname.split("/").pop()||""):"")||i("\u4EA7\u7269","Artifact")}function On({jobId:e,artifact:n,active:r,onPreview:o}){let a=$n(e,n),s=Fn(n,a);return a?t("span",{class:"acp-artifact-row",children:[t("a",{href:a,target:"_blank",rel:"noopener noreferrer",children:s}),t("button",{type:"button",class:"acp-link","aria-pressed":r,onClick:()=>o(n),children:r?i("\u9884\u89C8\u4E2D","Previewing"):i("\u9884\u89C8","Preview")})]}):n.path?t("span",{class:"acp-muted",children:[s," \xB7 ",t("code",{children:n.path})]}):null}function Un({jobId:e,artifact:n,onClose:r}){let o=$n(e,n),a=Fn(n,o),s=E(null);return T(()=>{s.current?.focus({preventScroll:!0});let c=l=>{l.key==="Escape"&&(l.stopPropagation(),r())};return document.addEventListener("keydown",c,!0),()=>document.removeEventListener("keydown",c,!0)},[r]),t("section",{class:"acp-artifact-drawer",role:"dialog","aria-label":a,children:[t("header",{class:"acp-artifact-drawer-header",children:[t("div",{children:[t("strong",{children:a}),n.path&&t("small",{title:n.path,children:n.path})]}),o&&t("a",{class:"acp-button",href:o,target:"_blank",rel:"noopener noreferrer",children:i("\u65B0\u7A97\u53E3\u6253\u5F00","Open in new tab")}),t("button",{type:"button",class:"acp-button",ref:s,onClick:r,children:i("\u5173\u95ED","Close")})]}),t("div",{class:"acp-artifact-drawer-body",children:o?t(ct,{name:a,path:n.path,url:o,mediaType:n.mediaType,diagrams:!1,hideHeader:!0,labels:Nn},o):t("p",{class:"acp-muted",children:i("\u8BE5\u4EA7\u7269\u6CA1\u6709\u53EF\u8BFB\u53D6\u7684\u5730\u5740","This artifact has no readable address")})})]})}function Hn({markdown:e,path:n}){return t(ct,{name:n?.split("/").pop()||"report.md",path:n,content:e,diagrams:!1,hideHeader:!0,labels:Nn})}function Wn({jobId:e,onOpenFile:n}){let r=ne(async(a,s)=>{let c=await O.chat(e,a===void 0?void 0:Number(a),s);return{items:c.items,hasMore:c.hasMore,nextCursor:c.nextCursor}},[e]),o=Ft(r,{pageSize:40});return t("div",{class:"acp-chat",children:t($t,{items:o.items,loading:o.loading,loadingMore:o.loadingMore,hasMore:o.hasMore,error:o.error,onLoadMore:o.loadMore,onRetry:o.reload,diagrams:!1,labels:Rr,onOpenFile:n})})}function ve({source:e,class:n,onOpenFile:r}){let[o,a]=g("");return T(()=>{let s=!0;return he(e).then(c=>s&&a(c)).catch(()=>s&&a("")),()=>{s=!1}},[e]),o?t("div",{class:`fp-md acp-md${n?` ${n}`:""}`,dangerouslySetInnerHTML:{__html:o},onClick:s=>{let c=s.target.closest("a")?.getAttribute("href");!c||/^(https?:|mailto:|#)/i.test(c)||!r||(s.preventDefault(),r(decodeURIComponent(c.split("#")[0]).replace(/:\d+$/,"")))}}):t("p",{class:n,children:e})}var Sr=e=>({pending:i("\u5F85\u56DE\u7B54","Waiting"),answered:i("\u5DF2\u56DE\u7B54","Answered"),cancelled:i("\u5DF2\u53D6\u6D88","Cancelled"),expired:i("\u5DF2\u8FC7\u671F","Expired")})[e]||e;function Pr(e){if(e instanceof V){if(e.code==="expired")return i("\u8FD9\u5219\u8FC7\u7A0B\u8BF7\u6C42\u5DF2\u7ECF\u8FC7\u671F","This process request has expired");if(e.code==="already_decided")return i("\u8FD9\u5219\u8FC7\u7A0B\u8BF7\u6C42\u5DF2\u7ECF\u5904\u7406\u8FC7","This process request was already handled");if(e.code==="idempotency_conflict")return i("\u8FD9\u6B21\u63D0\u4EA4\u548C\u4E0A\u6B21\u8BB0\u5F55\u4E0D\u4E00\u81F4","This submit does not match the recorded answer")}return e instanceof Error?e.message:String(e)}function Er({question:e,value:n,onChange:r}){if(e.options?.length&&e.multiSelect){let o=Array.isArray(n)?n:[];return t("div",{children:e.options.map(a=>t("label",{children:[t("input",{type:"checkbox",checked:o.includes(a.label),onChange:s=>{let c=new Set(o);s.currentTarget.checked?c.add(a.label):c.delete(a.label),r([...c])}}),a.label,a.description&&t("small",{children:a.description})]},a.label))})}return e.options?.length?t("div",{children:e.options.map(o=>t("label",{children:[t("input",{type:"radio",name:e.id,checked:n===o.label,onChange:()=>r(o.label)}),o.label,o.description&&t("small",{children:o.description})]},o.label))}):t("textarea",{value:typeof n=="string"?n:"",onInput:o=>r(o.currentTarget.value)})}function Ot({jobId:e,requests:n,onReload:r}){let o=n??[],[a,s]=g({}),[c,l]=g({}),[d,u]=g(""),[f,p]=g(""),_=E({});if(!o.length)return null;let b=m=>(_.current[m]??=crypto.randomUUID(),_.current[m]),x=async(m,I,w,y=!1)=>{let P=I==="rejected"?c[m.requestId]?.trim():"";u(m.requestId),p("");try{await O.answerProcessRequest(e,m.requestId,{clientRequestId:b(m.requestId),outcome:I,...w?{answers:a[m.requestId]??{}}:{},...P?{note:P}:{},...y?{stopTask:!0}:{}}),r()}catch(j){p(Pr(j))}finally{u("")}};return t("section",{class:"acp-detail-section",children:[t("h3",{children:i("\u8FC7\u7A0B\u8BF7\u6C42","Process requests")}),f&&t("p",{class:"acp-muted",children:f}),o.map(m=>{let I=m.kind!=="question"||(m.questions??[]).every(w=>{let y=a[m.requestId]?.[w.question];return Array.isArray(y)?y.length>0:!!(y&&y.trim())});return t("article",{class:"acp-process-request",children:[t("strong",{children:m.kind==="plan"?i("\u8BA1\u5212\u5BA1\u6279","Plan approval"):m.kind==="permission"?i("\u5DE5\u5177\u5BA1\u6279","Tool approval"):i("\u63D0\u95EE","Question")}),t("small",{children:[i("\u622A\u6B62","Deadline")," ",new Date(m.deadlineAt).toLocaleString()]}),m.planContent&&t(ve,{source:m.planContent}),m.kind==="permission"&&t(C,{children:[t("p",{children:m.toolTitle}),m.toolDetail&&t("pre",{class:"acp-tool-detail",children:m.toolDetail})]}),m.questions?.map(w=>t(C,{children:[t("p",{children:[w.header?`${w.header} \xB7 `:"",w.question]}),m.canAnswer&&t(Er,{question:w,value:a[m.requestId]?.[w.question],onChange:y=>s(P=>({...P,[m.requestId]:{...P[m.requestId],[w.question]:y}}))})]},w.id)),m.canAnswer&&m.kind==="question"&&t("div",{class:"acp-agent-actions",children:[t("button",{type:"button",class:"acp-button",disabled:d===m.requestId||!I,onClick:()=>{x(m,"accepted",!0)},children:i("\u63D0\u4EA4\u56DE\u7B54","Submit answer")}),t("button",{type:"button",class:"acp-button",disabled:d===m.requestId,onClick:()=>{x(m,"cancelled",!1)},children:i("\u53D6\u6D88\u8FD9\u6B21\u63D0\u95EE","Cancel question")})]}),m.canAnswer&&m.kind!=="question"&&t("textarea",{class:"acp-reject-note",maxLength:2e3,placeholder:i("\u62D2\u7EDD\u7406\u7531\uFF08\u53EF\u9009\uFF09","Reason for rejecting (optional)"),value:c[m.requestId]??"",onInput:w=>{let y=w.currentTarget.value;l(P=>({...P,[m.requestId]:y}))}}),m.canAnswer&&m.kind==="plan"&&t("div",{class:"acp-agent-actions",children:[t("button",{type:"button",class:"acp-button",disabled:d===m.requestId,onClick:()=>{x(m,"approved",!1)},children:i("\u6279\u51C6\u8BA1\u5212","Approve plan")}),t("button",{type:"button",class:"acp-button",disabled:d===m.requestId,onClick:()=>{x(m,"rejected",!1)},children:i("\u9000\u56DE\u8BA1\u5212","Reject plan")}),t("button",{type:"button",class:"acp-button",disabled:d===m.requestId,onClick:()=>{x(m,"abandoned",!1)},children:i("\u653E\u5F03","Abandon")})]}),m.canAnswer&&m.kind==="permission"&&t("div",{class:"acp-agent-actions",children:[t("button",{type:"button",class:"acp-button acp-primary",disabled:d===m.requestId,onClick:()=>{x(m,"approved",!1)},children:i("\u5141\u8BB8\u672C\u6B21","Allow once")}),t("button",{type:"button",class:"acp-button",disabled:d===m.requestId,onClick:()=>{x(m,"rejected",!1)},children:i("\u62D2\u7EDD\u8FD9\u6B21\u8C03\u7528","Reject this call")}),t("button",{type:"button",class:"acp-button acp-danger",title:i("\u62D2\u7EDD\u5E76\u53D6\u6D88\u6574\u4E2A\u4EFB\u52A1\uFF0CAgent \u4E0D\u4F1A\u518D\u6362\u65B9\u5F0F\u91CD\u8BD5","Reject and cancel the task so the agent cannot retry another way"),disabled:d===m.requestId,onClick:()=>{x(m,"rejected",!1,!0)},children:i("\u62D2\u7EDD\u5E76\u505C\u6B62\u4EFB\u52A1","Reject and stop task")}),t("button",{type:"button",class:"acp-button",disabled:d===m.requestId,onClick:()=>{x(m,"cancelled",!1)},children:i("\u53D6\u6D88","Cancel")})]}),!m.canAnswer&&t("small",{children:[Sr(m.status),m.kind==="permission"&&m.answer?.outcome==="approved"&&` \xB7 ${i("\u5DF2\u5141\u8BB8","Allowed")}`,m.kind==="permission"&&m.answer?.outcome==="rejected"&&` \xB7 ${m.answer.stopTask?i("\u5DF2\u62D2\u7EDD\u5E76\u505C\u6B62\u4EFB\u52A1","Rejected and stopped the task"):i("\u5DF2\u62D2\u7EDD","Rejected")}`,m.answer?.decidedBy?.kind==="coach"&&` \xB7 ${i("\u6559\u7EC3\u51B3\u5B9A","Decided by the coach")}`,m.answer?.note&&` \xB7 ${m.answer.note}`]})]},m.requestId)})]})}var Fe=e=>e instanceof Error?e.message:String(e),jr="\u4E0A\u4E00\u8F6E\u6267\u884C\u4E2D\u65AD\u4E86\uFF0C\u5DF2\u7ECF\u5B8C\u6210\u7684\u4E0D\u7528\u91CD\u505A\uFF0C\u8BF7\u63A5\u7740\u628A\u4EFB\u52A1\u505A\u5B8C\u3002",Mr=window.parent!==window;function Dr({detail:e}){let n=e.attempts.find(c=>c.attemptId===e.currentAttemptId)?.backendRunRef?.taskId,[r,o]=g(null);T(()=>{if(o(null),!Mr||!n)return;let c=!0;return O.dshSession(n).then(l=>c&&o(l),()=>c&&o(null)),()=>{c=!1}},[n,e.executionStatus]);let a=r?.available?r.sessionId:void 0;if(!a)return null;let s=r.task?.running===!0;return t("button",{type:"button",class:"acp-button acp-primary",disabled:s,title:s?i("A2A \u4EFB\u52A1\u4ECD\u5728\u6267\u884C\uFF0C\u7ED3\u675F\u540E\u53EF\u63A5\u7BA1","The A2A task is still running; take over once it ends"):i("\u5728 DSH \u4F1A\u8BDD\u4E2D\u7EE7\u7EED\u5904\u7406\uFF1B\u6EE1\u610F\u540E\u8BA9\u667A\u80FD\u4F53\u8C03\u7528 submit_to_review \u63D0\u4EA4\u56DE\u5DE5\u4F5C\u6D41","Continue in the DSH session; when satisfied, have the agent call submit_to_review"),onClick:()=>window.parent.postMessage({type:"1agents:open-session",sessionId:a},location.origin),children:s?i("\u6267\u884C\u4E2D\u2026","Running\u2026"):i("\u5728 DSH \u4E2D\u63A5\u7BA1","Take over in DSH")})}function Lr({execution:e}){let n=le(e,H);return t("small",{class:"acp-execution-caption",children:[t("span",{children:[n.mode," \xB7 ",n.role]}),t("span",{children:t(Ce,{execution:e})})]})}function Nr({execution:e}){let n=le(e,H);return t(C,{children:[t("span",{children:[i("\u4EFB\u52A1\u65B9\u5F0F","Task mode"),t("strong",{children:n.mode})]}),t("span",{children:[i("\u89D2\u8272\u6216\u9884\u8BBE","Role / preset"),t("strong",{children:t(De,{execution:e})})]}),t("span",{children:[i("\u6267\u884C\u670D\u52A1","Execution service"),t("strong",{children:t(Ce,{execution:e})})]})]})}function Bn({jobId:e,requestedReviewId:n,full:r,onChanged:o}){let[a,s]=g(null),[c,l]=g(""),[d,u]=g(!1),[f,p]=g(!0),[_,b]=g(n?"review":"overview"),[x,m]=g(n),[I,w]=g(""),[y,P]=g(!1),[j,h]=g(""),[N,U]=g(""),[K,$]=g(!1),[q,_e]=g(),[Re,Se]=g(!1),[X,Z]=g(null),[de,oe]=g(!1),[ue,be]=g(""),ye=ne(()=>_e(void 0),[]),Y=E(null),M=E(!0),se=E(!1),pe=E(null),R=a?.reviews.find(k=>k.reviewId===x),ae=At(a?.reviews||[]),W=ne(async()=>{if(!se.current){se.current=!0;try{let k=await O.get(e);if(!M.current)return;s(k),l(""),m(z=>z||n||k.pendingReviewId||At(k.reviews)?.reviewId)}catch(k){M.current&&l(Fe(k))}finally{M.current&&(p(!1),se.current=!1)}}},[e]),we=async()=>{Se(!0);try{let k=await O.refresh(e);if(!M.current)return;s(k),l(""),o()}catch(k){M.current&&l(Fe(k))}finally{M.current&&Se(!1)}},ke=async()=>{u(!0),l("");try{let k=await O.accept(e);if(!M.current)return;s(k),o()}catch(k){M.current&&l(Fe(k))}finally{M.current&&u(!1)}},Ae=async()=>{oe(!0),be("");try{let k=await O.continueTask(e,X??"");if(!M.current)return;s(k),Z(null),o()}catch(k){M.current&&be(Fe(k))}finally{M.current&&oe(!1)}};T(()=>{M.current=!0,W();let k=window.setInterval(()=>{document.hidden||W()},5e3);return()=>{M.current=!1,window.clearInterval(k)}},[W]),T(()=>{n&&(m(n),b("review"),U(""),w(""))},[n]),T(()=>{a&&pe.current?.focus()},[!!a]),T(()=>_e(void 0),[e]);let ee=k=>{m(k),b("review"),U(""),h(""),w(""),B({jobId:e,reviewId:k,full:r})},fe=k=>{let z=(a?.artifacts||[]).flatMap(Q=>Q.artifacts).find(Q=>typeof Q=="object"&&Q.path===k);z&&_e(z)},me=async k=>{if(!R||y||R.status!=="pending"||!R.canReview)return;if((k==="changes_requested"||k==="comment")&&!I.trim()){U(i("\u8BF7\u586B\u5199\u5177\u4F53\u610F\u89C1\u3002","Please enter feedback."));return}let z=JSON.stringify([R.reviewId,R.revision,R.digest,k,I.trim()]);Y.current?.key!==z&&(Y.current={key:z,id:crypto.randomUUID()});let Q={action:k,revision:R.revision,digest:R.digest,clientRequestId:Y.current.id,...I.trim()?{note:I.trim()}:{}};P(!0),U(""),h("");try{if(await O.decide(R.jobId||e,R.reviewId,Q),!M.current)return;w(""),$(!1),Y.current=null,h(k==="comment"?i("\u8BC4\u8BBA\u5DF2\u4FDD\u5B58\uFF0C\u5BA1\u6838\u4ECD\u5F85\u786E\u8BA4\u3002","Comment saved. Review remains pending."):i("\u51B3\u5B9A\u5DF2\u4FDD\u5B58\uFF0C\u6B63\u5728\u540C\u6B65\u4EFB\u52A1\u8FDB\u5C55\u3002","Decision saved. Synchronizing task progress.")),await W(),o()}catch(A){if(!M.current)return;U(A instanceof V&&A.status===403&&/browser_review_required|same.origin|browser/i.test(A.message)?i("\u5F53\u524D\u8FDE\u63A5\u4E0D\u80FD\u63D0\u4EA4\u4EBA\u5DE5\u51B3\u5B9A\u3002\u8BF7\u5728\u4EFB\u52A1\u6240\u5728\u8282\u70B9\u7684 Web \u9875\u9762\u767B\u5F55\u540E\u5904\u7406\u5BA1\u6838\u3002","This connection cannot submit human decisions. Open the node\u2019s web page and sign in to review."):A instanceof V&&A.status===409?i("\u7248\u672C\u6216\u5BA1\u6838\u72B6\u6001\u5DF2\u7ECF\u53D8\u5316\u3002\u8BF7\u6838\u5BF9\u5F53\u524D\u72B6\u6001\uFF1B\u65E7\u7248\u672C\u7684\u51B3\u5B9A\u4E0D\u4F1A\u653E\u884C\u65B0\u7248\u3002","The version or review state changed. Check the latest state before deciding."):Fe(A)),A instanceof V&&A.status===409&&await W()}finally{M.current&&P(!1)}},Oe=async()=>{let k=new URL(window.location.href);k.hash=rt({jobId:e,reviewId:_==="review"?x:void 0,full:!0});try{await navigator.clipboard.writeText(k.href),h(i("\u4EFB\u52A1\u94FE\u63A5\u5DF2\u590D\u5236","Task link copied"))}catch{h(i("\u65E0\u6CD5\u590D\u5236\u94FE\u63A5\uFF0C\u53EF\u590D\u5236\u5730\u5740\u680F\u94FE\u63A5","Could not copy. Copy the address bar URL."))}},Ue=[["overview",i("\u6982\u89C8","Overview")],["progress",i("\u8FDB\u5C55","Progress")],["review",i("\u4EA7\u7269\u4E0E\u5BA1\u6838","Artifacts & review")],["chat",i("\u5BF9\u8BDD","Conversation")],["events",i("\u4E8B\u4EF6\u8BB0\u5F55","Events")]];return t("aside",{class:"acp-detail","aria-label":i("\u4EFB\u52A1\u8BE6\u60C5","Task details"),children:[t("header",{class:"acp-detail-header",children:[t("div",{class:"acp-detail-tools",children:[t("span",{children:i("\u4EFB\u52A1\u8BE6\u60C5","Task details")}),t("div",{children:[a&&t(Dr,{detail:a}),a&&(a.displayStatus==="unwatched"||a.stale)&&t("button",{type:"button",class:"acp-button",disabled:Re,onClick:we,children:Re?i("\u6B63\u5728\u67E5\u8BE2\u2026","Querying\u2026"):i("\u91CD\u65B0\u67E5\u8BE2","Query again")}),a?.canAccept&&t("button",{type:"button",class:"acp-button acp-primary",disabled:d,onClick:()=>{ke()},children:i("\u5DF2\u9605","Mark as read")}),a?.canContinue&&X===null&&t("button",{type:"button",class:"acp-button acp-primary",onClick:()=>{be(""),Z(jr)},children:i("\u7EE7\u7EED","Continue")}),t("button",{type:"button",class:"acp-button",onClick:Oe,children:i("\u590D\u5236\u94FE\u63A5","Copy link")}),t("button",{type:"button",class:"acp-button",onClick:()=>B({jobId:e,reviewId:n,full:!r}),children:r?i("\u8FD4\u56DE\u8868\u683C","Back to table"):i("\u5C55\u5F00\u6574\u9875","Full page")}),t("button",{type:"button",class:"acp-button",onClick:()=>B({full:!1}),children:i("\u5173\u95ED","Close")})]})]}),t("div",{class:"acp-breadcrumb",children:[a?.ancestors?.map(k=>t(C,{children:[t("button",{type:"button",class:"acp-link",onClick:()=>B({jobId:k.jobId,full:r}),children:ge(k)}),t("span",{children:"\u203A"})]},k.jobId)),t("span",{children:e})]}),t("h2",{ref:pe,tabIndex:-1,children:a?ge(a):i("\u6B63\u5728\u8BFB\u53D6\u4EFB\u52A1\u2026","Loading task\u2026")}),a&&t("p",{class:"acp-channel-line",children:[t(re,{value:st(a)}),t("span",{class:"acp-mode-label",children:ot(a.channel)}),a.agentName&&t("span",{children:a.agentName}),a.stale&&t("span",{class:"acp-stale",children:i("\u5F53\u524D\u4E3A\u7F13\u5B58\u72B6\u6001\uFF0C\u7B49\u5F85\u540C\u6B65","Cached status; awaiting synchronization")})]}),a?.pendingProcessRequestId&&_!=="overview"&&t("button",{type:"button",class:"acp-link",onClick:()=>b("overview"),children:i("\u6709\u8FC7\u7A0B\u8BF7\u6C42\u5F85\u56DE\u7B54","A process request is waiting")})]}),t("nav",{class:"acp-detail-tabs","aria-label":i("\u4EFB\u52A1\u8BE6\u60C5\u89C6\u56FE","Task detail views"),role:"tablist",children:Ue.map(([k,z])=>t("button",{id:`acp-detail-tab-${k}`,type:"button",role:"tab","aria-selected":_===k,"aria-controls":"acp-detail-content",onClick:()=>b(k),children:z},k))}),t("div",{class:"acp-detail-content",id:"acp-detail-content",role:"tabpanel","aria-labelledby":`acp-detail-tab-${_}`,children:[c&&t(Te,{title:i("\u4EFB\u52A1\u8BE6\u60C5\u8BFB\u53D6\u5931\u8D25","Could not load task details"),message:c,onRetry:()=>{W()}}),f&&t("p",{class:"acp-muted",children:i("\u6B63\u5728\u8F7D\u5165\u2026","Loading\u2026")}),a?.canContinue&&X!==null&&t("div",{class:"acp-review-form",children:[t("label",{htmlFor:"acp-continue-prompt",children:i("\u5728\u539F\u4F1A\u8BDD\u91CC\u65B0\u5F00\u4E00\u8F6E\uFF0C\u53D1\u7ED9\u6267\u884C\u8005\u7684\u8BDD","Message for a new round in the same session")}),t("textarea",{id:"acp-continue-prompt",value:X,disabled:de,onInput:k=>Z(k.currentTarget.value)}),ue&&t("p",{role:"alert",class:"acp-decision-error",children:ue}),t("div",{class:"acp-review-buttons",children:[t("button",{type:"button",class:"acp-button acp-primary",disabled:de||!X.trim(),onClick:()=>{Ae()},children:de?i("\u6B63\u5728\u63D0\u4EA4\u2026","Submitting\u2026"):i("\u63D0\u4EA4\u5E76\u7EE7\u7EED","Submit and continue")}),t("button",{type:"button",class:"acp-link",disabled:de,onClick:()=>Z(null),children:i("\u53D6\u6D88","Cancel")})]})]}),a&&t(C,{children:[_==="overview"&&t(Fr,{detail:a,onReview:k=>ee(k),onReload:()=>{W()},onOpenFile:fe}),_==="progress"&&t(Or,{detail:a,onReview:k=>ee(k),onReload:()=>{W()},full:r}),_==="review"&&t(C,{children:[t(Hr,{detail:a,review:R,requestedReviewId:x,onSelect:ee,previewing:q,onPreview:_e}),R&&t(C,{children:[ae&&ae.reviewId!==R.reviewId&&t("div",{class:"acp-notice",children:[i("\u6B63\u5728\u67E5\u770B\u5386\u53F2\u7248\u672C\u3002","Viewing a historical version.")," ",t("button",{type:"button",class:"acp-link",onClick:()=>ee(ae.reviewId),children:i("\u67E5\u770B\u6700\u65B0\u7248\u672C \u2192","View latest version \u2192")})]}),R.status==="approved"&&!["completed","failed","canceled","rejected"].includes(a.executionStatus)&&R.resumeStatus==="pending"&&t("div",{class:"acp-notice",role:"status",children:i("\u672C\u7248\u5DF2\u901A\u8FC7\uFF0C\u7B49\u5F85\u7CFB\u7EDF\u7EE7\u7EED\u5904\u7406\u3002","This version is approved. Waiting for the workflow to resume.")}),R.resumeError&&t("p",{role:"alert",class:"acp-decision-error",children:R.resumeError}),t(Wr,{review:R}),R.status==="pending"&&R.canReview&&t("div",{class:"acp-review-form",children:[t("label",{htmlFor:"acp-review-feedback",children:i("\u5BA1\u6838\u610F\u89C1","Review feedback")}),t("textarea",{id:"acp-review-feedback",value:I,disabled:y,onInput:k=>w(k.currentTarget.value),placeholder:i("\u53EF\u6CE8\u660E\u5177\u4F53\u9875\u7801\uFF1B\u8981\u6C42\u4FEE\u6539\u65F6\u8BF7\u586B\u5199\u610F\u89C1\u3002","Reference page numbers. Feedback is required when requesting changes.")}),t("div",{class:"acp-review-buttons",children:[t("button",{type:"button",class:"acp-link",disabled:y,onClick:()=>{me("comment")},children:i("\u53D1\u8868\u8BC4\u8BBA","Comment")}),t("button",{type:"button",class:"acp-button",disabled:y,onClick:()=>B({full:!1}),children:i("\u7A0D\u540E\u5904\u7406","Later")}),t("button",{type:"button",class:"acp-button",disabled:y,onClick:()=>{me("changes_requested")},children:i("\u8981\u6C42\u4FEE\u6539","Request changes")}),t("button",{type:"button",class:"acp-button acp-primary",disabled:y,onClick:()=>{me("approve")},children:y?i("\u6B63\u5728\u63D0\u4EA4\u2026","Submitting\u2026"):i(`\u901A\u8FC7 ${R.revision}`,`Approve ${R.revision}`)})]}),t("details",{class:"acp-more-actions",children:[t("summary",{children:i("\u66F4\u591A\u64CD\u4F5C","More actions")}),K?t("div",{class:"acp-cancel-confirm",children:[t("p",{children:i("\u653E\u5F03\u5C06\u7EC8\u6B62\u5F53\u524D\u5DE5\u4F5C\u6D41\uFF0C\u5DF2\u6709\u4EA7\u7269\u4E0E\u5386\u53F2\u4FDD\u7559\u3002","Abandoning ends this workflow and retains existing artifacts and history.")}),t("button",{type:"button",class:"acp-button",disabled:y,onClick:()=>$(!1),children:i("\u7EE7\u7EED\u4FDD\u7559","Keep task")}),t("button",{type:"button",class:"acp-button acp-danger",disabled:y,onClick:()=>{me("cancel")},children:i("\u786E\u8BA4\u653E\u5F03\u4EFB\u52A1","Confirm abandon")})]}):t("button",{type:"button",class:"acp-link",onClick:()=>$(!0),children:i("\u653E\u5F03\u4EFB\u52A1","Abandon task")})]})]}),R.status==="pending"&&!R.canReview&&t("p",{class:"acp-muted",children:i("\u6B64\u5BA1\u6838\u672A\u5206\u914D\u7ED9\u5F53\u524D\u7528\u6237\u3002","This review is not assigned to the current user.")})]}),j&&t("p",{class:"acp-decision-message",role:"status",children:j}),N&&t("p",{class:"acp-decision-error",role:"alert",children:N})]}),_==="chat"&&t(Wn,{jobId:e,onOpenFile:fe}),_==="events"&&t(C,{children:[t(Ur,{detail:a}),t(Br,{detail:a})]})]})]}),q&&t(Un,{jobId:e,artifact:q,onClose:ye})]})}function $r({detail:e}){let n=e.businessAcceptance;return n?t("section",{class:"acp-detail-section",children:[t("h3",{children:i("\u4E1A\u52A1\u9A8C\u6536","Business acceptance")}),t("dl",{class:"acp-acceptance-record",children:[t("dt",{children:i("\u7ED3\u679C\u7248\u672C","Result revision")}),t("dd",{children:n.resultRevision}),t("dt",{children:i("\u8BB0\u5F55\u65F6\u95F4","Recorded")}),t("dd",{children:J(n.recordedAt)}),n.decidedBy&&t(C,{children:[t("dt",{children:i("\u5904\u7406\u4EBA","Decided by")}),t("dd",{children:n.decidedBy.kind==="coach"?i("\u6559\u7EC3","Coach"):i("\u4EBA","Person")})]}),n.note&&t(C,{children:[t("dt",{children:i("\u8BF4\u660E","Note")}),t("dd",{children:n.note})]})]})]}):null}function Fr({detail:e,onReview:n,onReload:r,onOpenFile:o}){let s=e.attempts.find(c=>c.attemptId===e.currentAttemptId)?.result?.resultSummary;return t(C,{children:[t(Ot,{jobId:e.jobId,requests:e.processRequests?.filter(c=>c.status==="pending"),onReload:r}),e.executionStatus==="completed"&&t($r,{detail:e}),e.pendingReviewId&&t("p",{class:"acp-notice",children:[i("\u6709\u4EA7\u7269\u7B49\u5F85\u4F60\u5BA1\u6838\u3002","An artifact is waiting for your review.")," ",t("button",{type:"button",class:"acp-link",onClick:()=>n(e.pendingReviewId),children:i("\u53BB\u5BA1\u6838","Review")})]}),e.description&&t("section",{class:"acp-detail-section",children:[t("h3",{children:i("\u4EFB\u52A1\u63CF\u8FF0","Task description")}),t(ve,{source:e.description,onOpenFile:o})]}),s?t("section",{class:"acp-detail-section",children:[t("h3",{children:i("\u6700\u65B0\u56DE\u7B54","Latest answer")}),t(ve,{source:s,onOpenFile:o})]}):e.progressSummary&&t("section",{class:"acp-detail-section",children:[t("h3",{children:i("\u5F53\u524D\u8FDB\u5C55","Current progress")}),t(ve,{source:e.progressSummary,onOpenFile:o})]}),t("div",{class:"acp-task-facts",children:[t("span",{children:[i("\u521B\u5EFA","Created"),t("strong",{children:J(e.createdAt)})]}),t("span",{children:[i("\u6700\u8FD1\u66F4\u65B0","Last updated"),t("strong",{children:J(e.updatedAt)})]}),e.progress?.executionElapsedMs!==void 0&&t("span",{children:[i("\u5B9E\u9645\u6267\u884C","Execution time"),t("strong",{children:Tt(e.progress.executionElapsedMs)})]}),e.progress?.humanWaitingMs!==void 0&&t("span",{children:[i("\u4EBA\u5DE5\u7B49\u5F85","Human wait"),t("strong",{children:Tt(e.progress.humanWaitingMs)})]})]})]})}function Or({detail:e,onReview:n,onReload:r,full:o}){let a=e.progress?.stages||[];return t(C,{children:[t(Ot,{jobId:e.jobId,requests:e.processRequests?.filter(s=>s.status!=="pending"),onReload:r}),a.length>0&&t("section",{class:"acp-detail-section",children:[t("h3",{children:i("\u9636\u6BB5\u8FDB\u5C55","Stage progress")}),t("ol",{class:"acp-stage-list",children:a.map(s=>t("li",{children:[t("span",{class:`acp-stage-dot acp-stage-dot-${s.status}`,"aria-hidden":"true",children:s.status==="completed"||s.status==="approved"?"\u2713":"\u2022"}),t("div",{children:[t("strong",{children:s.name}),t("small",{children:s.planned?i("\u8BA1\u5212\u9636\u6BB5 \xB7 \u5C1A\u672A\u521B\u5EFA\u6267\u884C\u4EFB\u52A1","Planned stage \xB7 no execution task yet"):s.jobId?t("button",{type:"button",class:"acp-link",onClick:()=>B({jobId:s.jobId,full:o}),children:i("\u67E5\u770B\u6267\u884C\u4EFB\u52A1","Open execution task")}):""})]}),s.stage==="human_review"&&e.pendingReviewId?t("button",{type:"button",class:"acp-link",onClick:()=>n(e.pendingReviewId),children:t(re,{value:s.status})}):t(re,{value:s.status})]},s.stage))})]}),t("section",{class:"acp-detail-section",children:[t("h3",{children:i("\u6267\u884C\u8F6E\u6B21","Execution attempts")}),e.attempts.length?[...e.attempts].reverse().map((s,c)=>t("details",{class:"acp-attempt",open:c===0,children:[t("summary",{children:[t("span",{children:[s.attemptId===e.currentAttemptId?i("\u5F53\u524D\u6267\u884C","Current attempt"):i("\u5386\u53F2\u6267\u884C","Past attempt")," ","\xB7 ",J(s.createdAt||s.updatedAt)]}),t(re,{value:s.executionStatus})]}),s.stale&&t("p",{class:"acp-stale",children:i("\u6B64\u8F6E\u72B6\u6001\u5F85\u6838\u5B9E\uFF1B\u5386\u53F2\u5728\u9014\u6267\u884C\u4E0D\u4F1A\u88AB\u9690\u85CF\u3002","This attempt needs verification; unresolved prior work remains visible.")}),s.diagnostic&&t("p",{class:"acp-decision-error",children:s.diagnostic}),s.attemptId!==e.currentAttemptId&&s.result?.resultSummary&&t("div",{class:"acp-result-summary",children:t(ve,{source:s.result.resultSummary})})]},s.attemptId)):t("p",{class:"acp-muted",children:i("\u6682\u65E0\u6267\u884C\u8BB0\u5F55","No execution attempts")})]}),t("section",{class:"acp-detail-section",children:[t("h3",{children:i("\u76F4\u63A5\u5B50\u4EFB\u52A1","Direct subtasks")}),e.children.length?e.children.map(s=>t("button",{type:"button",class:"acp-child-task",onClick:()=>B({jobId:s.jobId,full:o}),children:[t("span",{children:[ge(s),t(Lr,{execution:s.execution})]}),t(re,{value:Ct(s)})]},s.jobId)):t("p",{class:"acp-muted",children:i("\u5F53\u524D\u6CA1\u6709\u5DF2\u521B\u5EFA\u7684\u5B50\u4EFB\u52A1","No subtasks have been created")})]})]})}function Ur({detail:e}){return t(C,{children:t("section",{class:"acp-detail-section",children:[t("h3",{children:i("\u6267\u884C\u4FE1\u606F","Execution details")}),t("div",{class:"acp-task-facts",children:t(Nr,{execution:e.execution})}),[...e.attempts].reverse().map(n=>{let r=le(n.execution,H);return t("details",{class:"acp-attempt",children:[t("summary",{children:t("span",{children:[n.attemptId===e.currentAttemptId?i("\u5F53\u524D\u6267\u884C","Current attempt"):i("\u5386\u53F2\u6267\u884C","Past attempt")," ","\xB7 ",n.attemptId]})}),t("dl",{children:[t("dt",{children:i("\u4EFB\u52A1\u65B9\u5F0F","Task mode")}),t("dd",{children:r.mode}),t("dt",{children:i("\u89D2\u8272\u6216\u9884\u8BBE","Role / preset")}),t("dd",{children:t(De,{execution:n.execution})}),t("dt",{children:i("\u6267\u884C\u670D\u52A1","Execution service")}),t("dd",{children:t(Ce,{execution:n.execution})}),t(Rt,{execution:n.execution}),t("dt",{children:i("\u539F\u59CB\u76EE\u6807 ID","Raw target ID")}),t("dd",{children:n.execution?.targetId||n.targetId||i("\u672A\u8BB0\u5F55","Not recorded")}),t("dt",{children:i("\u66F4\u65B0\u65F6\u95F4","Updated")}),t("dd",{children:J(n.updatedAt)}),n.previousAttemptId&&t(C,{children:[t("dt",{children:i("\u63A5\u7EED\u6267\u884C","Continues attempt")}),t("dd",{children:n.previousAttemptId})]})]})]},n.attemptId)}),t("details",{class:"acp-context",children:[t("summary",{children:i("\u4EFB\u52A1\u6765\u6E90","Task source")}),t("dl",{children:[t(Rt,{execution:e.execution}),t("dt",{children:i("\u539F\u59CB\u76EE\u6807 ID","Raw target ID")}),t("dd",{children:e.execution?.targetId||e.targetId}),e.execution?.roleId&&t(C,{children:[t("dt",{children:i("\u89D2\u8272 ID","Role ID")}),t("dd",{children:e.execution.roleId})]}),e.execution?.agentPreset&&t(C,{children:[t("dt",{children:i("\u8BB0\u5F55\u7684\u9884\u8BBE","Recorded preset")}),t("dd",{children:e.execution.agentPreset})]}),e.execution?.connectionId&&t(C,{children:[t("dt",{children:i("\u8FDE\u63A5 ID","Connection ID")}),t("dd",{children:e.execution.connectionId})]}),e.execution?.provider&&t(C,{children:[t("dt",{children:i("\u6267\u884C\u540E\u7AEF","Execution backend")}),t("dd",{children:e.execution.provider})]}),t("dt",{children:i("\u6765\u6E90\u4F1A\u8BDD","Origin session")}),t("dd",{children:e.originSessionId}),t("dt",{children:i("\u4EFB\u52A1\u8D26\u672C","Ledger source")}),t("dd",{children:e.sourceId}),e.parentAttemptId&&t(C,{children:[t("dt",{children:i("\u6240\u5C5E\u7236\u6267\u884C\u8F6E\u6B21","Parent attempt")}),t("dd",{children:e.parentAttemptId})]})]})]})]})})}function Hr({detail:e,review:n,requestedReviewId:r,onSelect:o,previewing:a,onPreview:s}){let c=[...e.progress?.availableResults||[]];for(let l of e.artifacts||[])c.some(d=>d.revision===l.revision)||c.push({revision:l.revision,artifacts:l.artifacts.map(d=>typeof d=="string"?{url:d}:d),deliveryReady:e.executionStatus==="completed"});return t(C,{children:[c.length>0&&t("section",{class:"acp-detail-section",children:[t("h3",{children:i("\u5DF2\u6709\u4EA7\u7269","Available artifacts")}),c.map(l=>t("div",{class:"acp-artifact-group",children:[t("strong",{children:[l.revision," \xB7"," ",l.deliveryReady?i("\u6700\u7EC8\u4EA4\u4ED8","Final delivery"):i("\u5236\u4F5C\u7A3F","Draft")]}),l.artifacts.map((d,u)=>t(On,{jobId:e.jobId,artifact:d,active:!!a&&(a.url||a.path)===(d.url||d.path),onPreview:s},`${d.url||d.path}:${u}`))]},l.revision))]}),c.length===0&&t("section",{class:"acp-detail-section",children:[t("h3",{children:i("\u5DF2\u6709\u4EA7\u7269","Available artifacts")}),t("p",{class:"acp-muted",children:i("\u8FD9\u4E2A\u4EFB\u52A1\u8FD8\u6CA1\u6709\u767B\u8BB0\u4EA7\u7269\u3002\u4EA7\u7269\u4E0D\u4F1A\u4ECE\u5BF9\u8BDD\u5185\u5BB9\u91CC\u63A8\u65AD\uFF1A\u667A\u80FD\u4F53\u9700\u8981\u6309\u4EFB\u52A1\u8981\u6C42\u628A\u6587\u4EF6\u5199\u5230\u6307\u5B9A\u7684\u4EFB\u52A1\u76EE\u5F55\uFF0C\u5E76\u767B\u8BB0\u5230\u4EA7\u7269\u6E05\u5355\uFF0C\u6267\u884C\u7AEF\u6821\u9A8C\u901A\u8FC7\u540E\u624D\u4F1A\u663E\u793A\u5728\u8FD9\u91CC\u3002","No artifacts are registered for this task. They are never inferred from the conversation: the agent must write files to the task directory and list them in the artifact manifest, and the executor verifies them before they appear here.")})]}),e.reviews.length>0?t(C,{children:[t("div",{class:"acp-review-heading",children:[t("h3",{children:i("\u9636\u6BB5\u4EA7\u7269\u5BA1\u6838","Stage artifact review")}),t("label",{children:[i("\u7248\u672C","Version"),t("select",{value:n?.reviewId||r||"",onChange:l=>o(l.currentTarget.value),children:[r&&!n&&t("option",{value:r,children:i("\u672A\u627E\u5230\u8BF7\u6C42\u7684\u7248\u672C","Requested version unavailable")}),[...e.reviews].reverse().map(l=>t("option",{value:l.reviewId,children:[l.revision," \xB7 ",xt(l.status)]},l.reviewId))]})]})]}),n?t(C,{children:[t("div",{class:"acp-review-version",children:[t(re,{value:n.status}),t("span",{children:n.revision}),t("span",{children:J(n.createdAt)})]}),t("h3",{children:n.preview.title||n.title}),n.preview.kind==="markdown"&&t("section",{class:"acp-report-preview",children:[t("p",{class:"acp-muted",children:[i("\u62A5\u544A\u6587\u4EF6\uFF1A","Report file: "),t("code",{children:n.preview.reportPath})]}),t(Hn,{markdown:n.preview.markdown||"",path:n.preview.reportPath})]}),n.preview.slides.map((l,d)=>t("section",{class:"acp-script-slide",children:[t("h4",{children:[t("span",{children:String(d+1).padStart(2,"0")}),l.title]}),t("p",{class:"acp-slide-message",children:l.message}),t("ul",{children:l.body.map((u,f)=>t("li",{children:u},f))}),l.visual&&t("p",{children:[t("span",{class:"acp-muted",children:i("\u753B\u9762\u5EFA\u8BAE\uFF1A","Visual: ")}),l.visual]}),l.notes&&t("p",{children:l.notes}),t("details",{class:"acp-slide-sources",children:[t("summary",{children:i("\u4E8B\u5B9E\u4E0E\u7D20\u6750\u4F9D\u636E","Facts and sources")}),l.facts.length>0&&t("ul",{children:l.facts.map((u,f)=>t("li",{children:u},f))}),t("ul",{children:l.sources.map((u,f)=>t("li",{children:t("code",{children:u})},f))})]})]},`${n.reviewId}:${d}`)),t("details",{class:"acp-context",children:[t("summary",{children:i("\u5BA1\u6838\u7248\u672C\u6807\u8BC6","Review version reference")}),t("dl",{children:[t("dt",{children:i("\u5185\u5BB9\u6458\u8981","Content digest")}),t("dd",{children:t("code",{children:n.digest})}),t("dt",{children:i("\u4F5C\u8005\u6267\u884C\u8F6E\u6B21","Author attempt")}),t("dd",{children:n.authorAttemptId||n.attemptId})]})]})]}):t("p",{class:"acp-decision-error",children:i("\u627E\u4E0D\u5230\u94FE\u63A5\u5BF9\u5E94\u7684\u5BA1\u6838\u7248\u672C\uFF0C\u8BF7\u9009\u62E9\u53EF\u7528\u7248\u672C\u3002","The linked review version is unavailable. Select an available version.")})]}):t(at,{title:i("\u5F53\u524D\u6CA1\u6709\u9636\u6BB5\u5BA1\u6838","No stage review"),description:e.parentJobRef?i("\u53EF\u4EE5\u8FD4\u56DE\u7236\u4EFB\u52A1\u67E5\u770B\u5B8C\u6574\u4EA4\u4ED8\u4E0E\u5BA1\u6838\u3002","Open the parent task to see workflow reviews."):i("\u4EA7\u7269\u5F62\u6210\u540E\uFF0C\u4F1A\u5728\u8FD9\u91CC\u5C55\u793A\u53EF\u786E\u8BA4\u7684\u7248\u672C\u3002","Reviewable versions appear here once artifacts are ready.")})]})}function Wr({review:e}){let n={comment:i("\u53D1\u8868\u8BC4\u8BBA","Commented"),approve:i("\u901A\u8FC7","Approved"),changes_requested:i("\u8981\u6C42\u4FEE\u6539","Requested changes"),cancel:i("\u653E\u5F03\u4EFB\u52A1","Abandoned task")};return t("section",{class:"acp-detail-section",children:[t("h3",{children:i("\u610F\u89C1\u4E0E\u51B3\u5B9A","Feedback and decisions")}),e.history.length?e.history.map((r,o)=>t("article",{class:"acp-review-event",children:[t("header",{children:[t("strong",{children:r.actor.displayName||r.actor.id}),t("span",{children:n[r.action]}),t("time",{children:J(r.at)})]}),r.note&&t("p",{children:r.note})]},`${r.at}:${o}`)):t("p",{class:"acp-muted",children:i("\u5F53\u524D\u7248\u672C\u5C1A\u65E0\u610F\u89C1\u6216\u51B3\u5B9A","No feedback or decisions for this version")})]})}function Br({detail:e}){return t("section",{class:"acp-detail-section",children:[t("h3",{children:i("\u4EFB\u52A1\u4E8B\u4EF6","Task events")}),e.events.length?t("ol",{class:"acp-event-list",children:[...e.events].reverse().map(n=>t("li",{children:[t("time",{children:J(n.observedAt)}),t("div",{children:[t("strong",{title:n.type,children:bn(n.type)}),n.attemptId&&t("small",{children:[i("\u6267\u884C\u8F6E\u6B21\uFF1A","Attempt: "),n.attemptId]}),n.data!==void 0&&t("details",{children:[t("summary",{children:i("\u6280\u672F\u8BE6\u60C5","Technical details")}),t("pre",{children:JSON.stringify(n.data,null,2)})]})]})]},n.eventId))}):t("p",{class:"acp-muted",children:i("\u6682\u65E0\u4EFB\u52A1\u4E8B\u4EF6","No task events")})]})}var qr=["all","pending","working","failed"],zr={all:0,pending:0,working:0,failed:0},Ut=100;function Vr({onDone:e}){let[n,r]=g(""),[o,a]=g(""),[s,c]=g(!1);return t("form",{class:"acp-login",onSubmit:l=>{l.preventDefault(),c(!0),a(""),tt.login(n.trim()).then(()=>e()).catch(d=>a(It(d))).finally(()=>c(!1))},children:[t("h1",{children:i("\u4EFB\u52A1\u5DE5\u4F5C\u53F0","Task workbench")}),t("p",{class:"acp-muted",children:i("\u8F93\u5165 A2A \u7F51\u5173\u914D\u7F6E\u91CC\u7684 workbench.token\u3002\u767B\u5F55\u53EA\u5728\u672C\u673A\u8FD9\u4E2A\u7F51\u5173\u4E0A\u6709\u6548\uFF0C12 \u5C0F\u65F6\u540E\u9700\u8981\u91CD\u65B0\u767B\u5F55\u3002","Enter workbench.token from the A2A gateway config. The login is valid on this gateway for 12 hours.")}),t("label",{children:[i("\u5DE5\u4F5C\u53F0\u4EE4\u724C","Workbench token"),t("input",{type:"password",autoComplete:"current-password",value:n,onInput:l=>r(l.currentTarget.value)})]}),o&&t("p",{class:"acp-decision-error",role:"alert",children:o}),t("button",{type:"submit",class:"acp-button acp-primary",disabled:s||!n.trim(),children:i("\u767B\u5F55","Sign in")})]})}function Jr({onLogout:e}){let n=_n(),[r,o]=g("tasks"),[a,s]=g("all"),[c,l]=g(0),[d,u]=g(null),[f,p]=g(!0),[_,b]=g(""),[x,m]=g(0),I=E(0),w=E(!1);T(()=>{let h=++I.current,N=!1;w.current=!1,p(!0);let U=async()=>{if(!w.current){w.current=!0;try{let $=await O.list(a,c,Ut);!N&&h===I.current&&(u($),b(""))}catch($){!N&&h===I.current&&b(It($))}finally{!N&&h===I.current&&(p(!1),w.current=!1)}}};U();let K=window.setInterval(()=>{U()},5e3);return()=>{N=!0,window.clearInterval(K)}},[a,c,x]),T(()=>{n.jobId&&o("tasks")},[n.jobId]),T(()=>{let h=N=>{N.key==="Escape"&&n.jobId&&B({full:!1})};return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[n.jobId]);let y=[...d?.items||[]].sort((h,N)=>N.updatedAt.localeCompare(h.updatedAt)),P=d?.counts||zr,j=(h,N)=>B({jobId:h.jobId,reviewId:N,full:!1});return t("section",{class:`acp-workbench${n.jobId?" has-detail":""}${n.full?" is-full-detail":""}`,children:[t("header",{class:"acp-workbench-header",children:[t("div",{class:"acp-workbench-title",children:[t("h1",{children:i("\u4EFB\u52A1\u5DE5\u4F5C\u53F0","Task workbench")}),t("nav",{class:"acp-module-switch","aria-label":i("\u5DE5\u4F5C\u53F0\u6A21\u5757","Workbench modules"),children:[t("button",{type:"button","aria-pressed":r==="tasks",onClick:()=>o("tasks"),children:i("\u4EFB\u52A1","Tasks")}),t("button",{type:"button","aria-pressed":r==="agents",onClick:()=>{o("agents"),n.jobId&&B({full:!1})},children:i("\u667A\u80FD\u4F53","Agents")})]})]}),t("div",{class:"acp-header-actions",children:[t("button",{type:"button",class:"acp-button",onClick:()=>m(h=>h+1),disabled:f,children:i("\u5237\u65B0","Refresh")}),e&&t("button",{type:"button",class:"acp-button",onClick:e,children:i("\u9000\u51FA\u767B\u5F55","Sign out")})]})]}),t("p",{class:"acp-workbench-source",children:i("\u6570\u636E\u6765\u6E90\uFF1A\u672C\u673A A2A \u7F51\u5173\u8D26\u672C\u3002","Source: this A2A gateway ledger.")}),r==="agents"?t(xn,{refreshKey:x,onOpenTask:h=>{o("tasks"),B({jobId:h,full:!1})}}):t(C,{children:[t("nav",{class:"acp-workbench-views","aria-label":i("\u4EFB\u52A1\u89C6\u56FE","Task views"),children:qr.map(h=>t("button",{type:"button","aria-pressed":a===h,onClick:()=>{s(h),l(0)},children:[{all:i("\u5168\u90E8\u4EFB\u52A1","All tasks"),pending:i("\u5F85\u6211\u786E\u8BA4","My reviews"),working:i("\u8FDB\u884C\u4E2D","Working"),failed:i("\u5F02\u5E38","Needs attention")}[h],d&&t("span",{children:P[h]})]},h))}),t("div",{class:"acp-workbench-body",children:[t("div",{class:"acp-workbench-table",children:[_&&t(Te,{title:i("\u4EFB\u52A1\u8BFB\u53D6\u5931\u8D25","Could not load tasks"),message:_,onRetry:()=>m(h=>h+1)}),t("table",{children:[t("thead",{children:t("tr",{children:[t("th",{children:i("\u4EFB\u52A1\u540D\u79F0","Task")}),t("th",{children:i("\u4EFB\u52A1\u6027\u8D28","Task kind")}),t("th",{children:i("\u6267\u884C\u72B6\u6001","Status")}),t("th",{children:i("\u4EFB\u52A1\u65B9\u5F0F","Task mode")}),t("th",{children:i("\u89D2\u8272\u6216\u9884\u8BBE","Role / preset")}),t("th",{children:i("\u6267\u884C\u670D\u52A1","Execution service")}),t("th",{children:i("\u5F53\u524D\u9636\u6BB5","Phase")}),t("th",{children:i("\u5F85\u529E\u4E0E\u5361\u70B9","Action / blocker")}),t("th",{children:i("\u6700\u8FD1\u8FDB\u5C55","Last updated")})]})}),t("tbody",{children:[!f&&!y.length&&t("tr",{children:t("td",{colSpan:9,class:"acp-muted",children:a==="all"?i("\u5F53\u524D\u6CA1\u6709 ACP \u6267\u884C\u4EFB\u52A1","No ACP execution tasks yet"):i("\u5F53\u524D\u89C6\u56FE\u6CA1\u6709\u5339\u914D\u7684\u4EFB\u52A1","No tasks in this view")})}),y.map(h=>t("tr",{class:`acp-task-row${n.jobId===h.jobId?" is-selected":""}`,children:[t("td",{children:t("div",{class:"acp-task-name",style:{paddingLeft:`${Math.min(vn(h,y),6)*16}px`},children:t("button",{type:"button",class:"acp-link acp-name-link",title:ge(h),onClick:()=>j(h,a==="pending"?h.pendingReviewId:void 0),children:[t("span",{class:"acp-title-text",children:ge(h)}),t("small",{title:h.jobId,children:h.jobId.length>12?`${h.jobId.slice(0,8)}\u2026`:h.jobId})]})})}),t("td",{children:[t("span",{class:"acp-mode-label",children:ot(h.channel)}),h.agentName&&t("small",{class:"acp-cell-note",children:h.agentName})]}),t("td",{children:[t(re,{value:st(h)}),!!h.unresolvedAttemptIds?.length&&t("small",{class:"acp-stale",children:i("\u6709\u5F85\u6838\u5B9E\u7684\u5386\u53F2\u6267\u884C","Prior execution needs verification")}),h.stale&&t("small",{class:"acp-stale",children:i("\u72B6\u6001\u5F85\u540C\u6B65","Awaiting sync")})]}),t("td",{children:t("span",{class:"acp-mode-label",children:le(h.execution,H).mode})}),t("td",{children:t(De,{execution:h.execution})}),t("td",{children:t(Ce,{execution:h.execution})}),t("td",{children:yn(h.phase||"")||"\u2014"}),t("td",{children:[h.pendingReviewId&&t("button",{type:"button",class:"acp-link",onClick:()=>j(h,h.pendingReviewId),children:i("\u67E5\u770B\u5E76\u786E\u8BA4","Review content")}),h.pendingProcessRequestId&&t("button",{type:"button",class:"acp-link",onClick:()=>j(h),children:i("\u56DE\u7B54\u8FC7\u7A0B\u8BF7\u6C42","Answer request")}),!h.pendingReviewId&&!h.pendingProcessRequestId&&t("span",{class:"acp-task-blocker",title:h.progressSummary,children:wn(h.progressSummary)})]}),t("td",{class:"acp-task-updated",children:J(h.updatedAt)})]},h.jobId))]})]}),d&&t("div",{class:"acp-pagination",children:[t("span",{children:i(`${d.total} \u6761\u4EFB\u52A1\u8BB0\u5F55`,`${d.total} task records`)}),t("button",{type:"button",class:"acp-button",disabled:c===0||f,onClick:()=>l(Math.max(0,c-Ut)),children:i("\u4E0A\u4E00\u9875","Previous")}),t("button",{type:"button",class:"acp-button",disabled:c+y.length>=d.total||f,onClick:()=>l(c+Ut),children:i("\u4E0B\u4E00\u9875","Next")})]})]}),n.jobId&&t(Bn,{jobId:n.jobId,requestedReviewId:n.reviewId,full:n.full,onChanged:()=>m(h=>h+1)},n.jobId)]})]})]})}function Kr(){let[e,n]=g("checking"),[r,o]=g(!0);return T(()=>{tt.status().then(s=>{o(s.loginRequired!==!1),n(s.authenticated?"ready":"login")}).catch(()=>n("login"));let a=()=>n("login");return et.addEventListener("required",a),()=>et.removeEventListener("required",a)},[]),e==="checking"?t("p",{class:"acp-muted acp-boot",children:i("\u6B63\u5728\u8FDE\u63A5\u7F51\u5173\u2026","Connecting to the gateway\u2026")}):e==="login"?t(Vr,{onDone:()=>n("ready")}):t(Jr,{onLogout:r?()=>{tt.logout().finally(()=>n("login"))}:void 0})}nn(t(Kr,{}),document.getElementById("app"));
|
|
1
|
+
import"./chunk-SQE76S5B.js";var et,E,Qt,Xn,ce,Kt,Xt,Zt,ht,Je,De,Yt,yt,vt,_t,Zn,Xe={},Ze=[],Yn=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,tt=Array.isArray;function oe(e,n){for(var s in n)e[s]=n[s];return e}function wt(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function es(e,n,s){var a,i,r,c={};for(r in n)r=="key"?a=n[r]:r=="ref"?i=n[r]:c[r]=n[r];if(arguments.length>2&&(c.children=arguments.length>3?et.call(arguments,2):s),typeof e=="function"&&e.defaultProps!=null)for(r in e.defaultProps)c[r]===void 0&&(c[r]=e.defaultProps[r]);return Ge(e,c,a,i,null)}function Ge(e,n,s,a,i){var r={type:e,props:n,key:s,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++Qt,__i:-1,__u:0};return i==null&&E.vnode!=null&&E.vnode(r),r}function T(e){return e.children}function Qe(e,n){this.props=e,this.context=n}function Ce(e,n){if(n==null)return e.__?Ce(e.__,e.__i+1):null;for(var s;n<e.__k.length;n++)if((s=e.__k[n])!=null&&s.__e!=null)return s.__e;return typeof e.type=="function"?Ce(e):null}function ts(e){if(e.__P&&e.__d){var n=e.__v,s=n.__e,a=[],i=[],r=oe({},n);r.__v=n.__v+1,E.vnode&&E.vnode(r),kt(e.__P,r,n,e.__n,e.__P.namespaceURI,32&n.__u?[s]:null,a,s??Ce(n),!!(32&n.__u),i),r.__v=n.__v,r.__.__k[r.__i]=r,sn(a,r,i),n.__e=n.__=null,r.__e!=s&&en(r)}}function en(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(n){if(n!=null&&n.__e!=null)return e.__e=e.__c.base=n.__e}),en(e)}function Vt(e){(!e.__d&&(e.__d=!0)&&ce.push(e)&&!Ye.__r++||Kt!=E.debounceRendering)&&((Kt=E.debounceRendering)||Xt)(Ye)}function Ye(){try{for(var e,n=1;ce.length;)ce.length>n&&ce.sort(Zt),e=ce.shift(),n=ce.length,ts(e)}finally{ce.length=Ye.__r=0}}function tn(e,n,s,a,i,r,c,l,u,p,f){var d,h,_,C,m,x,y,w=a&&a.__k||Ze,S=n.length;for(u=ns(s,n,w,u,S),d=0;d<S;d++)(_=s.__k[d])!=null&&(h=_.__i!=-1&&w[_.__i]||Xe,_.__i=d,x=kt(e,_,h,i,r,c,l,u,p,f),C=_.__e,_.ref&&h.ref!=_.ref&&(h.ref&&At(h.ref,null,_),f.push(_.ref,_.__c||C,_)),m==null&&C!=null&&(m=C),(y=!!(4&_.__u))||h.__k===_.__k?(u=nn(_,u,e,y),y&&h.__e&&(h.__e=null)):typeof _.type=="function"&&x!==void 0?u=x:C&&(u=C.nextSibling),_.__u&=-7);return s.__e=m,u}function ns(e,n,s,a,i){var r,c,l,u,p,f=s.length,d=f,h=0;for(e.__k=new Array(i),r=0;r<i;r++)(c=n[r])!=null&&typeof c!="boolean"&&typeof c!="function"?(typeof c=="string"||typeof c=="number"||typeof c=="bigint"||c.constructor==String?c=e.__k[r]=Ge(null,c,null,null,null):tt(c)?c=e.__k[r]=Ge(T,{children:c},null,null,null):c.constructor===void 0&&c.__b>0?c=e.__k[r]=Ge(c.type,c.props,c.key,c.ref?c.ref:null,c.__v):e.__k[r]=c,u=r+h,c.__=e,c.__b=e.__b+1,l=null,(p=c.__i=ss(c,s,u,d))!=-1&&(d--,(l=s[p])&&(l.__u|=2)),l==null||l.__v==null?(p==-1&&(i>f?h--:i<f&&h++),typeof c.type!="function"&&(c.__u|=4)):p!=u&&(p==u-1?h--:p==u+1?h++:(p>u?h--:h++,c.__u|=4))):e.__k[r]=null;if(d)for(r=0;r<f;r++)(l=s[r])!=null&&(2&l.__u)==0&&(l.__e==a&&(a=Ce(l)),an(l,l));return a}function nn(e,n,s,a){var i,r;if(typeof e.type=="function"){for(i=e.__k,r=0;i&&r<i.length;r++)i[r]&&(i[r].__=e,n=nn(i[r],n,s,a));return n}e.__e!=n&&(a&&(n&&e.type&&!n.parentNode&&(n=Ce(e)),s.insertBefore(e.__e,n||null)),n=e.__e);do n=n&&n.nextSibling;while(n!=null&&n.nodeType==8);return n}function ss(e,n,s,a){var i,r,c,l=e.key,u=e.type,p=n[s],f=p!=null&&(2&p.__u)==0;if(p===null&&l==null||f&&l==p.key&&u==p.type)return s;if(a>(f?1:0)){for(i=s-1,r=s+1;i>=0||r<n.length;)if((p=n[c=i>=0?i--:r++])!=null&&(2&p.__u)==0&&l==p.key&&u==p.type)return c}return-1}function Jt(e,n,s){n[0]=="-"?e.setProperty(n,s??""):e[n]=s==null?"":typeof s!="number"||Yn.test(n)?s:s+"px"}function Ve(e,n,s,a,i){var r,c;e:if(n=="style")if(typeof s=="string")e.style.cssText=s;else{if(typeof a=="string"&&(e.style.cssText=a=""),a)for(n in a)s&&n in s||Jt(e.style,n,"");if(s)for(n in s)a&&s[n]==a[n]||Jt(e.style,n,s[n])}else if(n[0]=="o"&&n[1]=="n")r=n!=(n=n.replace(Yt,"$1")),c=n.toLowerCase(),n=c in e||n=="onFocusOut"||n=="onFocusIn"?c.slice(2):n.slice(2),e.l||(e.l={}),e.l[n+r]=s,s?a?s[De]=a[De]:(s[De]=yt,e.addEventListener(n,r?_t:vt,r)):e.removeEventListener(n,r?_t:vt,r);else{if(i=="http://www.w3.org/2000/svg")n=n.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(n!="width"&&n!="height"&&n!="href"&&n!="list"&&n!="form"&&n!="tabIndex"&&n!="download"&&n!="rowSpan"&&n!="colSpan"&&n!="role"&&n!="popover"&&n in e)try{e[n]=s??"";break e}catch{}typeof s=="function"||(s==null||s===!1&&n[4]!="-"?e.removeAttribute(n):e.setAttribute(n,n=="popover"&&s==1?"":s))}}function Gt(e){return function(n){if(this.l){var s=this.l[n.type+e];if(n[Je]==null)n[Je]=yt++;else if(n[Je]<s[De])return;return s(E.event?E.event(n):n)}}}function kt(e,n,s,a,i,r,c,l,u,p){var f,d,h,_,C,m,x,y,w,S,k,v,L,O,X,N=n.type;if(n.constructor!==void 0)return null;128&s.__u&&(u=!!(32&s.__u),r=[l=n.__e=s.__e]),(f=E.__b)&&f(n);e:if(typeof N=="function")try{if(y=n.props,w=N.prototype&&N.prototype.render,S=(f=N.contextType)&&a[f.__c],k=f?S?S.props.value:f.__:a,s.__c?x=(d=n.__c=s.__c).__=d.__E:(w?n.__c=d=new N(y,k):(n.__c=d=new Qe(y,k),d.constructor=N,d.render=as),S&&S.sub(d),d.state||(d.state={}),d.__n=a,h=d.__d=!0,d.__h=[],d._sb=[]),w&&d.__s==null&&(d.__s=d.state),w&&N.getDerivedStateFromProps!=null&&(d.__s==d.state&&(d.__s=oe({},d.__s)),oe(d.__s,N.getDerivedStateFromProps(y,d.__s))),_=d.props,C=d.state,d.__v=n,h)w&&N.getDerivedStateFromProps==null&&d.componentWillMount!=null&&d.componentWillMount(),w&&d.componentDidMount!=null&&d.__h.push(d.componentDidMount);else{if(w&&N.getDerivedStateFromProps==null&&y!==_&&d.componentWillReceiveProps!=null&&d.componentWillReceiveProps(y,k),n.__v==s.__v||!d.__e&&d.shouldComponentUpdate!=null&&d.shouldComponentUpdate(y,d.__s,k)===!1){n.__v!=s.__v&&(d.props=y,d.state=d.__s,d.__d=!1),n.__e=s.__e,n.__k=s.__k,n.__k.some(function(K){K&&(K.__=n)}),Ze.push.apply(d.__h,d._sb),d._sb=[],d.__h.length&&c.push(d);break e}d.componentWillUpdate!=null&&d.componentWillUpdate(y,d.__s,k),w&&d.componentDidUpdate!=null&&d.__h.push(function(){d.componentDidUpdate(_,C,m)})}if(d.context=k,d.props=y,d.__P=e,d.__e=!1,v=E.__r,L=0,w)d.state=d.__s,d.__d=!1,v&&v(n),f=d.render(d.props,d.state,d.context),Ze.push.apply(d.__h,d._sb),d._sb=[];else do d.__d=!1,v&&v(n),f=d.render(d.props,d.state,d.context),d.state=d.__s;while(d.__d&&++L<25);d.state=d.__s,d.getChildContext!=null&&(a=oe(oe({},a),d.getChildContext())),w&&!h&&d.getSnapshotBeforeUpdate!=null&&(m=d.getSnapshotBeforeUpdate(_,C)),O=f!=null&&f.type===T&&f.key==null?on(f.props.children):f,l=tn(e,tt(O)?O:[O],n,s,a,i,r,c,l,u,p),d.base=n.__e,n.__u&=-161,d.__h.length&&c.push(d),x&&(d.__E=d.__=null)}catch(K){if(n.__v=null,u||r!=null)if(K.then){for(n.__u|=u?160:128;l&&l.nodeType==8&&l.nextSibling;)l=l.nextSibling;r[r.indexOf(l)]=null,n.__e=l}else{for(X=r.length;X--;)wt(r[X]);bt(n)}else n.__e=s.__e,n.__k=s.__k,K.then||bt(n);E.__e(K,n,s)}else r==null&&n.__v==s.__v?(n.__k=s.__k,n.__e=s.__e):l=n.__e=os(s.__e,n,s,a,i,r,c,u,p);return(f=E.diffed)&&f(n),128&n.__u?void 0:l}function bt(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(bt))}function sn(e,n,s){for(var a=0;a<s.length;a++)At(s[a],s[++a],s[++a]);E.__c&&E.__c(n,e),e.some(function(i){try{e=i.__h,i.__h=[],e.some(function(r){r.call(i)})}catch(r){E.__e(r,i.__v)}})}function on(e){return typeof e!="object"||e==null||e.__b>0?e:tt(e)?e.map(on):e.constructor!==void 0?null:oe({},e)}function os(e,n,s,a,i,r,c,l,u){var p,f,d,h,_,C,m,x=s.props||Xe,y=n.props,w=n.type;if(w=="svg"?i="http://www.w3.org/2000/svg":w=="math"?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),r!=null){for(p=0;p<r.length;p++)if((_=r[p])&&"setAttribute"in _==!!w&&(w?_.localName==w:_.nodeType==3)){e=_,r[p]=null;break}}if(e==null){if(w==null)return document.createTextNode(y);e=document.createElementNS(i,w,y.is&&y),l&&(E.__m&&E.__m(n,r),l=!1),r=null}if(w==null)x===y||l&&e.data==y||(e.data=y);else{if(r=w=="textarea"&&y.defaultValue!=null?null:r&&et.call(e.childNodes),!l&&r!=null)for(x={},p=0;p<e.attributes.length;p++)x[(_=e.attributes[p]).name]=_.value;for(p in x)_=x[p],p=="dangerouslySetInnerHTML"?d=_:p=="children"||p in y||p=="value"&&"defaultValue"in y||p=="checked"&&"defaultChecked"in y||Ve(e,p,null,_,i);for(p in y)_=y[p],p=="children"?h=_:p=="dangerouslySetInnerHTML"?f=_:p=="value"?C=_:p=="checked"?m=_:l&&typeof _!="function"||x[p]===_||Ve(e,p,_,x[p],i);if(f)l||d&&(f.__html==d.__html||f.__html==e.innerHTML)||(e.innerHTML=f.__html),n.__k=[];else if(d&&(e.innerHTML=""),tn(n.type=="template"?e.content:e,tt(h)?h:[h],n,s,a,w=="foreignObject"?"http://www.w3.org/1999/xhtml":i,r,c,r?r[0]:s.__k&&Ce(s,0),l,u),r!=null)for(p=r.length;p--;)wt(r[p]);l&&w!="textarea"||(p="value",w=="progress"&&C==null?e.removeAttribute("value"):C!=null&&(C!==e[p]||w=="progress"&&!C||w=="option"&&C!=x[p])&&Ve(e,p,C,x[p],i),p="checked",m!=null&&m!=e[p]&&Ve(e,p,m,x[p],i))}return e}function At(e,n,s){try{if(typeof e=="function"){var a=typeof e.__u=="function";a&&e.__u(),a&&n==null||(e.__u=e(n))}else e.current=n}catch(i){E.__e(i,s)}}function an(e,n,s){var a,i;if(E.unmount&&E.unmount(e),(a=e.ref)&&(a.current&&a.current!=e.__e||At(a,null,n)),(a=e.__c)!=null){if(a.componentWillUnmount)try{a.componentWillUnmount()}catch(r){E.__e(r,n)}a.base=a.__P=null}if(a=e.__k)for(i=0;i<a.length;i++)a[i]&&an(a[i],n,s||typeof e.type!="function");s||wt(e.__e),e.__c=e.__=e.__e=void 0}function as(e,n,s){return this.constructor(e,s)}function rn(e,n,s){var a,i,r,c;n==document&&(n=document.documentElement),E.__&&E.__(e,n),i=(a=typeof s=="function")?null:s&&s.__k||n.__k,r=[],c=[],kt(n,e=(!a&&s||n).__k=es(T,null,[e]),i||Xe,Xe,n.namespaceURI,!a&&s?[s]:i?null:n.firstChild?et.call(n.childNodes):null,r,!a&&s?s:i?i.__e:n.firstChild,a,c),sn(r,e,c)}et=Ze.slice,E={__e:function(e,n,s,a){for(var i,r,c;n=n.__;)if((i=n.__c)&&!i.__)try{if((r=i.constructor)&&r.getDerivedStateFromError!=null&&(i.setState(r.getDerivedStateFromError(e)),c=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(e,a||{}),c=i.__d),c)return i.__E=i}catch(l){e=l}throw e}},Qt=0,Xn=function(e){return e!=null&&e.constructor===void 0},Qe.prototype.setState=function(e,n){var s;s=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=oe({},this.state),typeof e=="function"&&(e=e(oe({},s),this.props)),e&&oe(s,e),e!=null&&this.__v&&(n&&this._sb.push(n),Vt(this))},Qe.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Vt(this))},Qe.prototype.render=T,ce=[],Xt=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Zt=function(e,n){return e.__v.__b-n.__v.__b},Ye.__r=0,ht=Math.random().toString(8),Je="__d"+ht,De="__a"+ht,Yt=/(PointerCapture)$|Capture$/i,yt=0,vt=Gt(!1),_t=Gt(!0),Zn=0;var Te,D,It,cn,Me=0,hn=[],M=E,ln=M.__b,dn=M.__r,un=M.diffed,pn=M.__c,fn=M.unmount,mn=M.__;function st(e,n){M.__h&&M.__h(D,e,Me||n),Me=0;var s=D.__H||(D.__H={__:[],__h:[]});return e>=s.__.length&&s.__.push({}),s.__[e]}function g(e){return Me=1,rs(_n,e)}function rs(e,n,s){var a=st(Te++,2);if(a.t=e,!a.__c&&(a.__=[s?s(n):_n(void 0,n),function(l){var u=a.__N?a.__N[0]:a.__[0],p=a.t(u,l);u!==p&&(a.__N=[p,a.__[1]],a.__c.setState({}))}],a.__c=D,!D.__f)){var i=function(l,u,p){if(!a.__c.__H)return!0;var f=a.__c.__H.__.filter(function(h){return h.__c});if(f.every(function(h){return!h.__N}))return!r||r.call(this,l,u,p);var d=a.__c.props!==l;return f.some(function(h){if(h.__N){var _=h.__[0];h.__=h.__N,h.__N=void 0,_!==h.__[0]&&(d=!0)}}),r&&r.call(this,l,u,p)||d};D.__f=!0;var r=D.shouldComponentUpdate,c=D.componentWillUpdate;D.componentWillUpdate=function(l,u,p){if(this.__e){var f=r;r=void 0,i(l,u,p),r=f}c&&c.call(this,l,u,p)},D.shouldComponentUpdate=i}return a.__N||a.__}function R(e,n){var s=st(Te++,3);!M.__s&&Ct(s.__H,n)&&(s.__=e,s.u=n,D.__H.__h.push(s))}function vn(e,n){var s=st(Te++,4);!M.__s&&Ct(s.__H,n)&&(s.__=e,s.u=n,D.__h.push(s))}function j(e){return Me=5,Le(function(){return{current:e}},[])}function Le(e,n){var s=st(Te++,7);return Ct(s.__H,n)&&(s.__=e(),s.__H=n,s.__h=e),s.__}function J(e,n){return Me=8,Le(function(){return e},n)}function is(){for(var e;e=hn.shift();){var n=e.__H;if(e.__P&&n)try{n.__h.some(nt),n.__h.some(xt),n.__h=[]}catch(s){n.__h=[],M.__e(s,e.__v)}}}M.__b=function(e){D=null,ln&&ln(e)},M.__=function(e,n){e&&n.__k&&n.__k.__m&&(e.__m=n.__k.__m),mn&&mn(e,n)},M.__r=function(e){dn&&dn(e),Te=0;var n=(D=e.__c).__H;n&&(It===D?(n.__h=[],D.__h=[],n.__.some(function(s){s.__N&&(s.__=s.__N),s.u=s.__N=void 0})):(n.__h.some(nt),n.__h.some(xt),n.__h=[],Te=0)),It=D},M.diffed=function(e){un&&un(e);var n=e.__c;n&&n.__H&&(n.__H.__h.length&&(hn.push(n)!==1&&cn===M.requestAnimationFrame||((cn=M.requestAnimationFrame)||cs)(is)),n.__H.__.some(function(s){s.u&&(s.__H=s.u),s.u=void 0})),It=D=null},M.__c=function(e,n){n.some(function(s){try{s.__h.some(nt),s.__h=s.__h.filter(function(a){return!a.__||xt(a)})}catch(a){n.some(function(i){i.__h&&(i.__h=[])}),n=[],M.__e(a,s.__v)}}),pn&&pn(e,n)},M.unmount=function(e){fn&&fn(e);var n,s=e.__c;s&&s.__H&&(s.__H.__.some(function(a){try{nt(a)}catch(i){n=i}}),s.__H=void 0,n&&M.__e(n,s.__v))};var gn=typeof requestAnimationFrame=="function";function cs(e){var n,s=function(){clearTimeout(a),gn&&cancelAnimationFrame(n),setTimeout(e)},a=setTimeout(s,35);gn&&(n=requestAnimationFrame(s))}function nt(e){var n=D,s=e.__c;typeof s=="function"&&(e.__c=void 0,s()),D=n}function xt(e){var n=D;e.__c=e.__(),D=n}function Ct(e,n){return!e||e.length!==n.length||n.some(function(s,a){return s!==e[a]})}function _n(e,n){return typeof n=="function"?n(e):n}var ls="/workbench/ui/api",G=class extends Error{constructor(s,a,i){super(s);this.status=a;this.code=i}status;code},ot=new EventTarget;async function Y(e,n={}){let s=await fetch(`${ls}${e}`,{...n,credentials:"same-origin",headers:n.body?{"Content-Type":"application/json"}:void 0});if(s.ok)return await s.json();let a=s.statusText,i,r=await s.text();try{let c=JSON.parse(r);a=c.message||(typeof c.error=="string"?c.error:c.error?.message)||a,i=typeof c.code=="string"?c.code:typeof c.error=="string"?c.error:void 0}catch{a=r||a}throw s.status===401&&i==="login_required"&&ot.dispatchEvent(new Event("required")),new G(a,s.status,i)}var W=(e,n)=>Y(e,{method:"POST",body:JSON.stringify(n)}),at={status:()=>Y("/session"),login:e=>W("/session",{token:e}),logout:()=>Y("/session",{method:"DELETE"})},Ne={list:(e=0,n=100)=>{let s=new URLSearchParams({offset:String(e),limit:String(n)});return Y(`/cases?${s}`)},get:e=>Y(`/cases/${encodeURIComponent(e)}`),open:e=>W("/cases",e),decideHandoff:(e,n,s)=>W(`/cases/${encodeURIComponent(e)}/handoffs/${encodeURIComponent(n)}/decisions`,s),registerConvention:(e,n)=>W(`/cases/${encodeURIComponent(e)}/conventions`,n),recordReceipt:(e,n)=>W(`/cases/${encodeURIComponent(e)}/receipts`,n),recordFact:(e,n)=>W(`/cases/${encodeURIComponent(e)}/facts`,n)},U={list(e,n=0,s=100){let a=new URLSearchParams({filter:e,offset:String(n),limit:String(s)});return Y(`/tasks?${a}`)},get:e=>Y(`/tasks/${encodeURIComponent(e)}`),dshSession:e=>Y(`/dsh/tasks/${encodeURIComponent(e)}`),chat:(e,n,s)=>{let a=new URLSearchParams({limit:String(s)});return n!==void 0&&a.set("before",String(n)),Y(`/tasks/${encodeURIComponent(e)}/chat?${a}`)},decide:(e,n,s)=>W(`/tasks/${encodeURIComponent(e)}/reviews/${encodeURIComponent(n)}/decisions`,s),refresh:e=>W(`/tasks/${encodeURIComponent(e)}/refresh`,{}),continueTask:(e,n)=>W(`/tasks/${encodeURIComponent(e)}/continue`,{prompt:n}),accept:e=>W(`/tasks/${encodeURIComponent(e)}/acceptance`,{}),answerProcessRequest:(e,n,s)=>W(`/tasks/${encodeURIComponent(e)}/process-requests/${encodeURIComponent(n)}/answers`,s),listAgents:()=>Y("/agents"),createAgent:e=>W("/agents",e),updateAgent:(e,n)=>W(`/agents/${encodeURIComponent(e)}/settings`,n),publishAgent:(e,n)=>W(`/agents/${encodeURIComponent(e)}/publish`,n),registerAgentPath:e=>W("/agents/register-path",e)};function rt(e,n="zh-CN"){let s=(l,u)=>n==="zh-CN"?l:u,a=e?.serviceInfo,i=a?.connectionAlias||e?.service,r=s("\u672A\u8BB0\u5F55","Not recorded");if(a?.kind==="gateway_workflow")r=s("ACP \u5185\u7F6E\u534F\u8C03\u5668","ACP built-in coordinator");else if(a?.kind==="a2a"||a?.kind==="activepieces"){let l=a.kind==="a2a"?"A2A":"Activepieces",u=a.locality==="loopback"?s("\u672C\u673A","Loopback"):a.host?.includes(":")&&!a.host.startsWith("[")?`[${a.host}]`:a.host;r=a.host&&u?`${l} \xB7 ${u}${a.port?`:${a.port}`:""}`:`${l} \xB7 ${s("\u7AEF\u70B9\u672A\u8BB0\u5F55","Endpoint not recorded")}`}let c={backend_run:s("\u6267\u884C\u56DE\u6267","Execution receipt"),target_snapshot:s("\u6D3E\u5355\u5FEB\u7167","Dispatch snapshot"),workflow_run:s("\u6D41\u7A0B\u8BB0\u5F55","Workflow record"),unrecorded:s("\u672A\u8BB0\u5F55","Not recorded")};return{service:r,serviceNote:i&&a?.kind!=="gateway_workflow"?s(`\u8FDE\u63A5\u522B\u540D ${i}`,`Connection alias ${i}`):void 0,serviceSource:a&&c[a.source]||c.unrecorded,connectionAlias:i}}function le(e,n="zh-CN"){let s=(u,p)=>n==="zh-CN"?u:p,a=s("\u672A\u8BB0\u5F55","Not recorded"),i={temporary:s("\u4E34\u65F6\u4EFB\u52A1","Temporary task"),resident:s("\u5E38\u9A7B\u89D2\u8272","Resident role"),workflow:s("\u5DE5\u4F5C\u6D41","Workflow"),unknown:a},r=e&&i[e.kind]||a,c=a,l;return e?.kind==="resident"||e?.kind==="workflow"?(c=e.targetName||e.roleId||a,e.kind==="resident"&&e.agentPreset&&(l=s(`\u9884\u8BBE ${e.agentPreset}`,`Preset ${e.agentPreset}`))):e?.agentPreset?c=e.agentPreset:e?.kind==="temporary"&&e.presetStatus==="host_default"&&(c=s("\u5BBF\u4E3B\u9ED8\u8BA4","Host default"),l=s("\u5B9E\u9645\u9884\u8BBE\u672A\u8BB0\u5F55","Effective preset not recorded")),{mode:r,role:c,roleNote:l,service:rt(e,n).service}}function bn(e){let n=/^#acp\/tasks(?:\/([^?]+))?(?:\?(.*))?$/.exec(e);if(!n)return null;try{let s=n[1]?decodeURIComponent(n[1]):void 0;if(s&&(s.length>512||/[\u0000-\u001f/]/.test(s)))return null;let a=new URLSearchParams(n[2]||""),i=a.get("review")||void 0;return i&&(i.length>512||/[\u0000-\u001f]/.test(i))?null:{jobId:s,reviewId:i,full:!!s&&a.get("mode")!=="drawer"}}catch{return null}}function it(e){if(!e.jobId)return"#acp/tasks";let n=new URLSearchParams;return e.reviewId&&n.set("review",e.reviewId),e.full||n.set("mode","drawer"),`#acp/tasks/${encodeURIComponent(e.jobId)}${n.size?`?${n}`:""}`}function yn(e){let n=/^#acp\/cases(?:\/([^?]+))?(?:\?(.*))?$/.exec(e);if(!n)return null;try{let s=n[1]?decodeURIComponent(n[1]):void 0;if(s&&(s.length>512||/[\u0000-\u001f/]/.test(s)))return null;let a=new URLSearchParams(n[2]||"").get("origin")||void 0;return a&&(a.length>512||/[\u0000-\u001f]/.test(a))?null:{caseId:s,originSessionId:a}}catch{return null}}function wn(e){if(!e.caseId)return"#acp/cases";let n=new URLSearchParams;return e.originSessionId&&n.set("origin",e.originSessionId),`#acp/cases/${encodeURIComponent(e.caseId)}${n.size?`?${n}`:""}`}function Tt(e){return[...e].sort((n,s)=>s.createdAt.localeCompare(n.createdAt))[0]}function kn(e){if(e)try{let n=new URL(e);return["https:","http:"].includes(n.protocol)&&!n.username&&!n.password?n.href:void 0}catch{return}}function An(e,n){let s=new Map(n.map(c=>[c.jobId,c])),a=new Set([e.jobId]),i=e,r=0;for(;i.parentJobRef&&!a.has(i.parentJobRef.jobId);){let c=s.get(i.parentJobRef.jobId);if(!c)break;a.add(c.jobId),r++,i=c}return r}var ds=0;function t(e,n,s,a,i,r){n||(n={});var c,l,u=n;if("ref"in u)for(l in u={},n)l=="ref"?c=n[l]:u[l]=n[l];var p={type:e,props:u,key:s,ref:c,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--ds,__i:-1,__u:0,__source:i,__self:r};if(typeof e=="function"&&(c=e.defaultProps))for(l in c)u[l]===void 0&&(u[l]=c[l]);return E.vnode&&E.vnode(p),p}var B=navigator.language?.toLowerCase().startsWith("zh")?"zh-CN":"en",o=(e,n)=>B==="zh-CN"?e:n,de=e=>e instanceof Error?e.message:String(e),ve=e=>e.title||e.jobId,ct=e=>e==="trial"?o("\u8BD5\u8DD1","Trial"):e==="formal"?o("\u6B63\u5F0F","Formal"):o("\u4E34\u65F6","Temporary");function In(){let e=()=>bn(location.hash)??{full:!1},[n,s]=g(e);return R(()=>{let a=()=>s(e());return window.addEventListener("hashchange",a),()=>window.removeEventListener("hashchange",a)},[]),n}function z(e){location.hash=it(e)}function Rt(e){let s={not_started:["\u672A\u5F00\u59CB","Not started"],submitted:["\u5DF2\u63D0\u4EA4","Submitted"],working:["\u8FDB\u884C\u4E2D","Working"],completed:["\u5DF2\u5B8C\u6210","Completed"],failed:["\u5931\u8D25","Failed"],canceled:["\u5DF2\u53D6\u6D88","Canceled"],rejected:["\u5DF2\u62D2\u7EDD","Rejected"],unknown:["\u5F85\u6838\u5B9E","Unknown"],input_required:["\u9700\u8981\u5904\u7406","Needs input"],auth_required:["\u9700\u8981\u8BA4\u8BC1","Needs authentication"],waiting_human:["\u5F85\u4EBA\u5DE5\u786E\u8BA4","Awaiting review"],awaiting_human:["\u5F85\u4EBA\u5DE5\u786E\u8BA4","Awaiting review"],pending:["\u5F85\u786E\u8BA4","Pending"],approved:["\u5DF2\u901A\u8FC7","Approved"],changes_requested:["\u8981\u6C42\u4FEE\u6539","Changes requested"],superseded:["\u5DF2\u88AB\u66FF\u4EE3","Superseded"],awaiting_validation:["\u7B49\u5F85\u6821\u9A8C","Awaiting validation"],processing:["\u6B63\u5728\u7EED\u8DD1","Resuming"],resuming:["\u7B49\u5F85\u7EED\u8DD1","Waiting to resume"],applied:["\u5DF2\u5904\u7406","Applied"],tool_blocked:["\u5DE5\u5177\u672A\u83B7\u6279\u51C6","Tool not approved"],unwatched:["\u53D1\u8D77\u65B9\u5DF2\u505C\u6B62\u7B49\u5F85","Caller stopped waiting"],accepted:["\u5DF2\u9A8C\u6536","Accepted"],acceptance_changes:["\u9A8C\u6536\u8981\u6C42\u4FEE\u6539","Acceptance: changes requested"]}[e];return s?o(...s):e}function xn(e){let s={"job.created":["\u4EFB\u52A1\u521B\u5EFA","Task created"],"job.migrated":["\u5386\u53F2\u4EFB\u52A1\u8FC1\u5165","Imported from earlier record"],"job.acceptance_recorded":["\u4E1A\u52A1\u9A8C\u6536\u5DF2\u8BB0\u5F55","Business acceptance recorded"],"attempt.prepared":["\u65B0\u4E00\u8F6E\u6267\u884C\u5DF2\u51C6\u5907","New attempt prepared"],"attempt.dispatching":["\u6B63\u5728\u6D3E\u53D1\u7ED9\u6267\u884C\u7AEF","Dispatching to the executor"],"attempt.accepted":["\u6267\u884C\u7AEF\u5DF2\u63A5\u6536\u4EFB\u52A1","Executor accepted the task"],"attempt.submission_failed":["\u6D3E\u53D1\u5931\u8D25","Dispatch failed"],"attempt.submission_unknown":["\u6D3E\u53D1\u7ED3\u679C\u5F85\u6838\u5B9E","Dispatch result needs verification"],"attempt.state_changed":["\u6267\u884C\u72B6\u6001\u53D8\u5316","Execution status changed"],"attempt.result_updated":["\u6267\u884C\u7ED3\u679C\u66F4\u65B0","Result updated"],"attempt.observation_conflict":["\u72B6\u6001\u89C2\u6D4B\u51B2\u7A81","Conflicting status observation"],"attempt.cancellation_requested":["\u5DF2\u8BF7\u6C42\u53D6\u6D88","Cancellation requested"],"human_review.comment":["\u4EBA\u5DE5\u5BA1\u6838\uFF1A\u5DF2\u7559\u8A00","Review: comment added"],"human_review.approve":["\u4EBA\u5DE5\u5BA1\u6838\uFF1A\u5DF2\u901A\u8FC7","Review: approved"],"human_review.changes_requested":["\u4EBA\u5DE5\u5BA1\u6838\uFF1A\u8981\u6C42\u4FEE\u6539","Review: changes requested"],"human_review.cancel":["\u4EBA\u5DE5\u5BA1\u6838\uFF1A\u5DF2\u53D6\u6D88\u4EFB\u52A1","Review: task canceled"],"process.opened":["\u8FC7\u7A0B\u8BF7\u6C42\uFF1A\u7B49\u5F85\u5904\u7406","Process request opened"],"process.answered":["\u8FC7\u7A0B\u8BF7\u6C42\uFF1A\u5DF2\u5904\u7406","Process request answered"],"process.expired":["\u8FC7\u7A0B\u8BF7\u6C42\uFF1A\u5DF2\u8FC7\u671F","Process request expired"]}[e];return s?o(...s):e}function Cn(e){let n={research:["\u4E34\u65F6\u667A\u80FD\u4F53\u5206\u6790","Project analysis"],file_check:["\u62A5\u544A\u6587\u4EF6\u68C0\u67E5","Report file check"],summary:["\u6587\u7A3F\u751F\u6210","Writing"],project_script:["\u6587\u7A3F\u751F\u6210","Writing"],human_review:["\u4EBA\u5DE5\u5BA1\u6838","Human review"],human_resume:["\u7EED\u8DD1\u5904\u7406","Resuming workflow"],awaiting_human:["\u4EBA\u5DE5\u5BA1\u6838","Human review"],make:["\u8BBE\u8BA1\u5236\u4F5C","Production"],ppt_production:["\u8BBE\u8BA1\u5236\u4F5C","Production"],validate:["\u673A\u5668\u6821\u9A8C","Validation"],review:["\u72EC\u7ACB\u9A8C\u6536","Independent review"],independent_review:["\u72EC\u7ACB\u9A8C\u6536","Independent review"],finished:["\u4EA4\u4ED8\u5B8C\u6210","Delivered"],waiting_children:["\u7B49\u5F85\u6267\u884C\u7ED3\u679C","Waiting for execution"]};return n[e]?o(...n[e]):e}function St(e){return e.displayStatus||(e.pendingReviewId?"waiting_human":e.executionStatus)}function Q({value:e}){return t("span",{class:`acp-status acp-status-${e.replace(/[^a-z_]/gi,"")}`,children:Rt(e)})}function Re(e){let n=St(e),s=e.businessAcceptance?.reviewStatus;return n!=="completed"?n:s==="accepted"?"accepted":s==="changes_requested"?"acceptance_changes":n}function H(e){if(!e)return"\u2014";let n=new Date(e);return Number.isNaN(n.getTime())?e:n.toLocaleString(B,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function Pt(e){if(e===void 0)return"\u2014";let n=Math.floor(e/6e4);return n<60?o(`${n} \u5206\u949F`,`${n} min`):o(`${Math.floor(n/60)} \u5C0F\u65F6 ${n%60} \u5206\u949F`,`${Math.floor(n/60)} h ${n%60} min`)}function us(e){return e.replace(/```[^\n]*\n?/g," ").replace(/^\s*\|?[\s:|-]+\|[\s:|-]*$/gm," ").replace(/!?\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/^\s{0,3}(#{1,6}|>|[-*+]|\d+\.)\s+/gm,"").replace(/[|*_`~]/g," ")}function Tn(e){let n=Array.from(us(e||"").replace(/\s+/g," ").trim());return n.length>50?`${n.slice(0,49).join("")}\u2026`:n.join("")||"\u2014"}function Fe({execution:e}){let n=le(e,B);return t("span",{class:"acp-execution-role",title:[n.role,n.roleNote].filter(Boolean).join(" \xB7 "),children:[t("span",{children:n.role}),n.roleNote&&t("small",{children:n.roleNote})]})}function Se({execution:e}){let n=rt(e,B);return t("span",{class:"acp-execution-service",title:[n.service,n.serviceNote].filter(Boolean).join(" \xB7 "),children:[t("span",{children:n.service}),n.serviceNote&&t("small",{children:n.serviceNote})]})}function Et({execution:e}){let n=rt(e,B);return t(T,{children:[t("dt",{children:o("\u670D\u52A1\u6765\u6E90\u4F9D\u636E","Service evidence")}),t("dd",{children:n.serviceSource}),n.connectionAlias&&t(T,{children:[t("dt",{children:o("\u914D\u7F6E\u8FDE\u63A5\u522B\u540D","Configured connection alias")}),t("dd",{children:n.connectionAlias})]})]})}function Pe({title:e,description:n}){return t("div",{class:"acp-empty",children:[t("strong",{children:e}),n&&t("p",{children:n})]})}function ue({title:e,message:n,onRetry:s}){return t("div",{class:"acp-error",role:"alert",children:[t("strong",{children:e}),t("p",{children:n}),s&&t("button",{type:"button",class:"acp-button",onClick:s,children:o("\u91CD\u8BD5","Retry")})]})}var ps={developing:[],published:[]};function Rn(e){if(e instanceof G){if(e.code==="conflict")return o("\u8FD9\u4E2A\u540D\u5B57\u5DF2\u7ECF\u5728\u7528","That name is already in use");if(e.code==="not_found")return o("\u627E\u4E0D\u5230\u8FD9\u4EFD\u5F00\u53D1\u8349\u7A3F","Draft not found");if(e.code==="invalid")return o("\u8BBE\u7F6E\u683C\u5F0F\u4E0D\u6B63\u786E\u3002\u9009\u9879\u5199\u6210 id=value\uFF0C\u6A21\u578B\u9879\u53EF\u4EE5\u5199\u6210 model:id=value","Settings are not valid. Write options as id=value")}return e instanceof Error?e.message:String(e)}function fs(e){return e==="trial"?o("\u8BD5\u8DD1","Trial"):e==="formal"?o("\u6B63\u5F0F","Formal"):o("\u4E34\u65F6","Temporary")}function Sn(e){return e.map(n=>`${n.model&&n.id!=="model"?"model:":""}${n.id}=${n.value}`).join(`
|
|
2
|
+
`)}function ms(e){return e.split(`
|
|
3
|
+
`).map(n=>n.trim()).filter(Boolean).map(n=>{let s=!1,a=n;a.startsWith("model:")&&(s=!0,a=a.slice(6));let i=a.indexOf("="),r=i>0?a.slice(0,i).trim():"",c=i>0?a.slice(i+1).trim():"";if(!r||!c)throw new Error(o("\u6BCF\u4E00\u884C\u5199\u6210 id=value","Write each option as id=value"));return r==="model"&&(s=!0),{id:r,value:c,...s?{model:!0}:{}}})}function gs(e,n){return n==="developing"?e.developing:e.published}function En({refreshKey:e,onOpenTask:n}){let[s,a]=g(0),[i,r]=g("developing"),[c,l]=g(ps),[u,p]=g([]),[f,d]=g(""),[h,_]=g(!1),[C,m]=g(!1),[x,y]=g(""),[w,S]=g("grok-build"),[k,v]=g("acp"),[L,O]=g("standard"),[X,N]=g(""),[K,ye]=g(""),[Ee,je]=g(!0),[ee,te]=g(""),[pe,ae]=g(""),[fe,we]=g(!1),[ke,ne]=g(""),[$,re]=g("grok-build"),[me,P]=g(""),[ie,q]=g(""),[Ae,Ie]=g(""),[xe,se]=g(""),[ge,he]=g(""),[Be,qe]=g(!1);R(()=>{let b=!1;return je(!0),(async()=>{try{let[F,$e]=await Promise.all([U.listAgents(),U.list("all",0,100)]);if(b)return;l(F),p($e.items),te("")}catch(F){b||te(Rn(F))}finally{b||je(!1)}})(),()=>{b=!0}},[e,s]);let A=gs(c,i),V=c.connections??[],Z=K||V[0]?.connectionId||"",I=[...c.developing,...c.published].find(b=>b.agentId===f),Qn=I?[I.agentId,I.modeId,I.targetId,I.roleId,I.acpAgent,Sn(I.options)].join("|"):"";R(()=>{I&&(ne(I.name),re(I.acpAgent||""),P(I.roleId||""),q(I.targetId||""),Ie(I.modeId||""),se(Sn(I.options)),he(I.releaseName||I.name),qe(!1))},[Qn]);let zt=()=>({name:ke.trim(),acpAgent:$.trim(),...me.trim()?{roleId:me.trim()}:{},...ie.trim()?{targetId:ie.trim()}:{},...Ae.trim()?{modeId:Ae.trim()}:{},...xe.trim()?{options:ms(xe)}:{}}),ze=async b=>{we(!0),ae(""),te("");try{await b()}catch(F){te(Rn(F))}finally{we(!1)}};return t("div",{class:"acp-agent-module",children:[t("p",{class:"acp-agent-note",children:o("\u53D1\u5E03\u51BB\u7ED3\u7684\u662F\u5DE5\u4F5C\u53F0\u91CC\u7684\u4E00\u884C\u540D\u5B57\u3002\u6267\u884C\u5BBF\u4E3B\u4ECD\u6309\u8BE5\u5DE5\u4F5C\u533A\u548C ACP Agent \u6700\u8FD1\u4E00\u6B21\u5DF2\u63A5\u53D7\u7684 ACP \u8BBE\u7F6E\u56DE\u653E\uFF0C\u53D1\u5E03\u7ED3\u679C\u5199\u8FDB\u5BBF\u4E3B\u7F13\u5B58\u8FD8\u6CA1\u63A5\u4E0A\u3002\u5BA1\u6838\u901A\u8FC7\u4E0D\u4F1A\u4E0A\u7EBF\u3002","Publishing freezes a workbench name. The execution host still replays the last accepted ACP settings for that workspace and ACP agent. Syncing a release into the host cache is not connected. Approving a review does not publish.")}),t("nav",{class:"acp-workbench-views","aria-label":o("\u667A\u80FD\u4F53\u9636\u6BB5","Agent phase"),children:[t("button",{type:"button","aria-pressed":i==="developing",onClick:()=>r("developing"),children:[o("\u5F00\u53D1\u4E2D","In development"),t("span",{children:c.developing.length})]}),t("button",{type:"button","aria-pressed":i==="published",onClick:()=>r("published"),children:[o("\u5DF2\u4E0A\u7EBF","Published"),t("span",{children:c.published.length})]})]}),ee&&t(ue,{title:o("\u667A\u80FD\u4F53\u8BFB\u53D6\u6216\u4FDD\u5B58\u5931\u8D25","Could not load or save agents"),message:ee,onRetry:()=>a(b=>b+1)}),Ee&&t("p",{class:"acp-muted",children:o("\u6B63\u5728\u8F7D\u5165\u2026","Loading\u2026")}),!Ee&&!ee&&!A.length&&!h&&!C&&t(Pe,{title:i==="developing"?o("\u8FD8\u6CA1\u6709\u5F00\u53D1\u4E2D\u7684\u667A\u80FD\u4F53","No agents in development"):o("\u8FD8\u6CA1\u6709\u5DF2\u4E0A\u7EBF\u7684\u540D\u5B57","No published names"),description:o("\u5E38\u9A7B\u89D2\u8272\u4F1A\u76F4\u63A5\u51FA\u73B0\u5728\u5DF2\u4E0A\u7EBF\u3002\u65B0\u7684\u8BD5\u8DD1\u4ECE\u5F00\u53D1\u4E2D\u7684\u8349\u7A3F\u5F00\u59CB\u3002","Resident roles appear under Published. A new trial starts from a developing draft.")}),t("div",{class:"acp-agent-layout",children:[t("div",{class:"acp-agent-list",children:[i==="developing"&&t(T,{children:[t("button",{type:"button",class:"acp-button",onClick:()=>{_(!0),m(!1),d(""),ne(""),re("grok-build"),P(""),q(""),Ie(""),se("")},children:o("\u65B0\u5EFA\u8349\u7A3F","New draft")}),t("button",{type:"button",class:"acp-button",onClick:()=>{m(!0),_(!1),d("")},children:o("\u6309\u8DEF\u5F84\u767B\u8BB0","Register a path")})]}),A.map(b=>t("button",{type:"button",class:`acp-agent-row${f===b.agentId?" is-selected":""}`,onClick:()=>{d(b.agentId),_(!1),m(!1)},children:[t("strong",{children:b.name}),t("small",{children:b.acpAgent||b.agentPreset||b.origin}),t("small",{children:[o("\u4EFB\u52A1","Tasks")," ",b.taskCount," \xB7 ",o("\u5F85\u786E\u8BA4","Waiting")," ",b.pendingCount]})]},b.agentId))]}),t("div",{class:"acp-agent-detail",children:[C&&t("form",{class:"acp-agent-form",onSubmit:b=>{b.preventDefault(),ze(async()=>{let F=X.trim(),$e=F.indexOf("/");if(k==="native"&&F&&$e<=0)throw new Error(o("\u6A21\u578B\u5199\u6210 provider/model\uFF0C\u4F8B\u5982 minimax-cn/MiniMax-M3.1-Flash","Write the model as provider/model"));let Ke=await U.registerAgentPath({path:x.trim(),connectionId:Z,...k==="acp"?{acpAgent:w.trim()}:{agentPreset:L.trim(),...F?{provider:F.slice(0,$e),model:F.slice($e+1)}:{}}});l(Ke),m(!1),r("developing"),d(Ke.registered[0]?.agentId??""),ae(o(`\u5DF2\u767B\u8BB0 ${Ke.registered.map(gt=>gt.name).join("\u3001")}\u3002\u6BCF\u4E2A\u90FD\u6709\u81EA\u5DF1\u7684\u6267\u884C\u76EE\u6807\uFF0C\u6D3E\u53D1\u65F6\u5BBF\u4E3B\u8BFB\u53D6 agent \u6587\u4EF6\u4F5C\u4E3A\u89D2\u8272\u8BF4\u660E\u3002`,`Registered ${Ke.registered.map(gt=>gt.name).join(", ")}. Each has its own target; the host reads the agent file as its role at dispatch.`))})},children:[t("h3",{children:o("\u6309\u8DEF\u5F84\u767B\u8BB0","Register a path")}),t("p",{class:"acp-muted",children:o("\u8BFB\u53D6\u8FD9\u4E2A\u76EE\u5F55\u4E0B\u7684 agents/*.md\uFF0C\u6BCF\u4E2A\u6587\u4EF6\u767B\u8BB0\u6210\u4E00\u4E2A\u5F00\u53D1\u4E2D\u7684\u667A\u80FD\u4F53\uFF0C\u540D\u5B57\u662F\u201C\u6587\u4EF6\u540D@\u8FD0\u884C\u65B9\u5F0F\u201D\uFF0C\u5DE5\u4F5C\u76EE\u5F55\u5C31\u662F\u8FD9\u4E2A\u76EE\u5F55\u3002\u540C\u4E00\u4E2A\u76EE\u5F55\u53EF\u4EE5\u5206\u522B\u767B\u8BB0 grok\u3001DSH \u539F\u751F\u7B49\u591A\u79CD\u8FD0\u884C\u65B9\u5F0F\uFF1B\u540C\u4E00\u79CD\u8FD0\u884C\u65B9\u5F0F\u518D\u767B\u8BB0\u4E00\u6B21\u4F1A\u66F4\u65B0\u539F\u6709\u8BB0\u5F55\u3002","Each agents/*.md under the directory becomes a developing agent named name@runtime that runs in that directory. One directory can be registered on several runtimes; registering the same runtime again updates its records.")}),t("label",{children:[o("\u76EE\u5F55\u8DEF\u5F84","Directory"),t("input",{value:x,placeholder:"/absolute/path/to/scenario",onInput:b=>y(b.currentTarget.value)})]}),t("label",{children:[o("\u8FD0\u884C\u65B9\u5F0F","Runtime"),t("select",{value:k,onChange:b=>v(b.currentTarget.value==="native"?"native":"acp"),children:[t("option",{value:"acp",children:o("ACP Agent","ACP agent")}),t("option",{value:"native",children:o("DSH \u539F\u751F\u9884\u8BBE","DSH-native preset")})]})]}),k==="acp"?t("label",{children:["ACP Agent",t("input",{value:w,placeholder:"grok-build",onInput:b=>S(b.currentTarget.value)})]}):t(T,{children:[t("label",{children:[o("\u9884\u8BBE","Preset"),t("input",{value:L,placeholder:"standard",onInput:b=>O(b.currentTarget.value)})]}),t("label",{children:[o("\u6A21\u578B\uFF08\u53EF\u9009\uFF09","Model (optional)"),t("input",{value:X,placeholder:"minimax-cn/MiniMax-M3.1-Flash",onInput:b=>N(b.currentTarget.value)})]})]}),t("label",{children:[o("\u6267\u884C\u8FDE\u63A5","Connection"),t("select",{value:Z,onChange:b=>ye(b.currentTarget.value),children:V.map(b=>t("option",{value:b.connectionId,children:[b.connectionId," \xB7 ",b.remote]},b.connectionId))})]}),t("button",{type:"submit",class:"acp-button",disabled:fe||!x.trim()||!Z||!(k==="acp"?w.trim():L.trim()),children:o("\u767B\u8BB0","Register")})]}),h&&t("form",{class:"acp-agent-form",onSubmit:b=>{b.preventDefault(),ze(async()=>{let F=await U.createAgent(zt());l(F),_(!1),d(F.draft.agentId),r("developing"),ae(o("\u8349\u7A3F\u5DF2\u4FDD\u5B58\u3002\u6D3E\u53D1\u4ECD\u4E0D\u4F1A\u8BFB\u53D6\u8FD9\u4EFD\u8349\u7A3F\uFF0C\u8981\u53D1\u5E03\u540E\u65B0\u4EFB\u52A1\u624D\u6302\u5230\u8FD9\u4E2A\u540D\u5B57\u3002","Draft saved. Dispatch does not read it until you publish, and new tasks then use that name."))})},children:[t("h3",{children:o("\u65B0\u5EFA\u5F00\u53D1\u8349\u7A3F","New developing draft")}),t(Pn,{name:ke,acpAgent:$,roleId:me,targetId:ie,modeId:Ae,optionText:xe,onName:ne,onAgent:re,onRole:P,onTarget:q,onMode:Ie,onOptions:se}),t("button",{type:"submit",class:"acp-button",disabled:fe||!ke.trim()||!$.trim(),children:o("\u4FDD\u5B58\u8349\u7A3F","Save draft")})]}),I&&!h&&!C&&t(T,{children:[t("h3",{children:I.name}),t("p",{class:"acp-muted",children:I.origin==="resident"?o("\u8FD9\u662F\u5DF2\u7ECF\u5728\u8DD1\u7684\u5E38\u9A7B\u89D2\u8272\uFF0C\u4E0D\u8981\u6C42\u5148\u8865\u4E00\u6B21\u8BD5\u8DD1\u3002","This resident role is already running. It does not require a prior trial."):I.origin==="release"?o("\u8FD9\u662F\u5DF2\u53D1\u5E03\u7684\u540D\u5B57\u3002\u4E4B\u540E\u518D\u6539 ACP \u8BBE\u7F6E\uFF0C\u53EA\u6539\u5F00\u53D1\u4E2D\u7684\u8349\u7A3F\u3002","This is a published name. Later ACP setting edits update the developing draft."):o("\u8FD9\u662F\u5F00\u53D1\u8349\u7A3F\u3002\u8BD5\u8DD1\u4EFB\u52A1\u4F1A\u6302\u5728\u8FD9\u91CC\u3002\u5BA1\u6838\u901A\u8FC7\u4E0D\u4F1A\u81EA\u52A8\u4E0A\u7EBF\u3002","This is a developing draft. Trial tasks attach here. A passed review does not publish it.")}),I.counterpartId&&t("button",{type:"button",class:"acp-link",onClick:()=>{let b=[...c.developing,...c.published].find(F=>F.agentId===I.counterpartId);b&&(r(b.phase),d(b.agentId))},children:I.phase==="developing"?o("\u67E5\u770B\u5DF2\u4E0A\u7EBF\u7684\u540D\u5B57","Open the published name"):o("\u67E5\u770B\u5F00\u53D1\u4E2D\u7684\u8349\u7A3F","Open the developing draft")}),t("dl",{class:"acp-agent-facts",children:[t("div",{children:[t("dt",{children:"ACP Agent"}),t("dd",{children:I.acpAgent||"\u2014"})]}),I.origin!=="resident"&&I.agentPreset&&t("div",{children:[t("dt",{children:o("\u9884\u8BBE","Preset")}),t("dd",{children:I.agentPreset})]}),I.provider&&t("div",{children:[t("dt",{children:o("\u6A21\u578B","Model")}),t("dd",{children:[I.provider,"/",I.model]})]}),t("div",{children:[t("dt",{children:o("\u6A21\u5F0F","Mode")}),t("dd",{children:I.modeId||"\u2014"})]}),t("div",{children:[t("dt",{children:o("\u6267\u884C\u76EE\u6807","Target")}),t("dd",{children:I.targetId||"\u2014"})]}),t("div",{children:[t("dt",{children:o("\u89D2\u8272","Role")}),t("dd",{children:I.roleId||"\u2014"})]}),I.source&&t("div",{children:[t("dt",{children:o("\u6765\u6E90","Source")}),t("dd",{children:I.source.file})]})]}),I.description&&t("p",{children:I.description}),I.options.length>0&&t("ul",{children:I.options.map(b=>t("li",{children:[b.id,"=",b.value]},b.id))}),t("h4",{children:o("\u540D\u4E0B\u4EFB\u52A1","Tasks")}),u.filter(b=>b.agentId===I.agentId).length===0&&t("p",{class:"acp-muted",children:o("\u8FD8\u6CA1\u6709\u6302\u5230\u8FD9\u6761\u8BB0\u5F55\u4E0A\u7684\u4EFB\u52A1\u3002","No tasks are attached to this record yet.")}),t("ul",{children:u.filter(b=>b.agentId===I.agentId).map(b=>t("li",{children:t("button",{type:"button",class:"acp-link",onClick:()=>n(b.jobId),children:[fs(b.channel)," \xB7 ",b.title||b.jobId]})},b.jobId))}),I.origin==="draft"&&t("form",{class:"acp-agent-form",onSubmit:b=>{b.preventDefault(),ze(async()=>{let F=await U.updateAgent(I.agentId,zt());l(F),ae(o("\u8349\u7A3F\u5DF2\u66F4\u65B0\u3002\u6B63\u5728\u8DD1\u7684\u53D1\u5E03\u540D\u5B57\u6CA1\u6709\u53D8\u3002","Draft updated. The published name stays as it was."))})},children:[t("h4",{children:o("\u4FEE\u6539\u8349\u7A3F","Edit draft")}),t(Pn,{name:ke,acpAgent:$,roleId:me,targetId:ie,modeId:Ae,optionText:xe,onName:ne,onAgent:re,onRole:P,onTarget:q,onMode:Ie,onOptions:se}),t("small",{children:o("\u9009\u9879\u7559\u7A7A\u8868\u793A\u4E0D\u4FEE\u6539\u3002\u6A21\u578B\u9879\u5199 model=\u503C\uFF0C\u6216 model:\u9009\u9879id=\u503C\u3002","Leave options blank to keep them. Write a model as model=value, or model:id=value.")}),t("button",{type:"submit",class:"acp-button",disabled:fe,children:o("\u4FDD\u5B58\u4FEE\u6539","Save changes")})]}),I.origin==="draft"&&t("form",{class:"acp-agent-form",onSubmit:b=>{b.preventDefault(),ze(async()=>{let F=await U.publishAgent(I.agentId,{releaseName:ge.trim(),...Be?{replace:!0}:{}});l(F),r("published"),d(`release:${ge.trim()}`),ae(o("\u540D\u5B57\u5DF2\u53D1\u5E03\u3002\u65B0\u7684\u6B63\u5F0F\u4EFB\u52A1\u4F1A\u6302\u5230\u8FD9\u4E2A\u540D\u5B57\u3002\u5BBF\u4E3B\u56DE\u653E\u4ECD\u7528\u8BE5\u5DE5\u4F5C\u533A\u6700\u8FD1\u4E00\u6B21 ACP \u8BBE\u7F6E\u3002","Name published. New formal tasks use it. Host replay still uses the latest ACP settings for that workspace."))})},children:[t("h4",{children:o("\u53D1\u5E03\u4E00\u884C\u540D\u5B57","Publish a name")}),t("label",{children:[o("\u540D\u5B57","Name"),t("input",{value:ge,onInput:b=>he(b.currentTarget.value)})]}),t("label",{children:[t("input",{type:"checkbox",checked:Be,onChange:b=>qe(b.currentTarget.checked)}),o("\u8986\u76D6\u540C\u540D\u7684\u5DF2\u53D1\u5E03\u8BB0\u5F55","Replace the published record with this name")]}),t("button",{type:"submit",class:"acp-button",disabled:fe||!ge.trim(),children:o("\u53D1\u5E03","Publish")})]}),pe&&t("p",{children:pe})]})]})]})]})}function Pn(e){return t(T,{children:[t("label",{children:[o("\u540D\u79F0","Name"),t("input",{value:e.name,onInput:n=>e.onName(n.currentTarget.value)})]}),t("label",{children:["ACP Agent",t("input",{value:e.acpAgent,placeholder:"grok-build",onInput:n=>e.onAgent(n.currentTarget.value)})]}),t("label",{children:[o("\u89D2\u8272 ID","Role ID"),t("input",{value:e.roleId,onInput:n=>e.onRole(n.currentTarget.value)})]}),t("label",{children:[o("\u6267\u884C\u76EE\u6807 ID","Target ID"),t("input",{value:e.targetId,onInput:n=>e.onTarget(n.currentTarget.value)})]}),t("label",{children:["modeId",t("input",{value:e.modeId,placeholder:"mode id",onInput:n=>e.onMode(n.currentTarget.value)})]}),t("label",{children:[o("ACP \u9009\u9879","ACP options"),t("textarea",{rows:4,value:e.optionText,placeholder:`model=grok-2
|
|
4
|
+
reasoningEffort=high`,onInput:n=>e.onOptions(n.currentTarget.value)})]})]})}function jn(e){let n=e.trim();if(!n)return e;let s=c=>{if(c==null)return c;let l=c;if(typeof c=="string"){let u=c.trim();try{let p=JSON.parse(u);p!==null&&typeof p=="object"&&!Array.isArray(p)&&(l=p)}catch{}}if(typeof l=="object"&&l!==null&&!Array.isArray(l)){let u=l,p=["content","content_concise","raw_output","output_for_prompt","formatted_output","output"];for(let f of p)if(f in u&&u[f]!==void 0&&u[f]!==null)return u[f]}return c},a=c=>{let l=s(c);if(l==null)return"";if(typeof l=="object")return JSON.stringify(l,null,2);if(typeof l=="string"){let u=l.trim();try{let p=JSON.parse(u);if(p!==null&&typeof p=="object")return JSON.stringify(p,null,2)}catch{}return l}return String(l)},i=c=>{try{let l=JSON.parse(c);if(l!==null&&typeof l=="object"){if(!Array.isArray(l)){let u={GrepSearch:["file_matches"],ReadFile:["FileContent","content","content_concise","raw_output"]};if(typeof l.type=="string"&&l.type in u){let f=u[l.type];for(let d of f)if(d in l&&l[d]!==void 0&&l[d]!==null)return a(l[d])}let p=["output_for_prompt","formatted_output","FileContent","content","content_concise","raw_output","output"];for(let f of p)if(f in l&&l[f]!==void 0&&l[f]!==null)return a(l[f])}return JSON.stringify(l,null,2)}return null}catch{return null}},r=i(n);if(r!==null)return r;if(n.startsWith('"')&&n.endsWith('"')||n.startsWith("'")&&n.endsWith("'"))try{let c=JSON.parse(n);if(typeof c=="string"){let l=i(c.trim());if(l!==null)return l}}catch{}return e}function $n(e,n,s=3){let a=e===void 0||e===""?[]:e.split(`
|
|
5
|
+
`),i=n.split(`
|
|
6
|
+
`),r=0;for(;r<a.length&&r<i.length&&a[r]===i[r];)r++;let c=a.length,l=i.length;for(;c>r&&l>r&&a[c-1]===i[l-1];)c--,l--;let u=a.slice(Math.max(0,r-s),r).map(f=>({type:"ctx",text:f})),p=a.slice(c,c+s).map(f=>({type:"ctx",text:f}));return[...u,...a.slice(r,c).map(f=>({type:"del",text:f})),...i.slice(r,l).map(f=>({type:"add",text:f})),...p]}function Dn(e,n=",",s=2e3){let a=[],i=[],r="",c=!1,l=()=>{i.push(r),r="",a.push(i),i=[]};for(let u=0;u<e.length;u++){let p=e[u];if(c)p==='"'?e[u+1]==='"'?(r+='"',u++):c=!1:r+=p;else if(p==='"'&&r==="")c=!0;else if(p===n)i.push(r),r="";else if(p===`
|
|
7
|
+
`||p==="\r"){if(p==="\r"&&e[u+1]===`
|
|
8
|
+
`&&u++,l(),a.length>=s)return{rows:a,truncated:u<e.length-1}}else r+=p}return(r!==""||i.length)&&l(),{rows:a,truncated:!1}}var hs={md:"markdown",markdown:"markdown",mdx:"markdown",json:"json",jsonc:"json",jsonl:"code",ndjson:"code",csv:"csv",tsv:"csv",png:"image",jpg:"image",jpeg:"image",gif:"image",webp:"image",svg:"image",ico:"image",bmp:"image",avif:"image",mp4:"video",webm:"video",mov:"video",m4v:"video",mp3:"audio",wav:"audio",m4a:"audio",flac:"audio",aac:"audio",oga:"audio",ogg:"audio",pdf:"pdf",html:"html",htm:"html",txt:"text",log:"text",js:"code",jsx:"code",mjs:"code",cjs:"code",ts:"code",tsx:"code",css:"code",scss:"code",py:"code",go:"code",rs:"code",c:"code",h:"code",cpp:"code",hpp:"code",java:"code",rb:"code",php:"code",sh:"code",bash:"code",zsh:"code",yaml:"code",yml:"code",toml:"code",ini:"code",xml:"code",sql:"code",diff:"code",patch:"code",dockerfile:"code",env:"text",conf:"text",doc:"unsupported",docx:"unsupported",xls:"unsupported",xlsx:"unsupported",ppt:"unsupported",pptx:"unsupported",zip:"unsupported",gz:"unsupported",tar:"unsupported",bin:"unsupported"},vs=[["image/","image"],["video/","video"],["audio/","audio"],["application/pdf","pdf"],["text/html","html"],["text/markdown","markdown"],["text/csv","csv"],["application/json","json"],["text/","text"]],jt=e=>{let n=e.split(/[\\/]/).pop()||e,s=n.lastIndexOf(".");return s>0||s===0&&n.length>1?n.slice(s+1).toLowerCase():n.toLowerCase()};function Mn(e,n){let s=hs[jt(e)];if(s)return s;let a=(n||"").toLowerCase().split(";")[0].trim();for(let[i,r]of vs)if(a.startsWith(i))return r;return"unsupported"}var $t=e=>e==="markdown"||e==="code"||e==="json"||e==="csv"||e==="text";function Ln(e){if(!Number.isFinite(e)||e<0)return"";if(e<1024)return`${e} B`;let n=["KB","MB","GB"],s=e/1024,a=0;for(;s>=1024&&a<n.length-1;)s/=1024,a++;return`${s.toFixed(s<10?1:0)} ${n[a]}`}var Mt={json:()=>import("./chunk-P6TKKRKP.js"),bash:()=>import("./chunk-B2LIVH37.js"),python:()=>import("./chunk-7GIX43Y5.js"),javascript:()=>import("./chunk-Z3TCAKM5.js"),typescript:()=>import("./chunk-QOHUZGP4.js"),xml:()=>import("./chunk-YFVL4NJL.js"),css:()=>import("./chunk-NY7C662Z.js"),scss:()=>import("./chunk-S7C4HKEY.js"),yaml:()=>import("./chunk-HSAVC5GY.js"),go:()=>import("./chunk-YRFQENM4.js"),rust:()=>import("./chunk-TYAAT3GQ.js"),cpp:()=>import("./chunk-K43JDCBH.js"),c:()=>import("./chunk-O76WTHWP.js"),ini:()=>import("./chunk-CVQY7TNC.js"),sql:()=>import("./chunk-E253Y562.js"),dockerfile:()=>import("./chunk-BI6UHHQP.js"),markdown:()=>import("./chunk-PUQLANIM.js"),diff:()=>import("./chunk-S74PLMMS.js"),java:()=>import("./chunk-KT4DJNOR.js"),ruby:()=>import("./chunk-4N44QPL7.js"),php:()=>import("./chunk-CSEIBI5U.js")},_s={js:"javascript",jsx:"javascript",mjs:"javascript",cjs:"javascript",ts:"typescript",tsx:"typescript",py:"python",sh:"bash",zsh:"bash",shell:"bash",yml:"yaml",toml:"ini",conf:"ini",html:"xml",htm:"xml",rs:"rust",rb:"ruby",h:"c",hpp:"cpp",jsonc:"json",patch:"diff",md:"markdown",jsonl:"json",ndjson:"json"};function lt(e){let n=e.includes(".")||e.includes("/")?jt(e):e.toLowerCase(),s=_s[n]||n;return Object.hasOwn(Mt,s)?s:void 0}var Nn,Dt=new Map;async function bs(e){Nn??=import("./chunk-VSIWU7XA.js").then(s=>s.default);let n=await Nn;return Dt.has(e)||Dt.set(e,Mt[e]().then(s=>n.registerLanguage(e,s.default))),await Dt.get(e),n}async function Lt(e,n){let s=l=>l.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");if(!n||!Object.hasOwn(Mt,n))return e.split(`
|
|
9
|
+
`).map(s);let i=(await bs(n)).highlight(e,{language:n,ignoreIllegals:!0}).value,r=[],c=[];for(let l of i.split(`
|
|
10
|
+
`)){let u=c.join("")+l,p=/<span[^>]*>|<\/span>/g,f,d=[...c];for(;f=p.exec(l);)f[0]==="</span>"?d.pop():d.push(f[0]);u+="</span>".repeat(d.length),c=d,r.push(u)}return r}async function Fn(e,n){return(await Lt(e,n)).join(`
|
|
11
|
+
`)}var Un,Nt=e=>e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""");async function ys(){let[{Marked:e},n]=await Promise.all([import("./chunk-IZXOKUGG.js"),import("./chunk-KOUZX3UX.js")]),s=new e({gfm:!0,breaks:!1});s.use({async:!1,renderer:{code({text:i,lang:r}){let c=(r||"").trim().split(/\s+/)[0]||"";return c==="mermaid"?`<div class="fp-mermaid" data-mermaid="${encodeURIComponent(i)}"><pre>${Nt(i)}</pre></div>`:`<pre class="fp-md-code"><code class="hljs" data-lang="${Nt(c)}">${Nt(i)}</code></pre>`}}});let a=n.default;return{marked:s,purify:a}}async function _e(e,n={}){Un??=ys();let{marked:s,purify:a}=await Un,i=s.parse(e),r=new DOMParser().parseFromString(a.sanitize(i,{ADD_ATTR:["data-mermaid","data-lang"]}),"text/html");for(let c of r.querySelectorAll("a[href]")){let l=c.getAttribute("href")||"",u=n.resolveUrl?n.resolveUrl(l,"link"):l;if(u===void 0){c.removeAttribute("href");continue}c.setAttribute("href",u),/^(https?:)?\/\//i.test(u)&&(c.setAttribute("target","_blank"),c.setAttribute("rel","noopener noreferrer"))}for(let c of r.querySelectorAll("img[src]")){let l=n.resolveUrl?n.resolveUrl(c.getAttribute("src")||"","image"):c.getAttribute("src");l===void 0?c.remove():(c.setAttribute("src",l),c.setAttribute("loading","lazy"))}for(let c of r.querySelectorAll("code.hljs[data-lang]")){let l=lt(c.dataset.lang||"");l&&(c.innerHTML=await Fn(c.textContent||"",l))}return r.body.innerHTML}var Hn,On,ws=0;async function Ue(e,n="light"){let s=[...e.querySelectorAll(".fp-mermaid[data-mermaid]")].filter(i=>i.dataset.drawnTheme!==n);if(!s.length)return;Hn??=import("./chunk-Z6QR6FRE.js").then(i=>i.default);let a=await Hn;On!==n&&(a.initialize({startOnLoad:!1,securityLevel:"strict",theme:n==="dark"?"dark":"default"}),On=n);for(let i of s){let r="";try{r=decodeURIComponent(i.dataset.mermaid||"")}catch{continue}try{let{svg:c}=await a.render(`fp-mermaid-${++ws}`,r);i.innerHTML=c,i.dataset.drawnTheme=n}catch{i.classList.add("fp-mermaid-error"),i.textContent=r,i.dataset.drawnTheme=n}}}var ks={loading:"Loading\u2026",failed:"Could not load this file",open:"Open in new tab",unsupported:"No preview for this file type",truncated:"Showing the first part of a large file",noSource:"This file has no readable location",empty:"Empty file"},As=2*1024*1024;function Ft(e){try{let n=new URL(e,typeof location>"u"?"http://localhost":location.href);return(n.protocol==="http:"||n.protocol==="https:"||n.protocol==="blob:")&&!n.username&&!n.password}catch{return!1}}function Is(e,n,s,a,i){let[r,c]=g({status:"idle"});return R(()=>{if(!$t(e))return c({status:"idle"});if(s!==void 0){let u=s.length>a;return c({status:"ready",text:u?s.slice(0,a):s,truncated:u})}if(!n||!Ft(n))return c({status:"error",message:""});let l=new AbortController;return c({status:"loading"}),(async()=>{let u=await(i?i(n):fetch(n,{credentials:"same-origin",signal:l.signal}));if(!u.ok)throw new Error(`${u.status} ${u.statusText}`.trim());let p=await u.arrayBuffer(),f=p.byteLength>a;c({status:"ready",text:new TextDecoder().decode(f?p.slice(0,a):p),truncated:f})})().catch(u=>{l.signal.aborted||c({status:"error",message:u instanceof Error?u.message:String(u)})}),()=>l.abort()},[e,n,s,a,i]),r}function xs(e){return e||(typeof matchMedia=="function"&&matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light")}function Cs({text:e,theme:n,options:s,onOpenLink:a,diagrams:i}){let[r,c]=g(""),l=j(null);return R(()=>{let u=!0;return _e(e,s).then(p=>u&&c(p)).catch(()=>u&&c("")),()=>{u=!1}},[e,s]),R(()=>{i&&r&&l.current&&Ue(l.current,n)},[r,n,i]),t("div",{ref:l,class:"fp-md",dangerouslySetInnerHTML:{__html:r},onClick:u=>{let p=u.target.closest("a"),f=p?.getAttribute("href");if(!(!p||!f))if(f.startsWith("#")){u.preventDefault();let d=decodeURIComponent(f.slice(1));l.current?.querySelector(`[id="${d.replace(/"/g,'\\"')}"]`)?.scrollIntoView({behavior:"smooth"})}else a&&(u.preventDefault(),a(f))}})}function Ts({text:e,lang:n,targetLine:s}){let[a,i]=g(null),r=j(null);R(()=>{let u=!0;return i(null),Lt(e,n).then(p=>u&&i(p)).catch(()=>u&&i(e.split(`
|
|
12
|
+
`))),()=>{u=!1}},[e,n]),R(()=>{a&&s&&r.current?.scrollIntoView({block:"center"})},[a,s]);let c=Le(()=>e.split(`
|
|
13
|
+
`),[e]);return t("div",{class:"fp-code",role:"region","aria-label":"code",children:(a??c).map((u,p)=>t("div",{ref:s===p+1?r:void 0,class:`fp-code-row${s===p+1?" fp-code-target":""}`,children:[t("span",{class:"fp-code-no",children:p+1}),a?t("span",{class:"fp-code-text hljs",dangerouslySetInnerHTML:{__html:u||" "}}):t("span",{class:"fp-code-text",children:u||" "})]},p))})}function Rs({text:e,delimiter:n}){let{rows:s,truncated:a}=Le(()=>Dn(e,n),[e,n]);if(!s.length)return null;let[i,...r]=s;return t("div",{class:"fp-table-wrap",children:[t("table",{class:"fp-table",children:[t("thead",{children:t("tr",{children:i.map((c,l)=>t("th",{children:c},l))})}),t("tbody",{children:r.map((c,l)=>t("tr",{children:c.map((u,p)=>t("td",{children:u},p))},l))})]}),a&&t("p",{class:"fp-note",children:`Showing the first ${s.length} rows`})]})}function Ss(e){try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}function dt(e){let[n,s]=g(!1);R(()=>s(!1),[e.url]);let a={...ks,...e.labels},i=Mn(e.name,e.mediaType),r=xs(e.theme),c=e.url&&Ft(e.url)?e.url:void 0,l=Is(i,c,e.content,e.maxTextBytes??As,e.fetcher),u;if($t(i))if(l.status==="error")u=t("p",{class:"fp-note fp-error",role:"alert",children:[l.message||a.noSource,l.message?` \xB7 ${a.failed}`:""]});else if(l.status!=="ready")u=t("p",{class:"fp-note",role:"status",children:a.loading});else if(!l.text.trim())u=t("p",{class:"fp-note",children:a.empty});else{let p=i==="json"?Ss(l.text):l.text;u=t(T,{children:[i==="markdown"?t(Cs,{text:p,theme:r,options:e.markdown,onOpenLink:e.onOpenLink,diagrams:e.diagrams??!0}):i==="csv"?t(Rs,{text:p,delimiter:e.name.toLowerCase().endsWith(".tsv")?" ":","}):t(Ts,{text:p,lang:i==="json"?"json":i==="text"?void 0:lt(e.name),targetLine:e.targetLine}),l.truncated&&t("p",{class:"fp-note",children:a.truncated})]})}else c?n&&(i==="image"||i==="video"||i==="audio")?u=t("p",{class:"fp-note fp-error",role:"alert",children:a.failed}):i==="image"?u=t("div",{class:"fp-media",children:t("img",{src:c,alt:e.name,loading:"lazy",onError:()=>s(!0)})}):i==="video"?u=t("div",{class:"fp-media",children:t("video",{src:c,controls:!0,preload:"metadata",onError:()=>s(!0)})}):i==="audio"?u=t("div",{class:"fp-media",children:t("audio",{src:c,controls:!0,preload:"metadata",onError:()=>s(!0)})}):i==="pdf"?u=t("iframe",{class:"fp-frame",src:c,title:e.name}):i==="html"?u=t("iframe",{class:"fp-frame",src:c,title:e.name,sandbox:"",referrerpolicy:"no-referrer"}):u=t("p",{class:"fp-note",children:a.unsupported}):u=t("p",{class:"fp-note",children:i==="unsupported"?a.unsupported:a.noSource});return t("section",{class:`fp-root${e.class?` ${e.class}`:""}`,"data-fp-theme":r,"data-fp-kind":i,children:[!e.hideHeader&&t("header",{class:"fp-header",children:[t("strong",{class:"fp-name",title:e.path||e.name,children:e.name}),e.size!==void 0&&t("span",{class:"fp-size",children:Ln(e.size)}),c&&t("a",{class:"fp-open",href:c,target:"_blank",rel:"noopener noreferrer",children:a.open})]}),t("div",{class:"fp-body",children:u})]})}function ut({text:e,theme:n,onOpenFile:s,streaming:a,diagrams:i=!0}){let[r,c]=g(""),l=j(null);return R(()=>{let u=!0;return _e(e).then(p=>u&&c(p)).catch(()=>u&&c("")),()=>{u=!1}},[e]),R(()=>{i&&r&&!a&&l.current&&Ue(l.current,n)},[r,a,n,i]),t("div",{ref:l,class:"fp-md cv-md",dangerouslySetInnerHTML:{__html:r},onClick:u=>{let p=u.target.closest("a")?.getAttribute("href");if(!p||/^(https?:|mailto:|#)/i.test(p)||!s)return;u.preventDefault();let f=/^(.*?)(?::(\d+))?$/.exec(decodeURIComponent(p.split("#")[0]));s(f?.[1]||p,f?.[2]?Number(f[2]):void 0)}})}var Ps={empty:"No messages yet",loading:"Loading messages\u2026",loadEarlier:"Load earlier messages",loadingEarlier:"Loading\u2026",retry:"Retry",thinking:"Thinking",input:"Input",output:"Output",showMore:"Show all",allowed:"Allowed",denied:"Denied",waiting:"Waiting for an answer",plan:"Plan",you:"You",agent:"Agent"},pt=4e3;function He({label:e,children:n,open:s}){return t("details",{class:"cv-fold",open:s,children:[t("summary",{children:e}),n]})}function Oe({text:e,limit:n,labels:s}){let[a,i]=g(!1),r=!a&&e.length>n;return t(T,{children:[t("pre",{class:"cv-pre",children:r?e.slice(0,n):e}),r&&t("button",{type:"button",class:"cv-link",onClick:()=>i(!0),children:s.showMore})]})}function Es({path:e,oldText:n,newText:s,onOpenFile:a}){let i=$n(n,s);return t("div",{class:"cv-diff",children:[t("button",{type:"button",class:"cv-link cv-diff-path",onClick:()=>a?.(e),children:e}),t("pre",{class:"cv-pre",children:i.map((r,c)=>t("div",{class:`cv-diff-${r.type}`,children:[r.type==="add"?"+ ":r.type==="del"?"- ":" ",r.text]},c))})]})}function js(e){return e.isError||e.status==="failed"?"failed":e.status==="pending"||e.status==="in_progress"||e.status===void 0&&e.output===void 0?"running":"done"}function Ut({call:e,labels:n,onOpenFile:s}){let a=js(e),i=e.output===void 0?void 0:jn(e.output);return t("div",{class:`cv-tool cv-tool-${a}`,children:[t("div",{class:"cv-tool-head",children:[t("span",{class:"cv-dot","aria-hidden":"true"}),t("strong",{children:e.toolName}),e.kind&&t("span",{class:"cv-tag",children:e.kind}),e.locations?.map(r=>t("button",{type:"button",class:"cv-chip",onClick:()=>s?.(r.path,r.line),children:[r.path.split("/").pop(),r.line?`:${r.line}`:""]},`${r.path}:${r.line??""}`))]}),e.diffs?.map((r,c)=>t(Es,{...r,onOpenFile:s},c)),e.input&&e.input!=="{}"&&t(He,{label:n.input,children:t(Oe,{text:e.input,limit:pt,labels:n})}),i!==void 0&&i!==""&&t(He,{label:n.output,children:t(Oe,{text:i,limit:pt,labels:n})}),e.permission&&t("p",{class:"cv-note",children:e.permission.resolved==="allow"?n.allowed:e.permission.resolved==="deny"?n.denied:n.waiting})]})}function $s({item:e,results:n,theme:s,labels:a,onOpenFile:i,diagrams:r}){switch(e.kind){case"user":return t("div",{class:"cv-row cv-user",children:t("div",{class:"cv-bubble",children:t(Oe,{text:e.content,limit:2e4,labels:a})})});case"assistant_text":return t("div",{class:"cv-row cv-agent",children:t(ut,{diagrams:r,text:e.content,theme:s,streaming:e.streaming,onOpenFile:i})});case"thinking":return t("div",{class:"cv-row",children:t(He,{label:a.thinking,children:t(Oe,{text:e.content,limit:pt,labels:a})})});case"tool_use":{let c=e.calls.length?e.calls:[{toolName:e.toolName,input:e.input,toolCallId:e.toolCallId}];return t("div",{class:"cv-row",children:c.map((l,u)=>{let p=l.output===void 0&&l.toolCallId?n.get(l.toolCallId):void 0,f=p?{...l,output:p.content,isError:p.isError}:l;return t(Ut,{call:f,labels:a,onOpenFile:i},l.id||l.toolCallId||u)})})}case"tool_result":return t("div",{class:"cv-row",children:t(Ut,{call:{toolName:e.toolName||"tool",input:"",output:e.content,isError:e.isError},labels:a,onOpenFile:i})});case"permission_request":return t("div",{class:"cv-row",children:t("div",{class:"cv-tool",children:[t("div",{class:"cv-tool-head",children:t("strong",{children:e.toolName})}),t("p",{class:"cv-note",children:e.resolved==="allow"?a.allowed:e.resolved==="deny"?a.denied:a.waiting})]})});case"ask_user_question":return t("div",{class:"cv-row",children:t("div",{class:"cv-tool",children:[e.questions.map((c,l)=>t("div",{children:[t("strong",{children:[c.header?`${c.header} \xB7 `:"",c.question]}),c.options&&t("ul",{class:"cv-options",children:c.options.map(u=>t("li",{children:[u.label,u.description?` \u2014 ${u.description}`:""]},u.label))})]},l)),e.resolved===void 0&&t("p",{class:"cv-note",children:a.waiting})]})});case"exit_plan_mode":return t("div",{class:"cv-row",children:t(He,{label:a.plan,open:!0,children:t(ut,{diagrams:r,text:e.planContent,theme:s,onOpenFile:i})})});case"error":return t("div",{class:"cv-row",children:t("p",{class:"cv-error",role:"alert",children:e.content})});case"turn_receipt":return t("div",{class:"cv-row",children:t("p",{class:`cv-receipt cv-receipt-${e.status}`,children:e.content})});case"subagent_turn":return t("div",{class:"cv-row",children:t(He,{label:e.label,children:[e.thinking&&t(Oe,{text:e.thinking,limit:pt,labels:a}),e.calls.map((c,l)=>t(Ut,{call:c,labels:a,onOpenFile:i},l)),e.output&&t(ut,{diagrams:r,text:e.output,theme:s,streaming:e.streaming,onOpenFile:i})]})});default:return null}}function Ht(e){let n={...Ps,...e.labels},s=e.theme??(typeof matchMedia=="function"&&matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),a=j(null),i=j(null),r=j(!0),c=j({height:0,firstId:"",count:0}),l=new Map;for(let f of e.items)f.kind==="tool_result"&&f.toolCallId&&l.set(f.toolCallId,f);let u=new Set(e.items.flatMap(f=>f.kind==="tool_use"?f.calls.filter(d=>d.output===void 0&&d.toolCallId&&l.has(d.toolCallId)).map(d=>d.toolCallId):[])),p=e.items.filter(f=>!(f.kind==="tool_result"&&f.toolCallId&&u.has(f.toolCallId)));return vn(()=>{let f=a.current;if(!f)return;let d=c.current;d.firstId!==""&&e.items.length>d.count&&e.items[0]?.id!==d.firstId?f.scrollTop+=f.scrollHeight-d.height:(e.stickToBottom??!0)&&r.current&&(f.scrollTop=f.scrollHeight),c.current={height:f.scrollHeight,firstId:e.items[0]?.id??"",count:e.items.length}},[e.items]),R(()=>{let f=i.current,d=a.current;if(!f||!d||!e.hasMore||e.loadingMore||!e.onLoadMore||typeof IntersectionObserver>"u")return;let h=new IntersectionObserver(_=>{_.some(C=>C.isIntersecting)&&e.onLoadMore?.()},{root:d,rootMargin:"200px 0px 0px 0px"});return h.observe(f),()=>h.disconnect()},[e.hasMore,e.loadingMore,e.onLoadMore,e.items.length]),t("div",{ref:a,class:`cv-root${e.class?` ${e.class}`:""}`,"data-fp-theme":s,onScroll:f=>{let d=f.currentTarget;r.current=d.scrollHeight-d.scrollTop-d.clientHeight<80},children:[t("div",{ref:i}),e.hasMore&&t("button",{type:"button",class:"cv-more",disabled:e.loadingMore,onClick:e.onLoadMore,children:e.loadingMore?n.loadingEarlier:n.loadEarlier}),e.loading&&t("p",{class:"cv-note",role:"status",children:n.loading}),e.error&&t("p",{class:"cv-error",role:"alert",children:[e.error," ",e.onRetry&&t("button",{type:"button",class:"cv-link",onClick:e.onRetry,children:n.retry})]}),!e.loading&&!e.error&&p.length===0&&t("p",{class:"cv-note",children:n.empty}),p.map(f=>t($s,{item:f,results:l,theme:s,labels:n,onOpenFile:e.onOpenFile,diagrams:e.diagrams??!0},f.id))]})}function Ot(e,{pageSize:n=40,enabled:s=!0}={}){let[a,i]=g([]),[r,c]=g({loading:!1,loadingMore:!1,hasMore:!1,error:void 0}),l=j(void 0),u=j(),p=j(0),f=j(!1),d=J(C=>{if(f.current)return;f.current=!0;let m=p.current;u.current=new AbortController,c(x=>({...x,error:void 0,loading:C,loadingMore:!C})),e(C?void 0:l.current,n,u.current.signal).then(x=>{m===p.current&&(l.current=x.nextCursor,i(y=>{if(C)return x.items;let w=new Set(y.map(S=>S.id));return[...x.items.filter(S=>!w.has(S.id)),...y]}),c({loading:!1,loadingMore:!1,hasMore:x.hasMore,error:void 0}))}).catch(x=>{m===p.current&&c(y=>({...y,loading:!1,loadingMore:!1,error:x instanceof Error?x.message:String(x)}))}).finally(()=>{m===p.current&&(f.current=!1)})},[e,n]),h=J(()=>{p.current++,u.current?.abort(),f.current=!1,l.current=void 0,i([]),d(!0)},[d]);R(()=>{if(s)return h(),()=>{p.current++,u.current?.abort(),f.current=!1}},[s,h]);let _=J(()=>{r.hasMore&&!f.current&&d(!1)},[r.hasMore,d]);return{items:a,...r,loadMore:_,reload:h}}var Wn=B==="zh-CN"?{loading:"\u6B63\u5728\u8BFB\u53D6\u2026",failed:"\u65E0\u6CD5\u8BFB\u53D6\u8BE5\u6587\u4EF6",open:"\u65B0\u7A97\u53E3\u6253\u5F00",unsupported:"\u6B64\u7C7B\u578B\u6587\u4EF6\u6682\u4E0D\u652F\u6301\u9884\u89C8",truncated:"\u6587\u4EF6\u8F83\u5927\uFF0C\u4EC5\u663E\u793A\u5F00\u5934\u90E8\u5206",noSource:"\u8BE5\u4EA7\u7269\u6CA1\u6709\u53EF\u8BFB\u53D6\u7684\u5730\u5740",empty:"\u7A7A\u6587\u4EF6"}:void 0,Ds=B==="zh-CN"?{empty:"\u6682\u65E0\u5BF9\u8BDD\u5185\u5BB9",loading:"\u6B63\u5728\u8BFB\u53D6\u5BF9\u8BDD\u2026",loadEarlier:"\u52A0\u8F7D\u66F4\u65E9\u7684\u5BF9\u8BDD",loadingEarlier:"\u52A0\u8F7D\u4E2D\u2026",retry:"\u91CD\u8BD5",thinking:"\u601D\u8003",input:"\u8F93\u5165",output:"\u8F93\u51FA",showMore:"\u663E\u793A\u5168\u90E8",allowed:"\u5DF2\u5141\u8BB8",denied:"\u5DF2\u62D2\u7EDD",waiting:"\u7B49\u5F85\u56DE\u7B54",plan:"\u8BA1\u5212",you:"\u4F60",agent:"\u667A\u80FD\u4F53"}:void 0;function Bn(e,n){let s=kn(n.url);if(s)return s;if(!(!n.sha256||!/^[a-f0-9]{64}$/.test(n.sha256)))return new URL(`/workbench/ui/api/tasks/${encodeURIComponent(e)}/artifacts/${n.sha256}`,location.origin).href}function Wt(e,n,s){return new URL(`/workbench/ui/api/cases/${encodeURIComponent(e)}/handoffs/${encodeURIComponent(n)}/artifacts/${s}`,location.origin).href}function qn(e,n){return e.path?.split("/").pop()||(n?decodeURIComponent(new URL(n).pathname.split("/").pop()||""):"")||o("\u4EA7\u7269","Artifact")}function ft({jobId:e,artifact:n,active:s,onPreview:a}){let i=Bn(e,n),r=qn(n,i);return i?t("span",{class:"acp-artifact-row",children:[t("a",{href:i,target:"_blank",rel:"noopener noreferrer",children:r}),t("button",{type:"button",class:"acp-link","aria-pressed":s,onClick:()=>a(n),children:s?o("\u9884\u89C8\u4E2D","Previewing"):o("\u9884\u89C8","Preview")})]}):n.path?t("span",{class:"acp-muted",children:[r," \xB7 ",t("code",{children:n.path})]}):null}function mt({jobId:e,artifact:n,onClose:s}){let a=Bn(e,n),i=qn(n,a),r=j(null);return R(()=>{r.current?.focus({preventScroll:!0});let c=l=>{l.key==="Escape"&&(l.stopPropagation(),s())};return document.addEventListener("keydown",c,!0),()=>document.removeEventListener("keydown",c,!0)},[s]),t("section",{class:"acp-artifact-drawer",role:"dialog","aria-label":i,children:[t("header",{class:"acp-artifact-drawer-header",children:[t("div",{children:[t("strong",{children:i}),n.path&&t("small",{title:n.path,children:n.path})]}),a&&t("a",{class:"acp-button",href:a,target:"_blank",rel:"noopener noreferrer",children:o("\u65B0\u7A97\u53E3\u6253\u5F00","Open in new tab")}),t("button",{type:"button",class:"acp-button",ref:r,onClick:s,children:o("\u5173\u95ED","Close")})]}),t("div",{class:"acp-artifact-drawer-body",children:a?t(dt,{name:i,path:n.path,url:a,mediaType:n.mediaType,diagrams:!1,hideHeader:!0,labels:Wn},a):t("p",{class:"acp-muted",children:o("\u8BE5\u4EA7\u7269\u6CA1\u6709\u53EF\u8BFB\u53D6\u7684\u5730\u5740","This artifact has no readable address")})})]})}function zn({markdown:e,path:n}){return t(dt,{name:n?.split("/").pop()||"report.md",path:n,content:e,diagrams:!1,hideHeader:!0,labels:Wn})}function Kn({jobId:e,onOpenFile:n}){let s=J(async(i,r)=>{let c=await U.chat(e,i===void 0?void 0:Number(i),r);return{items:c.items,hasMore:c.hasMore,nextCursor:c.nextCursor}},[e]),a=Ot(s,{pageSize:40});return t("div",{class:"acp-chat",children:t(Ht,{items:a.items,loading:a.loading,loadingMore:a.loadingMore,hasMore:a.hasMore,error:a.error,onLoadMore:a.loadMore,onRetry:a.reload,diagrams:!1,labels:Ds,onOpenFile:n})})}function be({source:e,class:n,onOpenFile:s}){let[a,i]=g("");return R(()=>{let r=!0;return _e(e).then(c=>r&&i(c)).catch(()=>r&&i("")),()=>{r=!1}},[e]),a?t("div",{class:`fp-md acp-md${n?` ${n}`:""}`,dangerouslySetInnerHTML:{__html:a},onClick:r=>{let c=r.target.closest("a")?.getAttribute("href");!c||/^(https?:|mailto:|#)/i.test(c)||!s||(r.preventDefault(),s(decodeURIComponent(c.split("#")[0]).replace(/:\d+$/,"")))}}):t("p",{class:n,children:e})}function Ms(){let e=()=>yn(location.hash)??{},[n,s]=g(e);return R(()=>{let a=()=>s(e());return window.addEventListener("hashchange",a),()=>window.removeEventListener("hashchange",a)},[]),n}function Vn(e,n){location.hash=wn({caseId:e,originSessionId:n})}function Ls(e){return e==="page"?o("\uFF08\u7F51\u5173\u9875\u9762\uFF09"," (gateway page)"):e==="relay"?o("\uFF08\u5BBF\u4E3B\u8F6C\u53D1\uFF0C\u672A\u6838\u9A8C\u70B9\u51FB\uFF09"," (relayed, click unverified)"):""}var Ns={proposed:["\u63D0\u8BAE","Proposed"],accepted:["\u5DF2\u63A5\u53D7\uFF0C\u5F85\u5F00\u4E0B\u4E00\u5355","Accepted, not opened yet"],taken:["\u5DF2\u4EA4\u63A5","Handed over"],rejected:["\u5DF2\u62D2\u7EDD","Rejected"]};function Fs({edge:e,caseId:n,onDecide:s,busy:a,onPreview:i}){let r=Ns[e.status];return t("li",{class:`acp-case-edge${e.happened?" is-happened":" is-proposed"}`,children:[t("span",{class:"acp-case-edge-line","aria-hidden":"true"}),t("div",{children:[t("strong",{children:[o(r[0],r[1])," \xB7 ",e.toTargetId," / ",e.purpose]}),t("small",{class:"acp-muted",children:[e.reason," \xB7 ",o("\u7248\u672C","revision")," ",e.artifactRevision," \xB7 ",e.artifactDigest.slice(0,12)]}),e.decidedBy&&t("small",{class:"acp-muted",children:[o("\u51B3\u5B9A\u4EBA","Decided by")," ",e.decidedBy.kind==="person"?e.decidedBy.id||o("\u672C\u673A\u7528\u6237","Local user"):e.decidedBy.agent||e.decidedBy.sessionId,Ls(e.decidedBy.via)]}),e.snapshots?.length?t("span",{class:"acp-artifact-row",children:[t("small",{class:"acp-muted",children:o("\u5DF2\u51BB\u7ED3","Frozen")}),e.snapshots.map(c=>t("a",{href:Wt(n,e.handoffId,c.digest),target:"_blank",rel:"noopener noreferrer",onClick:l=>{l.preventDefault(),i({url:Wt(n,e.handoffId,c.digest),name:c.name,mediaType:c.mediaType})},children:c.name},c.digest))]}):null]}),e.status==="proposed"&&t("div",{class:"acp-review-buttons",children:[t("button",{type:"button",class:"acp-button acp-primary",disabled:a,onClick:()=>s(e,"accept"),children:o("\u63A5\u53D7\u8FD9\u4E00\u7248","Accept this version")}),t("button",{type:"button",class:"acp-button",disabled:a,onClick:()=>s(e,"reject"),children:o("\u62D2\u7EDD","Reject")})]})]})}function Us({item:e,onOpen:n}){let s=e.kind==="review"?o("\u5BA1\u6838","Review"):e.kind==="process_request"?o("\u8FC7\u7A0B\u8BF7\u6C42","Request"):o("\u4EA4\u63A5\u63D0\u8BAE","Handoff");return t("li",{class:"acp-inbox-row",children:[t("span",{class:"acp-mode-label",children:s}),t("div",{children:[t("strong",{children:e.title}),t("small",{class:"acp-muted",children:[e.summary,e.revision?` \xB7 ${e.revision}`:""]})]}),e.kind==="handoff"?null:t("button",{type:"button",class:"acp-link",onClick:()=>n(e),children:o("\u53BB\u5904\u7406","Open")})]})}function Hs({detail:e,onChanged:n}){let[s,a]=g(!1),[i,r]=g(""),[c,l]=g(""),[u,p]=g(null),f=async(d,h)=>{a(!0),r(""),l("");try{await Ne.decideHandoff(e.caseId,d.handoffId,{decision:h}),l(h==="accept"?o("\u5DF2\u63A5\u53D7\u8FD9\u4E00\u7248\u4EA4\u63A5\u3002","Handoff accepted."):o("\u5DF2\u62D2\u7EDD\u8FD9\u6B21\u4EA4\u63A5\u3002","Handoff rejected.")),n()}catch(_){r(de(_))}finally{a(!1)}};return t("section",{class:"acp-detail acp-case-detail",children:[t("header",{class:"acp-detail-header",children:[t("div",{class:"acp-detail-tools",children:[t("div",{children:t("strong",{children:e.title||e.goal||e.caseId})}),t("div",{children:t("button",{type:"button",class:"acp-button",onClick:n,children:o("\u5237\u65B0","Refresh")})})]}),t("p",{class:"acp-channel-line",children:t("span",{children:e.goal})}),t("small",{class:"acp-muted",children:[o("\u521B\u5EFA\u4E8E","Created")," ",H(e.createdAt)," \xB7 ",e.originSessionId,e.legacy?` \xB7 ${o("\u65E7\u8BB0\u5F55\u6295\u5F71","projected from older records")}`:""]}),e.artifactSpace&&t("small",{class:"acp-muted",children:[o("\u5171\u4EAB\u4EA7\u7269\u7A7A\u95F4","Shared artifact space")," ",t("code",{children:e.artifactSpace})]})]}),t("div",{class:"acp-detail-content",children:[i&&t("p",{class:"acp-decision-error",children:i}),c&&t("p",{class:"acp-decision-message",children:c}),t("section",{class:"acp-detail-section",children:[t("h3",{children:[o("\u5F85\u6211\u786E\u8BA4","Waiting for me")," (",e.inbox.filter(d=>d.canDecide).length,")"]}),e.inbox.length?t("ul",{class:"acp-stage-list acp-inbox-list",children:e.inbox.map(d=>t(Us,{item:d,onOpen:()=>Vn(e.caseId,e.originSessionId)},`${d.kind}-${d.id}`))}):t("p",{class:"acp-muted",children:o("\u8FD9\u4EF6\u4E8B\u6682\u65F6\u6CA1\u6709\u7B49\u5F85\u786E\u8BA4\u7684\u4E8B\u3002","Nothing on this case is waiting for a decision.")})]}),t("section",{class:"acp-detail-section",children:[t("h3",{children:o("\u4EA4\u63A5","Handoffs")}),e.edges.length?t("ul",{class:"acp-stage-list acp-case-edges",children:e.edges.map(d=>t(Fs,{edge:d,caseId:e.caseId,onDecide:f,busy:s,onPreview:p},d.handoffId))}):t("p",{class:"acp-muted",children:o("\u8FD8\u6CA1\u6709\u4EA4\u63A5\u3002","No handoff yet.")})]}),t("section",{class:"acp-detail-section",children:[t("h3",{children:o("\u7EA6\u5B9A","Conventions")}),e.conventions.length?t("ul",{class:"acp-stage-list",children:e.conventions.map(d=>t("li",{children:[t("span",{children:d.achieved?"\u2713":"\xB7"}),t("div",{children:[t("strong",{children:[d.toTargetId," / ",d.toPurpose]}),t("small",{class:"acp-muted",children:[d.when==="acceptance_accepted"?o("\u9A8C\u6536\u901A\u8FC7\u540E\u53EF\u4EA4","May follow an accepted result"):d.when==="ticket_closed"?o("\u4EFB\u52A1\u5355\u5173\u95ED\u540E\u53EF\u4EA4","May follow a closed ticket"):o("\u4E8B\u5B9E\u8FBE\u5230\u9608\u503C\u540E\u53EF\u4EA4","May follow a measured fact"),d.condition?`\uFF1A${d.condition.metric} ${d.condition.operator} ${d.condition.value}`:""]}),t("small",{class:"acp-muted",children:d.requireHuman?o("\u9700\u8981\u4EBA\u786E\u8BA4","A person confirms"):o("\u9A8C\u6536\u901A\u8FC7\u5373\u81EA\u52A8\u6210\u7ACB\u4EA4\u63A5","Acceptance alone makes the handoff happen")})]})]},d.conventionId))}):t("p",{class:"acp-muted",children:o("\u8FD8\u6CA1\u6709\u7EA6\u5B9A\u3002","No convention yet.")})]}),t("section",{class:"acp-detail-section",children:[t("h3",{children:o("\u4EFB\u52A1","Tasks")}),t("ul",{class:"acp-stage-list",children:e.tasks.map(d=>t("li",{children:[t("span",{}),t("div",{children:[t("strong",{children:d.title||d.jobId}),t("small",{class:"acp-muted",children:[d.targetId," \xB7 ",d.progressSummary]})]}),t(Q,{value:Re(d)})]},d.jobId))})]}),t("section",{class:"acp-detail-section",children:[t("h3",{children:o("\u4EA7\u7269","Artifacts")}),e.artifacts.length?e.artifacts.map((d,h)=>t("div",{class:"acp-artifact-group",children:[t("strong",{children:[d.revision,d.digest?` \xB7 ${d.digest.slice(0,12)}`:""]}),t("div",{children:d.artifacts.map((_,C)=>{let m=_;return t(ft,{jobId:d.jobId,artifact:m,onPreview:()=>p({url:m.url??"",name:m.path?.split("/").pop()??o("\u4EA7\u7269","Artifact"),path:m.path,mediaType:m.mediaType})},`${d.revision}-${C}`)})})]},`${d.revision}-${h}`)):t("p",{class:"acp-muted",children:o("\u8FD8\u6CA1\u6709\u4EA7\u7269\u3002","No artifact yet.")})]}),t("section",{class:"acp-detail-section",children:[t("h3",{children:o("\u53D1\u5E03\u56DE\u6267","Publication receipts")}),e.receipts.length?t("ul",{class:"acp-stage-list",children:e.receipts.map(d=>t("li",{children:[t("span",{}),t("div",{children:[t("strong",{children:[d.channel," \xB7 ",d.remoteId]}),t("small",{class:"acp-muted",children:[d.artifactDigest.slice(0,16)," \xB7 ",H(d.publishedAt)]})]})]},d.receiptId))}):t("p",{class:"acp-muted",children:o("\u8FD8\u6CA1\u6709\u56DE\u6267\u3002","No receipt yet.")})]}),t("section",{class:"acp-detail-section",children:[t("h3",{children:o("\u5916\u90E8\u4E8B\u5B9E","External facts")}),e.facts.length?t("ul",{class:"acp-stage-list",children:e.facts.map(d=>t("li",{children:[t("span",{}),t("div",{children:[t("strong",{children:[d.metric," ",d.value,d.unit?` ${d.unit}`:""]}),t("small",{class:"acp-muted",children:[d.source," \xB7 ",H(d.observedAt)]})]})]},d.factId))}):t("p",{class:"acp-muted",children:o("\u8FD8\u6CA1\u6709\u4E8B\u5B9E\u3002","No fact yet.")})]})]}),u&&t(mt,{jobId:"",artifact:{path:u.path,url:u.url,mediaType:u.mediaType},onClose:()=>p(null)})]})}function Jn({refreshKey:e}){let n=Ms(),[s,a]=g(null),[i,r]=g(null),[c,l]=g(!0),[u,p]=g(""),[f,d]=g(""),[h,_]=g(""),[C,m]=g(!1),x=j(!1),y=J(async()=>{if(!x.current){x.current=!0;try{let k=await Ne.list(0,100);a(k),p(""),!h&&k.origins.length&&_(k.origins[0])}catch(k){p(de(k))}finally{x.current=!1,l(!1)}}},[h]);R(()=>{y();let k=window.setInterval(()=>{y()},5e3);return()=>window.clearInterval(k)},[y,e]),R(()=>{if(!n.caseId){r(null);return}let k=!0;return Ne.get(n.caseId).then(v=>k&&r(v)).catch(v=>k&&p(de(v))),()=>{k=!1}},[n.caseId,e]);let w=async()=>{if(!(!f.trim()||!h)){m(!0),p("");try{await Ne.open({originSessionId:h,goal:f.trim()}),d(""),await y()}catch(k){p(de(k))}finally{m(!1)}}},S=s?.items??[];return t("div",{class:`acp-workbench-body${n.caseId?" has-case-detail":""}`,children:[t("div",{class:"acp-workbench-table",children:[u&&t(ue,{title:o("\u4E8B\u60C5\u8BFB\u53D6\u5931\u8D25","Could not load cases"),message:u,onRetry:()=>{y()}}),t("form",{class:"acp-case-create",onSubmit:k=>{k.preventDefault(),w()},children:[t("label",{children:[o("\u65B0\u4E8B\u60C5\u7684\u76EE\u6807","What is this thing for"),t("input",{type:"text",value:f,placeholder:o("\u4F8B\u5982\uFF1A\u672C\u5468\u516C\u4F17\u53F7\u9009\u9898\u4E0E\u53D1\u5E03","e.g. this week\u2019s topics and publication"),onInput:k=>d(k.currentTarget.value)})]}),t("label",{children:[o("\u5F52\u5C5E\u4F1A\u8BDD","Scope"),t("select",{value:h,onChange:k=>_(k.currentTarget.value),children:(s?.origins??[]).map(k=>t("option",{value:k,children:k},k))})]}),t("button",{type:"submit",class:"acp-button acp-primary",disabled:C||!f.trim()||!h,children:o("\u5F00\u4E00\u4EF6\u4E8B","Open a case")})]}),t("table",{children:[t("thead",{children:t("tr",{children:[t("th",{children:o("\u76EE\u6807","Goal")}),t("th",{children:o("\u4EFB\u52A1","Tasks")}),t("th",{children:o("\u5F85\u6211\u786E\u8BA4","Waiting for me")}),t("th",{children:o("\u5F52\u5C5E\u4F1A\u8BDD","Scope")}),t("th",{children:o("\u6700\u8FD1\u8FDB\u5C55","Last activity")})]})}),t("tbody",{children:[!c&&!S.length&&t("tr",{children:t("td",{colSpan:5,class:"acp-muted",children:o("\u8FD8\u6CA1\u6709\u4E8B\u60C5\u3002\u5F00\u4E00\u4EF6\u4E8B\uFF0C\u4E4B\u540E\u5B83\u7684\u4EFB\u52A1\u3001\u4EA4\u63A5\u548C\u5F85\u786E\u8BA4\u90FD\u5728\u8FD9\u91CC\u3002","No case yet. Open one; its tasks, handoffs and decisions live here.")})}),S.map(k=>t("tr",{class:`acp-task-row${n.caseId===k.caseId?" is-selected":""}`,children:[t("td",{children:t("button",{type:"button",class:"acp-link acp-name-link",title:k.goal,onClick:()=>Vn(k.caseId,k.originSessionId),children:[t("span",{class:"acp-title-text",children:k.title||k.goal||k.caseId}),t("small",{title:k.caseId,children:k.caseId})]})}),t("td",{children:k.taskCount}),t("td",{children:k.pendingCount||"\u2014"}),t("td",{class:"acp-muted",children:k.originSessionId}),t("td",{class:"acp-task-updated",children:H(k.lastActivityAt)})]},`${k.originSessionId}-${k.caseId}`))]})]})]}),n.caseId&&t("div",{class:"acp-case-panel",children:i?t(Hs,{detail:i,onChanged:()=>{y()}}):t(Pe,{title:o("\u8BFB\u53D6\u8FD9\u4EF6\u4E8B","Reading the case")})})]})}var Os=e=>({pending:o("\u5F85\u56DE\u7B54","Waiting"),answered:o("\u5DF2\u56DE\u7B54","Answered"),cancelled:o("\u5DF2\u53D6\u6D88","Cancelled"),expired:o("\u5DF2\u8FC7\u671F","Expired")})[e]||e;function Ws(e){if(e instanceof G){if(e.code==="expired")return o("\u8FD9\u5219\u8FC7\u7A0B\u8BF7\u6C42\u5DF2\u7ECF\u8FC7\u671F","This process request has expired");if(e.code==="already_decided")return o("\u8FD9\u5219\u8FC7\u7A0B\u8BF7\u6C42\u5DF2\u7ECF\u5904\u7406\u8FC7","This process request was already handled");if(e.code==="idempotency_conflict")return o("\u8FD9\u6B21\u63D0\u4EA4\u548C\u4E0A\u6B21\u8BB0\u5F55\u4E0D\u4E00\u81F4","This submit does not match the recorded answer")}return e instanceof Error?e.message:String(e)}function Bs({question:e,value:n,onChange:s}){if(e.options?.length&&e.multiSelect){let a=Array.isArray(n)?n:[];return t("div",{children:e.options.map(i=>t("label",{children:[t("input",{type:"checkbox",checked:a.includes(i.label),onChange:r=>{let c=new Set(a);r.currentTarget.checked?c.add(i.label):c.delete(i.label),s([...c])}}),i.label,i.description&&t("small",{children:i.description})]},i.label))})}return e.options?.length?t("div",{children:e.options.map(a=>t("label",{children:[t("input",{type:"radio",name:e.id,checked:n===a.label,onChange:()=>s(a.label)}),a.label,a.description&&t("small",{children:a.description})]},a.label))}):t("textarea",{value:typeof n=="string"?n:"",onInput:a=>s(a.currentTarget.value)})}function Bt({jobId:e,requests:n,onReload:s}){let a=n??[],[i,r]=g({}),[c,l]=g({}),[u,p]=g(""),[f,d]=g(""),h=j({});if(!a.length)return null;let _=m=>(h.current[m]??=crypto.randomUUID(),h.current[m]),C=async(m,x,y,w=!1)=>{let S=x==="rejected"?c[m.requestId]?.trim():"";p(m.requestId),d("");try{await U.answerProcessRequest(e,m.requestId,{clientRequestId:_(m.requestId),outcome:x,...y?{answers:i[m.requestId]??{}}:{},...S?{note:S}:{},...w?{stopTask:!0}:{}}),s()}catch(k){d(Ws(k))}finally{p("")}};return t("section",{class:"acp-detail-section",children:[t("h3",{children:o("\u8FC7\u7A0B\u8BF7\u6C42","Process requests")}),f&&t("p",{class:"acp-muted",children:f}),a.map(m=>{let x=m.kind!=="question"||(m.questions??[]).every(y=>{let w=i[m.requestId]?.[y.question];return Array.isArray(w)?w.length>0:!!(w&&w.trim())});return t("article",{class:"acp-process-request",children:[t("strong",{children:m.kind==="plan"?o("\u8BA1\u5212\u5BA1\u6279","Plan approval"):m.kind==="permission"?o("\u5DE5\u5177\u5BA1\u6279","Tool approval"):o("\u63D0\u95EE","Question")}),t("small",{children:[o("\u622A\u6B62","Deadline")," ",new Date(m.deadlineAt).toLocaleString()]}),m.planContent&&t(be,{source:m.planContent}),m.kind==="permission"&&t(T,{children:[t("p",{children:m.toolTitle}),m.toolDetail&&t("pre",{class:"acp-tool-detail",children:m.toolDetail})]}),m.questions?.map(y=>t(T,{children:[t("p",{children:[y.header?`${y.header} \xB7 `:"",y.question]}),m.canAnswer&&t(Bs,{question:y,value:i[m.requestId]?.[y.question],onChange:w=>r(S=>({...S,[m.requestId]:{...S[m.requestId],[y.question]:w}}))})]},y.id)),m.canAnswer&&m.kind==="question"&&t("div",{class:"acp-agent-actions",children:[t("button",{type:"button",class:"acp-button",disabled:u===m.requestId||!x,onClick:()=>{C(m,"accepted",!0)},children:o("\u63D0\u4EA4\u56DE\u7B54","Submit answer")}),t("button",{type:"button",class:"acp-button",disabled:u===m.requestId,onClick:()=>{C(m,"cancelled",!1)},children:o("\u53D6\u6D88\u8FD9\u6B21\u63D0\u95EE","Cancel question")})]}),m.canAnswer&&m.kind!=="question"&&t("textarea",{class:"acp-reject-note",maxLength:2e3,placeholder:o("\u62D2\u7EDD\u7406\u7531\uFF08\u53EF\u9009\uFF09","Reason for rejecting (optional)"),value:c[m.requestId]??"",onInput:y=>{let w=y.currentTarget.value;l(S=>({...S,[m.requestId]:w}))}}),m.canAnswer&&m.kind==="plan"&&t("div",{class:"acp-agent-actions",children:[t("button",{type:"button",class:"acp-button",disabled:u===m.requestId,onClick:()=>{C(m,"approved",!1)},children:o("\u6279\u51C6\u8BA1\u5212","Approve plan")}),t("button",{type:"button",class:"acp-button",disabled:u===m.requestId,onClick:()=>{C(m,"rejected",!1)},children:o("\u9000\u56DE\u8BA1\u5212","Reject plan")}),t("button",{type:"button",class:"acp-button",disabled:u===m.requestId,onClick:()=>{C(m,"abandoned",!1)},children:o("\u653E\u5F03","Abandon")})]}),m.canAnswer&&m.kind==="permission"&&t("div",{class:"acp-agent-actions",children:[t("button",{type:"button",class:"acp-button acp-primary",disabled:u===m.requestId,onClick:()=>{C(m,"approved",!1)},children:o("\u5141\u8BB8\u672C\u6B21","Allow once")}),t("button",{type:"button",class:"acp-button",disabled:u===m.requestId,onClick:()=>{C(m,"rejected",!1)},children:o("\u62D2\u7EDD\u8FD9\u6B21\u8C03\u7528","Reject this call")}),t("button",{type:"button",class:"acp-button acp-danger",title:o("\u62D2\u7EDD\u5E76\u53D6\u6D88\u6574\u4E2A\u4EFB\u52A1\uFF0CAgent \u4E0D\u4F1A\u518D\u6362\u65B9\u5F0F\u91CD\u8BD5","Reject and cancel the task so the agent cannot retry another way"),disabled:u===m.requestId,onClick:()=>{C(m,"rejected",!1,!0)},children:o("\u62D2\u7EDD\u5E76\u505C\u6B62\u4EFB\u52A1","Reject and stop task")}),t("button",{type:"button",class:"acp-button",disabled:u===m.requestId,onClick:()=>{C(m,"cancelled",!1)},children:o("\u53D6\u6D88","Cancel")})]}),!m.canAnswer&&t("small",{children:[Os(m.status),m.kind==="permission"&&m.answer?.outcome==="approved"&&` \xB7 ${o("\u5DF2\u5141\u8BB8","Allowed")}`,m.kind==="permission"&&m.answer?.outcome==="rejected"&&` \xB7 ${m.answer.stopTask?o("\u5DF2\u62D2\u7EDD\u5E76\u505C\u6B62\u4EFB\u52A1","Rejected and stopped the task"):o("\u5DF2\u62D2\u7EDD","Rejected")}`,m.answer?.decidedBy?.kind==="coach"&&` \xB7 ${o("\u6559\u7EC3\u51B3\u5B9A","Decided by the coach")}`,m.answer?.note&&` \xB7 ${m.answer.note}`]})]},m.requestId)})]})}var We=e=>e instanceof Error?e.message:String(e),qs="\u4E0A\u4E00\u8F6E\u6267\u884C\u4E2D\u65AD\u4E86\uFF0C\u5DF2\u7ECF\u5B8C\u6210\u7684\u4E0D\u7528\u91CD\u505A\uFF0C\u8BF7\u63A5\u7740\u628A\u4EFB\u52A1\u505A\u5B8C\u3002",zs=window.parent!==window;function Ks({detail:e}){let n=e.attempts.find(c=>c.attemptId===e.currentAttemptId)?.backendRunRef?.taskId,[s,a]=g(null);R(()=>{if(a(null),!zs||!n)return;let c=!0;return U.dshSession(n).then(l=>c&&a(l),()=>c&&a(null)),()=>{c=!1}},[n,e.executionStatus]);let i=s?.available?s.sessionId:void 0;if(!i)return null;let r=s.task?.running===!0;return t("button",{type:"button",class:"acp-button acp-primary",disabled:r,title:r?o("A2A \u4EFB\u52A1\u4ECD\u5728\u6267\u884C\uFF0C\u7ED3\u675F\u540E\u53EF\u63A5\u7BA1","The A2A task is still running; take over once it ends"):o("\u5728 DSH \u4F1A\u8BDD\u4E2D\u7EE7\u7EED\u5904\u7406\uFF1B\u6EE1\u610F\u540E\u8BA9\u667A\u80FD\u4F53\u8C03\u7528 submit_to_review \u63D0\u4EA4\u56DE\u5DE5\u4F5C\u6D41","Continue in the DSH session; when satisfied, have the agent call submit_to_review"),onClick:()=>window.parent.postMessage({type:"1agents:open-session",sessionId:i},location.origin),children:r?o("\u6267\u884C\u4E2D\u2026","Running\u2026"):o("\u5728 DSH \u4E2D\u63A5\u7BA1","Take over in DSH")})}function Vs({execution:e}){let n=le(e,B);return t("small",{class:"acp-execution-caption",children:[t("span",{children:[n.mode," \xB7 ",n.role]}),t("span",{children:t(Se,{execution:e})})]})}function Js({execution:e}){let n=le(e,B);return t(T,{children:[t("span",{children:[o("\u4EFB\u52A1\u65B9\u5F0F","Task mode"),t("strong",{children:n.mode})]}),t("span",{children:[o("\u89D2\u8272\u6216\u9884\u8BBE","Role / preset"),t("strong",{children:t(Fe,{execution:e})})]}),t("span",{children:[o("\u6267\u884C\u670D\u52A1","Execution service"),t("strong",{children:t(Se,{execution:e})})]})]})}function Gn({jobId:e,requestedReviewId:n,full:s,onChanged:a}){let[i,r]=g(null),[c,l]=g(""),[u,p]=g(!1),[f,d]=g(!0),[h,_]=g(n?"review":"overview"),[C,m]=g(n),[x,y]=g(""),[w,S]=g(!1),[k,v]=g(""),[L,O]=g(""),[X,N]=g(!1),[K,ye]=g(),[Ee,je]=g(!1),[ee,te]=g(null),[pe,ae]=g(!1),[fe,we]=g(""),ke=J(()=>ye(void 0),[]),ne=j(null),$=j(!0),re=j(!1),me=j(null),P=i?.reviews.find(A=>A.reviewId===C),ie=Tt(i?.reviews||[]),q=J(async()=>{if(!re.current){re.current=!0;try{let A=await U.get(e);if(!$.current)return;r(A),l(""),m(V=>V||n||A.pendingReviewId||Tt(A.reviews)?.reviewId)}catch(A){$.current&&l(We(A))}finally{$.current&&(d(!1),re.current=!1)}}},[e]),Ae=async()=>{je(!0);try{let A=await U.refresh(e);if(!$.current)return;r(A),l(""),a()}catch(A){$.current&&l(We(A))}finally{$.current&&je(!1)}},Ie=async()=>{p(!0),l("");try{let A=await U.accept(e);if(!$.current)return;r(A),a()}catch(A){$.current&&l(We(A))}finally{$.current&&p(!1)}},xe=async()=>{ae(!0),we("");try{let A=await U.continueTask(e,ee??"");if(!$.current)return;r(A),te(null),a()}catch(A){$.current&&we(We(A))}finally{$.current&&ae(!1)}};R(()=>{$.current=!0,q();let A=window.setInterval(()=>{document.hidden||q()},5e3);return()=>{$.current=!1,window.clearInterval(A)}},[q]),R(()=>{n&&(m(n),_("review"),O(""),y(""))},[n]),R(()=>{i&&me.current?.focus()},[!!i]),R(()=>ye(void 0),[e]);let se=A=>{m(A),_("review"),O(""),v(""),y(""),z({jobId:e,reviewId:A,full:s})},ge=A=>{let V=(i?.artifacts||[]).flatMap(Z=>Z.artifacts).find(Z=>typeof Z=="object"&&Z.path===A);V&&ye(V)},he=async A=>{if(!P||w||P.status!=="pending"||!P.canReview)return;if((A==="changes_requested"||A==="comment")&&!x.trim()){O(o("\u8BF7\u586B\u5199\u5177\u4F53\u610F\u89C1\u3002","Please enter feedback."));return}let V=JSON.stringify([P.reviewId,P.revision,P.digest,A,x.trim()]);ne.current?.key!==V&&(ne.current={key:V,id:crypto.randomUUID()});let Z={action:A,revision:P.revision,digest:P.digest,clientRequestId:ne.current.id,...x.trim()?{note:x.trim()}:{}};S(!0),O(""),v("");try{if(await U.decide(P.jobId||e,P.reviewId,Z),!$.current)return;y(""),N(!1),ne.current=null,v(A==="comment"?o("\u8BC4\u8BBA\u5DF2\u4FDD\u5B58\uFF0C\u5BA1\u6838\u4ECD\u5F85\u786E\u8BA4\u3002","Comment saved. Review remains pending."):o("\u51B3\u5B9A\u5DF2\u4FDD\u5B58\uFF0C\u6B63\u5728\u540C\u6B65\u4EFB\u52A1\u8FDB\u5C55\u3002","Decision saved. Synchronizing task progress.")),await q(),a()}catch(I){if(!$.current)return;O(I instanceof G&&I.status===403&&/browser_review_required|same.origin|browser/i.test(I.message)?o("\u5F53\u524D\u8FDE\u63A5\u4E0D\u80FD\u63D0\u4EA4\u4EBA\u5DE5\u51B3\u5B9A\u3002\u8BF7\u5728\u4EFB\u52A1\u6240\u5728\u8282\u70B9\u7684 Web \u9875\u9762\u767B\u5F55\u540E\u5904\u7406\u5BA1\u6838\u3002","This connection cannot submit human decisions. Open the node\u2019s web page and sign in to review."):I instanceof G&&I.status===409?o("\u7248\u672C\u6216\u5BA1\u6838\u72B6\u6001\u5DF2\u7ECF\u53D8\u5316\u3002\u8BF7\u6838\u5BF9\u5F53\u524D\u72B6\u6001\uFF1B\u65E7\u7248\u672C\u7684\u51B3\u5B9A\u4E0D\u4F1A\u653E\u884C\u65B0\u7248\u3002","The version or review state changed. Check the latest state before deciding."):We(I)),I instanceof G&&I.status===409&&await q()}finally{$.current&&S(!1)}},Be=async()=>{let A=new URL(window.location.href);A.hash=it({jobId:e,reviewId:h==="review"?C:void 0,full:!0});try{await navigator.clipboard.writeText(A.href),v(o("\u4EFB\u52A1\u94FE\u63A5\u5DF2\u590D\u5236","Task link copied"))}catch{v(o("\u65E0\u6CD5\u590D\u5236\u94FE\u63A5\uFF0C\u53EF\u590D\u5236\u5730\u5740\u680F\u94FE\u63A5","Could not copy. Copy the address bar URL."))}},qe=[["overview",o("\u6982\u89C8","Overview")],["progress",o("\u8FDB\u5C55","Progress")],["review",o("\u4EA7\u7269\u4E0E\u5BA1\u6838","Artifacts & review")],["chat",o("\u5BF9\u8BDD","Conversation")],["events",o("\u4E8B\u4EF6\u8BB0\u5F55","Events")]];return t("aside",{class:"acp-detail","aria-label":o("\u4EFB\u52A1\u8BE6\u60C5","Task details"),children:[t("header",{class:"acp-detail-header",children:[t("div",{class:"acp-detail-tools",children:[t("span",{children:o("\u4EFB\u52A1\u8BE6\u60C5","Task details")}),t("div",{children:[i&&t(Ks,{detail:i}),i&&(i.displayStatus==="unwatched"||i.stale)&&t("button",{type:"button",class:"acp-button",disabled:Ee,onClick:Ae,children:Ee?o("\u6B63\u5728\u67E5\u8BE2\u2026","Querying\u2026"):o("\u91CD\u65B0\u67E5\u8BE2","Query again")}),i?.canAccept&&t("button",{type:"button",class:"acp-button acp-primary",disabled:u,onClick:()=>{Ie()},children:o("\u5DF2\u9605","Mark as read")}),i?.canContinue&&ee===null&&t("button",{type:"button",class:"acp-button acp-primary",onClick:()=>{we(""),te(qs)},children:o("\u7EE7\u7EED","Continue")}),t("button",{type:"button",class:"acp-button",onClick:Be,children:o("\u590D\u5236\u94FE\u63A5","Copy link")}),t("button",{type:"button",class:"acp-button",onClick:()=>z({jobId:e,reviewId:n,full:!s}),children:s?o("\u8FD4\u56DE\u8868\u683C","Back to table"):o("\u5C55\u5F00\u6574\u9875","Full page")}),t("button",{type:"button",class:"acp-button",onClick:()=>z({full:!1}),children:o("\u5173\u95ED","Close")})]})]}),t("div",{class:"acp-breadcrumb",children:[i?.ancestors?.map(A=>t(T,{children:[t("button",{type:"button",class:"acp-link",onClick:()=>z({jobId:A.jobId,full:s}),children:ve(A)}),t("span",{children:"\u203A"})]},A.jobId)),t("span",{children:e})]}),t("h2",{ref:me,tabIndex:-1,children:i?ve(i):o("\u6B63\u5728\u8BFB\u53D6\u4EFB\u52A1\u2026","Loading task\u2026")}),i&&t("p",{class:"acp-channel-line",children:[t(Q,{value:Re(i)}),t("span",{class:"acp-mode-label",children:ct(i.channel)}),i.agentName&&t("span",{children:i.agentName}),i.stale&&t("span",{class:"acp-stale",children:o("\u5F53\u524D\u4E3A\u7F13\u5B58\u72B6\u6001\uFF0C\u7B49\u5F85\u540C\u6B65","Cached status; awaiting synchronization")})]}),i?.pendingProcessRequestId&&h!=="overview"&&t("button",{type:"button",class:"acp-link",onClick:()=>_("overview"),children:o("\u6709\u8FC7\u7A0B\u8BF7\u6C42\u5F85\u56DE\u7B54","A process request is waiting")})]}),t("nav",{class:"acp-detail-tabs","aria-label":o("\u4EFB\u52A1\u8BE6\u60C5\u89C6\u56FE","Task detail views"),role:"tablist",children:qe.map(([A,V])=>t("button",{id:`acp-detail-tab-${A}`,type:"button",role:"tab","aria-selected":h===A,"aria-controls":"acp-detail-content",onClick:()=>_(A),children:V},A))}),t("div",{class:"acp-detail-content",id:"acp-detail-content",role:"tabpanel","aria-labelledby":`acp-detail-tab-${h}`,children:[c&&t(ue,{title:o("\u4EFB\u52A1\u8BE6\u60C5\u8BFB\u53D6\u5931\u8D25","Could not load task details"),message:c,onRetry:()=>{q()}}),f&&t("p",{class:"acp-muted",children:o("\u6B63\u5728\u8F7D\u5165\u2026","Loading\u2026")}),i?.canContinue&&ee!==null&&t("div",{class:"acp-review-form",children:[t("label",{htmlFor:"acp-continue-prompt",children:o("\u5728\u539F\u4F1A\u8BDD\u91CC\u65B0\u5F00\u4E00\u8F6E\uFF0C\u53D1\u7ED9\u6267\u884C\u8005\u7684\u8BDD","Message for a new round in the same session")}),t("textarea",{id:"acp-continue-prompt",value:ee,disabled:pe,onInput:A=>te(A.currentTarget.value)}),fe&&t("p",{role:"alert",class:"acp-decision-error",children:fe}),t("div",{class:"acp-review-buttons",children:[t("button",{type:"button",class:"acp-button acp-primary",disabled:pe||!ee.trim(),onClick:()=>{xe()},children:pe?o("\u6B63\u5728\u63D0\u4EA4\u2026","Submitting\u2026"):o("\u63D0\u4EA4\u5E76\u7EE7\u7EED","Submit and continue")}),t("button",{type:"button",class:"acp-link",disabled:pe,onClick:()=>te(null),children:o("\u53D6\u6D88","Cancel")})]})]}),i&&t(T,{children:[h==="overview"&&t(Qs,{detail:i,onReview:A=>se(A),onReload:()=>{q()},onOpenFile:ge}),h==="progress"&&t(Xs,{detail:i,onReview:A=>se(A),onReload:()=>{q()},full:s}),h==="review"&&t(T,{children:[t(Ys,{detail:i,review:P,requestedReviewId:C,onSelect:se,previewing:K,onPreview:ye}),P&&t(T,{children:[ie&&ie.reviewId!==P.reviewId&&t("div",{class:"acp-notice",children:[o("\u6B63\u5728\u67E5\u770B\u5386\u53F2\u7248\u672C\u3002","Viewing a historical version.")," ",t("button",{type:"button",class:"acp-link",onClick:()=>se(ie.reviewId),children:o("\u67E5\u770B\u6700\u65B0\u7248\u672C \u2192","View latest version \u2192")})]}),P.status==="approved"&&!["completed","failed","canceled","rejected"].includes(i.executionStatus)&&P.resumeStatus==="pending"&&t("div",{class:"acp-notice",role:"status",children:o("\u672C\u7248\u5DF2\u901A\u8FC7\uFF0C\u7B49\u5F85\u7CFB\u7EDF\u7EE7\u7EED\u5904\u7406\u3002","This version is approved. Waiting for the workflow to resume.")}),P.resumeError&&t("p",{role:"alert",class:"acp-decision-error",children:P.resumeError}),t(eo,{review:P}),P.status==="pending"&&P.canReview&&t("div",{class:"acp-review-form",children:[t("label",{htmlFor:"acp-review-feedback",children:o("\u5BA1\u6838\u610F\u89C1","Review feedback")}),t("textarea",{id:"acp-review-feedback",value:x,disabled:w,onInput:A=>y(A.currentTarget.value),placeholder:o("\u53EF\u6CE8\u660E\u5177\u4F53\u9875\u7801\uFF1B\u8981\u6C42\u4FEE\u6539\u65F6\u8BF7\u586B\u5199\u610F\u89C1\u3002","Reference page numbers. Feedback is required when requesting changes.")}),t("div",{class:"acp-review-buttons",children:[t("button",{type:"button",class:"acp-link",disabled:w,onClick:()=>{he("comment")},children:o("\u53D1\u8868\u8BC4\u8BBA","Comment")}),t("button",{type:"button",class:"acp-button",disabled:w,onClick:()=>z({full:!1}),children:o("\u7A0D\u540E\u5904\u7406","Later")}),t("button",{type:"button",class:"acp-button",disabled:w,onClick:()=>{he("changes_requested")},children:o("\u8981\u6C42\u4FEE\u6539","Request changes")}),t("button",{type:"button",class:"acp-button acp-primary",disabled:w,onClick:()=>{he("approve")},children:w?o("\u6B63\u5728\u63D0\u4EA4\u2026","Submitting\u2026"):o(`\u901A\u8FC7 ${P.revision}`,`Approve ${P.revision}`)})]}),t("details",{class:"acp-more-actions",children:[t("summary",{children:o("\u66F4\u591A\u64CD\u4F5C","More actions")}),X?t("div",{class:"acp-cancel-confirm",children:[t("p",{children:o("\u653E\u5F03\u5C06\u7EC8\u6B62\u5F53\u524D\u5DE5\u4F5C\u6D41\uFF0C\u5DF2\u6709\u4EA7\u7269\u4E0E\u5386\u53F2\u4FDD\u7559\u3002","Abandoning ends this workflow and retains existing artifacts and history.")}),t("button",{type:"button",class:"acp-button",disabled:w,onClick:()=>N(!1),children:o("\u7EE7\u7EED\u4FDD\u7559","Keep task")}),t("button",{type:"button",class:"acp-button acp-danger",disabled:w,onClick:()=>{he("cancel")},children:o("\u786E\u8BA4\u653E\u5F03\u4EFB\u52A1","Confirm abandon")})]}):t("button",{type:"button",class:"acp-link",onClick:()=>N(!0),children:o("\u653E\u5F03\u4EFB\u52A1","Abandon task")})]})]}),P.status==="pending"&&!P.canReview&&t("p",{class:"acp-muted",children:o("\u6B64\u5BA1\u6838\u672A\u5206\u914D\u7ED9\u5F53\u524D\u7528\u6237\u3002","This review is not assigned to the current user.")})]}),k&&t("p",{class:"acp-decision-message",role:"status",children:k}),L&&t("p",{class:"acp-decision-error",role:"alert",children:L})]}),h==="chat"&&t(Kn,{jobId:e,onOpenFile:ge}),h==="events"&&t(T,{children:[t(Zs,{detail:i}),t(to,{detail:i})]})]})]}),K&&t(mt,{jobId:e,artifact:K,onClose:ke})]})}function Gs({detail:e}){let n=e.businessAcceptance;return n?t("section",{class:"acp-detail-section",children:[t("h3",{children:o("\u4E1A\u52A1\u9A8C\u6536","Business acceptance")}),t("dl",{class:"acp-acceptance-record",children:[t("dt",{children:o("\u7ED3\u679C\u7248\u672C","Result revision")}),t("dd",{children:n.resultRevision}),t("dt",{children:o("\u8BB0\u5F55\u65F6\u95F4","Recorded")}),t("dd",{children:H(n.recordedAt)}),n.decidedBy&&t(T,{children:[t("dt",{children:o("\u5904\u7406\u4EBA","Decided by")}),t("dd",{children:n.decidedBy.kind==="coach"?o("\u6559\u7EC3","Coach"):o("\u4EBA","Person")})]}),n.note&&t(T,{children:[t("dt",{children:o("\u8BF4\u660E","Note")}),t("dd",{children:n.note})]})]})]}):null}function Qs({detail:e,onReview:n,onReload:s,onOpenFile:a}){let r=e.attempts.find(c=>c.attemptId===e.currentAttemptId)?.result?.resultSummary;return t(T,{children:[t(Bt,{jobId:e.jobId,requests:e.processRequests?.filter(c=>c.status==="pending"),onReload:s}),e.executionStatus==="completed"&&t(Gs,{detail:e}),e.pendingReviewId&&t("p",{class:"acp-notice",children:[o("\u6709\u4EA7\u7269\u7B49\u5F85\u4F60\u5BA1\u6838\u3002","An artifact is waiting for your review.")," ",t("button",{type:"button",class:"acp-link",onClick:()=>n(e.pendingReviewId),children:o("\u53BB\u5BA1\u6838","Review")})]}),e.description&&t("section",{class:"acp-detail-section",children:[t("h3",{children:o("\u4EFB\u52A1\u63CF\u8FF0","Task description")}),t(be,{source:e.description,onOpenFile:a})]}),r?t("section",{class:"acp-detail-section",children:[t("h3",{children:o("\u6700\u65B0\u56DE\u7B54","Latest answer")}),t(be,{source:r,onOpenFile:a})]}):e.progressSummary&&t("section",{class:"acp-detail-section",children:[t("h3",{children:o("\u5F53\u524D\u8FDB\u5C55","Current progress")}),t(be,{source:e.progressSummary,onOpenFile:a})]}),t("div",{class:"acp-task-facts",children:[t("span",{children:[o("\u521B\u5EFA","Created"),t("strong",{children:H(e.createdAt)})]}),t("span",{children:[o("\u6700\u8FD1\u66F4\u65B0","Last updated"),t("strong",{children:H(e.updatedAt)})]}),e.progress?.executionElapsedMs!==void 0&&t("span",{children:[o("\u5B9E\u9645\u6267\u884C","Execution time"),t("strong",{children:Pt(e.progress.executionElapsedMs)})]}),e.progress?.humanWaitingMs!==void 0&&t("span",{children:[o("\u4EBA\u5DE5\u7B49\u5F85","Human wait"),t("strong",{children:Pt(e.progress.humanWaitingMs)})]})]})]})}function Xs({detail:e,onReview:n,onReload:s,full:a}){let i=e.progress?.stages||[];return t(T,{children:[t(Bt,{jobId:e.jobId,requests:e.processRequests?.filter(r=>r.status!=="pending"),onReload:s}),i.length>0&&t("section",{class:"acp-detail-section",children:[t("h3",{children:o("\u9636\u6BB5\u8FDB\u5C55","Stage progress")}),t("ol",{class:"acp-stage-list",children:i.map(r=>t("li",{children:[t("span",{class:`acp-stage-dot acp-stage-dot-${r.status}`,"aria-hidden":"true",children:r.status==="completed"||r.status==="approved"?"\u2713":"\u2022"}),t("div",{children:[t("strong",{children:r.name}),t("small",{children:r.planned?o("\u8BA1\u5212\u9636\u6BB5 \xB7 \u5C1A\u672A\u521B\u5EFA\u6267\u884C\u4EFB\u52A1","Planned stage \xB7 no execution task yet"):r.jobId?t("button",{type:"button",class:"acp-link",onClick:()=>z({jobId:r.jobId,full:a}),children:o("\u67E5\u770B\u6267\u884C\u4EFB\u52A1","Open execution task")}):""})]}),r.stage==="human_review"&&e.pendingReviewId?t("button",{type:"button",class:"acp-link",onClick:()=>n(e.pendingReviewId),children:t(Q,{value:r.status})}):t(Q,{value:r.status})]},r.stage))})]}),t("section",{class:"acp-detail-section",children:[t("h3",{children:o("\u6267\u884C\u8F6E\u6B21","Execution attempts")}),e.attempts.length?[...e.attempts].reverse().map((r,c)=>t("details",{class:"acp-attempt",open:c===0,children:[t("summary",{children:[t("span",{children:[r.attemptId===e.currentAttemptId?o("\u5F53\u524D\u6267\u884C","Current attempt"):o("\u5386\u53F2\u6267\u884C","Past attempt")," ","\xB7 ",H(r.createdAt||r.updatedAt)]}),t(Q,{value:r.executionStatus})]}),r.stale&&t("p",{class:"acp-stale",children:o("\u6B64\u8F6E\u72B6\u6001\u5F85\u6838\u5B9E\uFF1B\u5386\u53F2\u5728\u9014\u6267\u884C\u4E0D\u4F1A\u88AB\u9690\u85CF\u3002","This attempt needs verification; unresolved prior work remains visible.")}),r.diagnostic&&t("p",{class:"acp-decision-error",children:r.diagnostic}),r.attemptId!==e.currentAttemptId&&r.result?.resultSummary&&t("div",{class:"acp-result-summary",children:t(be,{source:r.result.resultSummary})})]},r.attemptId)):t("p",{class:"acp-muted",children:o("\u6682\u65E0\u6267\u884C\u8BB0\u5F55","No execution attempts")})]}),t("section",{class:"acp-detail-section",children:[t("h3",{children:o("\u76F4\u63A5\u5B50\u4EFB\u52A1","Direct subtasks")}),e.children.length?e.children.map(r=>t("button",{type:"button",class:"acp-child-task",onClick:()=>z({jobId:r.jobId,full:a}),children:[t("span",{children:[ve(r),t(Vs,{execution:r.execution})]}),t(Q,{value:St(r)})]},r.jobId)):t("p",{class:"acp-muted",children:o("\u5F53\u524D\u6CA1\u6709\u5DF2\u521B\u5EFA\u7684\u5B50\u4EFB\u52A1","No subtasks have been created")})]})]})}function Zs({detail:e}){return t(T,{children:t("section",{class:"acp-detail-section",children:[t("h3",{children:o("\u6267\u884C\u4FE1\u606F","Execution details")}),t("div",{class:"acp-task-facts",children:t(Js,{execution:e.execution})}),[...e.attempts].reverse().map(n=>{let s=le(n.execution,B);return t("details",{class:"acp-attempt",children:[t("summary",{children:t("span",{children:[n.attemptId===e.currentAttemptId?o("\u5F53\u524D\u6267\u884C","Current attempt"):o("\u5386\u53F2\u6267\u884C","Past attempt")," ","\xB7 ",n.attemptId]})}),t("dl",{children:[t("dt",{children:o("\u4EFB\u52A1\u65B9\u5F0F","Task mode")}),t("dd",{children:s.mode}),t("dt",{children:o("\u89D2\u8272\u6216\u9884\u8BBE","Role / preset")}),t("dd",{children:t(Fe,{execution:n.execution})}),t("dt",{children:o("\u6267\u884C\u670D\u52A1","Execution service")}),t("dd",{children:t(Se,{execution:n.execution})}),t(Et,{execution:n.execution}),t("dt",{children:o("\u539F\u59CB\u76EE\u6807 ID","Raw target ID")}),t("dd",{children:n.execution?.targetId||n.targetId||o("\u672A\u8BB0\u5F55","Not recorded")}),t("dt",{children:o("\u66F4\u65B0\u65F6\u95F4","Updated")}),t("dd",{children:H(n.updatedAt)}),n.previousAttemptId&&t(T,{children:[t("dt",{children:o("\u63A5\u7EED\u6267\u884C","Continues attempt")}),t("dd",{children:n.previousAttemptId})]})]})]},n.attemptId)}),t("details",{class:"acp-context",children:[t("summary",{children:o("\u4EFB\u52A1\u6765\u6E90","Task source")}),t("dl",{children:[t(Et,{execution:e.execution}),t("dt",{children:o("\u539F\u59CB\u76EE\u6807 ID","Raw target ID")}),t("dd",{children:e.execution?.targetId||e.targetId}),e.execution?.roleId&&t(T,{children:[t("dt",{children:o("\u89D2\u8272 ID","Role ID")}),t("dd",{children:e.execution.roleId})]}),e.execution?.agentPreset&&t(T,{children:[t("dt",{children:o("\u8BB0\u5F55\u7684\u9884\u8BBE","Recorded preset")}),t("dd",{children:e.execution.agentPreset})]}),e.execution?.connectionId&&t(T,{children:[t("dt",{children:o("\u8FDE\u63A5 ID","Connection ID")}),t("dd",{children:e.execution.connectionId})]}),e.execution?.provider&&t(T,{children:[t("dt",{children:o("\u6267\u884C\u540E\u7AEF","Execution backend")}),t("dd",{children:e.execution.provider})]}),t("dt",{children:o("\u6765\u6E90\u4F1A\u8BDD","Origin session")}),t("dd",{children:e.originSessionId}),t("dt",{children:o("\u4EFB\u52A1\u8D26\u672C","Ledger source")}),t("dd",{children:e.sourceId}),e.parentAttemptId&&t(T,{children:[t("dt",{children:o("\u6240\u5C5E\u7236\u6267\u884C\u8F6E\u6B21","Parent attempt")}),t("dd",{children:e.parentAttemptId})]})]})]})]})})}function Ys({detail:e,review:n,requestedReviewId:s,onSelect:a,previewing:i,onPreview:r}){let c=[...e.progress?.availableResults||[]];for(let l of e.artifacts||[])c.some(u=>u.revision===l.revision)||c.push({revision:l.revision,artifacts:l.artifacts.map(u=>typeof u=="string"?{url:u}:u),deliveryReady:e.executionStatus==="completed"});return t(T,{children:[c.length>0&&t("section",{class:"acp-detail-section",children:[t("h3",{children:o("\u5DF2\u6709\u4EA7\u7269","Available artifacts")}),c.map(l=>t("div",{class:"acp-artifact-group",children:[t("strong",{children:[l.revision," \xB7"," ",l.deliveryReady?o("\u6700\u7EC8\u4EA4\u4ED8","Final delivery"):o("\u5236\u4F5C\u7A3F","Draft")]}),l.artifacts.map((u,p)=>t(ft,{jobId:e.jobId,artifact:u,active:!!i&&(i.url||i.path)===(u.url||u.path),onPreview:r},`${u.url||u.path}:${p}`))]},l.revision))]}),c.length===0&&t("section",{class:"acp-detail-section",children:[t("h3",{children:o("\u5DF2\u6709\u4EA7\u7269","Available artifacts")}),t("p",{class:"acp-muted",children:o("\u8FD9\u4E2A\u4EFB\u52A1\u8FD8\u6CA1\u6709\u767B\u8BB0\u4EA7\u7269\u3002\u4EA7\u7269\u4E0D\u4F1A\u4ECE\u5BF9\u8BDD\u5185\u5BB9\u91CC\u63A8\u65AD\uFF1A\u667A\u80FD\u4F53\u9700\u8981\u6309\u4EFB\u52A1\u8981\u6C42\u628A\u6587\u4EF6\u5199\u5230\u6307\u5B9A\u7684\u4EFB\u52A1\u76EE\u5F55\uFF0C\u5E76\u767B\u8BB0\u5230\u4EA7\u7269\u6E05\u5355\uFF0C\u6267\u884C\u7AEF\u6821\u9A8C\u901A\u8FC7\u540E\u624D\u4F1A\u663E\u793A\u5728\u8FD9\u91CC\u3002","No artifacts are registered for this task. They are never inferred from the conversation: the agent must write files to the task directory and list them in the artifact manifest, and the executor verifies them before they appear here.")})]}),e.reviews.length>0?t(T,{children:[t("div",{class:"acp-review-heading",children:[t("h3",{children:o("\u9636\u6BB5\u4EA7\u7269\u5BA1\u6838","Stage artifact review")}),t("label",{children:[o("\u7248\u672C","Version"),t("select",{value:n?.reviewId||s||"",onChange:l=>a(l.currentTarget.value),children:[s&&!n&&t("option",{value:s,children:o("\u672A\u627E\u5230\u8BF7\u6C42\u7684\u7248\u672C","Requested version unavailable")}),[...e.reviews].reverse().map(l=>t("option",{value:l.reviewId,children:[l.revision," \xB7 ",Rt(l.status)]},l.reviewId))]})]})]}),n?t(T,{children:[t("div",{class:"acp-review-version",children:[t(Q,{value:n.status}),t("span",{children:n.revision}),t("span",{children:H(n.createdAt)})]}),t("h3",{children:n.preview.title||n.title}),n.preview.kind==="markdown"&&t("section",{class:"acp-report-preview",children:[t("p",{class:"acp-muted",children:[o("\u62A5\u544A\u6587\u4EF6\uFF1A","Report file: "),t("code",{children:n.preview.reportPath})]}),t(zn,{markdown:n.preview.markdown||"",path:n.preview.reportPath})]}),n.preview.slides.map((l,u)=>t("section",{class:"acp-script-slide",children:[t("h4",{children:[t("span",{children:String(u+1).padStart(2,"0")}),l.title]}),t("p",{class:"acp-slide-message",children:l.message}),t("ul",{children:l.body.map((p,f)=>t("li",{children:p},f))}),l.visual&&t("p",{children:[t("span",{class:"acp-muted",children:o("\u753B\u9762\u5EFA\u8BAE\uFF1A","Visual: ")}),l.visual]}),l.notes&&t("p",{children:l.notes}),t("details",{class:"acp-slide-sources",children:[t("summary",{children:o("\u4E8B\u5B9E\u4E0E\u7D20\u6750\u4F9D\u636E","Facts and sources")}),l.facts.length>0&&t("ul",{children:l.facts.map((p,f)=>t("li",{children:p},f))}),t("ul",{children:l.sources.map((p,f)=>t("li",{children:t("code",{children:p})},f))})]})]},`${n.reviewId}:${u}`)),t("details",{class:"acp-context",children:[t("summary",{children:o("\u5BA1\u6838\u7248\u672C\u6807\u8BC6","Review version reference")}),t("dl",{children:[t("dt",{children:o("\u5185\u5BB9\u6458\u8981","Content digest")}),t("dd",{children:t("code",{children:n.digest})}),t("dt",{children:o("\u4F5C\u8005\u6267\u884C\u8F6E\u6B21","Author attempt")}),t("dd",{children:n.authorAttemptId||n.attemptId})]})]})]}):t("p",{class:"acp-decision-error",children:o("\u627E\u4E0D\u5230\u94FE\u63A5\u5BF9\u5E94\u7684\u5BA1\u6838\u7248\u672C\uFF0C\u8BF7\u9009\u62E9\u53EF\u7528\u7248\u672C\u3002","The linked review version is unavailable. Select an available version.")})]}):t(Pe,{title:o("\u5F53\u524D\u6CA1\u6709\u9636\u6BB5\u5BA1\u6838","No stage review"),description:e.parentJobRef?o("\u53EF\u4EE5\u8FD4\u56DE\u7236\u4EFB\u52A1\u67E5\u770B\u5B8C\u6574\u4EA4\u4ED8\u4E0E\u5BA1\u6838\u3002","Open the parent task to see workflow reviews."):o("\u4EA7\u7269\u5F62\u6210\u540E\uFF0C\u4F1A\u5728\u8FD9\u91CC\u5C55\u793A\u53EF\u786E\u8BA4\u7684\u7248\u672C\u3002","Reviewable versions appear here once artifacts are ready.")})]})}function eo({review:e}){let n={comment:o("\u53D1\u8868\u8BC4\u8BBA","Commented"),approve:o("\u901A\u8FC7","Approved"),changes_requested:o("\u8981\u6C42\u4FEE\u6539","Requested changes"),cancel:o("\u653E\u5F03\u4EFB\u52A1","Abandoned task")};return t("section",{class:"acp-detail-section",children:[t("h3",{children:o("\u610F\u89C1\u4E0E\u51B3\u5B9A","Feedback and decisions")}),e.history.length?e.history.map((s,a)=>t("article",{class:"acp-review-event",children:[t("header",{children:[t("strong",{children:s.actor.displayName||s.actor.id}),t("span",{children:n[s.action]}),t("time",{children:H(s.at)})]}),s.note&&t("p",{children:s.note})]},`${s.at}:${a}`)):t("p",{class:"acp-muted",children:o("\u5F53\u524D\u7248\u672C\u5C1A\u65E0\u610F\u89C1\u6216\u51B3\u5B9A","No feedback or decisions for this version")})]})}function to({detail:e}){return t("section",{class:"acp-detail-section",children:[t("h3",{children:o("\u4EFB\u52A1\u4E8B\u4EF6","Task events")}),e.events.length?t("ol",{class:"acp-event-list",children:[...e.events].reverse().map(n=>t("li",{children:[t("time",{children:H(n.observedAt)}),t("div",{children:[t("strong",{title:n.type,children:xn(n.type)}),n.attemptId&&t("small",{children:[o("\u6267\u884C\u8F6E\u6B21\uFF1A","Attempt: "),n.attemptId]}),n.data!==void 0&&t("details",{children:[t("summary",{children:o("\u6280\u672F\u8BE6\u60C5","Technical details")}),t("pre",{children:JSON.stringify(n.data,null,2)})]})]})]},n.eventId))}):t("p",{class:"acp-muted",children:o("\u6682\u65E0\u4EFB\u52A1\u4E8B\u4EF6","No task events")})]})}var no=["all","pending","working","failed"],so={all:0,pending:0,working:0,failed:0},qt=100;function oo({onDone:e}){let[n,s]=g(""),[a,i]=g(""),[r,c]=g(!1);return t("form",{class:"acp-login",onSubmit:l=>{l.preventDefault(),c(!0),i(""),at.login(n.trim()).then(()=>e()).catch(u=>i(de(u))).finally(()=>c(!1))},children:[t("h1",{children:o("\u4EFB\u52A1\u5DE5\u4F5C\u53F0","Task workbench")}),t("p",{class:"acp-muted",children:o("\u8F93\u5165 A2A \u7F51\u5173\u914D\u7F6E\u91CC\u7684 workbench.token\u3002\u767B\u5F55\u53EA\u5728\u672C\u673A\u8FD9\u4E2A\u7F51\u5173\u4E0A\u6709\u6548\uFF0C12 \u5C0F\u65F6\u540E\u9700\u8981\u91CD\u65B0\u767B\u5F55\u3002","Enter workbench.token from the A2A gateway config. The login is valid on this gateway for 12 hours.")}),t("label",{children:[o("\u5DE5\u4F5C\u53F0\u4EE4\u724C","Workbench token"),t("input",{type:"password",autoComplete:"current-password",value:n,onInput:l=>s(l.currentTarget.value)})]}),a&&t("p",{class:"acp-decision-error",role:"alert",children:a}),t("button",{type:"submit",class:"acp-button acp-primary",disabled:r||!n.trim(),children:o("\u767B\u5F55","Sign in")})]})}function ao({onLogout:e}){let n=In(),[s,a]=g("cases"),[i,r]=g("all"),[c,l]=g(0),[u,p]=g(null),[f,d]=g(!0),[h,_]=g(""),[C,m]=g(0),x=j(0),y=j(!1);R(()=>{let v=++x.current,L=!1;y.current=!1,d(!0);let O=async()=>{if(!y.current){y.current=!0;try{let N=await U.list(i,c,qt);!L&&v===x.current&&(p(N),_(""))}catch(N){!L&&v===x.current&&_(de(N))}finally{!L&&v===x.current&&(d(!1),y.current=!1)}}};O();let X=window.setInterval(()=>{O()},5e3);return()=>{L=!0,window.clearInterval(X)}},[i,c,C]),R(()=>{n.jobId&&a("tasks")},[n.jobId]),R(()=>{let v=L=>{L.key==="Escape"&&n.jobId&&z({full:!1})};return window.addEventListener("keydown",v),()=>window.removeEventListener("keydown",v)},[n.jobId]);let w=[...u?.items||[]].sort((v,L)=>L.updatedAt.localeCompare(v.updatedAt)),S=u?.counts||so,k=(v,L)=>z({jobId:v.jobId,reviewId:L,full:!1});return t("section",{class:`acp-workbench${n.jobId?" has-detail":""}${n.full?" is-full-detail":""}`,children:[t("header",{class:"acp-workbench-header",children:[t("div",{class:"acp-workbench-title",children:[t("h1",{children:o("\u4EFB\u52A1\u5DE5\u4F5C\u53F0","Task workbench")}),t("nav",{class:"acp-module-switch","aria-label":o("\u5DE5\u4F5C\u53F0\u6A21\u5757","Workbench modules"),children:[t("button",{type:"button","aria-pressed":s==="cases",onClick:()=>a("cases"),children:o("\u4E8B\u60C5","Cases")}),t("button",{type:"button","aria-pressed":s==="tasks",onClick:()=>a("tasks"),children:o("\u4EFB\u52A1","Tasks")}),t("button",{type:"button","aria-pressed":s==="agents",onClick:()=>{a("agents"),n.jobId&&z({full:!1})},children:o("\u667A\u80FD\u4F53","Agents")})]})]}),t("div",{class:"acp-header-actions",children:[t("button",{type:"button",class:"acp-button",onClick:()=>m(v=>v+1),disabled:f,children:o("\u5237\u65B0","Refresh")}),e&&t("button",{type:"button",class:"acp-button",onClick:e,children:o("\u9000\u51FA\u767B\u5F55","Sign out")})]})]}),t("p",{class:"acp-workbench-source",children:o("\u6570\u636E\u6765\u6E90\uFF1A\u672C\u673A A2A \u7F51\u5173\u8D26\u672C\u3002","Source: this A2A gateway ledger.")}),s==="agents"?t(En,{refreshKey:C,onOpenTask:v=>{a("tasks"),z({jobId:v,full:!1})}}):s==="cases"?t(Jn,{refreshKey:C}):t(T,{children:[t("nav",{class:"acp-workbench-views","aria-label":o("\u4EFB\u52A1\u89C6\u56FE","Task views"),children:no.map(v=>t("button",{type:"button","aria-pressed":i===v,onClick:()=>{r(v),l(0)},children:[{all:o("\u5168\u90E8\u4EFB\u52A1","All tasks"),pending:o("\u5F85\u6211\u786E\u8BA4","My reviews"),working:o("\u8FDB\u884C\u4E2D","Working"),failed:o("\u5F02\u5E38","Needs attention")}[v],u&&t("span",{children:S[v]})]},v))}),t("div",{class:"acp-workbench-body",children:[t("div",{class:"acp-workbench-table",children:[h&&t(ue,{title:o("\u4EFB\u52A1\u8BFB\u53D6\u5931\u8D25","Could not load tasks"),message:h,onRetry:()=>m(v=>v+1)}),t("table",{children:[t("thead",{children:t("tr",{children:[t("th",{children:o("\u4EFB\u52A1\u540D\u79F0","Task")}),t("th",{children:o("\u4EFB\u52A1\u6027\u8D28","Task kind")}),t("th",{children:o("\u6267\u884C\u72B6\u6001","Status")}),t("th",{children:o("\u4EFB\u52A1\u65B9\u5F0F","Task mode")}),t("th",{children:o("\u89D2\u8272\u6216\u9884\u8BBE","Role / preset")}),t("th",{children:o("\u6267\u884C\u670D\u52A1","Execution service")}),t("th",{children:o("\u5F53\u524D\u9636\u6BB5","Phase")}),t("th",{children:o("\u5F85\u529E\u4E0E\u5361\u70B9","Action / blocker")}),t("th",{children:o("\u6700\u8FD1\u8FDB\u5C55","Last updated")})]})}),t("tbody",{children:[!f&&!w.length&&t("tr",{children:t("td",{colSpan:9,class:"acp-muted",children:i==="all"?o("\u5F53\u524D\u6CA1\u6709 ACP \u6267\u884C\u4EFB\u52A1","No ACP execution tasks yet"):o("\u5F53\u524D\u89C6\u56FE\u6CA1\u6709\u5339\u914D\u7684\u4EFB\u52A1","No tasks in this view")})}),w.map(v=>t("tr",{class:`acp-task-row${n.jobId===v.jobId?" is-selected":""}`,children:[t("td",{children:t("div",{class:"acp-task-name",style:{paddingLeft:`${Math.min(An(v,w),6)*16}px`},children:t("button",{type:"button",class:"acp-link acp-name-link",title:ve(v),onClick:()=>k(v,i==="pending"?v.pendingReviewId:void 0),children:[t("span",{class:"acp-title-text",children:ve(v)}),t("small",{title:v.jobId,children:v.jobId.length>12?`${v.jobId.slice(0,8)}\u2026`:v.jobId})]})})}),t("td",{children:[t("span",{class:"acp-mode-label",children:ct(v.channel)}),v.agentName&&t("small",{class:"acp-cell-note",children:v.agentName})]}),t("td",{children:[t(Q,{value:Re(v)}),!!v.unresolvedAttemptIds?.length&&t("small",{class:"acp-stale",children:o("\u6709\u5F85\u6838\u5B9E\u7684\u5386\u53F2\u6267\u884C","Prior execution needs verification")}),v.stale&&t("small",{class:"acp-stale",children:o("\u72B6\u6001\u5F85\u540C\u6B65","Awaiting sync")})]}),t("td",{children:t("span",{class:"acp-mode-label",children:le(v.execution,B).mode})}),t("td",{children:t(Fe,{execution:v.execution})}),t("td",{children:t(Se,{execution:v.execution})}),t("td",{children:Cn(v.phase||"")||"\u2014"}),t("td",{children:[v.pendingReviewId&&t("button",{type:"button",class:"acp-link",onClick:()=>k(v,v.pendingReviewId),children:o("\u67E5\u770B\u5E76\u786E\u8BA4","Review content")}),v.pendingProcessRequestId&&t("button",{type:"button",class:"acp-link",onClick:()=>k(v),children:o("\u56DE\u7B54\u8FC7\u7A0B\u8BF7\u6C42","Answer request")}),!v.pendingReviewId&&!v.pendingProcessRequestId&&t("span",{class:"acp-task-blocker",title:v.progressSummary,children:Tn(v.progressSummary)})]}),t("td",{class:"acp-task-updated",children:H(v.updatedAt)})]},v.jobId))]})]}),u&&t("div",{class:"acp-pagination",children:[t("span",{children:o(`${u.total} \u6761\u4EFB\u52A1\u8BB0\u5F55`,`${u.total} task records`)}),t("button",{type:"button",class:"acp-button",disabled:c===0||f,onClick:()=>l(Math.max(0,c-qt)),children:o("\u4E0A\u4E00\u9875","Previous")}),t("button",{type:"button",class:"acp-button",disabled:c+w.length>=u.total||f,onClick:()=>l(c+qt),children:o("\u4E0B\u4E00\u9875","Next")})]})]}),n.jobId&&t(Gn,{jobId:n.jobId,requestedReviewId:n.reviewId,full:n.full,onChanged:()=>m(v=>v+1)},n.jobId)]})]})]})}function ro(){let[e,n]=g("checking"),[s,a]=g(!0);return R(()=>{at.status().then(r=>{a(r.loginRequired!==!1),n(r.authenticated?"ready":"login")}).catch(()=>n("login"));let i=()=>n("login");return ot.addEventListener("required",i),()=>ot.removeEventListener("required",i)},[]),e==="checking"?t("p",{class:"acp-muted acp-boot",children:o("\u6B63\u5728\u8FDE\u63A5\u7F51\u5173\u2026","Connecting to the gateway\u2026")}):e==="login"?t(oo,{onDone:()=>n("ready")}):t(ao,{onLogout:s?()=>{at.logout().finally(()=>n("login"))}:void 0})}rn(t(ro,{}),document.getElementById("app"));
|