@1agents/acp-service 0.10.3 → 0.10.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/dist/src/a2a/index.d.ts +1 -1
  2. package/dist/src/a2a/index.js +1 -1
  3. package/dist/src/a2a/standalone.d.ts +4 -0
  4. package/dist/src/a2a/standalone.js +3 -0
  5. package/dist/src/a2a/workbench-ui.js +6 -2
  6. package/dist/src/capacity.d.ts +6 -1
  7. package/dist/src/capacity.js +5 -4
  8. package/dist/workbench-ui/app.js +1 -1
  9. package/package.json +5 -1
  10. package/vendor/dsh/README.md +1 -1
  11. package/vendor/dsh/a2a-executor.d.ts +3 -3
  12. package/vendor/dsh/a2a.d.ts +2 -2
  13. package/vendor/dsh/a2a.js +1 -4
  14. package/vendor/dsh/adapter.d.ts +5 -5
  15. package/vendor/dsh/cordis.patch.yml +2 -1
  16. package/vendor/dsh/diagnostics.d.ts +2 -14
  17. package/vendor/dsh/diagnostics.js +4 -79
  18. package/vendor/dsh/index.js +1 -3
  19. package/vendor/dsh/ticket-tools.d.ts +1 -1
  20. package/vendor/runtime/dist/{cli-Cy5XbWX9.js → cli-DXmYwv3U.js} +4 -4
  21. package/vendor/runtime/dist/{cli-Cy5XbWX9.js.map → cli-DXmYwv3U.js.map} +1 -1
  22. package/vendor/runtime/dist/cli.js +7 -7
  23. package/vendor/runtime/dist/{client-C5zneoBs.d.ts → client-VQsqcIOJ.d.ts} +1 -3
  24. package/vendor/runtime/dist/{client-C5zneoBs.d.ts.map → client-VQsqcIOJ.d.ts.map} +1 -1
  25. package/vendor/runtime/dist/{flows-q0phAwvh.js → flows-DJ17ajbw.js} +3 -3
  26. package/vendor/runtime/dist/{flows-q0phAwvh.js.map → flows-DJ17ajbw.js.map} +1 -1
  27. package/vendor/runtime/dist/flows.d.ts +1 -1
  28. package/vendor/runtime/dist/flows.js +1 -1
  29. package/vendor/runtime/dist/{invocation-options-BxtrhRYT.js → invocation-options-PBfCgrdi.js} +3 -3
  30. package/vendor/runtime/dist/{invocation-options-BxtrhRYT.js.map → invocation-options-PBfCgrdi.js.map} +1 -1
  31. package/vendor/runtime/dist/{output-BiOUhKGO.js → output-B3MDn7kv.js} +2 -2
  32. package/vendor/runtime/dist/{output-BiOUhKGO.js.map → output-B3MDn7kv.js.map} +1 -1
  33. package/vendor/runtime/dist/{queue-owner-runtime-CJwEW-f-.js → queue-owner-runtime-DXCVngwU.js} +1 -10
  34. package/vendor/runtime/dist/queue-owner-runtime-DXCVngwU.js.map +1 -0
  35. package/vendor/runtime/dist/runtime.d.ts +1 -1
  36. package/vendor/runtime/dist/runtime.js +1 -1
  37. package/vendor/runtime/dist/{session-watch-kRtST0Y5.js → session-watch-DURyCw31.js} +2 -2
  38. package/vendor/runtime/dist/{session-watch-kRtST0Y5.js.map → session-watch-DURyCw31.js.map} +1 -1
  39. package/vendor/runtime/dist/docs-site/.nojekyll +0 -0
  40. package/vendor/runtime/dist/docs-site/CLI.html +0 -833
  41. package/vendor/runtime/dist/docs-site/VISION.html +0 -415
  42. package/vendor/runtime/dist/docs-site/agents.html +0 -391
  43. package/vendor/runtime/dist/docs-site/compare.html +0 -359
  44. package/vendor/runtime/dist/docs-site/config.html +0 -450
  45. package/vendor/runtime/dist/docs-site/custom-agents.html +0 -408
  46. package/vendor/runtime/dist/docs-site/exit-codes.html +0 -347
  47. package/vendor/runtime/dist/docs-site/favicon.svg +0 -21
  48. package/vendor/runtime/dist/docs-site/flows.html +0 -498
  49. package/vendor/runtime/dist/docs-site/index.html +0 -367
  50. package/vendor/runtime/dist/docs-site/install.html +0 -386
  51. package/vendor/runtime/dist/docs-site/llms.txt +0 -36
  52. package/vendor/runtime/dist/docs-site/output-formats.html +0 -407
  53. package/vendor/runtime/dist/docs-site/permissions.html +0 -422
  54. package/vendor/runtime/dist/docs-site/prompting.html +0 -460
  55. package/vendor/runtime/dist/docs-site/quickstart.html +0 -382
  56. package/vendor/runtime/dist/docs-site/releasing.html +0 -341
  57. package/vendor/runtime/dist/docs-site/runtime-environment.html +0 -329
  58. package/vendor/runtime/dist/docs-site/runtime-process-lifecycle.html +0 -336
  59. package/vendor/runtime/dist/docs-site/safe-errors.html +0 -323
  60. package/vendor/runtime/dist/docs-site/session-control.html +0 -408
  61. package/vendor/runtime/dist/docs-site/session-watch.html +0 -354
  62. package/vendor/runtime/dist/docs-site/sessions.html +0 -488
  63. package/vendor/runtime/dist/docs-site/shared-sessions.html +0 -377
  64. package/vendor/runtime/dist/queue-owner-runtime-CJwEW-f-.js.map +0 -1
@@ -2,7 +2,7 @@
2
2
  export { createA2AServer } from './server.js';
3
3
  export type { A2AServerOptions } from './server.js';
4
4
  export { A2AResubmitError } from './resubmit.js';
5
- export { WORKBENCH_UI_PATH, isAgentRequest, sameOriginBrowser, serveWorkbenchPage } from './workbench-ui.js';
5
+ export { WorkbenchUi, WORKBENCH_UI_PATH, isAgentRequest, sameOriginBrowser, serveWorkbenchPage } from './workbench-ui.js';
6
6
  export type { A2AResubmission, A2AResubmitCode, A2ASessionTask } from './resubmit.js';
7
7
  export { FileA2AStore } from './store.js';
8
8
  export type { A2ABackend, A2ACloseResult, A2APrepareInput, A2ARunResult, A2ASessionStatus, A2ATarget, A2APreflightInput, A2APreflightRequirements, A2APreflightReport, A2ARoleSkills } from './types.js';
@@ -1,7 +1,7 @@
1
1
  /** Shared A2A 1.0 server, persistent state and host-independent executor interfaces. */
2
2
  export { createA2AServer } from './server.js';
3
3
  export { A2AResubmitError } from './resubmit.js';
4
- export { WORKBENCH_UI_PATH, isAgentRequest, sameOriginBrowser, serveWorkbenchPage } from './workbench-ui.js';
4
+ export { WorkbenchUi, WORKBENCH_UI_PATH, isAgentRequest, sameOriginBrowser, serveWorkbenchPage } from './workbench-ui.js';
5
5
  export { FileA2AStore } from './store.js';
6
6
  export { bindA2AExecution, currentA2AExecution, unbindA2AExecution } from './execution-binding.js';
7
7
  export { a2aRoleSkillsSchema } from './types.js';
@@ -0,0 +1,4 @@
1
+ /** Narrow standalone-host entrypoint: A2A HTTP server and workspace preflight only. */
2
+ export { createA2AServer } from './server.js';
3
+ export type { A2AServerOptions } from './server.js';
4
+ export { a2aPreflightInputSchema, a2aPreflightRequirementsSchema, a2aPreflightReportSchema, A2APreflightError, runA2APreflight } from './preflight.js';
@@ -0,0 +1,3 @@
1
+ /** Narrow standalone-host entrypoint: A2A HTTP server and workspace preflight only. */
2
+ export { createA2AServer } from './server.js';
3
+ export { a2aPreflightInputSchema, a2aPreflightRequirementsSchema, a2aPreflightReportSchema, A2APreflightError, runA2APreflight } from './preflight.js';
@@ -27,8 +27,12 @@ const SECURITY_HEADERS = {
27
27
  */
28
28
  function assetDirectory() {
29
29
  const here = path.dirname(fileURLToPath(import.meta.url));
30
- return [path.resolve(here, '../../workbench-ui'), path.resolve(here, '../../dist/workbench-ui')]
31
- .find(directory => existsSync(path.join(directory, 'app.js')));
30
+ return [
31
+ path.resolve(here, '../../workbench-ui'),
32
+ path.resolve(here, '../../dist/workbench-ui'),
33
+ path.resolve(here, 'workbench-ui'),
34
+ path.resolve(here, '../workbench-ui'),
35
+ ].find(directory => existsSync(path.join(directory, 'app.js')));
32
36
  }
33
37
  function send(res, status, type, payload, headers = {}) {
34
38
  res.writeHead(status, { ...SECURITY_HEADERS, 'Content-Type': type, ...headers });
@@ -25,7 +25,7 @@ export interface CapacityRequest {
25
25
  export interface CapacityLimits {
26
26
  soft: number;
27
27
  hard: number;
28
- basis: 'hardware-estimate' | 'configured';
28
+ basis: 'hardware-estimate' | 'package' | 'configured';
29
29
  }
30
30
  export interface CapacitySnapshot {
31
31
  limits: CapacityLimits;
@@ -69,6 +69,11 @@ export declare class CapacityError extends Error {
69
69
  readonly code: CapacityErrorCode;
70
70
  constructor(code: CapacityErrorCode);
71
71
  }
72
+ /** Shipped admission limits. Every host sharing one capacity directory uses these unless it sets the same override. */
73
+ export declare const packageCapacityLimits: {
74
+ readonly soft: 8;
75
+ readonly hard: 12;
76
+ };
72
77
  /** Allow roughly one automatic agent per two CPUs and 3 GiB, then keep at least one manual slot. */
73
78
  export declare function estimateCapacityLimits(): CapacityLimits;
74
79
  /** Darwin's raw free count excludes reclaimable inactive caches. Purgeable pages are not added twice. */
@@ -26,6 +26,8 @@ const stateMessage = 'ACP capacity state is unavailable; check the local host ca
26
26
  const pidIsValid = (value) => Number.isSafeInteger(value) && value > 0;
27
27
  const validKind = (value) => value === 'process' || value === 'task';
28
28
  const validSource = (value) => value === 'automatic' || value === 'interactive';
29
+ /** Shipped admission limits. Every host sharing one capacity directory uses these unless it sets the same override. */
30
+ export const packageCapacityLimits = { soft: 8, hard: 12 };
29
31
  /** Allow roughly one automatic agent per two CPUs and 3 GiB, then keep at least one manual slot. */
30
32
  export function estimateCapacityLimits() {
31
33
  const cores = availableParallelism();
@@ -114,13 +116,12 @@ export class CapacityGovernor {
114
116
  estimatedInstanceBytes;
115
117
  constructor(options = {}) {
116
118
  this.directory = resolveCapacityDirectory(options);
117
- const estimate = estimateCapacityLimits();
118
119
  const soft = limit(options.softLimit ?? process.env.ACP_CAPACITY_SOFT_LIMIT, 'ACP capacity soft limit');
119
120
  const hard = limit(options.hardLimit ?? process.env.ACP_CAPACITY_HARD_LIMIT, 'ACP capacity hard limit');
120
121
  this.limits = {
121
- soft: soft ?? (hard === undefined ? estimate.soft : Math.min(estimate.soft, hard - 1)),
122
- hard: hard ?? Math.max(estimate.hard, (soft ?? estimate.soft) + 1),
123
- basis: soft === undefined && hard === undefined ? 'hardware-estimate' : 'configured',
122
+ soft: soft ?? packageCapacityLimits.soft,
123
+ hard: hard ?? packageCapacityLimits.hard,
124
+ basis: soft === undefined && hard === undefined ? 'package' : 'configured',
124
125
  };
125
126
  if (this.limits.soft < 1 || this.limits.hard <= this.limits.soft || !Number.isSafeInteger(this.limits.hard)) {
126
127
  throw new Error('ACP capacity hard limit must exceed the soft limit and reserve at least one interactive slot');
@@ -10,4 +10,4 @@ reasoningEffort=high`,onInput:n=>e.onOptions(n.currentTarget.value)})]})]})}func
10
10
  `)){let d=c.join("")+l,u=/<span[^>]*>|<\/span>/g,f,p=[...c];for(;f=u.exec(l);)f[0]==="</span>"?p.pop():p.push(f[0]);d+="</span>".repeat(p.length),c=p,s.push(d)}return s}async function jn(e,n){return(await Mt(e,n)).join(`
11
11
  `)}var Mn,Dt=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;");async function mr(){let[{Marked:e},n]=await Promise.all([import("./chunk-IZXOKUGG.js"),import("./chunk-KOUZX3UX.js")]),r=new e({gfm:!0,breaks:!1});r.use({async:!1,renderer:{code({text:a,lang:s}){let c=(s||"").trim().split(/\s+/)[0]||"";return c==="mermaid"?`<div class="fp-mermaid" data-mermaid="${encodeURIComponent(a)}"><pre>${Dt(a)}</pre></div>`:`<pre class="fp-md-code"><code class="hljs" data-lang="${Dt(c)}">${Dt(a)}</code></pre>`}}});let o=n.default;return{marked:r,purify:o}}async function he(e,n={}){Mn??=mr();let{marked:r,purify:o}=await Mn,a=r.parse(e),s=new DOMParser().parseFromString(o.sanitize(a,{ADD_ATTR:["data-mermaid","data-lang"]}),"text/html");for(let c of s.querySelectorAll("a[href]")){let l=c.getAttribute("href")||"",d=n.resolveUrl?n.resolveUrl(l,"link"):l;if(d===void 0){c.removeAttribute("href");continue}c.setAttribute("href",d),/^(https?:)?\/\//i.test(d)&&(c.setAttribute("target","_blank"),c.setAttribute("rel","noopener noreferrer"))}for(let c of s.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 s.querySelectorAll("code.hljs[data-lang]")){let l=it(c.dataset.lang||"");l&&(c.innerHTML=await jn(c.textContent||"",l))}return s.body.innerHTML}var Dn,Ln,gr=0;async function Le(e,n="light"){let r=[...e.querySelectorAll(".fp-mermaid[data-mermaid]")].filter(a=>a.dataset.drawnTheme!==n);if(!r.length)return;Dn??=import("./chunk-Z6QR6FRE.js").then(a=>a.default);let o=await Dn;Ln!==n&&(o.initialize({startOnLoad:!1,securityLevel:"strict",theme:n==="dark"?"dark":"default"}),Ln=n);for(let a of r){let s="";try{s=decodeURIComponent(a.dataset.mermaid||"")}catch{continue}try{let{svg:c}=await o.render(`fp-mermaid-${++gr}`,s);a.innerHTML=c,a.dataset.drawnTheme=n}catch{a.classList.add("fp-mermaid-error"),a.textContent=s,a.dataset.drawnTheme=n}}}var hr={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"},vr=2*1024*1024;function Lt(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 _r(e,n,r,o,a){let[s,c]=g({status:"idle"});return T(()=>{if(!Pt(e))return c({status:"idle"});if(r!==void 0){let d=r.length>o;return c({status:"ready",text:d?r.slice(0,o):r,truncated:d})}if(!n||!Lt(n))return c({status:"error",message:""});let l=new AbortController;return c({status:"loading"}),(async()=>{let d=await(a?a(n):fetch(n,{credentials:"same-origin",signal:l.signal}));if(!d.ok)throw new Error(`${d.status} ${d.statusText}`.trim());let u=await d.arrayBuffer(),f=u.byteLength>o;c({status:"ready",text:new TextDecoder().decode(f?u.slice(0,o):u),truncated:f})})().catch(d=>{l.signal.aborted||c({status:"error",message:d instanceof Error?d.message:String(d)})}),()=>l.abort()},[e,n,r,o,a]),s}function br(e){return e||(typeof matchMedia=="function"&&matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light")}function yr({text:e,theme:n,options:r,onOpenLink:o,diagrams:a}){let[s,c]=g(""),l=E(null);return T(()=>{let d=!0;return he(e,r).then(u=>d&&c(u)).catch(()=>d&&c("")),()=>{d=!1}},[e,r]),T(()=>{a&&s&&l.current&&Le(l.current,n)},[s,n,a]),t("div",{ref:l,class:"fp-md",dangerouslySetInnerHTML:{__html:s},onClick:d=>{let u=d.target.closest("a"),f=u?.getAttribute("href");if(!(!u||!f))if(f.startsWith("#")){d.preventDefault();let p=decodeURIComponent(f.slice(1));l.current?.querySelector(`[id="${p.replace(/"/g,'\\"')}"]`)?.scrollIntoView({behavior:"smooth"})}else o&&(d.preventDefault(),o(f))}})}function wr({text:e,lang:n,targetLine:r}){let[o,a]=g(null),s=E(null);T(()=>{let d=!0;return a(null),Mt(e,n).then(u=>d&&a(u)).catch(()=>d&&a(e.split(`
12
12
  `))),()=>{d=!1}},[e,n]),T(()=>{o&&r&&s.current?.scrollIntoView({block:"center"})},[o,r]);let c=Me(()=>e.split(`
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||document.hidden)){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"));
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"));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1agents/acp-service",
3
- "version": "0.10.3",
3
+ "version": "0.10.5",
4
4
  "description": "agent-workflow ACP runtime, CLI, HTTP/WebSocket service and DeepSeek Harness ACP/A2A plugins in one package. Part of 一芥天地 (DreamMate World).",
5
5
  "keywords": [
6
6
  "dreammate",
@@ -72,6 +72,10 @@
72
72
  "./a2a": {
73
73
  "types": "./dist/src/a2a/index.d.ts",
74
74
  "import": "./dist/src/a2a/index.js"
75
+ },
76
+ "./a2a-standalone": {
77
+ "types": "./dist/src/a2a/standalone.d.ts",
78
+ "import": "./dist/src/a2a/standalone.js"
75
79
  }
76
80
  },
77
81
  "bin": {
@@ -103,7 +103,7 @@ The bundle's `oneagents-acp` row accepts `serviceUrl`, `serviceMode`, `serviceSt
103
103
 
104
104
  Explicitly authorized unattended work can declare `sessionPolicies`, with an exact absolute `cwd`, ACP registry `agent`, and optional `initialModeId`. A policy matches only that workspace and Agent; wildcards and duplicate scopes are rejected. New sessions select the advertised native mode before sending any prompt; an unavailable mode fails without prompting. A stored ACP 设置 record for the same workspace and Agent is applied on that new session, and its mode replaces `initialModeId`. Existing sessions keep their native mode and any ACP settings already selected or imported. `permissionMode` (`approve-reads`, `approve-all`, `deny-all`) may still appear in older configs and is ignored: the bridge does not apply that three-state shield. Mode and reasoning effort come from ACP 设置 (`session/set_mode`, `session/set_config_option`) or from the native session an import resumes. For example, an authorized Codex video workspace can use `initialModeId: "agent-full-access"` without changing the host's global model or other workspaces. Remove the declaration when the authorized batch ends; existing native sessions retain their own stored mode.
105
105
 
106
- Diagnostic storage defaults to `stateDirectory/diagnostics`; `diagnosticsDirectory` selects a separate explicit location. Keep this directory with the A2A state when moving a host. Its version is independent of DSH Session formats. The plugin privately mounts official storage components; it does not require a shared host storage-domain configuration. Only one plugin instance may write the directory at a time. A second DSH process, such as desktop while web already holds the lock, starts instead of failing: A2A reads the owner's records and rejects mutations, and that follower's diagnostics stay in memory so a chat turn is not failed for lack of the lock. The follower does not mark the owner's in-flight tasks failed and does not release the owner's lock. Session binding files in `stateDirectory` are outside that lock.
106
+ Diagnostic storage defaults to `stateDirectory/diagnostics`; `diagnosticsDirectory` selects a separate explicit location. Keep this directory with the A2A state when moving a host. Its version is independent of DSH Session formats. The plugin privately mounts official storage components; it does not require a shared host storage-domain configuration. Only one plugin instance may write the directory at a time.
107
107
 
108
108
  ### Local service lifecycle
109
109
 
@@ -1,7 +1,7 @@
1
1
  import type { Context } from '@deepseek-ai/cordis';
2
2
  import type { SessionId } from '@deepseek-ai/dsh-session';
3
3
  import { type A2ABackend, type A2AExecutionRef, type A2APreflightInput, type A2APrepareInput, type A2ARunResult, type A2ATarget } from '@1agents/acp-service/a2a';
4
- import type { DiagnosticLog } from './diagnostics.js';
4
+ import type { Diagnostics } from './diagnostics.js';
5
5
  export interface SessionControl {
6
6
  release(sessionId: string): Promise<{
7
7
  processReleased: true | 'pending';
@@ -36,7 +36,7 @@ export declare class DshA2ABackend implements A2ABackend {
36
36
  private readonly sessions?;
37
37
  private readonly executions;
38
38
  /** @param ctx DSH plugin context that owns session-controller and execution event registrations. */
39
- constructor(ctx: Context, diagnostics?: DiagnosticLog | undefined, sessions?: SessionControl | undefined);
39
+ constructor(ctx: Context, diagnostics?: Diagnostics, sessions?: SessionControl);
40
40
  close(target: A2ATarget): Promise<{
41
41
  processReleased: true | 'pending';
42
42
  acp?: boolean;
@@ -54,7 +54,7 @@ export declare class DshA2ABackend implements A2ABackend {
54
54
  /** Restart reconciliation reads the plugin domain and never dispatches another prompt. */
55
55
  recover(target: A2ATarget, options: {
56
56
  requestId: string;
57
- }): Promise<import("@1agents/acp-service/runtime").SafeError | undefined>;
57
+ }): Promise<import("@1agents/acp-service/runtime").SafeError>;
58
58
  preflight(input: A2APreflightInput): Promise<import("@1agents/acp-service/a2a").A2APreflightReport>;
59
59
  /** Create a new session or restore an explicitly addressed session without changing its workspace or preset.
60
60
  * @param input Remote host directory, preset, and optional existing DSH session identity.
@@ -1,7 +1,7 @@
1
1
  /** Mount the shared A2A implementation on the current DSH web host. */
2
2
  import { createA2AServer, type A2AServerOptions } from '@1agents/acp-service/a2a';
3
3
  import type { Context } from '@deepseek-ai/cordis';
4
- import type { DiagnosticLog } from './diagnostics.js';
4
+ import type { Diagnostics } from './diagnostics.js';
5
5
  import { type SessionControl } from './a2a-executor.js';
6
6
  /** Optional host configuration; omitted configuration leaves A2A disabled. */
7
7
  export interface DshA2AOptions extends Omit<A2AServerOptions, 'backend' | 'token' | 'stateDirectory' | 'publicUrl'> {
@@ -23,4 +23,4 @@ export interface DshA2AOptions extends Omit<A2AServerOptions, 'backend' | 'token
23
23
  /** In-process takeover controls of the mounted host; absent while A2A is disabled or closed. */
24
24
  export type A2AHostControls = Pick<Awaited<ReturnType<typeof createA2AServer>>, 'sessionTask' | 'taskSession' | 'resubmit'>;
25
25
  /** Routes and in-flight turns are released with the owning Cordis plugin. */
26
- export declare function mountDshA2A(ctx: Context, options: DshA2AOptions, stateDirectory: string, diagnostics?: DiagnosticLog, sessions?: SessionControl, expose?: (host: A2AHostControls | undefined) => void): Promise<() => Promise<void>>;
26
+ export declare function mountDshA2A(ctx: Context, options: DshA2AOptions, stateDirectory: string, diagnostics?: Diagnostics, sessions?: SessionControl, expose?: (host: A2AHostControls | undefined) => void): Promise<() => Promise<void>>;
package/vendor/dsh/a2a.js CHANGED
@@ -13,10 +13,7 @@ export async function mountDshA2A(ctx, options, stateDirectory, diagnostics, ses
13
13
  const { workbench: _workbench, ...serverOptions } = options;
14
14
  const server = await createA2AServer({ ...serverOptions, token, backend: new DshA2ABackend(ctx, diagnostics, sessions),
15
15
  stateDirectory: options.stateDirectory ?? stateDirectory,
16
- publicUrl: options.publicUrl ?? `http://127.0.0.1:${ctx.webServer.port}`,
17
- storage: { onConflict: 'readonly' } });
18
- if (server.mode === 'read-only')
19
- console.warn('oneagents-acp A2A storage is read-only because another instance owns it');
16
+ publicUrl: options.publicUrl ?? `http://127.0.0.1:${ctx.webServer.port}` });
20
17
  const routes = [];
21
18
  try {
22
19
  routes.push(ctx.webServer.register({ kind: 'exact', path: '/.well-known/agent-card.json', handler: server.cardHandler }));
@@ -1,7 +1,7 @@
1
1
  import type { Context } from '@deepseek-ai/cordis';
2
2
  import type { Agent } from '@deepseek-ai/dsh-agent';
3
3
  import type { LlmAdapter, GenerateOptions, StreamChunk, LlmModelInfo } from '@deepseek-ai/dsh-llm';
4
- import type { DiagnosticLog } from './diagnostics.js';
4
+ import type { Diagnostics } from './diagnostics.js';
5
5
  import type { McpServer, SessionConfigOption, SessionModeState, AvailableCommand } from '@agentclientprotocol/sdk';
6
6
  import { type Binding } from './state.js';
7
7
  import type { ProcessRequestClient } from './process-requests.js';
@@ -58,7 +58,7 @@ export declare class AcpAdapter implements LlmAdapter {
58
58
  private readonly sessionSettings;
59
59
  /** MCP servers offered when a session is created or restored, such as the A2A hand-back tool. */
60
60
  mcpServersFor?: (sessionId: string) => McpServer[];
61
- constructor(ctx: Context, config: Config, diagnostics?: DiagnosticLog | undefined, processRequests?: ProcessRequestClient | undefined);
61
+ constructor(ctx: Context, config: Config, diagnostics?: Diagnostics, processRequests?: ProcessRequestClient);
62
62
  providerInfo(provider: string): {
63
63
  id: string;
64
64
  name: string;
@@ -66,12 +66,12 @@ export declare class AcpAdapter implements LlmAdapter {
66
66
  providerRetryPolicy(): {
67
67
  mode: "normal";
68
68
  maxRetries: number;
69
- retryableCodes: never[];
69
+ retryableCodes: any[];
70
70
  initialDelayMs: number;
71
71
  maxDelayMs: number;
72
72
  jitterRatio: number;
73
73
  };
74
- imageRequestPricing(): undefined;
74
+ imageRequestPricing(): any;
75
75
  /** DSH 0.2.1 requires this. ACP Agents take text only, so keep the base class's untouched image target. */
76
76
  imageRequestTarget(_provider: string, _model: string, image: {
77
77
  width: number;
@@ -96,7 +96,7 @@ export declare class AcpAdapter implements LlmAdapter {
96
96
  name: string;
97
97
  inputModalities: "text"[];
98
98
  };
99
- stream: (o: GenerateOptions) => AsyncIterable<StreamChunk>;
99
+ stream: (o: GenerateOptions) => AsyncIterable<any>;
100
100
  }>;
101
101
  dispose(): Promise<void>;
102
102
  agentName(agent: Agent): string | undefined;
@@ -4,7 +4,8 @@
4
4
  - id: oneagents-acp
5
5
  name: '@1agents/acp-service'
6
6
  config:
7
- serviceMode: auto
7
+ # Shared ACP daemon; do not fork one service per DSH profile.
8
+ serviceMode: external
8
9
  serviceUrl: http://127.0.0.1:36812
9
10
  reconnectAttempts: 5
10
11
  reconnectDelayMs: 1000