@abelxiaoxing/cadence 2.0.10 → 2.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +97 -25
- package/docs/reuse-and-distribution.md +3 -3
- package/docs/service-management.md +81 -3
- package/package.json +1 -1
- package/src/native-build.ts +1 -1
- package/src/native-client.ts +15 -9
- package/src/operator-cli.mjs +13 -2
- package/src/sdk-worker.mjs +5 -1
- package/src/service/contracts/current.ts +8 -1
- package/src/service-cli.mjs +465 -75
- package/src/service-host.mjs +52 -13
- package/src/task-store.ts +44 -10
- package/web/dist/assets/cadence.css +1 -1
- package/web/dist/assets/cadence.js +7 -7
- package/web/dist/manifest.json +7 -7
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime.js";import{n as t,r as n,t as r}from"./react.js";import{a as i,c as a,i as o,n as s,o as c,r as l,s as u,t as d}from"./markdown.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var f=e(n(),1),p={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},m=f.createContext&&f.createContext(p),h=[`attr`,`size`,`title`];function g(e,t){if(e==null)return{};var n,r,i=_(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function _(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function v(){return v=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},v.apply(null,arguments)}function y(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function b(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?y(Object(n),!0).forEach(function(t){x(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):y(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function x(e,t,n){return(t=S(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function S(e){var t=C(e,`string`);return typeof t==`symbol`?t:t+``}function C(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function w(e){return e&&e.map((e,t)=>f.createElement(e.tag,b({key:t},e.attr),w(e.child)))}function T(e){return t=>f.createElement(E,v({attr:b({},e.attr)},t),w(e.child))}function E(e){var t=t=>{var n=e.attr,r=e.size,i=e.title,a=g(e,h),o=r||t.size||`1em`,s;return t.className&&(s=t.className),e.className&&(s=(s?s+` `:``)+e.className),f.createElement(`svg`,v({stroke:`currentColor`,fill:`currentColor`,strokeWidth:`0`},t.attr,n,a,{className:s,style:b(b({color:e.color||t.color},t.style),e.style),height:o,width:o,xmlns:`http://www.w3.org/2000/svg`}),i&&f.createElement(`title`,null,i),e.children)};return m===void 0?t(p):f.createElement(m.Consumer,null,e=>t(e))}var ee=t();function D(e){return T({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`line`,attr:{x1:`18`,y1:`6`,x2:`6`,y2:`18`},child:[]},{tag:`line`,attr:{x1:`6`,y1:`6`,x2:`18`,y2:`18`},child:[]}]})(e)}function te(e){return T({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M16 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2`},child:[]},{tag:`circle`,attr:{cx:`8.5`,cy:`7`,r:`4`},child:[]},{tag:`polyline`,attr:{points:`17 11 19 13 23 9`},child:[]}]})(e)}function ne(e){return T({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`polyline`,attr:{points:`3 6 5 6 21 6`},child:[]},{tag:`path`,attr:{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`},child:[]},{tag:`line`,attr:{x1:`10`,y1:`11`,x2:`10`,y2:`17`},child:[]},{tag:`line`,attr:{x1:`14`,y1:`11`,x2:`14`,y2:`17`},child:[]}]})(e)}function re(e){return T({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z`},child:[]}]})(e)}function ie(e){return T({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`rect`,attr:{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,ry:`2`},child:[]}]})(e)}function ae(e){return T({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`rect`,attr:{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,ry:`2`},child:[]},{tag:`line`,attr:{x1:`9`,y1:`3`,x2:`9`,y2:`21`},child:[]}]})(e)}function oe(e){return T({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`circle`,attr:{cx:`11`,cy:`11`,r:`8`},child:[]},{tag:`line`,attr:{x1:`21`,y1:`21`,x2:`16.65`,y2:`16.65`},child:[]}]})(e)}function se(e){return T({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`polyline`,attr:{points:`23 4 23 10 17 10`},child:[]},{tag:`polyline`,attr:{points:`1 20 1 14 7 14`},child:[]},{tag:`path`,attr:{d:`M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15`},child:[]}]})(e)}function ce(e){return T({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`line`,attr:{x1:`12`,y1:`5`,x2:`12`,y2:`19`},child:[]},{tag:`line`,attr:{x1:`5`,y1:`12`,x2:`19`,y2:`12`},child:[]}]})(e)}function le(e){return T({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z`},child:[]}]})(e)}function ue(e){return T({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`line`,attr:{x1:`3`,y1:`12`,x2:`21`,y2:`12`},child:[]},{tag:`line`,attr:{x1:`3`,y1:`6`,x2:`21`,y2:`6`},child:[]},{tag:`line`,attr:{x1:`3`,y1:`18`,x2:`21`,y2:`18`},child:[]}]})(e)}function de(e){return T({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`},child:[]},{tag:`polyline`,attr:{points:`16 17 21 12 16 7`},child:[]},{tag:`line`,attr:{x1:`21`,y1:`12`,x2:`9`,y2:`12`},child:[]}]})(e)}function fe(e){return T({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`line`,attr:{x1:`8`,y1:`6`,x2:`21`,y2:`6`},child:[]},{tag:`line`,attr:{x1:`8`,y1:`12`,x2:`21`,y2:`12`},child:[]},{tag:`line`,attr:{x1:`8`,y1:`18`,x2:`21`,y2:`18`},child:[]},{tag:`line`,attr:{x1:`3`,y1:`6`,x2:`3.01`,y2:`6`},child:[]},{tag:`line`,attr:{x1:`3`,y1:`12`,x2:`3.01`,y2:`12`},child:[]},{tag:`line`,attr:{x1:`3`,y1:`18`,x2:`3.01`,y2:`18`},child:[]}]})(e)}function pe(e){return T({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`},child:[]},{tag:`path`,attr:{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`},child:[]}]})(e)}function me(e){return T({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`polygon`,attr:{points:`12 2 2 7 12 12 22 7 12 2`},child:[]},{tag:`polyline`,attr:{points:`2 17 12 22 22 17`},child:[]},{tag:`polyline`,attr:{points:`2 12 12 17 22 12`},child:[]}]})(e)}function he(e){return T({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`circle`,attr:{cx:`12`,cy:`12`,r:`10`},child:[]},{tag:`line`,attr:{x1:`2`,y1:`12`,x2:`22`,y2:`12`},child:[]},{tag:`path`,attr:{d:`M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z`},child:[]}]})(e)}function ge(e){return T({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`circle`,attr:{cx:`18`,cy:`18`,r:`3`},child:[]},{tag:`circle`,attr:{cx:`6`,cy:`6`,r:`3`},child:[]},{tag:`path`,attr:{d:`M13 6h3a2 2 0 0 1 2 2v7`},child:[]},{tag:`line`,attr:{x1:`6`,y1:`9`,x2:`6`,y2:`21`},child:[]}]})(e)}function _e(e){return T({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`circle`,attr:{cx:`12`,cy:`12`,r:`4`},child:[]},{tag:`line`,attr:{x1:`1.05`,y1:`12`,x2:`7`,y2:`12`},child:[]},{tag:`line`,attr:{x1:`17.01`,y1:`12`,x2:`22.96`,y2:`12`},child:[]}]})(e)}function ve(e){return T({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`line`,attr:{x1:`6`,y1:`3`,x2:`6`,y2:`15`},child:[]},{tag:`circle`,attr:{cx:`18`,cy:`6`,r:`3`},child:[]},{tag:`circle`,attr:{cx:`6`,cy:`18`,r:`3`},child:[]},{tag:`path`,attr:{d:`M18 9a9 9 0 0 1-9 9`},child:[]}]})(e)}function ye(e){return T({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z`},child:[]}]})(e)}function be(e){return T({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z`},child:[]},{tag:`polyline`,attr:{points:`14 2 14 8 20 8`},child:[]},{tag:`line`,attr:{x1:`16`,y1:`13`,x2:`8`,y2:`13`},child:[]},{tag:`line`,attr:{x1:`16`,y1:`17`,x2:`8`,y2:`17`},child:[]},{tag:`polyline`,attr:{points:`10 9 9 9 8 9`},child:[]}]})(e)}function xe(e){return T({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z`},child:[]},{tag:`circle`,attr:{cx:`12`,cy:`12`,r:`3`},child:[]}]})(e)}function Se(e){return T({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z`},child:[]}]})(e)}function Ce(e){return T({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`},child:[]},{tag:`polyline`,attr:{points:`7 10 12 15 17 10`},child:[]},{tag:`line`,attr:{x1:`12`,y1:`15`,x2:`12`,y2:`3`},child:[]}]})(e)}function we(e){return T({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`rect`,attr:{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,ry:`2`},child:[]},{tag:`rect`,attr:{x:`9`,y:`9`,width:`6`,height:`6`},child:[]},{tag:`line`,attr:{x1:`9`,y1:`1`,x2:`9`,y2:`4`},child:[]},{tag:`line`,attr:{x1:`15`,y1:`1`,x2:`15`,y2:`4`},child:[]},{tag:`line`,attr:{x1:`9`,y1:`20`,x2:`9`,y2:`23`},child:[]},{tag:`line`,attr:{x1:`15`,y1:`20`,x2:`15`,y2:`23`},child:[]},{tag:`line`,attr:{x1:`20`,y1:`9`,x2:`23`,y2:`9`},child:[]},{tag:`line`,attr:{x1:`20`,y1:`14`,x2:`23`,y2:`14`},child:[]},{tag:`line`,attr:{x1:`1`,y1:`9`,x2:`4`,y2:`9`},child:[]},{tag:`line`,attr:{x1:`1`,y1:`14`,x2:`4`,y2:`14`},child:[]}]})(e)}function Te(e){return T({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`rect`,attr:{x:`9`,y:`9`,width:`13`,height:`13`,rx:`2`,ry:`2`},child:[]},{tag:`path`,attr:{d:`M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1`},child:[]}]})(e)}function Ee(e){return T({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`circle`,attr:{cx:`12`,cy:`12`,r:`10`},child:[]},{tag:`polyline`,attr:{points:`12 6 12 12 16 14`},child:[]}]})(e)}function De(e){return T({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`polyline`,attr:{points:`18 15 12 9 6 15`},child:[]}]})(e)}function Oe(e){return T({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`polyline`,attr:{points:`9 18 15 12 9 6`},child:[]}]})(e)}function ke(e){return T({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`polyline`,attr:{points:`6 9 12 15 18 9`},child:[]}]})(e)}function Ae(e){return T({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`polyline`,attr:{points:`20 6 9 17 4 12`},child:[]}]})(e)}function je(e){return T({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`polyline`,attr:{points:`9 11 12 14 22 4`},child:[]},{tag:`path`,attr:{d:`M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11`},child:[]}]})(e)}function Me(e){return T({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M22 11.08V12a10 10 0 1 1-5.93-9.14`},child:[]},{tag:`polyline`,attr:{points:`22 4 12 14.01 9 11.01`},child:[]}]})(e)}function Ne(e){return T({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`line`,attr:{x1:`12`,y1:`5`,x2:`12`,y2:`19`},child:[]},{tag:`polyline`,attr:{points:`19 12 12 19 5 12`},child:[]}]})(e)}var Pe=`cadence-graph/2`,Fe=`cadence-public-export/2`,O=Object.freeze({controlBytes:1048576,admissionCount:16,admissionBytes:33554432,cancelBytes:65536,headerBytes:8192,wsClientFrameBytes:16384,startWaitMs:1e4,stopWaitMs:6e4,authWaitMs:3e4,authValidityMarginMs:12e4,browserLifetimeMs:432e5,terminateGraceMs:1e3,unconfirmedStopMs:3e3,graphBytes:524288,grantMs:12e4,assignments:16,instructionsBytes:16384,expectedOutputBytes:2048,workerRequestBytes:131072,publicRequestBytes:98304,predecessorBytes:16384,handoffBytes:32768,frameBytes:65536,chunkBytes:8192,detailBytes:33554432,childProtocolBytes:134217728,dataFrames:1e5,controlFrames:256,sdkEvents:1e6,workerQueueBytes:4194304,workerQueueFrames:1024,ownerQueueBytes:8388608,ownerQueueFrames:2048,ownerControlBytes:1048576,ownerControlFrames:256,recordingStallMs:5e3,episodes:8,queuedAssignments:128,childReservations:2,episodeMs:216e5,readyWaitMs:6e5,workerMs:12e5,artifactPartBytes:262144,progressBatchMs:100,progressBatchBytes:262144,segmentBytes:8388608,segmentRecords:4096,checkoutQuotaBytes:10737418240,episodeReservationBytes:536870912,freeSpaceFloorBytes:268435456,episodeControlBytes:1048576,searchReaders:2,exportReaders:2,downloadIdleMs:12e4,pageEntries:50,maxPageEntries:200,pageBytes:524288,detailPageBytes:262144,previewBytes:4096,searchBytes:8388608,searchMs:100,queryBytes:1024,navigationBytes:8192,ringEvents:1024,ringBytes:2097152,viewers:16,viewerMessages:256,viewerBytes:1048576,heartbeatMs:5e3,staleMs:15e3,reconcileMs:3e4}),Ie=[`invalid`,`oversize`,`unauthenticated`,`forbidden`,`stale`,`conflict`,`corrupt-selected`,`expired-grant`,`consumed-grant`,`unsupported-context`,`quarantine`,`capacity`,`unavailable`,`auth-unavailable`,`recording-exhausted`,`receipt-inconclusive`],k=class extends Error{code;constructor(e=`invalid`){super(e),this.code=e}};function Le(e,t=`none`){return{code:e,effect:t,recovery:t!==`none`||e===`receipt-inconclusive`?`observe`:[`stale`,`expired-grant`,`consumed-grant`].includes(e)?`fresh-confirmation`:`operator`}}function A(){throw new k}function j(e,t,n=!1){if((typeof e!=`string`||e.includes(`\0`)||/[\uD800-\uDFFF]/u.test(e)||n&&!e.trim())&&A(),M(e)>t)throw new k(`oversize`);return e}function M(e){return new TextEncoder().encode(e).length}function N(e,t=0,n=2**53-1){return(typeof e!=`number`||!Number.isSafeInteger(e)||e<t||e>n)&&A(),e}function P(e){return typeof e!=`boolean`&&A(),e}function F(e,t){return(typeof e!=`string`||!t.includes(e))&&A(),e}function I(e,t){return e!==t&&A(),t}function L(e,t){return e===null?null:t(e)}function R(e,t){(typeof e!=`object`||!e||Array.isArray(e)||![null,Object.prototype].includes(Object.getPrototypeOf(e)))&&A();let n=Reflect.ownKeys(e);(n.length!==t.length||n.some(e=>typeof e!=`string`||!t.includes(e)))&&A();let r=Object.create(null);for(let n of t){let t=Object.getOwnPropertyDescriptor(e,n);(!t||!(`value`in t)||!t.enumerable)&&A(),r[n]=t.value}return r}function z(e,t,n){(!Array.isArray(e)||e.length>t||Reflect.ownKeys(e).length!==e.length+1)&&A();let r=[];for(let t=0;t<e.length;t++){let i=Object.getOwnPropertyDescriptor(e,String(t));(!i||!(`value`in i))&&A(),r.push(n(i.value))}return r}function B(e){let t=j(e,36);return/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/.test(t)||A(),t}function V(e){let t=j(e,64);return/^[0-9a-f]{64}$/.test(t)||A(),t}function H(e){let t=j(e,O.controlBytes);return/^(0|[1-9][0-9]*)$/.test(t)||A(),t}function Re(e,t){return H(e),H(t),e.length===t.length?e===t?0:e<t?-1:1:e.length<t.length?-1:1}function ze(e){let t=j(e,48);return/^[a-z][a-z0-9-]{0,47}$/.test(t)||A(),t}function U(e,t=O.controlBytes){let n=t,r=e=>{if(n-=M(e),n<0)throw new k(`oversize`);return e};function i(e,n){if(n>64&&A(),e===null||typeof e==`boolean`)return r(String(e));if(typeof e==`string`)return j(e,t),r(JSON.stringify(e));if(typeof e==`number`)return Number.isFinite(e)||A(),r(JSON.stringify(e));if(Array.isArray(e)){let a=z(e,t,e=>e);return r(`[]${`,`.repeat(Math.max(0,a.length-1))}`),`[${a.map(e=>i(e,n+1)).join(`,`)}]`}if(e&&typeof e==`object`){let t=Reflect.ownKeys(e);t.some(e=>typeof e!=`string`)&&A();let a=t.sort(),o=R(e,a);return r(`{}${`,`.repeat(Math.max(0,a.length-1))}`),`{${a.map(e=>`${r(`${JSON.stringify(e)}:`)}${i(o[e],n+1)}`).join(`,`)}}`}return A()}return i(e,0)}function Be(e,t=O.controlBytes){j(e,t);let n=0,r=()=>{for(;/[\x20\t\r\n]/.test(e[n]??`!`);)n++};function i(){let r=n++,i=!1;for(;n<e.length;){let a=e[n++];if(!i&&a===`"`)try{return j(JSON.parse(e.slice(r,n)),t)}catch{return A()}i=!i&&a===`\\`}return A()}function a(t){if(t>64&&A(),r(),e[n]===`"`)return i();if(e[n]===`{`||e[n]===`[`){let o=e[n++]===`{`,s=o?`}`:`]`,c=Object.create(null),l=[],u=new Set;if(r(),e[n]===s)return n++,o?c:l;for(;;){r();let d=``;o&&(e[n]!==`"`&&A(),d=i(),u.has(d)&&A(),u.add(d),r(),e[n++]!==`:`&&A());let f=a(t+1);o?c[d]=f:l.push(f),r();let p=e[n++];if(p===s)break;p!==`,`&&A()}return o?c:l}let o=/^(?:true|false|null|-?(?:0|[1-9][0-9]*)(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?)/.exec(e.slice(n))?.[0];o||A(),n+=o.length;let s=JSON.parse(o);return typeof s==`number`&&!Number.isFinite(s)&&A(),s}let o=a(0);return r(),n!==e.length&&A(),o}function W(e){let t=R(e,[`code`,`effect`,`recovery`]);return{code:F(t.code,Ie),effect:F(t.effect,[`none`,`accepted`,`uncertain`]),recovery:F(t.recovery,[`observe`,`fresh-confirmation`,`operator`])}}var Ve=[`plan`,`context`,`message`,`final-text`,`tool-args`,`tool-update`,`tool-result`,`check`,`changes`,`review`],He=[`completed`,`failed`,`canceled`,`timeout`,`unknown`,`blocked`],Ue=[`not-launched`,`direct-child-closed`,`unconfirmed`],We=[`openai-completions`,`openai-responses`,`openai-codex-responses`,`anthropic-messages`,`google-generative-ai`,`mistral-conversations`,`azure-openai-responses`],Ge=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`,`max`];function Ke(e){let t=R(e,[`provider`,`model`,`api`,`thinking`]);return{provider:j(t.provider,128,!0),model:j(t.model,256,!0),api:F(t.api,We),thinking:F(t.thinking,Ge)}}function qe(e){let{sourceSelectionId:t,...n}=R(e,[`sourceSelectionId`,`provider`,`model`,`api`,`thinking`]);return{sourceSelectionId:B(t),...Ke(n)}}function Je(e){let t=R(e,[`role`,`sha256`]);return{role:F(t.role,[`design-explorer`,`implementation-worker`,`diagnosis-worker`]),sha256:V(t.sha256)}}function Ye(e){return e===`edit`?`implementation-worker`:e===`diagnosis`?`diagnosis-worker`:`design-explorer`}function G(e){let t=R(e,[`recordId`,`version`,`field`,`bytes`,`sha256`]);return{recordId:B(t.recordId),version:N(t.version,1),field:F(t.field,Ve),bytes:N(t.bytes,0,O.detailBytes),sha256:V(t.sha256)}}function Xe(e){let t=R(e,[`start`,`end`]),n=N(t.start);return{start:n,end:N(t.end,n+1,O.detailBytes)}}function Ze(e){let t=R(e,[`source`,`range`,`requireCompleteObservation`]),n=K(t.source),r;if(n===`current`)r={kind:n,assignmentId:ze(R(t.source,[`kind`,`assignmentId`]).assignmentId)};else{let e=R(t.source,[`kind`,`runId`,`childRunId`,`result`]);I(n,`historical`);let i=G(e.result);I(i.field,`final-text`),r={kind:`historical`,runId:B(e.runId),childRunId:B(e.childRunId),result:i}}let i=L(t.range,Xe);return r.kind===`historical`&&i&&i.end>r.result.bytes&&A(),{source:r,range:i,requireCompleteObservation:P(t.requireCompleteObservation)}}function K(e,t=`kind`){(typeof e!=`object`||!e)&&A();let n=Object.getOwnPropertyDescriptor(e,t);return(!n||!(`value`in n))&&A(),j(n.value,64,!0)}function Qe(e){U(e,O.graphBytes);let t=R(e,[`schema`,`taskId`,`taskKind`,`taskRevision`,`revision`,`planRevision`,`plan`,`assignments`]),n=G(t.plan);I(n.field,`plan`);let r=N(t.planRevision,1);n.version!==r&&A();let i={schema:I(t.schema,Pe),taskId:B(t.taskId),taskKind:F(t.taskKind,[`code`,`research`,`diagnosis`]),taskRevision:N(t.taskRevision,1),revision:N(t.revision,1),planRevision:r,plan:n,assignments:z(t.assignments,O.assignments,e=>{let t=R(e,[`id`,`purpose`,`instructions`,`expectedOutput`,`role`,`model`,`dependencies`]);return{id:ze(t.id),purpose:F(t.purpose,[`research`,`diagnosis`,`review`,`edit`]),instructions:j(t.instructions,O.instructionsBytes,!0),expectedOutput:j(t.expectedOutput,O.expectedOutputBytes,!0),role:Je(t.role),model:qe(t.model),dependencies:z(t.dependencies,O.assignments,Ze)}})};i.assignments.length||A();let a=new Map(i.assignments.map(e=>[e.id,e]));a.size!==i.assignments.length&&A();let o=new Set,s=new Set;function c(e){if(o.has(e.id)&&A(),s.has(e.id))return;o.add(e.id);let t=new Set;for(let n of e.dependencies){let e=U(n.source);if(t.has(e)&&A(),t.add(e),n.source.kind===`current`){let e=a.get(n.source.assignmentId);e||A(),c(e)}}o.delete(e.id),s.add(e.id)}for(let e of i.assignments){if(i.taskKind!==`code`&&e.purpose===`edit`||e.role.role!==Ye(e.purpose))throw new k(`forbidden`);c(e)}return i}function $e(e){let t=R(e,[`id`,`kind`,`revision`,`identity`,`graphRevision`,`graphIdentity`]),n=L(t.graphRevision,e=>N(e,1)),r=L(t.graphIdentity,V);return n===null!=(r===null)&&A(),{id:B(t.id),kind:F(t.kind,[`code`,`research`,`diagnosis`]),revision:N(t.revision,1),identity:V(t.identity),graphRevision:n,graphIdentity:r}}function et(e){let t=R(e,[`epoch`,`accessGeneration`,`configRev`,`controlRev`,`workspaceId`,`cwdId`,`model`,`checkEnvGeneration`,`checkoutGeneration`,`observation`,`task`]),n=R(t.observation,[`identity`,`complete`]);return{epoch:B(t.epoch),accessGeneration:N(t.accessGeneration,1),configRev:N(t.configRev,1),controlRev:N(t.controlRev,1),workspaceId:B(t.workspaceId),cwdId:B(t.cwdId),model:qe(t.model),checkEnvGeneration:N(t.checkEnvGeneration,1),checkoutGeneration:N(t.checkoutGeneration),observation:{identity:V(n.identity),complete:P(n.complete)},task:L(t.task,$e)}}function tt(e){let t=R(e,[`kind`,`name`,`command`,`timeoutMs`]),n={kind:F(t.kind,[`configured`,`manual`]),name:j(t.name,128,!0),command:j(t.command,4096,!0),timeoutMs:N(t.timeoutMs,100,O.workerMs)},r=/[\x00-\x08\x0b-\x1f\x7f-\x9f\u202a-\u202e\u2066-\u2069]/u;return(r.test(n.name)||r.test(n.command)||/[\n\t]/.test(n.name)||n.name===`Manual command`)&&A(),n.kind===`manual`&&(n.name!==`Manual`||n.timeoutMs!==12e4)&&A(),n}function nt(e){switch(U(e),K(e)){case`create`:{let t=R(e,[`kind`,`taskKind`,`goal`]);return{kind:`create`,taskKind:F(t.taskKind,[`code`,`research`,`diagnosis`]),goal:j(t.goal,8192,!0)}}case`save-plan`:{let t=R(e,[`kind`,`taskId`,`plan`,`graph`]),n=Qe(t.graph),r=B(t.taskId);return n.taskId!==r&&A(),{kind:`save-plan`,taskId:r,plan:j(t.plan,32768),graph:n}}case`generate-plan`:case`start`:return{kind:K(e),taskId:B(R(e,[`kind`,`taskId`]).taskId)};case`check`:{let t=R(e,[`kind`,`taskId`,`check`]);return{kind:`check`,taskId:B(t.taskId),check:tt(t.check)}}case`review`:{let t=R(e,[`kind`,`taskId`,`runId`,`changesIdentity`,`checksRevision`,`acceptIssues`]);return{kind:`review`,taskId:B(t.taskId),runId:B(t.runId),changesIdentity:V(t.changesIdentity),checksRevision:N(t.checksRevision),acceptIssues:P(t.acceptIssues)}}default:return A()}}function rt(e){U(e);let t=R(e,[`expected`,`action`]);return{expected:et(t.expected),action:nt(t.action)}}function it(e){U(e);let t=R(e,[`commandId`,`grant`,`expected`,`action`]);return{commandId:B(t.commandId),grant:B(t.grant),expected:et(t.expected),action:nt(t.action)}}function at(e){if(U(e),K(e)===`action`){let t=R(e,[`kind`,`expected`,`action`]);return{kind:`action`,expected:et(t.expected),action:nt(t.action)}}let t=R(e,[`kind`,`epoch`,`runId`]);return I(t.kind,`cancel`),{kind:`cancel`,epoch:B(t.epoch),runId:B(t.runId)}}function ot(e){let t=R(e,[`commandId`,`epoch`,`runId`]);return{commandId:B(t.commandId),epoch:B(t.epoch),runId:B(t.runId)}}function st(e){U(e);let t=typeof e==`object`&&!!e&&Object.hasOwn(e,`checkEnvironmentPolicy`),n=R(e,[`version`,`action`,`rootLabel`,`cwdLabel`,`readablePlan`,`graph`,`activeRunId`,`issues`,`configuredChecks`,`checksRevision`,`reviewRunId`,...t?[`checkEnvironmentPolicy`]:[]]),r=z(n.configuredChecks,32,tt);return(r.some(e=>e.kind!==`configured`)||new Set(r.map(e=>e.name)).size!==r.length)&&A(),{...t?{checkEnvironmentPolicy:I(n.checkEnvironmentPolicy,`service-launch-ordinary/1`)}:{},configuredChecks:r,checksRevision:N(n.checksRevision),reviewRunId:L(n.reviewRunId,B),version:et(n.version),action:nt(n.action),rootLabel:j(n.rootLabel,4096,!0),cwdLabel:j(n.cwdLabel,4096,!0),readablePlan:j(n.readablePlan,32768),graph:L(n.graph,Qe),activeRunId:L(n.activeRunId,B),issues:z(n.issues,7,e=>F(e,[`incomplete-observation`,`unrun-checks`,`stale-checks`,`failed-checks`,`partial-results`,`recording-incomplete`,`legacy-context`]))}}function ct(e){U(e);let t=R(e,[`grant`,`expiresAt`,`preview`]),n=j(t.expiresAt,24);return(!/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d\.\d{3}Z$/.test(n)||!Number.isFinite(Date.parse(n))||new Date(n).toISOString()!==n)&&A(),{grant:B(t.grant),expiresAt:n,preview:st(t.preview)}}function q(e){let t=R(e,[`observed`,`source`,`redacted`,`omissions`]),n={observed:F(t.observed,[`complete`,`incomplete`]),source:F(t.source,[`complete`,`limited`,`unavailable`]),redacted:P(t.redacted),omissions:z(t.omissions,6,e=>F(e,[`binary`,`hidden-thinking`,`source-limit`,`capture-limit`,`gap`,`unsupported`]))};return(new Set(n.omissions).size!==n.omissions.length||n.observed===`complete`&&n.omissions.some(e=>e===`capture-limit`||e===`gap`))&&A(),n}function lt(e){let t=R(e,[`graphRevision`,`inputs`]),n=0,r=new Set;return{graphRevision:N(t.graphRevision,1),inputs:z(t.inputs,O.assignments,e=>{let t=R(e,[`assignmentId`,`dependencyIndex`,`runId`,`childRunId`,`result`,`range`,`text`,`coverage`]),i=G(t.result);I(i.field,`final-text`);let a=L(t.range,Xe);a&&a.end>i.bytes&&A();let o=j(t.text,O.predecessorBytes);if(n+=M(o),n>O.handoffBytes)throw new k(`oversize`);let s=N(t.dependencyIndex,0,O.assignments-1);return r.has(s)&&A(),r.add(s),M(o)!==(a?a.end-a.start:i.bytes)&&A(),{assignmentId:ze(t.assignmentId),dependencyIndex:s,runId:B(t.runId),childRunId:B(t.childRunId),result:i,range:a,text:o,coverage:q(t.coverage)}})}}function ut(e){let t=R(e,[`outcome`,`closure`,`exitCode`,`signal`,`durationMs`,`stdin`,`final`,`cleanup`,`capture`]),n={outcome:F(t.outcome,[`completed`,`failed`,`canceled`,`timeout`,`unknown`]),closure:F(t.closure,Ue),exitCode:L(t.exitCode,e=>N(e,-2147483648,4294967295)),signal:L(t.signal,e=>j(e,32,!0)),durationMs:N(t.durationMs),stdin:F(t.stdin,[`delivered`,`failed`,`not-required`]),final:F(t.final,[`valid`,`missing`,`invalid`]),cleanup:F(t.cleanup,[`settled`,`failed`,`unconfirmed`]),capture:q(t.capture)};return n.closure===`not-launched`&&(n.exitCode!==null||n.signal!==null)&&A(),n.outcome===`completed`&&(n.closure!==`direct-child-closed`||n.exitCode!==0||n.signal!==null||n.stdin!==`delivered`||n.final!==`valid`||n.cleanup!==`settled`||n.capture.observed!==`complete`)&&A(),n}function dt(e){let t=R(e,[`kind`,`id`]);return{kind:F(t.kind,[`task`,`run`,`child`]),id:B(t.id)}}function ft(e){let t=j(e,O.navigationBytes,!0);return/^[\x21-\x7e]+$/.test(t)||A(),t}function J(e){U(e);let t=R(e,[`storeId`,`scope`,`query`,`snapshotSeq`,`recordId`,`recordVersion`,`field`,`offset`,...Object.hasOwn(e??{},`navigation`)?[`navigation`]:[]]),n={storeId:B(t.storeId),scope:dt(t.scope),query:L(t.query,e=>{let t=j(e,O.queryBytes);return t.length||A(),t}),snapshotSeq:H(t.snapshotSeq),recordId:L(t.recordId,B),recordVersion:L(t.recordVersion,e=>N(e,1)),field:L(t.field,e=>F(e,Ve)),offset:N(t.offset),...Object.hasOwn(t,`navigation`)?{navigation:ft(t.navigation)}:{}};return(n.recordId===null!=(n.recordVersion===null)||n.recordId===null!=(n.field===null))&&A(),n}function pt(e){let t=R(e,[`disposition`,`value`]),n=F(t.disposition,[`observed`,`unavailable`,`redacted`]),r=vt(t.value);return n===`observed`!=(r!==null)&&A(),{disposition:n,value:r}}function mt(e){let t=R(e,[`messageId`,`blockId`]);return{messageId:B(t.messageId),blockId:B(t.blockId)}}function ht(e){let t=K(e);if(t===`message-final`)return{kind:t,messageId:B(R(e,[`kind`,`messageId`]).messageId)};if(t===`context`)return{kind:t,component:F(R(e,[`kind`,`component`]).component,[`request-context`,`request-prompt`,`request-instructions`,`role`,`effective-system`])};if(t===`handoff`){let n=R(e,[`kind`,`dependencyIndex`,`source`]),r=G(n.source);return I(r.field,`final-text`),{kind:t,dependencyIndex:N(n.dependencyIndex,0,O.assignments-1),source:r}}if(t===`message`){let n=R(e,[`kind`,`messageId`,`blockId`,`index`,`stage`]);return{kind:t,messageId:B(n.messageId),blockId:B(n.blockId),index:N(n.index,0,O.dataFrames),stage:F(n.stage,[`stream`,`final`])}}let n=R(e,[`kind`,`callId`,`blockId`,`index`,`stage`]);return I(t,`tool`),{kind:`tool`,callId:B(n.callId),blockId:B(n.blockId),index:N(n.index,0,O.dataFrames),stage:F(n.stage,[`arguments-partial`,`arguments-final`,`execution-arguments`,`update-snapshot`,`result`])}}function gt(e){let t=R(e,[`owner`,`field`,`encoding`]),n=ht(t.owner),r=F(t.field,[`context`,`message`,`final-text`,`tool-args`,`tool-update`,`tool-result`]),i=F(t.encoding,[`utf8`,`canonical-json`]);return(r!==(n.kind===`context`||n.kind===`handoff`?`context`:n.kind===`message-final`?`final-text`:n.kind===`message`?`message`:n.stage===`result`?`tool-result`:n.stage===`update-snapshot`?`tool-update`:`tool-args`)||n.kind!==`tool`&&i!==`utf8`||r===`tool-args`&&i!==`canonical-json`&&(n.kind!==`tool`||n.stage!==`arguments-partial`))&&A(),{owner:n,field:r,encoding:i}}function _t(e){let t=R(e,[`owner`,`sourceType`,`mimeType`,`reason`]),n=F(t.sourceType,[`image`,`audio`,`binary`,`hidden-thinking`,`unsupported`]),r=F(t.reason,[`binary`,`hidden-thinking`,`unsupported`]),i=L(t.mimeType,e=>j(e,128,!0));return(r!==(n===`hidden-thinking`?`hidden-thinking`:n===`unsupported`?`unsupported`:`binary`)||i!==null&&(n===`hidden-thinking`||!/^[a-z0-9.+-]+\/[a-z0-9.+-]+$/i.test(i)))&&A(),{owner:ht(t.owner),sourceType:n,mimeType:i,reason:r}}function vt(e){if(e===null)return null;let t=j(e,128,!0);return/^[a-zA-Z0-9_-]+$/.test(t)||A(),t}function yt(e){let t=K(e);switch(t){case`ready`:return{kind:t,requestProtocol:I(R(e,[`kind`,`requestProtocol`]).requestProtocol,2)};case`message-start`:{let n=R(e,[`kind`,`messageId`,`role`,`source`,`resultCallId`]),r=F(n.role,[`user`,`assistant`,`tool-result`]),i=L(n.resultCallId,B);return r!==`tool-result`&&i!==null&&A(),{kind:t,messageId:B(n.messageId),role:r,source:pt(n.source),resultCallId:i}}case`message-text`:{let n=R(e,[`kind`,`messageId`,`blockId`,`detailId`]);return{kind:t,...mt({messageId:n.messageId,blockId:n.blockId}),detailId:B(n.detailId)}}case`message-end`:{let n=R(e,[`kind`,`messageId`,`finalDetailId`,`finalBlockCount`,`stopReason`]);return{kind:t,messageId:B(n.messageId),finalDetailId:L(n.finalDetailId,B),finalBlockCount:N(n.finalBlockCount,0,O.dataFrames),stopReason:F(n.stopReason,[`stop`,`length`,`toolUse`,`error`,`aborted`,`unknown`])}}case`call-declaration`:{let n=R(e,[`kind`,`callId`,`declaration`,`index`,`source`,`name`,`argsDetailId`,`stage`]);return{kind:t,callId:B(n.callId),declaration:mt(n.declaration),index:N(n.index,0,O.dataFrames),source:pt(n.source),name:j(n.name,128,!0),argsDetailId:L(n.argsDetailId,B),stage:F(n.stage,[`partial`,`final`])}}case`tool-start`:{let n=R(e,[`kind`,`callId`,`declaration`,`source`,`name`,`argsDetailId`]);return{kind:t,callId:B(n.callId),declaration:L(n.declaration,mt),source:pt(n.source),name:j(n.name,128,!0),argsDetailId:L(n.argsDetailId,B)}}case`tool-update`:{let n=R(e,[`kind`,`callId`,`detailId`,`semantics`]);return{kind:t,callId:B(n.callId),detailId:B(n.detailId),semantics:I(n.semantics,`snapshot`)}}case`tool-end`:{let n=R(e,[`kind`,`callId`,`declaration`,`source`,`name`,`resultDetailId`,`isError`,`association`,`startObserved`]),r=F(n.association,[`declared`,`execution-only`,`orphan`,`ambiguous`]),i=L(n.declaration,mt),a=P(n.startObserved);return(r===`declared`!=(i!==null)||r===`execution-only`&&!a||(r===`orphan`||r===`ambiguous`)&&a)&&A(),{kind:t,callId:B(n.callId),declaration:i,source:pt(n.source),name:j(n.name,128,!0),resultDetailId:B(n.resultDetailId),isError:P(n.isError),association:r,startObserved:a}}case`omitted-block`:return{kind:t,block:_t(R(e,[`kind`,`block`]).block)};case`detail-begin`:{let n=R(e,[`kind`,`detailId`,`descriptor`]);return{kind:t,detailId:B(n.detailId),descriptor:gt(n.descriptor)}}case`detail-chunk`:{let n=R(e,[`kind`,`detailId`,`offset`,`text`]),r=j(n.text,O.chunkBytes),i=N(n.offset,0,O.detailBytes);return i+M(r)>O.detailBytes&&A(),{kind:t,detailId:B(n.detailId),offset:i,text:r}}case`detail-end`:{let n=R(e,[`kind`,`detailId`,`bytes`,`sha256`,`coverage`]);return{kind:t,detailId:B(n.detailId),bytes:N(n.bytes,0,O.detailBytes),sha256:V(n.sha256),coverage:q(n.coverage)}}case`capture-status`:return{kind:t,coverage:q(R(e,[`kind`,`coverage`]).coverage)};case`worker-failure`:return{kind:t,code:F(R(e,[`kind`,`code`]).code,[`protocol`,`capture`,`model`,`auth`,`network`,`cleanup`,`prompt`])};case`final`:{let n=R(e,[`kind`,`messageId`,`detailId`,`stopReason`]);return{kind:t,messageId:B(n.messageId),detailId:B(n.detailId),stopReason:I(n.stopReason,`stop`)}}default:return A()}}function bt(e){let t=R(e,[`outcome`,`closure`,`exitCode`,`signal`,`durationMs`,`stdin`]),n={outcome:F(t.outcome,[`completed`,`failed`,`canceled`,`timeout`,`unknown`]),closure:F(t.closure,Ue),exitCode:L(t.exitCode,e=>N(e,-2147483648,4294967295)),signal:L(t.signal,e=>j(e,32,!0)),durationMs:N(t.durationMs),stdin:I(t.stdin,`not-required`)};return(n.closure===`not-launched`&&(n.exitCode!==null||n.signal!==null)||n.outcome===`completed`&&(n.closure!==`direct-child-closed`||n.exitCode!==0||n.signal!==null))&&A(),n}function xt(e){let t=R(e,[`messageId`,`detailId`]);return{messageId:B(t.messageId),detailId:B(t.detailId)}}function St(e){let t=R(e,[`childRunId`,`detailId`,`content`,`committedSeq`]),n=H(t.committedSeq);return n===`0`&&A(),{childRunId:B(t.childRunId),detailId:B(t.detailId),content:G(t.content),committedSeq:n}}function Ct(e){let t=K(e,`status`);if(t===`committed`){let n=R(e,[`status`,`selected`,`detail`]),r=xt(n.selected),i=St(n.detail);return(r.detailId!==i.detailId||i.content.field!==`final-text`)&&A(),{status:t,selected:r,detail:i}}if(t===`refused`){let n=R(e,[`status`,`selected`,`error`]);return{status:t,selected:L(n.selected,xt),error:W(n.error)}}let n=R(e,[`status`,`selected`]);return{status:F(t,[`pending`,`uncertain`]),selected:L(n.selected,xt)}}function wt(e,t){let n=L(e,H);return(n===`0`||n!==null&&t.status===`committed`&&Re(n,t.detail.committedSeq)<0)&&A(),n}function Tt(e){return e.native?.outcome===`completed`&&e.recording.status===`committed`&&e.settlementSeq!==null}function Et(e){return e.kind===`parent`?e.outcome:e.native.outcome===`completed`?e.kind===`sdk`?Tt(e)?`completed`:`failed`:e.capture.observed===`complete`&&e.settlementSeq!==null?`completed`:`failed`:e.native.outcome}function Dt(e){let t=K(e);if(t===`sdk`){let n=R(e,[`kind`,`native`,`recording`,`settlementSeq`]),r=Ct(n.recording),i=wt(n.settlementSeq,r);return{kind:t,native:ut(n.native),recording:r,settlementSeq:i}}if(t===`check`){let n=R(e,[`kind`,`native`,`capture`,`settlementSeq`]),r=L(n.settlementSeq,H);return r===`0`&&A(),{kind:t,native:bt(n.native),capture:q(n.capture),settlementSeq:r}}let n=R(e,[`kind`,`outcome`,`required`]);I(t,`parent`);let r=z(n.required,O.assignments,e=>{let t=R(e,[`assignmentId`,`childRunId`,`native`,`recording`,`settlementSeq`]),n=B(t.childRunId),r=Ct(t.recording);return r.status===`committed`&&r.detail.childRunId!==n&&A(),{assignmentId:ze(t.assignmentId),childRunId:n,native:L(t.native,ut),recording:r,settlementSeq:wt(t.settlementSeq,r)}}),i=F(n.outcome,He);return(!r.length||new Set(r.map(e=>e.assignmentId)).size!==r.length||new Set(r.map(e=>e.childRunId)).size!==r.length||i===`completed`&&!r.every(Tt))&&A(),{kind:`parent`,outcome:i,required:r}}function Ot(e){let t=R(e,[`first`,`last`,`firstObservedMs`,`lastObservedMs`]),n=N(t.first,1,O.dataFrames+O.controlFrames),r=N(t.last,n,O.dataFrames+O.controlFrames),i=N(t.firstObservedMs),a=N(t.lastObservedMs,i);return n===r&&i!==a&&A(),{first:n,last:r,firstObservedMs:i,lastObservedMs:a}}function kt(e){let t=R(e,[`source`,`event`]),n=Ot(t.source),r=K(t.event);if(r===`stored-chunk`){let e=R(t.event,[`kind`,`detailId`,`text`]);return{source:n,event:{kind:r,detailId:B(e.detailId),text:j(e.text,O.chunkBytes)}}}if(r===`stored-end`){let e=R(t.event,[`kind`,`detailId`,`coverage`]);return{source:n,event:{kind:r,detailId:B(e.detailId),coverage:q(e.coverage)}}}let i=yt(t.event);return(i.kind===`detail-chunk`||i.kind===`detail-end`)&&A(),{source:n,event:i}}function At(e){let t=R(e,[`epoch`,`taskId`,`runId`,`childRunId`]);return{epoch:B(t.epoch),taskId:B(t.taskId),runId:B(t.runId),childRunId:B(t.childRunId)}}function jt(e){U({kind:`ok`,value:e},O.pageBytes);let t=Object.getOwnPropertyDescriptor(e??{},`status`)?.value===`complete`,n=R(e,[`storeId`,`workspaceId`,`epoch`,`status`,t?`runs`:`error`]),r={storeId:B(n.storeId),workspaceId:B(n.workspaceId),epoch:B(n.epoch)};if(!t)return I(n.status,`unavailable`),{...r,status:`unavailable`,error:Mt(n.error)};let i=z(n.runs,O.episodes,e=>{let t=R(e,[`taskId`,`runId`,`operationId`,`epoch`,`kind`,`stage`]);return{taskId:B(t.taskId),runId:B(t.runId),operationId:B(t.operationId),epoch:B(t.epoch),kind:F(t.kind,[`start`,`generate-plan`,`check`]),stage:F(t.stage,[`accepted-unallocated`,`active`,`draining`])}});return(i.some(e=>e.epoch!==r.epoch)||new Set(i.map(e=>e.runId)).size!==i.length||new Set(i.map(e=>e.taskId)).size!==i.length||new Set(i.map(e=>e.operationId)).size!==i.length)&&A(),{...r,status:`complete`,runs:i}}function Mt(e){let t=W(e);return I(t.effect,`none`),t}function Nt(e){let t=R(e,[`sourceHash`,`contractHash`,`buildId`]);return{sourceHash:V(t.sourceHash),contractHash:V(t.contractHash),buildId:V(t.buildId)}}function Pt(e){let t=F(Object.getOwnPropertyDescriptor(e??{},`kind`)?.value,[`native`,`browser`]),n=R(e,t===`native`?[`kind`,`contractHash`]:[`kind`,`contractHash`,`sourceHash`,`buildId`]);return t===`native`?{kind:t,contractHash:V(n.contractHash)}:{kind:t,...Nt({contractHash:n.contractHash,sourceHash:n.sourceHash,buildId:n.buildId})}}function Ft(e){let t=R(e,[`contractHash`,`assets`]);return{contractHash:V(t.contractHash),assets:Nt(t.assets)}}function It(e,t,n=!1){return!!e&&!!t&&t.contractHash===e.contractHash&&(n||e.assets.contractHash===e.contractHash&&(t.kind===`native`||t.buildId===e.assets.buildId&&t.sourceHash===e.assets.sourceHash))}function Lt(e){U(e);let t=R(e,[`commandId`,`operationId`,`runId`,`admission`,`committedSeq`,`execution`,`settlement`,`created`,`publication`]),n={commandId:B(t.commandId),operationId:B(t.operationId),runId:L(t.runId,B),admission:F(t.admission,[`accepted`,`refused`,`uncertain`]),committedSeq:H(t.committedSeq),execution:L(t.execution,e=>F(e,He)),settlement:L(t.settlement,Dt),created:L(t.created,e=>{let t=R(e,[`kind`,`taskId`,`state`]);return{kind:I(t.kind,`task`),taskId:B(t.taskId),state:F(t.state,[`reserved`,`published`])}}),publication:F(t.publication,[`pending`,`published`,`conflict`,`uncertain`])};return(n.committedSeq===`0`||n.settlement?.kind===`sdk`||n.execution===`completed`&&!n.settlement||n.execution!==null&&n.settlement!==null&&Et(n.settlement)!==n.execution||n.created?.state===`published`&&n.publication!==`published`)&&A(),n}function Rt(e){U(e);let t=R(e,[`identity`,`receipt`]),n=at(t.identity),r=Lt(t.receipt);n.kind===`cancel`&&r.runId!==n.runId&&A();let i=n.kind===`action`&&n.action.kind===`create`;if((!i&&r.created!==null||i&&r.admission===`accepted`&&r.created===null)&&A(),n.kind===`action`){let e=[`start`,`generate-plan`,`check`].includes(n.action.kind);(r.admission===`accepted`&&e!==(r.runId!==null)||!e&&(r.execution!==null||r.settlement!==null)||r.settlement!==null&&r.settlement.kind!==(n.action.kind===`check`?`check`:`parent`))&&A()}return{identity:n,receipt:r}}function Y(e,t){if(K(e)===`ok`)return{kind:`ok`,value:t(R(e,[`kind`,`value`]).value)};let n=R(e,[`kind`,`error`]);return I(n.kind,`error`),{kind:`error`,error:W(n.error)}}function zt(e){switch(U(e),K(e,`status`)){case`found`:return{status:`found`,receipt:Lt(R(e,[`status`,`receipt`]).receipt)};case`absent`:return{status:`absent`,committedSeq:H(R(e,[`status`,`committedSeq`]).committedSeq)};case`inconclusive`:return{status:`inconclusive`,error:W(R(e,[`status`,`error`]).error)};default:return A()}}function Bt(e){let t=R(e,[`runId`,`taskId`,`childRunId`,`assignmentId`,`admission`,`lifecycle`,`outcome`,`settlement`,`reason`,`publication`,`coverage`,`result`]),n={runId:B(t.runId),taskId:B(t.taskId),childRunId:L(t.childRunId,B),assignmentId:L(t.assignmentId,ze),admission:Xt(t.admission),lifecycle:F(t.lifecycle,[`queued`,`preparing`,`running`,`closing`,`settled`]),outcome:L(t.outcome,e=>F(e,He)),settlement:L(t.settlement,Dt),reason:L(t.reason,e=>F(e,[`capacity`,`dependency`,`writer`,`parent-stopped`,`wait-expired`,`handoff-overflow`,`stale-dependency`,`quarantine`])),publication:F(t.publication,[`pending`,`published`,`conflict`,`uncertain`]),coverage:q(t.coverage),result:L(t.result,G)};return(n.admission.context.task?.id!==n.taskId||n.childRunId!==null&&!n.admission.assignments.some(e=>e.childRunId===n.childRunId&&e.assignmentId===n.assignmentId)||n.settlement?.kind===`parent`&&U(n.settlement.required.map(({assignmentId:e,childRunId:t})=>({assignmentId:e,childRunId:t})))!==U(n.admission.assignments)||n.settlement?.kind===`sdk`&&n.settlement.recording.status===`committed`&&(n.settlement.recording.detail.childRunId!==n.childRunId||n.result!==null&&U(n.result)!==U(n.settlement.recording.detail.content))||n.settlement!==null&&(n.childRunId!==null&&n.settlement.kind!==`sdk`||n.childRunId===null&&n.settlement.kind!==(n.admission.kind===`check`?`check`:`parent`)||n.outcome!==null&&Et(n.settlement)!==n.outcome)||n.childRunId===null!=(n.assignmentId===null)||n.lifecycle===`settled`!=(n.outcome!==null)||n.outcome===`completed`&&(!n.settlement||Et(n.settlement)!==`completed`||n.coverage.observed!==`complete`))&&A(),n}function Vt(e,t){return t.kind===`task`?e.taskId===t.id:t.kind===`run`?e.runId===t.id:e.childRunId===t.id}function Ht(e,t,n){return Vt(e,t)&&e.taskId===$t(n)&&e.admission.context.workspaceId===Qt(n)}function Ut(e){U(e,O.pageBytes);let t=R(e,[`protocol`,`storeId`,`epoch`,`scope`,`committedSeq`,`context`,`runs`,`horizon`]),n={protocol:I(t.protocol,1),storeId:B(t.storeId),epoch:B(t.epoch),scope:dt(t.scope),committedSeq:H(t.committedSeq),context:Zt(t.context),runs:z(t.runs,O.maxPageEntries,Bt),horizon:dn(t.horizon)};return(!en(n.context,n.epoch,n.scope)||U(n.horizon.historicalRuns.scope)!==U(n.scope)||n.horizon.historicalRuns.snapshotSeq!==n.committedSeq||n.horizon.historicalRuns.storeId!==n.storeId||n.runs.some(e=>!Ht(e,n.scope,n.context))||new Set(n.runs.map(e=>e.childRunId??e.runId)).size!==n.runs.length)&&A(),n}function Wt(e){U(e,O.pageBytes);let t=K(e),n=R(e,t===`update`?[`kind`,`storeId`,`epoch`,`scope`,`previousSeq`,`committedSeq`,`runs`,`removed`,`context`]:[`kind`,`storeId`,`epoch`,`scope`,`committedSeq`]),r={storeId:B(n.storeId),epoch:B(n.epoch),scope:dt(n.scope),committedSeq:H(n.committedSeq)};if(t===`update`){let e=H(n.previousSeq);Re(r.committedSeq,e)<=0&&A();let i=Zt(n.context);en(i,r.epoch,r.scope)||A();let a=z(n.runs,O.maxPageEntries,Bt),o=z(n.removed,O.maxPageEntries,B),s=a.map(e=>e.childRunId??e.runId);return(a.some(e=>!Ht(e,r.scope,i))||new Set(s).size!==s.length||new Set(o).size!==o.length||o.some(e=>s.includes(e)))&&A(),{kind:t,...r,previousSeq:e,runs:a,removed:o,context:i}}return I(t,`heartbeat`),{kind:`heartbeat`,...r}}function Gt(e){let{navigation:t,...n}=e;return n}function Kt(e,t){(!t.navigation||t.navigation===e.navigation||U(Gt(e))!==U(Gt(t)))&&A()}function qt(e){if(Object.getOwnPropertyDescriptor(e??{},`kind`)?.value!==`progress`)return Jt(e);U({kind:`ok`,value:e},O.pageBytes);let t=R(e,[`kind`,`cursor`,`next`,`coverage`]),n=J(t.cursor),r=J(t.next);return Kt(n,r),{kind:`progress`,cursor:n,next:r,coverage:q(t.coverage)}}function Jt(e){U({kind:`ok`,value:e},O.pageBytes);let t=R(e,[`cursor`,`content`,`range`,`text`,`next`,`coverage`]),n={cursor:J(t.cursor),content:G(t.content),range:L(t.range,Xe),text:j(t.text,O.detailPageBytes),next:L(t.next,J),coverage:q(t.coverage)};return(n.cursor.recordId!==n.content.recordId||n.cursor.recordVersion!==n.content.version||n.cursor.field!==n.content.field||(n.range?n.range.start!==n.cursor.offset||n.range.end>n.content.bytes||n.range.end-n.range.start!==M(n.text):n.content.bytes!==0||n.cursor.offset!==0||n.text!==``))&&A(),n.coverage.observed===`complete`&&n.next!==null!=(n.range?.end??0)<n.content.bytes&&A(),n.next&&(n.next.offset!==n.range?.end||U(Gt({...n.next,offset:n.cursor.offset}))!==U(Gt(n.cursor)))&&A(),n}function Yt(e){U({kind:`ok`,value:e},O.pageBytes);let t=R(e,[`cursor`,`hits`,`next`,`coverage`]),n=J(t.cursor);n.query||A();let r=M(n.query),i=z(t.hits,O.maxPageEntries,e=>{let t=R(e,[`content`,`range`,`preview`,`cursor`,`owner`]),i=G(t.content),a=rn(t.owner);an(a,n.scope)||A();let o=Xe(t.range),s=J(t.cursor);return(o.end>i.bytes||o.end-o.start!==r||s.recordId!==i.recordId||s.recordVersion!==i.version||s.field!==i.field||s.offset!==o.start||s.storeId!==n.storeId||U(s.scope)!==U(n.scope)||s.snapshotSeq!==n.snapshotSeq||s.query!==n.query||s.navigation!==void 0)&&A(),{content:i,owner:a,range:o,preview:j(t.preview,O.previewBytes),cursor:s}}),a=L(t.next,J);return a&&(a.storeId!==n.storeId||U(a.scope)!==U(n.scope)||a.query!==n.query||a.snapshotSeq!==n.snapshotSeq||a.recordId===n.recordId&&a.recordVersion===n.recordVersion&&a.field===n.field&&(a.offset<n.offset||a.offset===n.offset&&(!a.navigation||a.navigation===n.navigation)))&&A(),{cursor:n,hits:i,next:a,coverage:q(t.coverage)}}function Xt(e){let t=R(e,[`operationId`,`commandId`,`kind`,`context`,`assignments`,`graph`]),n=et(t.context),r=L(t.graph,e=>{let t=R(e,[`recordId`,`revision`,`sha256`]);return{recordId:B(t.recordId),revision:N(t.revision,1),sha256:V(t.sha256)}}),i=F(t.kind,[`start`,`generate-plan`,`check`]),a=z(t.assignments,O.assignments,e=>{let t=R(e,[`assignmentId`,`childRunId`]);return{assignmentId:ze(t.assignmentId),childRunId:B(t.childRunId)}});return(i===`check`!=(a.length===0)||new Set(a.map(e=>e.assignmentId)).size!==a.length||new Set(a.map(e=>e.childRunId)).size!==a.length)&&A(),(!n.task||i===`start`&&(!r||r.revision!==n.task.graphRevision||r.sha256!==n.task.graphIdentity)||i!==`start`&&r!==null)&&A(),{operationId:B(t.operationId),commandId:B(t.commandId),kind:i,context:n,assignments:a,graph:r}}function Zt(e){if(K(e,`status`)===`available`)return{status:`available`,version:et(R(e,[`status`,`version`]).version)};let t=R(e,[`status`,`workspaceId`,`taskId`,`error`]);I(t.status,`unavailable`);let n=W(t.error);return I(n.effect,`none`),{status:`unavailable`,workspaceId:B(t.workspaceId),taskId:L(t.taskId,B),error:n}}function Qt(e){return e.status===`available`?e.version.workspaceId:e.workspaceId}function $t(e){return e.status===`available`?e.version.task?.id??null:e.taskId}function en(e,t,n){return(e.status!==`available`||e.version.epoch===t)&&(n.kind!==`task`||$t(e)===n.id)}function tn(e){let t=R(e,[`protocol`,`storeId`,`epoch`,`accessGeneration`,`authority`,`csrf`,`capabilities`,...Object.getOwnPropertyDescriptor(e??{},`build`)?[`build`]:[]]),n=R(t.capabilities,[`actions`,`manualChecks`,`history`]),r=F(t.authority,[`browser`,`local`]),i=L(t.csrf,B),a={actions:P(n.actions),manualChecks:P(n.manualChecks),history:P(n.history)};return(r===`browser`&&(i===null||a.manualChecks)||r===`local`&&i!==null)&&A(),{...t.build===void 0?{}:{build:Ft(t.build)},protocol:I(t.protocol,1),storeId:B(t.storeId),epoch:B(t.epoch),accessGeneration:N(t.accessGeneration,1),authority:r,csrf:i,capabilities:a}}function nn(e){U({kind:`ok`,value:e},O.pageBytes);let t=R(e,[`workspaceId`,`storeId`,`epoch`,`committedSeq`,`rootLabel`,`context`,`models`,...Object.hasOwn(e??{},`activeRuns`)?[`activeRuns`]:[]]),n={...t.activeRuns===void 0?{}:{activeRuns:jt(t.activeRuns)},workspaceId:B(t.workspaceId),storeId:B(t.storeId),epoch:B(t.epoch),committedSeq:H(t.committedSeq),rootLabel:j(t.rootLabel,4096,!0),context:Zt(t.context),models:z(t.models,O.maxPageEntries,qe)};return n.activeRuns&&(n.activeRuns.storeId!==n.storeId||n.activeRuns.workspaceId!==n.workspaceId||n.activeRuns.epoch!==n.epoch)&&A(),(Qt(n.context)!==n.workspaceId||$t(n.context)!==null||n.context.status===`available`&&n.context.version.epoch!==n.epoch)&&A(),n}function rn(e){let t=R(e,[`taskId`,`runId`,`childRunId`,`entity`]),n=R(t.entity,[`kind`,`id`,`version`]),r={taskId:B(t.taskId),runId:L(t.runId,B),childRunId:L(t.childRunId,B),entity:{kind:F(n.kind,[`task`,`run`,`child`,`message`,`tool`,`check`,`changes`,`review`]),id:B(n.id),version:N(n.version,1)}};return(r.childRunId!==null&&r.runId===null||r.entity.kind===`task`&&(r.entity.id!==r.taskId||r.runId!==null)||r.entity.kind===`run`&&(r.entity.id!==r.runId||r.childRunId!==null)||r.entity.kind===`child`&&r.entity.id!==r.childRunId||[`message`,`tool`].includes(r.entity.kind)&&r.childRunId===null||[`check`,`changes`,`review`].includes(r.entity.kind)&&r.childRunId!==null)&&A(),r}function an(e,t){return t.kind===`task`?e.taskId===t.id:t.kind===`run`?e.runId===t.id:e.childRunId===t.id}function on(e){let t=R(e,[`identity`,`complete`,`checkoutGeneration`]);return{identity:V(t.identity),complete:P(t.complete),checkoutGeneration:N(t.checkoutGeneration)}}function sn(e){U(e,O.controlBytes);let t=K(e);switch(t){case`assignment-state`:{let n=R(e,[`kind`,`childRunId`,`state`,`reason`]),r=F(n.state,[`waiting`,`ready`,`preparing`,`closing`,`unstarted`]),i=L(n.reason,e=>F(e,[`capacity`,`dependency`,`writer`,`parent-stopped`,`wait-expired`,`handoff-overflow`,`stale-dependency`,`quarantine`]));return(r===`waiting`||r===`unstarted`)&&i===null&&A(),(r===`ready`||r===`preparing`)&&i!==null&&A(),{kind:t,childRunId:B(n.childRunId),state:r,reason:i}}case`admission-closed`:return{kind:t,reason:F(R(e,[`kind`,`reason`]).reason,[`failed`,`canceled`,`timeout`,`wait-expired`,`handoff-overflow`,`stale-dependency`,`quarantine`])};case`parent-admitted`:{let n=R(e,[`kind`,`runId`,`identity`]);return{kind:t,runId:B(n.runId),identity:Xt(n.identity)}}case`parent-settled`:{let n=R(e,[`kind`,`runId`,`settlement`]),r=Dt(n.settlement);return r.kind!==`parent`&&A(),{kind:t,runId:B(n.runId),settlement:r}}case`gate`:{let n=typeof e==`object`&&!!e&&Object.hasOwn(e,`reservationId`),r=R(e,[`kind`,`lane`,`state`,`checkoutGeneration`,...n?[`reservationId`]:[]]);return{kind:t,...n?{reservationId:B(r.reservationId)}:{},lane:F(r.lane,[`reader`,`writer`,`check`]),state:F(r.state,[`waiting`,`held`,`released`,`unknown`]),checkoutGeneration:N(r.checkoutGeneration)}}case`handoff`:{let n=R(e,[`kind`,`childRunId`,`handoff`,`observation`]);return{kind:t,childRunId:B(n.childRunId),handoff:lt(n.handoff),observation:on(n.observation)}}case`changes`:{let n=R(e,[`kind`,`observationId`,`stage`,`observation`,`content`]),r=G(n.content);return I(r.field,`changes`),{kind:t,observationId:B(n.observationId),stage:F(n.stage,[`before`,`after`,`review`]),observation:on(n.observation),content:r}}case`check-start`:{let n=R(e,[`kind`,`checkId`,`selection`,`cwdId`,`cwdLabel`,`checkEnvGeneration`,`before`]);return{kind:t,checkId:B(n.checkId),selection:tt(n.selection),cwdId:B(n.cwdId),cwdLabel:j(n.cwdLabel,4096,!0),checkEnvGeneration:N(n.checkEnvGeneration,1),before:on(n.before)}}case`check-settled`:{let n=typeof e==`object`&&!!e&&Object.hasOwn(e,`ownAdvance`),r=R(e,[`kind`,`checkId`,`native`,`status`,`before`,`after`,`output`,`coverage`,...n?[`ownAdvance`]:[]]),i;if(n){let e=R(r.ownAdvance,[`operationId`,`reservationId`,`from`,`to`]);i={operationId:B(e.operationId),reservationId:B(e.reservationId),from:N(e.from),to:N(e.to)},(i.to!==i.from+1||i.reservationId!==r.checkId)&&A()}let a=bt(r.native),o=F(r.status,[`passed`,`failed`,`canceled`,`stale`]),s=on(r.before),c=on(r.after),l=L(r.output,G),u=q(r.coverage);return l&&l.field!==`check`&&A(),o===`passed`&&(a.outcome!==`completed`||U({...s,checkoutGeneration:c.checkoutGeneration})!==U(c)||(i?s.checkoutGeneration!==i.from||c.checkoutGeneration!==i.to||l===null:s.checkoutGeneration!==c.checkoutGeneration)||u.observed!==`complete`)&&A(),o===`canceled`&&![`canceled`,`timeout`].includes(a.outcome)&&A(),{kind:t,...i?{ownAdvance:i}:{},checkId:B(r.checkId),native:a,status:o,before:s,after:c,output:l,coverage:u}}case`review`:{let n=R(e,[`kind`,`reviewId`,`runId`,`checksRevision`,`changesIdentity`,`acceptIssues`,`outcome`,`content`]),r=P(n.acceptIssues),i=F(n.outcome,[`reviewed`,`reviewed-with-issues`]),a=G(n.content);return I(a.field,`review`),i===`reviewed-with-issues`&&!r&&A(),{kind:t,reviewId:B(n.reviewId),runId:B(n.runId),checksRevision:N(n.checksRevision),changesIdentity:V(n.changesIdentity),acceptIssues:r,outcome:i,content:a}}case`publication-intent`:{let n=R(e,[`kind`,`publicationId`,`expectedRevision`,`expectedIdentity`,`nextRevision`,`nextIdentity`]),r=N(n.expectedRevision),i=L(n.expectedIdentity,V),a=N(n.nextRevision,1);return(r===0!=(i===null)||a!==r+1)&&A(),{kind:t,publicationId:B(n.publicationId),expectedRevision:r,expectedIdentity:i,nextRevision:a,nextIdentity:V(n.nextIdentity)}}case`publication-settled`:{let n=R(e,[`kind`,`publicationId`,`status`,`observed`]),r=F(n.status,[`published`,`conflict`,`uncertain`]),i=L(n.observed,e=>{let t=R(e,[`revision`,`identity`]);return{revision:N(t.revision,1),identity:V(t.identity)}});return r===`published`&&i===null&&A(),{kind:t,publicationId:B(n.publicationId),status:r,observed:i}}default:return A()}}function cn(e){let t=R(e,[`epoch`,`operationId`,`taskId`,`runId`]);return{epoch:B(t.epoch),operationId:B(t.operationId),taskId:B(t.taskId),runId:L(t.runId,B)}}function ln(e){U(e,O.ownerQueueBytes);let t=R(e,[`observedMs`,`link`,`events`]),n=cn(t.link),r=z(t.events,O.ownerQueueFrames,e=>{let t=K(e);if(t===`fact`){let r=sn(R(e,[`kind`,`fact`]).fact);return(`runId`in r&&r.runId!==n.runId||r.kind===`parent-admitted`&&(r.identity.context.task?.id!==n.taskId||r.identity.operationId!==n.operationId)||[`gate`,`assignment-state`,`admission-closed`,`handoff`,`check-start`,`check-settled`].includes(r.kind)&&n.runId===null)&&A(),{kind:t,fact:r}}if(t===`content-begin`){let r=R(e,[`kind`,`detailId`,`owner`,`field`,`encoding`]),i=rn(r.owner),a=F(r.field,[`plan`,`check`,`changes`,`review`]);return(i.taskId!==n.taskId||i.runId!==n.runId||i.childRunId!==null||i.entity.kind!==(a===`plan`?`task`:a))&&A(),{kind:t,detailId:B(r.detailId),owner:i,field:a,encoding:I(r.encoding,`utf8`)}}if(t===`content-chunk`){let n=R(e,[`kind`,`detailId`,`text`]);return{kind:t,detailId:B(n.detailId),text:j(n.text,O.chunkBytes)}}let r=R(e,[`kind`,`detailId`,`coverage`]);return I(t,`content-end`),{kind:`content-end`,detailId:B(r.detailId),coverage:q(r.coverage)}});return{observedMs:N(t.observedMs),link:n,events:r}}var un=[`tasks`,`runs`,`messages`,`tools`,`contents`,`events`,`checks`,`changes`,`reviews`];function X(e){let t=R(e,[`reader`,`storeId`,`scope`,`snapshotSeq`,`after`,`limit`,...Object.hasOwn(e??{},`navigation`)?[`navigation`]:[]]),n=F(t.reader,un),r=R(t.scope,[`kind`,`id`]),i={kind:F(r.kind,[`workspace`,`task`,`run`,`child`]),id:B(r.id)},a=L(t.snapshotSeq,H),o=L(t.after,e=>{let t=R(e,[`recordId`,`version`,`offset`]);return{recordId:B(t.recordId),version:N(t.version,1),offset:N(t.offset)}});return(o&&a===null||n===`tasks`!=(i.kind===`workspace`))&&A(),{reader:n,...Object.hasOwn(t,`navigation`)?{navigation:ft(t.navigation)}:{},storeId:B(t.storeId),scope:i,snapshotSeq:a,after:o,limit:N(t.limit,1,O.maxPageEntries)}}function dn(e){let t=R(e,[`policy`,`historicalRuns`]),n=X(t.historicalRuns);return(n.reader!==`runs`||n.after!==null||n.snapshotSeq===null)&&A(),{policy:I(t.policy,`active-and-recent`),historicalRuns:n}}function fn(e){let t=K(e);if(t===`run`)return{kind:t,projection:Bt(R(e,[`kind`,`projection`]).projection)};if(t===`capture-fact`){let n=R(e,[`kind`,`recordId`,`committedSeq`,`link`,`capture`]),r=H(n.committedSeq);return r===`0`&&A(),{kind:t,recordId:B(n.recordId),committedSeq:r,link:At(n.link),capture:kt(n.capture)}}if(t===`owner-fact`){let n=R(e,[`kind`,`recordId`,`committedSeq`,`observedMs`,`link`,`fact`]),r=ln({observedMs:n.observedMs,link:n.link,events:[{kind:`fact`,fact:n.fact}]}),i=r.events[0];i.kind!==`fact`&&A();let a=H(n.committedSeq);return a===`0`&&A(),{kind:t,recordId:B(n.recordId),committedSeq:a,link:r.link,observedMs:r.observedMs,fact:i.fact}}let n=[`kind`,`owner`,`version`],r=t===`task`?[`goal`,`plan`]:t===`message`?[`role`,`source`,`resultCallId`,`state`,`finalBlockCount`,`finalText`]:t===`tool`?[`source`,`name`,`declaration`,`declarationStage`,`startObserved`,`result`]:t===`content`?[`detailId`,`descriptor`,`content`,`coverage`]:[`block`],i=R(e,[...n,...r]),a=rn(i.owner),o=N(i.version,1);if([`task`,`message`,`tool`].includes(t)&&(a.entity.kind!==t||a.entity.version!==o)&&A(),t===`task`){let e=L(i.plan,G);return e&&e.field!==`plan`&&A(),{kind:t,owner:a,version:o,goal:j(i.goal,8192,!0),plan:e}}if(t===`message`){let e=F(i.role,[`user`,`assistant`,`tool-result`]),n=F(i.state,[`partial`,`final`]),r=L(i.finalBlockCount,e=>N(e,0,O.dataFrames)),s=L(i.finalText,G),c=L(i.resultCallId,B);return(n===`final`!=(r!==null)||n===`partial`&&s!==null||s&&s.field!==`final-text`||e!==`tool-result`&&c!==null)&&A(),{kind:t,owner:a,version:o,role:e,state:n,finalBlockCount:r,finalText:s,resultCallId:c,source:pt(i.source)}}if(t===`tool`){let e=L(i.declaration,mt),n=L(i.declarationStage,e=>F(e,[`partial`,`final`])),r=P(i.startObserved),s=L(i.result,e=>{let t=yt(e);return t.kind!==`tool-end`&&A(),t});return(e===null!=(n===null)||s&&(s.callId!==a.entity.id||s.startObserved!==r||U(s.declaration)!==U(e)))&&A(),{kind:t,owner:a,version:o,declaration:e,declarationStage:n,startObserved:r,result:s,source:pt(i.source),name:j(i.name,128,!0)}}if(t===`content`){let e=gt(i.descriptor),n=G(i.content);return(e.field!==n.field||!pn(e.owner,a))&&A(),{kind:t,owner:a,version:o,detailId:B(i.detailId),descriptor:e,content:n,coverage:q(i.coverage)}}I(t,`omitted`);let s=_t(i.block);return pn(s.owner,a)||A(),{kind:`omitted`,owner:a,version:o,block:s}}function pn(e,t){return e.kind===`message`||e.kind===`message-final`?t.entity.kind===`message`&&e.messageId===t.entity.id:e.kind===`tool`?t.entity.kind===`tool`&&e.callId===t.entity.id:t.entity.kind===`child`}function mn(e,t){let{scope:n,reader:r}=t,i=e.kind===`run`?{taskId:e.projection.taskId,runId:e.projection.runId,childRunId:e.projection.childRunId}:e.kind===`owner-fact`?{...e.link,childRunId:null}:e.kind===`capture-fact`?e.link:e.owner;return n.kind!==`workspace`&&!(n.kind===`task`?i.taskId===n.id:n.kind===`run`?i.runId===n.id:i.childRunId===n.id)?!1:r===`tasks`?e.kind===`task`:r===`runs`?e.kind===`run`:r===`messages`?e.kind===`message`:r===`tools`?e.kind===`tool`:r===`contents`?e.kind===`content`||e.kind===`omitted`:e.kind===`capture-fact`?r===`events`:e.kind===`owner-fact`?r===`events`||r===`checks`&&[`check-start`,`check-settled`].includes(e.fact.kind)||r===`changes`&&e.fact.kind===`changes`||r===`reviews`&&e.fact.kind===`review`:!1}function hn(e){U({kind:`ok`,value:e},O.pageBytes);let t=R(e,[`request`,`records`,`next`,`coverage`]),n=X(t.request);n.snapshotSeq===null&&A();let r=z(t.records,n.limit,fn),i=L(t.next,X);return(r.some(e=>!mn(e,n))||i&&(i.after===null||U(Gt({...i,after:n.after}))!==U(Gt(n))||U(i.after)===U(n.after)))&&A(),{request:n,records:r,next:i,coverage:q(t.coverage)}}function gn(e){if(Object.getOwnPropertyDescriptor(e??{},`kind`)?.value===`snapshot`){U({kind:`ok`,value:e},O.pageBytes);let t=R(e,[`kind`,`request`,`next`,`coverage`]),n=X(t.request),r=X(t.next);return(n.snapshotSeq!==null||n.after!==null||r.snapshotSeq===null||!r.navigation||U(Gt({...r,snapshotSeq:null}))!==U(Gt(n)))&&A(),{kind:`snapshot`,request:n,next:r,coverage:q(t.coverage)}}if(Object.getOwnPropertyDescriptor(e??{},`kind`)?.value!==`progress`)return hn(e);U({kind:`ok`,value:e},O.pageBytes);let t=R(e,[`kind`,`request`,`next`,`coverage`]),n=X(t.request),r=X(t.next);return Kt(n,r),{kind:`progress`,request:n,next:r,coverage:q(t.coverage)}}function _n(e,t){return U({...t.request,snapshotSeq:e.snapshotSeq})===U(e)&&(e.snapshotSeq===null||e.snapshotSeq===t.request.snapshotSeq)}function vn(e){let t=R(e,[`storeId`,`scope`,`snapshotSeq`,`graph`,...Object.hasOwn(e??{},`navigation`)?[`navigation`]:[]]),n=R(t.graph,[`recordId`,`revision`,`sha256`]);return{...Object.hasOwn(t,`navigation`)?{navigation:ft(t.navigation)}:{},storeId:B(t.storeId),scope:dt(t.scope),snapshotSeq:H(t.snapshotSeq),graph:{recordId:B(n.recordId),revision:N(n.revision,1),sha256:V(n.sha256)}}}function yn(e){U({kind:`ok`,value:e});let t=R(e,[`request`,`graph`]),n=vn(t.request),r=Qe(t.graph);return(r.revision!==n.graph.revision||n.scope.kind===`task`&&n.scope.id!==r.taskId)&&A(),{request:n,graph:r}}function bn(e){if(Object.getOwnPropertyDescriptor(e??{},`kind`)?.value!==`progress`)return yn(e);U({kind:`ok`,value:e},O.pageBytes);let t=R(e,[`kind`,`request`,`next`,`coverage`]),n=vn(t.request),r=vn(t.next);return Kt(n,r),{kind:`progress`,request:n,next:r,coverage:q(t.coverage)}}function xn(e){let t=R(e,[`storeId`,`scope`,`snapshotSeq`,`format`]);return{storeId:B(t.storeId),scope:dt(t.scope),snapshotSeq:H(t.snapshotSeq),format:F(t.format,[`ndjson`,`markdown`])}}function Sn(e){U(e,O.controlBytes);let t=R(e,[`exportId`,`ordinal`,`event`]),n=K(t.event),r;switch(n){case`manifest`:{let e=R(t.event,[`kind`,`schema`,`request`,`coverage`,`serviceProtocol`,`workerProtocol`,`provenance`]),i=R(e.provenance,[`exporterBuildSha256`,`capturePolicy`]);r={kind:n,provenance:{exporterBuildSha256:V(i.exporterBuildSha256),capturePolicy:I(i.capturePolicy,`public-text-tools/2`)},schema:I(e.schema,Fe),request:xn(e.request),coverage:q(e.coverage),serviceProtocol:I(e.serviceProtocol,1),workerProtocol:I(e.workerProtocol,2)};break}case`record`:r={kind:n,record:fn(R(t.event,[`kind`,`record`]).record)};break;case`graph`:r={kind:n,graph:yn(R(t.event,[`kind`,`graph`]).graph)};break;case`detail`:{let e=R(t.event,[`kind`,`owner`,`content`,`range`,`text`,`coverage`]),i=G(e.content),a=L(e.range,Xe),o=j(e.text,O.detailPageBytes);(a?a.end>i.bytes||a.end-a.start!==M(o):i.bytes!==0||o!==``)&&A(),r={kind:n,owner:rn(e.owner),content:i,range:a,text:o,coverage:q(e.coverage)};break}case`markdown`:r={kind:n,text:j(R(t.event,[`kind`,`text`]).text,O.detailPageBytes)};break;case`trailer`:{let e=R(t.event,[`kind`,`complete`,`frames`,`encodedBytes`,`sha256`,`committedSeq`,`coverage`]),i=q(e.coverage),a=P(e.complete);a&&i.observed!==`complete`&&A(),r={kind:n,complete:a,frames:N(e.frames,1),encodedBytes:N(e.encodedBytes),sha256:V(e.sha256),committedSeq:H(e.committedSeq),coverage:i};break}default:return A()}return{exportId:B(t.exportId),ordinal:N(t.ordinal,1),event:r}}function Cn(e,t){let n=Sn(e);return t===`ndjson`?`${U(n)}\n`:n.event.kind===`markdown`?n.event.text:(n.event.kind!==`manifest`&&n.event.kind!==`trailer`&&A(),`\n\n\`\`\`json\n${U(n)}\n\`\`\`\n`)}var wn=class{exportId=null;ordinal=0;bytes=0;ended=!1;complete=!1;request;constructor(e){this.request=xn(e)}receive(e){let t=Sn(e),n=t.event;return(this.ended||t.ordinal!==this.ordinal+1||this.exportId!==null&&this.exportId!==t.exportId)&&A(),this.ordinal===0?(n.kind!==`manifest`||U(n.request)!==U(this.request))&&A():n.kind===`manifest`&&A(),n.kind===`trailer`?((n.frames!==this.ordinal||n.encodedBytes!==this.bytes||n.committedSeq!==this.request.snapshotSeq)&&A(),this.ended=!0,this.complete=n.complete):(this.request.format===`markdown`&&n.kind!==`manifest`&&n.kind!==`markdown`&&A(),this.request.format===`ndjson`&&n.kind===`markdown`&&A(),n.kind===`detail`&&!an(n.owner,this.request.scope)&&A(),n.kind===`graph`&&(U(n.graph.request.scope)!==U(this.request.scope)||n.graph.request.snapshotSeq!==this.request.snapshotSeq||n.graph.request.storeId!==this.request.storeId)&&A(),n.kind===`record`&&!Tn(n.record,this.request.scope)&&A(),this.bytes+=M(Cn(t,this.request.format))),this.exportId=t.exportId,this.ordinal=t.ordinal,t}get completion(){return this.ended?this.complete?`complete-unverified-digest`:`incomplete`:`missing-trailer`}};function Tn(e,t){return e.kind===`run`?Vt(e.projection,t):e.kind===`owner-fact`?t.kind===`task`?e.link.taskId===t.id:t.kind===`run`&&e.link.runId===t.id:e.kind===`capture-fact`?t.kind===`task`?e.link.taskId===t.id:t.kind===`run`?e.link.runId===t.id:e.link.childRunId===t.id:an(e.owner,t)}function En(e){let t=R(e,[`taskId`,`revision`,`definitions`]),n=z(t.definitions,32,e=>{let t=R(e,[`selection`,`status`,`checkId`]),n=tt(t.selection),r=F(t.status,[`not-run`,`passed`,`failed`,`canceled`,`stale`]),i=L(t.checkId,B);return(n.kind!==`configured`||r===`not-run`!=(i===null))&&A(),{selection:n,status:r,checkId:i}});return new Set(n.map(e=>e.selection.name)).size!==n.length&&A(),{taskId:B(t.taskId),revision:N(t.revision),definitions:n}}function Dn(e){let t=R(e,[`storeId`,`scope`,`snapshotSeq`,`kind`,`id`,`version`,...Object.hasOwn(e??{},`navigation`)?[`navigation`]:[]]);return{...Object.hasOwn(t,`navigation`)?{navigation:ft(t.navigation)}:{},storeId:B(t.storeId),scope:dt(t.scope),snapshotSeq:H(t.snapshotSeq),kind:F(t.kind,[`task`,`message`,`tool`]),id:B(t.id),version:N(t.version,1)}}function On(e){U({kind:`ok`,value:e},O.pageBytes);let t=R(e,[`request`,`record`]),n=Dn(t.request),r=fn(t.record);return(r.kind!==`task`&&r.kind!==`message`&&r.kind!==`tool`||r.kind!==n.kind||r.owner.entity.id!==n.id||r.version!==n.version||!an(r.owner,n.scope))&&A(),{request:n,record:r}}function kn(e){if(Object.getOwnPropertyDescriptor(e??{},`kind`)?.value!==`progress`)return On(e);U({kind:`ok`,value:e},O.pageBytes);let t=R(e,[`kind`,`request`,`next`,`coverage`]),n=Dn(t.request),r=Dn(t.next);return Kt(n,r),{kind:`progress`,request:n,next:r,coverage:q(t.coverage)}}var An=e=>{let t=W(e);return I(t.effect,`none`),t};function jn(e){let t=R(e,[`storeId`,`taskId`]);return{storeId:B(t.storeId),taskId:L(t.taskId,B)}}function Mn(e){let t=jn(e);return t.taskId===null&&A(),t}function Nn(e){let t=R(e,[`id`,`kind`,`revision`,`identity`]);return{id:B(t.id),kind:F(t.kind,[`code`,`research`,`diagnosis`]),revision:N(t.revision,1),identity:V(t.identity)}}function Pn(e){let t=z(e,3,Je);return(t.length!==3||new Set(t.map(e=>e.role)).size!==3)&&A(),t}function Fn(e){let t=Object.getOwnPropertyDescriptor(e??{},`status`)?.value;if(t===`none`)return R(e,[`status`]),{status:t};if(t===`saved`){let n=R(e,[`status`,`request`,`planRevision`]);return{status:t,request:vn(n.request),planRevision:N(n.planRevision,1)}}let n=R(e,[`status`,`error`]);return I(n.status,`unavailable`),{status:`unavailable`,error:An(n.error)}}function In(e){if((e.request.taskId!==(e.task?.id??null)||Qt(e.context)!==e.workspaceId||$t(e.context)!==e.request.taskId)&&A(),e.context.status===`available`){let t=e.context.version;(t.epoch!==e.epoch||!!t.task!=!!e.task||e.task&&(t.task?.revision!==e.task.revision||t.task.identity!==e.task.identity||t.task.kind!==e.task.kind))&&A()}}function Ln(e){U({kind:`ok`,value:e},O.pageBytes);let t=R(e,[`request`,`workspaceId`,`epoch`,`committedSeq`,`context`,`task`,`roles`,`readablePlan`,`savedGraph`]),n={request:jn(t.request),workspaceId:B(t.workspaceId),epoch:B(t.epoch),committedSeq:H(t.committedSeq),context:Zt(t.context),task:L(t.task,Nn),roles:Pn(t.roles),savedGraph:Fn(t.savedGraph),readablePlan:L(t.readablePlan,e=>{let t=R(e,[`source`,`text`,`editable`,`coverage`]),n=q(t.coverage),r=P(t.editable);return r&&(n.redacted||n.observed!==`complete`||n.source!==`complete`||n.omissions.length)&&A(),{source:I(t.source,`current-v1`),text:j(t.text,32768),editable:r,coverage:n}})};In(n),!!n.task!=!!n.readablePlan&&A();let r=n.savedGraph;return r.status===`saved`&&(r.request.storeId!==n.request.storeId||r.request.scope.kind!==`task`||r.request.scope.id!==n.task?.id||r.request.snapshotSeq!==n.committedSeq||n.context.status===`available`&&(r.request.graph.sha256!==n.context.version.task?.graphIdentity||r.request.graph.revision!==n.context.version.task?.graphRevision))&&A(),r.status===`unavailable`&&n.context.status===`available`&&A(),n}function Rn(e){U({kind:`ok`,value:e},O.pageBytes);let t=R(e,[`request`,`workspaceId`,`epoch`,`committedSeq`,`context`,`task`,`observation`,`text`,`git`,`coverage`]),n=R(t.observation,[`identity`,`complete`,`checkoutGeneration`]),r={request:Mn(t.request),workspaceId:B(t.workspaceId),epoch:B(t.epoch),committedSeq:H(t.committedSeq),context:Zt(t.context),task:Nn(t.task),observation:{identity:V(n.identity),complete:P(n.complete),checkoutGeneration:N(n.checkoutGeneration,0)},text:j(t.text,131072),git:P(t.git),coverage:q(t.coverage)};if(In(r),r.context.status===`available`){let e=r.context.version;(e.observation.identity!==r.observation.identity||e.observation.complete!==r.observation.complete||e.checkoutGeneration!==r.observation.checkoutGeneration)&&A()}return r}function zn(e){let t=R(e,[`epoch`,`accessGeneration`,`configRev`,`catalogId`]);return{epoch:B(t.epoch),accessGeneration:N(t.accessGeneration,1),configRev:N(t.configRev,1),catalogId:B(t.catalogId)}}function Bn(e){U({kind:`ok`,value:e},O.pageBytes);let t=R(e,[`version`,`selected`]);return{version:zn(t.version),selected:L(t.selected,qe)}}function Vn(e){U(e);let t=R(e,[`expected`,`choice`]);return{expected:zn(t.expected),choice:Ke(t.choice)}}function Hn(e){let t=R(e,[`provider`,`model`,`api`,`thinking`,`eligibility`]),n={provider:j(t.provider,128,!0),model:j(t.model,256,!0),api:L(t.api,e=>F(e,We)),thinking:z(t.thinking,7,e=>{let t=R(e,[`level`,`selectable`]);return{level:F(t.level,Ge),selectable:P(t.selectable)}}),eligibility:F(t.eligibility,[`candidate`,`unsupported`,`auth-unavailable`])};return(new Set(n.thinking.map(e=>e.level)).size!==n.thinking.length||n.thinking.some(e=>e.selectable&&(n.api===null||n.eligibility!==`candidate`))||n.eligibility===`candidate`&&!n.thinking.some(e=>e.selectable))&&A(),n}function Un(e){U({kind:`ok`,value:e},O.pageBytes);let t=R(e,[`version`,`selected`,`status`,`entries`,`withheld`]),n=z(t.entries,O.maxPageEntries,Hn),r=F(t.status,[`complete`,`capacity`]),i=N(t.withheld,0,O.maxPageEntries);return(r===`capacity`&&(n.length||i)||n.length+i>O.maxPageEntries||new Set(n.map(e=>U([e.provider,e.model]))).size!==n.length)&&A(),{version:zn(t.version),selected:L(t.selected,qe),status:r,entries:n,withheld:i}}async function Wn(e,t,n){let r=await e.preflight(t,n);return r.kind===`error`?r:{kind:`ok`,value:{preflight:r.value,commandId:crypto.randomUUID(),submitted:!1}}}function Gn(e,t){if(t.submitted)throw Error(`Already submitted; observe the same receipt.`);t.submitted=!0;let n=t.preflight,r={commandId:t.commandId,expected:n.preview.version,grant:n.grant},i=n.preview.action;switch(i.kind){case`create`:return e.create({...r,action:i});case`save-plan`:return e.savePlan({...r,action:i});case`generate-plan`:return e.generatePlan({...r,action:i});case`start`:return e.start({...r,action:i});case`check`:return e.check({...r,action:i});case`review`:return e.review({...r,action:i})}}var Z=e=>({kind:`error`,error:Le(`unavailable`,e?`uncertain`:`none`)}),Kn=class{transport;constructor(e){this.transport=e}async current(e,t){let n=jn(e);try{if(!this.transport.current)return Z(!1);let e=Y(await this.transport.current(n,t),Ln);return e.kind===`ok`&&U(e.value.request)!==U(n)?Z(!1):e}catch{return Z(!1)}}async currentChanges(e,t){let n=Mn(e);try{if(!this.transport.currentChanges)return Z(!1);let e=Y(await this.transport.currentChanges(n,t),Rn);return e.kind===`ok`&&U(e.value.request)!==U(n)?Z(!1):e}catch{return Z(!1)}}async activeRuns(e){try{return this.transport.activeRuns?Y(await this.transport.activeRuns(e),jt):Z(!1)}catch{return Z(!1)}}async models(e){try{return this.transport.models?Y(await this.transport.models(e),Un):Z(!1)}catch{return Z(!1)}}async chooseModel(e){let t=Vn(e);try{if(!this.transport.chooseModel)return Z(!1);let e=Y(await this.transport.chooseModel(t),Bn);if(e.kind===`ok`){let{sourceSelectionId:n,...r}=e.value.selected??{};if(U(r)!==U(t.choice)||e.value.version.epoch!==t.expected.epoch||e.value.version.accessGeneration!==t.expected.accessGeneration||![t.expected.configRev,t.expected.configRev+1].includes(e.value.version.configRev)||e.value.version.configRev===t.expected.configRev!=(e.value.version.catalogId===t.expected.catalogId))return Z(!0)}return e}catch{return Z(!0)}}async checkObligations(e,t){B(e);try{let n=Y(await this.transport.checkObligations(e,t),En);return n.kind===`ok`&&n.value.taskId!==e?Z(!1):n}catch{return Z(!1)}}task(e,t){return this.entity(`task`,e,t)}message(e,t){return this.entity(`message`,e,t)}tool(e,t){return this.entity(`tool`,e,t)}async entity(e,t,n){let r=Dn({...t,kind:e});try{let e=Y(await this.transport.entity(r,n),kn);return e.kind===`ok`&&U(e.value.request)!==U(r)?Z(!1):e}catch{return Z(!1)}}async session(e){try{return Y(await this.transport.session(e),tn)}catch{return Z(!1)}}async workspace(e){try{return Y(await this.transport.workspace(e),nn)}catch{return Z(!1)}}tasks(e,t){return this.page(`tasks`,e,t)}runs(e,t){return this.page(`runs`,e,t)}messages(e,t){return this.page(`messages`,e,t)}tools(e,t){return this.page(`tools`,e,t)}contents(e,t){return this.page(`contents`,e,t)}events(e,t){return this.page(`events`,e,t)}checks(e,t){return this.page(`checks`,e,t)}changes(e,t){return this.page(`changes`,e,t)}reviews(e,t){return this.page(`reviews`,e,t)}async page(e,t,n){let r=X({...t,reader:e});try{let t=Y(await this.transport[e](r,n),gn);return t.kind===`ok`&&!_n(r,t.value)?Z(!1):t}catch{return Z(!1)}}async graph(e,t){let n=vn(e);try{let e=Y(await this.transport.graph(n,t),bn);return e.kind===`ok`&&U(e.value.request)!==U(n)?Z(!1):e}catch{return Z(!1)}}async*export(e,t){let n=xn(e),r=new wn(n),i;try{if(t.aborted)throw new k(`unavailable`);for await(let e of this.transport.export(n,t)){if(t.aborted)throw new k(`unavailable`);let n=r.receive(e);n.event.kind===`trailer`?i=n:yield n}if(t.aborted||!i)throw new k(`unavailable`);yield i}catch{throw new k(`unavailable`)}}async preflight(e,t){let n=rt({expected:e,action:t});try{let e=Y(await this.transport.preflight(n),ct);return e.kind===`ok`&&(U(e.value.preview.version)!==U(n.expected)||U(e.value.preview.action)!==U(n.action))?Z(!1):e}catch{return Z(!1)}}create(e){return this.execute(`create`,e)}savePlan(e){return this.execute(`save-plan`,e)}generatePlan(e){return this.execute(`generate-plan`,e)}start(e){return this.execute(`start`,e)}check(e){return this.execute(`check`,e)}review(e){return this.execute(`review`,e)}async execute(e,t){let n=it(t);if(n.action.kind!==e)return{kind:`error`,error:Le(`invalid`)};try{let e=Y(await this.transport.command(n),Lt);if(e.kind===`ok`){if(e.value.commandId!==n.commandId)return Z(!0);Rt({identity:{kind:`action`,expected:n.expected,action:n.action},receipt:e.value})}return e}catch{return Z(!0)}}async cancel(e){let t=ot(e);try{let e=Y(await this.transport.cancel(t),Lt);if(e.kind===`ok`){if(e.value.commandId!==t.commandId)return Z(!0);Rt({identity:{kind:`cancel`,epoch:t.epoch,runId:t.runId},receipt:e.value})}return e}catch{return Z(!0)}}async receipt(e,t){B(e);try{let n=zt(await this.transport.receipt(e,t));if(n.status===`found`&&n.receipt.commandId!==e)throw Error(`invalid`);return n}catch{return{status:`inconclusive`,error:Le(`receipt-inconclusive`,`uncertain`)}}}async snapshot(e,t){let n=dt(e);try{let e=Y(await this.transport.snapshot(n,t),Ut);return e.kind===`ok`&&U(e.value.scope)!==U(n)?Z(!1):e}catch{return Z(!1)}}async detail(e,t){let n=J(e);try{let e=Y(await this.transport.detail(n,t),qt);return e.kind===`ok`&&U(e.value.cursor)!==U(n)?Z(!1):e}catch{return Z(!1)}}async search(e,t){let n=J(e);try{let e=Y(await this.transport.search(n,t),Yt);return e.kind===`ok`&&U(e.value.cursor)!==U(n)?Z(!1):e}catch{return Z(!1)}}},qn=class{generation=0;snapshotRequest=0;observation;lastSnapshotMs=0;beginSnapshot(){return++this.snapshotRequest}install(e,t,n){if(n!==this.snapshotRequest)return;let r=Ut(e),i=this.observation?.snapshot;if(i&&i.storeId===r.storeId&&U(i.scope)===U(r.scope)&&Re(r.committedSeq,i.committedSeq)<0)this.resync();else return this.observation={snapshot:r,connection:`current`,lastObservedMs:t},this.lastSnapshotMs=t,++this.generation}resync(){return this.observation&&(this.observation.connection=`resync`),this.snapshotRequest++,`resync`}get state(){return this.observation&&structuredClone(this.observation)}needsPoll(e){return!this.observation||this.observation.connection===`resync`||e<this.lastSnapshotMs||e-this.lastSnapshotMs>=O.reconcileMs}tick(e){let t=this.observation;t&&t.connection!==`resync`&&(e<t.lastObservedMs||e-t.lastObservedMs>=O.staleMs)&&(t.connection=`stale`)}receive(e,t,n){let r=this.observation;if(!r||t!==this.generation)return`ignored`;if(r.connection===`resync`)return`resync`;let i;try{i=Wt(e)}catch{return this.resync()}let a=r.snapshot;if(i.storeId!==a.storeId||i.epoch!==a.epoch||U(i.scope)!==U(a.scope))return this.resync();let o=Re(i.committedSeq,a.committedSeq);if(o<0)return`duplicate`;if(i.kind===`heartbeat`)return o>0?this.resync():(r.lastObservedMs=n,r.connection=`current`,`applied`);if(o===0)return`duplicate`;if(i.previousSeq!==a.committedSeq||Qt(i.context)!==Qt(a.context)||$t(i.context)!==$t(a.context)||i.context.status===`available`&&a.context.status===`available`&&i.context.version.controlRev<a.context.version.controlRev)return this.resync();let s=[...a.runs];for(let e of i.removed){let t=s.findIndex(t=>(t.childRunId??t.runId)===e);if(t===-1||s[t].lifecycle!==`settled`)return this.resync();s.splice(t,1)}for(let e of i.runs){let t=e.childRunId??e.runId,n=s.findIndex(e=>(e.childRunId??e.runId)===t);if(n===-1)s.push(e);else{let t=s[n];if(t.runId!==e.runId||t.childRunId!==e.childRunId||t.assignmentId!==e.assignmentId||U(t.admission)!==U(e.admission))return this.resync();s[n]=e}}if(s.length>O.maxPageEntries)return this.resync();let c={...a,runs:s,context:i.context,committedSeq:i.committedSeq,horizon:{...a.horizon,historicalRuns:{...a.horizon.historicalRuns,snapshotSeq:i.committedSeq}}};try{Ut(c)}catch{return this.resync()}return a.runs=s,a.horizon=c.horizon,a.context=i.context,a.committedSeq=i.committedSeq,r.lastObservedMs=n,r.connection=`current`,`applied`}},Jn={session:`/api/v1/session`,current:`/api/v1/current`,currentChanges:`/api/v1/current-changes`,activeRuns:`/api/v1/active-runs`,models:`/api/v1/models`,chooseModel:`/api/v1/model-choice`,workspace:`/api/v1/workspace`,tasks:`/api/v1/tasks`,runs:`/api/v1/runs`,messages:`/api/v1/messages`,tools:`/api/v1/tools`,contents:`/api/v1/contents`,events:`/api/v1/history-events`,checks:`/api/v1/checks`,changes:`/api/v1/changes`,reviews:`/api/v1/reviews`,checkObligations:`/api/v1/check-obligations`,entity:`/api/v1/entity`,graph:`/api/v1/graph`,snapshot:`/api/v1/snapshot`,detail:`/api/v1/details`,search:`/api/v1/search`,export:`/api/v1/export`,download:`/api/v1/download`,preflight:`/api/v1/preflight`,command:`/api/v1/commands`,cancel:`/api/v1/cancel`,receipt:`/api/v1/receipt`,detach:`/api/v1/detach`},Yn=`/api/v1/events`,Xn=[`tasks`,`runs`,`messages`,`tools`,`contents`,`events`,`checks`,`changes`,`reviews`];function Zn(e,t){if(Xn.includes(e)||e===`detail`||e===`search`||e===`entity`||e===`current`||e===`currentChanges`||e===`activeRuns`||e===`workspace`||e===`models`||e===`chooseModel`)return O.pageBytes;if(e===`graph`){let e=Object.getOwnPropertyDescriptor(t??{},`kind`)?.value,n=Object.getOwnPropertyDescriptor(t??{},`value`)?.value;if(e===`ok`&&Object.getOwnPropertyDescriptor(n??{},`kind`)?.value===`progress`)return O.pageBytes}return O.controlBytes}function Qn(e){return[`preflight`,`command`,`cancel`,`detach`,`chooseModel`].includes(e)}function $n(e,t){switch(e){case`session`:case`models`:case`activeRuns`:case`workspace`:case`detach`:if(t!==null)throw new k(`invalid`);return null;case`tasks`:case`runs`:case`messages`:case`tools`:case`contents`:case`events`:case`checks`:case`changes`:case`reviews`:{let n=X(t);if(n.reader!==e)throw new k(`invalid`);return n}case`current`:return jn(t);case`currentChanges`:return Mn(t);case`checkObligations`:case`receipt`:return B(t);case`entity`:return Dn(t);case`graph`:return vn(t);case`snapshot`:return dt(t);case`detail`:case`search`:return J(t);case`export`:case`download`:return xn(t);case`chooseModel`:return Vn(t);case`preflight`:return rt(t);case`command`:return it(t);case`cancel`:return ot(t)}}function er(e,t){if(Xn.includes(e))return Y(t,gn);switch(e){case`current`:return Y(t,Ln);case`currentChanges`:return Y(t,Rn);case`activeRuns`:return Y(t,jt);case`models`:return Y(t,Un);case`chooseModel`:return Y(t,Bn);case`session`:return Y(t,tn);case`workspace`:return Y(t,nn);case`checkObligations`:return Y(t,En);case`entity`:return Y(t,kn);case`graph`:return Y(t,bn);case`snapshot`:return Y(t,Ut);case`detail`:return Y(t,qt);case`search`:return Y(t,Yt);case`preflight`:return Y(t,ct);case`command`:case`cancel`:return Y(t,Lt);case`receipt`:return zt(t);case`detach`:return Y(t,e=>{if(e!==null)throw new k(`invalid`);return null});default:throw new k(`invalid`)}}function tr(e){return[...Xn,`current`,`currentChanges`,`checkObligations`,`entity`,`graph`,`snapshot`,`detail`,`search`,`export`,`download`,`receipt`].includes(e)}function nr(e,t){let n=Jn[e];return t===null||Qn(e)?n:`${n}?request=${encodeURIComponent(U(t))}`}function rr(e,t){let n=$n(e,t),r=typeof n==`object`&&!!n&&Object.hasOwn(n,`navigation`),i=r?Jn[e]:nr(e,n);return Qn(e)||tr(e)&&(r||M(i)>O.headerBytes/4)?{path:Jn[e],method:`POST`,body:U(n)}:{path:i,method:`GET`}}function ir(e){U(e,O.viewerBytes);let t=F(Object.getOwnPropertyDescriptor(e,`kind`)?.value,[`snapshot`,`event`,`resync`]);return t===`snapshot`?{kind:t,snapshot:Ut(R(e,[`kind`,`snapshot`]).snapshot)}:t===`event`?{kind:t,event:Wt(R(e,[`kind`,`event`]).event)}:(R(e,[`kind`]),{kind:t})}var ar=class{options;attachment;csrf=null;fetcher;origin;constructor(e){this.options=e;let t=new URL(e.origin);if(t.origin!==e.origin||t.protocol!==`https:`&&!/^http:\/\/(?:127\.0\.0\.1|\[::1\]):[1-9][0-9]*$/.test(e.origin))throw new k(`invalid`);this.origin=e.origin,e.build&&=Pt(e.build),this.fetcher=e.fetch??globalThis.fetch.bind(globalThis)}headers(e){let t={"Cache-Control":`no-store`};if(this.options.build&&(t[`X-Cadence-Build`]=U(this.options.build)),this.attachment&&(t[`X-Cadence-Attachment`]=this.attachment),this.options.localCapability&&(t[`X-Cadence-Local`]=this.options.localCapability),e){if(!this.attachment||!this.options.localCapability&&!this.csrf)throw new k(`stale`);t[`Content-Type`]=`application/json`,this.csrf&&(t[`X-Cadence-CSRF`]=this.csrf)}return t}async request(e,t,n){let r=rr(e,$n(e,t)),i=r.method===`POST`,a=await this.fetcher(`${this.origin}${r.path}`,{method:r.method,headers:this.headers(i),credentials:`same-origin`,redirect:`error`,signal:this.options.requestTimeoutMs===void 0?n:AbortSignal.any([...n?[n]:[],AbortSignal.timeout(this.options.requestTimeoutMs)]),...i?{body:r.body}:{}}),o;try{e===`session`&&a.ok&&(o=B(a.headers.get(`x-cadence-attachment`)),this.attachment=o)}catch(e){throw await a.body?.cancel().catch(()=>{}),e}let s=await or(a,Zn(e)),c=Be(s);if(M(s)>Zn(e,c))throw new k(`oversize`);let l=er(e,c);if(e===`session`){let e=Y(l,tn);if(e.kind===`ok`){if(e.value.authority===`local`!=!!this.options.localCapability)throw new k(`forbidden`);this.attachment=o??B(a.headers.get(`x-cadence-attachment`)),this.csrf=e.value.csrf}}return l}session(e){return this.request(`session`,null,e)}current(e,t){return this.request(`current`,e,t)}currentChanges(e,t){return this.request(`currentChanges`,e,t)}activeRuns(e){return this.request(`activeRuns`,null,e)}models(e){return this.request(`models`,null,e)}chooseModel(e){return this.request(`chooseModel`,Vn(e))}workspace(e){return this.request(`workspace`,null,e)}checkObligations(e,t){return this.request(`checkObligations`,B(e),t)}entity(e,t){return this.request(`entity`,Dn(e),t)}tasks(e,t){return this.request(`tasks`,X(e),t)}runs(e,t){return this.request(`runs`,X(e),t)}messages(e,t){return this.request(`messages`,X(e),t)}tools(e,t){return this.request(`tools`,X(e),t)}contents(e,t){return this.request(`contents`,X(e),t)}events(e,t){return this.request(`events`,X(e),t)}checks(e,t){return this.request(`checks`,X(e),t)}changes(e,t){return this.request(`changes`,X(e),t)}reviews(e,t){return this.request(`reviews`,X(e),t)}graph(e,t){return this.request(`graph`,vn(e),t)}preflight(e){return this.request(`preflight`,rt(e))}command(e){return this.request(`command`,it(e))}cancel(e){return this.request(`cancel`,ot(e))}receipt(e,t){return this.request(`receipt`,B(e),t)}snapshot(e,t){return this.request(`snapshot`,e,t)}detail(e,t){return this.request(`detail`,e,t)}search(e,t){return this.request(`search`,e,t)}async detach(){let e=this.attachment;if(!e)return;let t=Y(await this.request(`detach`,null),e=>{if(e!==null)throw new k(`invalid`);return null});if(t.kind===`error`&&t.error.code!==`stale`&&t.error.code!==`unauthenticated`)throw new k(t.error.code);return this.attachment===e&&(this.attachment=void 0,this.csrf=null),t}async*export(e,t){let n=rr(`export`,xn(e)),r=await this.fetcher(`${this.origin}${n.path}`,{method:n.method,headers:this.headers(n.method===`POST`),...n.body===void 0?{}:{body:n.body},credentials:`same-origin`,redirect:`error`,signal:t});if(!r.ok||!r.body)throw await r.body?.cancel(),new k(`unavailable`);let i=r.body.getReader(),a=new TextDecoder(`utf-8`,{fatal:!0}),o=``;try{for(;;){let{value:e,done:n}=await i.read();if(t.aborted)throw new k(`unavailable`);for(let t=0;t<(n?1:e.byteLength);t+=O.chunkBytes){o+=n?a.decode():a.decode(e.subarray(t,t+O.chunkBytes),{stream:!0});let r=o.indexOf(`
|
|
2
|
-
`);for(;r!==-1;){let e=o.slice(0,r);o=o.slice(r+1),yield
|
|
3
|
-
`)}if(new TextEncoder().encode(o).length>O.controlBytes)throw new k(`oversize`)}if(n){if(o)throw new k(`invalid`);break}}}finally{await i.cancel().catch(()=>{}),i.releaseLock()}}subscribe(e,t,n){let r=dt(e);if(!this.attachment||!this.options.socket)throw new k(`unavailable`);let i=this.options.socket(`${this.origin.replace(/^http/,`ws`)}${Yn}?attachment=${this.attachment}`),a=!1,o=!1,s=Date.now(),c=Date.now(),l=()=>{if(!o){o=!0,a=!1,clearInterval(d);try{i.close()}catch{}u(`closed`)}},u=e=>{try{n(e)}catch{}},d=setInterval(()=>{if(a){Date.now()-s>=O.staleMs&&u(`stale`);try{Date.now()-c>=O.reconcileMs?(i.send(U({kind:`resync`,scope:r})),c=Date.now()):i.send(`{"kind":"ping"}`)}catch{l()}}},O.heartbeatMs);return i.addEventListener(`open`,()=>{if(!o){a=!0;try{i.send(U({kind:`subscribe`,scope:r}))}catch{l()}}}),i.addEventListener(`message`,e=>{if(!o)try{if(typeof e.data!=`string`)throw new k(`invalid`);let n=ir(Be(e.data,O.viewerBytes));s=Date.now(),u(`current`),t(n)}catch{l()}}),i.addEventListener(`error`,l),i.addEventListener(`close`,l),l}};async function or(e,t){if(!e.body)throw new k(`invalid`);let n=e.body.getReader(),r=new TextDecoder(`utf-8`,{fatal:!0}),i=0,a=``;try{for(;;){let{value:e,done:o}=await n.read();if(o)return a+r.decode();if(i+=e.byteLength,i>t)throw new k(`oversize`);a+=r.decode(e,{stream:!0})}}finally{await n.cancel().catch(()=>{}),n.releaseLock()}}var sr={sourceHash:`2e6e1d67b722c149c26cb3cc25853d04020e613762909dc68b9fee53c51969d6`,contractHash:`c2bb81519387005a71e88a64364dff47d5c39dab17812833ca898bc51055e59d`,buildId:`d53f729d3971bed4e08df91c7898ac1fbf1a255f61eb7c644474971eab4a6195`};function cr(){let e=new ar({origin:window.location.origin,...sr?{build:{kind:`browser`,...sr}}:{},socket:e=>new WebSocket(e)});return{client:new Kn(e),transport:e}}async function lr(e,t,n,r){let i=Ln(e);if(i.context.status!==`available`||!i.context.version.task||!i.readablePlan?.editable||i.savedGraph.status===`unavailable`)throw new k(`unavailable`);let a=i.context.version,o=a.task;if(!o)throw new k(`stale`);let s=j(t,32768),c=nt({kind:`save-plan`,taskId:o.id,plan:s,graph:{schema:`cadence-graph/2`,taskId:o.id,taskKind:o.kind,taskRevision:o.revision+1,revision:(o.graphRevision??0)+1,planRevision:i.savedGraph.status===`saved`?i.savedGraph.planRevision+1:1,plan:{recordId:r.uuid(),version:i.savedGraph.status===`saved`?i.savedGraph.planRevision+1:1,field:`plan`,bytes:M(s),sha256:`0`.repeat(64)},assignments:n}});if(c.kind!==`save-plan`)throw new k(`invalid`);for(let e of c.graph.assignments){let t=i.roles.find(t=>t.role===Ye(e.purpose));if(!t||U(t)!==U(e.role)||U(a.model)!==U(e.model))throw new k(`stale`)}c.graph.plan.sha256=await r.sha256(new TextEncoder().encode(s));let l=nt(c);if(l.kind!==`save-plan`)throw new k(`invalid`);return l}var ur=`Current plan metadata unavailable. Observe again; historical text is not action authority.`;function dr(e,t){let n=async n=>{let r=await e.current({storeId:t,taskId:n.task?.id??null});if(r.kind===`error`)throw new k(r.error.code);if(r.value.context.status!==`available`||U(r.value.context.version)!==U(n))throw new k(`stale`);return r.value},r=e=>({kind:`error`,error:Le(e instanceof k?e.code:`unavailable`)});return{async read(t,i){try{let r=await n(t);if(!r.readablePlan||r.savedGraph.status===`unavailable`)throw new k(`unavailable`);let a=null;if(r.savedGraph.status===`saved`){let o=r.savedGraph.request;if(i&&(i.storeId!==o.storeId||U(i.graph)!==U(o.graph)||U(i.scope)!==U(o.scope)))throw new k(`stale`);let s=await e.graph(i??o);if(s.kind===`error`)return s;if(await n(t),`kind`in s.value)return{kind:`ok`,value:{...s.value,context:t}};a=s.value.graph}else if(i)throw new k(`stale`);return{kind:`ok`,value:{context:t,roles:r.roles,savedGraph:a,readablePlan:r.readablePlan.text,editable:r.readablePlan.editable}}}catch(e){return r(e)}},async saveAction(e,t){let i=structuredClone(t);try{let t=await lr(await n(e),i.readablePlan,i.assignments,{uuid:()=>crypto.randomUUID(),sha256:async e=>Array.from(new Uint8Array(await crypto.subtle.digest(`SHA-256`,Uint8Array.from(e))),e=>e.toString(16).padStart(2,`0`)).join(``)});return await n(e),{kind:`ok`,value:t}}catch(e){return r(e)}}}}function fr(e,t){if(e.commandId!==t.commandId)return e;let n=[e.receipt,e.lookup?.status===`found`?e.lookup.receipt:void 0,t.receipt,t.lookup?.status===`found`?t.lookup.receipt:void 0],r,i=!1;for(let t of n)t&&t.commandId===e.commandId&&(r&&(r.operationId!==t.operationId||r.runId!==t.runId||r.created!==null&&r.created.taskId!==t.created?.taskId)||r&&Re(t.committedSeq,r.committedSeq)>0&&(r.created?.state===`published`&&t.created?.state!==`published`||r.admission===`accepted`&&t.admission!==`accepted`||r.execution!==null&&t.execution!==r.execution||r.settlement!==null&&U(t.settlement)!==U(r.settlement))?i=!0:(!r||Re(t.committedSeq,r.committedSeq)>0||U(r)===U(t))&&(r=t));return{commandId:e.commandId,receipt:r,lookup:r?{status:`found`,receipt:r}:t.lookup??e.lookup,error:i?`Conflicting receipt observation refused; prior committed facts preserved.`:r?void 0:t.error??e.error}}var pr=e=>e===`unauthenticated`||e===`forbidden`,mr=class{api;serial=Promise.resolve();version=0;stopCurrent;pollCurrent;constructor(e){this.api=e}refresh(e=!1){this.pollCurrent?.(e)}observe(e,t){this.stopCurrent?.();let n=++this.version,r=!1,i,a,o,s=new AbortController,c=new qn,l=0,u=0,d=!1,f=!1,p=0,m=!1,h=!1,g={actions:!1,transportStatus:`closed`,attachmentVersion:0},_=()=>!r&&n===this.version,v=()=>{_()&&t({...g,observation:c.state})},y=()=>{r||(r=!0,s.abort(),clearInterval(a),clearTimeout(o),u++,i?.(),n===this.version&&(this.pollCurrent=void 0))};this.stopCurrent=y;let b=e=>{this.serial=this.serial.then(e).catch(()=>{_()&&(m=!0,s.abort(),clearInterval(a),clearTimeout(o),u++,i?.(),g.error=`Observation unavailable or detach unconfirmed; explicit re-entry required.`,g.actions=!1,g.transportStatus=`closed`,g.workspace=void 0,c=new qn,v())})},x=async()=>{await this.api.transport.detach()},S=async(t=!1)=>{if(!_()||!f||d||m)return;d=!0,g.actions=!1;let n=!1;v(),p=Date.now();let r=s.signal;try{let i=async()=>{let e=await this.api.client.session(r);return!_()||r.aborted?!1:e.kind===`error`?(g.actions=!1,g.error=e.error.code,pr(e.error.code)&&C(),!1):(w(e.value),!0)};if(t&&!await i())return;e||(g.transportStatus=`current`);let a=await this.api.client.activeRuns(r);if(!_()||r.aborted)return;if(a.kind===`ok`)g.activeRuns=a.value;else if(pr(a.error.code)){C();return}else g.activeRuns=void 0;v();let o=await this.api.client.workspace(r);if(!_()||r.aborted)return;if(o.kind===`error`){g.error=o.error.code,pr(o.error.code)&&C();return}if(!t&&U(g.workspace?.models??[])!==U(o.value.models)&&!await i())return;if(g.workspace=o.value,e){let t=c.beginSnapshot(),i=await this.api.client.snapshot(e,r);if(!_()||r.aborted)return;if(i.kind===`error`)g.error=i.error.code,pr(i.error.code)&&C();else{let e=c.install(i.value,Date.now(),t);e!==void 0&&(l=e),g.error=void 0,n=!0}}else g.error=void 0,n=!0}catch{_()&&(g.error=`Observation unavailable.`,g.actions=!1,g.transportStatus=`stale`)}finally{d=!1,g.actions=n&&h,v()}},C=()=>{m=!0,g.actions=!1,g.transportStatus=`closed`,g.error=`Access revoked; explicit token re-entry required.`,g.workspace=void 0,g.activeRuns=void 0,c=new qn,s.abort(),clearInterval(a),clearTimeout(o),u++,i?.(),b(x),v()},w=e=>{let t=sr?{kind:`browser`,...sr}:null;g.compatible=It(e.build,t),g.cancelCompatible=It(e.build,t,!0),h=e.capabilities.actions&&g.compatible},T=async()=>{if(f=!1,await x(),!_()||m)return;let t=await this.api.client.session();if(!_()||m){await x();return}if(t.kind===`error`){m=!0,g.error=`${t.error.code}; explicit re-entry required.`,g.workspace=void 0,c=new qn,g.actions=!1,v();return}if(f=!0,s=new AbortController,c=new qn,g={actions:t.value.capabilities.actions,transportStatus:`closed`,attachmentVersion:g.attachmentVersion+1},w(t.value),v(),await S(),!_()||m||!e)return;let n=++u;i=this.api.transport.subscribe(e,e=>{if(_()&&!m&&n===u){if(e.kind===`snapshot`){let t=c.install(e.snapshot,Date.now(),c.beginSnapshot());t!==void 0&&(l=t)}else e.kind===`event`?c.receive(e.event,l,Date.now())===`resync`&&S():S();v()}},e=>{_()&&!m&&n===u&&(g.transportStatus=e,e===`closed`&&(f=!1,g.actions=!1,g.attachmentVersion++,s.abort(),u++,o=setTimeout(()=>b(T),1e3)),v())})};return b(T),this.pollCurrent=e=>{S(e)},a=setInterval(()=>{_()&&!m&&(c.tick(Date.now()),v(),(Date.now()-p>=3e4||e&&c.needsPoll(Date.now()))&&S())},1e3),()=>{_()&&(y(),b(x))}}};function hr(e,t,n){let r=(0,f.useMemo)(()=>new mr(e),[e]),[i,a]=(0,f.useState)({actions:!1,transportStatus:`closed`,attachmentVersion:0}),o=t?.kind,s=t?.id;return(0,f.useEffect)(()=>{if(a({actions:!1,transportStatus:`closed`,attachmentVersion:0}),n)return r.observe(o&&s?{kind:o,id:s}:null,a)},[r,o,s,n]),{...i,refresh:(e=!1)=>r.refresh(e)}}var gr=class{generation=0;identity=``;select(e){e!==this.identity&&(this.identity=e,this.depart())}depart(){this.generation++}ticket(){return this.generation}current(e){return e===this.generation}},_r={"Cadence task workspace":`Cadence 任务工作区`,"Presentation unavailable":`界面无法显示`,"No execution result is inferred. Reconnect to observe the owner; accepted work continues.":`不会推断任何执行结果。重新连接以观察所有者服务;已接受的工作会继续进行。`,"Reload observation":`重新加载观察`,Tasks:`任务`,"Recorded views":`已记录视图`,messages:`消息`,tools:`工具`,context:`上下文`,timeline:`时间线`,runs:`运行`,outcomes:`结果`,"Export selected scope":`导出所选范围`,"Copy token-free link":`复制不含令牌的链接`,"Link copy unavailable.":`无法复制链接。`,"Observe current state":`重新观察当前状态`,"Choose owner model":`选择所有者模型`,Model:`模型`,"Return — work continues":`返回——工作继续`,"Return — accepted work continues":`返回——已接受的工作会继续`,Return:`返回`,"Plan / review":`计划 / 审阅`,Plan:`计划`,"Execution and cancellation":`执行与取消`,"Open active task":`打开活动任务`,"Cancel run — request stop":`取消运行——请求停止`,"{message}.":`{message}。`,"The service no longer matches the sources it loaded, for example after Pi's {file} changed; restart it to reload them: {restart} (or {stop} then {start}).":`服务已与其加载的来源不一致(例如 Pi 的 {file} 已更改);请重启服务以重新加载:{restart}(或先 {stop} 再 {start})。`,"Explicit service guidance: {status} / {start}. No service is started by this page.":`显式服务操作:{status} / {start}。本页面不会启动任何服务。`,"Close drawer":`关闭抽屉`,"Task navigation drawer":`任务导航抽屉`,"Plan and review drawer":`计划与审阅抽屉`,"Selected {kind}:":`已选{kind}:`,"· snapshot {seq}.":`· 快照 {seq}。`,"Pages and old outcomes are historical observations, not renewed consent.":`分页内容和旧结果是历史观察,不代表重新授权。`,"Open a task or create one explicitly":`打开一个任务,或显式创建一个`,"Plans, children, checks and human review share one service owner. No chat or discovery activates execution.":`计划、子运行、检查和人工审阅共用一个服务所有者。聊天或浏览不会触发执行。`,"Create task":`创建任务`,"No owner run projection in this snapshot.":`此快照中没有所有者运行视图。`,"No snapshot observed yet; absence is not proof of settlement.":`尚未观察到快照;没有记录不代表已结束。`,"Connection freshness is not execution outcome.":`连接是否最新不代表执行结果。`," · transport {status}":` · 传输:{status}`,"{count} active run":`{count} 个活动运行`,"{count} active runs":`{count} 个活动运行`,"No active runs":`没有活动运行`,"Active roster unavailable; absence is not proof of settlement.":`活动运行列表不可用;没有记录不代表已结束。`,"unbuilt source":`未构建的源码`,"Local browser build: {build}.":`本地浏览器构建:{build}。`,"Shared compatibility: {state}.":`共享兼容性:{state}。`,compatible:`兼容`,"unavailable / mismatch — reload built assets; normal actions disabled":`不可用 / 不匹配——请重新加载构建产物;常规操作已禁用`,"Service unavailable":`服务不可用`,"Task snapshot not observed yet":`尚未观察到任务快照`,"No task selected":`未选择任务`,"Resize left pane":`调整左侧面板宽度`,"Resize right pane":`调整右侧面板宽度`,Detached:`已断开`,"Accepted service work continues. No Cancel was requested.":`已接受的服务工作会继续进行。没有请求取消。`,"Observe command after reconnect:":`重新连接后观察命令:`,"Reconnect as a viewer":`以查看者身份重新连接`,"Current action context unavailable; observe again.":`当前操作上下文不可用;请重新观察。`,"Preflight refused: {code}":`预检被拒绝:{code}`,"Preflight unavailable. No automatic retry.":`预检不可用。不会自动重试。`,"Stop requested; settlement is not yet confirmed.":`已请求停止;尚未确认结束。`,"{code}; cancellation effect {effect}. Observe exact receipt.":`{code};取消效果 {effect}。请观察确切回执。`,"Cancellation effect uncertain. Observe exact receipt.":`取消效果不确定。请观察确切回执。`,"Observation unavailable or detach unconfirmed; explicit re-entry required.":`观察不可用或断开未确认;需要显式重新进入。`,"Observation unavailable.":`观察不可用。`,"Access revoked; explicit token re-entry required.":`访问已被撤销;需要显式重新输入令牌。`,Kind:`类型`,Code:`代码`,"Readonly research":`只读调研`,"Readonly diagnosis":`只读诊断`,Goal:`目标`,"Preview Create (does not Start)":`预览创建(不会启动)`,"Close dialog — no cancellation of accepted work":`关闭对话框——不会取消已接受的工作`,"Close — accepted work is not cancelled":`关闭——不会取消已接受的工作`,"Admission pending/unknown — observe this exact receipt.":`准入待定/未知——请观察这个确切回执。`,"{code}; effect {effect}":`{code};效果 {effect}`,"Uncertain; do not repeat the action.":`结果不确定;请勿重复此操作。`,"Confirm {action}":`确认{action}`,"Access is not consent. This confirmation applies only to the displayed context, once.":`访问权限不等于同意。此确认仅对所显示的上下文生效一次。`,Checkout:`工作副本`,"Working directory":`工作目录`,"Model / API / thinking":`模型 / API / 思考`,"Check environment":`检查环境`,"Service launch environment policy, generation {generation}; no browser environment overlays.":`服务启动环境策略,第 {generation} 代;不叠加浏览器环境。`,Observation:`观察`,"Complete within bounded scope":`在限定范围内完整`,"Incomplete bounded coverage":`限定范围覆盖不完整`,Expires:`过期时间`,"Exact parent check":`确切的父级检查`,"{name}; timeout {timeout} ms; cwd above.":`{name};超时 {timeout} 毫秒;工作目录见上。`,"Readonly proposal only. It will not save itself or dispatch editing.":`仅为只读提案。它不会自行保存,也不会分派编辑。`,"Issues: {issues}":`问题:{issues}`,"Context changed or confirmation expired. Close, observe again and request a new preview.":`上下文已变化或确认已过期。请关闭、重新观察并请求新的预览。`,"Back — no new effect":`返回——不产生新效果`,"Create {kind} task":`创建{kind}任务`,"No Start is included.":`不包含启动。`,"Expected: {output}":`预期产出:{output}`,"Exact proposed graph and identities (not yet committed)":`确切的提议任务图与标识(尚未提交)`,"Exact human review targets":`确切的人工审阅对象`,"Human review only; failures, native exit, stale and not-run checks remain unchanged. Issues acknowledgment: {accepted}.":`仅为人工审阅;失败、原生退出、过期和未运行的检查保持不变。问题确认:{accepted}。`,"Explicit owner-wide choice, only while quiescent. This does not resolve credentials, probe a provider, save a plan or Start work.":`显式的所有者级选择,仅在空闲时可用。它不会解析凭据、探测提供方、保存计划或启动工作。`,"Current: {model}":`当前:{model}`,"No model selected":`未选择模型`,"Exact model / API / thinking":`确切的模型 / API / 思考级别`,"Select explicitly":`请显式选择`,"Catalog capacity exceeded; no partial model list is selectable.":`模型目录超出容量;不能从不完整的列表中选择。`,"{error}. No automatic replacement or retry.":`{error}。不会自动替换或重试。`,"{count} model withheld: its provider or model ID contains a credential value (such as an apiKey equal to the provider name) or control characters. Give each credential a value that matches no provider or model ID; restart the service after editing models.json.":`{count} 个模型未列出:其提供方或模型 ID 包含某个凭据值(例如与提供方名称相同的 apiKey)或控制字符。请让每个凭据值都不与任何提供方或模型 ID 重合;修改 models.json 后需重启服务。`,"{count} models withheld: their provider or model IDs contain a credential value (such as an apiKey equal to the provider name) or control characters. Give each credential a value that matches no provider or model ID; restart the service after editing models.json.":`{count} 个模型未列出:其提供方或模型 ID 包含某个凭据值(例如与提供方名称相同的 apiKey)或控制字符。请让每个凭据值都不与任何提供方或模型 ID 重合;修改 models.json 后需重启服务。`,"Model catalog unavailable ({code}); no model is selectable. No automatic retry.":`模型目录不可用({code});无法选择任何模型。不会自动重试。`,"Choice response unconfirmed; observe catalog before another explicit choice.":`选择的响应未确认;请先观察目录再进行下一次显式选择。`,"Confirm owner model choice":`确认所有者模型选择`,"Command receipt":`命令回执`,Admission:`准入`,Execution:`执行`,"not settled":`未结束`,Publication:`发布`,Run:`运行`,"metadata action":`元数据操作`,"{status}. This observation does not authorize replay.":`{status}。此观察不授权重放。`,"Observe exact receipt":`观察确切回执`,"Conflicting receipt observation refused; prior committed facts preserved.":`冲突的回执观察已被拒绝;之前提交的事实已保留。`,"Retained content fields":`保留的内容字段`,"Showing matches for entity {entity} on this page only. Continue paging for other fields/versions.":`仅显示本页中实体 {entity} 的匹配项。继续翻页可查看其他字段/版本。`,"Omitted source block:":`已省略的源块:`,"{bytes} retained bytes":`保留 {bytes} 字节`,"Inspect complete retained field":`查看完整的保留字段`,"Recording: {observed}; source: {source};":`记录:{observed};来源:{source};`,redacted:`已脱敏`,"no reported redaction":`未报告脱敏`,"; omitted: {omissions}":`;已省略:{omissions}`,". Not a guarantee of complete original source or universal secret detection.":`。不保证原始来源完整,也不保证能检测出所有机密。`,"Reading all retained field pages…":`正在读取所有保留字段页…`,"Copied all retained field bytes (source omissions still apply).":`已复制全部保留字段字节(来源省略仍然适用)。`,"Copied retained field bytes; recording is incomplete. No complete-source claim.":`已复制保留字段字节;记录不完整。不声称来源完整。`,"Clipboard unavailable.":`剪贴板不可用。`,"Full-field copy refused/incomplete.":`完整字段复制被拒绝/不完整。`,"Retained field":`保留字段`,"snapshot {seq}":`快照 {seq}`,"Exact hit bytes [{start}, {end}); only this immutable field is highlighted.":`确切命中字节 [{start}, {end});仅高亮这个不可变字段。`,"Markdown page":`Markdown 页`,"Raw page":`原始页`,"Copy full retained field":`复制完整保留字段`,"Copy canceled; execution unchanged.":`复制已取消;执行不受影响。`,"Cancel copy":`取消复制`,"Detail refused: {error}":`详情被拒绝:{error}`,"Reading…":`读取中…`,"Validation in progress. The retained field is not empty.":`正在验证。该保留字段并非为空。`,"Bytes {start}–{end} of {total}.":`第 {start}–{end} 字节,共 {total} 字节。`,"More retained data available.":`还有更多保留数据。`,"End of field.":`字段结束。`,Previous:`上一页`,"Continue validation":`继续验证`,"Next field page":`下一字段页`,"Read unavailable.":`读取不可用。`,"Exact entity metadata":`确切的实体元数据`,"Reading exact entity version…":`正在读取确切的实体版本…`,"Entity refused: {error}":`实体被拒绝:{error}`,"Entity validation in progress, not missing.":`实体正在验证,并非缺失。`,"Continue exact entity validation":`继续确切的实体验证`,"Exact stored owner and associations":`确切存储的所有者与关联`,"Export retained history":`导出保留历史`,"Selected {kind}: {id} · snapshot {seq}":`已选{kind}:{id} · 快照 {seq}`,Format:`格式`,"NDJSON public archive":`NDJSON 公开归档`,"Readable Markdown with footer metadata":`带页脚元数据的可读 Markdown`,"Includes retained context, messages/tools, graph, lifecycle, changes, checks, human review and coverage beyond loaded pages. Redactions and source omissions remain.":`包括已加载页之外的保留上下文、消息/工具、任务图、生命周期、变更、检查、人工审阅和覆盖范围。脱敏和来源省略仍然保留。`,"A native browser download request cannot establish completion. Inspect the original EOF and completion trailer/counts/digest in the downloaded artifact; missing footer means incomplete. Revoked access may terminate without a trailer.":`浏览器原生下载请求无法证明下载完成。请检查下载文件中的原始 EOF 以及完成尾部/计数/摘要;缺少页脚即表示不完整。访问被撤销时可能在没有尾部的情况下终止。`,"Download requested — completion not verified by this browser UI.":`已请求下载——此浏览器界面未验证是否完成。`,"Download unavailable; no archive claimed complete.":`下载不可用;不声称任何归档完整。`,"Request selected-scope download":`请求下载所选范围`,"Search retained history":`搜索保留历史`,"Case-sensitive literal query":`区分大小写的字面查询`,"Case-sensitive literal UTF-8 search. Scope {kind} {id}; snapshot {seq}. No regex, provider request or history repair.":`区分大小写的 UTF-8 字面搜索。范围:{kind} {id};快照 {seq}。不使用正则,不请求提供方,也不修复历史。`,"Searching bounded retained range…":`正在搜索限定的保留范围…`,"Search refused: {error}":`搜索被拒绝:{error}`,"Enter a query to search this selected scope.":`输入查询以搜索所选范围。`,"Matches on this page: {count}":`本页匹配:{count}`,"bytes {start}–{end}":`字节 {start}–{end}`,"Continue same snapshot search":`在同一快照中继续搜索`,"↑↓ Navigate · Enter Open exact hit · Escape Close. Reopening never resumes execution.":`↑↓ 移动 · Enter 打开确切命中 · Escape 关闭。重新打开不会恢复执行。`,"Search unavailable or invalid; no automatic retry.":`搜索不可用或无效;不会自动重试。`,"Query must be 1–1024 UTF-8 bytes; it was not clipped.":`查询必须为 1–1024 个 UTF-8 字节;未做截断。`,"No hits in this bounded window; search is not finished.":`此限定窗口中没有命中;搜索尚未完成。`,"No hits in the final retained window. Coverage limits above still apply.":`最后的保留窗口中没有命中。上方的覆盖范围限制仍然适用。`,"Immutable admitted graph":`不可变的已准入任务图`,"Graph refused: {error}":`任务图被拒绝:{error}`,"Reading graph…":`正在读取任务图…`,"Graph validation in progress; not an empty graph.":`任务图正在验证;并非空图。`,"Continue graph validation":`继续验证任务图`,"Find on displayed field page":`在当前字段页中查找`," (first 1000 visual highlights)":`(前 1000 处可视高亮)`,"; not whole-history search":`;不是全历史搜索`,"Previous match":`上一个匹配`,"Next match":`下一个匹配`,"Read refused: {error}. Retained state has not been repaired.":`读取被拒绝:{error}。保留状态未被修复。`,"Reading bounded history page…":`正在读取限定的历史页…`,"Snapshot selected":`已选择快照`,"Validating retained history":`正在验证保留历史`,"; continue this exact read. No data page yet.":`;请继续这次确切读取。尚无数据页。`,"Previous page":`上一页`,"Next page":`下一页`,"Observe a new snapshot":`观察新快照`,"End of this retained snapshot (incomplete).":`此保留快照已结束(不完整)。`,"End of this retained snapshot.":`此保留快照已结束。`,"Open retained episode/child details":`打开保留的执行轮次/子运行详情`,"Inspect admitted graph and plan":`查看已准入的任务图与计划`,"Search all retained pages in selected scope":`搜索所选范围内的所有保留页`,"Select a task to inspect plans, checks, changes and review.":`选择一个任务以查看计划、检查、变更和审阅。`,Inspector:`检查器`,plan:`计划`,checks:`检查`,changes:`变更`,review:`审阅`,"Owner metadata is stale.":`所有者元数据已过期。`,"Owner metadata unavailable.":`所有者元数据不可用。`,"Plan proposal unavailable.":`计划提案不可用。`,"Current plan metadata unavailable. Observe again; historical text is not action authority.":`当前计划元数据不可用。请重新观察;历史文本不能作为操作依据。`,"Saved graph proof in progress.":`已保存任务图的证明正在进行。`,"Continue saved graph read":`继续读取已保存的任务图`,"Load observed saved plan into local draft":`将观察到的已保存计划载入本地草稿`,"Current control context unavailable. Historical data is not action authority.":`当前控制上下文不可用。历史数据不能作为操作依据。`,"Captured historical observations":`已捕获的历史观察`,"Human review":`人工审阅`,"Done records human acknowledgment, not execution success or certification. It cannot restart a blocked episode.":`“完成”记录的是人工确认,而非执行成功或认证。它不能重新启动被阻塞的执行轮次。`,"Episode to review":`要审阅的执行轮次`,"Select an observed episode":`选择一个已观察的执行轮次`,"I acknowledge current unresolved issues if present; original results will not be rewritten.":`我确认当前存在的未解决问题;原始结果不会被改写。`,"Preview human review / Done":`预览人工审阅 / 完成`,"Observe current obligations in Checks before requesting review.":`请求审阅前,请先在“检查”中观察当前检查项。`,"Readable plan & decomposition":`可读计划与分解`,"{count} required assignments":`{count} 个必需子任务`,"Preview readonly Generate proposal":`预览只读生成提案`,"Preview Save plan":`预览保存计划`,"Preview Start saved graph":`预览启动已保存的任务图`,"Draft changes never execute. Start uses the saved graph shown in its fresh preview, not unsaved text. Generated proposals never save or start themselves.":`草稿修改永远不会执行。启动使用其最新预览中显示的已保存任务图,而不是未保存的文本。生成的提案不会自行保存或启动。`,"Saved assignments name an old model selection. Reading does not rebind them.":`已保存的子任务指定了旧的模型选择。读取不会重新绑定它们。`,"Explicitly rebind draft to current model (requires new Save)":`将草稿显式重新绑定到当前模型(需要重新保存)`,"Readable plan":`可读计划`,"Read rendered plan":`阅读渲染后的计划`,"checkout writer":`工作副本写入者`,readonly:`只读`,Edit:`编辑`,"Remove draft assignment":`移除草稿子任务`,Purpose:`用途`,Instructions:`指令`,"Expected output":`预期产出`,"Current-episode dependencies (whole final text by default)":`本轮依赖(默认使用完整最终文本)`,"Require complete observation":`要求完整观察`,"Selection: {range}":`选择范围:{range}`,"reviewed UTF-8 bytes {start}–{end}":`已审阅的 UTF-8 字节 {start}–{end}`,"whole final text; no silent clipping":`完整最终文本;不会静默截断`,"Reviewed edge JSON (range/null and exact historical identity)":`已审阅的依赖边 JSON(范围/null 与确切历史标识)`,"Remove edge":`移除依赖边`,"Explicit historical/advisory edge JSON":`显式的历史/参考依赖边 JSON`,"Exact committed run/child/result/version plus range and coverage requirement":`确切的已提交运行/子运行/结果/版本,以及范围和覆盖要求`,"Add reviewed historical edge":`添加已审阅的历史依赖边`,"Discard inline edits":`放弃行内编辑`,"Apply to local draft":`应用到本地草稿`,"Role {role}":`角色 {role}`,"Add assignment":`添加子任务`,"Remove dependent edges explicitly before deleting this assignment.":`删除此子任务前,请先显式移除依赖它的边。`,"Invalid dependency. Original edge retained; review before Save.":`依赖无效。已保留原依赖边;请在保存前审阅。`,"Historical edge requires actual committed identity; no guessed result reference.":`历史依赖边需要真实的已提交标识;不接受猜测的结果引用。`,View:`视图`,"Raw text / lines":`原始文本 / 行`,"Safe Markdown":`安全 Markdown`,"Observed diff":`观察到的 diff`,"Wrap: on":`换行:开`,"Wrap: off":`换行:关`,"Zoom +":`放大 +`,"Zoom −":`缩小 −`,"Captured page only, not a current filesystem read. Line numbers are page-local. Full retained paging and copy are available above.":`仅为捕获的页面,不是对当前文件系统的读取。行号仅在本页内有效。上方提供完整的保留分页和复制。`,"Page headings":`页面标题`,"Select page line {line}":`选择页内第 {line} 行`,"Selected page lines {start}–{end}":`已选页内第 {start}–{end} 行`,"Clear selection":`清除选择`,"Current configured obligations":`当前已配置的检查项`,"Observe obligations":`观察检查项`,"Obligations unavailable: {error}":`检查项不可用:{error}`,"Obligations unavailable.":`检查项不可用。`,"No configured obligations. This is not passing check coverage.":`没有已配置的检查项。这不代表检查已通过。`,"Timeout {timeout} ms. Native outcome and freshness remain separate.":`超时 {timeout} 毫秒。原生结果与是否最新分别记录。`,"Preview exact configured check":`预览确切的已配置检查`,"Browser checks are configured selections only. Native-local manual commands are not a browser shell endpoint.":`浏览器中只能运行已配置的检查。本地原生手动命令不是浏览器 shell 端点。`,"Current checkout changes":`当前工作副本变更`,"Current checkout changes (not a captured historical diff)":`当前工作副本变更(不是捕获的历史 diff)`,"Observe current changes":`观察当前变更`,"Current observation unavailable":`当前观察不可用`,"Fingerprint {identity} · {coverage} · includes pre-existing dirt; not attribution.":`指纹 {identity} · {coverage} · 包含既有的未提交修改;不代表归属。`,"complete within bounded scope":`在限定范围内完整`,"incomplete coverage":`覆盖不完整`,"Captured observations include pre-existing dirt. They do not attribute every change to Cadence; bounded fingerprints are not filesystem snapshots.":`捕获的观察包含既有的未提交修改。它们不会把每处变更都归于 Cadence;限定指纹不是文件系统快照。`,"committed #{seq}":`已提交 #{seq}`,"Inspect full retained {field}":`查看完整保留的{field}`,"Copy displayed text":`复制显示的文本`,"Copy unavailable":`无法复制`,"{state} message record, not execution outcome":`{state}消息记录,不代表执行结果`,Collapse:`收起`,"Inspect message":`查看消息`,"Child {child} · message {message} · version {version}":`子运行 {child} · 消息 {message} · 版本 {version}`,"Result call: {call}. Kept visible independently of the tool card.":`结果对应调用:{call}。独立于工具卡片保持可见。`,"unassociated / orphan":`未关联 / 孤立`,"No finalized text field in this snapshot. Inspect retained partial/final blocks and omission metadata below.":`此快照中没有最终文本字段。请在下方查看保留的部分/最终块以及省略元数据。`,"All message blocks, source limits and tool associations":`全部消息块、来源限制与工具关联`,"Latest on loaded page":`跳到已加载页的最新处`,"No message records on this page; more history remains.":`本页没有消息记录;还有更多历史。`,"No message records on this page.":`本页没有消息记录。`,"SDK tool error observed":`观察到 SDK 工具错误`,"SDK tool end observed":`观察到 SDK 工具结束`,"Start observed; end not observed in this snapshot":`已观察到开始;此快照中未观察到结束`,"No start observed":`未观察到开始`,"Inspect recorded tool call":`查看已记录的工具调用`,"Child {child} · call {call} · v{version}":`子运行 {child} · 调用 {call} · v{version}`,"SDK tool observations are not native process launch/close or passing parent checks.":`SDK 工具观察不代表原生进程的启动/关闭,也不代表父级检查已通过。`,"Source ID":`来源 ID`,unavailable:`不可用`,Declaration:`声明`,"No declaration recorded; orphan result remains accessible":`未记录声明;孤立结果仍可访问`,"Recorded tool end (not parsed from output)":`已记录的工具结束(非从输出解析)`,"No end fact in this snapshot.":`此快照中没有结束事实。`,"historical projection":`历史视图`,"owner projection":`所有者视图`,Lifecycle:`生命周期`,unsettled:`未结束`,"Wait/block reason":`等待/阻塞原因`,"none reported":`未报告`,"Summary publication":`摘要发布`,"Native / recording / parent settlement facts (independent of human review)":`原生 / 记录 / 父级结束事实(独立于人工审阅)`,"No settlement recorded":`未记录结束信息`,"New task":`新建任务`,"No retained task on this page.":`本页没有保留的任务。`,"One checkout owner. Open/history never executes.":`每个工作副本一个所有者。打开或查看历史永远不会执行。`,"Active and recent episodes":`活动与近期执行轮次`,"Runs and assignments":`运行与子任务`,"Toggle assignments":`展开/收起子任务`,"{count} descendants":`{count} 个后代`," / failed child":` / 有失败的子运行`," / unknown child":` / 有未知的子运行`,"No active or recent episode observed.":`未观察到活动或近期的执行轮次。`,"All retained episodes for task":`此任务的全部保留执行轮次`,"Committed order, not wall time. Replay advances visualization only. Raw observations retain clock/sequence provenance; unknown timing is not reconstructed.":`按提交顺序排列,而非真实时间。回放只推进可视化。原始观察保留时钟/序号来源;未知的时间不会被重建。`,"Bundled timeline unavailable; retained events remain accessible, no CDN fallback.":`内置时间线不可用;保留的事件仍可访问,不会回退到 CDN。`,Owner:`所有者`,owner:`所有者`,input:`输入`,model:`模型`,"Committed #{seq}; {who}":`已提交 #{seq};{who}`,"recorded fact":`已记录事实`,"Worker-local monotonic observations ({child}): {first}–{last} ms; not aligned to other workers.":`工作进程本地单调时钟观察({child}):{first}–{last} 毫秒;未与其他工作进程对齐。`,"Owner observation ({epoch}): {ms} ms; clock origin not established by this reader.":`所有者观察({epoch}):{ms} 毫秒;此读取器未确定时钟起点。`,"{scope} — loaded committed page":`{scope}——已加载的提交页`,"Committed sequence {seq}; page ordinal {ordinal}. Timing shown in raw facts only; clocks may not be comparable.":`提交序号 {seq};页内序数 {ordinal}。时间只在原始事实中显示;各时钟可能无法比较。`,task:`任务`,run:`运行`,child:`子运行`,workspace:`工作区`,message:`消息`,tool:`工具`,"final-text":`最终文本`,"tool-args":`工具参数`,"tool-update":`工具更新`,"tool-result":`工具结果`,check:`检查`,user:`用户`,assistant:`助手`,partial:`部分`,final:`最终`,observed:`已观察`,create:`创建`,"generate-plan":`生成计划`,"save-plan":`保存计划`,start:`启动`,research:`调研`,diagnosis:`诊断`,edit:`编辑`,current:`最新`,stale:`已过期`,resync:`重新同步中`,closed:`已关闭`,"accepted-unallocated":`已接受未分配`,active:`活动中`,draining:`排空中`,queued:`排队中`,preparing:`准备中`,running:`运行中`,closing:`收尾中`,settled:`已结束`,completed:`已完成`,failed:`失败`,canceled:`已取消`,timeout:`超时`,unknown:`未知`,blocked:`已阻塞`,pending:`待定`,published:`已发布`,conflict:`冲突`,uncertain:`不确定`,accepted:`已接受`,refused:`已拒绝`,absent:`不存在`,inconclusive:`无定论`,"not-run":`未运行`,passed:`已通过`,complete:`完整`,incomplete:`不完整`,limited:`受限`,binary:`二进制`,"hidden-thinking":`隐藏的思考`,"source-limit":`来源限制`,"capture-limit":`捕获限制`,gap:`缺口`,unsupported:`不支持`,capacity:`容量`,dependency:`依赖`,writer:`写入者`,"parent-stopped":`父级已停止`,"wait-expired":`等待超时`,"handoff-overflow":`交接溢出`,"stale-dependency":`依赖已过期`,quarantine:`隔离`,"incomplete-observation":`观察不完整`,"unrun-checks":`有未运行的检查`,"stale-checks":`有过期的检查`,"failed-checks":`有失败的检查`,"partial-results":`结果不完整`,"recording-incomplete":`记录不完整`,"legacy-context":`旧版上下文`},Q=r(),vr=`cadence-locale`,yr=new Map(Object.entries(_r));function br(e,t,n){let r=e===`zh`?yr.get(t)??t:t;return n?r.replace(/\{(\w+)\}/g,(e,t)=>Object.hasOwn(n,t)?String(n[t]):e):r}function xr({text:e,slots:t}){return e.split(/\{(\w+)\}/).map((e,n)=>n%2==0?e:(0,Q.jsx)(f.Fragment,{children:Object.hasOwn(t,e)?t[e]:`{${e}}`},e))}function Sr(){try{let e=localStorage.getItem(vr);if(e===`en`||e===`zh`)return e}catch{}return(typeof navigator>`u`?void 0:navigator.languages?.[0]??navigator.language)?.toLowerCase().startsWith(`zh`)?`zh`:`en`}function Cr(e,t){return{locale:e,t:(t,n)=>br(e,t,n),tx:t=>br(e,t),setLocale:t}}var wr=(0,f.createContext)(Cr(`en`,()=>{}));function $(){return(0,f.useContext)(wr)}function Tr({initial:e,children:t}){let[n,r]=(0,f.useState)(()=>e??Sr()),i=(0,f.useMemo)(()=>Cr(n,e=>{try{localStorage.setItem(vr,e)}catch{}r(e)}),[n]);return(0,f.useEffect)(()=>{document.documentElement.lang=n===`zh`?`zh-CN`:`en`,document.title=br(n,`Cadence task workspace`)},[n]),(0,Q.jsx)(wr.Provider,{value:i,children:t})}function Er({title:e,children:t,onClose:n}){let{t:r}=$(),i=(0,f.useRef)(null),a=(0,f.useId)(),o=(0,f.useRef)(n);return o.current=n,(0,f.useEffect)(()=>{let e=document.activeElement,t=i.current;return t?.showModal(),()=>{t?.close(),e instanceof HTMLElement&&e.isConnected&&e.focus()}},[]),(0,Q.jsxs)(`dialog`,{ref:i,className:`action-dialog`,"aria-labelledby":a,onCancel:e=>{e.preventDefault(),o.current()},children:[(0,Q.jsxs)(`header`,{children:[(0,Q.jsx)(`h2`,{id:a,children:e}),(0,Q.jsx)(`button`,{type:`button`,className:`dialog-close`,"aria-label":r(`Close dialog — no cancellation of accepted work`),title:r(`Close — accepted work is not cancelled`),onClick:n,children:(0,Q.jsx)(D,{"aria-hidden":`true`})})]}),t]})}function Dr(e){let t=e=>{if(typeof e==`string`||typeof e==`number`){let t=String(e);return t===``?[[]]:t.split(`
|
|
4
|
-
`).map(e=>e===``?[]:[e])}if(Array.isArray(e)){let n=[];for(let r of e){let e=t(r);if(n.length===0)n=e;else{let t=e[0]??[];n[n.length-1].push(...t),n.push(...e.slice(1))}}return n}if(e&&typeof e==`object`&&`props`in e){let n=e,r=n.props?.children,i={...n.props,children:void 0},a=r==null?[]:t(r);return a.length===0?[[(0,f.createElement)(n.type,i)]]:a.map(e=>[(0,f.createElement)(n.type,i,...e)])}return[[e]]},n=t(e);return n.length>1&&n[n.length-1].length===0&&n.pop(),n}var Or=function(){let e=this.data();e.micromarkExtensions??=[],e.micromarkExtensions.push({flow:{92:kr(!0)},text:{92:kr(!1)}});let t={enter:{backslashMathInline:Ar,backslashMathDisplay:Ar,backslashMathBlock:Ar},exit:{backslashMathInline:jr,backslashMathDisplay:jr,backslashMathBlock:jr}};e.fromMarkdownExtensions??=[],e.fromMarkdownExtensions.push(t)};function kr(e){return{tokenize:function(t,n,r){let i=this,a=93,o=e?`backslashMathBlock`:`backslashMathDisplay`,s;return c;function c(e){return e===92?(s=t.enter(o),t.consume(e),l):r(e)}function l(n){return n!==91&&(e||n!==40)?r(n):(a=n===91?93:41,!e&&n===40&&(o=`backslashMathInline`,s.type=o),t.consume(n),u)}function u(n){return n===null||e&&i.parser.lazy[i.now().line]?r(n):n===-5||n===-4||n===-3?(t.enter(`lineEnding`),t.consume(n),t.exit(`lineEnding`),u):(f(n),n===92?d:u)}function d(i){return i===a?(f(i),t.exit(o),e?p:n):i===null?r(i):i===-5||i===-4||i===-3?u(i):(f(i),u)}function f(e){t.enter(`backslashMathData`),t.consume(e),t.exit(`backslashMathData`)}function p(e){return e===null||e===-5||e===-4||e===-3?n(e):e===32||e===-2||e===-1?(t.enter(`whitespace`),t.consume(e),t.exit(`whitespace`),p):r(e)}},concrete:e,name:e?`backslashMathBlock`:`backslashMathText`}}var Ar=function(e){let t=e.type===`backslashMathBlock`,n=e.type!==`backslashMathInline`,r=this.sliceSerialize(e).slice(2,-2).trim(),i={type:`element`,tagName:`code`,properties:{className:[`language-math`,n?`math-display`:`math-inline`]},children:[{type:`text`,value:r}]},a=t?{type:`math`,meta:null,value:r,data:{hName:`pre`,hChildren:[i]}}:{type:`inlineMath`,value:r,data:{hName:`code`,hProperties:i.properties,hChildren:i.children}};this.enter(a,e)},jr=function(e){this.exit(e)};function Mr(e){if(typeof document>`u`)return!1;let t=document.createElement(`textarea`),n=document.activeElement;try{return t.value=e,t.style.position=`fixed`,t.style.left=`-9999px`,t.setAttribute(`readonly`,``),document.body.appendChild(t),t.select(),document.execCommand(`copy`)}catch{return!1}finally{t.remove(),n instanceof HTMLElement&&n.isConnected&&n.focus()}}async function Nr(e){if(typeof navigator<`u`&&navigator.clipboard&&typeof navigator.clipboard.writeText==`function`)try{return await navigator.clipboard.writeText(e),!0}catch{return Mr(e)}return Mr(e)}function Pr(e={}){let{duration:t=2e3,onSuccess:n,onError:r}=e,i=(0,f.useRef)(!0),[a,o]=(0,f.useState)(!1),s=(0,f.useRef)(null),c=(0,f.useCallback)(()=>{s.current!==null&&(clearTimeout(s.current),s.current=null)},[]),l=(0,f.useCallback)(()=>{c(),o(!1)},[c]);return(0,f.useEffect)(()=>(i.current=!0,()=>{i.current=!1,c()}),[c]),{copied:a,copy:(0,f.useCallback)(async e=>{let a=!1;try{a=await Nr(e)}catch(e){a=!1,r&&r(e)}return i.current&&(a?(o(!0),c(),s.current=setTimeout(()=>{o(!1),s.current=null},t),n?.(e)):r&&!a&&r(Error(`Copy failed`))),a},[t,n,r,c]),reset:l}}var Fr=(0,f.memo)(function({text:e}){let{t}=$(),[n,r]=(0,f.useState)(!1),{copied:i,copy:a}=Pr();return(0,Q.jsxs)(`button`,{type:`button`,className:`copy-btn`,title:t(`Copy displayed text`),"aria-label":t(`Copy displayed text`),onClick:()=>{r(!1),a(e).then(e=>r(!e))},children:[i?(0,Q.jsx)(Ae,{}):(0,Q.jsx)(Te,{}),n&&t(`Copy unavailable`)]})}),Ir=[s,d,Or],Lr=[s,l,d,Or],Rr=[[c,{strict:!1,throwOnError:!1,trust:!1,maxExpand:1e3}],[u,{detect:!1,ignoreMissing:!0}]];function zr(e){if(e.startsWith(`#`)&&![...e].some(e=>e.charCodeAt(0)<=32))return e;try{let t=new URL(e);return![`https:`,`http:`].includes(t.protocol)||t.username||t.password||t.searchParams.has(`token`)?void 0:e}catch{return}}function Br({text:e,rawHtml:t=!1,hardBreaks:n=!1}){return(0,Q.jsx)(a,{remarkPlugins:n?Lr:Ir,rehypePlugins:t?[i,o,...Rr]:Rr,skipHtml:!t,disallowedElements:[`iframe`,`object`,`embed`,`script`,`style`,`video`,`audio`,`source`,`form`,`input`],components:{pre:Ur,a:Hr,img:({alt:e})=>(0,Q.jsxs)(`span`,{className:`omission`,children:[`[Image omitted: `,e||`external/media content`,`]`]})},children:e})}var Vr=(0,f.memo)(function(e){return(0,Q.jsx)(`div`,{className:`md`,children:(0,Q.jsx)(Br,{...e})})});function Hr({href:e,children:t}){let n=e&&zr(e);return n?(0,Q.jsx)(`a`,{href:n,target:n.startsWith(`#`)?void 0:`_blank`,rel:`noreferrer noopener`,referrerPolicy:`no-referrer`,children:t}):(0,Q.jsxs)(`span`,{children:[t,` [link unavailable]`]})}function Ur({children:e,node:t,...n}){let r=e&&typeof e==`object`&&`props`in e?e.props?.children:e,i=0,a=Dr(r).map(e=>{let t=`code-offset:${i}`;return i+=Wr(e).length+1,{key:t,nodes:e}}),o=a.length>1,s=o?`${String(a.length).length+1}ch`:void 0;return(0,Q.jsxs)(`div`,{className:`codeblock`,children:[(0,Q.jsx)(Fr,{text:Wr(e)}),(0,Q.jsx)(`pre`,{...n,children:a.map(({nodes:e,key:t},n)=>(0,Q.jsxs)(`div`,{className:`code-line`,children:[o&&(0,Q.jsx)(`span`,{className:`code-num`,style:s?{width:s}:void 0,children:n+1}),(0,Q.jsx)(`code`,{className:`code-line-body hljs`,children:e})]},t))})]})}function Wr(e){if(typeof e==`string`)return e;if(Array.isArray(e))return e.map(Wr).join(``);if(e&&typeof e==`object`&&`props`in e){let t=e.props;return Wr(t?.children)}return``}function Gr({prepared:e,client:t,current:n,onClose:r,onResult:i,attachmentVersion:a}){let{t:o,tx:s}=$(),[c,l]=(0,f.useState)(Date.now()),[u,d]=(0,f.useState)(!1);(0,f.useEffect)(()=>{let e=setInterval(()=>l(Date.now()),1e3);return()=>clearInterval(e)},[]);let p=e.preflight,m=p.preview,h=(0,f.useRef)(a),g=(0,f.useRef)(!1);(!n||U(n)!==U(m.version)||c>=Date.parse(p.expiresAt)||h.current!==a)&&(g.current=!0);let _=g.current,v=async()=>{if(!(_||e.submitted)){d(!0),i({commandId:e.commandId,error:o(`Admission pending/unknown — observe this exact receipt.`)});try{let n=await Gn(t,e);i(n.kind===`ok`?{commandId:e.commandId,receipt:n.value}:{commandId:e.commandId,error:o(`{code}; effect {effect}`,{code:n.error.code,effect:n.error.effect})})}catch{i({commandId:e.commandId,error:o(`Uncertain; do not repeat the action.`)})}r()}};return(0,Q.jsxs)(Er,{title:o(`Confirm {action}`,{action:s(m.action.kind)}),onClose:r,children:[(0,Q.jsx)(`p`,{children:o(`Access is not consent. This confirmation applies only to the displayed context, once.`)}),(0,Q.jsxs)(`dl`,{children:[(0,Q.jsx)(`dt`,{children:o(`Checkout`)}),(0,Q.jsx)(`dd`,{children:m.rootLabel}),(0,Q.jsx)(`dt`,{children:o(`Working directory`)}),(0,Q.jsx)(`dd`,{children:(0,Q.jsx)(`code`,{children:m.cwdLabel})}),(0,Q.jsx)(`dt`,{children:o(`Model / API / thinking`)}),(0,Q.jsxs)(`dd`,{children:[m.version.model.provider,` / `,m.version.model.model,` /`,` `,m.version.model.api,` / `,m.version.model.thinking]}),(0,Q.jsx)(`dt`,{children:o(`Check environment`)}),(0,Q.jsx)(`dd`,{children:o(`Service launch environment policy, generation {generation}; no browser environment overlays.`,{generation:m.version.checkEnvGeneration})}),(0,Q.jsx)(`dt`,{children:o(`Observation`)}),(0,Q.jsx)(`dd`,{children:m.version.observation.complete?o(`Complete within bounded scope`):o(`Incomplete bounded coverage`)}),(0,Q.jsx)(`dt`,{children:o(`Expires`)}),(0,Q.jsx)(`dd`,{children:p.expiresAt})]}),(0,Q.jsx)(Kr,{preview:m}),m.action.kind===`check`&&(0,Q.jsxs)(`section`,{children:[(0,Q.jsx)(`h3`,{children:o(`Exact parent check`)}),(0,Q.jsx)(`pre`,{children:m.action.check.command}),(0,Q.jsx)(`p`,{children:o(`{name}; timeout {timeout} ms; cwd above.`,{name:m.action.check.name,timeout:m.action.check.timeoutMs})})]}),m.action.kind===`generate-plan`&&(0,Q.jsx)(`p`,{children:o(`Readonly proposal only. It will not save itself or dispatch editing.`)}),m.issues.length>0&&(0,Q.jsx)(`p`,{role:`alert`,children:o(`Issues: {issues}`,{issues:m.issues.map(s).join(`, `)})}),_&&(0,Q.jsx)(`p`,{role:`alert`,children:o(`Context changed or confirmation expired. Close, observe again and request a new preview.`)}),(0,Q.jsxs)(`footer`,{children:[(0,Q.jsx)(`button`,{type:`button`,onClick:r,children:o(`Back — no new effect`)}),(0,Q.jsx)(`button`,{type:`button`,className:`primary`,disabled:_||u||e.submitted,onClick:()=>void v(),children:o(`Confirm {action}`,{action:s(m.action.kind)})})]})]})}function Kr({preview:e}){let{t,tx:n}=$(),r=e.action,i=r.kind===`save-plan`?r.graph:e.graph;return(0,Q.jsxs)(Q.Fragment,{children:[r.kind===`create`&&(0,Q.jsxs)(`section`,{children:[(0,Q.jsx)(`h3`,{children:t(`Create {kind} task`,{kind:n(r.taskKind)})}),(0,Q.jsx)(`pre`,{children:r.goal}),(0,Q.jsx)(`p`,{children:t(`No Start is included.`)})]}),r.kind!==`create`&&(0,Q.jsx)(Vr,{text:r.kind===`save-plan`?r.plan:e.readablePlan}),i?.assignments.map(e=>(0,Q.jsxs)(`section`,{children:[(0,Q.jsxs)(`h3`,{children:[e.id,` · `,e.purpose]}),(0,Q.jsxs)(`p`,{children:[e.role.role,` / `,e.role.sha256]}),(0,Q.jsx)(`pre`,{children:JSON.stringify(e.model,null,2)}),(0,Q.jsx)(Vr,{text:e.instructions}),(0,Q.jsx)(`p`,{children:t(`Expected: {output}`,{output:e.expectedOutput})}),(0,Q.jsx)(`pre`,{children:JSON.stringify(e.dependencies,null,2)})]},e.id)),r.kind===`save-plan`&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`h3`,{children:t(`Exact proposed graph and identities (not yet committed)`)}),(0,Q.jsx)(`pre`,{children:JSON.stringify(r.graph,null,2)})]}),r.kind===`review`&&(0,Q.jsxs)(`section`,{children:[(0,Q.jsx)(`h3`,{children:t(`Exact human review targets`)}),(0,Q.jsx)(`pre`,{children:JSON.stringify(r,null,2)}),(0,Q.jsx)(`p`,{children:t(`Human review only; failures, native exit, stale and not-run checks remain unchanged. Issues acknowledgment: {accepted}.`,{accepted:String(r.acceptIssues)})})]})]})}function qr({client:e,compatible:t,onClose:n,onChanged:r}){let{t:i,tx:a}=$(),[o,s]=(0,f.useState)(),[c,l]=(0,f.useState)(``),[u,d]=(0,f.useState)(``),[p,m]=(0,f.useState)(``),[h,g]=(0,f.useState)(!1);return(0,f.useEffect)(()=>{let t=new AbortController;return e.models(t.signal).then(e=>{t.signal.aborted||(e.kind===`ok`?s(e.value):d(e.error.code))}).catch(()=>{t.signal.aborted||d(`unavailable`)}),()=>t.abort()},[e]),(0,Q.jsxs)(Er,{title:i(`Choose owner model`),onClose:n,children:[(0,Q.jsx)(`p`,{children:i(`Explicit owner-wide choice, only while quiescent. This does not resolve credentials, probe a provider, save a plan or Start work.`)}),(0,Q.jsx)(`p`,{children:i(`Current: {model}`,{model:o?.selected?`${o.selected.provider}/${o.selected.model} · ${o.selected.thinking}`:i(`No model selected`)})}),(0,Q.jsxs)(`label`,{children:[i(`Exact model / API / thinking`),(0,Q.jsxs)(`select`,{value:c,disabled:!o,onChange:e=>l(e.target.value),children:[(0,Q.jsx)(`option`,{value:``,children:i(`Select explicitly`)}),o?.entries.flatMap(e=>e.thinking.filter(e=>e.selectable).map(t=>{let n=JSON.stringify({provider:e.provider,model:e.model,api:e.api,thinking:t.level});return(0,Q.jsxs)(`option`,{value:n,children:[e.provider,`/`,e.model,` · `,e.api,` · `,t.level]},n)}))]})]}),o?.status===`capacity`&&(0,Q.jsx)(`p`,{children:i(`Catalog capacity exceeded; no partial model list is selectable.`)}),!!o?.withheld&&(0,Q.jsx)(`p`,{role:`alert`,children:i(o.withheld===1?`{count} model withheld: its provider or model ID contains a credential value (such as an apiKey equal to the provider name) or control characters. Give each credential a value that matches no provider or model ID; restart the service after editing models.json.`:`{count} models withheld: their provider or model IDs contain a credential value (such as an apiKey equal to the provider name) or control characters. Give each credential a value that matches no provider or model ID; restart the service after editing models.json.`,{count:o.withheld})}),u&&(0,Q.jsx)(`p`,{role:`alert`,children:i(`Model catalog unavailable ({code}); no model is selectable. No automatic retry.`,{code:a(u)})}),p&&(0,Q.jsx)(`p`,{role:`alert`,children:i(`{error}. No automatic replacement or retry.`,{error:a(p)})}),(0,Q.jsx)(`button`,{type:`button`,disabled:!t||!o||!c||h,onClick:()=>{o&&(g(!0),e.chooseModel({expected:o.version,choice:Ke(JSON.parse(c))}).then(e=>{e.kind===`error`?m(e.error.code):(r(),n())}).catch(()=>m(`Choice response unconfirmed; observe catalog before another explicit choice.`)).finally(()=>g(!1)))},children:i(`Confirm owner model choice`)})]})}function Jr({client:e,value:t,onChange:n}){let{t:r,tx:i}=$(),a=(0,f.useRef)(!0),o=(0,f.useRef)(null);(0,f.useEffect)(()=>(a.current=!0,()=>{a.current=!1,o.current?.abort()}),[]);let[s,c]=(0,f.useState)(!1),l=t.receipt??(t.lookup?.status===`found`?t.lookup.receipt:void 0);return(0,Q.jsxs)(`section`,{className:`receipt`,"aria-label":r(`Command receipt`),children:[(0,Q.jsx)(`h3`,{children:r(`Command receipt`)}),(0,Q.jsx)(`code`,{children:t.commandId}),t.error&&(0,Q.jsx)(`p`,{role:`alert`,children:i(t.error)}),l&&(0,Q.jsxs)(`dl`,{children:[(0,Q.jsx)(`dt`,{children:r(`Admission`)}),(0,Q.jsx)(`dd`,{children:i(l.admission)}),(0,Q.jsx)(`dt`,{children:r(`Execution`)}),(0,Q.jsx)(`dd`,{children:l.execution?i(l.execution):r(`not settled`)}),(0,Q.jsx)(`dt`,{children:r(`Publication`)}),(0,Q.jsx)(`dd`,{children:i(l.publication)}),(0,Q.jsx)(`dt`,{children:r(`Run`)}),(0,Q.jsx)(`dd`,{children:l.runId??r(`metadata action`)})]}),t.lookup&&t.lookup.status!==`found`&&(0,Q.jsx)(`p`,{children:r(`{status}. This observation does not authorize replay.`,{status:i(t.lookup.status)})}),(0,Q.jsx)(`button`,{type:`button`,disabled:s,onClick:()=>{c(!0),o.current=new AbortController,e.receipt(t.commandId,o.current.signal).then(e=>{a.current&&(n({commandId:t.commandId,lookup:e}),c(!1))})},children:r(`Observe exact receipt`)})]})}function Yr(e,t){let n=e??{content:t.content,chunks:[],offset:0},r=n.content,i=t.content;if(r.recordId!==i.recordId||r.version!==i.version||r.field!==i.field||r.sha256!==i.sha256||r.bytes!==i.bytes||n.offset!==(t.range?.start??0))throw Error(`Noncontiguous immutable field`);return{...n,chunks:[...n.chunks,t.text],offset:t.range?.end??0}}function Xr(e,t,n){switch(t.reader){case`tasks`:return e.tasks(t,n);case`runs`:return e.runs(t,n);case`messages`:return e.messages(t,n);case`tools`:return e.tools(t,n);case`contents`:return e.contents(t,n);case`events`:return e.events(t,n);case`checks`:return e.checks(t,n);case`changes`:return e.changes(t,n);case`reviews`:return e.reviews(t,n)}}function Zr(e,t,n,r){return{storeId:e,scope:t,snapshotSeq:n,query:null,recordId:r.recordId,recordVersion:r.version,field:r.field,offset:0}}async function Qr(e,t,n){let r={...t,offset:0};delete r.navigation;let i=null,a=!0;for(;r;){if(n.aborted)throw Error(`canceled`);let t=await e.detail(r,n);if(n.aborted)throw Error(`canceled`);if(t.kind===`error`)throw Error(t.error.code);let o=t.value;r=o.next,`kind`in o||(a&&=o.coverage.observed===`complete`,i=Yr(i,o)),await new Promise(e=>setTimeout(e,0))}if(!i||i.offset!==i.content.bytes)throw Error(`incomplete-content`);return{text:i.chunks.join(``),recordingComplete:a}}function $r(e,t){let n=t?U({reader:t.reader,storeId:t.storeId,scope:t.scope,limit:t.limit}):`absent`,[r,i]=(0,f.useState)(),[a,o]=(0,f.useState)(!1),[s,c]=(0,f.useState)(),[l,u]=(0,f.useState)(t),[d,p]=(0,f.useState)([]),m=(0,f.useRef)(0),[h,g]=(0,f.useState)(n);return h!==n&&(m.current++,g(n),i(void 0),c(void 0),u(t),p([])),(0,f.useEffect)(()=>{let t=++m.current;if(!l){o(!1);return}let n=new AbortController;return o(!0),c(void 0),Xr(e,l,n.signal).then(e=>{t===m.current&&(o(!1),e.kind===`error`?c(e.error.code):i(e.value))}).catch(()=>{t===m.current&&(c(`Read unavailable.`),o(!1))}),()=>{n.abort(),m.current++}},[e,l]),{page:r,busy:a,error:s,more:()=>{!a&&r?.next&&(l&&p(e=>[...e,l]),u(r.next))},previous:()=>{!a&&d.length&&(u(d[d.length-1]),p(e=>e.slice(0,-1)))},canPrevious:d.length>0,refresh:()=>{i(void 0),p([]),u(t?{...t}:null)}}}function ei({value:e}){let{t,tx:n}=$();return(0,Q.jsxs)(`p`,{className:`coverage${e.observed===`complete`&&e.source===`complete`&&!e.redacted&&e.omissions.length===0?``:` partial`}`,children:[t(`Recording: {observed}; source: {source};`,{observed:n(e.observed),source:n(e.source)}),` `,e.redacted?t(`redacted`):t(`no reported redaction`),e.omissions.length>0&&t(`; omitted: {omissions}`,{omissions:e.omissions.map(n).join(`, `)}),t(`. Not a guarantee of complete original source or universal secret detection.`)]})}function ti(e,t){let n=[],r=t;if(!r)return n;let i=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,{acceptNode(e){let t=e.parentElement;return!t||t.closest(`.search-bar`)||t.closest(`.msg-collapsed`)?NodeFilter.FILTER_REJECT:(e.textContent??``).includes(r)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(let e=i.nextNode();e;e=i.nextNode()){let t=e.textContent??``;if(!e.parentElement?.closest(`[data-retained-field]`))continue;let i=t.indexOf(r);for(;i!==-1;){let a=document.createRange();if(a.setStart(e,i),a.setEnd(e,i+r.length),n.push(a),n.length===1e3)return n;i=t.indexOf(r,i+r.length)}}return n}var ni=new Map;function ri(e,t){t.length?ni.set(e,t):ni.delete(e);let n=e.endsWith(`-active`);e=n?`cadence-page-active`:`cadence-page`,t=[...ni].filter(([e])=>e.endsWith(`-active`)===n).flatMap(([,e])=>e);let r=CSS;if(!r.highlights)return;if(t.length===0){r.highlights.delete(e);return}let i=window.Highlight;i&&r.highlights.set(e,new i(...t))}function ii(e,t){let n=[],r=e;for(;r&&r!==t;){let e=getComputedStyle(r);/(auto|scroll|hidden)/.test(e.overflowY+e.overflowX)&&(r.scrollHeight>r.clientHeight||r.scrollWidth>r.clientWidth)&&n.push(r),r=r.parentElement}return n}function ai(e,t){let n=t.startContainer.parentElement;for(let r of ii(n,e)){let e=t.getBoundingClientRect(),n=r.getBoundingClientRect();if(e.height<=0||e.width<=0)return;e.top>=n.top+4&&e.bottom<=n.bottom-4||(r.scrollTop+=e.top-n.top-(r.clientHeight-e.height)/2),e.left>=n.left+4&&e.right<=n.right-4||(r.scrollLeft+=e.left-n.left-(r.clientWidth-e.width)/2)}let r=t.getBoundingClientRect(),i=e.getBoundingClientRect();if(r.height<=0||r.width<=0)return;let a=r.top>=i.top+6&&r.bottom<=i.bottom-6,o=r.left>=i.left+6&&r.right<=i.right-6;a&&o||(a||(e.scrollTop+=r.top-i.top-(i.height-r.height)/2),o||(e.scrollLeft+=r.left-i.left-(i.width-r.width)/2))}function oi({container:e,version:t}){let{t:n}=$(),[r,i]=(0,f.useState)(``),[a,o]=(0,f.useState)(0),[s,c]=(0,f.useState)(0),l=(0,f.useRef)([]),u=`cadence-page-${(0,f.useId)().replace(/[^a-z0-9]/gi,``)}`;(0,f.useEffect)(()=>{if(!t)return;let n=e.current,i=n&&r?ti(n,r):[];return l.current=i,c(i.length),o(0),ri(u,i),()=>ri(u,[])},[r,e,t,u]);let d=t=>{let n=s?(a+t+s)%s:0;o(n),e.current&&l.current[n]&&(ai(e.current,l.current[n]),ri(`${u}-active`,[l.current[n]]))};return(0,f.useEffect)(()=>()=>ri(`${u}-active`,[]),[u]),(0,Q.jsxs)(`div`,{className:`search-bar toolbar`,children:[(0,Q.jsxs)(`label`,{children:[n(`Find on displayed field page`),(0,Q.jsx)(`input`,{value:r,onChange:e=>i(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),d(e.shiftKey?-1:1))}})]}),(0,Q.jsxs)(`span`,{children:[s?a+1:0,`/`,s,s>=1e3?n(` (first 1000 visual highlights)`):``,n(`; not whole-history search`)]}),(0,Q.jsx)(`button`,{type:`button`,disabled:!s,onClick:()=>d(-1),children:n(`Previous match`)}),(0,Q.jsx)(`button`,{type:`button`,disabled:!s,onClick:()=>d(1),children:n(`Next match`)})]})}function si({client:e,cursor:t,highlight:n,render:r}){let{t:i,tx:a}=$(),o=U(t),s=(0,f.useMemo)(()=>J(JSON.parse(o)),[o]),[c,l]=(0,f.useState)(t),[u,d]=(0,f.useState)(),[p,m]=(0,f.useState)([]),[h,g]=(0,f.useState)(!1),[_,v]=(0,f.useState)(),[y,b]=(0,f.useState)(`raw`),[x,S]=(0,f.useState)(``),C=(0,f.useRef)(null),w=(0,f.useRef)(null);(0,f.useEffect)(()=>(l(s),m([]),d(void 0),v(void 0),()=>C.current?.abort()),[s]),(0,f.useEffect)(()=>{let t=!0,n=new AbortController;return g(!0),v(void 0),e.detail(c,n.signal).then(e=>{t&&(g(!1),e.kind===`error`?v(e.error.code):d(e.value))}).catch(()=>{t&&(v(`Read unavailable.`),g(!1))}),()=>{t=!1,n.abort()}},[e,c]);let T=async()=>{if(C.current)return;let n=new AbortController;C.current=n,S(i(`Reading all retained field pages…`));try{let r=await Qr(e,t,n.signal);if(n.signal.aborted)return;let a=await Nr(r.text);if(n.signal.aborted)return;S(a?r.recordingComplete?i(`Copied all retained field bytes (source omissions still apply).`):i(`Copied retained field bytes; recording is incomplete. No complete-source claim.`):i(`Clipboard unavailable.`))}catch{n.signal.aborted||S(i(`Full-field copy refused/incomplete.`))}finally{C.current===n&&(C.current=null)}},E=u&&!(`kind`in u)?u:void 0;return(0,Q.jsxs)(`section`,{className:`detail-pane`,"aria-label":i(`Retained field`),children:[(0,Q.jsxs)(`div`,{className:`detail-identity`,children:[(0,Q.jsx)(`code`,{children:t.recordId}),` v`,t.recordVersion,` /`,` `,t.field&&a(t.field),` /`,` `,i(`snapshot {seq}`,{seq:t.snapshotSeq})]}),n&&(0,Q.jsx)(`p`,{children:i(`Exact hit bytes [{start}, {end}); only this immutable field is highlighted.`,{start:n.start,end:n.end})}),(0,Q.jsxs)(`div`,{className:`toolbar`,children:[(0,Q.jsx)(`button`,{type:`button`,onClick:()=>b(e=>e===`raw`?`markdown`:`raw`),children:i(y===`raw`?`Markdown page`:`Raw page`)}),(0,Q.jsx)(`button`,{type:`button`,disabled:!!C.current,onClick:()=>void T(),children:i(`Copy full retained field`)}),!!C.current&&(0,Q.jsx)(`button`,{type:`button`,onClick:()=>{C.current?.abort(),C.current=null,S(i(`Copy canceled; execution unchanged.`))},children:i(`Cancel copy`)})]}),(0,Q.jsx)(`p`,{role:`status`,children:x}),_&&(0,Q.jsx)(`p`,{role:`alert`,children:i(`Detail refused: {error}`,{error:a(_)})}),h&&(0,Q.jsx)(`p`,{role:`status`,children:i(`Reading…`)}),u&&(0,Q.jsx)(ei,{value:u.coverage}),u&&`kind`in u&&(0,Q.jsx)(`p`,{children:i(`Validation in progress. The retained field is not empty.`)}),E&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`p`,{children:[i(`Bytes {start}–{end} of {total}.`,{start:E.range?.start??0,end:E.range?.end??0,total:E.content.bytes}),` `,E.next?i(`More retained data available.`):i(`End of field.`)]}),(0,Q.jsx)(oi,{container:w,version:`${E.content.recordId}:${E.content.version}:${E.range?.start??0}:${y}`}),(0,Q.jsx)(`div`,{ref:w,"data-retained-field":!0,children:r?r(E.text):y===`markdown`?(0,Q.jsx)(Vr,{text:E.text}):(0,Q.jsx)(`pre`,{className:`detail-text`,children:(()=>{if(!E||!n||!E.range)return E?.text;let e=Math.max(n.start,E.range.start)-E.range.start,t=Math.min(n.end,E.range.end)-E.range.start;if(t<=e)return E.text;let r=new TextEncoder().encode(E.text),i=(e,t)=>new TextDecoder(`utf-8`,{fatal:!0}).decode(r.subarray(e,t));return(0,Q.jsxs)(Q.Fragment,{children:[i(0,e),(0,Q.jsx)(`mark`,{children:i(e,t)}),i(t,r.length)]})})()})})]}),(0,Q.jsxs)(`div`,{className:`toolbar`,children:[(0,Q.jsx)(`button`,{type:`button`,disabled:h||!p.length,onClick:()=>{l(p[p.length-1]),m(e=>e.slice(0,-1))},children:i(`Previous`)}),(0,Q.jsx)(`button`,{type:`button`,disabled:h||!u?.next,onClick:()=>{u?.next&&(m(e=>[...e,c]),l(u.next))},children:u&&`kind`in u?i(`Continue validation`):i(`Next field page`)})]})]})}function ci({pager:e}){let{t,tx:n}=$(),{page:r,busy:i,error:a}=e;return(0,Q.jsxs)(`div`,{className:`page-controls`,children:[a&&(0,Q.jsx)(`p`,{role:`alert`,children:t(`Read refused: {error}. Retained state has not been repaired.`,{error:n(a)})}),i&&(0,Q.jsx)(`p`,{role:`status`,children:t(`Reading bounded history page…`)}),r&&`kind`in r&&(0,Q.jsxs)(`p`,{role:`status`,children:[r.kind===`snapshot`?t(`Snapshot selected`):t(`Validating retained history`),t(`; continue this exact read. No data page yet.`)]}),r&&(0,Q.jsx)(ei,{value:r.coverage}),(0,Q.jsx)(`button`,{type:`button`,disabled:i||!e.canPrevious,onClick:e.previous,children:t(`Previous page`)}),(0,Q.jsx)(`button`,{type:`button`,disabled:i||!r?.next,onClick:e.more,children:r&&`kind`in r?t(`Continue validation`):t(`Next page`)}),(0,Q.jsx)(`button`,{type:`button`,disabled:i,onClick:e.refresh,children:t(`Observe a new snapshot`)}),r&&!(`kind`in r)&&!r.next&&(0,Q.jsx)(`span`,{className:`page-end`,children:r.coverage.observed===`incomplete`?t(`End of this retained snapshot (incomplete).`):t(`End of this retained snapshot.`)})]})}function li({client:e,seed:t,entityId:n}){let{t:r,tx:i}=$(),a=$r(e,{...t,reader:`contents`}),[o,s]=(0,f.useState)(),c=a.page;return(0,Q.jsxs)(`section`,{"aria-label":r(`Retained content fields`),children:[(0,Q.jsx)(ci,{pager:a}),n&&(0,Q.jsx)(`p`,{children:(0,Q.jsx)(xr,{text:r(`Showing matches for entity {entity} on this page only. Continue paging for other fields/versions.`),slots:{entity:(0,Q.jsx)(`code`,{children:n})}})}),c&&!(`kind`in c)&&c.records.map(e=>e.kind!==`content`&&e.kind!==`omitted`||n&&e.owner.entity.id!==n?null:e.kind===`omitted`?(0,Q.jsxs)(`p`,{className:`omission`,children:[r(`Omitted source block:`),` `,(0,Q.jsx)(`code`,{children:JSON.stringify(e.block)})]},`${e.owner.entity.id}:${e.version}:${JSON.stringify(e.block.owner)}`):(0,Q.jsxs)(`article`,{children:[(0,Q.jsxs)(`p`,{children:[i(e.owner.entity.kind),` `,(0,Q.jsx)(`code`,{children:e.owner.entity.id}),` ·`,` `,i(e.content.field),` ·`,` `,r(`{bytes} retained bytes`,{bytes:e.content.bytes})]}),(0,Q.jsx)(`pre`,{children:JSON.stringify(e.descriptor.owner)}),(0,Q.jsx)(ei,{value:e.coverage}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>{c.request.scope.kind!==`workspace`&&c.request.snapshotSeq!==null&&s(Zr(c.request.storeId,c.request.scope,c.request.snapshotSeq,e.content))},children:r(`Inspect complete retained field`)})]},`${e.content.recordId}:${e.content.version}`)),o&&(0,Q.jsx)(si,{client:e,cursor:o},`${o.recordId}:${o.recordVersion}`)]})}function ui({client:e,seed:t}){return(0,Q.jsx)(di,{client:e,seed:t},U(t))}function di({client:e,seed:t}){let{t:n,tx:r}=$(),[i,a]=(0,f.useState)(t),[o,s]=(0,f.useState)(),[c,l]=(0,f.useState)(),[u,d]=(0,f.useState)(!1);return(0,f.useEffect)(()=>{let t=!0,n=new AbortController;return d(!0),(i.kind===`message`?e.message(i,n.signal):i.kind===`tool`?e.tool(i,n.signal):e.task(i,n.signal)).then(e=>{t&&(d(!1),e.kind===`error`?l(e.error.code):(s(e.value),l(void 0)))}).catch(()=>{t&&(l(`Read unavailable.`),d(!1))}),()=>{t=!1,n.abort()}},[e,i]),(0,Q.jsxs)(`section`,{"aria-label":n(`Exact entity metadata`),children:[u&&(0,Q.jsx)(`p`,{children:n(`Reading exact entity version…`)}),c&&(0,Q.jsx)(`p`,{role:`alert`,children:n(`Entity refused: {error}`,{error:r(c)})}),o&&`kind`in o&&(0,Q.jsx)(ei,{value:o.coverage}),o&&(`kind`in o?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{children:n(`Entity validation in progress, not missing.`)}),(0,Q.jsx)(`button`,{type:`button`,disabled:u,onClick:()=>a(o.next),children:n(`Continue exact entity validation`)})]}):(0,Q.jsxs)(`details`,{children:[(0,Q.jsx)(`summary`,{children:n(`Exact stored owner and associations`)}),(0,Q.jsx)(`pre`,{children:JSON.stringify(o.record,null,2)})]}))]})}function fi(e){let t=rr(`download`,xn(e));if(t.method!==`GET`)throw Error(`Native download needs the named GET attachment route.`);let n=document.createElement(`a`);n.href=t.path,n.download=`cadence-${e.scope.kind}-${e.scope.id}.${e.format===`markdown`?`md`:`ndjson`}`,n.referrerPolicy=`no-referrer`,document.body.appendChild(n),n.click(),n.remove()}function pi({request:e,onClose:t}){let{t:n,tx:r}=$(),[i]=(0,f.useState)(e),[a,o]=(0,f.useState)(e.format),[s,c]=(0,f.useState)(``);return(0,Q.jsxs)(Er,{title:n(`Export retained history`),onClose:t,children:[(0,Q.jsx)(`p`,{children:n(`Selected {kind}: {id} · snapshot {seq}`,{kind:r(i.scope.kind),id:i.scope.id,seq:i.snapshotSeq})}),(0,Q.jsxs)(`label`,{children:[n(`Format`),(0,Q.jsxs)(`select`,{value:a,onChange:e=>o(e.target.value===`markdown`?`markdown`:`ndjson`),children:[(0,Q.jsx)(`option`,{value:`ndjson`,children:n(`NDJSON public archive`)}),(0,Q.jsx)(`option`,{value:`markdown`,children:n(`Readable Markdown with footer metadata`)})]})]}),(0,Q.jsx)(`p`,{children:n(`Includes retained context, messages/tools, graph, lifecycle, changes, checks, human review and coverage beyond loaded pages. Redactions and source omissions remain.`)}),(0,Q.jsx)(`p`,{children:n(`A native browser download request cannot establish completion. Inspect the original EOF and completion trailer/counts/digest in the downloaded artifact; missing footer means incomplete. Revoked access may terminate without a trailer.`)}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>{try{fi({...i,format:a}),c(n(`Download requested — completion not verified by this browser UI.`))}catch{c(n(`Download unavailable; no archive claimed complete.`))}},children:n(`Request selected-scope download`)}),(0,Q.jsx)(`p`,{role:`status`,children:s})]})}function mi(e,t){if(!t||M(t)>O.queryBytes)throw Error(`Query must be 1–${O.queryBytes} UTF-8 bytes; it was not clipped.`);let{navigation:n,...r}=e;return J({...r,query:t,recordId:null,recordVersion:null,field:null,offset:0})}function hi(e){return e.next?`No hits in this bounded window; search is not finished.`:`No hits in the final retained window. Coverage limits above still apply.`}function gi({client:e,seed:t,onClose:n,onHit:r}){let{t:i,tx:a}=$(),[o]=(0,f.useState)(t),s=(0,f.useRef)(null),c=(0,f.useRef)(0),[l,u]=(0,f.useState)(``),[d,p]=(0,f.useState)(0),[m,h]=(0,f.useState)(),[g,_]=(0,f.useState)(!1),[v,y]=(0,f.useState)(),b=(0,f.useRef)(null),x=(0,f.useCallback)(async(t,n)=>{b.current?.abort();let r=new AbortController;b.current=r,_(!0),y(void 0);try{let i=await e.search(t,r.signal);if(c.current!==n||r.signal.aborted)return;i.kind===`error`?y(i.error.code):(h(i.value),p(0))}catch{c.current===n&&!r.signal.aborted&&y(`Search unavailable or invalid; no automatic retry.`)}finally{c.current===n&&!r.signal.aborted&&_(!1)}},[e]);return(0,f.useEffect)(()=>(s.current?.focus(),()=>{c.current++,b.current?.abort()}),[]),(0,f.useEffect)(()=>{let e=++c.current;if(b.current?.abort(),_(!1),h(void 0),p(0),y(void 0),!l)return;let t;try{t=mi(o,l)}catch{y(`Query must be 1–1024 UTF-8 bytes; it was not clipped.`);return}let n=setTimeout(()=>void x(t,e),300);return()=>{clearTimeout(n),c.current++,b.current?.abort()}},[l,o,x]),(0,Q.jsx)(Er,{title:i(`Search retained history`),onClose:n,children:(0,Q.jsxs)(`div`,{className:`gs-modal`,children:[(0,Q.jsxs)(`div`,{className:`gs-input-row`,children:[(0,Q.jsx)(oe,{}),(0,Q.jsx)(`input`,{ref:s,"aria-label":i(`Case-sensitive literal query`),value:l,onChange:e=>u(e.target.value),onKeyDown:e=>{e.key===`ArrowDown`&&(e.preventDefault(),p(e=>Math.max(0,Math.min(e+1,(m?.hits.length??0)-1)))),e.key===`ArrowUp`&&(e.preventDefault(),p(e=>Math.max(e-1,0))),e.key===`Enter`&&m?.hits[d]&&(e.preventDefault(),r(m.hits[d]),n())}})]}),(0,Q.jsx)(`p`,{children:i(`Case-sensitive literal UTF-8 search. Scope {kind} {id}; snapshot {seq}. No regex, provider request or history repair.`,{kind:a(o.scope.kind),id:o.scope.id,seq:o.snapshotSeq})}),(0,Q.jsxs)(`div`,{className:`gs-results`,children:[g&&(0,Q.jsx)(`p`,{role:`status`,children:i(`Searching bounded retained range…`)}),v&&(0,Q.jsx)(`p`,{role:`alert`,children:i(`Search refused: {error}`,{error:a(v)})}),!l&&(0,Q.jsx)(`p`,{children:i(`Enter a query to search this selected scope.`)}),m&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(ei,{value:m.coverage}),(0,Q.jsxs)(`div`,{className:`gs-section`,children:[(0,Q.jsx)(`div`,{className:`gs-section-head`,children:i(`Matches on this page: {count}`,{count:m.hits.length})}),m.hits.map((e,t)=>(0,Q.jsxs)(`button`,{type:`button`,className:`gs-item ${d===t?`active`:``}`,onMouseEnter:()=>p(t),onClick:()=>{r(e),n()},children:[(0,Q.jsxs)(`span`,{className:`gs-item-title`,children:[a(e.owner.entity.kind),` · `,a(e.content.field),` · v`,e.content.version]}),(0,Q.jsx)(`span`,{className:`gs-item-sub`,children:e.preview}),(0,Q.jsxs)(`code`,{children:[e.owner.childRunId??e.owner.runId??e.owner.taskId,` `,`/ `,e.content.recordId,` /`,` `,i(`bytes {start}–{end}`,{start:e.range.start,end:e.range.end})]})]},`${e.content.recordId}:${e.content.version}:${e.range.start}`)),m.hits.length===0&&(0,Q.jsx)(`p`,{children:a(hi(m))})]}),(0,Q.jsx)(`button`,{type:`button`,disabled:g||!m.next,onClick:()=>{m.next&&x(m.next,++c.current)},children:i(`Continue same snapshot search`)})]})]}),(0,Q.jsx)(`footer`,{className:`gs-foot`,children:i(`↑↓ Navigate · Enter Open exact hit · Escape Close. Reopening never resumes execution.`)})]})})}function _i({run:e,historical:t=!1}){let{t:n,tx:r}=$();return(0,Q.jsxs)(`article`,{className:`run-summary`,children:[(0,Q.jsxs)(`h3`,{children:[e.assignmentId??e.admission.kind,` ·`,` `,n(t?`historical projection`:`owner projection`)]}),(0,Q.jsx)(`p`,{children:(0,Q.jsx)(`code`,{children:e.childRunId??e.runId})}),(0,Q.jsxs)(`dl`,{children:[(0,Q.jsx)(`dt`,{children:n(`Lifecycle`)}),(0,Q.jsx)(`dd`,{children:r(e.lifecycle)}),(0,Q.jsx)(`dt`,{children:n(`Execution`)}),(0,Q.jsx)(`dd`,{children:e.outcome?r(e.outcome):n(`unsettled`)}),(0,Q.jsx)(`dt`,{children:n(`Wait/block reason`)}),(0,Q.jsx)(`dd`,{children:e.reason?r(e.reason):n(`none reported`)}),(0,Q.jsx)(`dt`,{children:n(`Summary publication`)}),(0,Q.jsx)(`dd`,{children:r(e.publication)})]}),(0,Q.jsx)(ei,{value:e.coverage}),(0,Q.jsxs)(`details`,{children:[(0,Q.jsx)(`summary`,{children:n(`Native / recording / parent settlement facts (independent of human review)`)}),(0,Q.jsx)(`pre`,{children:e.settlement?JSON.stringify(e.settlement,null,2):n(`No settlement recorded`)})]})]})}function vi({client:e,seed:t}){return(0,Q.jsx)(yi,{client:e,seed:t},U(t))}function yi({client:e,seed:t}){let{t:n,tx:r}=$(),[i,a]=(0,f.useState)(t),[o,s]=(0,f.useState)(),[c,l]=(0,f.useState)(),[u,d]=(0,f.useState)(!1);return(0,f.useEffect)(()=>{let t=!0,n=new AbortController;return d(!0),e.graph(i,n.signal).then(e=>{t&&(d(!1),e.kind===`error`?l(e.error.code):(s(e.value),l(void 0)))}).catch(()=>{t&&(l(`Read unavailable.`),d(!1))}),()=>{t=!1,n.abort()}},[e,i]),(0,Q.jsxs)(`section`,{children:[(0,Q.jsx)(`h3`,{children:n(`Immutable admitted graph`)}),c&&(0,Q.jsx)(`p`,{role:`alert`,children:n(`Graph refused: {error}`,{error:r(c)})}),u&&(0,Q.jsx)(`p`,{children:n(`Reading graph…`)}),o&&`kind`in o&&(0,Q.jsx)(ei,{value:o.coverage}),o&&(`kind`in o?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{children:n(`Graph validation in progress; not an empty graph.`)}),(0,Q.jsx)(`button`,{type:`button`,disabled:u,onClick:()=>a(o.next),children:n(`Continue graph validation`)})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(si,{client:e,cursor:Zr(o.request.storeId,o.request.scope,o.request.snapshotSeq,o.graph.plan)}),o.graph.assignments.map(e=>(0,Q.jsxs)(`article`,{children:[(0,Q.jsxs)(`h4`,{children:[e.id,` / `,e.purpose]}),(0,Q.jsx)(Vr,{text:e.instructions}),(0,Q.jsx)(`p`,{children:n(`Expected: {output}`,{output:e.expectedOutput})}),(0,Q.jsx)(`pre`,{children:JSON.stringify({model:e.model,role:e.role,dependencies:e.dependencies},null,2)})]},e.id))]}))]})}function bi({client:e,seed:t,onScope:n}){let{t:r}=$(),i=$r(e,{...t,reader:`runs`}),a=i.page,[o,s]=(0,f.useState)();return(0,Q.jsxs)(`section`,{children:[(0,Q.jsx)(ci,{pager:i}),a&&!(`kind`in a)&&a.records.map(e=>e.kind===`run`?(0,Q.jsxs)(`article`,{children:[(0,Q.jsx)(_i,{run:e.projection,historical:!0}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>n({kind:e.projection.childRunId?`child`:`run`,id:e.projection.childRunId??e.projection.runId}),children:r(`Open retained episode/child details`)}),e.projection.admission.graph&&(0,Q.jsx)(`button`,{type:`button`,onClick:()=>{a.request.scope.kind!==`workspace`&&a.request.snapshotSeq!==null&&e.projection.admission.graph&&s({storeId:a.request.storeId,scope:a.request.scope,snapshotSeq:a.request.snapshotSeq,graph:e.projection.admission.graph})},children:r(`Inspect admitted graph and plan`)})]},e.projection.childRunId??e.projection.runId):null),o&&(0,Q.jsx)(vi,{client:e,seed:o},o.graph.recordId)]})}function xi({onOpen:e,disabled:t}){let{t:n}=$();return(0,Q.jsx)(`button`,{type:`button`,className:`chip search-toggle`,"aria-label":n(`Search all retained pages in selected scope`),"data-tip":n(`Search all retained pages in selected scope`),disabled:t,onClick:e,children:(0,Q.jsx)(oe,{"aria-hidden":`true`})})}function Si(e,t,n,r,i){let a=i??t,o=[],s=[],c=0;for(let i of e)n.has(i.id)||(r.has(i.id)?i.top<t.bottom&&i.bottom>t.top&&o.push(i.id):i.top<a.bottom&&i.bottom>a.top||(s.push(i.id),i.bottom<=a.top&&(c+=i.bottom-i.top)));return{show:o,hide:s,shrinkAbove:c}}function Ci(e,t){if(t.show.length===0&&t.hide.length===0)return e;let n=new Set(e);for(let e of t.show)n.delete(e);for(let e of t.hide)n.add(e);return n}function wi(e,t,n){let r=new Set,i=0;for(let a=e.length-1;a>=0&&!(a<e.length-1&&i>=n);a--){let n=e[a];r.add(n.id),i+=t.get(n.id)??Ti(n.role,n.customType)}return r}function Ti(e,t){switch(e){case`user`:return 72;case`assistant`:return 280;case`tool-result`:return 120;case`custom`:return t===`file`?96:72;default:return 60}}function Ei(e,t,n,r){let i=n.get(e);return i&&i.len===t?i.h:r}var Di=(0,f.memo)(function({id:e,show:t,height:n,containerRef:r,onMeasured:i,lazyRef:a,children:o}){let s=(0,f.useRef)(null);return(0,f.useLayoutEffect)(()=>{if(!t)return;let n=s.current;if(!n)return;let r=n.offsetHeight;r>0&&i?.(e,r)},[t,e,i]),t?(0,Q.jsx)(`div`,{ref:a,"data-lazy-id":e,children:(0,Q.jsx)(`div`,{ref:s,children:o})}):(0,Q.jsx)(`div`,{ref:a,className:`msg-lazy-ph`,"data-msg-id":e,"data-lazy-id":e,style:{height:n},"aria-hidden":`true`})}),Oi=(0,f.memo)(function({message:e,client:t,seed:n}){let{t:r,tx:i}=$(),[a,o]=(0,f.useState)(!1);return(0,Q.jsxs)(`article`,{className:`msg msg-${e.role}`,"data-msg-id":e.owner.entity.id,children:[(0,Q.jsxs)(`header`,{className:`msg-meta`,children:[(0,Q.jsx)(`strong`,{className:`msg-role`,children:i(e.role)}),(0,Q.jsx)(`span`,{className:`msg-state`,children:r(`{state} message record, not execution outcome`,{state:i(e.state)})}),(0,Q.jsxs)(`span`,{className:`msg-time`,children:[`v`,e.version]}),(0,Q.jsxs)(`button`,{type:`button`,className:`msg-inspect`,"aria-expanded":a,onClick:()=>o(e=>!e),children:[a?(0,Q.jsx)(De,{"aria-hidden":`true`}):(0,Q.jsx)(xe,{"aria-hidden":`true`}),r(a?`Collapse`:`Inspect message`)]})]}),(0,Q.jsxs)(`div`,{className:`msg-body`,children:[(0,Q.jsx)(`p`,{className:`msg-ident`,children:r(`Child {child} · message {message} · version {version}`,{child:e.owner.childRunId??``,message:e.owner.entity.id,version:e.version})}),e.role===`tool-result`&&(0,Q.jsx)(`p`,{className:`msg-note`,children:r(`Result call: {call}. Kept visible independently of the tool card.`,{call:e.resultCallId??r(`unassociated / orphan`)})}),a&&(0,Q.jsx)(`div`,{className:`msg-text`,children:(0,Q.jsxs)(`div`,{className:`msg-text-main`,children:[e.finalText&&n.scope.kind!==`workspace`&&n.snapshotSeq!==null?(0,Q.jsx)(si,{client:t,cursor:Zr(n.storeId,n.scope,n.snapshotSeq,e.finalText)}):(0,Q.jsx)(`p`,{children:r(`No finalized text field in this snapshot. Inspect retained partial/final blocks and omission metadata below.`)}),(0,Q.jsxs)(`details`,{children:[(0,Q.jsx)(`summary`,{children:r(`All message blocks, source limits and tool associations`)}),(0,Q.jsx)(li,{client:t,seed:n,entityId:e.owner.entity.id})]})]})})]})]})});function ki({messages:e,client:t,seed:n}){let{t:r}=$(),i=(0,f.useRef)(null),a=(0,f.useRef)(!0),[o,s]=(0,f.useState)(()=>new Set),c=(0,f.useRef)(o);c.current=o;let l=(0,f.useRef)(new Map),u=(0,f.useRef)(new Map),d=(0,f.useRef)(new Map),p=(0,f.useRef)(0),m=(0,f.useMemo)(()=>e.map(e=>({id:e.owner.entity.id,role:e.role,message:e})),[e]),h=(0,f.useRef)(new Map);h.current=new Map(m.map(e=>[e.id,e.message.version]));let g=(0,f.useRef)(new Set);g.current=wi(m,l.current,1800);let _=(0,f.useCallback)((e,t)=>{let n=h.current.get(e);n!==void 0&&(u.current.set(e,{h:t,len:n}),l.current.set(e,t))},[]),v=(0,f.useCallback)(()=>{let e=i.current;if(!e)return;let t=e.getBoundingClientRect(),n=[];for(let[e,t]of d.current){let r=t.getBoundingClientRect();n.push({id:e,top:r.top,bottom:r.bottom}),c.current.has(e)||_(e,r.height)}let r=Si(n,{top:t.top-1200,bottom:t.bottom+1200},g.current,c.current,{top:t.top-2400,bottom:t.bottom+2400});for(let e of r.hide){let t=d.current.get(e);t&&_(e,t.offsetHeight)}s(e=>Ci(e,r))},[_]),y=(0,f.useCallback)(()=>{p.current||=requestAnimationFrame(()=>{p.current=0,v()})},[v]);return(0,f.useLayoutEffect)(()=>{m.length?v():s(new Set)},[v,m]),(0,f.useEffect)(()=>{let e=new ResizeObserver(y);return i.current&&e.observe(i.current),()=>{e.disconnect(),cancelAnimationFrame(p.current)}},[y]),(0,Q.jsxs)(`div`,{className:`messages-wrap`,children:[(0,Q.jsx)(`div`,{className:`messages`,ref:i,onScroll:e=>{let t=e.currentTarget;a.current=t.scrollHeight-t.scrollTop-t.clientHeight<80,y()},children:m.map(({id:e,role:r,message:a})=>(0,Q.jsx)(Di,{id:e,show:!o.has(e),height:Ei(e,a.version,u.current,r===`user`?100:280),containerRef:i,onMeasured:_,lazyRef:t=>{t?d.current.set(e,t):d.current.delete(e)},children:(0,Q.jsx)(Oi,{message:a,client:t,seed:n})},e))}),(0,Q.jsxs)(`button`,{type:`button`,className:`scroll-bottom`,onClick:()=>{i.current&&(i.current.scrollTop=i.current.scrollHeight,a.current=!0)},children:[(0,Q.jsx)(Ne,{"aria-hidden":`true`}),r(`Latest on loaded page`)]})]})}function Ai({client:e,seed:t}){let{t:n}=$(),r=$r(e,{...t,reader:`messages`}),i=r.page;return(0,Q.jsxs)(`section`,{className:`transcript`,children:[(0,Q.jsx)(ci,{pager:r}),i&&!(`kind`in i)&&(0,Q.jsxs)(Q.Fragment,{children:[i.records.length===0&&(0,Q.jsx)(`p`,{className:`empty-note panel-empty`,children:i.next?n(`No message records on this page; more history remains.`):n(`No message records on this page.`)}),(0,Q.jsx)(ki,{messages:i.records.filter(e=>e.kind===`message`),client:e,seed:i.request},`${i.request.snapshotSeq}:${i.request.after?.recordId??`first`}`)]})]})}function ji({open:e,onToggle:t,headClassName:n,titleText:r,icon:i,iconClassName:a,titleClassName:o,toggleClassName:s,toggle:c,onHeadContextMenu:l,children:u,after:d}){return(0,Q.jsxs)(`div`,{className:`chead ${n}`,children:[(0,Q.jsxs)(`button`,{type:`button`,className:`chead-main`,"aria-expanded":e,title:r,onClick:t,onContextMenu:l,children:[c===void 0?(0,Q.jsx)(`span`,{className:s?`chead-toggle ${s}`:`chead-toggle`,children:e?(0,Q.jsx)(ke,{}):(0,Q.jsx)(Oe,{})}):c,(0,Q.jsx)(`span`,{className:a?`chead-icon ${a}`:`chead-icon`,children:i}),(0,Q.jsx)(`span`,{className:o?`chead-title ${o}`:`chead-title`,children:u})]}),d]})}var Mi=(0,f.memo)(function({record:e,client:t,seed:n}){let{t:r,tx:i}=$(),[a,o]=(0,f.useState)(!1),s=e.result?e.result.isError?r(`SDK tool error observed`):r(`SDK tool end observed`):e.startObserved?r(`Start observed; end not observed in this snapshot`):r(`No start observed`),c=e.result?e.result.isError?`err`:`ok`:e.startObserved?`pending`:``;return(0,Q.jsxs)(`div`,{className:`toolcall${c===`err`?` err`:``}`,children:[(0,Q.jsx)(ji,{open:a,onToggle:()=>o(e=>!e),headClassName:`toolcall-head`,titleText:r(`Inspect recorded tool call`),icon:(0,Q.jsx)(re,{}),iconClassName:`toolcall-icon`,titleClassName:`toolcall-name`,after:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`toolcall-path`,children:r(`Child {child} · call {call} · v{version}`,{child:e.owner.childRunId??``,call:e.owner.entity.id,version:e.version})}),(0,Q.jsx)(`span`,{className:`toolcall-badge ${c}`,children:s})]}),children:e.name}),a&&(0,Q.jsxs)(`div`,{className:`toolcall-body`,children:[(0,Q.jsx)(`p`,{children:r(`SDK tool observations are not native process launch/close or passing parent checks.`)}),(0,Q.jsxs)(`dl`,{children:[(0,Q.jsx)(`dt`,{children:r(`Source ID`)}),(0,Q.jsxs)(`dd`,{children:[i(e.source.disposition),`:`,` `,e.source.value??r(`unavailable`)]}),(0,Q.jsx)(`dt`,{children:r(`Declaration`)}),(0,Q.jsx)(`dd`,{children:e.declaration?`${e.declaration.messageId} / ${e.declaration.blockId} (${i(String(e.declarationStage))})`:r(`No declaration recorded; orphan result remains accessible`)})]}),(0,Q.jsxs)(`div`,{className:`toolcall-output`,children:[(0,Q.jsx)(`div`,{className:`toolcall-output-label`,children:r(`Recorded tool end (not parsed from output)`)}),(0,Q.jsx)(`pre`,{children:e.result?JSON.stringify(e.result,null,2):r(`No end fact in this snapshot.`)})]}),(0,Q.jsx)(`div`,{className:`toolcall-args`,children:(0,Q.jsx)(li,{client:t,seed:n,entityId:e.owner.entity.id})})]})]})});function Ni({draft:e,onChange:t,context:n,roles:r,onSave:i,onGenerate:a,onStart:o,canSave:s,canAct:c}){let{t:l,tx:u}=$(),[d,p]=(0,f.useState)(!0),[m,h]=(0,f.useState)(null),[g,_]=(0,f.useState)(``),[v,y]=(0,f.useState)(``),[b,x]=(0,f.useState)(`research`),[S,C]=(0,f.useState)([]),[w,T]=(0,f.useState)(``),[E,ee]=(0,f.useState)(``),D=e.assignments,te=e=>{h(e.id),_(e.instructions),y(e.expectedOutput),x(e.purpose),C(e.dependencies),ee(``)},re=()=>{h(null),_(``),y(``),ee(``)},ie=n=>{let i=r?.find(e=>e.role===Ye(b));i?(t({...e,assignments:D.map(e=>e.id===n?{...e,purpose:b,instructions:g,expectedOutput:v,dependencies:S,role:i}:e)}),re()):ee(ur)},ae=()=>{let i=r?.find(e=>e.role===Ye(`research`));if(!i){ee(ur);return}let a=1;for(;D.some(e=>e.id===`assignment-${a}`);)a++;let o={id:`assignment-${a}`,purpose:`research`,instructions:``,expectedOutput:``,dependencies:[],role:i,model:n.model};t({...e,assignments:[...D,o]}),te(o)},oe=n=>{D.some(e=>e.dependencies.some(e=>e.source.kind===`current`&&e.source.assignmentId===n))?ee(`Remove dependent edges explicitly before deleting this assignment.`):t({...e,assignments:D.filter(e=>e.id!==n)})};return(0,Q.jsxs)(`section`,{className:`plan-board ${d?``:`plan-board-collapsed`}`,children:[(0,Q.jsx)(`div`,{className:`plan-board-head`,children:(0,Q.jsxs)(`button`,{type:`button`,className:`plan-board-head-main`,"aria-expanded":d,onClick:()=>p(!d),children:[(0,Q.jsx)(fe,{}),(0,Q.jsx)(`span`,{children:l(`Readable plan & decomposition`)}),(0,Q.jsx)(`span`,{children:l(`{count} required assignments`,{count:D.length})}),d?(0,Q.jsx)(De,{}):(0,Q.jsx)(ke,{})]})}),(0,Q.jsxs)(`div`,{className:`toolbar`,children:[(0,Q.jsx)(`button`,{type:`button`,disabled:!c||n.task?.kind!==`code`,onClick:a,children:l(`Preview readonly Generate proposal`)}),(0,Q.jsx)(`button`,{type:`button`,disabled:!s,onClick:i,children:l(`Preview Save plan`)}),(0,Q.jsx)(`button`,{type:`button`,className:`primary`,disabled:!c,onClick:o,children:l(`Preview Start saved graph`)})]}),(0,Q.jsx)(`p`,{children:l(`Draft changes never execute. Start uses the saved graph shown in its fresh preview, not unsaved text. Generated proposals never save or start themselves.`)}),D.some(e=>U(e.model)!==U(n.model))&&(0,Q.jsxs)(`section`,{children:[(0,Q.jsx)(`p`,{children:l(`Saved assignments name an old model selection. Reading does not rebind them.`)}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>t({...e,assignments:D.map(e=>({...e,model:n.model}))}),children:l(`Explicitly rebind draft to current model (requires new Save)`)})]}),!r&&(0,Q.jsx)(`p`,{role:`status`,children:u(`Current plan metadata unavailable. Observe again; historical text is not action authority.`)}),E&&(0,Q.jsx)(`p`,{role:`alert`,children:u(E)}),d&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`label`,{children:[l(`Readable plan`),(0,Q.jsx)(`textarea`,{"aria-label":l(`Readable plan`),value:e.readablePlan,onChange:n=>t({...e,readablePlan:n.target.value}),rows:8})]}),(0,Q.jsxs)(`details`,{children:[(0,Q.jsx)(`summary`,{children:l(`Read rendered plan`)}),(0,Q.jsx)(Vr,{text:e.readablePlan})]}),(0,Q.jsx)(Fr,{text:e.readablePlan}),(0,Q.jsx)(`ol`,{className:`plan-board-steps`,children:D.map(e=>(0,Q.jsxs)(`li`,{className:`plan-board-step`,children:[(0,Q.jsxs)(`div`,{className:`plan-step-head`,children:[(0,Q.jsx)(`strong`,{children:e.id}),(0,Q.jsxs)(`span`,{children:[u(e.purpose),` —`,` `,e.purpose===`edit`?l(`checkout writer`):l(`readonly`)]}),(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>te(e),children:[(0,Q.jsx)(Se,{}),` `,l(`Edit`)]}),(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>oe(e.id),children:[(0,Q.jsx)(ne,{}),` `,l(`Remove draft assignment`)]})]}),m===e.id?(0,Q.jsxs)(`div`,{className:`plan-step-edit`,children:[(0,Q.jsxs)(`label`,{children:[l(`Purpose`),(0,Q.jsx)(`select`,{value:b,onChange:e=>{let t=e.target.value;(t===`research`||t===`diagnosis`||t===`review`||t===`edit`&&n.task?.kind===`code`)&&x(t)},children:[`research`,`diagnosis`,`review`,`edit`].filter(e=>e!==`edit`||n.task?.kind===`code`).map(e=>(0,Q.jsx)(`option`,{value:e,children:u(e)},e))})]}),(0,Q.jsxs)(`label`,{children:[l(`Instructions`),(0,Q.jsx)(`textarea`,{"aria-label":l(`Instructions`),value:g,onChange:e=>_(e.target.value),rows:5})]}),(0,Q.jsxs)(`label`,{children:[l(`Expected output`),(0,Q.jsx)(`textarea`,{"aria-label":l(`Expected output`),value:v,onChange:e=>y(e.target.value),rows:3})]}),(0,Q.jsxs)(`fieldset`,{children:[(0,Q.jsx)(`legend`,{children:l(`Current-episode dependencies (whole final text by default)`)}),D.filter(t=>t.id!==e.id).map(e=>{let t=S.findIndex(t=>t.source.kind===`current`&&t.source.assignmentId===e.id);return(0,Q.jsxs)(`label`,{children:[(0,Q.jsx)(`input`,{type:`checkbox`,checked:t>=0,onChange:t=>C(n=>t.target.checked?[...n,{source:{kind:`current`,assignmentId:e.id},range:null,requireCompleteObservation:!1}]:n.filter(t=>t.source.kind!==`current`||t.source.assignmentId!==e.id))}),e.id]},e.id)})]}),S.map((e,t)=>(0,Q.jsxs)(`div`,{className:`dependency-editor`,children:[(0,Q.jsx)(`code`,{children:JSON.stringify(e.source)}),(0,Q.jsxs)(`label`,{children:[(0,Q.jsx)(`input`,{type:`checkbox`,checked:e.requireCompleteObservation,onChange:e=>C(n=>n.map((n,r)=>t===r?{...n,requireCompleteObservation:e.target.checked}:n))}),l(`Require complete observation`)]}),(0,Q.jsx)(`p`,{children:l(`Selection: {range}`,{range:e.range?l(`reviewed UTF-8 bytes {start}–{end}`,{start:e.range.start,end:e.range.end}):l(`whole final text; no silent clipping`)})}),(0,Q.jsxs)(`label`,{children:[l(`Reviewed edge JSON (range/null and exact historical identity)`),(0,Q.jsx)(`textarea`,{defaultValue:JSON.stringify(e),onBlur:e=>{try{let n=Ze(Be(e.target.value));C(e=>e.map((e,r)=>t===r?n:e)),ee(``)}catch{ee(`Invalid dependency. Original edge retained; review before Save.`)}}})]}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>C(e=>e.filter((e,n)=>t!==n)),children:l(`Remove edge`)})]},e.source.kind===`current`?e.source.assignmentId:e.source.childRunId)),(0,Q.jsxs)(`label`,{children:[l(`Explicit historical/advisory edge JSON`),(0,Q.jsx)(`textarea`,{value:w,onChange:e=>T(e.target.value),placeholder:l(`Exact committed run/child/result/version plus range and coverage requirement`)})]}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>{try{let e=Ze(Be(w));if(e.source.kind!==`historical`)throw Error();C(t=>[...t,e]),T(``),ee(``)}catch{ee(`Historical edge requires actual committed identity; no guessed result reference.`)}},children:l(`Add reviewed historical edge`)}),(0,Q.jsx)(`button`,{type:`button`,onClick:re,children:l(`Discard inline edits`)}),(0,Q.jsx)(`button`,{type:`button`,disabled:!!E,onClick:()=>ie(e.id),children:l(`Apply to local draft`)})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Vr,{text:e.instructions}),(0,Q.jsx)(`p`,{children:l(`Expected: {output}`,{output:e.expectedOutput})}),(0,Q.jsxs)(`p`,{children:[l(`Role {role}`,{role:e.role.role}),` /`,` `,(0,Q.jsx)(`code`,{children:e.role.sha256})]}),(0,Q.jsxs)(`p`,{children:[e.model.provider,`/`,e.model.model,` ·`,` `,e.model.thinking]}),(0,Q.jsx)(`pre`,{children:JSON.stringify(e.dependencies,null,2)})]})]},e.id))}),(0,Q.jsxs)(`button`,{type:`button`,disabled:!r||D.length>=16,onClick:ae,children:[(0,Q.jsx)(ce,{}),` `,l(`Add assignment`)]})]})]})}var Pi=`未命名章节`;function Fi(e){return String(e??``).trim().replace(/[\s\u3000]+/g,`-`).replace(/[^\p{L}\p{N}_-]+/gu,`-`).replace(/-{2,}/g,`-`).replace(/^-+|-+$/g,``).slice(0,80)||`section`}function Ii(e){let t=new Map;return e.map(({level:e,label:n})=>{let r=String(n??``).replace(/\s+/g,` `).trim(),i=Fi(r||Pi),a=(t.get(i)??0)+1;return t.set(i,a),{level:e,id:a===1?i:`${i}-${a}`,label:r||Pi}})}function Li(e){return e.length>=2}function Ri(e){let t=0,n=0;return e.split(`
|
|
5
|
-
`).map(e=>{let r={key:`text-offset:${t}`,number:++n,text:e};return t+=e.length+1,r})}function
|
|
6
|
-
`);return(0,f.useLayoutEffect)(()=>{if(n!==`markdown`)return;if(!e){l([]);return}let t=Array.from(m.current?.querySelectorAll(`h1,h2,h3,h4,h5,h6`)??[]),r=
|
|
7
|
-
`):e})]}),(0,Q.jsx)(`p`,{className:`fp-notice`,children:t(`Captured page only, not a current filesystem read. Line numbers are page-local. Full retained paging and copy are available above.`)}),(0,Q.jsx)(`div`,{style:{fontSize:`${o}em`},children:n===`markdown`?(0,Q.jsxs)(`div`,{className:`fp-toc-layout`,children:[Li(c)&&(0,Q.jsx)(`nav`,{className:`fp-toc`,"aria-label":t(`Page headings`),children:c.map(e=>(0,Q.jsx)(`button`,{type:`button`,className:`l${e.level}`,onClick:()=>m.current?.querySelector(`#${CSS.escape(`preview-${e.id}`)}`)?.scrollIntoView({block:`nearest`}),children:e.label},e.id))}),(0,Q.jsx)(`div`,{className:`fp-markdown-zoom`,ref:m,children:(0,Q.jsx)(Vr,{text:e})})]}):n===`diff`?(0,Q.jsx)(zi,{text:e}):(0,Q.jsx)(`div`,{className:`fp-code ${i?``:`no-wrap`}`,children:Ri(e).map(({text:e,number:n,key:r})=>(0,Q.jsxs)(`div`,{className:`fp-line ${u&&n>=u.start&&n<=u.end?`sel`:``}`,children:[(0,Q.jsx)(`button`,{type:`button`,className:`fp-num`,"aria-label":t(`Select page line {line}`,{line:n}),onClick:e=>{e.shiftKey||(p.current=n),d({start:Math.min(p.current,n),end:Math.max(p.current,n)})},children:n}),(0,Q.jsx)(`span`,{className:`fp-code-text`,children:e||` `})]},r))})}),u&&(0,Q.jsxs)(`footer`,{className:`fp-foot`,children:[t(`Selected page lines {start}–{end}`,{start:u.start,end:u.end}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>d(null),children:t(`Clear selection`)})]})]})}function Vi({client:e,seed:t}){let{t:n,tx:r}=$(),i=$r(e,t),[a,o]=(0,f.useState)(),s=i.page;return(0,Q.jsxs)(`section`,{className:`scm-body`,children:[(0,Q.jsx)(ci,{pager:i}),(0,Q.jsx)(`p`,{children:n(`Captured observations include pre-existing dirt. They do not attribute every change to Cadence; bounded fingerprints are not filesystem snapshots.`)}),(0,Q.jsx)(`div`,{className:`scm-files-list`,children:s&&!(`kind`in s)&&s.records.map(e=>{if(e.kind!==`owner-fact`)return null;let t=e.fact,i=t.kind===`changes`||t.kind===`review`?t.content:t.kind===`check-settled`?t.output:null;return(0,Q.jsxs)(`article`,{className:`scm-file`,children:[(0,Q.jsxs)(`h3`,{children:[t.kind,` · `,n(`committed #{seq}`,{seq:e.committedSeq})]}),(0,Q.jsx)(`pre`,{children:JSON.stringify(t,null,2)}),i&&(0,Q.jsx)(`button`,{type:`button`,onClick:()=>{s.request.scope.kind!==`workspace`&&s.request.snapshotSeq!==null&&o(Zr(s.request.storeId,s.request.scope,s.request.snapshotSeq,i))},children:n(`Inspect full retained {field}`,{field:r(i.field)})})]},e.recordId)})}),a&&(0,Q.jsx)(si,{client:e,cursor:a,render:e=>(0,Q.jsx)(Bi,{text:e})},`${a.recordId}:${a.recordVersion}`)]})}function Hi({client:e,taskId:t,seed:n,canAct:r,onAction:i,onObligations:a}){let{t:o,tx:s}=$(),[c,l]=(0,f.useState)(),[u,d]=(0,f.useState)(),[p,m]=(0,f.useState)(0),h=(0,f.useRef)(p);return h.current=p,(0,f.useEffect)(()=>{let n=p,r=new AbortController,i=!0;return l(void 0),e.checkObligations(t,r.signal).then(e=>{i&&h.current===n&&(e.kind===`error`?d(e.error.code):(d(void 0),l(e.value),a(e.value)))}).catch(()=>{i&&d(`Obligations unavailable.`)}),()=>{r.abort(),i=!1}},[e,t,p,a]),(0,Q.jsxs)(`section`,{children:[(0,Q.jsx)(`h3`,{children:o(`Current configured obligations`)}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>m(e=>e+1),children:o(`Observe obligations`)}),u&&(0,Q.jsx)(`p`,{role:`alert`,children:o(`Obligations unavailable: {error}`,{error:s(u)})}),c?.definitions.length===0&&(0,Q.jsx)(`p`,{children:o(`No configured obligations. This is not passing check coverage.`)}),c?.definitions.map(e=>(0,Q.jsxs)(`article`,{children:[(0,Q.jsxs)(`h4`,{children:[e.selection.name,`: `,s(e.status)]}),(0,Q.jsx)(`pre`,{children:e.selection.command}),(0,Q.jsx)(`p`,{children:o(`Timeout {timeout} ms. Native outcome and freshness remain separate.`,{timeout:e.selection.timeoutMs})}),(0,Q.jsx)(`button`,{type:`button`,disabled:!r,onClick:()=>i({kind:`check`,taskId:t,check:e.selection}),children:o(`Preview exact configured check`)})]},e.selection.name)),(0,Q.jsx)(`p`,{children:o(`Browser checks are configured selections only. Native-local manual commands are not a browser shell endpoint.`)}),(0,Q.jsx)(Vi,{client:e,seed:{...n,reader:`checks`}})]})}function Ui({client:e,storeId:t,taskId:n}){let{t:r,tx:i}=$(),[a,o]=(0,f.useState)(),[s,c]=(0,f.useState)(``),[l,u]=(0,f.useState)(0);return(0,f.useEffect)(()=>{if(l<0)return;let r=new AbortController;return o(void 0),c(``),e.currentChanges({storeId:t,taskId:n},r.signal).then(e=>{r.signal.aborted||(e.kind===`ok`?o(e.value):c(e.error.code))}).catch(()=>{r.signal.aborted||c(`Current observation unavailable`)}),()=>r.abort()},[e,t,n,l]),(0,Q.jsxs)(`section`,{"aria-label":r(`Current checkout changes`),children:[(0,Q.jsx)(`h3`,{children:r(`Current checkout changes (not a captured historical diff)`)}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>u(e=>e+1),children:r(`Observe current changes`)}),s&&(0,Q.jsx)(`p`,{role:`alert`,children:i(s)}),a&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{children:(0,Q.jsx)(xr,{text:r(`Fingerprint {identity} · {coverage} · includes pre-existing dirt; not attribution.`),slots:{identity:(0,Q.jsx)(`code`,{children:a.observation.identity}),coverage:a.observation.complete?r(`complete within bounded scope`):r(`incomplete coverage`)}})}),(0,Q.jsx)(`pre`,{children:JSON.stringify(a.coverage)}),(0,Q.jsx)(Bi,{text:a.text})]})]})}var Wi=[[`plan`,be],[`checks`,je],[`changes`,ge],[`review`,te]];function Gi(){let{t:e}=$();return(0,Q.jsx)(`aside`,{className:`panel panel-right`,children:(0,Q.jsx)(`p`,{className:`panel-empty`,children:e(`Select a task to inspect plans, checks, changes and review.`)})})}function Ki({client:e,context:t,seed:n,runs:r,canAct:i,onAction:a,planMetadata:o}){let{t:s,tx:c}=$(),l=t?U(t):`unavailable`,u=(0,f.useMemo)(()=>l===`unavailable`?null:et(Be(l)),[l]),[d,p]=(0,f.useState)(`plan`),[m,h]=(0,f.useState)({readablePlan:``,assignments:[]}),[g,_]=(0,f.useState)(),[v,y]=(0,f.useState)(),[b,x]=(0,f.useState)(),[S,C]=(0,f.useState)(),[w,T]=(0,f.useState)(``),[E,ee]=(0,f.useState)(!1),D=u?.task?.id??(n.scope.kind===`task`?n.scope.id:null),te=(0,f.useRef)(new gr);te.current.select(U({context:u,tab:d,draft:m,canAct:i})),(0,f.useEffect)(()=>()=>te.current.depart(),[]),(0,f.useEffect)(()=>{let e=!0;if(y(void 0),_(void 0),!o||!u)x(ur);else return o.read(u).then(t=>{e&&(t.kind===`error`?x(t.error.code):U(t.value.context)===l?(`kind`in t.value?_(t.value):y(t.value),x(void 0)):x(`Owner metadata is stale.`))}).catch(()=>{e&&x(`Owner metadata unavailable.`)}),()=>{e=!1}},[o,u,l]);let ne=(0,f.useCallback)(e=>C(e),[]);if(!D)return(0,Q.jsx)(Gi,{});let re={...n,scope:{kind:`task`,id:D}};return(0,Q.jsxs)(`aside`,{className:`panel panel-right`,children:[(0,Q.jsx)(`nav`,{className:`rp-tabs`,"aria-label":s(`Inspector`),children:Wi.map(([e,t])=>(0,Q.jsxs)(`button`,{type:`button`,className:`rp-tab`,"aria-label":c(e),"aria-pressed":d===e,onClick:()=>p(e),children:[(0,Q.jsx)(t,{"aria-hidden":`true`}),(0,Q.jsx)(`span`,{children:c(e)})]},e))}),(0,Q.jsxs)(`div`,{className:`inspector-body`,children:[d===`plan`&&(0,Q.jsxs)(Q.Fragment,{children:[b&&(0,Q.jsx)(`p`,{className:`inspector-note`,role:`status`,children:c(b)}),g&&(0,Q.jsxs)(`section`,{children:[(0,Q.jsxs)(`p`,{children:[s(`Saved graph proof in progress.`),` `,JSON.stringify(g.coverage)]}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>{if(!o||!u)return;let e=te.current.ticket();o.read(u,g.next).then(t=>{te.current.current(e)&&(t.kind===`error`?x(t.error.code):`kind`in t.value?_(t.value):(_(void 0),y(t.value)))})},children:s(`Continue saved graph read`)})]}),v&&(0,Q.jsx)(`button`,{type:`button`,onClick:()=>h({readablePlan:v.readablePlan,assignments:v.savedGraph?.assignments??[]}),children:s(`Load observed saved plan into local draft`)}),u?(0,Q.jsx)(Ni,{draft:m,onChange:h,context:u,roles:v?.roles??null,canAct:i,canSave:i&&!!v&&v.editable!==!1&&!!o,onGenerate:()=>a({kind:`generate-plan`,taskId:D}),onStart:()=>a({kind:`start`,taskId:D}),onSave:()=>{if(!o)return;let e=te.current.ticket();o.saveAction(u,structuredClone(m)).then(t=>{te.current.current(e)&&(t.kind===`error`?x(t.error.code):a(t.value))}).catch(()=>{te.current.current(e)&&x(`Plan proposal unavailable.`)})}}):(0,Q.jsx)(`p`,{children:s(`Current control context unavailable. Historical data is not action authority.`)})]}),d===`checks`&&(0,Q.jsx)(Hi,{client:e,taskId:D,seed:re,canAct:i,onAction:a,onObligations:ne}),d===`changes`&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Ui,{client:e,storeId:n.storeId,taskId:D}),(0,Q.jsx)(`h3`,{children:s(`Captured historical observations`)}),(0,Q.jsx)(Vi,{client:e,seed:{...re,reader:`changes`}})]}),d===`review`&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`h3`,{children:s(`Human review`)}),(0,Q.jsx)(`p`,{children:s(`Done records human acknowledgment, not execution success or certification. It cannot restart a blocked episode.`)}),(0,Q.jsxs)(`label`,{children:[s(`Episode to review`),(0,Q.jsxs)(`select`,{value:w,onChange:e=>T(e.target.value),children:[(0,Q.jsx)(`option`,{value:``,children:s(`Select an observed episode`)}),r.filter(e=>e.childRunId===null&&e.admission.kind!==`check`).map(e=>(0,Q.jsxs)(`option`,{value:e.runId,children:[e.runId,` · `,c(e.outcome??e.lifecycle)]},e.runId))]})]}),(0,Q.jsxs)(`label`,{children:[(0,Q.jsx)(`input`,{type:`checkbox`,checked:E,onChange:e=>ee(e.target.checked)}),s(`I acknowledge current unresolved issues if present; original results will not be rewritten.`)]}),(0,Q.jsx)(`button`,{type:`button`,disabled:!i||!u||!S||S.taskId!==D||!w,onClick:()=>{u&&S&&a({kind:`review`,taskId:D,runId:w,changesIdentity:u.observation.identity,checksRevision:S.revision,acceptIssues:E})},children:s(`Preview human review / Done`)}),!S&&(0,Q.jsx)(`p`,{children:s(`Observe current obligations in Checks before requesting review.`)}),(0,Q.jsx)(Vi,{client:e,seed:{...re,reader:`reviews`}})]})]})]})}function qi(e,t=new Set){let n=new Map(e.map(e=>[e.id,e])),r=new Map,i=[];for(let t of e)if(t.parentId&&n.has(t.parentId)){let e=r.get(t.parentId)??[];e.push(t),r.set(t.parentId,e)}else i.push(t);let a=e=>{let t=[],n=[...r.get(e)??[]],i=new Set;for(;n.length>0;){let e=n.shift();if(!e)break;if(i.has(e.id))continue;i.add(e.id),t.push(e);let a=r.get(e.id);a&&n.push(...a)}return t},o=[],s=new Set,c=new Set,l=(e,n)=>{if(s.has(e.id)||c.has(e.id))return;s.add(e.id);let i=r.get(e.id)??[],u=i.length>0,d=u&&t.has(e.id),f=0,p=!1,m=!1,h=!1;if(u){let t=a(e.id);if(f=t.length,p=t.some(e=>e.active),m=t.some(e=>e.failed),h=t.some(e=>e.unknown),d)for(let e of t)c.add(e.id)}if(o.push({c:e,depth:n,hasKids:u,isCollapsed:d,descendantCount:f,hasActive:p,hasFailure:m,hasUnknown:h}),!d)for(let e of i)l(e,n+1)};for(let e of i)l(e,0);for(let t of e)l(t,0);return o}function Ji({client:e,workspace:t,taskId:n,runs:r,onTask:i,onScope:a,onNew:o}){let s={reader:`tasks`,storeId:t.storeId,scope:{kind:`workspace`,id:t.workspaceId},snapshotSeq:null,after:null,limit:50},{t:c,tx:l}=$(),u=$r(e,s),[d,p]=(0,f.useState)(new Set),m=(0,f.useMemo)(()=>qi(r.map(e=>({id:e.childRunId??e.runId,parentId:e.childRunId?e.runId:null,label:e.assignmentId??e.admission.kind,active:e.lifecycle!==`settled`,failed:e.outcome===`failed`,unknown:e.outcome===`unknown`})),d),[r,d]),h=u.page&&!(`kind`in u.page)?u.page.records:null,g=h?.filter(e=>e.kind===`task`).length,_=g===void 0?``:` (${g}${u.page&&!(`kind`in u.page)&&u.page.next||u.canPrevious?`+`:``})`;return(0,Q.jsxs)(`aside`,{className:`panel panel-left lp-panel`,children:[(0,Q.jsxs)(`section`,{className:`lp-section grow`,children:[(0,Q.jsxs)(`header`,{className:`lp-section-header`,children:[(0,Q.jsxs)(`h2`,{className:`lp-section-title`,children:[c(`Tasks`),_]}),(0,Q.jsx)(`div`,{className:`lp-section-actions`,children:(0,Q.jsx)(`button`,{type:`button`,className:`lp-section-action`,"aria-label":c(`New task`),title:c(`New task`),onClick:o,children:(0,Q.jsx)(ce,{"aria-hidden":`true`})})})]}),(0,Q.jsxs)(`nav`,{"aria-label":c(`Tasks`),className:`lp-section-body task-list`,children:[h?.map(e=>e.kind===`task`?(0,Q.jsxs)(`button`,{type:`button`,className:`session-item${e.owner.taskId===n?` active`:``}`,"aria-current":e.owner.taskId===n?`true`:void 0,title:e.goal,onClick:()=>i(e.owner.taskId),children:[(0,Q.jsx)(`span`,{className:`session-icon`,children:(0,Q.jsx)(be,{"aria-hidden":`true`})}),(0,Q.jsxs)(`span`,{className:`session-info`,children:[(0,Q.jsx)(`span`,{className:`session-title`,children:e.goal}),` `,(0,Q.jsxs)(`span`,{className:`session-sub`,children:[e.owner.taskId,` · v`,e.version]})]})]},e.owner.taskId):null),g===0&&(0,Q.jsx)(`p`,{className:`panel-empty`,children:c(`No retained task on this page.`)}),(0,Q.jsx)(ci,{pager:u})]}),(0,Q.jsx)(`p`,{className:`panel-hint`,children:c(`One checkout owner. Open/history never executes.`)})]}),n&&(0,Q.jsxs)(`section`,{className:`lp-section episodes`,children:[(0,Q.jsx)(`header`,{className:`lp-section-header`,children:(0,Q.jsx)(`h3`,{className:`lp-section-title`,children:c(`Active and recent episodes`)})}),(0,Q.jsxs)(`div`,{className:`lp-section-body`,children:[(0,Q.jsxs)(`nav`,{"aria-label":c(`Runs and assignments`),children:[m.map(e=>{let t=e.c.failed?`failed`:e.c.unknown?`unknown`:e.c.active?`active`:`settled`;return(0,Q.jsxs)(`div`,{className:`ep-row`,style:{paddingInlineStart:`${e.depth*16}px`},children:[e.hasKids?(0,Q.jsx)(`button`,{type:`button`,className:`ep-toggle`,"aria-label":c(`Toggle assignments`),"aria-expanded":!e.isCollapsed,onClick:()=>p(t=>{let n=new Set(t);return n.has(e.c.id)?n.delete(e.c.id):n.add(e.c.id),n}),children:e.isCollapsed?(0,Q.jsx)(Oe,{"aria-hidden":`true`}):(0,Q.jsx)(ke,{"aria-hidden":`true`})}):(0,Q.jsx)(`span`,{className:`ep-toggle-spacer`,"aria-hidden":`true`}),(0,Q.jsxs)(`button`,{type:`button`,className:`session-item`,onClick:()=>a({kind:e.c.parentId?`child`:`run`,id:e.c.id}),children:[(0,Q.jsxs)(`span`,{className:`session-info`,children:[(0,Q.jsx)(`span`,{className:`session-title`,children:e.c.label}),e.isCollapsed&&` `,e.isCollapsed&&(0,Q.jsx)(`span`,{className:`session-sub session-outcome`,children:`${c(`{count} descendants`,{count:e.descendantCount})}${e.hasFailure?c(` / failed child`):``}${e.hasUnknown?c(` / unknown child`):``}`})]}),` `,(0,Q.jsx)(`span`,{className:`ep-state ${t}`,children:l(t)})]})]},e.c.id)}),m.length===0&&(0,Q.jsx)(`p`,{className:`panel-empty`,children:c(`No active or recent episode observed.`)})]}),(0,Q.jsxs)(`button`,{type:`button`,className:`ghost ep-all`,onClick:()=>a({kind:`task`,id:n}),children:[(0,Q.jsx)(fe,{"aria-hidden":`true`}),c(`All retained episodes for task`)]})]})]})]})}function Yi(e,t){let n=new URL(window.location.origin+window.location.pathname),r=new URLSearchParams({task:B(e)});if(t){let{navigation:e,...n}=t;r.set(`detail`,JSON.stringify(n))}return n.hash=r.toString(),n.href}function Xi(){try{let e=new URLSearchParams(window.location.hash.slice(1)),t=B(e.get(`task`)),n=e.get(`detail`);if(!n)return{taskId:t};let r=J(Be(n));return r.navigation?null:{taskId:t,cursor:r}}catch{return null}}function Zi(e){let t=e.start.above+e.start.below,n=Math.max(1,e.availablePx)/(e.totalWeight>0?e.totalWeight:1),r=e.minAbovePx/n,i=e.minBelowPx/n;if(r+i>=t){let n=e.minAbovePx+e.minBelowPx||1,r=t*e.minAbovePx/n;return{above:r,below:t-r}}let a=Math.min(t-i,Math.max(r,e.start.above+e.deltaPx/n));return{above:a,below:t-a}}function Qi({side:e,width:t,onResize:n}){let{t:r}=$(),i=(0,f.useRef)(void 0);return(0,f.useEffect)(()=>()=>i.current?.(),[]),(0,Q.jsx)(`input`,{type:`range`,min:220,max:600,step:20,value:t,onChange:e=>n(Number(e.target.value)),className:`resize-handle`,tabIndex:0,"aria-orientation":`vertical`,"aria-label":r(e===`left`?`Resize left pane`:`Resize right pane`),"aria-valuemin":220,"aria-valuemax":600,"aria-valuenow":t,onDoubleClick:()=>n(e===`left`?260:360),onPointerDown:r=>{r.preventDefault(),i.current?.();let a=r.clientX,o=window.innerWidth,s=r=>{let i=Zi({start:{above:t,below:Math.max(1,o-t)},deltaPx:(r.clientX-a)*(e===`left`?1:-1),availablePx:o,totalWeight:o,minAbovePx:220,minBelowPx:320});n(Math.min(600,i.above))},c=()=>{window.removeEventListener(`pointermove`,s),window.removeEventListener(`pointerup`,c),window.removeEventListener(`pointercancel`,c),i.current=void 0};i.current=c,window.addEventListener(`pointermove`,s),window.addEventListener(`pointerup`,c,{once:!0}),window.addEventListener(`pointercancel`,c,{once:!0})}})}function $i(e,t,n,r){(0,f.useEffect)(()=>{if(!n||!t)return;let i=e.current?.querySelector(`.drawer-${t}`),a=document.activeElement,o=()=>Array.from(i?.querySelectorAll(`button:not(:disabled),input,textarea,select,a[href],[tabindex="0"]`)??[]).filter(e=>e.getClientRects().length>0);(o()[0]??i)?.focus();let s=e=>{if(e.key===`Escape`&&(e.preventDefault(),r()),e.key===`Tab`){let t=o(),n=t[0],r=t[t.length-1];if(!n){e.preventDefault();return}e.shiftKey&&document.activeElement===n?(e.preventDefault(),r.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),n.focus())}};return i?.addEventListener(`keydown`,s),()=>{i?.removeEventListener(`keydown`,s),a instanceof HTMLElement&&a.isConnected&&a.focus()}},[e,t,n,r])}var ea=.4,ta=1.05;function na(e){return Math.min(300,e*.86)}function ra(e,t,n){return n||(t<=144?null:e<=72?`left`:t-e<=72?`right`:null)}function ia(e,t){let n=Math.abs(e),r=Math.abs(t);return n<12&&r<12?`none`:n>r*1.2?`horizontal`:`vertical`}function aa(e,t){return e===`left`?t:-t}function oa(e,t){return Math.max(-e,Math.min(0,-e+t))}function sa(e,t,n){let r=n?e+t:t;return Math.max(0,Math.min(1,r/e))}function ca(e){let{wasOpen:t,pull:n,width:r,durationMs:i}=e;return i<=320&&Math.abs(n)>=48?n>0:sa(r*ta,n,t)>=ea}var la=new Set([`auto`,`scroll`,`overlay`]);function ua(e,t){let n=e instanceof Element?e:null;for(;n;){if(n instanceof HTMLElement&&n.scrollWidth>n.clientWidth+4&&la.has(getComputedStyle(n).overflowX))return!0;if(n===t)break;n=n.parentElement}return!1}function da(){let e=e=>{e.stopPropagation(),e.preventDefault()};window.addEventListener(`click`,e,{capture:!0,once:!0}),setTimeout(()=>window.removeEventListener(`click`,e,{capture:!0}),400)}function fa(e){let{enabled:t,open:n,onOpenChange:r,container:i}=e,{panelSelector:a,backdropSelector:o}=e;(0,f.useEffect)(()=>{let e=i.current;if(!t||!e)return;let s=null,c=`none`,l=0,u=0,d=0,f=0,p=!1,m=0,h=0,g=null,_=null,v=()=>{g&&(g.classList.remove(`drawer-dragging`),g.style.transform=``),_&&(_.style.opacity=``),s=null,c=`none`,g=null,_=null,f=0,p=!1},y=t=>{if(v(),t.touches.length!==1)return;let r=t.touches[0];if(!r)return;let i=ra(r.clientX,window.innerWidth,n);i&&!ua(t.target,e)&&(s=i,l=r.clientX,u=r.clientY,d=Date.now())},b=t=>{let r=s;if(!r||t.touches.length!==1)return;let i=t.touches[0];if(!i)return;let d=i.clientX-l,v=i.clientY-u;if(c===`none`){let t=ia(d,v);if(t===`none`)return;if(t===`vertical`){s=null;return}c=`horizontal`,p=n===r,m=na(window.innerWidth),h=m*ta;let i=e.querySelector(a?a(r):`.panel-drawer.drawer-${r}`);if(!i){s=null;return}g=i,_=o===null?null:e.querySelector(o??`.drawer-backdrop`),i.classList.add(`drawer-dragging`)}let y=g;if(!y)return;f=aa(r,d);let b=oa(h,p?h+f:f);y.style.transform=`translateX(${r===`left`?b:-b}px)`,_&&(_.style.opacity=String(sa(h,f,p))),t.preventDefault()},x=()=>{let e=s,t=c===`horizontal`&&e!==null&&g!==null,i=f,a=Date.now()-d,o=t?ca({wasOpen:p,pull:i,width:m,durationMs:a}):!1;v(),t&&e&&o!==(n===e)&&(da(),r(o?e:null))},S=()=>v();return e.addEventListener(`touchstart`,y,{passive:!0}),e.addEventListener(`touchmove`,b,{passive:!1}),e.addEventListener(`touchend`,x),e.addEventListener(`touchcancel`,S),()=>{v(),e.removeEventListener(`touchstart`,y),e.removeEventListener(`touchmove`,b),e.removeEventListener(`touchend`,x),e.removeEventListener(`touchcancel`,S)}},[t,n,r,i,a,o])}function pa(e,t,n,r,i=`en`){let a=(e,t)=>br(i,e,t),o=t.filter(e=>e.kind===`owner-fact`||e.kind===`capture-fact`),s=o.map((e,t)=>{let n=e.kind===`owner-fact`?e.fact.kind:e.capture.event.kind,r=e.kind===`capture-fact`?e.link.childRunId:null,o=n.startsWith(`tool`)?`tools`:n.startsWith(`message`)?`model`:`input`;return{key:e.recordId,lane:o,group:`${r??`owner`}:${o}`,groupLabel:`${r??a(`Owner`)} · ${br(i,o)}`,kind:o===`tools`?`tool`:o===`model`?`text`:`system`,title:`#${e.committedSeq} ${n}`,summary:n,source:a(`Committed #{seq}; {who}`,{seq:e.committedSeq,who:r??a(`owner`)}),status:a(`recorded fact`),clock:e.kind===`capture-fact`?a(`Worker-local monotonic observations ({child}): {first}–{last} ms; not aligned to other workers.`,{child:e.link.childRunId,first:e.capture.source.firstObservedMs,last:e.capture.source.lastObservedMs}):a(`Owner observation ({epoch}): {ms} ms; clock origin not established by this reader.`,{epoch:e.link.epoch,ms:e.observedMs}),...e.kind===`owner-fact`&&e.fact.kind===`check-settled`?{dur:e.fact.native.durationMs}:{},t:t*1e3,end:t*1e3}}),c;return{lang:i,onData(e){return c=e,()=>{c=void 0}},readState(){c?.({kind:`state`,conversations:[{id:e,title:a(`{scope} — loaded committed page`,{scope:e}),isStreaming:!1,segCount:s.length}],activeId:e})},readSegments(t){t===e&&c?.({kind:`segs`,convId:t,segs:s,reset:!0})},readSegment(t,n){let r=s.findIndex(e=>e.key===n);t!==e||r<0||c?.({kind:`seg_detail`,convId:t,key:n,seg:s[r],detail:JSON.stringify(o[r],null,2),analysis:{position:a(`Committed sequence {seq}; page ordinal {ordinal}. Timing shown in raw facts only; clocks may not be comparable.`,{seq:o[r].committedSeq,ordinal:r+1})}})},openDetail(t,r){let i=o.find(e=>e.recordId===r);t===e&&i&&n(i)},searchHistory:r}}var ma=`modulepreload`,ha=function(e){return`/`+e},ga={},_a=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=ha(t,n),t=s(t),t in ga)return;ga[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:ma,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})};function va({client:e,seed:t,onSearch:n}){let{t:r}=$(),i=$r(e,{...t,reader:`events`}),a=i.page;return(0,Q.jsxs)(`section`,{className:`timeline-view`,children:[(0,Q.jsx)(`p`,{children:r(`Committed order, not wall time. Replay advances visualization only. Raw observations retain clock/sequence provenance; unknown timing is not reconstructed.`)}),(0,Q.jsx)(ci,{pager:i}),a&&!(`kind`in a)&&(0,Q.jsx)(ya,{client:e,seed:a.request,records:a.records,onSearch:n},`${a.request.snapshotSeq}:${a.request.after?.recordId??`first`}`)]})}function ya({client:e,seed:t,records:n,onSearch:r}){let{t:i,locale:a}=$(),o=(0,f.useRef)(null),[s,c]=(0,f.useState)(!1),[l,u]=(0,f.useState)(!1),d=(0,f.useRef)(r);return d.current=r,(0,f.useEffect)(()=>{let e=!1,r;return _a(()=>import(`./timeline-client.js`).then(i=>{!e&&o.current&&(r=i.default.mount(o.current,pa(t.scope.id,n,()=>c(!0),()=>d.current(),a)))}),[]).catch(()=>{e||u(!0)}),()=>{e=!0,r?.()}},[n,t.scope.id,a]),(0,Q.jsxs)(Q.Fragment,{children:[l&&(0,Q.jsx)(`p`,{role:`alert`,children:i(`Bundled timeline unavailable; retained events remain accessible, no CDN fallback.`)}),(0,Q.jsx)(`div`,{className:`timeline-mount`,ref:o}),s&&(0,Q.jsx)(li,{client:e,seed:t})]})}var ba=[[`messages`,le],[`tools`,re],[`context`,me],[`timeline`,Ee],[`runs`,ve],[`outcomes`,Me]];function xa({api:e,planMetadata:t}){let{t:n,tx:r,locale:i,setLocale:a}=$(),[o]=(0,f.useState)(()=>e??cr()),[s,c]=(0,f.useState)(!1),[l,u]=(0,f.useState)(!1),[d]=(0,f.useState)(Xi),[p,m]=(0,f.useState)(d?.taskId??null),[h,g]=(0,f.useState)(d?{kind:`task`,id:d.taskId}:null),_=hr(o,p?{kind:`task`,id:p}:null,!l),v={state:_.observation,transportStatus:_.transportStatus,error:_.error,refresh:_.refresh},y=_.workspace?.storeId,b=(0,f.useMemo)(()=>t??(y?dr(o.client,y):void 0),[t,o,y]),x=v.state?.snapshot.scope.kind===`task`&&v.state.snapshot.scope.id===p?v.state.snapshot.context:void 0,S=x?.status===`available`?x.version:null,C=_.actions&&v.state?.connection===`current`&&v.transportStatus===`current`&&!!S&&S.epoch===_.workspace?.epoch,[w,T]=(0,f.useState)(null),[E,ee]=(0,f.useState)(!1),D=(0,f.useRef)(null),[te,ne]=(0,f.useState)(260),[re,oe]=(0,f.useState)(360),le=(0,f.useCallback)(()=>T(null),[]);(0,f.useEffect)(()=>{let e=matchMedia(`(max-width: 900px)`),t=()=>ee(e.matches);return t(),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]),fa({enabled:E&&!l,open:w,onOpenChange:T,container:D}),$i(D,w,E&&!l,le);let[fe,me]=(0,f.useState)(`messages`),[ge,ve]=(0,f.useState)(!1),[be,xe]=(0,f.useState)(!1),[Se,Te]=(0,f.useState)(),[Ee,De]=(0,f.useState)(d?.cursor),[Oe,ke]=(0,f.useState)(!1),[Ae,je]=(0,f.useState)(``),[Me,Ne]=(0,f.useState)(`code`),[Pe,Fe]=(0,f.useState)(),[O,Ie]=(0,f.useState)(!1),[k,Le]=(0,f.useState)(``),[A,j]=(0,f.useState)([]),[M,N]=(0,f.useState)(new Set),P=(0,f.useRef)(!0),F=e=>{P.current&&j(t=>{let n=t.findIndex(t=>t.commandId===e.commandId);return n<0?[...t,e]:t.map((t,r)=>r===n?fr(t,e):t)})},I=(0,f.useRef)(new gr),L=U({taskId:p,scope:h,detached:l,context:S,attachment:_.attachmentVersion,workspaceContext:_.workspace?.context??null,observationError:_.error??null});I.current.select(L);let[R,z]=(0,f.useState)(L);R!==L&&(z(L),Ie(!1),Fe(void 0)),(0,f.useEffect)(()=>(P.current=!0,()=>{P.current=!1,I.current.depart()}),[]);let B=Pe?.preflight.preview.action.kind===`create`?_.workspace?.context.status===`available`?_.workspace.context.version:null:S,V=async e=>{let t=e.kind===`create`?_.workspace?.context.status===`available`?_.workspace.context.version:null:S;if(!_.actions||!t||O||l){Le(n(`Current action context unavailable; observe again.`));return}I.current.depart();let r=I.current.ticket();Ie(!0),Le(``);try{let i=await Wn(o.client,t,e);if(!I.current.current(r))return;i.kind===`error`?Le(n(`Preflight refused: {code}`,{code:i.error.code})):Fe(i.value)}catch{I.current.current(r)&&Le(n(`Preflight unavailable. No automatic retry.`))}finally{I.current.current(r)&&Ie(!1)}},H=e=>{I.current.depart(),Fe(void 0),Ie(!1),m(e),g({kind:`task`,id:e}),Te(void 0),De(void 0),me(`messages`),le(),history.replaceState(null,``,Yi(e))};(0,f.useEffect)(()=>{let e=()=>{let e=Xi();e&&(I.current.depart(),Fe(void 0),Ie(!1),m(e.taskId),g({kind:`task`,id:e.taskId}),Te(void 0),De(e.cursor),me(`messages`),le())};return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},[le]);let Re=e=>{I.current.depart(),Fe(void 0),Ie(!1),g(e),Te(void 0),De(void 0),me(e.kind===`task`?`runs`:`messages`),le()},ze=v.state?.snapshot.committedSeq??_.workspace?.committedSeq,Be=_.workspace?.storeId,W=h&&Be&&ze?{storeId:Be,scope:h,snapshotSeq:ze,reader:`messages`,after:null,limit:50}:null,Ve=h&&Be&&ze?{storeId:Be,scope:h,snapshotSeq:ze,query:null,recordId:null,recordVersion:null,field:null,offset:0}:null,He=x?v.state?.snapshot.runs??[]:[],Ue=I.current.ticket(),We=e=>{F(e),e.receipt&&I.current.current(Ue)&&(_.refresh(),e.receipt.created?.state===`published`&&H(e.receipt.created.taskId))},Ge=e=>{if(M.has(e)||!_.cancelCompatible||!_.activeRuns)return;let t=crypto.randomUUID(),r=_.activeRuns.epoch;N(t=>new Set(t).add(e)),F({commandId:t,error:n(`Stop requested; settlement is not yet confirmed.`)}),o.client.cancel({commandId:t,epoch:r,runId:e}).then(e=>{We(e.kind===`ok`?{commandId:t,receipt:e.value}:{commandId:t,error:n(`{code}; cancellation effect {effect}. Observe exact receipt.`,{code:e.error.code,effect:e.error.effect})})}).catch(()=>F({commandId:t,error:n(`Cancellation effect uncertain. Observe exact receipt.`)})).finally(()=>{P.current&&N(t=>{let n=new Set(t);return n.delete(e),n})})};if(l)return(0,Q.jsxs)(`main`,{className:`entry`,children:[(0,Q.jsx)(`span`,{className:`empty-logo`,"aria-hidden":`true`,children:`C`}),(0,Q.jsx)(`h1`,{children:n(`Detached`)}),(0,Q.jsx)(`p`,{children:n(`Accepted service work continues. No Cancel was requested.`)}),A.map(e=>(0,Q.jsxs)(`p`,{children:[n(`Observe command after reconnect:`),` `,(0,Q.jsx)(`code`,{children:e.commandId})]},e.commandId)),(0,Q.jsx)(`button`,{type:`button`,className:`primary`,onClick:()=>u(!1),children:n(`Reconnect as a viewer`)})]});let Ke=_.activeRuns,qe=Ke?.status===`complete`?Ke.runs:[],Je=v.state?.connection??(_.workspace?p?`Task snapshot not observed yet`:`No task selected`:`Service unavailable`);return(0,Q.jsxs)(`div`,{className:`app`,children:[(0,Q.jsxs)(`header`,{className:`topbar`,children:[(0,Q.jsx)(`button`,{type:`button`,className:`panel-toggle`,"aria-label":n(`Tasks`),onClick:()=>T(e=>e===`left`?null:`left`),children:(0,Q.jsx)(ue,{"aria-hidden":`true`})}),(0,Q.jsxs)(`div`,{className:`topbar-flow`,children:[(0,Q.jsxs)(`span`,{className:`brand`,children:[(0,Q.jsx)(`span`,{className:`brand-logo`,"aria-hidden":`true`,children:`C`}),(0,Q.jsx)(`h1`,{className:`brand-name`,children:`Cadence`})]}),_.workspace&&(0,Q.jsxs)(`span`,{className:`chip static chip-root`,title:_.workspace.rootLabel,children:[(0,Q.jsx)(ye,{"aria-hidden":`true`}),(0,Q.jsx)(`span`,{children:_.workspace.rootLabel})]}),(0,Q.jsx)(`span`,{className:`tb-spacer`,"aria-hidden":`true`}),(0,Q.jsx)(`nav`,{className:`tb-tabs`,"aria-label":n(`Recorded views`),children:ba.map(([e,t])=>(0,Q.jsxs)(`button`,{type:`button`,className:`tb-tab`,"aria-label":r(e),"aria-pressed":fe===e,onClick:()=>{De(void 0),Te(void 0),me(e)},children:[(0,Q.jsx)(t,{"aria-hidden":`true`}),(0,Q.jsx)(`span`,{children:r(e)})]},e))}),(0,Q.jsx)(`span`,{className:`tb-spacer`,"aria-hidden":`true`}),(0,Q.jsxs)(`div`,{className:`tb-actions`,children:[(0,Q.jsx)(xi,{disabled:!Ve,onOpen:()=>ve(!0)}),(0,Q.jsx)(`button`,{type:`button`,className:`chip`,"aria-label":n(`Export selected scope`),"data-tip":n(`Export selected scope`),disabled:!W,onClick:()=>xe(!0),children:(0,Q.jsx)(Ce,{"aria-hidden":`true`})}),(0,Q.jsx)(`button`,{type:`button`,className:`chip`,"aria-label":n(`Copy token-free link`),"data-tip":n(`Copy token-free link`),disabled:!p,onClick:()=>{p&&Nr(Yi(p,Ee)).then(e=>Le(e?``:n(`Link copy unavailable.`)))},children:(0,Q.jsx)(pe,{"aria-hidden":`true`})}),(0,Q.jsx)(`button`,{type:`button`,className:`chip`,"aria-label":n(`Observe current state`),"data-tip":n(`Observe current state`),onClick:()=>{_.refresh(),v.refresh()},children:(0,Q.jsx)(se,{"aria-hidden":`true`})}),(0,Q.jsxs)(`button`,{type:`button`,className:`chip`,"aria-label":n(`Choose owner model`),"data-tip":n(`Choose owner model`),onClick:()=>c(!0),children:[(0,Q.jsx)(we,{"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`chip-label`,children:n(`Model`)})]}),(0,Q.jsxs)(`button`,{type:`button`,className:`chip`,"aria-label":n(`Return — work continues`),"data-tip":n(`Return — accepted work continues`),onClick:()=>{Fe(void 0),T(null),ve(!1),xe(!1),I.current.depart(),Ie(!1),u(!0)},children:[(0,Q.jsx)(de,{"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`chip-label`,children:n(`Return`)})]}),(0,Q.jsxs)(`button`,{type:`button`,className:`chip chip-lang`,lang:i===`zh`?`en`:`zh-CN`,"aria-label":i===`zh`?`Switch to English`:`切换到中文`,"data-tip":i===`zh`?`Switch to English`:`切换到中文`,onClick:()=>a(i===`zh`?`en`:`zh`),children:[(0,Q.jsx)(he,{"aria-hidden":`true`}),(0,Q.jsx)(`span`,{children:i===`zh`?`EN`:`中文`})]})]})]}),(0,Q.jsxs)(`button`,{type:`button`,className:`panel-toggle has-label`,"aria-label":n(`Plan / review`),onClick:()=>T(e=>e===`right`?null:`right`),children:[(0,Q.jsx)(ae,{"aria-hidden":`true`}),(0,Q.jsx)(`span`,{children:n(`Plan`)})]})]}),qe.length>0&&(0,Q.jsx)(`section`,{className:`run-strip`,"aria-label":n(`Execution and cancellation`),children:qe.map(e=>(0,Q.jsxs)(`div`,{className:`run-strip-row`,children:[(0,Q.jsx)(`span`,{className:`status-dot busy`,"aria-hidden":`true`}),(0,Q.jsxs)(`span`,{className:`run-strip-label`,children:[r(e.kind),` `,e.runId,` · `,r(e.stage)]}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>H(e.taskId),children:n(`Open active task`)}),(0,Q.jsxs)(`button`,{type:`button`,className:`danger`,disabled:!_.cancelCompatible||M.has(e.runId),onClick:()=>Ge(e.runId),children:[(0,Q.jsx)(ie,{"aria-hidden":`true`}),n(`Cancel run — request stop`)]})]},e.runId))}),(k||_.error)&&(0,Q.jsxs)(`p`,{className:`banner-notice`,role:`alert`,children:[n(`{message}.`,{message:k||r(_.error??``)}),` `,!k&&_.error===`stale`&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(xr,{text:n(`The service no longer matches the sources it loaded, for example after Pi's {file} changed; restart it to reload them: {restart} (or {stop} then {start}).`),slots:{file:(0,Q.jsx)(`code`,{children:`models.json`}),restart:(0,Q.jsx)(`code`,{children:`systemctl --user restart cadence`}),stop:(0,Q.jsx)(`code`,{children:`cadence-service stop`}),start:(0,Q.jsx)(`code`,{children:`start`})}}),` `]}),(0,Q.jsx)(xr,{text:n(`Explicit service guidance: {status} / {start}. No service is started by this page.`),slots:{status:(0,Q.jsx)(`code`,{children:`cadence-service status`}),start:(0,Q.jsx)(`code`,{children:`cadence-service start --workspace <path>`})}})]}),(0,Q.jsxs)(`div`,{ref:D,className:`layout`,style:{"--left-w":`${te}px`,"--right-w":`${re}px`},children:[(0,Q.jsx)(`button`,{type:`button`,"aria-label":n(`Close drawer`),tabIndex:-1,className:`drawer-backdrop persistent${w?` on`:``}`,onClick:le}),(0,Q.jsx)(`section`,{className:`panel-drawer drawer-left${w===`left`?` open`:``}`,"aria-label":n(`Task navigation drawer`),tabIndex:-1,inert:E&&w!==`left`,children:_.workspace&&(0,Q.jsx)(Ji,{client:o.client,workspace:_.workspace,taskId:p,runs:He,onTask:H,onScope:Re,onNew:()=>{le(),ke(!0)}})}),(0,Q.jsx)(Qi,{side:`left`,width:te,onResize:ne}),(0,Q.jsxs)(`main`,{className:`main`,inert:E&&w!==null,children:[h&&(0,Q.jsxs)(`p`,{className:`scope-bar`,children:[(0,Q.jsx)(_e,{"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`scope-kind`,children:n(`Selected {kind}:`,{kind:r(h.kind)})}),(0,Q.jsx)(`code`,{children:h.id}),(0,Q.jsx)(`span`,{children:n(`· snapshot {seq}.`,{seq:ze??``})}),(0,Q.jsx)(`span`,{className:`scope-hint`,children:n(`Pages and old outcomes are historical observations, not renewed consent.`)})]}),(0,Q.jsxs)(`div`,{className:`workspace-content`,children:[!W&&(0,Q.jsxs)(`section`,{className:`empty-state`,children:[(0,Q.jsx)(`span`,{className:`empty-logo`,"aria-hidden":`true`,children:`C`}),(0,Q.jsx)(`h2`,{children:n(`Open a task or create one explicitly`)}),(0,Q.jsx)(`p`,{children:n(`Plans, children, checks and human review share one service owner. No chat or discovery activates execution.`)}),(0,Q.jsxs)(`button`,{type:`button`,className:`primary`,disabled:!_.workspace,onClick:()=>ke(!0),children:[(0,Q.jsx)(ce,{"aria-hidden":`true`}),n(`Create task`)]})]}),W&&Ee?(0,Q.jsxs)(`div`,{className:`tab-body`,children:[Se&&(Se.owner.entity.kind===`task`||Se.owner.entity.kind===`message`||Se.owner.entity.kind===`tool`)&&(0,Q.jsx)(ui,{client:o.client,seed:{storeId:Ee.storeId,scope:Ee.scope,snapshotSeq:Ee.snapshotSeq,kind:Se.owner.entity.kind,id:Se.owner.entity.id,version:Se.owner.entity.version}},`${Se.owner.entity.id}:${Se.owner.entity.version}`),(0,Q.jsx)(si,{client:o.client,cursor:Ee,highlight:Se?.range},`${Ee.recordId}:${Ee.recordVersion}`)]}):W&&(0,Q.jsxs)(`div`,{className:fe===`messages`||fe===`tools`?`tab-body transcript-body`:`tab-body`,children:[fe===`messages`&&(0,Q.jsx)(Ai,{client:o.client,seed:W}),fe===`tools`&&(0,Q.jsx)(Sa,{client:o.client,seed:W}),fe===`context`&&(0,Q.jsx)(li,{client:o.client,seed:W}),fe===`timeline`&&(0,Q.jsx)(va,{client:o.client,seed:W,onSearch:()=>ve(!0)}),fe===`runs`&&(0,Q.jsx)(bi,{client:o.client,seed:{...W,scope:{kind:`task`,id:p??W.scope.id}},onScope:Re},p),fe===`outcomes`&&(He.length>0?He.map(e=>(0,Q.jsx)(_i,{run:e},e.childRunId??e.runId)):(0,Q.jsx)(`p`,{className:`panel-empty`,children:x&&v.state?n(`No owner run projection in this snapshot.`):n(`No snapshot observed yet; absence is not proof of settlement.`)}))]})]}),_.workspace&&A.length>0&&(0,Q.jsx)(`div`,{className:`receipt-dock`,children:A.map(e=>(0,Q.jsx)(Jr,{client:o.client,value:e,onChange:F},e.commandId))})]}),(0,Q.jsx)(Qi,{side:`right`,width:re,onResize:oe}),(0,Q.jsx)(`section`,{className:`panel-drawer drawer-right${w===`right`?` open`:``}`,"aria-label":n(`Plan and review drawer`),tabIndex:-1,inert:E&&w!==`right`,children:W?(0,Q.jsx)(Ki,{client:o.client,context:S,seed:W,runs:He,canAct:C&&!O,onAction:e=>void V(e),planMetadata:b},p):(0,Q.jsx)(Gi,{})})]}),(0,Q.jsxs)(`footer`,{className:`statusbar`,children:[(0,Q.jsxs)(`div`,{className:`statusbar-left`,children:[(0,Q.jsxs)(`span`,{className:`status-item`,role:`status`,title:n(`Connection freshness is not execution outcome.`),children:[(0,Q.jsx)(`span`,{className:`status-dot ${v.error||!_.workspace?`error`:v.transportStatus===`current`?v.state?v.state.connection===`current`?`ok`:`busy`:``:`busy`}`,"aria-hidden":`true`}),r(Je),n(` · transport {status}`,{status:r(v.transportStatus)}),v.error?` · ${r(v.error)}`:``]}),(0,Q.jsx)(`span`,{className:`status-item${Ke?.status===`complete`?qe.length>0?` warn`:``:` faint`}`,children:Ke?.status===`complete`?qe.length>0?n(qe.length===1?`{count} active run`:`{count} active runs`,{count:qe.length}):n(`No active runs`):n(`Active roster unavailable; absence is not proof of settlement.`)}),(0,Q.jsx)(`span`,{className:`status-item faint`,children:n(`Connection freshness is not execution outcome.`)})]}),(0,Q.jsx)(`div`,{className:`statusbar-right`,children:(0,Q.jsxs)(`span`,{className:`status-item${_.compatible?` faint`:` warn`}`,title:sr?.buildId??n(`unbuilt source`),children:[(0,Q.jsxs)(`span`,{className:`build-part`,children:[(0,Q.jsx)(xr,{text:n(`Local browser build: {build}.`),slots:{build:(0,Q.jsx)(`code`,{children:sr?.buildId??n(`unbuilt source`)})}}),` `]}),(0,Q.jsx)(`span`,{children:n(`Shared compatibility: {state}.`,{state:_.compatible?n(`compatible`):n(`unavailable / mismatch — reload built assets; normal actions disabled`)})})]})})]}),s&&(0,Q.jsx)(qr,{client:o.client,compatible:!!_.compatible&&_.transportStatus===`current`&&!_.error,onClose:()=>c(!1),onChanged:()=>{Fe(void 0),I.current.depart(),_.refresh(!0)}}),Oe&&(0,Q.jsxs)(Er,{title:n(`Create task`),onClose:()=>ke(!1),children:[(0,Q.jsxs)(`label`,{children:[n(`Kind`),(0,Q.jsxs)(`select`,{"aria-label":n(`Kind`),value:Me,onChange:e=>Ne(e.target.value===`research`?`research`:e.target.value===`diagnosis`?`diagnosis`:`code`),children:[(0,Q.jsx)(`option`,{value:`code`,children:n(`Code`)}),(0,Q.jsx)(`option`,{value:`research`,children:n(`Readonly research`)}),(0,Q.jsx)(`option`,{value:`diagnosis`,children:n(`Readonly diagnosis`)})]})]}),(0,Q.jsxs)(`label`,{children:[n(`Goal`),(0,Q.jsx)(`textarea`,{"aria-label":n(`Goal`),value:Ae,onChange:e=>je(e.target.value),rows:6})]}),(0,Q.jsx)(`footer`,{children:(0,Q.jsx)(`button`,{type:`button`,className:`primary`,disabled:!_.actions||_.workspace?.context.status!==`available`||O||!Ae.trim(),onClick:()=>{ke(!1),V({kind:`create`,taskKind:Me,goal:Ae})},children:n(`Preview Create (does not Start)`)})})]}),Pe&&(0,Q.jsx)(Gr,{prepared:Pe,client:o.client,current:_.actions&&(C||Pe.preflight.preview.action.kind===`create`)?B:null,attachmentVersion:_.attachmentVersion,onClose:()=>{I.current.current(Ue)&&(I.current.depart(),Fe(e=>e===Pe?void 0:e))},onResult:We},Pe.commandId),ge&&Ve&&(0,Q.jsx)(gi,{client:o.client,seed:Ve,onClose:()=>ve(!1),onHit:e=>{Te(e),De(e.cursor),p&&history.replaceState(null,``,Yi(p,e.cursor))}}),be&&Ve&&(0,Q.jsx)(pi,{request:{storeId:Ve.storeId,scope:Ve.scope,snapshotSeq:Ve.snapshotSeq,format:`ndjson`},onClose:()=>xe(!1)})]})}function Sa({client:e,seed:t}){let n=$r(e,{...t,reader:`tools`}),r=n.page;return(0,Q.jsxs)(`section`,{className:`tools-list`,children:[(0,Q.jsx)(ci,{pager:n}),(0,Q.jsx)(`div`,{className:`tools-body`,children:r&&!(`kind`in r)&&r.records.map(t=>t.kind===`tool`?(0,Q.jsx)(Mi,{record:t,client:e,seed:r.request},`${t.owner.entity.id}:${t.version}`):null)})]})}function Ca(){let{t:e}=$();return(0,Q.jsxs)(`main`,{className:`entry`,children:[(0,Q.jsx)(`h1`,{children:e(`Presentation unavailable`)}),(0,Q.jsx)(`p`,{children:e(`No execution result is inferred. Reconnect to observe the owner; accepted work continues.`)}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>window.location.reload(),children:e(`Reload observation`)})]})}var wa=class extends f.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}render(){return this.state.failed?(0,Q.jsx)(Ca,{}):this.props.children}},Ta=document.getElementById(`root`);if(!Ta)throw Error(`Application root unavailable`);(0,ee.createRoot)(Ta).render((0,Q.jsx)(Tr,{children:(0,Q.jsx)(wa,{children:(0,Q.jsx)(xa,{})})}));export{_a as t};
|
|
1
|
+
import{r as e}from"./rolldown-runtime.js";import{n as t,r as n,t as r}from"./react.js";import{a as i,c as a,i as o,n as s,o as c,r as l,s as u,t as d}from"./markdown.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var f=e(n(),1),p={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},m=f.createContext&&f.createContext(p),h=[`attr`,`size`,`title`];function g(e,t){if(e==null)return{};var n,r,i=_(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function _(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function v(){return v=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},v.apply(null,arguments)}function y(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function b(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?y(Object(n),!0).forEach(function(t){x(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):y(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function x(e,t,n){return(t=S(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function S(e){var t=C(e,`string`);return typeof t==`symbol`?t:t+``}function C(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function w(e){return e&&e.map((e,t)=>f.createElement(e.tag,b({key:t},e.attr),w(e.child)))}function T(e){return t=>f.createElement(ee,v({attr:b({},e.attr)},t),w(e.child))}function ee(e){var t=t=>{var n=e.attr,r=e.size,i=e.title,a=g(e,h),o=r||t.size||`1em`,s;return t.className&&(s=t.className),e.className&&(s=(s?s+` `:``)+e.className),f.createElement(`svg`,v({stroke:`currentColor`,fill:`currentColor`,strokeWidth:`0`},t.attr,n,a,{className:s,style:b(b({color:e.color||t.color},t.style),e.style),height:o,width:o,xmlns:`http://www.w3.org/2000/svg`}),i&&f.createElement(`title`,null,i),e.children)};return m===void 0?t(p):f.createElement(m.Consumer,null,e=>t(e))}var E=t();function D(e){return T({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`line`,attr:{x1:`18`,y1:`6`,x2:`6`,y2:`18`},child:[]},{tag:`line`,attr:{x1:`6`,y1:`6`,x2:`18`,y2:`18`},child:[]}]})(e)}function te(e){return T({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M16 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2`},child:[]},{tag:`circle`,attr:{cx:`8.5`,cy:`7`,r:`4`},child:[]},{tag:`polyline`,attr:{points:`17 11 19 13 23 9`},child:[]}]})(e)}function ne(e){return T({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`polyline`,attr:{points:`3 6 5 6 21 6`},child:[]},{tag:`path`,attr:{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`},child:[]},{tag:`line`,attr:{x1:`10`,y1:`11`,x2:`10`,y2:`17`},child:[]},{tag:`line`,attr:{x1:`14`,y1:`11`,x2:`14`,y2:`17`},child:[]}]})(e)}function re(e){return T({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z`},child:[]}]})(e)}function ie(e){return T({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`rect`,attr:{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,ry:`2`},child:[]}]})(e)}function ae(e){return T({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`rect`,attr:{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,ry:`2`},child:[]},{tag:`line`,attr:{x1:`9`,y1:`3`,x2:`9`,y2:`21`},child:[]}]})(e)}function oe(e){return T({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`circle`,attr:{cx:`11`,cy:`11`,r:`8`},child:[]},{tag:`line`,attr:{x1:`21`,y1:`21`,x2:`16.65`,y2:`16.65`},child:[]}]})(e)}function se(e){return T({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`polyline`,attr:{points:`23 4 23 10 17 10`},child:[]},{tag:`polyline`,attr:{points:`1 20 1 14 7 14`},child:[]},{tag:`path`,attr:{d:`M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15`},child:[]}]})(e)}function ce(e){return T({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`line`,attr:{x1:`12`,y1:`5`,x2:`12`,y2:`19`},child:[]},{tag:`line`,attr:{x1:`5`,y1:`12`,x2:`19`,y2:`12`},child:[]}]})(e)}function le(e){return T({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z`},child:[]}]})(e)}function ue(e){return T({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`line`,attr:{x1:`3`,y1:`12`,x2:`21`,y2:`12`},child:[]},{tag:`line`,attr:{x1:`3`,y1:`6`,x2:`21`,y2:`6`},child:[]},{tag:`line`,attr:{x1:`3`,y1:`18`,x2:`21`,y2:`18`},child:[]}]})(e)}function de(e){return T({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`},child:[]},{tag:`polyline`,attr:{points:`16 17 21 12 16 7`},child:[]},{tag:`line`,attr:{x1:`21`,y1:`12`,x2:`9`,y2:`12`},child:[]}]})(e)}function fe(e){return T({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`line`,attr:{x1:`8`,y1:`6`,x2:`21`,y2:`6`},child:[]},{tag:`line`,attr:{x1:`8`,y1:`12`,x2:`21`,y2:`12`},child:[]},{tag:`line`,attr:{x1:`8`,y1:`18`,x2:`21`,y2:`18`},child:[]},{tag:`line`,attr:{x1:`3`,y1:`6`,x2:`3.01`,y2:`6`},child:[]},{tag:`line`,attr:{x1:`3`,y1:`12`,x2:`3.01`,y2:`12`},child:[]},{tag:`line`,attr:{x1:`3`,y1:`18`,x2:`3.01`,y2:`18`},child:[]}]})(e)}function pe(e){return T({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`},child:[]},{tag:`path`,attr:{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`},child:[]}]})(e)}function me(e){return T({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`polygon`,attr:{points:`12 2 2 7 12 12 22 7 12 2`},child:[]},{tag:`polyline`,attr:{points:`2 17 12 22 22 17`},child:[]},{tag:`polyline`,attr:{points:`2 12 12 17 22 12`},child:[]}]})(e)}function he(e){return T({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`circle`,attr:{cx:`12`,cy:`12`,r:`10`},child:[]},{tag:`line`,attr:{x1:`2`,y1:`12`,x2:`22`,y2:`12`},child:[]},{tag:`path`,attr:{d:`M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z`},child:[]}]})(e)}function ge(e){return T({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`circle`,attr:{cx:`18`,cy:`18`,r:`3`},child:[]},{tag:`circle`,attr:{cx:`6`,cy:`6`,r:`3`},child:[]},{tag:`path`,attr:{d:`M13 6h3a2 2 0 0 1 2 2v7`},child:[]},{tag:`line`,attr:{x1:`6`,y1:`9`,x2:`6`,y2:`21`},child:[]}]})(e)}function _e(e){return T({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`line`,attr:{x1:`6`,y1:`3`,x2:`6`,y2:`15`},child:[]},{tag:`circle`,attr:{cx:`18`,cy:`6`,r:`3`},child:[]},{tag:`circle`,attr:{cx:`6`,cy:`18`,r:`3`},child:[]},{tag:`path`,attr:{d:`M18 9a9 9 0 0 1-9 9`},child:[]}]})(e)}function ve(e){return T({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z`},child:[]}]})(e)}function ye(e){return T({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z`},child:[]},{tag:`polyline`,attr:{points:`14 2 14 8 20 8`},child:[]},{tag:`line`,attr:{x1:`16`,y1:`13`,x2:`8`,y2:`13`},child:[]},{tag:`line`,attr:{x1:`16`,y1:`17`,x2:`8`,y2:`17`},child:[]},{tag:`polyline`,attr:{points:`10 9 9 9 8 9`},child:[]}]})(e)}function be(e){return T({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z`},child:[]},{tag:`circle`,attr:{cx:`12`,cy:`12`,r:`3`},child:[]}]})(e)}function xe(e){return T({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z`},child:[]}]})(e)}function Se(e){return T({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`},child:[]},{tag:`polyline`,attr:{points:`7 10 12 15 17 10`},child:[]},{tag:`line`,attr:{x1:`12`,y1:`15`,x2:`12`,y2:`3`},child:[]}]})(e)}function Ce(e){return T({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`rect`,attr:{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,ry:`2`},child:[]},{tag:`rect`,attr:{x:`9`,y:`9`,width:`6`,height:`6`},child:[]},{tag:`line`,attr:{x1:`9`,y1:`1`,x2:`9`,y2:`4`},child:[]},{tag:`line`,attr:{x1:`15`,y1:`1`,x2:`15`,y2:`4`},child:[]},{tag:`line`,attr:{x1:`9`,y1:`20`,x2:`9`,y2:`23`},child:[]},{tag:`line`,attr:{x1:`15`,y1:`20`,x2:`15`,y2:`23`},child:[]},{tag:`line`,attr:{x1:`20`,y1:`9`,x2:`23`,y2:`9`},child:[]},{tag:`line`,attr:{x1:`20`,y1:`14`,x2:`23`,y2:`14`},child:[]},{tag:`line`,attr:{x1:`1`,y1:`9`,x2:`4`,y2:`9`},child:[]},{tag:`line`,attr:{x1:`1`,y1:`14`,x2:`4`,y2:`14`},child:[]}]})(e)}function we(e){return T({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`rect`,attr:{x:`9`,y:`9`,width:`13`,height:`13`,rx:`2`,ry:`2`},child:[]},{tag:`path`,attr:{d:`M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1`},child:[]}]})(e)}function Te(e){return T({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`circle`,attr:{cx:`12`,cy:`12`,r:`10`},child:[]},{tag:`polyline`,attr:{points:`12 6 12 12 16 14`},child:[]}]})(e)}function Ee(e){return T({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`polyline`,attr:{points:`18 15 12 9 6 15`},child:[]}]})(e)}function O(e){return T({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`polyline`,attr:{points:`9 18 15 12 9 6`},child:[]}]})(e)}function De(e){return T({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`polyline`,attr:{points:`6 9 12 15 18 9`},child:[]}]})(e)}function Oe(e){return T({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`polyline`,attr:{points:`20 6 9 17 4 12`},child:[]}]})(e)}function ke(e){return T({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`polyline`,attr:{points:`9 11 12 14 22 4`},child:[]},{tag:`path`,attr:{d:`M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11`},child:[]}]})(e)}function Ae(e){return T({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M22 11.08V12a10 10 0 1 1-5.93-9.14`},child:[]},{tag:`polyline`,attr:{points:`22 4 12 14.01 9 11.01`},child:[]}]})(e)}function je(e){return T({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`line`,attr:{x1:`12`,y1:`5`,x2:`12`,y2:`19`},child:[]},{tag:`polyline`,attr:{points:`19 12 12 19 5 12`},child:[]}]})(e)}var Me=`cadence-graph/2`,Ne=`cadence-public-export/2`,k=Object.freeze({controlBytes:1048576,admissionCount:16,admissionBytes:33554432,cancelBytes:65536,headerBytes:8192,wsClientFrameBytes:16384,startWaitMs:1e4,stopWaitMs:6e4,authWaitMs:3e4,authValidityMarginMs:12e4,browserLifetimeMs:432e5,terminateGraceMs:1e3,unconfirmedStopMs:3e3,graphBytes:524288,grantMs:12e4,assignments:16,instructionsBytes:16384,expectedOutputBytes:2048,workerRequestBytes:131072,publicRequestBytes:98304,predecessorBytes:16384,handoffBytes:32768,frameBytes:65536,chunkBytes:8192,detailBytes:33554432,childProtocolBytes:134217728,dataFrames:1e5,controlFrames:256,sdkEvents:1e6,workerQueueBytes:4194304,workerQueueFrames:1024,ownerQueueBytes:8388608,ownerQueueFrames:2048,ownerControlBytes:1048576,ownerControlFrames:256,recordingStallMs:5e3,episodes:8,queuedAssignments:128,childReservations:2,episodeMs:216e5,readyWaitMs:6e5,workerMs:12e5,artifactPartBytes:262144,progressBatchMs:100,progressBatchBytes:262144,segmentBytes:8388608,segmentRecords:4096,checkoutQuotaBytes:10737418240,episodeReservationBytes:536870912,freeSpaceFloorBytes:268435456,episodeControlBytes:1048576,searchReaders:2,exportReaders:2,downloadIdleMs:12e4,pageEntries:50,maxPageEntries:200,pageBytes:524288,detailPageBytes:262144,previewBytes:4096,searchBytes:8388608,searchMs:100,queryBytes:1024,navigationBytes:8192,ringEvents:1024,ringBytes:2097152,viewers:16,viewerMessages:256,viewerBytes:1048576,heartbeatMs:5e3,staleMs:15e3,reconcileMs:3e4}),Pe=[`invalid`,`oversize`,`unauthenticated`,`forbidden`,`stale`,`conflict`,`corrupt-selected`,`expired-grant`,`consumed-grant`,`unsupported-context`,`quarantine`,`capacity`,`unavailable`,`auth-unavailable`,`recording-exhausted`,`receipt-inconclusive`],A=class extends Error{code;constructor(e=`invalid`){super(e),this.code=e}};function Fe(e,t=`none`){return{code:e,effect:t,recovery:t!==`none`||e===`receipt-inconclusive`?`observe`:[`stale`,`expired-grant`,`consumed-grant`].includes(e)?`fresh-confirmation`:`operator`}}function j(){throw new A}function M(e,t,n=!1){if((typeof e!=`string`||e.includes(`\0`)||/[\uD800-\uDFFF]/u.test(e)||n&&!e.trim())&&j(),Ie(e)>t)throw new A(`oversize`);return e}function Ie(e){return new TextEncoder().encode(e).length}function N(e,t=0,n=2**53-1){return(typeof e!=`number`||!Number.isSafeInteger(e)||e<t||e>n)&&j(),e}function P(e){return typeof e!=`boolean`&&j(),e}function F(e,t){return(typeof e!=`string`||!t.includes(e))&&j(),e}function I(e,t){return e!==t&&j(),t}function L(e,t){return e===null?null:t(e)}function R(e,t){(typeof e!=`object`||!e||Array.isArray(e)||![null,Object.prototype].includes(Object.getPrototypeOf(e)))&&j();let n=Reflect.ownKeys(e);(n.length!==t.length||n.some(e=>typeof e!=`string`||!t.includes(e)))&&j();let r=Object.create(null);for(let n of t){let t=Object.getOwnPropertyDescriptor(e,n);(!t||!(`value`in t)||!t.enumerable)&&j(),r[n]=t.value}return r}function z(e,t,n){(!Array.isArray(e)||e.length>t||Reflect.ownKeys(e).length!==e.length+1)&&j();let r=[];for(let t=0;t<e.length;t++){let i=Object.getOwnPropertyDescriptor(e,String(t));(!i||!(`value`in i))&&j(),r.push(n(i.value))}return r}function B(e){let t=M(e,36);return/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/.test(t)||j(),t}function V(e){let t=M(e,64);return/^[0-9a-f]{64}$/.test(t)||j(),t}function H(e){let t=M(e,k.controlBytes);return/^(0|[1-9][0-9]*)$/.test(t)||j(),t}function Le(e,t){return H(e),H(t),e.length===t.length?e===t?0:e<t?-1:1:e.length<t.length?-1:1}function Re(e){let t=M(e,48);return/^[a-z][a-z0-9-]{0,47}$/.test(t)||j(),t}function U(e,t=k.controlBytes){let n=t,r=e=>{if(n-=Ie(e),n<0)throw new A(`oversize`);return e};function i(e,n){if(n>64&&j(),e===null||typeof e==`boolean`)return r(String(e));if(typeof e==`string`)return M(e,t),r(JSON.stringify(e));if(typeof e==`number`)return Number.isFinite(e)||j(),r(JSON.stringify(e));if(Array.isArray(e)){let a=z(e,t,e=>e);return r(`[]${`,`.repeat(Math.max(0,a.length-1))}`),`[${a.map(e=>i(e,n+1)).join(`,`)}]`}if(e&&typeof e==`object`){let t=Reflect.ownKeys(e);t.some(e=>typeof e!=`string`)&&j();let a=t.sort(),o=R(e,a);return r(`{}${`,`.repeat(Math.max(0,a.length-1))}`),`{${a.map(e=>`${r(`${JSON.stringify(e)}:`)}${i(o[e],n+1)}`).join(`,`)}}`}return j()}return i(e,0)}function ze(e,t=k.controlBytes){M(e,t);let n=0,r=()=>{for(;/[\x20\t\r\n]/.test(e[n]??`!`);)n++};function i(){let r=n++,i=!1;for(;n<e.length;){let a=e[n++];if(!i&&a===`"`)try{return M(JSON.parse(e.slice(r,n)),t)}catch{return j()}i=!i&&a===`\\`}return j()}function a(t){if(t>64&&j(),r(),e[n]===`"`)return i();if(e[n]===`{`||e[n]===`[`){let o=e[n++]===`{`,s=o?`}`:`]`,c=Object.create(null),l=[],u=new Set;if(r(),e[n]===s)return n++,o?c:l;for(;;){r();let d=``;o&&(e[n]!==`"`&&j(),d=i(),u.has(d)&&j(),u.add(d),r(),e[n++]!==`:`&&j());let f=a(t+1);o?c[d]=f:l.push(f),r();let p=e[n++];if(p===s)break;p!==`,`&&j()}return o?c:l}let o=/^(?:true|false|null|-?(?:0|[1-9][0-9]*)(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?)/.exec(e.slice(n))?.[0];o||j(),n+=o.length;let s=JSON.parse(o);return typeof s==`number`&&!Number.isFinite(s)&&j(),s}let o=a(0);return r(),n!==e.length&&j(),o}function Be(e){let t=R(e,[`code`,`effect`,`recovery`]);return{code:F(t.code,Pe),effect:F(t.effect,[`none`,`accepted`,`uncertain`]),recovery:F(t.recovery,[`observe`,`fresh-confirmation`,`operator`])}}var W=[`plan`,`context`,`message`,`final-text`,`tool-args`,`tool-update`,`tool-result`,`check`,`changes`,`review`],Ve=[`completed`,`failed`,`canceled`,`timeout`,`unknown`,`blocked`],He=[`not-launched`,`direct-child-closed`,`unconfirmed`],Ue=[`openai-completions`,`openai-responses`,`openai-codex-responses`,`anthropic-messages`,`google-generative-ai`,`mistral-conversations`,`azure-openai-responses`],We=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`,`max`];function Ge(e){let t=R(e,[`provider`,`model`,`api`,`thinking`]);return{provider:M(t.provider,128,!0),model:M(t.model,256,!0),api:F(t.api,Ue),thinking:F(t.thinking,We)}}function Ke(e){let{sourceSelectionId:t,...n}=R(e,[`sourceSelectionId`,`provider`,`model`,`api`,`thinking`]);return{sourceSelectionId:B(t),...Ge(n)}}function qe(e){let t=R(e,[`role`,`sha256`]);return{role:F(t.role,[`design-explorer`,`implementation-worker`,`diagnosis-worker`]),sha256:V(t.sha256)}}function Je(e){return e===`edit`?`implementation-worker`:e===`diagnosis`?`diagnosis-worker`:`design-explorer`}function G(e){let t=R(e,[`recordId`,`version`,`field`,`bytes`,`sha256`]);return{recordId:B(t.recordId),version:N(t.version,1),field:F(t.field,W),bytes:N(t.bytes,0,k.detailBytes),sha256:V(t.sha256)}}function K(e){let t=R(e,[`start`,`end`]),n=N(t.start);return{start:n,end:N(t.end,n+1,k.detailBytes)}}function Ye(e){let t=R(e,[`source`,`range`,`requireCompleteObservation`]),n=q(t.source),r;if(n===`current`)r={kind:n,assignmentId:Re(R(t.source,[`kind`,`assignmentId`]).assignmentId)};else{let e=R(t.source,[`kind`,`runId`,`childRunId`,`result`]);I(n,`historical`);let i=G(e.result);I(i.field,`final-text`),r={kind:`historical`,runId:B(e.runId),childRunId:B(e.childRunId),result:i}}let i=L(t.range,K);return r.kind===`historical`&&i&&i.end>r.result.bytes&&j(),{source:r,range:i,requireCompleteObservation:P(t.requireCompleteObservation)}}function q(e,t=`kind`){(typeof e!=`object`||!e)&&j();let n=Object.getOwnPropertyDescriptor(e,t);return(!n||!(`value`in n))&&j(),M(n.value,64,!0)}function Xe(e){U(e,k.graphBytes);let t=R(e,[`schema`,`taskId`,`taskKind`,`taskRevision`,`revision`,`planRevision`,`plan`,`assignments`]),n=G(t.plan);I(n.field,`plan`);let r=N(t.planRevision,1);n.version!==r&&j();let i={schema:I(t.schema,Me),taskId:B(t.taskId),taskKind:F(t.taskKind,[`code`,`research`,`diagnosis`]),taskRevision:N(t.taskRevision,1),revision:N(t.revision,1),planRevision:r,plan:n,assignments:z(t.assignments,k.assignments,e=>{let t=R(e,[`id`,`purpose`,`instructions`,`expectedOutput`,`role`,`model`,`dependencies`]);return{id:Re(t.id),purpose:F(t.purpose,[`research`,`diagnosis`,`review`,`edit`]),instructions:M(t.instructions,k.instructionsBytes,!0),expectedOutput:M(t.expectedOutput,k.expectedOutputBytes,!0),role:qe(t.role),model:Ke(t.model),dependencies:z(t.dependencies,k.assignments,Ye)}})};i.assignments.length||j();let a=new Map(i.assignments.map(e=>[e.id,e]));a.size!==i.assignments.length&&j();let o=new Set,s=new Set;function c(e){if(o.has(e.id)&&j(),s.has(e.id))return;o.add(e.id);let t=new Set;for(let n of e.dependencies){let e=U(n.source);if(t.has(e)&&j(),t.add(e),n.source.kind===`current`){let e=a.get(n.source.assignmentId);e||j(),c(e)}}o.delete(e.id),s.add(e.id)}for(let e of i.assignments){if(i.taskKind!==`code`&&e.purpose===`edit`||e.role.role!==Je(e.purpose))throw new A(`forbidden`);c(e)}return i}function Ze(e){let t=R(e,[`id`,`kind`,`revision`,`identity`,`graphRevision`,`graphIdentity`]),n=L(t.graphRevision,e=>N(e,1)),r=L(t.graphIdentity,V);return n===null!=(r===null)&&j(),{id:B(t.id),kind:F(t.kind,[`code`,`research`,`diagnosis`]),revision:N(t.revision,1),identity:V(t.identity),graphRevision:n,graphIdentity:r}}function Qe(e){let t=R(e,[`epoch`,`accessGeneration`,`configRev`,`controlRev`,`workspaceId`,`cwdId`,`model`,`checkEnvGeneration`,`checkoutGeneration`,`observation`,`task`]),n=R(t.observation,[`identity`,`complete`]);return{epoch:B(t.epoch),accessGeneration:N(t.accessGeneration,1),configRev:N(t.configRev,1),controlRev:N(t.controlRev,1),workspaceId:B(t.workspaceId),cwdId:B(t.cwdId),model:Ke(t.model),checkEnvGeneration:N(t.checkEnvGeneration,1),checkoutGeneration:N(t.checkoutGeneration),observation:{identity:V(n.identity),complete:P(n.complete)},task:L(t.task,Ze)}}function $e(e){let t=R(e,[`kind`,`name`,`command`,`timeoutMs`]),n={kind:F(t.kind,[`configured`,`manual`]),name:M(t.name,128,!0),command:M(t.command,4096,!0),timeoutMs:N(t.timeoutMs,100,k.workerMs)},r=/[\x00-\x08\x0b-\x1f\x7f-\x9f\u202a-\u202e\u2066-\u2069]/u;return(r.test(n.name)||r.test(n.command)||/[\n\t]/.test(n.name)||n.name===`Manual command`)&&j(),n.kind===`manual`&&(n.name!==`Manual`||n.timeoutMs!==12e4)&&j(),n}function et(e){switch(U(e),q(e)){case`create`:{let t=R(e,[`kind`,`taskKind`,`goal`]);return{kind:`create`,taskKind:F(t.taskKind,[`code`,`research`,`diagnosis`]),goal:M(t.goal,8192,!0)}}case`save-plan`:{let t=R(e,[`kind`,`taskId`,`plan`,`graph`]),n=Xe(t.graph),r=B(t.taskId);return n.taskId!==r&&j(),{kind:`save-plan`,taskId:r,plan:M(t.plan,32768),graph:n}}case`generate-plan`:case`start`:return{kind:q(e),taskId:B(R(e,[`kind`,`taskId`]).taskId)};case`check`:{let t=R(e,[`kind`,`taskId`,`check`]);return{kind:`check`,taskId:B(t.taskId),check:$e(t.check)}}case`review`:{let t=R(e,[`kind`,`taskId`,`runId`,`changesIdentity`,`checksRevision`,`acceptIssues`]);return{kind:`review`,taskId:B(t.taskId),runId:B(t.runId),changesIdentity:V(t.changesIdentity),checksRevision:N(t.checksRevision),acceptIssues:P(t.acceptIssues)}}default:return j()}}function tt(e){U(e);let t=R(e,[`expected`,`action`]);return{expected:Qe(t.expected),action:et(t.action)}}function nt(e){U(e);let t=R(e,[`commandId`,`grant`,`expected`,`action`]);return{commandId:B(t.commandId),grant:B(t.grant),expected:Qe(t.expected),action:et(t.action)}}function rt(e){if(U(e),q(e)===`action`){let t=R(e,[`kind`,`expected`,`action`]);return{kind:`action`,expected:Qe(t.expected),action:et(t.action)}}let t=R(e,[`kind`,`epoch`,`runId`]);return I(t.kind,`cancel`),{kind:`cancel`,epoch:B(t.epoch),runId:B(t.runId)}}function it(e){let t=R(e,[`commandId`,`epoch`,`runId`]);return{commandId:B(t.commandId),epoch:B(t.epoch),runId:B(t.runId)}}function at(e){U(e);let t=typeof e==`object`&&!!e&&Object.hasOwn(e,`checkEnvironmentPolicy`),n=R(e,[`version`,`action`,`rootLabel`,`cwdLabel`,`readablePlan`,`graph`,`activeRunId`,`issues`,`configuredChecks`,`checksRevision`,`reviewRunId`,...t?[`checkEnvironmentPolicy`]:[]]),r=z(n.configuredChecks,32,$e);return(r.some(e=>e.kind!==`configured`)||new Set(r.map(e=>e.name)).size!==r.length)&&j(),{...t?{checkEnvironmentPolicy:I(n.checkEnvironmentPolicy,`service-launch-ordinary/1`)}:{},configuredChecks:r,checksRevision:N(n.checksRevision),reviewRunId:L(n.reviewRunId,B),version:Qe(n.version),action:et(n.action),rootLabel:M(n.rootLabel,4096,!0),cwdLabel:M(n.cwdLabel,4096,!0),readablePlan:M(n.readablePlan,32768),graph:L(n.graph,Xe),activeRunId:L(n.activeRunId,B),issues:z(n.issues,7,e=>F(e,[`incomplete-observation`,`unrun-checks`,`stale-checks`,`failed-checks`,`partial-results`,`recording-incomplete`,`legacy-context`]))}}function ot(e){U(e);let t=R(e,[`grant`,`expiresAt`,`preview`]),n=M(t.expiresAt,24);return(!/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d\.\d{3}Z$/.test(n)||!Number.isFinite(Date.parse(n))||new Date(n).toISOString()!==n)&&j(),{grant:B(t.grant),expiresAt:n,preview:at(t.preview)}}function J(e){let t=R(e,[`observed`,`source`,`redacted`,`omissions`]),n={observed:F(t.observed,[`complete`,`incomplete`]),source:F(t.source,[`complete`,`limited`,`unavailable`]),redacted:P(t.redacted),omissions:z(t.omissions,6,e=>F(e,[`binary`,`hidden-thinking`,`source-limit`,`capture-limit`,`gap`,`unsupported`]))};return(new Set(n.omissions).size!==n.omissions.length||n.observed===`complete`&&n.omissions.some(e=>e===`capture-limit`||e===`gap`))&&j(),n}function st(e){let t=R(e,[`graphRevision`,`inputs`]),n=0,r=new Set;return{graphRevision:N(t.graphRevision,1),inputs:z(t.inputs,k.assignments,e=>{let t=R(e,[`assignmentId`,`dependencyIndex`,`runId`,`childRunId`,`result`,`range`,`text`,`coverage`]),i=G(t.result);I(i.field,`final-text`);let a=L(t.range,K);a&&a.end>i.bytes&&j();let o=M(t.text,k.predecessorBytes);if(n+=Ie(o),n>k.handoffBytes)throw new A(`oversize`);let s=N(t.dependencyIndex,0,k.assignments-1);return r.has(s)&&j(),r.add(s),Ie(o)!==(a?a.end-a.start:i.bytes)&&j(),{assignmentId:Re(t.assignmentId),dependencyIndex:s,runId:B(t.runId),childRunId:B(t.childRunId),result:i,range:a,text:o,coverage:J(t.coverage)}})}}function ct(e){let t=R(e,[`outcome`,`closure`,`exitCode`,`signal`,`durationMs`,`stdin`,`final`,`cleanup`,`capture`]),n={outcome:F(t.outcome,[`completed`,`failed`,`canceled`,`timeout`,`unknown`]),closure:F(t.closure,He),exitCode:L(t.exitCode,e=>N(e,-2147483648,4294967295)),signal:L(t.signal,e=>M(e,32,!0)),durationMs:N(t.durationMs),stdin:F(t.stdin,[`delivered`,`failed`,`not-required`]),final:F(t.final,[`valid`,`missing`,`invalid`]),cleanup:F(t.cleanup,[`settled`,`failed`,`unconfirmed`]),capture:J(t.capture)};return n.closure===`not-launched`&&(n.exitCode!==null||n.signal!==null)&&j(),n.outcome===`completed`&&(n.closure!==`direct-child-closed`||n.exitCode!==0||n.signal!==null||n.stdin!==`delivered`||n.final!==`valid`||n.cleanup!==`settled`||n.capture.observed!==`complete`)&&j(),n}function lt(e){let t=R(e,[`kind`,`id`]);return{kind:F(t.kind,[`task`,`run`,`child`]),id:B(t.id)}}function ut(e){let t=M(e,k.navigationBytes,!0);return/^[\x21-\x7e]+$/.test(t)||j(),t}function dt(e){U(e);let t=R(e,[`storeId`,`scope`,`query`,`snapshotSeq`,`recordId`,`recordVersion`,`field`,`offset`,...Object.hasOwn(e??{},`navigation`)?[`navigation`]:[]]),n={storeId:B(t.storeId),scope:lt(t.scope),query:L(t.query,e=>{let t=M(e,k.queryBytes);return t.length||j(),t}),snapshotSeq:H(t.snapshotSeq),recordId:L(t.recordId,B),recordVersion:L(t.recordVersion,e=>N(e,1)),field:L(t.field,e=>F(e,W)),offset:N(t.offset),...Object.hasOwn(t,`navigation`)?{navigation:ut(t.navigation)}:{}};return(n.recordId===null!=(n.recordVersion===null)||n.recordId===null!=(n.field===null))&&j(),n}function ft(e){let t=R(e,[`disposition`,`value`]),n=F(t.disposition,[`observed`,`unavailable`,`redacted`]),r=_t(t.value);return n===`observed`!=(r!==null)&&j(),{disposition:n,value:r}}function pt(e){let t=R(e,[`messageId`,`blockId`]);return{messageId:B(t.messageId),blockId:B(t.blockId)}}function mt(e){let t=q(e);if(t===`message-final`)return{kind:t,messageId:B(R(e,[`kind`,`messageId`]).messageId)};if(t===`context`)return{kind:t,component:F(R(e,[`kind`,`component`]).component,[`request-context`,`request-prompt`,`request-instructions`,`role`,`effective-system`])};if(t===`handoff`){let n=R(e,[`kind`,`dependencyIndex`,`source`]),r=G(n.source);return I(r.field,`final-text`),{kind:t,dependencyIndex:N(n.dependencyIndex,0,k.assignments-1),source:r}}if(t===`message`){let n=R(e,[`kind`,`messageId`,`blockId`,`index`,`stage`]);return{kind:t,messageId:B(n.messageId),blockId:B(n.blockId),index:N(n.index,0,k.dataFrames),stage:F(n.stage,[`stream`,`final`])}}let n=R(e,[`kind`,`callId`,`blockId`,`index`,`stage`]);return I(t,`tool`),{kind:`tool`,callId:B(n.callId),blockId:B(n.blockId),index:N(n.index,0,k.dataFrames),stage:F(n.stage,[`arguments-partial`,`arguments-final`,`execution-arguments`,`update-snapshot`,`result`])}}function ht(e){let t=R(e,[`owner`,`field`,`encoding`]),n=mt(t.owner),r=F(t.field,[`context`,`message`,`final-text`,`tool-args`,`tool-update`,`tool-result`]),i=F(t.encoding,[`utf8`,`canonical-json`]);return(r!==(n.kind===`context`||n.kind===`handoff`?`context`:n.kind===`message-final`?`final-text`:n.kind===`message`?`message`:n.stage===`result`?`tool-result`:n.stage===`update-snapshot`?`tool-update`:`tool-args`)||n.kind!==`tool`&&i!==`utf8`||r===`tool-args`&&i!==`canonical-json`&&(n.kind!==`tool`||n.stage!==`arguments-partial`))&&j(),{owner:n,field:r,encoding:i}}function gt(e){let t=R(e,[`owner`,`sourceType`,`mimeType`,`reason`]),n=F(t.sourceType,[`image`,`audio`,`binary`,`hidden-thinking`,`unsupported`]),r=F(t.reason,[`binary`,`hidden-thinking`,`unsupported`]),i=L(t.mimeType,e=>M(e,128,!0));return(r!==(n===`hidden-thinking`?`hidden-thinking`:n===`unsupported`?`unsupported`:`binary`)||i!==null&&(n===`hidden-thinking`||!/^[a-z0-9.+-]+\/[a-z0-9.+-]+$/i.test(i)))&&j(),{owner:mt(t.owner),sourceType:n,mimeType:i,reason:r}}function _t(e){if(e===null)return null;let t=M(e,128,!0);return/^[a-zA-Z0-9_-]+$/.test(t)||j(),t}function vt(e){let t=q(e);switch(t){case`ready`:return{kind:t,requestProtocol:I(R(e,[`kind`,`requestProtocol`]).requestProtocol,2)};case`message-start`:{let n=R(e,[`kind`,`messageId`,`role`,`source`,`resultCallId`]),r=F(n.role,[`user`,`assistant`,`tool-result`]),i=L(n.resultCallId,B);return r!==`tool-result`&&i!==null&&j(),{kind:t,messageId:B(n.messageId),role:r,source:ft(n.source),resultCallId:i}}case`message-text`:{let n=R(e,[`kind`,`messageId`,`blockId`,`detailId`]);return{kind:t,...pt({messageId:n.messageId,blockId:n.blockId}),detailId:B(n.detailId)}}case`message-end`:{let n=R(e,[`kind`,`messageId`,`finalDetailId`,`finalBlockCount`,`stopReason`]);return{kind:t,messageId:B(n.messageId),finalDetailId:L(n.finalDetailId,B),finalBlockCount:N(n.finalBlockCount,0,k.dataFrames),stopReason:F(n.stopReason,[`stop`,`length`,`toolUse`,`error`,`aborted`,`unknown`])}}case`call-declaration`:{let n=R(e,[`kind`,`callId`,`declaration`,`index`,`source`,`name`,`argsDetailId`,`stage`]);return{kind:t,callId:B(n.callId),declaration:pt(n.declaration),index:N(n.index,0,k.dataFrames),source:ft(n.source),name:M(n.name,128,!0),argsDetailId:L(n.argsDetailId,B),stage:F(n.stage,[`partial`,`final`])}}case`tool-start`:{let n=R(e,[`kind`,`callId`,`declaration`,`source`,`name`,`argsDetailId`]);return{kind:t,callId:B(n.callId),declaration:L(n.declaration,pt),source:ft(n.source),name:M(n.name,128,!0),argsDetailId:L(n.argsDetailId,B)}}case`tool-update`:{let n=R(e,[`kind`,`callId`,`detailId`,`semantics`]);return{kind:t,callId:B(n.callId),detailId:B(n.detailId),semantics:I(n.semantics,`snapshot`)}}case`tool-end`:{let n=R(e,[`kind`,`callId`,`declaration`,`source`,`name`,`resultDetailId`,`isError`,`association`,`startObserved`]),r=F(n.association,[`declared`,`execution-only`,`orphan`,`ambiguous`]),i=L(n.declaration,pt),a=P(n.startObserved);return(r===`declared`!=(i!==null)||r===`execution-only`&&!a||(r===`orphan`||r===`ambiguous`)&&a)&&j(),{kind:t,callId:B(n.callId),declaration:i,source:ft(n.source),name:M(n.name,128,!0),resultDetailId:B(n.resultDetailId),isError:P(n.isError),association:r,startObserved:a}}case`omitted-block`:return{kind:t,block:gt(R(e,[`kind`,`block`]).block)};case`detail-begin`:{let n=R(e,[`kind`,`detailId`,`descriptor`]);return{kind:t,detailId:B(n.detailId),descriptor:ht(n.descriptor)}}case`detail-chunk`:{let n=R(e,[`kind`,`detailId`,`offset`,`text`]),r=M(n.text,k.chunkBytes),i=N(n.offset,0,k.detailBytes);return i+Ie(r)>k.detailBytes&&j(),{kind:t,detailId:B(n.detailId),offset:i,text:r}}case`detail-end`:{let n=R(e,[`kind`,`detailId`,`bytes`,`sha256`,`coverage`]);return{kind:t,detailId:B(n.detailId),bytes:N(n.bytes,0,k.detailBytes),sha256:V(n.sha256),coverage:J(n.coverage)}}case`capture-status`:return{kind:t,coverage:J(R(e,[`kind`,`coverage`]).coverage)};case`worker-failure`:return{kind:t,code:F(R(e,[`kind`,`code`]).code,[`protocol`,`capture`,`model`,`auth`,`network`,`cleanup`,`prompt`])};case`final`:{let n=R(e,[`kind`,`messageId`,`detailId`,`stopReason`]);return{kind:t,messageId:B(n.messageId),detailId:B(n.detailId),stopReason:I(n.stopReason,`stop`)}}default:return j()}}function yt(e){let t=R(e,[`outcome`,`closure`,`exitCode`,`signal`,`durationMs`,`stdin`]),n={outcome:F(t.outcome,[`completed`,`failed`,`canceled`,`timeout`,`unknown`]),closure:F(t.closure,He),exitCode:L(t.exitCode,e=>N(e,-2147483648,4294967295)),signal:L(t.signal,e=>M(e,32,!0)),durationMs:N(t.durationMs),stdin:I(t.stdin,`not-required`)};return(n.closure===`not-launched`&&(n.exitCode!==null||n.signal!==null)||n.outcome===`completed`&&(n.closure!==`direct-child-closed`||n.exitCode!==0||n.signal!==null))&&j(),n}function bt(e){let t=R(e,[`messageId`,`detailId`]);return{messageId:B(t.messageId),detailId:B(t.detailId)}}function xt(e){let t=R(e,[`childRunId`,`detailId`,`content`,`committedSeq`]),n=H(t.committedSeq);return n===`0`&&j(),{childRunId:B(t.childRunId),detailId:B(t.detailId),content:G(t.content),committedSeq:n}}function St(e){let t=q(e,`status`);if(t===`committed`){let n=R(e,[`status`,`selected`,`detail`]),r=bt(n.selected),i=xt(n.detail);return(r.detailId!==i.detailId||i.content.field!==`final-text`)&&j(),{status:t,selected:r,detail:i}}if(t===`refused`){let n=R(e,[`status`,`selected`,`error`]);return{status:t,selected:L(n.selected,bt),error:Be(n.error)}}let n=R(e,[`status`,`selected`]);return{status:F(t,[`pending`,`uncertain`]),selected:L(n.selected,bt)}}function Ct(e,t){let n=L(e,H);return(n===`0`||n!==null&&t.status===`committed`&&Le(n,t.detail.committedSeq)<0)&&j(),n}function wt(e){return e.native?.outcome===`completed`&&e.recording.status===`committed`&&e.settlementSeq!==null}function Tt(e){return e.kind===`parent`?e.outcome:e.native.outcome===`completed`?e.kind===`sdk`?wt(e)?`completed`:`failed`:e.capture.observed===`complete`&&e.settlementSeq!==null?`completed`:`failed`:e.native.outcome}function Et(e){let t=q(e);if(t===`sdk`){let n=R(e,[`kind`,`native`,`recording`,`settlementSeq`]),r=St(n.recording),i=Ct(n.settlementSeq,r);return{kind:t,native:ct(n.native),recording:r,settlementSeq:i}}if(t===`check`){let n=R(e,[`kind`,`native`,`capture`,`settlementSeq`]),r=L(n.settlementSeq,H);return r===`0`&&j(),{kind:t,native:yt(n.native),capture:J(n.capture),settlementSeq:r}}let n=R(e,[`kind`,`outcome`,`required`]);I(t,`parent`);let r=z(n.required,k.assignments,e=>{let t=R(e,[`assignmentId`,`childRunId`,`native`,`recording`,`settlementSeq`]),n=B(t.childRunId),r=St(t.recording);return r.status===`committed`&&r.detail.childRunId!==n&&j(),{assignmentId:Re(t.assignmentId),childRunId:n,native:L(t.native,ct),recording:r,settlementSeq:Ct(t.settlementSeq,r)}}),i=F(n.outcome,Ve);return(!r.length||new Set(r.map(e=>e.assignmentId)).size!==r.length||new Set(r.map(e=>e.childRunId)).size!==r.length||i===`completed`&&!r.every(wt))&&j(),{kind:`parent`,outcome:i,required:r}}function Dt(e){let t=R(e,[`first`,`last`,`firstObservedMs`,`lastObservedMs`]),n=N(t.first,1,k.dataFrames+k.controlFrames),r=N(t.last,n,k.dataFrames+k.controlFrames),i=N(t.firstObservedMs),a=N(t.lastObservedMs,i);return n===r&&i!==a&&j(),{first:n,last:r,firstObservedMs:i,lastObservedMs:a}}function Ot(e){let t=R(e,[`source`,`event`]),n=Dt(t.source),r=q(t.event);if(r===`stored-chunk`){let e=R(t.event,[`kind`,`detailId`,`text`]);return{source:n,event:{kind:r,detailId:B(e.detailId),text:M(e.text,k.chunkBytes)}}}if(r===`stored-end`){let e=R(t.event,[`kind`,`detailId`,`coverage`]);return{source:n,event:{kind:r,detailId:B(e.detailId),coverage:J(e.coverage)}}}let i=vt(t.event);return(i.kind===`detail-chunk`||i.kind===`detail-end`)&&j(),{source:n,event:i}}function kt(e){let t=R(e,[`epoch`,`taskId`,`runId`,`childRunId`]);return{epoch:B(t.epoch),taskId:B(t.taskId),runId:B(t.runId),childRunId:B(t.childRunId)}}function At(e){U({kind:`ok`,value:e},k.pageBytes);let t=Object.getOwnPropertyDescriptor(e??{},`status`)?.value===`complete`,n=R(e,[`storeId`,`workspaceId`,`epoch`,`status`,t?`runs`:`error`]),r={storeId:B(n.storeId),workspaceId:B(n.workspaceId),epoch:B(n.epoch)};if(!t)return I(n.status,`unavailable`),{...r,status:`unavailable`,error:jt(n.error)};let i=z(n.runs,k.episodes,e=>{let t=R(e,[`taskId`,`runId`,`operationId`,`epoch`,`kind`,`stage`]);return{taskId:B(t.taskId),runId:B(t.runId),operationId:B(t.operationId),epoch:B(t.epoch),kind:F(t.kind,[`start`,`generate-plan`,`check`]),stage:F(t.stage,[`accepted-unallocated`,`active`,`draining`])}});return(i.some(e=>e.epoch!==r.epoch)||new Set(i.map(e=>e.runId)).size!==i.length||new Set(i.map(e=>e.taskId)).size!==i.length||new Set(i.map(e=>e.operationId)).size!==i.length)&&j(),{...r,status:`complete`,runs:i}}function jt(e){let t=Be(e);return I(t.effect,`none`),t}function Mt(e){let t=R(e,[`sourceHash`,`contractHash`,`buildId`]);return{sourceHash:V(t.sourceHash),contractHash:V(t.contractHash),buildId:V(t.buildId)}}function Nt(e){let t=F(Object.getOwnPropertyDescriptor(e??{},`kind`)?.value,[`native`,`browser`]),n=R(e,t===`native`?[`kind`,`contractHash`]:[`kind`,`contractHash`,`sourceHash`,`buildId`]);return t===`native`?{kind:t,contractHash:V(n.contractHash)}:{kind:t,...Mt({contractHash:n.contractHash,sourceHash:n.sourceHash,buildId:n.buildId})}}function Pt(e){let t=R(e,[`contractHash`,`assets`]);return{contractHash:V(t.contractHash),assets:Mt(t.assets)}}function Ft(e,t,n=!1){return!!e&&!!t&&t.contractHash===e.contractHash&&(n||e.assets.contractHash===e.contractHash&&(t.kind===`native`||t.buildId===e.assets.buildId&&t.sourceHash===e.assets.sourceHash))}function It(e){U(e);let t=R(e,[`commandId`,`operationId`,`runId`,`admission`,`committedSeq`,`execution`,`settlement`,`created`,`publication`]),n={commandId:B(t.commandId),operationId:B(t.operationId),runId:L(t.runId,B),admission:F(t.admission,[`accepted`,`refused`,`uncertain`]),committedSeq:H(t.committedSeq),execution:L(t.execution,e=>F(e,Ve)),settlement:L(t.settlement,Et),created:L(t.created,e=>{let t=R(e,[`kind`,`taskId`,`state`]);return{kind:I(t.kind,`task`),taskId:B(t.taskId),state:F(t.state,[`reserved`,`published`])}}),publication:F(t.publication,[`pending`,`published`,`conflict`,`uncertain`])};return(n.committedSeq===`0`||n.settlement?.kind===`sdk`||n.execution===`completed`&&!n.settlement||n.execution!==null&&n.settlement!==null&&Tt(n.settlement)!==n.execution||n.created?.state===`published`&&n.publication!==`published`)&&j(),n}function Lt(e){U(e);let t=R(e,[`identity`,`receipt`]),n=rt(t.identity),r=It(t.receipt);n.kind===`cancel`&&r.runId!==n.runId&&j();let i=n.kind===`action`&&n.action.kind===`create`;if((!i&&r.created!==null||i&&r.admission===`accepted`&&r.created===null)&&j(),n.kind===`action`){let e=[`start`,`generate-plan`,`check`].includes(n.action.kind);(r.admission===`accepted`&&e!==(r.runId!==null)||!e&&(r.execution!==null||r.settlement!==null)||r.settlement!==null&&r.settlement.kind!==(n.action.kind===`check`?`check`:`parent`))&&j()}return{identity:n,receipt:r}}function Y(e,t){if(q(e)===`ok`)return{kind:`ok`,value:t(R(e,[`kind`,`value`]).value)};let n=R(e,[`kind`,`error`]);return I(n.kind,`error`),{kind:`error`,error:Be(n.error)}}function Rt(e){switch(U(e),q(e,`status`)){case`found`:return{status:`found`,receipt:It(R(e,[`status`,`receipt`]).receipt)};case`absent`:return{status:`absent`,committedSeq:H(R(e,[`status`,`committedSeq`]).committedSeq)};case`inconclusive`:return{status:`inconclusive`,error:Be(R(e,[`status`,`error`]).error)};default:return j()}}function zt(e){let t=R(e,[`runId`,`taskId`,`childRunId`,`assignmentId`,`admission`,`lifecycle`,`outcome`,`settlement`,`reason`,`publication`,`coverage`,`result`]),n={runId:B(t.runId),taskId:B(t.taskId),childRunId:L(t.childRunId,B),assignmentId:L(t.assignmentId,Re),admission:Yt(t.admission),lifecycle:F(t.lifecycle,[`queued`,`preparing`,`running`,`closing`,`settled`]),outcome:L(t.outcome,e=>F(e,Ve)),settlement:L(t.settlement,Et),reason:L(t.reason,e=>F(e,[`capacity`,`dependency`,`writer`,`parent-stopped`,`wait-expired`,`handoff-overflow`,`stale-dependency`,`quarantine`])),publication:F(t.publication,[`pending`,`published`,`conflict`,`uncertain`]),coverage:J(t.coverage),result:L(t.result,G)};return(n.admission.context.task?.id!==n.taskId||n.childRunId!==null&&!n.admission.assignments.some(e=>e.childRunId===n.childRunId&&e.assignmentId===n.assignmentId)||n.settlement?.kind===`parent`&&U(n.settlement.required.map(({assignmentId:e,childRunId:t})=>({assignmentId:e,childRunId:t})))!==U(n.admission.assignments)||n.settlement?.kind===`sdk`&&n.settlement.recording.status===`committed`&&(n.settlement.recording.detail.childRunId!==n.childRunId||n.result!==null&&U(n.result)!==U(n.settlement.recording.detail.content))||n.settlement!==null&&(n.childRunId!==null&&n.settlement.kind!==`sdk`||n.childRunId===null&&n.settlement.kind!==(n.admission.kind===`check`?`check`:`parent`)||n.outcome!==null&&Tt(n.settlement)!==n.outcome)||n.childRunId===null!=(n.assignmentId===null)||n.lifecycle===`settled`!=(n.outcome!==null)||n.outcome===`completed`&&(!n.settlement||Tt(n.settlement)!==`completed`||n.coverage.observed!==`complete`))&&j(),n}function Bt(e,t){return t.kind===`task`?e.taskId===t.id:t.kind===`run`?e.runId===t.id:e.childRunId===t.id}function Vt(e,t,n){return Bt(e,t)&&e.taskId===Qt(n)&&e.admission.context.workspaceId===Zt(n)}function Ht(e){U(e,k.pageBytes);let t=R(e,[`protocol`,`storeId`,`epoch`,`scope`,`committedSeq`,`context`,`runs`,`horizon`]),n={protocol:I(t.protocol,1),storeId:B(t.storeId),epoch:B(t.epoch),scope:lt(t.scope),committedSeq:H(t.committedSeq),context:Xt(t.context),runs:z(t.runs,k.maxPageEntries,zt),horizon:un(t.horizon)};return(!$t(n.context,n.epoch,n.scope)||U(n.horizon.historicalRuns.scope)!==U(n.scope)||n.horizon.historicalRuns.snapshotSeq!==n.committedSeq||n.horizon.historicalRuns.storeId!==n.storeId||n.runs.some(e=>!Vt(e,n.scope,n.context))||new Set(n.runs.map(e=>e.childRunId??e.runId)).size!==n.runs.length)&&j(),n}function Ut(e){U(e,k.pageBytes);let t=q(e),n=R(e,t===`update`?[`kind`,`storeId`,`epoch`,`scope`,`previousSeq`,`committedSeq`,`runs`,`removed`,`context`]:[`kind`,`storeId`,`epoch`,`scope`,`committedSeq`]),r={storeId:B(n.storeId),epoch:B(n.epoch),scope:lt(n.scope),committedSeq:H(n.committedSeq)};if(t===`update`){let e=H(n.previousSeq);Le(r.committedSeq,e)<=0&&j();let i=Xt(n.context);$t(i,r.epoch,r.scope)||j();let a=z(n.runs,k.maxPageEntries,zt),o=z(n.removed,k.maxPageEntries,B),s=a.map(e=>e.childRunId??e.runId);return(a.some(e=>!Vt(e,r.scope,i))||new Set(s).size!==s.length||new Set(o).size!==o.length||o.some(e=>s.includes(e)))&&j(),{kind:t,...r,previousSeq:e,runs:a,removed:o,context:i}}return I(t,`heartbeat`),{kind:`heartbeat`,...r}}function Wt(e){let{navigation:t,...n}=e;return n}function Gt(e,t){(!t.navigation||t.navigation===e.navigation||U(Wt(e))!==U(Wt(t)))&&j()}function Kt(e){if(Object.getOwnPropertyDescriptor(e??{},`kind`)?.value!==`progress`)return qt(e);U({kind:`ok`,value:e},k.pageBytes);let t=R(e,[`kind`,`cursor`,`next`,`coverage`]),n=dt(t.cursor),r=dt(t.next);return Gt(n,r),{kind:`progress`,cursor:n,next:r,coverage:J(t.coverage)}}function qt(e){U({kind:`ok`,value:e},k.pageBytes);let t=R(e,[`cursor`,`content`,`range`,`text`,`next`,`coverage`]),n={cursor:dt(t.cursor),content:G(t.content),range:L(t.range,K),text:M(t.text,k.detailPageBytes),next:L(t.next,dt),coverage:J(t.coverage)};return(n.cursor.recordId!==n.content.recordId||n.cursor.recordVersion!==n.content.version||n.cursor.field!==n.content.field||(n.range?n.range.start!==n.cursor.offset||n.range.end>n.content.bytes||n.range.end-n.range.start!==Ie(n.text):n.content.bytes!==0||n.cursor.offset!==0||n.text!==``))&&j(),n.coverage.observed===`complete`&&n.next!==null!=(n.range?.end??0)<n.content.bytes&&j(),n.next&&(n.next.offset!==n.range?.end||U(Wt({...n.next,offset:n.cursor.offset}))!==U(Wt(n.cursor)))&&j(),n}function Jt(e){U({kind:`ok`,value:e},k.pageBytes);let t=R(e,[`cursor`,`hits`,`next`,`coverage`]),n=dt(t.cursor);n.query||j();let r=Ie(n.query),i=z(t.hits,k.maxPageEntries,e=>{let t=R(e,[`content`,`range`,`preview`,`cursor`,`owner`]),i=G(t.content),a=nn(t.owner);rn(a,n.scope)||j();let o=K(t.range),s=dt(t.cursor);return(o.end>i.bytes||o.end-o.start!==r||s.recordId!==i.recordId||s.recordVersion!==i.version||s.field!==i.field||s.offset!==o.start||s.storeId!==n.storeId||U(s.scope)!==U(n.scope)||s.snapshotSeq!==n.snapshotSeq||s.query!==n.query||s.navigation!==void 0)&&j(),{content:i,owner:a,range:o,preview:M(t.preview,k.previewBytes),cursor:s}}),a=L(t.next,dt);return a&&(a.storeId!==n.storeId||U(a.scope)!==U(n.scope)||a.query!==n.query||a.snapshotSeq!==n.snapshotSeq||a.recordId===n.recordId&&a.recordVersion===n.recordVersion&&a.field===n.field&&(a.offset<n.offset||a.offset===n.offset&&(!a.navigation||a.navigation===n.navigation)))&&j(),{cursor:n,hits:i,next:a,coverage:J(t.coverage)}}function Yt(e){let t=R(e,[`operationId`,`commandId`,`kind`,`context`,`assignments`,`graph`]),n=Qe(t.context),r=L(t.graph,e=>{let t=R(e,[`recordId`,`revision`,`sha256`]);return{recordId:B(t.recordId),revision:N(t.revision,1),sha256:V(t.sha256)}}),i=F(t.kind,[`start`,`generate-plan`,`check`]),a=z(t.assignments,k.assignments,e=>{let t=R(e,[`assignmentId`,`childRunId`]);return{assignmentId:Re(t.assignmentId),childRunId:B(t.childRunId)}});return(i===`check`!=(a.length===0)||new Set(a.map(e=>e.assignmentId)).size!==a.length||new Set(a.map(e=>e.childRunId)).size!==a.length)&&j(),(!n.task||i===`start`&&(!r||r.revision!==n.task.graphRevision||r.sha256!==n.task.graphIdentity)||i!==`start`&&r!==null)&&j(),{operationId:B(t.operationId),commandId:B(t.commandId),kind:i,context:n,assignments:a,graph:r}}function Xt(e){if(q(e,`status`)===`available`)return{status:`available`,version:Qe(R(e,[`status`,`version`]).version)};let t=R(e,[`status`,`workspaceId`,`taskId`,`error`]);I(t.status,`unavailable`);let n=Be(t.error);return I(n.effect,`none`),{status:`unavailable`,workspaceId:B(t.workspaceId),taskId:L(t.taskId,B),error:n}}function Zt(e){return e.status===`available`?e.version.workspaceId:e.workspaceId}function Qt(e){return e.status===`available`?e.version.task?.id??null:e.taskId}function $t(e,t,n){return(e.status!==`available`||e.version.epoch===t)&&(n.kind!==`task`||Qt(e)===n.id)}function en(e){let t=R(e,[`protocol`,`storeId`,`epoch`,`accessGeneration`,`authority`,`csrf`,`capabilities`,...Object.getOwnPropertyDescriptor(e??{},`build`)?[`build`]:[]]),n=R(t.capabilities,[`actions`,`manualChecks`,`history`]),r=F(t.authority,[`browser`,`local`]),i=L(t.csrf,B),a={actions:P(n.actions),manualChecks:P(n.manualChecks),history:P(n.history)};return(r===`browser`&&(i===null||a.manualChecks)||r===`local`&&i!==null)&&j(),{...t.build===void 0?{}:{build:Pt(t.build)},protocol:I(t.protocol,1),storeId:B(t.storeId),epoch:B(t.epoch),accessGeneration:N(t.accessGeneration,1),authority:r,csrf:i,capabilities:a}}function tn(e){U({kind:`ok`,value:e},k.pageBytes);let t=R(e,[`workspaceId`,`storeId`,`epoch`,`committedSeq`,`rootLabel`,`context`,`models`,...Object.hasOwn(e??{},`activeRuns`)?[`activeRuns`]:[]]),n={...t.activeRuns===void 0?{}:{activeRuns:At(t.activeRuns)},workspaceId:B(t.workspaceId),storeId:B(t.storeId),epoch:B(t.epoch),committedSeq:H(t.committedSeq),rootLabel:M(t.rootLabel,4096,!0),context:Xt(t.context),models:z(t.models,k.maxPageEntries,Ke)};return n.activeRuns&&(n.activeRuns.storeId!==n.storeId||n.activeRuns.workspaceId!==n.workspaceId||n.activeRuns.epoch!==n.epoch)&&j(),(Zt(n.context)!==n.workspaceId||Qt(n.context)!==null||n.context.status===`available`&&n.context.version.epoch!==n.epoch)&&j(),n}function nn(e){let t=R(e,[`taskId`,`runId`,`childRunId`,`entity`]),n=R(t.entity,[`kind`,`id`,`version`]),r={taskId:B(t.taskId),runId:L(t.runId,B),childRunId:L(t.childRunId,B),entity:{kind:F(n.kind,[`task`,`run`,`child`,`message`,`tool`,`check`,`changes`,`review`]),id:B(n.id),version:N(n.version,1)}};return(r.childRunId!==null&&r.runId===null||r.entity.kind===`task`&&(r.entity.id!==r.taskId||r.runId!==null)||r.entity.kind===`run`&&(r.entity.id!==r.runId||r.childRunId!==null)||r.entity.kind===`child`&&r.entity.id!==r.childRunId||[`message`,`tool`].includes(r.entity.kind)&&r.childRunId===null||[`check`,`changes`,`review`].includes(r.entity.kind)&&r.childRunId!==null)&&j(),r}function rn(e,t){return t.kind===`task`?e.taskId===t.id:t.kind===`run`?e.runId===t.id:e.childRunId===t.id}function an(e){let t=R(e,[`identity`,`complete`,`checkoutGeneration`]);return{identity:V(t.identity),complete:P(t.complete),checkoutGeneration:N(t.checkoutGeneration)}}function on(e){U(e,k.controlBytes);let t=q(e);switch(t){case`assignment-state`:{let n=R(e,[`kind`,`childRunId`,`state`,`reason`]),r=F(n.state,[`waiting`,`ready`,`preparing`,`closing`,`unstarted`]),i=L(n.reason,e=>F(e,[`capacity`,`dependency`,`writer`,`parent-stopped`,`wait-expired`,`handoff-overflow`,`stale-dependency`,`quarantine`]));return(r===`waiting`||r===`unstarted`)&&i===null&&j(),(r===`ready`||r===`preparing`)&&i!==null&&j(),{kind:t,childRunId:B(n.childRunId),state:r,reason:i}}case`admission-closed`:return{kind:t,reason:F(R(e,[`kind`,`reason`]).reason,[`failed`,`canceled`,`timeout`,`wait-expired`,`handoff-overflow`,`stale-dependency`,`quarantine`])};case`parent-admitted`:{let n=R(e,[`kind`,`runId`,`identity`]);return{kind:t,runId:B(n.runId),identity:Yt(n.identity)}}case`parent-settled`:{let n=R(e,[`kind`,`runId`,`settlement`]),r=Et(n.settlement);return r.kind!==`parent`&&j(),{kind:t,runId:B(n.runId),settlement:r}}case`gate`:{let n=typeof e==`object`&&!!e&&Object.hasOwn(e,`reservationId`),r=R(e,[`kind`,`lane`,`state`,`checkoutGeneration`,...n?[`reservationId`]:[]]);return{kind:t,...n?{reservationId:B(r.reservationId)}:{},lane:F(r.lane,[`reader`,`writer`,`check`]),state:F(r.state,[`waiting`,`held`,`released`,`unknown`]),checkoutGeneration:N(r.checkoutGeneration)}}case`handoff`:{let n=R(e,[`kind`,`childRunId`,`handoff`,`observation`]);return{kind:t,childRunId:B(n.childRunId),handoff:st(n.handoff),observation:an(n.observation)}}case`changes`:{let n=R(e,[`kind`,`observationId`,`stage`,`observation`,`content`]),r=G(n.content);return I(r.field,`changes`),{kind:t,observationId:B(n.observationId),stage:F(n.stage,[`before`,`after`,`review`]),observation:an(n.observation),content:r}}case`check-start`:{let n=R(e,[`kind`,`checkId`,`selection`,`cwdId`,`cwdLabel`,`checkEnvGeneration`,`before`]);return{kind:t,checkId:B(n.checkId),selection:$e(n.selection),cwdId:B(n.cwdId),cwdLabel:M(n.cwdLabel,4096,!0),checkEnvGeneration:N(n.checkEnvGeneration,1),before:an(n.before)}}case`check-settled`:{let n=typeof e==`object`&&!!e&&Object.hasOwn(e,`ownAdvance`),r=R(e,[`kind`,`checkId`,`native`,`status`,`before`,`after`,`output`,`coverage`,...n?[`ownAdvance`]:[]]),i;if(n){let e=R(r.ownAdvance,[`operationId`,`reservationId`,`from`,`to`]);i={operationId:B(e.operationId),reservationId:B(e.reservationId),from:N(e.from),to:N(e.to)},(i.to!==i.from+1||i.reservationId!==r.checkId)&&j()}let a=yt(r.native),o=F(r.status,[`passed`,`failed`,`canceled`,`stale`]),s=an(r.before),c=an(r.after),l=L(r.output,G),u=J(r.coverage);return l&&l.field!==`check`&&j(),o===`passed`&&(a.outcome!==`completed`||U({...s,checkoutGeneration:c.checkoutGeneration})!==U(c)||(i?s.checkoutGeneration!==i.from||c.checkoutGeneration!==i.to||l===null:s.checkoutGeneration!==c.checkoutGeneration)||u.observed!==`complete`)&&j(),o===`canceled`&&![`canceled`,`timeout`].includes(a.outcome)&&j(),{kind:t,...i?{ownAdvance:i}:{},checkId:B(r.checkId),native:a,status:o,before:s,after:c,output:l,coverage:u}}case`review`:{let n=R(e,[`kind`,`reviewId`,`runId`,`checksRevision`,`changesIdentity`,`acceptIssues`,`outcome`,`content`]),r=P(n.acceptIssues),i=F(n.outcome,[`reviewed`,`reviewed-with-issues`]),a=G(n.content);return I(a.field,`review`),i===`reviewed-with-issues`&&!r&&j(),{kind:t,reviewId:B(n.reviewId),runId:B(n.runId),checksRevision:N(n.checksRevision),changesIdentity:V(n.changesIdentity),acceptIssues:r,outcome:i,content:a}}case`publication-intent`:{let n=R(e,[`kind`,`publicationId`,`expectedRevision`,`expectedIdentity`,`nextRevision`,`nextIdentity`]),r=N(n.expectedRevision),i=L(n.expectedIdentity,V),a=N(n.nextRevision,1);return(r===0!=(i===null)||a!==r+1)&&j(),{kind:t,publicationId:B(n.publicationId),expectedRevision:r,expectedIdentity:i,nextRevision:a,nextIdentity:V(n.nextIdentity)}}case`publication-settled`:{let n=R(e,[`kind`,`publicationId`,`status`,`observed`]),r=F(n.status,[`published`,`conflict`,`uncertain`]),i=L(n.observed,e=>{let t=R(e,[`revision`,`identity`]);return{revision:N(t.revision,1),identity:V(t.identity)}});return r===`published`&&i===null&&j(),{kind:t,publicationId:B(n.publicationId),status:r,observed:i}}default:return j()}}function sn(e){let t=R(e,[`epoch`,`operationId`,`taskId`,`runId`]);return{epoch:B(t.epoch),operationId:B(t.operationId),taskId:B(t.taskId),runId:L(t.runId,B)}}function cn(e){U(e,k.ownerQueueBytes);let t=R(e,[`observedMs`,`link`,`events`]),n=sn(t.link),r=z(t.events,k.ownerQueueFrames,e=>{let t=q(e);if(t===`fact`){let r=on(R(e,[`kind`,`fact`]).fact);return(`runId`in r&&r.runId!==n.runId||r.kind===`parent-admitted`&&(r.identity.context.task?.id!==n.taskId||r.identity.operationId!==n.operationId)||[`gate`,`assignment-state`,`admission-closed`,`handoff`,`check-start`,`check-settled`].includes(r.kind)&&n.runId===null)&&j(),{kind:t,fact:r}}if(t===`content-begin`){let r=R(e,[`kind`,`detailId`,`owner`,`field`,`encoding`]),i=nn(r.owner),a=F(r.field,[`plan`,`check`,`changes`,`review`]);return(i.taskId!==n.taskId||i.runId!==n.runId||i.childRunId!==null||i.entity.kind!==(a===`plan`?`task`:a))&&j(),{kind:t,detailId:B(r.detailId),owner:i,field:a,encoding:I(r.encoding,`utf8`)}}if(t===`content-chunk`){let n=R(e,[`kind`,`detailId`,`text`]);return{kind:t,detailId:B(n.detailId),text:M(n.text,k.chunkBytes)}}let r=R(e,[`kind`,`detailId`,`coverage`]);return I(t,`content-end`),{kind:`content-end`,detailId:B(r.detailId),coverage:J(r.coverage)}});return{observedMs:N(t.observedMs),link:n,events:r}}var ln=[`tasks`,`runs`,`messages`,`tools`,`contents`,`events`,`checks`,`changes`,`reviews`];function X(e){let t=R(e,[`reader`,`storeId`,`scope`,`snapshotSeq`,`after`,`limit`,...Object.hasOwn(e??{},`navigation`)?[`navigation`]:[]]),n=F(t.reader,ln),r=R(t.scope,[`kind`,`id`]),i={kind:F(r.kind,[`workspace`,`task`,`run`,`child`]),id:B(r.id)},a=L(t.snapshotSeq,H),o=L(t.after,e=>{let t=R(e,[`recordId`,`version`,`offset`]);return{recordId:B(t.recordId),version:N(t.version,1),offset:N(t.offset)}});return(o&&a===null||n===`tasks`!=(i.kind===`workspace`))&&j(),{reader:n,...Object.hasOwn(t,`navigation`)?{navigation:ut(t.navigation)}:{},storeId:B(t.storeId),scope:i,snapshotSeq:a,after:o,limit:N(t.limit,1,k.maxPageEntries)}}function un(e){let t=R(e,[`policy`,`historicalRuns`]),n=X(t.historicalRuns);return(n.reader!==`runs`||n.after!==null||n.snapshotSeq===null)&&j(),{policy:I(t.policy,`active-and-recent`),historicalRuns:n}}function dn(e){let t=q(e);if(t===`run`)return{kind:t,projection:zt(R(e,[`kind`,`projection`]).projection)};if(t===`capture-fact`){let n=R(e,[`kind`,`recordId`,`committedSeq`,`link`,`capture`]),r=H(n.committedSeq);return r===`0`&&j(),{kind:t,recordId:B(n.recordId),committedSeq:r,link:kt(n.link),capture:Ot(n.capture)}}if(t===`owner-fact`){let n=R(e,[`kind`,`recordId`,`committedSeq`,`observedMs`,`link`,`fact`]),r=cn({observedMs:n.observedMs,link:n.link,events:[{kind:`fact`,fact:n.fact}]}),i=r.events[0];i.kind!==`fact`&&j();let a=H(n.committedSeq);return a===`0`&&j(),{kind:t,recordId:B(n.recordId),committedSeq:a,link:r.link,observedMs:r.observedMs,fact:i.fact}}let n=[`kind`,`owner`,`version`],r=t===`task`?[`goal`,`plan`]:t===`message`?[`role`,`source`,`resultCallId`,`state`,`finalBlockCount`,`finalText`]:t===`tool`?[`source`,`name`,`declaration`,`declarationStage`,`startObserved`,`result`]:t===`content`?[`detailId`,`descriptor`,`content`,`coverage`]:[`block`],i=R(e,[...n,...r]),a=nn(i.owner),o=N(i.version,1);if([`task`,`message`,`tool`].includes(t)&&(a.entity.kind!==t||a.entity.version!==o)&&j(),t===`task`){let e=L(i.plan,G);return e&&e.field!==`plan`&&j(),{kind:t,owner:a,version:o,goal:M(i.goal,8192,!0),plan:e}}if(t===`message`){let e=F(i.role,[`user`,`assistant`,`tool-result`]),n=F(i.state,[`partial`,`final`]),r=L(i.finalBlockCount,e=>N(e,0,k.dataFrames)),s=L(i.finalText,G),c=L(i.resultCallId,B);return(n===`final`!=(r!==null)||n===`partial`&&s!==null||s&&s.field!==`final-text`||e!==`tool-result`&&c!==null)&&j(),{kind:t,owner:a,version:o,role:e,state:n,finalBlockCount:r,finalText:s,resultCallId:c,source:ft(i.source)}}if(t===`tool`){let e=L(i.declaration,pt),n=L(i.declarationStage,e=>F(e,[`partial`,`final`])),r=P(i.startObserved),s=L(i.result,e=>{let t=vt(e);return t.kind!==`tool-end`&&j(),t});return(e===null!=(n===null)||s&&(s.callId!==a.entity.id||s.startObserved!==r||U(s.declaration)!==U(e)))&&j(),{kind:t,owner:a,version:o,declaration:e,declarationStage:n,startObserved:r,result:s,source:ft(i.source),name:M(i.name,128,!0)}}if(t===`content`){let e=ht(i.descriptor),n=G(i.content);return(e.field!==n.field||!fn(e.owner,a))&&j(),{kind:t,owner:a,version:o,detailId:B(i.detailId),descriptor:e,content:n,coverage:J(i.coverage)}}I(t,`omitted`);let s=gt(i.block);return fn(s.owner,a)||j(),{kind:`omitted`,owner:a,version:o,block:s}}function fn(e,t){return e.kind===`message`||e.kind===`message-final`?t.entity.kind===`message`&&e.messageId===t.entity.id:e.kind===`tool`?t.entity.kind===`tool`&&e.callId===t.entity.id:t.entity.kind===`child`}function pn(e,t){let{scope:n,reader:r}=t,i=e.kind===`run`?{taskId:e.projection.taskId,runId:e.projection.runId,childRunId:e.projection.childRunId}:e.kind===`owner-fact`?{...e.link,childRunId:null}:e.kind===`capture-fact`?e.link:e.owner;return n.kind!==`workspace`&&!(n.kind===`task`?i.taskId===n.id:n.kind===`run`?i.runId===n.id:i.childRunId===n.id)?!1:r===`tasks`?e.kind===`task`:r===`runs`?e.kind===`run`:r===`messages`?e.kind===`message`:r===`tools`?e.kind===`tool`:r===`contents`?e.kind===`content`||e.kind===`omitted`:e.kind===`capture-fact`?r===`events`:e.kind===`owner-fact`?r===`events`||r===`checks`&&[`check-start`,`check-settled`].includes(e.fact.kind)||r===`changes`&&e.fact.kind===`changes`||r===`reviews`&&e.fact.kind===`review`:!1}function mn(e){U({kind:`ok`,value:e},k.pageBytes);let t=R(e,[`request`,`records`,`next`,`coverage`]),n=X(t.request);n.snapshotSeq===null&&j();let r=z(t.records,n.limit,dn),i=L(t.next,X);return(r.some(e=>!pn(e,n))||i&&(i.after===null||U(Wt({...i,after:n.after}))!==U(Wt(n))||U(i.after)===U(n.after)))&&j(),{request:n,records:r,next:i,coverage:J(t.coverage)}}function hn(e){if(Object.getOwnPropertyDescriptor(e??{},`kind`)?.value===`snapshot`){U({kind:`ok`,value:e},k.pageBytes);let t=R(e,[`kind`,`request`,`next`,`coverage`]),n=X(t.request),r=X(t.next);return(n.snapshotSeq!==null||n.after!==null||r.snapshotSeq===null||!r.navigation||U(Wt({...r,snapshotSeq:null}))!==U(Wt(n)))&&j(),{kind:`snapshot`,request:n,next:r,coverage:J(t.coverage)}}if(Object.getOwnPropertyDescriptor(e??{},`kind`)?.value!==`progress`)return mn(e);U({kind:`ok`,value:e},k.pageBytes);let t=R(e,[`kind`,`request`,`next`,`coverage`]),n=X(t.request),r=X(t.next);return Gt(n,r),{kind:`progress`,request:n,next:r,coverage:J(t.coverage)}}function gn(e,t){return U({...t.request,snapshotSeq:e.snapshotSeq})===U(e)&&(e.snapshotSeq===null||e.snapshotSeq===t.request.snapshotSeq)}function _n(e){let t=R(e,[`storeId`,`scope`,`snapshotSeq`,`graph`,...Object.hasOwn(e??{},`navigation`)?[`navigation`]:[]]),n=R(t.graph,[`recordId`,`revision`,`sha256`]);return{...Object.hasOwn(t,`navigation`)?{navigation:ut(t.navigation)}:{},storeId:B(t.storeId),scope:lt(t.scope),snapshotSeq:H(t.snapshotSeq),graph:{recordId:B(n.recordId),revision:N(n.revision,1),sha256:V(n.sha256)}}}function vn(e){U({kind:`ok`,value:e});let t=R(e,[`request`,`graph`]),n=_n(t.request),r=Xe(t.graph);return(r.revision!==n.graph.revision||n.scope.kind===`task`&&n.scope.id!==r.taskId)&&j(),{request:n,graph:r}}function yn(e){if(Object.getOwnPropertyDescriptor(e??{},`kind`)?.value!==`progress`)return vn(e);U({kind:`ok`,value:e},k.pageBytes);let t=R(e,[`kind`,`request`,`next`,`coverage`]),n=_n(t.request),r=_n(t.next);return Gt(n,r),{kind:`progress`,request:n,next:r,coverage:J(t.coverage)}}function bn(e){let t=R(e,[`storeId`,`scope`,`snapshotSeq`,`format`]);return{storeId:B(t.storeId),scope:lt(t.scope),snapshotSeq:H(t.snapshotSeq),format:F(t.format,[`ndjson`,`markdown`])}}function xn(e){U(e,k.controlBytes);let t=R(e,[`exportId`,`ordinal`,`event`]),n=q(t.event),r;switch(n){case`manifest`:{let e=R(t.event,[`kind`,`schema`,`request`,`coverage`,`serviceProtocol`,`workerProtocol`,`provenance`]),i=R(e.provenance,[`exporterBuildSha256`,`capturePolicy`]);r={kind:n,provenance:{exporterBuildSha256:V(i.exporterBuildSha256),capturePolicy:I(i.capturePolicy,`public-text-tools/2`)},schema:I(e.schema,Ne),request:bn(e.request),coverage:J(e.coverage),serviceProtocol:I(e.serviceProtocol,1),workerProtocol:I(e.workerProtocol,2)};break}case`record`:r={kind:n,record:dn(R(t.event,[`kind`,`record`]).record)};break;case`graph`:r={kind:n,graph:vn(R(t.event,[`kind`,`graph`]).graph)};break;case`detail`:{let e=R(t.event,[`kind`,`owner`,`content`,`range`,`text`,`coverage`]),i=G(e.content),a=L(e.range,K),o=M(e.text,k.detailPageBytes);(a?a.end>i.bytes||a.end-a.start!==Ie(o):i.bytes!==0||o!==``)&&j(),r={kind:n,owner:nn(e.owner),content:i,range:a,text:o,coverage:J(e.coverage)};break}case`markdown`:r={kind:n,text:M(R(t.event,[`kind`,`text`]).text,k.detailPageBytes)};break;case`trailer`:{let e=R(t.event,[`kind`,`complete`,`frames`,`encodedBytes`,`sha256`,`committedSeq`,`coverage`]),i=J(e.coverage),a=P(e.complete);a&&i.observed!==`complete`&&j(),r={kind:n,complete:a,frames:N(e.frames,1),encodedBytes:N(e.encodedBytes),sha256:V(e.sha256),committedSeq:H(e.committedSeq),coverage:i};break}default:return j()}return{exportId:B(t.exportId),ordinal:N(t.ordinal,1),event:r}}function Sn(e,t){let n=xn(e);return t===`ndjson`?`${U(n)}\n`:n.event.kind===`markdown`?n.event.text:(n.event.kind!==`manifest`&&n.event.kind!==`trailer`&&j(),`\n\n\`\`\`json\n${U(n)}\n\`\`\`\n`)}var Cn=class{exportId=null;ordinal=0;bytes=0;ended=!1;complete=!1;request;constructor(e){this.request=bn(e)}receive(e){let t=xn(e),n=t.event;return(this.ended||t.ordinal!==this.ordinal+1||this.exportId!==null&&this.exportId!==t.exportId)&&j(),this.ordinal===0?(n.kind!==`manifest`||U(n.request)!==U(this.request))&&j():n.kind===`manifest`&&j(),n.kind===`trailer`?((n.frames!==this.ordinal||n.encodedBytes!==this.bytes||n.committedSeq!==this.request.snapshotSeq)&&j(),this.ended=!0,this.complete=n.complete):(this.request.format===`markdown`&&n.kind!==`manifest`&&n.kind!==`markdown`&&j(),this.request.format===`ndjson`&&n.kind===`markdown`&&j(),n.kind===`detail`&&!rn(n.owner,this.request.scope)&&j(),n.kind===`graph`&&(U(n.graph.request.scope)!==U(this.request.scope)||n.graph.request.snapshotSeq!==this.request.snapshotSeq||n.graph.request.storeId!==this.request.storeId)&&j(),n.kind===`record`&&!wn(n.record,this.request.scope)&&j(),this.bytes+=Ie(Sn(t,this.request.format))),this.exportId=t.exportId,this.ordinal=t.ordinal,t}get completion(){return this.ended?this.complete?`complete-unverified-digest`:`incomplete`:`missing-trailer`}};function wn(e,t){return e.kind===`run`?Bt(e.projection,t):e.kind===`owner-fact`?t.kind===`task`?e.link.taskId===t.id:t.kind===`run`&&e.link.runId===t.id:e.kind===`capture-fact`?t.kind===`task`?e.link.taskId===t.id:t.kind===`run`?e.link.runId===t.id:e.link.childRunId===t.id:rn(e.owner,t)}function Tn(e){let t=R(e,[`taskId`,`revision`,`definitions`]),n=z(t.definitions,32,e=>{let t=R(e,[`selection`,`status`,`checkId`]),n=$e(t.selection),r=F(t.status,[`not-run`,`passed`,`failed`,`canceled`,`stale`]),i=L(t.checkId,B);return(n.kind!==`configured`||r===`not-run`!=(i===null))&&j(),{selection:n,status:r,checkId:i}});return new Set(n.map(e=>e.selection.name)).size!==n.length&&j(),{taskId:B(t.taskId),revision:N(t.revision),definitions:n}}function En(e){let t=R(e,[`storeId`,`scope`,`snapshotSeq`,`kind`,`id`,`version`,...Object.hasOwn(e??{},`navigation`)?[`navigation`]:[]]);return{...Object.hasOwn(t,`navigation`)?{navigation:ut(t.navigation)}:{},storeId:B(t.storeId),scope:lt(t.scope),snapshotSeq:H(t.snapshotSeq),kind:F(t.kind,[`task`,`message`,`tool`]),id:B(t.id),version:N(t.version,1)}}function Dn(e){U({kind:`ok`,value:e},k.pageBytes);let t=R(e,[`request`,`record`]),n=En(t.request),r=dn(t.record);return(r.kind!==`task`&&r.kind!==`message`&&r.kind!==`tool`||r.kind!==n.kind||r.owner.entity.id!==n.id||r.version!==n.version||!rn(r.owner,n.scope))&&j(),{request:n,record:r}}function On(e){if(Object.getOwnPropertyDescriptor(e??{},`kind`)?.value!==`progress`)return Dn(e);U({kind:`ok`,value:e},k.pageBytes);let t=R(e,[`kind`,`request`,`next`,`coverage`]),n=En(t.request),r=En(t.next);return Gt(n,r),{kind:`progress`,request:n,next:r,coverage:J(t.coverage)}}var kn=e=>{let t=Be(e);return I(t.effect,`none`),t};function An(e){let t=R(e,[`storeId`,`taskId`]);return{storeId:B(t.storeId),taskId:L(t.taskId,B)}}function jn(e){let t=An(e);return t.taskId===null&&j(),t}function Mn(e){let t=R(e,[`id`,`kind`,`revision`,`identity`]);return{id:B(t.id),kind:F(t.kind,[`code`,`research`,`diagnosis`]),revision:N(t.revision,1),identity:V(t.identity)}}function Nn(e){let t=z(e,3,qe);return(t.length!==3||new Set(t.map(e=>e.role)).size!==3)&&j(),t}function Pn(e){let t=Object.getOwnPropertyDescriptor(e??{},`status`)?.value;if(t===`none`)return R(e,[`status`]),{status:t};if(t===`saved`){let n=R(e,[`status`,`request`,`planRevision`]);return{status:t,request:_n(n.request),planRevision:N(n.planRevision,1)}}let n=R(e,[`status`,`error`]);return I(n.status,`unavailable`),{status:`unavailable`,error:kn(n.error)}}function Fn(e){if((!(e.task?e.task.id===e.request.taskId:e.request.taskId===null||e.context.status===`unavailable`)||Zt(e.context)!==e.workspaceId||Qt(e.context)!==e.request.taskId)&&j(),e.context.status===`available`){let t=e.context.version;(t.epoch!==e.epoch||!!t.task!=!!e.task||e.task&&(t.task?.revision!==e.task.revision||t.task.identity!==e.task.identity||t.task.kind!==e.task.kind))&&j()}}function In(e){U({kind:`ok`,value:e},k.pageBytes);let t=R(e,[`request`,`workspaceId`,`epoch`,`committedSeq`,`context`,`task`,`roles`,`readablePlan`,`savedGraph`]),n={request:An(t.request),workspaceId:B(t.workspaceId),epoch:B(t.epoch),committedSeq:H(t.committedSeq),context:Xt(t.context),task:L(t.task,Mn),roles:Nn(t.roles),savedGraph:Pn(t.savedGraph),readablePlan:L(t.readablePlan,e=>{let t=R(e,[`source`,`text`,`editable`,`coverage`]),n=J(t.coverage),r=P(t.editable);return r&&(n.redacted||n.observed!==`complete`||n.source!==`complete`||n.omissions.length)&&j(),{source:I(t.source,`current-v1`),text:M(t.text,32768),editable:r,coverage:n}})};Fn(n),!!n.task!=!!n.readablePlan&&j();let r=n.savedGraph;return r.status===`saved`&&(r.request.storeId!==n.request.storeId||r.request.scope.kind!==`task`||r.request.scope.id!==n.task?.id||r.request.snapshotSeq!==n.committedSeq||n.context.status===`available`&&(r.request.graph.sha256!==n.context.version.task?.graphIdentity||r.request.graph.revision!==n.context.version.task?.graphRevision))&&j(),r.status===`unavailable`&&n.context.status===`available`&&j(),n}function Ln(e){U({kind:`ok`,value:e},k.pageBytes);let t=R(e,[`request`,`workspaceId`,`epoch`,`committedSeq`,`context`,`task`,`observation`,`text`,`git`,`coverage`]),n=R(t.observation,[`identity`,`complete`,`checkoutGeneration`]),r={request:jn(t.request),workspaceId:B(t.workspaceId),epoch:B(t.epoch),committedSeq:H(t.committedSeq),context:Xt(t.context),task:Mn(t.task),observation:{identity:V(n.identity),complete:P(n.complete),checkoutGeneration:N(n.checkoutGeneration,0)},text:M(t.text,131072),git:P(t.git),coverage:J(t.coverage)};if(Fn(r),r.context.status===`available`){let e=r.context.version;(e.observation.identity!==r.observation.identity||e.observation.complete!==r.observation.complete||e.checkoutGeneration!==r.observation.checkoutGeneration)&&j()}return r}function Rn(e){let t=R(e,[`epoch`,`accessGeneration`,`configRev`,`catalogId`]);return{epoch:B(t.epoch),accessGeneration:N(t.accessGeneration,1),configRev:N(t.configRev,1),catalogId:B(t.catalogId)}}function zn(e){U({kind:`ok`,value:e},k.pageBytes);let t=R(e,[`version`,`selected`]);return{version:Rn(t.version),selected:L(t.selected,Ke)}}function Bn(e){U(e);let t=R(e,[`expected`,`choice`]);return{expected:Rn(t.expected),choice:Ge(t.choice)}}function Vn(e){let t=R(e,[`provider`,`model`,`api`,`thinking`,`eligibility`]),n={provider:M(t.provider,128,!0),model:M(t.model,256,!0),api:L(t.api,e=>F(e,Ue)),thinking:z(t.thinking,7,e=>{let t=R(e,[`level`,`selectable`]);return{level:F(t.level,We),selectable:P(t.selectable)}}),eligibility:F(t.eligibility,[`candidate`,`unsupported`,`auth-unavailable`])};return(new Set(n.thinking.map(e=>e.level)).size!==n.thinking.length||n.thinking.some(e=>e.selectable&&(n.api===null||n.eligibility!==`candidate`))||n.eligibility===`candidate`&&!n.thinking.some(e=>e.selectable))&&j(),n}function Hn(e){U({kind:`ok`,value:e},k.pageBytes);let t=R(e,[`version`,`selected`,`status`,`entries`,`withheld`]),n=z(t.entries,k.maxPageEntries,Vn),r=F(t.status,[`complete`,`capacity`]),i=N(t.withheld,0,k.maxPageEntries);return(r===`capacity`&&(n.length||i)||n.length+i>k.maxPageEntries||new Set(n.map(e=>U([e.provider,e.model]))).size!==n.length)&&j(),{version:Rn(t.version),selected:L(t.selected,Ke),status:r,entries:n,withheld:i}}async function Un(e,t,n){let r=await e.preflight(t,n);return r.kind===`error`?r:{kind:`ok`,value:{preflight:r.value,commandId:crypto.randomUUID(),submitted:!1}}}function Wn(e,t){if(t.submitted)throw Error(`Already submitted; observe the same receipt.`);t.submitted=!0;let n=t.preflight,r={commandId:t.commandId,expected:n.preview.version,grant:n.grant},i=n.preview.action;switch(i.kind){case`create`:return e.create({...r,action:i});case`save-plan`:return e.savePlan({...r,action:i});case`generate-plan`:return e.generatePlan({...r,action:i});case`start`:return e.start({...r,action:i});case`check`:return e.check({...r,action:i});case`review`:return e.review({...r,action:i})}}var Z=e=>({kind:`error`,error:Fe(`unavailable`,e?`uncertain`:`none`)}),Gn=class{transport;constructor(e){this.transport=e}async current(e,t){let n=An(e);try{if(!this.transport.current)return Z(!1);let e=Y(await this.transport.current(n,t),In);return e.kind===`ok`&&U(e.value.request)!==U(n)?Z(!1):e}catch{return Z(!1)}}async currentChanges(e,t){let n=jn(e);try{if(!this.transport.currentChanges)return Z(!1);let e=Y(await this.transport.currentChanges(n,t),Ln);return e.kind===`ok`&&U(e.value.request)!==U(n)?Z(!1):e}catch{return Z(!1)}}async activeRuns(e){try{return this.transport.activeRuns?Y(await this.transport.activeRuns(e),At):Z(!1)}catch{return Z(!1)}}async models(e){try{return this.transport.models?Y(await this.transport.models(e),Hn):Z(!1)}catch{return Z(!1)}}async chooseModel(e){let t=Bn(e);try{if(!this.transport.chooseModel)return Z(!1);let e=Y(await this.transport.chooseModel(t),zn);if(e.kind===`ok`){let{sourceSelectionId:n,...r}=e.value.selected??{};if(U(r)!==U(t.choice)||e.value.version.epoch!==t.expected.epoch||e.value.version.accessGeneration!==t.expected.accessGeneration||![t.expected.configRev,t.expected.configRev+1].includes(e.value.version.configRev)||e.value.version.configRev===t.expected.configRev!=(e.value.version.catalogId===t.expected.catalogId))return Z(!0)}return e}catch{return Z(!0)}}async checkObligations(e,t){B(e);try{let n=Y(await this.transport.checkObligations(e,t),Tn);return n.kind===`ok`&&n.value.taskId!==e?Z(!1):n}catch{return Z(!1)}}task(e,t){return this.entity(`task`,e,t)}message(e,t){return this.entity(`message`,e,t)}tool(e,t){return this.entity(`tool`,e,t)}async entity(e,t,n){let r=En({...t,kind:e});try{let e=Y(await this.transport.entity(r,n),On);return e.kind===`ok`&&U(e.value.request)!==U(r)?Z(!1):e}catch{return Z(!1)}}async session(e){try{return Y(await this.transport.session(e),en)}catch{return Z(!1)}}async workspace(e){try{return Y(await this.transport.workspace(e),tn)}catch{return Z(!1)}}tasks(e,t){return this.page(`tasks`,e,t)}runs(e,t){return this.page(`runs`,e,t)}messages(e,t){return this.page(`messages`,e,t)}tools(e,t){return this.page(`tools`,e,t)}contents(e,t){return this.page(`contents`,e,t)}events(e,t){return this.page(`events`,e,t)}checks(e,t){return this.page(`checks`,e,t)}changes(e,t){return this.page(`changes`,e,t)}reviews(e,t){return this.page(`reviews`,e,t)}async page(e,t,n){let r=X({...t,reader:e});try{let t=Y(await this.transport[e](r,n),hn);return t.kind===`ok`&&!gn(r,t.value)?Z(!1):t}catch{return Z(!1)}}async graph(e,t){let n=_n(e);try{let e=Y(await this.transport.graph(n,t),yn);return e.kind===`ok`&&U(e.value.request)!==U(n)?Z(!1):e}catch{return Z(!1)}}async*export(e,t){let n=bn(e),r=new Cn(n),i;try{if(t.aborted)throw new A(`unavailable`);for await(let e of this.transport.export(n,t)){if(t.aborted)throw new A(`unavailable`);let n=r.receive(e);n.event.kind===`trailer`?i=n:yield n}if(t.aborted||!i)throw new A(`unavailable`);yield i}catch{throw new A(`unavailable`)}}async preflight(e,t){let n=tt({expected:e,action:t});try{let e=Y(await this.transport.preflight(n),ot);return e.kind===`ok`&&(U(e.value.preview.version)!==U(n.expected)||U(e.value.preview.action)!==U(n.action))?Z(!1):e}catch{return Z(!1)}}create(e){return this.execute(`create`,e)}savePlan(e){return this.execute(`save-plan`,e)}generatePlan(e){return this.execute(`generate-plan`,e)}start(e){return this.execute(`start`,e)}check(e){return this.execute(`check`,e)}review(e){return this.execute(`review`,e)}async execute(e,t){let n=nt(t);if(n.action.kind!==e)return{kind:`error`,error:Fe(`invalid`)};try{let e=Y(await this.transport.command(n),It);if(e.kind===`ok`){if(e.value.commandId!==n.commandId)return Z(!0);Lt({identity:{kind:`action`,expected:n.expected,action:n.action},receipt:e.value})}return e}catch{return Z(!0)}}async cancel(e){let t=it(e);try{let e=Y(await this.transport.cancel(t),It);if(e.kind===`ok`){if(e.value.commandId!==t.commandId)return Z(!0);Lt({identity:{kind:`cancel`,epoch:t.epoch,runId:t.runId},receipt:e.value})}return e}catch{return Z(!0)}}async receipt(e,t){B(e);try{let n=Rt(await this.transport.receipt(e,t));if(n.status===`found`&&n.receipt.commandId!==e)throw Error(`invalid`);return n}catch{return{status:`inconclusive`,error:Fe(`receipt-inconclusive`,`uncertain`)}}}async snapshot(e,t){let n=lt(e);try{let e=Y(await this.transport.snapshot(n,t),Ht);return e.kind===`ok`&&U(e.value.scope)!==U(n)?Z(!1):e}catch{return Z(!1)}}async detail(e,t){let n=dt(e);try{let e=Y(await this.transport.detail(n,t),Kt);return e.kind===`ok`&&U(e.value.cursor)!==U(n)?Z(!1):e}catch{return Z(!1)}}async search(e,t){let n=dt(e);try{let e=Y(await this.transport.search(n,t),Jt);return e.kind===`ok`&&U(e.value.cursor)!==U(n)?Z(!1):e}catch{return Z(!1)}}},Kn=class{generation=0;snapshotRequest=0;observation;lastSnapshotMs=0;beginSnapshot(){return++this.snapshotRequest}install(e,t,n){if(n!==this.snapshotRequest)return;let r=Ht(e),i=this.observation?.snapshot;if(i&&i.storeId===r.storeId&&U(i.scope)===U(r.scope)&&Le(r.committedSeq,i.committedSeq)<0)this.resync();else return this.observation={snapshot:r,connection:`current`,lastObservedMs:t},this.lastSnapshotMs=t,++this.generation}resync(){return this.observation&&(this.observation.connection=`resync`),this.snapshotRequest++,`resync`}get state(){return this.observation&&structuredClone(this.observation)}needsPoll(e){return!this.observation||this.observation.connection===`resync`||e<this.lastSnapshotMs||e-this.lastSnapshotMs>=k.reconcileMs}tick(e){let t=this.observation;t&&t.connection!==`resync`&&(e<t.lastObservedMs||e-t.lastObservedMs>=k.staleMs)&&(t.connection=`stale`)}receive(e,t,n){let r=this.observation;if(!r||t!==this.generation)return`ignored`;if(r.connection===`resync`)return`resync`;let i;try{i=Ut(e)}catch{return this.resync()}let a=r.snapshot;if(i.storeId!==a.storeId||i.epoch!==a.epoch||U(i.scope)!==U(a.scope))return this.resync();let o=Le(i.committedSeq,a.committedSeq);if(o<0)return`duplicate`;if(i.kind===`heartbeat`)return o>0?this.resync():(r.lastObservedMs=n,r.connection=`current`,`applied`);if(o===0)return`duplicate`;if(i.previousSeq!==a.committedSeq||Zt(i.context)!==Zt(a.context)||Qt(i.context)!==Qt(a.context)||i.context.status===`available`&&a.context.status===`available`&&i.context.version.controlRev<a.context.version.controlRev)return this.resync();let s=[...a.runs];for(let e of i.removed){let t=s.findIndex(t=>(t.childRunId??t.runId)===e);if(t===-1||s[t].lifecycle!==`settled`)return this.resync();s.splice(t,1)}for(let e of i.runs){let t=e.childRunId??e.runId,n=s.findIndex(e=>(e.childRunId??e.runId)===t);if(n===-1)s.push(e);else{let t=s[n];if(t.runId!==e.runId||t.childRunId!==e.childRunId||t.assignmentId!==e.assignmentId||U(t.admission)!==U(e.admission))return this.resync();s[n]=e}}if(s.length>k.maxPageEntries)return this.resync();let c={...a,runs:s,context:i.context,committedSeq:i.committedSeq,horizon:{...a.horizon,historicalRuns:{...a.horizon.historicalRuns,snapshotSeq:i.committedSeq}}};try{Ht(c)}catch{return this.resync()}return a.runs=s,a.horizon=c.horizon,a.context=i.context,a.committedSeq=i.committedSeq,r.lastObservedMs=n,r.connection=`current`,`applied`}},qn={session:`/api/v1/session`,current:`/api/v1/current`,currentChanges:`/api/v1/current-changes`,activeRuns:`/api/v1/active-runs`,models:`/api/v1/models`,chooseModel:`/api/v1/model-choice`,workspace:`/api/v1/workspace`,tasks:`/api/v1/tasks`,runs:`/api/v1/runs`,messages:`/api/v1/messages`,tools:`/api/v1/tools`,contents:`/api/v1/contents`,events:`/api/v1/history-events`,checks:`/api/v1/checks`,changes:`/api/v1/changes`,reviews:`/api/v1/reviews`,checkObligations:`/api/v1/check-obligations`,entity:`/api/v1/entity`,graph:`/api/v1/graph`,snapshot:`/api/v1/snapshot`,detail:`/api/v1/details`,search:`/api/v1/search`,export:`/api/v1/export`,download:`/api/v1/download`,preflight:`/api/v1/preflight`,command:`/api/v1/commands`,cancel:`/api/v1/cancel`,receipt:`/api/v1/receipt`,detach:`/api/v1/detach`},Jn=`/api/v1/events`,Yn=[`tasks`,`runs`,`messages`,`tools`,`contents`,`events`,`checks`,`changes`,`reviews`];function Xn(e,t){if(Yn.includes(e)||e===`detail`||e===`search`||e===`entity`||e===`current`||e===`currentChanges`||e===`activeRuns`||e===`workspace`||e===`models`||e===`chooseModel`)return k.pageBytes;if(e===`graph`){let e=Object.getOwnPropertyDescriptor(t??{},`kind`)?.value,n=Object.getOwnPropertyDescriptor(t??{},`value`)?.value;if(e===`ok`&&Object.getOwnPropertyDescriptor(n??{},`kind`)?.value===`progress`)return k.pageBytes}return k.controlBytes}function Zn(e){return[`preflight`,`command`,`cancel`,`detach`,`chooseModel`].includes(e)}function Qn(e,t){switch(e){case`session`:case`models`:case`activeRuns`:case`workspace`:case`detach`:if(t!==null)throw new A(`invalid`);return null;case`tasks`:case`runs`:case`messages`:case`tools`:case`contents`:case`events`:case`checks`:case`changes`:case`reviews`:{let n=X(t);if(n.reader!==e)throw new A(`invalid`);return n}case`current`:return An(t);case`currentChanges`:return jn(t);case`checkObligations`:case`receipt`:return B(t);case`entity`:return En(t);case`graph`:return _n(t);case`snapshot`:return lt(t);case`detail`:case`search`:return dt(t);case`export`:case`download`:return bn(t);case`chooseModel`:return Bn(t);case`preflight`:return tt(t);case`command`:return nt(t);case`cancel`:return it(t)}}function $n(e,t){if(Yn.includes(e))return Y(t,hn);switch(e){case`current`:return Y(t,In);case`currentChanges`:return Y(t,Ln);case`activeRuns`:return Y(t,At);case`models`:return Y(t,Hn);case`chooseModel`:return Y(t,zn);case`session`:return Y(t,en);case`workspace`:return Y(t,tn);case`checkObligations`:return Y(t,Tn);case`entity`:return Y(t,On);case`graph`:return Y(t,yn);case`snapshot`:return Y(t,Ht);case`detail`:return Y(t,Kt);case`search`:return Y(t,Jt);case`preflight`:return Y(t,ot);case`command`:case`cancel`:return Y(t,It);case`receipt`:return Rt(t);case`detach`:return Y(t,e=>{if(e!==null)throw new A(`invalid`);return null});default:throw new A(`invalid`)}}function er(e){return[...Yn,`current`,`currentChanges`,`checkObligations`,`entity`,`graph`,`snapshot`,`detail`,`search`,`export`,`download`,`receipt`].includes(e)}function tr(e,t){let n=qn[e];return t===null||Zn(e)?n:`${n}?request=${encodeURIComponent(U(t))}`}function nr(e,t){let n=Qn(e,t),r=typeof n==`object`&&!!n&&Object.hasOwn(n,`navigation`),i=r?qn[e]:tr(e,n);return Zn(e)||er(e)&&(r||Ie(i)>k.headerBytes/4)?{path:qn[e],method:`POST`,body:U(n)}:{path:i,method:`GET`}}function rr(e){U(e,k.viewerBytes);let t=F(Object.getOwnPropertyDescriptor(e,`kind`)?.value,[`snapshot`,`event`,`resync`]);return t===`snapshot`?{kind:t,snapshot:Ht(R(e,[`kind`,`snapshot`]).snapshot)}:t===`event`?{kind:t,event:Ut(R(e,[`kind`,`event`]).event)}:(R(e,[`kind`]),{kind:t})}var ir=class{options;attachment;csrf=null;fetcher;origin;constructor(e){this.options=e;let t=new URL(e.origin);if(t.origin!==e.origin||t.protocol!==`https:`&&!/^http:\/\/(?:127\.0\.0\.1|\[::1\]):[1-9][0-9]*$/.test(e.origin))throw new A(`invalid`);this.origin=e.origin,e.build&&=Nt(e.build),this.fetcher=e.fetch??globalThis.fetch.bind(globalThis)}headers(e){let t={"Cache-Control":`no-store`};if(this.options.build&&(t[`X-Cadence-Build`]=U(this.options.build)),this.attachment&&(t[`X-Cadence-Attachment`]=this.attachment),this.options.localCapability&&(t[`X-Cadence-Local`]=this.options.localCapability),e){if(!this.attachment||!this.options.localCapability&&!this.csrf)throw new A(`stale`);t[`Content-Type`]=`application/json`,this.csrf&&(t[`X-Cadence-CSRF`]=this.csrf)}return t}async request(e,t,n){let r=nr(e,Qn(e,t)),i=r.method===`POST`,a=await this.fetcher(`${this.origin}${r.path}`,{method:r.method,headers:this.headers(i),credentials:`same-origin`,redirect:`error`,signal:this.options.requestTimeoutMs===void 0?n:AbortSignal.any([...n?[n]:[],AbortSignal.timeout(this.options.requestTimeoutMs)]),...i?{body:r.body}:{}}),o;try{e===`session`&&a.ok&&(o=B(a.headers.get(`x-cadence-attachment`)),this.attachment=o)}catch(e){throw await a.body?.cancel().catch(()=>{}),e}let s=await ar(a,Xn(e)),c=ze(s);if(Ie(s)>Xn(e,c))throw new A(`oversize`);let l=$n(e,c);if(e===`session`){let e=Y(l,en);if(e.kind===`ok`){if(e.value.authority===`local`!=!!this.options.localCapability)throw new A(`forbidden`);this.attachment=o??B(a.headers.get(`x-cadence-attachment`)),this.csrf=e.value.csrf}}return l}session(e){return this.request(`session`,null,e)}current(e,t){return this.request(`current`,e,t)}currentChanges(e,t){return this.request(`currentChanges`,e,t)}activeRuns(e){return this.request(`activeRuns`,null,e)}models(e){return this.request(`models`,null,e)}chooseModel(e){return this.request(`chooseModel`,Bn(e))}workspace(e){return this.request(`workspace`,null,e)}checkObligations(e,t){return this.request(`checkObligations`,B(e),t)}entity(e,t){return this.request(`entity`,En(e),t)}tasks(e,t){return this.request(`tasks`,X(e),t)}runs(e,t){return this.request(`runs`,X(e),t)}messages(e,t){return this.request(`messages`,X(e),t)}tools(e,t){return this.request(`tools`,X(e),t)}contents(e,t){return this.request(`contents`,X(e),t)}events(e,t){return this.request(`events`,X(e),t)}checks(e,t){return this.request(`checks`,X(e),t)}changes(e,t){return this.request(`changes`,X(e),t)}reviews(e,t){return this.request(`reviews`,X(e),t)}graph(e,t){return this.request(`graph`,_n(e),t)}preflight(e){return this.request(`preflight`,tt(e))}command(e){return this.request(`command`,nt(e))}cancel(e){return this.request(`cancel`,it(e))}receipt(e,t){return this.request(`receipt`,B(e),t)}snapshot(e,t){return this.request(`snapshot`,e,t)}detail(e,t){return this.request(`detail`,e,t)}search(e,t){return this.request(`search`,e,t)}async detach(){let e=this.attachment;if(!e)return;let t=Y(await this.request(`detach`,null),e=>{if(e!==null)throw new A(`invalid`);return null});if(t.kind===`error`&&t.error.code!==`stale`&&t.error.code!==`unauthenticated`)throw new A(t.error.code);return this.attachment===e&&(this.attachment=void 0,this.csrf=null),t}async*export(e,t){let n=nr(`export`,bn(e)),r=await this.fetcher(`${this.origin}${n.path}`,{method:n.method,headers:this.headers(n.method===`POST`),...n.body===void 0?{}:{body:n.body},credentials:`same-origin`,redirect:`error`,signal:t});if(!r.ok||!r.body)throw await r.body?.cancel(),new A(`unavailable`);let i=r.body.getReader(),a=new TextDecoder(`utf-8`,{fatal:!0}),o=``;try{for(;;){let{value:e,done:n}=await i.read();if(t.aborted)throw new A(`unavailable`);for(let t=0;t<(n?1:e.byteLength);t+=k.chunkBytes){o+=n?a.decode():a.decode(e.subarray(t,t+k.chunkBytes),{stream:!0});let r=o.indexOf(`
|
|
2
|
+
`);for(;r!==-1;){let e=o.slice(0,r);o=o.slice(r+1),yield xn(ze(e,k.controlBytes)),r=o.indexOf(`
|
|
3
|
+
`)}if(new TextEncoder().encode(o).length>k.controlBytes)throw new A(`oversize`)}if(n){if(o)throw new A(`invalid`);break}}}finally{await i.cancel().catch(()=>{}),i.releaseLock()}}subscribe(e,t,n){let r=lt(e);if(!this.attachment||!this.options.socket)throw new A(`unavailable`);let i=this.options.socket(`${this.origin.replace(/^http/,`ws`)}${Jn}?attachment=${this.attachment}`),a=!1,o=!1,s=Date.now(),c=Date.now(),l=()=>{if(!o){o=!0,a=!1,clearInterval(d);try{i.close()}catch{}u(`closed`)}},u=e=>{try{n(e)}catch{}},d=setInterval(()=>{if(a){Date.now()-s>=k.staleMs&&u(`stale`);try{Date.now()-c>=k.reconcileMs?(i.send(U({kind:`resync`,scope:r})),c=Date.now()):i.send(`{"kind":"ping"}`)}catch{l()}}},k.heartbeatMs);return i.addEventListener(`open`,()=>{if(!o){a=!0;try{i.send(U({kind:`subscribe`,scope:r}))}catch{l()}}}),i.addEventListener(`message`,e=>{if(!o)try{if(typeof e.data!=`string`)throw new A(`invalid`);let n=rr(ze(e.data,k.viewerBytes));s=Date.now(),u(`current`),t(n)}catch{l()}}),i.addEventListener(`error`,l),i.addEventListener(`close`,l),l}};async function ar(e,t){if(!e.body)throw new A(`invalid`);let n=e.body.getReader(),r=new TextDecoder(`utf-8`,{fatal:!0}),i=0,a=``;try{for(;;){let{value:e,done:o}=await n.read();if(o)return a+r.decode();if(i+=e.byteLength,i>t)throw new A(`oversize`);a+=r.decode(e,{stream:!0})}}finally{await n.cancel().catch(()=>{}),n.releaseLock()}}var or={sourceHash:`c3f3278d6d0b73b1c047cca158dd82750f1d420a2257f9b7352d2daf20520b44`,contractHash:`e9b1ea4bb8d1c275a0cb0cf70947f9ac58e5de0cc438d551dc96809f3e82dd7c`,buildId:`fb909a91e624aa0689cea3608ddc70a81473055561edb11b246a950ab11753e1`};function sr(){let e=new ir({origin:window.location.origin,...or?{build:{kind:`browser`,...or}}:{},socket:e=>new WebSocket(e)});return{client:new Gn(e),transport:e}}async function cr(e,t,n,r){let i=In(e);if(i.context.status!==`available`||!i.context.version.task||!i.readablePlan?.editable||i.savedGraph.status===`unavailable`)throw new A(`unavailable`);let a=i.context.version,o=a.task;if(!o)throw new A(`stale`);let s=M(t,32768),c=et({kind:`save-plan`,taskId:o.id,plan:s,graph:{schema:`cadence-graph/2`,taskId:o.id,taskKind:o.kind,taskRevision:o.revision+1,revision:(o.graphRevision??0)+1,planRevision:i.savedGraph.status===`saved`?i.savedGraph.planRevision+1:1,plan:{recordId:r.uuid(),version:i.savedGraph.status===`saved`?i.savedGraph.planRevision+1:1,field:`plan`,bytes:Ie(s),sha256:`0`.repeat(64)},assignments:n}});if(c.kind!==`save-plan`)throw new A(`invalid`);for(let e of c.graph.assignments){let t=i.roles.find(t=>t.role===Je(e.purpose));if(!t||U(t)!==U(e.role)||U(a.model)!==U(e.model))throw new A(`stale`)}c.graph.plan.sha256=await r.sha256(new TextEncoder().encode(s));let l=et(c);if(l.kind!==`save-plan`)throw new A(`invalid`);return l}var lr=`Current plan metadata unavailable. Observe again; historical text is not action authority.`;function ur(e,t){let n=async n=>{let r=await e.current({storeId:t,taskId:n.task?.id??null});if(r.kind===`error`)throw new A(r.error.code);if(r.value.context.status!==`available`||U(r.value.context.version)!==U(n))throw new A(`stale`);return r.value},r=e=>({kind:`error`,error:Fe(e instanceof A?e.code:`unavailable`)});return{async read(t,i){try{let r=await n(t);if(!r.readablePlan||r.savedGraph.status===`unavailable`)throw new A(`unavailable`);let a=null;if(r.savedGraph.status===`saved`){let o=r.savedGraph.request;if(i&&(i.storeId!==o.storeId||U(i.graph)!==U(o.graph)||U(i.scope)!==U(o.scope)))throw new A(`stale`);let s=await e.graph(i??o);if(s.kind===`error`)return s;if(await n(t),`kind`in s.value)return{kind:`ok`,value:{...s.value,context:t}};a=s.value.graph}else if(i)throw new A(`stale`);return{kind:`ok`,value:{context:t,roles:r.roles,savedGraph:a,readablePlan:r.readablePlan.text,editable:r.readablePlan.editable}}}catch(e){return r(e)}},async saveAction(e,t){let i=structuredClone(t);try{let t=await cr(await n(e),i.readablePlan,i.assignments,{uuid:()=>crypto.randomUUID(),sha256:async e=>Array.from(new Uint8Array(await crypto.subtle.digest(`SHA-256`,Uint8Array.from(e))),e=>e.toString(16).padStart(2,`0`)).join(``)});return await n(e),{kind:`ok`,value:t}}catch(e){return r(e)}}}}function dr(e,t){if(e.commandId!==t.commandId)return e;let n=[e.receipt,e.lookup?.status===`found`?e.lookup.receipt:void 0,t.receipt,t.lookup?.status===`found`?t.lookup.receipt:void 0],r,i=!1;for(let t of n)t&&t.commandId===e.commandId&&(r&&(r.operationId!==t.operationId||r.runId!==t.runId||r.created!==null&&r.created.taskId!==t.created?.taskId)||r&&Le(t.committedSeq,r.committedSeq)>0&&(r.created?.state===`published`&&t.created?.state!==`published`||r.admission===`accepted`&&t.admission!==`accepted`||r.execution!==null&&t.execution!==r.execution||r.settlement!==null&&U(t.settlement)!==U(r.settlement))?i=!0:(!r||Le(t.committedSeq,r.committedSeq)>0||U(r)===U(t))&&(r=t));return{commandId:e.commandId,receipt:r,lookup:r?{status:`found`,receipt:r}:t.lookup??e.lookup,error:i?`Conflicting receipt observation refused; prior committed facts preserved.`:r?void 0:t.error??e.error}}var fr=e=>e===`unauthenticated`||e===`forbidden`,pr=class{api;serial=Promise.resolve();version=0;stopCurrent;pollCurrent;constructor(e){this.api=e}refresh(e=!1){this.pollCurrent?.(e)}observe(e,t){this.stopCurrent?.();let n=++this.version,r=!1,i,a,o,s=new AbortController,c=new Kn,l=0,u=0,d=!1,f=!1,p=0,m=!1,h=!1,g={actions:!1,transportStatus:`closed`,attachmentVersion:0},_=()=>!r&&n===this.version,v=()=>{_()&&t({...g,observation:c.state})},y=()=>{r||(r=!0,s.abort(),clearInterval(a),clearTimeout(o),u++,i?.(),n===this.version&&(this.pollCurrent=void 0))};this.stopCurrent=y;let b=e=>{this.serial=this.serial.then(e).catch(()=>{_()&&(m=!0,s.abort(),clearInterval(a),clearTimeout(o),u++,i?.(),g.error=`Observation unavailable or detach unconfirmed; explicit re-entry required.`,g.actions=!1,g.transportStatus=`closed`,g.workspace=void 0,c=new Kn,v())})},x=async()=>{await this.api.transport.detach()},S=async(t=!1)=>{if(!_()||!f||d||m)return;d=!0,g.actions=!1;let n=!1;v(),p=Date.now();let r=s.signal;try{let i=async()=>{let e=await this.api.client.session(r);return!_()||r.aborted?!1:e.kind===`error`?(g.actions=!1,g.error=e.error.code,fr(e.error.code)&&C(),!1):(w(e.value),!0)};if(t&&!await i())return;e||(g.transportStatus=`current`);let a=await this.api.client.activeRuns(r);if(!_()||r.aborted)return;if(a.kind===`ok`)g.activeRuns=a.value;else if(fr(a.error.code)){C();return}else g.activeRuns=void 0;v();let o=await this.api.client.workspace(r);if(!_()||r.aborted)return;if(o.kind===`error`){g.error=o.error.code,fr(o.error.code)&&C();return}if(!t&&U(g.workspace?.models??[])!==U(o.value.models)&&!await i())return;if(g.workspace=o.value,e){let t=c.beginSnapshot(),i=await this.api.client.snapshot(e,r);if(!_()||r.aborted)return;if(i.kind===`error`)g.error=i.error.code,fr(i.error.code)&&C();else{let e=c.install(i.value,Date.now(),t);e!==void 0&&(l=e),g.error=void 0,n=!0}}else g.error=void 0,n=!0}catch{_()&&(g.error=`Observation unavailable.`,g.actions=!1,g.transportStatus=`stale`)}finally{d=!1,g.actions=n&&h,v()}},C=()=>{m=!0,g.actions=!1,g.transportStatus=`closed`,g.error=`Access revoked; explicit token re-entry required.`,g.workspace=void 0,g.activeRuns=void 0,c=new Kn,s.abort(),clearInterval(a),clearTimeout(o),u++,i?.(),b(x),v()},w=e=>{let t=or?{kind:`browser`,...or}:null;g.compatible=Ft(e.build,t),g.cancelCompatible=Ft(e.build,t,!0),h=e.capabilities.actions&&g.compatible},T=async()=>{if(f=!1,await x(),!_()||m)return;let t=await this.api.client.session();if(!_()||m){await x();return}if(t.kind===`error`){m=!0,g.error=`${t.error.code}; explicit re-entry required.`,g.workspace=void 0,c=new Kn,g.actions=!1,v();return}if(f=!0,s=new AbortController,c=new Kn,g={actions:t.value.capabilities.actions,transportStatus:`closed`,attachmentVersion:g.attachmentVersion+1},w(t.value),v(),await S(),!_()||m||!e)return;let n=++u;i=this.api.transport.subscribe(e,e=>{if(_()&&!m&&n===u){if(e.kind===`snapshot`){let t=c.install(e.snapshot,Date.now(),c.beginSnapshot());t!==void 0&&(l=t)}else e.kind===`event`?c.receive(e.event,l,Date.now())===`resync`&&S():S();v()}},e=>{_()&&!m&&n===u&&(g.transportStatus=e,e===`closed`&&(f=!1,g.actions=!1,g.attachmentVersion++,s.abort(),u++,o=setTimeout(()=>b(T),1e3)),v())})};return b(T),this.pollCurrent=e=>{S(e)},a=setInterval(()=>{_()&&!m&&(c.tick(Date.now()),v(),(Date.now()-p>=3e4||e&&c.needsPoll(Date.now()))&&S())},1e3),()=>{_()&&(y(),b(x))}}};function mr(e,t,n){let r=(0,f.useMemo)(()=>new pr(e),[e]),[i,a]=(0,f.useState)({actions:!1,transportStatus:`closed`,attachmentVersion:0}),o=t?.kind,s=t?.id;return(0,f.useEffect)(()=>{if(a({actions:!1,transportStatus:`closed`,attachmentVersion:0}),n)return r.observe(o&&s?{kind:o,id:s}:null,a)},[r,o,s,n]),{...i,refresh:(e=!1)=>r.refresh(e)}}var hr=class{generation=0;identity=``;select(e){e!==this.identity&&(this.identity=e,this.depart())}depart(){this.generation++}ticket(){return this.generation}current(e){return e===this.generation}},gr={"Cadence task workspace":`Cadence 任务工作区`,"Presentation unavailable":`界面无法显示`,"No execution result is inferred. Reconnect to observe the owner; accepted work continues.":`不会推断任何执行结果。重新连接以观察所有者服务;已接受的工作会继续进行。`,"Reload observation":`重新加载观察`,"Build information":`构建信息`,Conversation:`对话`,Details:`详情`,"Back to task":`返回任务`,"Task {id}":`任务 {id}`,"{kind} {id}":`{kind} {id}`,Subagent:`子代理`,"Recorded conversation":`已记录对话`,"Recording details":`记录信息`,"Field details":`原文与复制`,"New activity — update conversation":`有新动态 · 更新对话`,"No retained conversations on this page.":`本页没有已保留的对话。`,"Recent projects":`最近项目`,"This service exposes one project. Opening it never starts work.":`当前服务连接一个项目,打开项目不会启动执行。`,"Running conversations":`运行的对话`,"Conversation history":`历史对话`,"Task conversations":`任务对话与子代理`,Tasks:`任务`,"Recorded views":`已记录视图`,messages:`消息`,tools:`工具`,context:`上下文`,timeline:`时间线`,runs:`运行`,outcomes:`结果`,"Export selected scope":`导出所选范围`,"Copy token-free link":`复制不含令牌的链接`,"Link copy unavailable.":`无法复制链接。`,"Observe current state":`重新观察当前状态`,"Choose owner model":`选择所有者模型`,Model:`模型`,"Return — work continues":`返回——工作继续`,"Return — accepted work continues":`返回——已接受的工作会继续`,Return:`返回`,"Plan / review":`计划 / 审阅`,Plan:`计划`,"Execution and cancellation":`执行与取消`,"Open active task":`打开活动任务`,"Cancel run — request stop":`取消运行——请求停止`,"{message}.":`{message}。`,"Context changed. Observe again and request a fresh confirmation.":`上下文已变化。请重新观察并请求新的确认。`,"Explicit service guidance: {status} / {start}. No service is started by this page.":`显式服务操作:{status} / {start}。本页面不会启动任何服务。`,"Close drawer":`关闭抽屉`,"Task navigation drawer":`任务导航抽屉`,"Plan and review drawer":`计划与审阅抽屉`,"Selected {kind}:":`已选{kind}:`,"· snapshot {seq}.":`· 快照 {seq}。`,"Pages and old outcomes are historical observations, not renewed consent.":`分页内容和旧结果是历史观察,不代表重新授权。`,"Open a task or create one explicitly":`打开一个任务,或显式创建一个`,"Plans, children, checks and human review share one service owner. No chat or discovery activates execution.":`计划、子运行、检查和人工审阅共用一个服务所有者。聊天或浏览不会触发执行。`,"Create task":`创建任务`,"No owner run projection in this snapshot.":`此快照中没有所有者运行视图。`,"No snapshot observed yet; absence is not proof of settlement.":`尚未观察到快照;没有记录不代表已结束。`,"Connection freshness is not execution outcome.":`连接是否最新不代表执行结果。`," · transport {status}":` · 传输:{status}`,"{count} active run":`{count} 个活动运行`,"{count} active runs":`{count} 个活动运行`,"No active runs":`没有活动运行`,"Active roster unavailable; absence is not proof of settlement.":`活动运行列表不可用;没有记录不代表已结束。`,"unbuilt source":`未构建的源码`,"Local browser build: {build}.":`本地浏览器构建:{build}。`,"Shared compatibility: {state}.":`共享兼容性:{state}。`,compatible:`兼容`,"unavailable / mismatch — reload built assets; normal actions disabled":`不可用 / 不匹配——请重新加载构建产物;常规操作已禁用`,"Service unavailable":`服务不可用`,"Task snapshot not observed yet":`尚未观察到任务快照`,"No task selected":`未选择任务`,"Resize left pane":`调整左侧面板宽度`,"Resize right pane":`调整右侧面板宽度`,Detached:`已断开`,"Accepted service work continues. No Cancel was requested.":`已接受的服务工作会继续进行。没有请求取消。`,"Observe command after reconnect:":`重新连接后观察命令:`,"Reconnect as a viewer":`以查看者身份重新连接`,"Current action context unavailable; observe again.":`当前操作上下文不可用;请重新观察。`,"Preflight refused: {code}":`预检被拒绝:{code}`,"Preflight unavailable. No automatic retry.":`预检不可用。不会自动重试。`,"Stop requested; settlement is not yet confirmed.":`已请求停止;尚未确认结束。`,"{code}; cancellation effect {effect}. Observe exact receipt.":`{code};取消效果 {effect}。请观察确切回执。`,"Cancellation effect uncertain. Observe exact receipt.":`取消效果不确定。请观察确切回执。`,"Observation unavailable or detach unconfirmed; explicit re-entry required.":`观察不可用或断开未确认;需要显式重新进入。`,"Observation unavailable.":`观察不可用。`,"Access revoked; explicit token re-entry required.":`访问已被撤销;需要显式重新输入令牌。`,Kind:`类型`,Code:`代码`,"Readonly research":`只读调研`,"Readonly diagnosis":`只读诊断`,Goal:`目标`,"Preview Create (does not Start)":`预览创建(不会启动)`,"Close dialog — no cancellation of accepted work":`关闭对话框——不会取消已接受的工作`,"Close — accepted work is not cancelled":`关闭——不会取消已接受的工作`,"Admission pending/unknown — observe this exact receipt.":`准入待定/未知——请观察这个确切回执。`,"{code}; effect {effect}":`{code};效果 {effect}`,"Uncertain; do not repeat the action.":`结果不确定;请勿重复此操作。`,"Confirm {action}":`确认{action}`,"Access is not consent. This confirmation applies only to the displayed context, once.":`访问权限不等于同意。此确认仅对所显示的上下文生效一次。`,Checkout:`工作副本`,"Working directory":`工作目录`,"Model / API / thinking":`模型 / API / 思考`,"Check environment":`检查环境`,"Service launch environment policy, generation {generation}; no browser environment overlays.":`服务启动环境策略,第 {generation} 代;不叠加浏览器环境。`,Observation:`观察`,"Complete within bounded scope":`在限定范围内完整`,"Incomplete bounded coverage":`限定范围覆盖不完整`,Expires:`过期时间`,"Exact parent check":`确切的父级检查`,"{name}; timeout {timeout} ms; cwd above.":`{name};超时 {timeout} 毫秒;工作目录见上。`,"Readonly proposal only. It will not save itself or dispatch editing.":`仅为只读提案。它不会自行保存,也不会分派编辑。`,"Issues: {issues}":`问题:{issues}`,"Context changed or confirmation expired. Close, observe again and request a new preview.":`上下文已变化或确认已过期。请关闭、重新观察并请求新的预览。`,"Back — no new effect":`返回——不产生新效果`,"Create {kind} task":`创建{kind}任务`,"No Start is included.":`不包含启动。`,"Expected: {output}":`预期产出:{output}`,"Exact proposed graph and identities (not yet committed)":`确切的提议任务图与标识(尚未提交)`,"Exact human review targets":`确切的人工审阅对象`,"Human review only; failures, native exit, stale and not-run checks remain unchanged. Issues acknowledgment: {accepted}.":`仅为人工审阅;失败、原生退出、过期和未运行的检查保持不变。问题确认:{accepted}。`,"Explicit owner-wide choice, only while quiescent. This does not resolve credentials, probe a provider, save a plan or Start work.":`显式的所有者级选择,仅在空闲时可用。它不会解析凭据、探测提供方、保存计划或启动工作。`,"Current: {model}":`当前:{model}`,"No model selected":`未选择模型`,"Exact model / API / thinking":`确切的模型 / API / 思考级别`,"Select explicitly":`请显式选择`,"Catalog capacity exceeded; no partial model list is selectable.":`模型目录超出容量;不能从不完整的列表中选择。`,"{error}. No automatic replacement or retry.":`{error}。不会自动替换或重试。`,"{count} model withheld: its provider or model ID contains a credential value (such as an apiKey equal to the provider name) or control characters. Give each credential a value that matches no provider or model ID; restart the service after editing models.json.":`{count} 个模型未列出:其提供方或模型 ID 包含某个凭据值(例如与提供方名称相同的 apiKey)或控制字符。请让每个凭据值都不与任何提供方或模型 ID 重合;修改 models.json 后需重启服务。`,"{count} models withheld: their provider or model IDs contain a credential value (such as an apiKey equal to the provider name) or control characters. Give each credential a value that matches no provider or model ID; restart the service after editing models.json.":`{count} 个模型未列出:其提供方或模型 ID 包含某个凭据值(例如与提供方名称相同的 apiKey)或控制字符。请让每个凭据值都不与任何提供方或模型 ID 重合;修改 models.json 后需重启服务。`,"Model catalog unavailable ({code}); no model is selectable. No automatic retry.":`模型目录不可用({code});无法选择任何模型。不会自动重试。`,"Choice response unconfirmed; observe catalog before another explicit choice.":`选择的响应未确认;请先观察目录再进行下一次显式选择。`,"Confirm owner model choice":`确认所有者模型选择`,"Command receipt":`命令回执`,Admission:`准入`,Execution:`执行`,"not settled":`未结束`,Publication:`发布`,Run:`运行`,"metadata action":`元数据操作`,"{status}. This observation does not authorize replay.":`{status}。此观察不授权重放。`,"Observe exact receipt":`观察确切回执`,"Conflicting receipt observation refused; prior committed facts preserved.":`冲突的回执观察已被拒绝;之前提交的事实已保留。`,"Retained content fields":`保留的内容字段`,"Showing matches for entity {entity} on this page only. Continue paging for other fields/versions.":`仅显示本页中实体 {entity} 的匹配项。继续翻页可查看其他字段/版本。`,"Omitted source block:":`已省略的源块:`,"{bytes} retained bytes":`保留 {bytes} 字节`,"Inspect complete retained field":`查看完整的保留字段`,"Recording: {observed}; source: {source};":`记录:{observed};来源:{source};`,redacted:`已脱敏`,"no reported redaction":`未报告脱敏`,"; omitted: {omissions}":`;已省略:{omissions}`,". Not a guarantee of complete original source or universal secret detection.":`。不保证原始来源完整,也不保证能检测出所有机密。`,"Reading all retained field pages…":`正在读取所有保留字段页…`,"Copied all retained field bytes (source omissions still apply).":`已复制全部保留字段字节(来源省略仍然适用)。`,"Copied retained field bytes; recording is incomplete. No complete-source claim.":`已复制保留字段字节;记录不完整。不声称来源完整。`,"Clipboard unavailable.":`剪贴板不可用。`,"Full-field copy refused/incomplete.":`完整字段复制被拒绝/不完整。`,"Retained field":`保留字段`,"snapshot {seq}":`快照 {seq}`,"Exact hit bytes [{start}, {end}); only this immutable field is highlighted.":`确切命中字节 [{start}, {end});仅高亮这个不可变字段。`,"Markdown page":`Markdown 页`,"Raw page":`原始页`,"Copy full retained field":`复制完整保留字段`,"Copy canceled; execution unchanged.":`复制已取消;执行不受影响。`,"Cancel copy":`取消复制`,"Detail refused: {error}":`详情被拒绝:{error}`,"Reading…":`读取中…`,"Validation in progress. The retained field is not empty.":`正在验证。该保留字段并非为空。`,"Bytes {start}–{end} of {total}.":`第 {start}–{end} 字节,共 {total} 字节。`,"More retained data available.":`还有更多保留数据。`,"End of field.":`字段结束。`,Previous:`上一页`,"Continue validation":`继续验证`,"Next field page":`下一字段页`,"Read unavailable.":`读取不可用。`,"Exact entity metadata":`确切的实体元数据`,"Reading exact entity version…":`正在读取确切的实体版本…`,"Entity refused: {error}":`实体被拒绝:{error}`,"Entity validation in progress, not missing.":`实体正在验证,并非缺失。`,"Continue exact entity validation":`继续确切的实体验证`,"Exact stored owner and associations":`确切存储的所有者与关联`,"Export retained history":`导出保留历史`,"Selected {kind}: {id} · snapshot {seq}":`已选{kind}:{id} · 快照 {seq}`,Format:`格式`,"NDJSON public archive":`NDJSON 公开归档`,"Readable Markdown with footer metadata":`带页脚元数据的可读 Markdown`,"Includes retained context, messages/tools, graph, lifecycle, changes, checks, human review and coverage beyond loaded pages. Redactions and source omissions remain.":`包括已加载页之外的保留上下文、消息/工具、任务图、生命周期、变更、检查、人工审阅和覆盖范围。脱敏和来源省略仍然保留。`,"A native browser download request cannot establish completion. Inspect the original EOF and completion trailer/counts/digest in the downloaded artifact; missing footer means incomplete. Revoked access may terminate without a trailer.":`浏览器原生下载请求无法证明下载完成。请检查下载文件中的原始 EOF 以及完成尾部/计数/摘要;缺少页脚即表示不完整。访问被撤销时可能在没有尾部的情况下终止。`,"Download requested — completion not verified by this browser UI.":`已请求下载——此浏览器界面未验证是否完成。`,"Download unavailable; no archive claimed complete.":`下载不可用;不声称任何归档完整。`,"Request selected-scope download":`请求下载所选范围`,"Search retained history":`搜索保留历史`,"Case-sensitive literal query":`区分大小写的字面查询`,"Case-sensitive literal UTF-8 search. Scope {kind} {id}; snapshot {seq}. No regex, provider request or history repair.":`区分大小写的 UTF-8 字面搜索。范围:{kind} {id};快照 {seq}。不使用正则,不请求提供方,也不修复历史。`,"Searching bounded retained range…":`正在搜索限定的保留范围…`,"Search refused: {error}":`搜索被拒绝:{error}`,"Enter a query to search this selected scope.":`输入查询以搜索所选范围。`,"Matches on this page: {count}":`本页匹配:{count}`,"bytes {start}–{end}":`字节 {start}–{end}`,"Continue same snapshot search":`在同一快照中继续搜索`,"↑↓ Navigate · Enter Open exact hit · Escape Close. Reopening never resumes execution.":`↑↓ 移动 · Enter 打开确切命中 · Escape 关闭。重新打开不会恢复执行。`,"Search unavailable or invalid; no automatic retry.":`搜索不可用或无效;不会自动重试。`,"Query must be 1–1024 UTF-8 bytes; it was not clipped.":`查询必须为 1–1024 个 UTF-8 字节;未做截断。`,"No hits in this bounded window; search is not finished.":`此限定窗口中没有命中;搜索尚未完成。`,"No hits in the final retained window. Coverage limits above still apply.":`最后的保留窗口中没有命中。上方的覆盖范围限制仍然适用。`,"Immutable admitted graph":`不可变的已准入任务图`,"Graph refused: {error}":`任务图被拒绝:{error}`,"Reading graph…":`正在读取任务图…`,"Graph validation in progress; not an empty graph.":`任务图正在验证;并非空图。`,"Continue graph validation":`继续验证任务图`,"Find on displayed field page":`在当前字段页中查找`," (first 1000 visual highlights)":`(前 1000 处可视高亮)`,"; not whole-history search":`;不是全历史搜索`,"Previous match":`上一个匹配`,"Next match":`下一个匹配`,"Read refused: {error}. Retained state has not been repaired.":`读取被拒绝:{error}。保留状态未被修复。`,"Reading bounded history page…":`正在读取限定的历史页…`,"Snapshot selected":`已选择快照`,"Validating retained history":`正在验证保留历史`,"; continue this exact read. No data page yet.":`;请继续这次确切读取。尚无数据页。`,"Previous page":`上一页`,"Next page":`下一页`,"Observe a new snapshot":`观察新快照`,"End of this retained snapshot (incomplete).":`此保留快照已结束(不完整)。`,"End of this retained snapshot.":`此保留快照已结束。`,"Open retained episode/child details":`打开保留的执行轮次/子运行详情`,"Inspect admitted graph and plan":`查看已准入的任务图与计划`,"Search all retained pages in selected scope":`搜索所选范围内的所有保留页`,"Select a task to inspect plans, checks, changes and review.":`选择一个任务以查看计划、检查、变更和审阅。`,Inspector:`检查器`,plan:`计划`,checks:`检查`,changes:`变更`,review:`审阅`,"Owner metadata is stale.":`所有者元数据已过期。`,"Owner metadata unavailable.":`所有者元数据不可用。`,"Plan proposal unavailable.":`计划提案不可用。`,"Current plan metadata unavailable. Observe again; historical text is not action authority.":`当前计划元数据不可用。请重新观察;历史文本不能作为操作依据。`,"Saved graph proof in progress.":`已保存任务图的证明正在进行。`,"Continue saved graph read":`继续读取已保存的任务图`,"Load observed saved plan into local draft":`将观察到的已保存计划载入本地草稿`,"Current control context unavailable. Historical data is not action authority.":`当前控制上下文不可用。历史数据不能作为操作依据。`,"Captured historical observations":`已捕获的历史观察`,"Human review":`人工审阅`,"Done records human acknowledgment, not execution success or certification. It cannot restart a blocked episode.":`“完成”记录的是人工确认,而非执行成功或认证。它不能重新启动被阻塞的执行轮次。`,"Episode to review":`要审阅的执行轮次`,"Select an observed episode":`选择一个已观察的执行轮次`,"I acknowledge current unresolved issues if present; original results will not be rewritten.":`我确认当前存在的未解决问题;原始结果不会被改写。`,"Preview human review / Done":`预览人工审阅 / 完成`,"Observe current obligations in Checks before requesting review.":`请求审阅前,请先在“检查”中观察当前检查项。`,"Readable plan & decomposition":`可读计划与分解`,"{count} required assignments":`{count} 个必需子任务`,"Preview readonly Generate proposal":`预览只读生成提案`,"Preview Save plan":`预览保存计划`,"Preview Start saved graph":`预览启动已保存的任务图`,"Draft changes never execute. Start uses the saved graph shown in its fresh preview, not unsaved text. Generated proposals never save or start themselves.":`草稿修改永远不会执行。启动使用其最新预览中显示的已保存任务图,而不是未保存的文本。生成的提案不会自行保存或启动。`,"Saved assignments name an old model selection. Reading does not rebind them.":`已保存的子任务指定了旧的模型选择。读取不会重新绑定它们。`,"Explicitly rebind draft to current model (requires new Save)":`将草稿显式重新绑定到当前模型(需要重新保存)`,"Readable plan":`可读计划`,"Read rendered plan":`阅读渲染后的计划`,"checkout writer":`工作副本写入者`,readonly:`只读`,Edit:`编辑`,"Remove draft assignment":`移除草稿子任务`,Purpose:`用途`,Instructions:`指令`,"Expected output":`预期产出`,"Current-episode dependencies (whole final text by default)":`本轮依赖(默认使用完整最终文本)`,"Require complete observation":`要求完整观察`,"Selection: {range}":`选择范围:{range}`,"reviewed UTF-8 bytes {start}–{end}":`已审阅的 UTF-8 字节 {start}–{end}`,"whole final text; no silent clipping":`完整最终文本;不会静默截断`,"Reviewed edge JSON (range/null and exact historical identity)":`已审阅的依赖边 JSON(范围/null 与确切历史标识)`,"Remove edge":`移除依赖边`,"Explicit historical/advisory edge JSON":`显式的历史/参考依赖边 JSON`,"Exact committed run/child/result/version plus range and coverage requirement":`确切的已提交运行/子运行/结果/版本,以及范围和覆盖要求`,"Add reviewed historical edge":`添加已审阅的历史依赖边`,"Discard inline edits":`放弃行内编辑`,"Apply to local draft":`应用到本地草稿`,"Role {role}":`角色 {role}`,"Add assignment":`添加子任务`,"Remove dependent edges explicitly before deleting this assignment.":`删除此子任务前,请先显式移除依赖它的边。`,"Invalid dependency. Original edge retained; review before Save.":`依赖无效。已保留原依赖边;请在保存前审阅。`,"Historical edge requires actual committed identity; no guessed result reference.":`历史依赖边需要真实的已提交标识;不接受猜测的结果引用。`,View:`视图`,"Raw text / lines":`原始文本 / 行`,"Safe Markdown":`安全 Markdown`,"Observed diff":`观察到的 diff`,"Wrap: on":`换行:开`,"Wrap: off":`换行:关`,"Zoom +":`放大 +`,"Zoom −":`缩小 −`,"Captured page only, not a current filesystem read. Line numbers are page-local. Full retained paging and copy are available above.":`仅为捕获的页面,不是对当前文件系统的读取。行号仅在本页内有效。上方提供完整的保留分页和复制。`,"Page headings":`页面标题`,"Select page line {line}":`选择页内第 {line} 行`,"Selected page lines {start}–{end}":`已选页内第 {start}–{end} 行`,"Clear selection":`清除选择`,"Current configured obligations":`当前已配置的检查项`,"Observe obligations":`观察检查项`,"Obligations unavailable: {error}":`检查项不可用:{error}`,"Obligations unavailable.":`检查项不可用。`,"No configured obligations. This is not passing check coverage.":`没有已配置的检查项。这不代表检查已通过。`,"Timeout {timeout} ms. Native outcome and freshness remain separate.":`超时 {timeout} 毫秒。原生结果与是否最新分别记录。`,"Preview exact configured check":`预览确切的已配置检查`,"Browser checks are configured selections only. Native-local manual commands are not a browser shell endpoint.":`浏览器中只能运行已配置的检查。本地原生手动命令不是浏览器 shell 端点。`,"Current checkout changes":`当前工作副本变更`,"Current checkout changes (not a captured historical diff)":`当前工作副本变更(不是捕获的历史 diff)`,"Observe current changes":`观察当前变更`,"Current observation unavailable":`当前观察不可用`,"Fingerprint {identity} · {coverage} · includes pre-existing dirt; not attribution.":`指纹 {identity} · {coverage} · 包含既有的未提交修改;不代表归属。`,"complete within bounded scope":`在限定范围内完整`,"incomplete coverage":`覆盖不完整`,"Captured observations include pre-existing dirt. They do not attribute every change to Cadence; bounded fingerprints are not filesystem snapshots.":`捕获的观察包含既有的未提交修改。它们不会把每处变更都归于 Cadence;限定指纹不是文件系统快照。`,"committed #{seq}":`已提交 #{seq}`,"Inspect full retained {field}":`查看完整保留的{field}`,"Copy displayed text":`复制显示的文本`,"Copy unavailable":`无法复制`,"{state} message record, not execution outcome":`{state}消息记录,不代表执行结果`,Collapse:`收起`,"Inspect message":`查看消息`,"Child {child} · message {message} · version {version}":`子运行 {child} · 消息 {message} · 版本 {version}`,"Result call: {call}. Kept visible independently of the tool card.":`结果对应调用:{call}。独立于工具卡片保持可见。`,"unassociated / orphan":`未关联 / 孤立`,"No finalized text field in this snapshot. Inspect retained partial/final blocks and omission metadata below.":`此快照中没有最终文本字段。请在下方查看保留的部分/最终块以及省略元数据。`,"All message blocks, source limits and tool associations":`全部消息块、来源限制与工具关联`,"Latest on loaded page":`跳到已加载页的最新处`,"No message records on this page; more history remains.":`本页没有消息记录;还有更多历史。`,"No message records on this page.":`本页没有消息记录。`,"SDK tool error observed":`观察到 SDK 工具错误`,"SDK tool end observed":`观察到 SDK 工具结束`,"Start observed; end not observed in this snapshot":`已观察到开始;此快照中未观察到结束`,"No start observed":`未观察到开始`,"Inspect recorded tool call":`查看已记录的工具调用`,"Child {child} · call {call} · v{version}":`子运行 {child} · 调用 {call} · v{version}`,"SDK tool observations are not native process launch/close or passing parent checks.":`SDK 工具观察不代表原生进程的启动/关闭,也不代表父级检查已通过。`,"Source ID":`来源 ID`,unavailable:`不可用`,Declaration:`声明`,"No declaration recorded; orphan result remains accessible":`未记录声明;孤立结果仍可访问`,"Recorded tool end (not parsed from output)":`已记录的工具结束(非从输出解析)`,"No end fact in this snapshot.":`此快照中没有结束事实。`,"historical projection":`历史视图`,"owner projection":`所有者视图`,Lifecycle:`生命周期`,unsettled:`未结束`,"Wait/block reason":`等待/阻塞原因`,"none reported":`未报告`,"Summary publication":`摘要发布`,"Native / recording / parent settlement facts (independent of human review)":`原生 / 记录 / 父级结束事实(独立于人工审阅)`,"No settlement recorded":`未记录结束信息`,"New task":`新建任务`,"No retained task on this page.":`本页没有保留的任务。`,"One checkout owner. Open/history never executes.":`每个工作副本一个所有者。打开或查看历史永远不会执行。`,"Active and recent episodes":`活动与近期执行轮次`,"Runs and assignments":`运行与子任务`,"Toggle assignments":`展开/收起子任务`,"{count} descendants":`{count} 个后代`," / failed child":` / 有失败的子运行`," / unknown child":` / 有未知的子运行`,"No active or recent episode observed.":`未观察到活动或近期的执行轮次。`,"All retained episodes for task":`此任务的全部保留执行轮次`,"Committed order, not wall time. Replay advances visualization only. Raw observations retain clock/sequence provenance; unknown timing is not reconstructed.":`按提交顺序排列,而非真实时间。回放只推进可视化。原始观察保留时钟/序号来源;未知的时间不会被重建。`,"Bundled timeline unavailable; retained events remain accessible, no CDN fallback.":`内置时间线不可用;保留的事件仍可访问,不会回退到 CDN。`,Owner:`所有者`,owner:`所有者`,input:`输入`,model:`模型`,"Committed #{seq}; {who}":`已提交 #{seq};{who}`,"recorded fact":`已记录事实`,"Worker-local monotonic observations ({child}): {first}–{last} ms; not aligned to other workers.":`工作进程本地单调时钟观察({child}):{first}–{last} 毫秒;未与其他工作进程对齐。`,"Owner observation ({epoch}): {ms} ms; clock origin not established by this reader.":`所有者观察({epoch}):{ms} 毫秒;此读取器未确定时钟起点。`,"{scope} — loaded committed page":`{scope}——已加载的提交页`,"Committed sequence {seq}; page ordinal {ordinal}. Timing shown in raw facts only; clocks may not be comparable.":`提交序号 {seq};页内序数 {ordinal}。时间只在原始事实中显示;各时钟可能无法比较。`,task:`任务`,run:`运行`,child:`子运行`,workspace:`工作区`,message:`消息`,tool:`工具`,"final-text":`最终文本`,"tool-args":`工具参数`,"tool-update":`工具更新`,"tool-result":`工具结果`,check:`检查`,user:`用户`,assistant:`助手`,partial:`部分`,final:`最终`,observed:`已观察`,create:`创建`,"generate-plan":`生成计划`,"save-plan":`保存计划`,start:`启动`,research:`调研`,diagnosis:`诊断`,edit:`编辑`,current:`最新`,stale:`已过期`,resync:`重新同步中`,closed:`已关闭`,"accepted-unallocated":`已接受未分配`,active:`活动中`,draining:`排空中`,queued:`排队中`,preparing:`准备中`,running:`运行中`,closing:`收尾中`,settled:`已结束`,completed:`已完成`,failed:`失败`,canceled:`已取消`,timeout:`超时`,unknown:`未知`,blocked:`已阻塞`,pending:`待定`,published:`已发布`,conflict:`冲突`,uncertain:`不确定`,accepted:`已接受`,refused:`已拒绝`,absent:`不存在`,inconclusive:`无定论`,"not-run":`未运行`,passed:`已通过`,complete:`完整`,incomplete:`不完整`,limited:`受限`,binary:`二进制`,"hidden-thinking":`隐藏的思考`,"source-limit":`来源限制`,"capture-limit":`捕获限制`,gap:`缺口`,unsupported:`不支持`,capacity:`容量`,dependency:`依赖`,writer:`写入者`,"parent-stopped":`父级已停止`,"wait-expired":`等待超时`,"handoff-overflow":`交接溢出`,"stale-dependency":`依赖已过期`,quarantine:`隔离`,"incomplete-observation":`观察不完整`,"unrun-checks":`有未运行的检查`,"stale-checks":`有过期的检查`,"failed-checks":`有失败的检查`,"partial-results":`结果不完整`,"recording-incomplete":`记录不完整`,"legacy-context":`旧版上下文`},Q=r(),_r=`cadence-locale`,vr=new Map(Object.entries(gr));function yr(e,t,n){let r=e===`zh`?vr.get(t)??t:t;return n?r.replace(/\{(\w+)\}/g,(e,t)=>Object.hasOwn(n,t)?String(n[t]):e):r}function br({text:e,slots:t}){return e.split(/\{(\w+)\}/).map((e,n)=>n%2==0?e:(0,Q.jsx)(f.Fragment,{children:Object.hasOwn(t,e)?t[e]:`{${e}}`},e))}function xr(){try{let e=localStorage.getItem(_r);if(e===`en`||e===`zh`)return e}catch{}return(typeof navigator>`u`?void 0:navigator.languages?.[0]??navigator.language)?.toLowerCase().startsWith(`zh`)?`zh`:`en`}function Sr(e,t){return{locale:e,t:(t,n)=>yr(e,t,n),tx:t=>yr(e,t),setLocale:t}}var Cr=(0,f.createContext)(Sr(`en`,()=>{}));function $(){return(0,f.useContext)(Cr)}function wr({initial:e,children:t}){let[n,r]=(0,f.useState)(()=>e??xr()),i=(0,f.useMemo)(()=>Sr(n,e=>{try{localStorage.setItem(_r,e)}catch{}r(e)}),[n]);return(0,f.useEffect)(()=>{document.documentElement.lang=n===`zh`?`zh-CN`:`en`,document.title=yr(n,`Cadence task workspace`)},[n]),(0,Q.jsx)(Cr.Provider,{value:i,children:t})}function Tr({title:e,children:t,onClose:n}){let{t:r}=$(),i=(0,f.useRef)(null),a=(0,f.useId)(),o=(0,f.useRef)(n);return o.current=n,(0,f.useEffect)(()=>{let e=document.activeElement,t=i.current;return t?.showModal(),()=>{t?.close(),e instanceof HTMLElement&&e.isConnected&&e.focus()}},[]),(0,Q.jsxs)(`dialog`,{ref:i,className:`action-dialog`,"aria-labelledby":a,onCancel:e=>{e.preventDefault(),o.current()},children:[(0,Q.jsxs)(`header`,{children:[(0,Q.jsx)(`h2`,{id:a,children:e}),(0,Q.jsx)(`button`,{type:`button`,className:`dialog-close`,"aria-label":r(`Close dialog — no cancellation of accepted work`),title:r(`Close — accepted work is not cancelled`),onClick:n,children:(0,Q.jsx)(D,{"aria-hidden":`true`})})]}),t]})}function Er(e){let t=e=>{if(typeof e==`string`||typeof e==`number`){let t=String(e);return t===``?[[]]:t.split(`
|
|
4
|
+
`).map(e=>e===``?[]:[e])}if(Array.isArray(e)){let n=[];for(let r of e){let e=t(r);if(n.length===0)n=e;else{let t=e[0]??[];n[n.length-1].push(...t),n.push(...e.slice(1))}}return n}if(e&&typeof e==`object`&&`props`in e){let n=e,r=n.props?.children,i={...n.props,children:void 0},a=r==null?[]:t(r);return a.length===0?[[(0,f.createElement)(n.type,i)]]:a.map(e=>[(0,f.createElement)(n.type,i,...e)])}return[[e]]},n=t(e);return n.length>1&&n[n.length-1].length===0&&n.pop(),n}var Dr=function(){let e=this.data();e.micromarkExtensions??=[],e.micromarkExtensions.push({flow:{92:Or(!0)},text:{92:Or(!1)}});let t={enter:{backslashMathInline:kr,backslashMathDisplay:kr,backslashMathBlock:kr},exit:{backslashMathInline:Ar,backslashMathDisplay:Ar,backslashMathBlock:Ar}};e.fromMarkdownExtensions??=[],e.fromMarkdownExtensions.push(t)};function Or(e){return{tokenize:function(t,n,r){let i=this,a=93,o=e?`backslashMathBlock`:`backslashMathDisplay`,s;return c;function c(e){return e===92?(s=t.enter(o),t.consume(e),l):r(e)}function l(n){return n!==91&&(e||n!==40)?r(n):(a=n===91?93:41,!e&&n===40&&(o=`backslashMathInline`,s.type=o),t.consume(n),u)}function u(n){return n===null||e&&i.parser.lazy[i.now().line]?r(n):n===-5||n===-4||n===-3?(t.enter(`lineEnding`),t.consume(n),t.exit(`lineEnding`),u):(f(n),n===92?d:u)}function d(i){return i===a?(f(i),t.exit(o),e?p:n):i===null?r(i):i===-5||i===-4||i===-3?u(i):(f(i),u)}function f(e){t.enter(`backslashMathData`),t.consume(e),t.exit(`backslashMathData`)}function p(e){return e===null||e===-5||e===-4||e===-3?n(e):e===32||e===-2||e===-1?(t.enter(`whitespace`),t.consume(e),t.exit(`whitespace`),p):r(e)}},concrete:e,name:e?`backslashMathBlock`:`backslashMathText`}}var kr=function(e){let t=e.type===`backslashMathBlock`,n=e.type!==`backslashMathInline`,r=this.sliceSerialize(e).slice(2,-2).trim(),i={type:`element`,tagName:`code`,properties:{className:[`language-math`,n?`math-display`:`math-inline`]},children:[{type:`text`,value:r}]},a=t?{type:`math`,meta:null,value:r,data:{hName:`pre`,hChildren:[i]}}:{type:`inlineMath`,value:r,data:{hName:`code`,hProperties:i.properties,hChildren:i.children}};this.enter(a,e)},Ar=function(e){this.exit(e)};function jr(e){if(typeof document>`u`)return!1;let t=document.createElement(`textarea`),n=document.activeElement;try{return t.value=e,t.style.position=`fixed`,t.style.left=`-9999px`,t.setAttribute(`readonly`,``),document.body.appendChild(t),t.select(),document.execCommand(`copy`)}catch{return!1}finally{t.remove(),n instanceof HTMLElement&&n.isConnected&&n.focus()}}async function Mr(e){if(typeof navigator<`u`&&navigator.clipboard&&typeof navigator.clipboard.writeText==`function`)try{return await navigator.clipboard.writeText(e),!0}catch{return jr(e)}return jr(e)}function Nr(e={}){let{duration:t=2e3,onSuccess:n,onError:r}=e,i=(0,f.useRef)(!0),[a,o]=(0,f.useState)(!1),s=(0,f.useRef)(null),c=(0,f.useCallback)(()=>{s.current!==null&&(clearTimeout(s.current),s.current=null)},[]),l=(0,f.useCallback)(()=>{c(),o(!1)},[c]);return(0,f.useEffect)(()=>(i.current=!0,()=>{i.current=!1,c()}),[c]),{copied:a,copy:(0,f.useCallback)(async e=>{let a=!1;try{a=await Mr(e)}catch(e){a=!1,r&&r(e)}return i.current&&(a?(o(!0),c(),s.current=setTimeout(()=>{o(!1),s.current=null},t),n?.(e)):r&&!a&&r(Error(`Copy failed`))),a},[t,n,r,c]),reset:l}}var Pr=(0,f.memo)(function({text:e}){let{t}=$(),[n,r]=(0,f.useState)(!1),{copied:i,copy:a}=Nr();return(0,Q.jsxs)(`button`,{type:`button`,className:`copy-btn`,title:t(`Copy displayed text`),"aria-label":t(`Copy displayed text`),onClick:()=>{r(!1),a(e).then(e=>r(!e))},children:[i?(0,Q.jsx)(Oe,{}):(0,Q.jsx)(we,{}),n&&t(`Copy unavailable`)]})}),Fr=[s,d,Dr],Ir=[s,l,d,Dr],Lr=[[c,{strict:!1,throwOnError:!1,trust:!1,maxExpand:1e3}],[u,{detect:!1,ignoreMissing:!0}]];function Rr(e){if(e.startsWith(`#`)&&![...e].some(e=>e.charCodeAt(0)<=32))return e;try{let t=new URL(e);return![`https:`,`http:`].includes(t.protocol)||t.username||t.password||t.searchParams.has(`token`)?void 0:e}catch{return}}function zr({text:e,rawHtml:t=!1,hardBreaks:n=!1}){return(0,Q.jsx)(a,{remarkPlugins:n?Ir:Fr,rehypePlugins:t?[i,o,...Lr]:Lr,skipHtml:!t,disallowedElements:[`iframe`,`object`,`embed`,`script`,`style`,`video`,`audio`,`source`,`form`,`input`],components:{pre:Hr,a:Vr,img:({alt:e})=>(0,Q.jsxs)(`span`,{className:`omission`,children:[`[Image omitted: `,e||`external/media content`,`]`]})},children:e})}var Br=(0,f.memo)(function(e){return(0,Q.jsx)(`div`,{className:`md`,children:(0,Q.jsx)(zr,{...e})})});function Vr({href:e,children:t}){let n=e&&Rr(e);return n?(0,Q.jsx)(`a`,{href:n,target:n.startsWith(`#`)?void 0:`_blank`,rel:`noreferrer noopener`,referrerPolicy:`no-referrer`,children:t}):(0,Q.jsxs)(`span`,{children:[t,` [link unavailable]`]})}function Hr({children:e,node:t,...n}){let r=e&&typeof e==`object`&&`props`in e?e.props?.children:e,i=0,a=Er(r).map(e=>{let t=`code-offset:${i}`;return i+=Ur(e).length+1,{key:t,nodes:e}}),o=a.length>1,s=o?`${String(a.length).length+1}ch`:void 0;return(0,Q.jsxs)(`div`,{className:`codeblock`,children:[(0,Q.jsx)(Pr,{text:Ur(e)}),(0,Q.jsx)(`pre`,{...n,children:a.map(({nodes:e,key:t},n)=>(0,Q.jsxs)(`div`,{className:`code-line`,children:[o&&(0,Q.jsx)(`span`,{className:`code-num`,style:s?{width:s}:void 0,children:n+1}),(0,Q.jsx)(`code`,{className:`code-line-body hljs`,children:e})]},t))})]})}function Ur(e){if(typeof e==`string`)return e;if(Array.isArray(e))return e.map(Ur).join(``);if(e&&typeof e==`object`&&`props`in e){let t=e.props;return Ur(t?.children)}return``}function Wr({prepared:e,client:t,current:n,onClose:r,onResult:i,attachmentVersion:a}){let{t:o,tx:s}=$(),[c,l]=(0,f.useState)(Date.now()),[u,d]=(0,f.useState)(!1);(0,f.useEffect)(()=>{let e=setInterval(()=>l(Date.now()),1e3);return()=>clearInterval(e)},[]);let p=e.preflight,m=p.preview,h=(0,f.useRef)(a),g=(0,f.useRef)(!1);(!n||U(n)!==U(m.version)||c>=Date.parse(p.expiresAt)||h.current!==a)&&(g.current=!0);let _=g.current,v=async()=>{if(!(_||e.submitted)){d(!0),i({commandId:e.commandId,error:o(`Admission pending/unknown — observe this exact receipt.`)});try{let n=await Wn(t,e);i(n.kind===`ok`?{commandId:e.commandId,receipt:n.value}:{commandId:e.commandId,error:o(`{code}; effect {effect}`,{code:n.error.code,effect:n.error.effect})})}catch{i({commandId:e.commandId,error:o(`Uncertain; do not repeat the action.`)})}r()}};return(0,Q.jsxs)(Tr,{title:o(`Confirm {action}`,{action:s(m.action.kind)}),onClose:r,children:[(0,Q.jsx)(`p`,{children:o(`Access is not consent. This confirmation applies only to the displayed context, once.`)}),(0,Q.jsxs)(`dl`,{children:[(0,Q.jsx)(`dt`,{children:o(`Checkout`)}),(0,Q.jsx)(`dd`,{children:m.rootLabel}),(0,Q.jsx)(`dt`,{children:o(`Working directory`)}),(0,Q.jsx)(`dd`,{children:(0,Q.jsx)(`code`,{children:m.cwdLabel})}),(0,Q.jsx)(`dt`,{children:o(`Model / API / thinking`)}),(0,Q.jsxs)(`dd`,{children:[m.version.model.provider,` / `,m.version.model.model,` /`,` `,m.version.model.api,` / `,m.version.model.thinking]}),(0,Q.jsx)(`dt`,{children:o(`Check environment`)}),(0,Q.jsx)(`dd`,{children:o(`Service launch environment policy, generation {generation}; no browser environment overlays.`,{generation:m.version.checkEnvGeneration})}),(0,Q.jsx)(`dt`,{children:o(`Observation`)}),(0,Q.jsx)(`dd`,{children:m.version.observation.complete?o(`Complete within bounded scope`):o(`Incomplete bounded coverage`)}),(0,Q.jsx)(`dt`,{children:o(`Expires`)}),(0,Q.jsx)(`dd`,{children:p.expiresAt})]}),(0,Q.jsx)(Gr,{preview:m}),m.action.kind===`check`&&(0,Q.jsxs)(`section`,{children:[(0,Q.jsx)(`h3`,{children:o(`Exact parent check`)}),(0,Q.jsx)(`pre`,{children:m.action.check.command}),(0,Q.jsx)(`p`,{children:o(`{name}; timeout {timeout} ms; cwd above.`,{name:m.action.check.name,timeout:m.action.check.timeoutMs})})]}),m.action.kind===`generate-plan`&&(0,Q.jsx)(`p`,{children:o(`Readonly proposal only. It will not save itself or dispatch editing.`)}),m.issues.length>0&&(0,Q.jsx)(`p`,{role:`alert`,children:o(`Issues: {issues}`,{issues:m.issues.map(s).join(`, `)})}),_&&(0,Q.jsx)(`p`,{role:`alert`,children:o(`Context changed or confirmation expired. Close, observe again and request a new preview.`)}),(0,Q.jsxs)(`footer`,{children:[(0,Q.jsx)(`button`,{type:`button`,onClick:r,children:o(`Back — no new effect`)}),(0,Q.jsx)(`button`,{type:`button`,className:`primary`,disabled:_||u||e.submitted,onClick:()=>void v(),children:o(`Confirm {action}`,{action:s(m.action.kind)})})]})]})}function Gr({preview:e}){let{t,tx:n}=$(),r=e.action,i=r.kind===`save-plan`?r.graph:e.graph;return(0,Q.jsxs)(Q.Fragment,{children:[r.kind===`create`&&(0,Q.jsxs)(`section`,{children:[(0,Q.jsx)(`h3`,{children:t(`Create {kind} task`,{kind:n(r.taskKind)})}),(0,Q.jsx)(`pre`,{children:r.goal}),(0,Q.jsx)(`p`,{children:t(`No Start is included.`)})]}),r.kind!==`create`&&(0,Q.jsx)(Br,{text:r.kind===`save-plan`?r.plan:e.readablePlan}),i?.assignments.map(e=>(0,Q.jsxs)(`section`,{children:[(0,Q.jsxs)(`h3`,{children:[e.id,` · `,e.purpose]}),(0,Q.jsxs)(`p`,{children:[e.role.role,` / `,e.role.sha256]}),(0,Q.jsx)(`pre`,{children:JSON.stringify(e.model,null,2)}),(0,Q.jsx)(Br,{text:e.instructions}),(0,Q.jsx)(`p`,{children:t(`Expected: {output}`,{output:e.expectedOutput})}),(0,Q.jsx)(`pre`,{children:JSON.stringify(e.dependencies,null,2)})]},e.id)),r.kind===`save-plan`&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`h3`,{children:t(`Exact proposed graph and identities (not yet committed)`)}),(0,Q.jsx)(`pre`,{children:JSON.stringify(r.graph,null,2)})]}),r.kind===`review`&&(0,Q.jsxs)(`section`,{children:[(0,Q.jsx)(`h3`,{children:t(`Exact human review targets`)}),(0,Q.jsx)(`pre`,{children:JSON.stringify(r,null,2)}),(0,Q.jsx)(`p`,{children:t(`Human review only; failures, native exit, stale and not-run checks remain unchanged. Issues acknowledgment: {accepted}.`,{accepted:String(r.acceptIssues)})})]})]})}function Kr({client:e,compatible:t,onClose:n,onChanged:r}){let{t:i,tx:a}=$(),[o,s]=(0,f.useState)(),[c,l]=(0,f.useState)(``),[u,d]=(0,f.useState)(``),[p,m]=(0,f.useState)(``),[h,g]=(0,f.useState)(!1);return(0,f.useEffect)(()=>{let t=new AbortController;return e.models(t.signal).then(e=>{t.signal.aborted||(e.kind===`ok`?s(e.value):d(e.error.code))}).catch(()=>{t.signal.aborted||d(`unavailable`)}),()=>t.abort()},[e]),(0,Q.jsxs)(Tr,{title:i(`Choose owner model`),onClose:n,children:[(0,Q.jsx)(`p`,{children:i(`Explicit owner-wide choice, only while quiescent. This does not resolve credentials, probe a provider, save a plan or Start work.`)}),(0,Q.jsx)(`p`,{children:i(`Current: {model}`,{model:o?.selected?`${o.selected.provider}/${o.selected.model} · ${o.selected.thinking}`:i(`No model selected`)})}),(0,Q.jsxs)(`label`,{children:[i(`Exact model / API / thinking`),(0,Q.jsxs)(`select`,{value:c,disabled:!o,onChange:e=>l(e.target.value),children:[(0,Q.jsx)(`option`,{value:``,children:i(`Select explicitly`)}),o?.entries.flatMap(e=>e.thinking.filter(e=>e.selectable).map(t=>{let n=JSON.stringify({provider:e.provider,model:e.model,api:e.api,thinking:t.level});return(0,Q.jsxs)(`option`,{value:n,children:[e.provider,`/`,e.model,` · `,e.api,` · `,t.level]},n)}))]})]}),o?.status===`capacity`&&(0,Q.jsx)(`p`,{children:i(`Catalog capacity exceeded; no partial model list is selectable.`)}),!!o?.withheld&&(0,Q.jsx)(`p`,{role:`alert`,children:i(o.withheld===1?`{count} model withheld: its provider or model ID contains a credential value (such as an apiKey equal to the provider name) or control characters. Give each credential a value that matches no provider or model ID; restart the service after editing models.json.`:`{count} models withheld: their provider or model IDs contain a credential value (such as an apiKey equal to the provider name) or control characters. Give each credential a value that matches no provider or model ID; restart the service after editing models.json.`,{count:o.withheld})}),u&&(0,Q.jsx)(`p`,{role:`alert`,children:i(`Model catalog unavailable ({code}); no model is selectable. No automatic retry.`,{code:a(u)})}),p&&(0,Q.jsx)(`p`,{role:`alert`,children:i(`{error}. No automatic replacement or retry.`,{error:a(p)})}),(0,Q.jsx)(`button`,{type:`button`,disabled:!t||!o||!c||h,onClick:()=>{o&&(g(!0),e.chooseModel({expected:o.version,choice:Ge(JSON.parse(c))}).then(e=>{e.kind===`error`?m(e.error.code):(r(),n())}).catch(()=>m(`Choice response unconfirmed; observe catalog before another explicit choice.`)).finally(()=>g(!1)))},children:i(`Confirm owner model choice`)})]})}function qr({client:e,value:t,onChange:n}){let{t:r,tx:i}=$(),a=(0,f.useRef)(!0),o=(0,f.useRef)(null);(0,f.useEffect)(()=>(a.current=!0,()=>{a.current=!1,o.current?.abort()}),[]);let[s,c]=(0,f.useState)(!1),l=t.receipt??(t.lookup?.status===`found`?t.lookup.receipt:void 0);return(0,Q.jsxs)(`section`,{className:`receipt`,"aria-label":r(`Command receipt`),children:[(0,Q.jsx)(`h3`,{children:r(`Command receipt`)}),(0,Q.jsx)(`code`,{children:t.commandId}),t.error&&(0,Q.jsx)(`p`,{role:`alert`,children:i(t.error)}),l&&(0,Q.jsxs)(`dl`,{children:[(0,Q.jsx)(`dt`,{children:r(`Admission`)}),(0,Q.jsx)(`dd`,{children:i(l.admission)}),(0,Q.jsx)(`dt`,{children:r(`Execution`)}),(0,Q.jsx)(`dd`,{children:l.execution?i(l.execution):r(`not settled`)}),(0,Q.jsx)(`dt`,{children:r(`Publication`)}),(0,Q.jsx)(`dd`,{children:i(l.publication)}),(0,Q.jsx)(`dt`,{children:r(`Run`)}),(0,Q.jsx)(`dd`,{children:l.runId??r(`metadata action`)})]}),t.lookup&&t.lookup.status!==`found`&&(0,Q.jsx)(`p`,{children:r(`{status}. This observation does not authorize replay.`,{status:i(t.lookup.status)})}),(0,Q.jsx)(`button`,{type:`button`,disabled:s,onClick:()=>{c(!0),o.current=new AbortController,e.receipt(t.commandId,o.current.signal).then(e=>{a.current&&(n({commandId:t.commandId,lookup:e}),c(!1))})},children:r(`Observe exact receipt`)})]})}function Jr(e,t){let n=e??{content:t.content,chunks:[],offset:0},r=n.content,i=t.content;if(r.recordId!==i.recordId||r.version!==i.version||r.field!==i.field||r.sha256!==i.sha256||r.bytes!==i.bytes||n.offset!==(t.range?.start??0))throw Error(`Noncontiguous immutable field`);return{...n,chunks:[...n.chunks,t.text],offset:t.range?.end??0}}function Yr(e,t,n){switch(t.reader){case`tasks`:return e.tasks(t,n);case`runs`:return e.runs(t,n);case`messages`:return e.messages(t,n);case`tools`:return e.tools(t,n);case`contents`:return e.contents(t,n);case`events`:return e.events(t,n);case`checks`:return e.checks(t,n);case`changes`:return e.changes(t,n);case`reviews`:return e.reviews(t,n)}}function Xr(e,t,n,r){return{storeId:e,scope:t,snapshotSeq:n,query:null,recordId:r.recordId,recordVersion:r.version,field:r.field,offset:0}}async function Zr(e,t,n){let r={...t,offset:0};delete r.navigation;let i=null,a=!0;for(;r;){if(n.aborted)throw Error(`canceled`);let t=await e.detail(r,n);if(n.aborted)throw Error(`canceled`);if(t.kind===`error`)throw Error(t.error.code);let o=t.value;r=o.next,`kind`in o||(a&&=o.coverage.observed===`complete`,i=Jr(i,o)),await new Promise(e=>setTimeout(e,0))}if(!i||i.offset!==i.content.bytes)throw Error(`incomplete-content`);return{text:i.chunks.join(``),recordingComplete:a}}function Qr(e,t){let n=t?U({reader:t.reader,storeId:t.storeId,scope:t.scope,limit:t.limit}):`absent`,[r,i]=(0,f.useState)(),[a,o]=(0,f.useState)(!1),[s,c]=(0,f.useState)(),[l,u]=(0,f.useState)(t),[d,p]=(0,f.useState)([]),m=(0,f.useRef)(0),[h,g]=(0,f.useState)(n);return h!==n&&(m.current++,g(n),i(void 0),c(void 0),u(t),p([])),(0,f.useEffect)(()=>{let t=++m.current;if(!l){o(!1);return}let n=new AbortController;return o(!0),c(void 0),Yr(e,l,n.signal).then(e=>{t===m.current&&(o(!1),e.kind===`error`?c(e.error.code):i(e.value))}).catch(()=>{t===m.current&&(c(`Read unavailable.`),o(!1))}),()=>{n.abort(),m.current++}},[e,l]),{page:r,busy:a,error:s,more:()=>{!a&&r?.next&&(l&&p(e=>[...e,l]),u(r.next))},previous:()=>{!a&&d.length&&(u(d[d.length-1]),p(e=>e.slice(0,-1)))},canPrevious:d.length>0,refresh:()=>{i(void 0),p([]),u(t?{...t}:null)}}}function $r({value:e,compact:t=!1}){let{t:n,tx:r}=$();return t&&e.observed===`complete`&&e.source===`complete`&&!e.redacted&&e.omissions.length===0?(0,Q.jsxs)(`details`,{className:`coverage-details`,children:[(0,Q.jsx)(`summary`,{children:n(`Recording details`)}),(0,Q.jsx)($r,{value:e})]}):(0,Q.jsxs)(`p`,{className:`coverage${e.observed===`complete`&&e.source===`complete`&&!e.redacted&&e.omissions.length===0?``:` partial`}`,children:[n(`Recording: {observed}; source: {source};`,{observed:r(e.observed),source:r(e.source)}),` `,e.redacted?n(`redacted`):n(`no reported redaction`),e.omissions.length>0&&n(`; omitted: {omissions}`,{omissions:e.omissions.map(r).join(`, `)}),n(`. Not a guarantee of complete original source or universal secret detection.`)]})}function ei(e,t){let n=[],r=t;if(!r)return n;let i=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,{acceptNode(e){let t=e.parentElement;return!t||t.closest(`.search-bar`)||t.closest(`.msg-collapsed`)?NodeFilter.FILTER_REJECT:(e.textContent??``).includes(r)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(let e=i.nextNode();e;e=i.nextNode()){let t=e.textContent??``;if(!e.parentElement?.closest(`[data-retained-field]`))continue;let i=t.indexOf(r);for(;i!==-1;){let a=document.createRange();if(a.setStart(e,i),a.setEnd(e,i+r.length),n.push(a),n.length===1e3)return n;i=t.indexOf(r,i+r.length)}}return n}var ti=new Map;function ni(e,t){t.length?ti.set(e,t):ti.delete(e);let n=e.endsWith(`-active`);e=n?`cadence-page-active`:`cadence-page`,t=[...ti].filter(([e])=>e.endsWith(`-active`)===n).flatMap(([,e])=>e);let r=CSS;if(!r.highlights)return;if(t.length===0){r.highlights.delete(e);return}let i=window.Highlight;i&&r.highlights.set(e,new i(...t))}function ri(e,t){let n=[],r=e;for(;r&&r!==t;){let e=getComputedStyle(r);/(auto|scroll|hidden)/.test(e.overflowY+e.overflowX)&&(r.scrollHeight>r.clientHeight||r.scrollWidth>r.clientWidth)&&n.push(r),r=r.parentElement}return n}function ii(e,t){let n=t.startContainer.parentElement;for(let r of ri(n,e)){let e=t.getBoundingClientRect(),n=r.getBoundingClientRect();if(e.height<=0||e.width<=0)return;e.top>=n.top+4&&e.bottom<=n.bottom-4||(r.scrollTop+=e.top-n.top-(r.clientHeight-e.height)/2),e.left>=n.left+4&&e.right<=n.right-4||(r.scrollLeft+=e.left-n.left-(r.clientWidth-e.width)/2)}let r=t.getBoundingClientRect(),i=e.getBoundingClientRect();if(r.height<=0||r.width<=0)return;let a=r.top>=i.top+6&&r.bottom<=i.bottom-6,o=r.left>=i.left+6&&r.right<=i.right-6;a&&o||(a||(e.scrollTop+=r.top-i.top-(i.height-r.height)/2),o||(e.scrollLeft+=r.left-i.left-(i.width-r.width)/2))}function ai({container:e,version:t}){let{t:n}=$(),[r,i]=(0,f.useState)(``),[a,o]=(0,f.useState)(0),[s,c]=(0,f.useState)(0),l=(0,f.useRef)([]),u=`cadence-page-${(0,f.useId)().replace(/[^a-z0-9]/gi,``)}`;(0,f.useEffect)(()=>{if(!t)return;let n=e.current,i=n&&r?ei(n,r):[];return l.current=i,c(i.length),o(0),ni(u,i),()=>ni(u,[])},[r,e,t,u]);let d=t=>{let n=s?(a+t+s)%s:0;o(n),e.current&&l.current[n]&&(ii(e.current,l.current[n]),ni(`${u}-active`,[l.current[n]]))};return(0,f.useEffect)(()=>()=>ni(`${u}-active`,[]),[u]),(0,Q.jsxs)(`div`,{className:`search-bar toolbar`,children:[(0,Q.jsxs)(`label`,{children:[n(`Find on displayed field page`),(0,Q.jsx)(`input`,{value:r,onChange:e=>i(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),d(e.shiftKey?-1:1))}})]}),(0,Q.jsxs)(`span`,{children:[s?a+1:0,`/`,s,s>=1e3?n(` (first 1000 visual highlights)`):``,n(`; not whole-history search`)]}),(0,Q.jsx)(`button`,{type:`button`,disabled:!s,onClick:()=>d(-1),children:n(`Previous match`)}),(0,Q.jsx)(`button`,{type:`button`,disabled:!s,onClick:()=>d(1),children:n(`Next match`)})]})}function oi({client:e,cursor:t,highlight:n,render:r,compact:i=!1}){let{t:a,tx:o}=$(),s=U(t),c=(0,f.useMemo)(()=>dt(JSON.parse(s)),[s]),[l,u]=(0,f.useState)(t),[d,p]=(0,f.useState)(),[m,h]=(0,f.useState)([]),[g,_]=(0,f.useState)(!1),[v,y]=(0,f.useState)(),[b,x]=(0,f.useState)(i?`markdown`:`raw`),[S,C]=(0,f.useState)(``),w=(0,f.useRef)(null),T=(0,f.useRef)(null);(0,f.useEffect)(()=>(u(c),h([]),p(void 0),y(void 0),()=>w.current?.abort()),[c]),(0,f.useEffect)(()=>{let t=!0,n=new AbortController;return _(!0),y(void 0),e.detail(l,n.signal).then(e=>{t&&(_(!1),e.kind===`error`?y(e.error.code):p(e.value))}).catch(()=>{t&&(y(`Read unavailable.`),_(!1))}),()=>{t=!1,n.abort()}},[e,l]);let ee=async()=>{if(w.current)return;let n=new AbortController;w.current=n,C(a(`Reading all retained field pages…`));try{let r=await Zr(e,t,n.signal);if(n.signal.aborted)return;let i=await Mr(r.text);if(n.signal.aborted)return;C(i?r.recordingComplete?a(`Copied all retained field bytes (source omissions still apply).`):a(`Copied retained field bytes; recording is incomplete. No complete-source claim.`):a(`Clipboard unavailable.`))}catch{n.signal.aborted||C(a(`Full-field copy refused/incomplete.`))}finally{w.current===n&&(w.current=null)}},E=d&&!(`kind`in d)?d:void 0;return(0,Q.jsxs)(`section`,{className:`detail-pane${i?` message-field`:``}`,"aria-label":a(`Retained field`),children:[(0,Q.jsxs)(`details`,{className:`field-details`,open:!i||void 0,children:[(0,Q.jsx)(`summary`,{children:a(`Field details`)}),(0,Q.jsxs)(`div`,{className:`detail-identity`,children:[(0,Q.jsx)(`code`,{children:t.recordId}),` v`,t.recordVersion,` /`,` `,t.field&&o(t.field),` /`,` `,a(`snapshot {seq}`,{seq:t.snapshotSeq})]}),n&&(0,Q.jsx)(`p`,{children:a(`Exact hit bytes [{start}, {end}); only this immutable field is highlighted.`,{start:n.start,end:n.end})}),(0,Q.jsxs)(`div`,{className:`toolbar`,children:[(0,Q.jsx)(`button`,{type:`button`,onClick:()=>x(e=>e===`raw`?`markdown`:`raw`),children:a(b===`raw`?`Markdown page`:`Raw page`)}),(0,Q.jsx)(`button`,{type:`button`,disabled:!!w.current,onClick:()=>void ee(),children:a(`Copy full retained field`)}),!!w.current&&(0,Q.jsx)(`button`,{type:`button`,onClick:()=>{w.current?.abort(),w.current=null,C(a(`Copy canceled; execution unchanged.`))},children:a(`Cancel copy`)})]})]}),S&&(0,Q.jsx)(`p`,{role:`status`,children:S}),v&&(0,Q.jsx)(`p`,{role:`alert`,children:a(`Detail refused: {error}`,{error:o(v)})}),g&&(0,Q.jsx)(`p`,{role:`status`,children:a(`Reading…`)}),d&&(0,Q.jsx)($r,{value:d.coverage,compact:i}),d&&`kind`in d&&(0,Q.jsx)(`p`,{children:a(`Validation in progress. The retained field is not empty.`)}),E&&(0,Q.jsxs)(Q.Fragment,{children:[(!i||E.next)&&(0,Q.jsxs)(`p`,{children:[a(`Bytes {start}–{end} of {total}.`,{start:E.range?.start??0,end:E.range?.end??0,total:E.content.bytes}),` `,E.next?a(`More retained data available.`):a(`End of field.`)]}),!i&&(0,Q.jsx)(ai,{container:T,version:`${E.content.recordId}:${E.content.version}:${E.range?.start??0}:${b}`}),(0,Q.jsx)(`div`,{ref:T,"data-retained-field":!0,children:r?r(E.text):b===`markdown`?(0,Q.jsx)(Br,{text:E.text}):(0,Q.jsx)(`pre`,{className:`detail-text`,children:(()=>{if(!E||!n||!E.range)return E?.text;let e=Math.max(n.start,E.range.start)-E.range.start,t=Math.min(n.end,E.range.end)-E.range.start;if(t<=e)return E.text;let r=new TextEncoder().encode(E.text),i=(e,t)=>new TextDecoder(`utf-8`,{fatal:!0}).decode(r.subarray(e,t));return(0,Q.jsxs)(Q.Fragment,{children:[i(0,e),(0,Q.jsx)(`mark`,{children:i(e,t)}),i(t,r.length)]})})()})})]}),(!i||m.length>0||d?.next)&&(0,Q.jsxs)(`div`,{className:`toolbar`,children:[(0,Q.jsx)(`button`,{type:`button`,disabled:g||!m.length,onClick:()=>{u(m[m.length-1]),h(e=>e.slice(0,-1))},children:a(`Previous`)}),(0,Q.jsx)(`button`,{type:`button`,disabled:g||!d?.next,onClick:()=>{d?.next&&(h(e=>[...e,l]),u(d.next))},children:d&&`kind`in d?a(`Continue validation`):a(`Next field page`)})]})]})}function si({pager:e,compact:t=!1}){let{t:n,tx:r}=$(),{page:i,busy:a,error:o}=e;return(0,Q.jsxs)(`div`,{className:`page-controls${t?` compact`:``}`,children:[o&&(0,Q.jsx)(`p`,{role:`alert`,children:n(`Read refused: {error}. Retained state has not been repaired.`,{error:r(o)})}),a&&(0,Q.jsx)(`p`,{role:`status`,children:n(`Reading bounded history page…`)}),i&&`kind`in i&&(0,Q.jsxs)(`p`,{role:`status`,children:[i.kind===`snapshot`?n(`Snapshot selected`):n(`Validating retained history`),n(`; continue this exact read. No data page yet.`)]}),i&&(0,Q.jsx)($r,{value:i.coverage,compact:t}),(!t||e.canPrevious)&&(0,Q.jsx)(`button`,{type:`button`,disabled:a||!e.canPrevious,onClick:e.previous,children:n(`Previous page`)}),(!t||i?.next)&&(0,Q.jsx)(`button`,{type:`button`,disabled:a||!i?.next,onClick:e.more,children:i&&`kind`in i?n(`Continue validation`):n(`Next page`)}),(0,Q.jsx)(`button`,{type:`button`,disabled:a,onClick:e.refresh,"aria-label":n(`Observe a new snapshot`),title:n(`Observe a new snapshot`),children:t?(0,Q.jsx)(se,{"aria-hidden":`true`}):n(`Observe a new snapshot`)}),!t&&i&&!(`kind`in i)&&!i.next&&(0,Q.jsx)(`span`,{className:`page-end`,children:i.coverage.observed===`incomplete`?n(`End of this retained snapshot (incomplete).`):n(`End of this retained snapshot.`)})]})}function ci({client:e,seed:t,entityId:n}){let{t:r,tx:i}=$(),a=Qr(e,{...t,reader:`contents`}),[o,s]=(0,f.useState)(),c=a.page;return(0,Q.jsxs)(`section`,{"aria-label":r(`Retained content fields`),children:[(0,Q.jsx)(si,{pager:a}),n&&(0,Q.jsx)(`p`,{children:(0,Q.jsx)(br,{text:r(`Showing matches for entity {entity} on this page only. Continue paging for other fields/versions.`),slots:{entity:(0,Q.jsx)(`code`,{children:n})}})}),c&&!(`kind`in c)&&c.records.map(e=>e.kind!==`content`&&e.kind!==`omitted`||n&&e.owner.entity.id!==n?null:e.kind===`omitted`?(0,Q.jsxs)(`p`,{className:`omission`,children:[r(`Omitted source block:`),` `,(0,Q.jsx)(`code`,{children:JSON.stringify(e.block)})]},`${e.owner.entity.id}:${e.version}:${JSON.stringify(e.block.owner)}`):(0,Q.jsxs)(`article`,{children:[(0,Q.jsxs)(`p`,{children:[i(e.owner.entity.kind),` `,(0,Q.jsx)(`code`,{children:e.owner.entity.id}),` ·`,` `,i(e.content.field),` ·`,` `,r(`{bytes} retained bytes`,{bytes:e.content.bytes})]}),(0,Q.jsx)(`pre`,{children:JSON.stringify(e.descriptor.owner)}),(0,Q.jsx)($r,{value:e.coverage}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>{c.request.scope.kind!==`workspace`&&c.request.snapshotSeq!==null&&s(Xr(c.request.storeId,c.request.scope,c.request.snapshotSeq,e.content))},children:r(`Inspect complete retained field`)})]},`${e.content.recordId}:${e.content.version}`)),o&&(0,Q.jsx)(oi,{client:e,cursor:o},`${o.recordId}:${o.recordVersion}`)]})}function li({client:e,seed:t}){return(0,Q.jsx)(ui,{client:e,seed:t},U(t))}function ui({client:e,seed:t}){let{t:n,tx:r}=$(),[i,a]=(0,f.useState)(t),[o,s]=(0,f.useState)(),[c,l]=(0,f.useState)(),[u,d]=(0,f.useState)(!1);return(0,f.useEffect)(()=>{let t=!0,n=new AbortController;return d(!0),(i.kind===`message`?e.message(i,n.signal):i.kind===`tool`?e.tool(i,n.signal):e.task(i,n.signal)).then(e=>{t&&(d(!1),e.kind===`error`?l(e.error.code):(s(e.value),l(void 0)))}).catch(()=>{t&&(l(`Read unavailable.`),d(!1))}),()=>{t=!1,n.abort()}},[e,i]),(0,Q.jsxs)(`section`,{"aria-label":n(`Exact entity metadata`),children:[u&&(0,Q.jsx)(`p`,{children:n(`Reading exact entity version…`)}),c&&(0,Q.jsx)(`p`,{role:`alert`,children:n(`Entity refused: {error}`,{error:r(c)})}),o&&`kind`in o&&(0,Q.jsx)($r,{value:o.coverage}),o&&(`kind`in o?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{children:n(`Entity validation in progress, not missing.`)}),(0,Q.jsx)(`button`,{type:`button`,disabled:u,onClick:()=>a(o.next),children:n(`Continue exact entity validation`)})]}):(0,Q.jsxs)(`details`,{children:[(0,Q.jsx)(`summary`,{children:n(`Exact stored owner and associations`)}),(0,Q.jsx)(`pre`,{children:JSON.stringify(o.record,null,2)})]}))]})}function di(e){let t=nr(`download`,bn(e));if(t.method!==`GET`)throw Error(`Native download needs the named GET attachment route.`);let n=document.createElement(`a`);n.href=t.path,n.download=`cadence-${e.scope.kind}-${e.scope.id}.${e.format===`markdown`?`md`:`ndjson`}`,n.referrerPolicy=`no-referrer`,document.body.appendChild(n),n.click(),n.remove()}function fi({request:e,onClose:t}){let{t:n,tx:r}=$(),[i]=(0,f.useState)(e),[a,o]=(0,f.useState)(e.format),[s,c]=(0,f.useState)(``);return(0,Q.jsxs)(Tr,{title:n(`Export retained history`),onClose:t,children:[(0,Q.jsx)(`p`,{children:n(`Selected {kind}: {id} · snapshot {seq}`,{kind:r(i.scope.kind),id:i.scope.id,seq:i.snapshotSeq})}),(0,Q.jsxs)(`label`,{children:[n(`Format`),(0,Q.jsxs)(`select`,{value:a,onChange:e=>o(e.target.value===`markdown`?`markdown`:`ndjson`),children:[(0,Q.jsx)(`option`,{value:`ndjson`,children:n(`NDJSON public archive`)}),(0,Q.jsx)(`option`,{value:`markdown`,children:n(`Readable Markdown with footer metadata`)})]})]}),(0,Q.jsx)(`p`,{children:n(`Includes retained context, messages/tools, graph, lifecycle, changes, checks, human review and coverage beyond loaded pages. Redactions and source omissions remain.`)}),(0,Q.jsx)(`p`,{children:n(`A native browser download request cannot establish completion. Inspect the original EOF and completion trailer/counts/digest in the downloaded artifact; missing footer means incomplete. Revoked access may terminate without a trailer.`)}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>{try{di({...i,format:a}),c(n(`Download requested — completion not verified by this browser UI.`))}catch{c(n(`Download unavailable; no archive claimed complete.`))}},children:n(`Request selected-scope download`)}),(0,Q.jsx)(`p`,{role:`status`,children:s})]})}function pi(e,t){if(!t||Ie(t)>k.queryBytes)throw Error(`Query must be 1–${k.queryBytes} UTF-8 bytes; it was not clipped.`);let{navigation:n,...r}=e;return dt({...r,query:t,recordId:null,recordVersion:null,field:null,offset:0})}function mi(e){return e.next?`No hits in this bounded window; search is not finished.`:`No hits in the final retained window. Coverage limits above still apply.`}function hi({client:e,seed:t,onClose:n,onHit:r}){let{t:i,tx:a}=$(),[o]=(0,f.useState)(t),s=(0,f.useRef)(null),c=(0,f.useRef)(0),[l,u]=(0,f.useState)(``),[d,p]=(0,f.useState)(0),[m,h]=(0,f.useState)(),[g,_]=(0,f.useState)(!1),[v,y]=(0,f.useState)(),b=(0,f.useRef)(null),x=(0,f.useCallback)(async(t,n)=>{b.current?.abort();let r=new AbortController;b.current=r,_(!0),y(void 0);try{let i=await e.search(t,r.signal);if(c.current!==n||r.signal.aborted)return;i.kind===`error`?y(i.error.code):(h(i.value),p(0))}catch{c.current===n&&!r.signal.aborted&&y(`Search unavailable or invalid; no automatic retry.`)}finally{c.current===n&&!r.signal.aborted&&_(!1)}},[e]);return(0,f.useEffect)(()=>(s.current?.focus(),()=>{c.current++,b.current?.abort()}),[]),(0,f.useEffect)(()=>{let e=++c.current;if(b.current?.abort(),_(!1),h(void 0),p(0),y(void 0),!l)return;let t;try{t=pi(o,l)}catch{y(`Query must be 1–1024 UTF-8 bytes; it was not clipped.`);return}let n=setTimeout(()=>void x(t,e),300);return()=>{clearTimeout(n),c.current++,b.current?.abort()}},[l,o,x]),(0,Q.jsx)(Tr,{title:i(`Search retained history`),onClose:n,children:(0,Q.jsxs)(`div`,{className:`gs-modal`,children:[(0,Q.jsxs)(`div`,{className:`gs-input-row`,children:[(0,Q.jsx)(oe,{}),(0,Q.jsx)(`input`,{ref:s,"aria-label":i(`Case-sensitive literal query`),value:l,onChange:e=>u(e.target.value),onKeyDown:e=>{e.key===`ArrowDown`&&(e.preventDefault(),p(e=>Math.max(0,Math.min(e+1,(m?.hits.length??0)-1)))),e.key===`ArrowUp`&&(e.preventDefault(),p(e=>Math.max(e-1,0))),e.key===`Enter`&&m?.hits[d]&&(e.preventDefault(),r(m.hits[d]),n())}})]}),(0,Q.jsx)(`p`,{children:i(`Case-sensitive literal UTF-8 search. Scope {kind} {id}; snapshot {seq}. No regex, provider request or history repair.`,{kind:a(o.scope.kind),id:o.scope.id,seq:o.snapshotSeq})}),(0,Q.jsxs)(`div`,{className:`gs-results`,children:[g&&(0,Q.jsx)(`p`,{role:`status`,children:i(`Searching bounded retained range…`)}),v&&(0,Q.jsx)(`p`,{role:`alert`,children:i(`Search refused: {error}`,{error:a(v)})}),!l&&(0,Q.jsx)(`p`,{children:i(`Enter a query to search this selected scope.`)}),m&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)($r,{value:m.coverage}),(0,Q.jsxs)(`div`,{className:`gs-section`,children:[(0,Q.jsx)(`div`,{className:`gs-section-head`,children:i(`Matches on this page: {count}`,{count:m.hits.length})}),m.hits.map((e,t)=>(0,Q.jsxs)(`button`,{type:`button`,className:`gs-item ${d===t?`active`:``}`,onMouseEnter:()=>p(t),onClick:()=>{r(e),n()},children:[(0,Q.jsxs)(`span`,{className:`gs-item-title`,children:[a(e.owner.entity.kind),` · `,a(e.content.field),` · v`,e.content.version]}),(0,Q.jsx)(`span`,{className:`gs-item-sub`,children:e.preview}),(0,Q.jsxs)(`code`,{children:[e.owner.childRunId??e.owner.runId??e.owner.taskId,` `,`/ `,e.content.recordId,` /`,` `,i(`bytes {start}–{end}`,{start:e.range.start,end:e.range.end})]})]},`${e.content.recordId}:${e.content.version}:${e.range.start}`)),m.hits.length===0&&(0,Q.jsx)(`p`,{children:a(mi(m))})]}),(0,Q.jsx)(`button`,{type:`button`,disabled:g||!m.next,onClick:()=>{m.next&&x(m.next,++c.current)},children:i(`Continue same snapshot search`)})]})]}),(0,Q.jsx)(`footer`,{className:`gs-foot`,children:i(`↑↓ Navigate · Enter Open exact hit · Escape Close. Reopening never resumes execution.`)})]})})}function gi({run:e,historical:t=!1}){let{t:n,tx:r}=$();return(0,Q.jsxs)(`article`,{className:`run-summary`,children:[(0,Q.jsxs)(`h3`,{children:[e.assignmentId??e.admission.kind,` ·`,` `,n(t?`historical projection`:`owner projection`)]}),(0,Q.jsx)(`p`,{children:(0,Q.jsx)(`code`,{children:e.childRunId??e.runId})}),(0,Q.jsxs)(`dl`,{children:[(0,Q.jsx)(`dt`,{children:n(`Lifecycle`)}),(0,Q.jsx)(`dd`,{children:r(e.lifecycle)}),(0,Q.jsx)(`dt`,{children:n(`Execution`)}),(0,Q.jsx)(`dd`,{children:e.outcome?r(e.outcome):n(`unsettled`)}),(0,Q.jsx)(`dt`,{children:n(`Wait/block reason`)}),(0,Q.jsx)(`dd`,{children:e.reason?r(e.reason):n(`none reported`)}),(0,Q.jsx)(`dt`,{children:n(`Summary publication`)}),(0,Q.jsx)(`dd`,{children:r(e.publication)})]}),(0,Q.jsx)($r,{value:e.coverage}),(0,Q.jsxs)(`details`,{children:[(0,Q.jsx)(`summary`,{children:n(`Native / recording / parent settlement facts (independent of human review)`)}),(0,Q.jsx)(`pre`,{children:e.settlement?JSON.stringify(e.settlement,null,2):n(`No settlement recorded`)})]})]})}function _i({client:e,seed:t}){return(0,Q.jsx)(vi,{client:e,seed:t},U(t))}function vi({client:e,seed:t}){let{t:n,tx:r}=$(),[i,a]=(0,f.useState)(t),[o,s]=(0,f.useState)(),[c,l]=(0,f.useState)(),[u,d]=(0,f.useState)(!1);return(0,f.useEffect)(()=>{let t=!0,n=new AbortController;return d(!0),e.graph(i,n.signal).then(e=>{t&&(d(!1),e.kind===`error`?l(e.error.code):(s(e.value),l(void 0)))}).catch(()=>{t&&(l(`Read unavailable.`),d(!1))}),()=>{t=!1,n.abort()}},[e,i]),(0,Q.jsxs)(`section`,{children:[(0,Q.jsx)(`h3`,{children:n(`Immutable admitted graph`)}),c&&(0,Q.jsx)(`p`,{role:`alert`,children:n(`Graph refused: {error}`,{error:r(c)})}),u&&(0,Q.jsx)(`p`,{children:n(`Reading graph…`)}),o&&`kind`in o&&(0,Q.jsx)($r,{value:o.coverage}),o&&(`kind`in o?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{children:n(`Graph validation in progress; not an empty graph.`)}),(0,Q.jsx)(`button`,{type:`button`,disabled:u,onClick:()=>a(o.next),children:n(`Continue graph validation`)})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(oi,{client:e,cursor:Xr(o.request.storeId,o.request.scope,o.request.snapshotSeq,o.graph.plan)}),o.graph.assignments.map(e=>(0,Q.jsxs)(`article`,{children:[(0,Q.jsxs)(`h4`,{children:[e.id,` / `,e.purpose]}),(0,Q.jsx)(Br,{text:e.instructions}),(0,Q.jsx)(`p`,{children:n(`Expected: {output}`,{output:e.expectedOutput})}),(0,Q.jsx)(`pre`,{children:JSON.stringify({model:e.model,role:e.role,dependencies:e.dependencies},null,2)})]},e.id))]}))]})}function yi({client:e,seed:t,onScope:n}){let{t:r}=$(),i=Qr(e,{...t,reader:`runs`}),a=i.page,[o,s]=(0,f.useState)();return(0,Q.jsxs)(`section`,{children:[(0,Q.jsx)(si,{pager:i}),a&&!(`kind`in a)&&a.records.map(e=>e.kind===`run`?(0,Q.jsxs)(`article`,{children:[(0,Q.jsx)(gi,{run:e.projection,historical:!0}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>n({kind:e.projection.childRunId?`child`:`run`,id:e.projection.childRunId??e.projection.runId}),children:r(`Open retained episode/child details`)}),e.projection.admission.graph&&(0,Q.jsx)(`button`,{type:`button`,onClick:()=>{a.request.scope.kind!==`workspace`&&a.request.snapshotSeq!==null&&e.projection.admission.graph&&s({storeId:a.request.storeId,scope:a.request.scope,snapshotSeq:a.request.snapshotSeq,graph:e.projection.admission.graph})},children:r(`Inspect admitted graph and plan`)})]},e.projection.childRunId??e.projection.runId):null),o&&(0,Q.jsx)(_i,{client:e,seed:o},o.graph.recordId)]})}function bi({onOpen:e,disabled:t}){let{t:n}=$();return(0,Q.jsx)(`button`,{type:`button`,className:`chip search-toggle`,"aria-label":n(`Search all retained pages in selected scope`),"data-tip":n(`Search all retained pages in selected scope`),disabled:t,onClick:e,children:(0,Q.jsx)(oe,{"aria-hidden":`true`})})}function xi(e,t,n,r,i){let a=i??t,o=[],s=[],c=0;for(let i of e)n.has(i.id)||(r.has(i.id)?i.top<t.bottom&&i.bottom>t.top&&o.push(i.id):i.top<a.bottom&&i.bottom>a.top||(s.push(i.id),i.bottom<=a.top&&(c+=i.bottom-i.top)));return{show:o,hide:s,shrinkAbove:c}}function Si(e,t){if(t.show.length===0&&t.hide.length===0)return e;let n=new Set(e);for(let e of t.show)n.delete(e);for(let e of t.hide)n.add(e);return n}function Ci(e,t,n){let r=new Set,i=0;for(let a=e.length-1;a>=0&&!(a<e.length-1&&i>=n);a--){let n=e[a];r.add(n.id),i+=t.get(n.id)??wi(n.role,n.customType)}return r}function wi(e,t){switch(e){case`user`:return 72;case`assistant`:return 280;case`tool-result`:return 120;case`custom`:return t===`file`?96:72;default:return 60}}function Ti(e,t,n,r){let i=n.get(e);return i&&i.len===t?i.h:r}var Ei=(0,f.memo)(function({id:e,show:t,height:n,containerRef:r,onMeasured:i,lazyRef:a,children:o}){let s=(0,f.useRef)(null);return(0,f.useLayoutEffect)(()=>{if(!t)return;let n=s.current;if(!n)return;let r=n.offsetHeight;r>0&&i?.(e,r)},[t,e,i]),t?(0,Q.jsx)(`div`,{ref:a,"data-lazy-id":e,children:(0,Q.jsx)(`div`,{ref:s,children:o})}):(0,Q.jsx)(`div`,{ref:a,className:`msg-lazy-ph`,"data-msg-id":e,"data-lazy-id":e,style:{height:n},"aria-hidden":`true`})}),Di=(0,f.memo)(function({message:e,client:t,seed:n}){let{t:r,tx:i}=$(),[a,o]=(0,f.useState)(!1);return(0,Q.jsxs)(`article`,{className:`msg msg-${e.role}`,"data-msg-id":e.owner.entity.id,children:[(0,Q.jsxs)(`header`,{className:`msg-meta`,children:[(0,Q.jsx)(`strong`,{className:`msg-role`,children:i(e.role)}),e.state!==`final`&&(0,Q.jsx)(`span`,{className:`msg-state`,children:i(e.state)}),(0,Q.jsxs)(`button`,{type:`button`,className:`msg-inspect`,"aria-expanded":a,onClick:()=>o(e=>!e),children:[a?(0,Q.jsx)(Ee,{"aria-hidden":`true`}):(0,Q.jsx)(be,{"aria-hidden":`true`}),r(a?`Collapse`:`Inspect message`)]})]}),(0,Q.jsxs)(`div`,{className:`msg-body`,children:[e.role===`tool-result`&&(0,Q.jsx)(`p`,{className:`msg-note`,children:r(`Result call: {call}. Kept visible independently of the tool card.`,{call:e.resultCallId??r(`unassociated / orphan`)})}),(0,Q.jsx)(`div`,{className:`msg-text`,children:(0,Q.jsxs)(`div`,{className:`msg-text-main`,children:[e.finalText&&n.scope.kind!==`workspace`&&n.snapshotSeq!==null?(0,Q.jsx)(oi,{compact:!0,client:t,cursor:Xr(n.storeId,n.scope,n.snapshotSeq,e.finalText)}):(0,Q.jsx)(`p`,{children:r(`No finalized text field in this snapshot. Inspect retained partial/final blocks and omission metadata below.`)}),a&&(0,Q.jsxs)(`div`,{className:`message-inspection`,children:[(0,Q.jsx)(`p`,{className:`msg-ident`,children:r(`Child {child} · message {message} · version {version}`,{child:e.owner.childRunId??``,message:e.owner.entity.id,version:e.version})}),(0,Q.jsx)(`p`,{className:`msg-note`,children:r(`{state} message record, not execution outcome`,{state:i(e.state)})}),(0,Q.jsxs)(`details`,{open:!0,children:[(0,Q.jsx)(`summary`,{children:r(`All message blocks, source limits and tool associations`)}),(0,Q.jsx)(ci,{client:t,seed:n,entityId:e.owner.entity.id})]})]})]})})]})]})});function Oi({messages:e,client:t,seed:n}){let{t:r}=$(),i=(0,f.useRef)(null),a=(0,f.useRef)(!0),[o,s]=(0,f.useState)(()=>new Set),c=(0,f.useRef)(o);c.current=o;let l=(0,f.useRef)(new Map),u=(0,f.useRef)(new Map),d=(0,f.useRef)(new Map),p=(0,f.useRef)(0),m=(0,f.useMemo)(()=>e.map(e=>({id:e.owner.entity.id,role:e.role,message:e})),[e]),h=(0,f.useRef)(new Map);h.current=new Map(m.map(e=>[e.id,e.message.version]));let g=(0,f.useRef)(new Set);g.current=Ci(m,l.current,1800);let _=(0,f.useCallback)((e,t)=>{let n=h.current.get(e);n!==void 0&&(u.current.set(e,{h:t,len:n}),l.current.set(e,t))},[]),v=(0,f.useCallback)(()=>{let e=i.current;if(!e)return;let t=e.getBoundingClientRect(),n=[];for(let[e,t]of d.current){let r=t.getBoundingClientRect();n.push({id:e,top:r.top,bottom:r.bottom}),c.current.has(e)||_(e,r.height)}let r=xi(n,{top:t.top-1200,bottom:t.bottom+1200},g.current,c.current,{top:t.top-2400,bottom:t.bottom+2400});for(let e of r.hide){let t=d.current.get(e);t&&_(e,t.offsetHeight)}s(e=>Si(e,r))},[_]),y=(0,f.useCallback)(()=>{p.current||=requestAnimationFrame(()=>{p.current=0,v()})},[v]);return(0,f.useLayoutEffect)(()=>{m.length?v():s(new Set)},[v,m]),(0,f.useEffect)(()=>{let e=new ResizeObserver(y);return i.current&&e.observe(i.current),()=>{e.disconnect(),cancelAnimationFrame(p.current)}},[y]),(0,Q.jsxs)(`div`,{className:`messages-wrap`,children:[(0,Q.jsx)(`div`,{className:`messages`,ref:i,onScroll:e=>{let t=e.currentTarget;a.current=t.scrollHeight-t.scrollTop-t.clientHeight<80,y()},children:m.map(({id:e,role:r,message:a})=>(0,Q.jsx)(Ei,{id:e,show:!o.has(e),height:Ti(e,a.version,u.current,r===`user`?100:280),containerRef:i,onMeasured:_,lazyRef:t=>{t?d.current.set(e,t):d.current.delete(e)},children:(0,Q.jsx)(Di,{message:a,client:t,seed:n})},e))}),(0,Q.jsxs)(`button`,{type:`button`,className:`scroll-bottom`,onClick:()=>{i.current&&(i.current.scrollTop=i.current.scrollHeight,a.current=!0)},children:[(0,Q.jsx)(je,{"aria-hidden":`true`}),r(`Latest on loaded page`)]})]})}function ki({client:e,seed:t}){let{t:n}=$(),r=Qr(e,{...t,reader:`messages`}),i=r.page;return(0,Q.jsxs)(`section`,{className:`transcript`,children:[(0,Q.jsx)(si,{pager:r,compact:!0}),i&&!(`kind`in i)&&t.snapshotSeq!==null&&i.request.snapshotSeq!==t.snapshotSeq&&(0,Q.jsx)(`button`,{type:`button`,className:`conversation-update`,disabled:r.busy,onClick:r.refresh,children:n(`New activity — update conversation`)}),i&&!(`kind`in i)&&(0,Q.jsxs)(Q.Fragment,{children:[i.records.length===0&&(0,Q.jsx)(`p`,{className:`empty-note panel-empty`,children:i.next?n(`No message records on this page; more history remains.`):n(`No message records on this page.`)}),(0,Q.jsx)(Oi,{messages:i.records.filter(e=>e.kind===`message`),client:e,seed:i.request},`${i.request.snapshotSeq}:${i.request.after?.recordId??`first`}`)]})]})}function Ai({open:e,onToggle:t,headClassName:n,titleText:r,icon:i,iconClassName:a,titleClassName:o,toggleClassName:s,toggle:c,onHeadContextMenu:l,children:u,after:d}){return(0,Q.jsxs)(`div`,{className:`chead ${n}`,children:[(0,Q.jsxs)(`button`,{type:`button`,className:`chead-main`,"aria-expanded":e,title:r,onClick:t,onContextMenu:l,children:[c===void 0?(0,Q.jsx)(`span`,{className:s?`chead-toggle ${s}`:`chead-toggle`,children:e?(0,Q.jsx)(De,{}):(0,Q.jsx)(O,{})}):c,(0,Q.jsx)(`span`,{className:a?`chead-icon ${a}`:`chead-icon`,children:i}),(0,Q.jsx)(`span`,{className:o?`chead-title ${o}`:`chead-title`,children:u})]}),d]})}var ji=(0,f.memo)(function({record:e,client:t,seed:n}){let{t:r,tx:i}=$(),[a,o]=(0,f.useState)(!1),s=e.result?e.result.isError?r(`SDK tool error observed`):r(`SDK tool end observed`):e.startObserved?r(`Start observed; end not observed in this snapshot`):r(`No start observed`),c=e.result?e.result.isError?`err`:`ok`:e.startObserved?`pending`:``;return(0,Q.jsxs)(`div`,{className:`toolcall${c===`err`?` err`:``}`,children:[(0,Q.jsx)(Ai,{open:a,onToggle:()=>o(e=>!e),headClassName:`toolcall-head`,titleText:r(`Inspect recorded tool call`),icon:(0,Q.jsx)(re,{}),iconClassName:`toolcall-icon`,titleClassName:`toolcall-name`,after:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`toolcall-path`,children:r(`Child {child} · call {call} · v{version}`,{child:e.owner.childRunId??``,call:e.owner.entity.id,version:e.version})}),(0,Q.jsx)(`span`,{className:`toolcall-badge ${c}`,children:s})]}),children:e.name}),a&&(0,Q.jsxs)(`div`,{className:`toolcall-body`,children:[(0,Q.jsx)(`p`,{children:r(`SDK tool observations are not native process launch/close or passing parent checks.`)}),(0,Q.jsxs)(`dl`,{children:[(0,Q.jsx)(`dt`,{children:r(`Source ID`)}),(0,Q.jsxs)(`dd`,{children:[i(e.source.disposition),`:`,` `,e.source.value??r(`unavailable`)]}),(0,Q.jsx)(`dt`,{children:r(`Declaration`)}),(0,Q.jsx)(`dd`,{children:e.declaration?`${e.declaration.messageId} / ${e.declaration.blockId} (${i(String(e.declarationStage))})`:r(`No declaration recorded; orphan result remains accessible`)})]}),(0,Q.jsxs)(`div`,{className:`toolcall-output`,children:[(0,Q.jsx)(`div`,{className:`toolcall-output-label`,children:r(`Recorded tool end (not parsed from output)`)}),(0,Q.jsx)(`pre`,{children:e.result?JSON.stringify(e.result,null,2):r(`No end fact in this snapshot.`)})]}),(0,Q.jsx)(`div`,{className:`toolcall-args`,children:(0,Q.jsx)(ci,{client:t,seed:n,entityId:e.owner.entity.id})})]})]})});function Mi({draft:e,onChange:t,context:n,roles:r,onSave:i,onGenerate:a,onStart:o,canSave:s,canAct:c}){let{t:l,tx:u}=$(),[d,p]=(0,f.useState)(!0),[m,h]=(0,f.useState)(null),[g,_]=(0,f.useState)(``),[v,y]=(0,f.useState)(``),[b,x]=(0,f.useState)(`research`),[S,C]=(0,f.useState)([]),[w,T]=(0,f.useState)(``),[ee,E]=(0,f.useState)(``),D=e.assignments,te=e=>{h(e.id),_(e.instructions),y(e.expectedOutput),x(e.purpose),C(e.dependencies),E(``)},re=()=>{h(null),_(``),y(``),E(``)},ie=n=>{let i=r?.find(e=>e.role===Je(b));i?(t({...e,assignments:D.map(e=>e.id===n?{...e,purpose:b,instructions:g,expectedOutput:v,dependencies:S,role:i}:e)}),re()):E(lr)},ae=()=>{let i=r?.find(e=>e.role===Je(`research`));if(!i){E(lr);return}let a=1;for(;D.some(e=>e.id===`assignment-${a}`);)a++;let o={id:`assignment-${a}`,purpose:`research`,instructions:``,expectedOutput:``,dependencies:[],role:i,model:n.model};t({...e,assignments:[...D,o]}),te(o)},oe=n=>{D.some(e=>e.dependencies.some(e=>e.source.kind===`current`&&e.source.assignmentId===n))?E(`Remove dependent edges explicitly before deleting this assignment.`):t({...e,assignments:D.filter(e=>e.id!==n)})};return(0,Q.jsxs)(`section`,{className:`plan-board ${d?``:`plan-board-collapsed`}`,children:[(0,Q.jsx)(`div`,{className:`plan-board-head`,children:(0,Q.jsxs)(`button`,{type:`button`,className:`plan-board-head-main`,"aria-expanded":d,onClick:()=>p(!d),children:[(0,Q.jsx)(fe,{}),(0,Q.jsx)(`span`,{children:l(`Readable plan & decomposition`)}),(0,Q.jsx)(`span`,{children:l(`{count} required assignments`,{count:D.length})}),d?(0,Q.jsx)(Ee,{}):(0,Q.jsx)(De,{})]})}),(0,Q.jsxs)(`div`,{className:`toolbar`,children:[(0,Q.jsx)(`button`,{type:`button`,disabled:!c||n.task?.kind!==`code`,onClick:a,children:l(`Preview readonly Generate proposal`)}),(0,Q.jsx)(`button`,{type:`button`,disabled:!s,onClick:i,children:l(`Preview Save plan`)}),(0,Q.jsx)(`button`,{type:`button`,className:`primary`,disabled:!c,onClick:o,children:l(`Preview Start saved graph`)})]}),(0,Q.jsx)(`p`,{children:l(`Draft changes never execute. Start uses the saved graph shown in its fresh preview, not unsaved text. Generated proposals never save or start themselves.`)}),D.some(e=>U(e.model)!==U(n.model))&&(0,Q.jsxs)(`section`,{children:[(0,Q.jsx)(`p`,{children:l(`Saved assignments name an old model selection. Reading does not rebind them.`)}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>t({...e,assignments:D.map(e=>({...e,model:n.model}))}),children:l(`Explicitly rebind draft to current model (requires new Save)`)})]}),!r&&(0,Q.jsx)(`p`,{role:`status`,children:u(`Current plan metadata unavailable. Observe again; historical text is not action authority.`)}),ee&&(0,Q.jsx)(`p`,{role:`alert`,children:u(ee)}),d&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`label`,{children:[l(`Readable plan`),(0,Q.jsx)(`textarea`,{"aria-label":l(`Readable plan`),value:e.readablePlan,onChange:n=>t({...e,readablePlan:n.target.value}),rows:8})]}),(0,Q.jsxs)(`details`,{children:[(0,Q.jsx)(`summary`,{children:l(`Read rendered plan`)}),(0,Q.jsx)(Br,{text:e.readablePlan})]}),(0,Q.jsx)(Pr,{text:e.readablePlan}),(0,Q.jsx)(`ol`,{className:`plan-board-steps`,children:D.map(e=>(0,Q.jsxs)(`li`,{className:`plan-board-step`,children:[(0,Q.jsxs)(`div`,{className:`plan-step-head`,children:[(0,Q.jsx)(`strong`,{children:e.id}),(0,Q.jsxs)(`span`,{children:[u(e.purpose),` —`,` `,e.purpose===`edit`?l(`checkout writer`):l(`readonly`)]}),(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>te(e),children:[(0,Q.jsx)(xe,{}),` `,l(`Edit`)]}),(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>oe(e.id),children:[(0,Q.jsx)(ne,{}),` `,l(`Remove draft assignment`)]})]}),m===e.id?(0,Q.jsxs)(`div`,{className:`plan-step-edit`,children:[(0,Q.jsxs)(`label`,{children:[l(`Purpose`),(0,Q.jsx)(`select`,{value:b,onChange:e=>{let t=e.target.value;(t===`research`||t===`diagnosis`||t===`review`||t===`edit`&&n.task?.kind===`code`)&&x(t)},children:[`research`,`diagnosis`,`review`,`edit`].filter(e=>e!==`edit`||n.task?.kind===`code`).map(e=>(0,Q.jsx)(`option`,{value:e,children:u(e)},e))})]}),(0,Q.jsxs)(`label`,{children:[l(`Instructions`),(0,Q.jsx)(`textarea`,{"aria-label":l(`Instructions`),value:g,onChange:e=>_(e.target.value),rows:5})]}),(0,Q.jsxs)(`label`,{children:[l(`Expected output`),(0,Q.jsx)(`textarea`,{"aria-label":l(`Expected output`),value:v,onChange:e=>y(e.target.value),rows:3})]}),(0,Q.jsxs)(`fieldset`,{children:[(0,Q.jsx)(`legend`,{children:l(`Current-episode dependencies (whole final text by default)`)}),D.filter(t=>t.id!==e.id).map(e=>{let t=S.findIndex(t=>t.source.kind===`current`&&t.source.assignmentId===e.id);return(0,Q.jsxs)(`label`,{children:[(0,Q.jsx)(`input`,{type:`checkbox`,checked:t>=0,onChange:t=>C(n=>t.target.checked?[...n,{source:{kind:`current`,assignmentId:e.id},range:null,requireCompleteObservation:!1}]:n.filter(t=>t.source.kind!==`current`||t.source.assignmentId!==e.id))}),e.id]},e.id)})]}),S.map((e,t)=>(0,Q.jsxs)(`div`,{className:`dependency-editor`,children:[(0,Q.jsx)(`code`,{children:JSON.stringify(e.source)}),(0,Q.jsxs)(`label`,{children:[(0,Q.jsx)(`input`,{type:`checkbox`,checked:e.requireCompleteObservation,onChange:e=>C(n=>n.map((n,r)=>t===r?{...n,requireCompleteObservation:e.target.checked}:n))}),l(`Require complete observation`)]}),(0,Q.jsx)(`p`,{children:l(`Selection: {range}`,{range:e.range?l(`reviewed UTF-8 bytes {start}–{end}`,{start:e.range.start,end:e.range.end}):l(`whole final text; no silent clipping`)})}),(0,Q.jsxs)(`label`,{children:[l(`Reviewed edge JSON (range/null and exact historical identity)`),(0,Q.jsx)(`textarea`,{defaultValue:JSON.stringify(e),onBlur:e=>{try{let n=Ye(ze(e.target.value));C(e=>e.map((e,r)=>t===r?n:e)),E(``)}catch{E(`Invalid dependency. Original edge retained; review before Save.`)}}})]}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>C(e=>e.filter((e,n)=>t!==n)),children:l(`Remove edge`)})]},e.source.kind===`current`?e.source.assignmentId:e.source.childRunId)),(0,Q.jsxs)(`label`,{children:[l(`Explicit historical/advisory edge JSON`),(0,Q.jsx)(`textarea`,{value:w,onChange:e=>T(e.target.value),placeholder:l(`Exact committed run/child/result/version plus range and coverage requirement`)})]}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>{try{let e=Ye(ze(w));if(e.source.kind!==`historical`)throw Error();C(t=>[...t,e]),T(``),E(``)}catch{E(`Historical edge requires actual committed identity; no guessed result reference.`)}},children:l(`Add reviewed historical edge`)}),(0,Q.jsx)(`button`,{type:`button`,onClick:re,children:l(`Discard inline edits`)}),(0,Q.jsx)(`button`,{type:`button`,disabled:!!ee,onClick:()=>ie(e.id),children:l(`Apply to local draft`)})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Br,{text:e.instructions}),(0,Q.jsx)(`p`,{children:l(`Expected: {output}`,{output:e.expectedOutput})}),(0,Q.jsxs)(`p`,{children:[l(`Role {role}`,{role:e.role.role}),` /`,` `,(0,Q.jsx)(`code`,{children:e.role.sha256})]}),(0,Q.jsxs)(`p`,{children:[e.model.provider,`/`,e.model.model,` ·`,` `,e.model.thinking]}),(0,Q.jsx)(`pre`,{children:JSON.stringify(e.dependencies,null,2)})]})]},e.id))}),(0,Q.jsxs)(`button`,{type:`button`,disabled:!r||D.length>=16,onClick:ae,children:[(0,Q.jsx)(ce,{}),` `,l(`Add assignment`)]})]})]})}var Ni=`未命名章节`;function Pi(e){return String(e??``).trim().replace(/[\s\u3000]+/g,`-`).replace(/[^\p{L}\p{N}_-]+/gu,`-`).replace(/-{2,}/g,`-`).replace(/^-+|-+$/g,``).slice(0,80)||`section`}function Fi(e){let t=new Map;return e.map(({level:e,label:n})=>{let r=String(n??``).replace(/\s+/g,` `).trim(),i=Pi(r||Ni),a=(t.get(i)??0)+1;return t.set(i,a),{level:e,id:a===1?i:`${i}-${a}`,label:r||Ni}})}function Ii(e){return e.length>=2}function Li(e){let t=0,n=0;return e.split(`
|
|
5
|
+
`).map(e=>{let r={key:`text-offset:${t}`,number:++n,text:e};return t+=e.length+1,r})}function Ri({text:e}){return(0,Q.jsx)(`pre`,{className:`scm-diff-pre`,children:Li(e).map(({text:e,key:t})=>{let n=``;return[`diff --git`,`index `,`new file`,`deleted file`,`old mode`,`new mode`,`similarity index`,`rename `,`copy `,`Binary files`,`---`,`+++`].some(t=>e.startsWith(t))?n=`hdr`:e.startsWith(`@@`)?n=`hunk`:e.startsWith(`+`)?n=`add`:e.startsWith(`-`)&&(n=`del`),(0,Q.jsx)(`div`,{className:`scm-diff-line ${n}`,children:e||` `},t)})})}function zi({text:e}){let{t}=$(),[n,r]=(0,f.useState)(`raw`),[i,a]=(0,f.useState)(!0),[o,s]=(0,f.useState)(1),[c,l]=(0,f.useState)([]),[u,d]=(0,f.useState)(null),p=(0,f.useRef)(1),m=(0,f.useRef)(null),h=e.split(`
|
|
6
|
+
`);return(0,f.useLayoutEffect)(()=>{if(n!==`markdown`)return;if(!e){l([]);return}let t=Array.from(m.current?.querySelectorAll(`h1,h2,h3,h4,h5,h6`)??[]),r=Fi(t.map(e=>({level:Number(e.tagName[1]),label:e.textContent??``})));r.forEach((e,n)=>{t[n].id=`preview-${e.id}`}),l(r)},[e,n]),(0,Q.jsxs)(`div`,{className:`fp-preview`,children:[(0,Q.jsxs)(`div`,{className:`fp-head toolbar`,children:[(0,Q.jsxs)(`label`,{children:[t(`View`),(0,Q.jsxs)(`select`,{value:n,onChange:e=>r(e.target.value===`markdown`?`markdown`:e.target.value===`diff`?`diff`:`raw`),children:[(0,Q.jsx)(`option`,{value:`raw`,children:t(`Raw text / lines`)}),(0,Q.jsx)(`option`,{value:`markdown`,children:t(`Safe Markdown`)}),(0,Q.jsx)(`option`,{value:`diff`,children:t(`Observed diff`)})]})]}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>a(e=>!e),children:t(i?`Wrap: on`:`Wrap: off`)}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>s(e=>Math.min(2,e+.1)),children:t(`Zoom +`)}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>s(e=>Math.max(.8,e-.1)),children:t(`Zoom −`)}),(0,Q.jsx)(Pr,{text:u?h.slice(u.start-1,u.end).join(`
|
|
7
|
+
`):e})]}),(0,Q.jsx)(`p`,{className:`fp-notice`,children:t(`Captured page only, not a current filesystem read. Line numbers are page-local. Full retained paging and copy are available above.`)}),(0,Q.jsx)(`div`,{style:{fontSize:`${o}em`},children:n===`markdown`?(0,Q.jsxs)(`div`,{className:`fp-toc-layout`,children:[Ii(c)&&(0,Q.jsx)(`nav`,{className:`fp-toc`,"aria-label":t(`Page headings`),children:c.map(e=>(0,Q.jsx)(`button`,{type:`button`,className:`l${e.level}`,onClick:()=>m.current?.querySelector(`#${CSS.escape(`preview-${e.id}`)}`)?.scrollIntoView({block:`nearest`}),children:e.label},e.id))}),(0,Q.jsx)(`div`,{className:`fp-markdown-zoom`,ref:m,children:(0,Q.jsx)(Br,{text:e})})]}):n===`diff`?(0,Q.jsx)(Ri,{text:e}):(0,Q.jsx)(`div`,{className:`fp-code ${i?``:`no-wrap`}`,children:Li(e).map(({text:e,number:n,key:r})=>(0,Q.jsxs)(`div`,{className:`fp-line ${u&&n>=u.start&&n<=u.end?`sel`:``}`,children:[(0,Q.jsx)(`button`,{type:`button`,className:`fp-num`,"aria-label":t(`Select page line {line}`,{line:n}),onClick:e=>{e.shiftKey||(p.current=n),d({start:Math.min(p.current,n),end:Math.max(p.current,n)})},children:n}),(0,Q.jsx)(`span`,{className:`fp-code-text`,children:e||` `})]},r))})}),u&&(0,Q.jsxs)(`footer`,{className:`fp-foot`,children:[t(`Selected page lines {start}–{end}`,{start:u.start,end:u.end}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>d(null),children:t(`Clear selection`)})]})]})}function Bi({client:e,seed:t}){let{t:n,tx:r}=$(),i=Qr(e,t),[a,o]=(0,f.useState)(),s=i.page;return(0,Q.jsxs)(`section`,{className:`scm-body`,children:[(0,Q.jsx)(si,{pager:i}),(0,Q.jsx)(`p`,{children:n(`Captured observations include pre-existing dirt. They do not attribute every change to Cadence; bounded fingerprints are not filesystem snapshots.`)}),(0,Q.jsx)(`div`,{className:`scm-files-list`,children:s&&!(`kind`in s)&&s.records.map(e=>{if(e.kind!==`owner-fact`)return null;let t=e.fact,i=t.kind===`changes`||t.kind===`review`?t.content:t.kind===`check-settled`?t.output:null;return(0,Q.jsxs)(`article`,{className:`scm-file`,children:[(0,Q.jsxs)(`h3`,{children:[t.kind,` · `,n(`committed #{seq}`,{seq:e.committedSeq})]}),(0,Q.jsx)(`pre`,{children:JSON.stringify(t,null,2)}),i&&(0,Q.jsx)(`button`,{type:`button`,onClick:()=>{s.request.scope.kind!==`workspace`&&s.request.snapshotSeq!==null&&o(Xr(s.request.storeId,s.request.scope,s.request.snapshotSeq,i))},children:n(`Inspect full retained {field}`,{field:r(i.field)})})]},e.recordId)})}),a&&(0,Q.jsx)(oi,{client:e,cursor:a,render:e=>(0,Q.jsx)(zi,{text:e})},`${a.recordId}:${a.recordVersion}`)]})}function Vi({client:e,taskId:t,seed:n,canAct:r,onAction:i,onObligations:a}){let{t:o,tx:s}=$(),[c,l]=(0,f.useState)(),[u,d]=(0,f.useState)(),[p,m]=(0,f.useState)(0),h=(0,f.useRef)(p);return h.current=p,(0,f.useEffect)(()=>{let n=p,r=new AbortController,i=!0;return l(void 0),e.checkObligations(t,r.signal).then(e=>{i&&h.current===n&&(e.kind===`error`?d(e.error.code):(d(void 0),l(e.value),a(e.value)))}).catch(()=>{i&&d(`Obligations unavailable.`)}),()=>{r.abort(),i=!1}},[e,t,p,a]),(0,Q.jsxs)(`section`,{children:[(0,Q.jsx)(`h3`,{children:o(`Current configured obligations`)}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>m(e=>e+1),children:o(`Observe obligations`)}),u&&(0,Q.jsx)(`p`,{role:`alert`,children:o(`Obligations unavailable: {error}`,{error:s(u)})}),c?.definitions.length===0&&(0,Q.jsx)(`p`,{children:o(`No configured obligations. This is not passing check coverage.`)}),c?.definitions.map(e=>(0,Q.jsxs)(`article`,{children:[(0,Q.jsxs)(`h4`,{children:[e.selection.name,`: `,s(e.status)]}),(0,Q.jsx)(`pre`,{children:e.selection.command}),(0,Q.jsx)(`p`,{children:o(`Timeout {timeout} ms. Native outcome and freshness remain separate.`,{timeout:e.selection.timeoutMs})}),(0,Q.jsx)(`button`,{type:`button`,disabled:!r,onClick:()=>i({kind:`check`,taskId:t,check:e.selection}),children:o(`Preview exact configured check`)})]},e.selection.name)),(0,Q.jsx)(`p`,{children:o(`Browser checks are configured selections only. Native-local manual commands are not a browser shell endpoint.`)}),(0,Q.jsx)(Bi,{client:e,seed:{...n,reader:`checks`}})]})}function Hi({client:e,storeId:t,taskId:n}){let{t:r,tx:i}=$(),[a,o]=(0,f.useState)(),[s,c]=(0,f.useState)(``),[l,u]=(0,f.useState)(0);return(0,f.useEffect)(()=>{if(l<0)return;let r=new AbortController;return o(void 0),c(``),e.currentChanges({storeId:t,taskId:n},r.signal).then(e=>{r.signal.aborted||(e.kind===`ok`?o(e.value):c(e.error.code))}).catch(()=>{r.signal.aborted||c(`Current observation unavailable`)}),()=>r.abort()},[e,t,n,l]),(0,Q.jsxs)(`section`,{"aria-label":r(`Current checkout changes`),children:[(0,Q.jsx)(`h3`,{children:r(`Current checkout changes (not a captured historical diff)`)}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>u(e=>e+1),children:r(`Observe current changes`)}),s&&(0,Q.jsx)(`p`,{role:`alert`,children:i(s)}),a&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{children:(0,Q.jsx)(br,{text:r(`Fingerprint {identity} · {coverage} · includes pre-existing dirt; not attribution.`),slots:{identity:(0,Q.jsx)(`code`,{children:a.observation.identity}),coverage:a.observation.complete?r(`complete within bounded scope`):r(`incomplete coverage`)}})}),(0,Q.jsx)(`pre`,{children:JSON.stringify(a.coverage)}),(0,Q.jsx)(zi,{text:a.text})]})]})}var Ui=[[`plan`,ye],[`checks`,ke],[`changes`,ge],[`review`,te]];function Wi(){let{t:e}=$();return(0,Q.jsx)(`aside`,{className:`panel panel-right`,children:(0,Q.jsx)(`p`,{className:`panel-empty`,children:e(`Select a task to inspect plans, checks, changes and review.`)})})}function Gi({client:e,context:t,seed:n,runs:r,canAct:i,onAction:a,planMetadata:o}){let{t:s,tx:c}=$(),l=t?U(t):`unavailable`,u=(0,f.useMemo)(()=>l===`unavailable`?null:Qe(ze(l)),[l]),[d,p]=(0,f.useState)(`plan`),[m,h]=(0,f.useState)({readablePlan:``,assignments:[]}),[g,_]=(0,f.useState)(),[v,y]=(0,f.useState)(),[b,x]=(0,f.useState)(),[S,C]=(0,f.useState)(),[w,T]=(0,f.useState)(``),[ee,E]=(0,f.useState)(!1),D=u?.task?.id??(n.scope.kind===`task`?n.scope.id:null),te=(0,f.useRef)(new hr);te.current.select(U({context:u,tab:d,draft:m,canAct:i})),(0,f.useEffect)(()=>()=>te.current.depart(),[]),(0,f.useEffect)(()=>{let e=!0;if(y(void 0),_(void 0),!o||!u)x(lr);else return o.read(u).then(t=>{e&&(t.kind===`error`?x(t.error.code):U(t.value.context)===l?(`kind`in t.value?_(t.value):y(t.value),x(void 0)):x(`Owner metadata is stale.`))}).catch(()=>{e&&x(`Owner metadata unavailable.`)}),()=>{e=!1}},[o,u,l]);let ne=(0,f.useCallback)(e=>C(e),[]);if(!D)return(0,Q.jsx)(Wi,{});let re={...n,scope:{kind:`task`,id:D}};return(0,Q.jsxs)(`aside`,{className:`panel panel-right`,children:[(0,Q.jsx)(`nav`,{className:`rp-tabs`,"aria-label":s(`Inspector`),children:Ui.map(([e,t])=>(0,Q.jsxs)(`button`,{type:`button`,className:`rp-tab`,"aria-label":c(e),"aria-pressed":d===e,onClick:()=>p(e),children:[(0,Q.jsx)(t,{"aria-hidden":`true`}),(0,Q.jsx)(`span`,{children:c(e)})]},e))}),(0,Q.jsxs)(`div`,{className:`inspector-body`,children:[d===`plan`&&(0,Q.jsxs)(Q.Fragment,{children:[b&&(0,Q.jsx)(`p`,{className:`inspector-note`,role:`status`,children:c(b)}),g&&(0,Q.jsxs)(`section`,{children:[(0,Q.jsxs)(`p`,{children:[s(`Saved graph proof in progress.`),` `,JSON.stringify(g.coverage)]}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>{if(!o||!u)return;let e=te.current.ticket();o.read(u,g.next).then(t=>{te.current.current(e)&&(t.kind===`error`?x(t.error.code):`kind`in t.value?_(t.value):(_(void 0),y(t.value)))})},children:s(`Continue saved graph read`)})]}),v&&(0,Q.jsx)(`button`,{type:`button`,onClick:()=>h({readablePlan:v.readablePlan,assignments:v.savedGraph?.assignments??[]}),children:s(`Load observed saved plan into local draft`)}),u?(0,Q.jsx)(Mi,{draft:m,onChange:h,context:u,roles:v?.roles??null,canAct:i,canSave:i&&!!v&&v.editable!==!1&&!!o,onGenerate:()=>a({kind:`generate-plan`,taskId:D}),onStart:()=>a({kind:`start`,taskId:D}),onSave:()=>{if(!o)return;let e=te.current.ticket();o.saveAction(u,structuredClone(m)).then(t=>{te.current.current(e)&&(t.kind===`error`?x(t.error.code):a(t.value))}).catch(()=>{te.current.current(e)&&x(`Plan proposal unavailable.`)})}}):(0,Q.jsx)(`p`,{children:s(`Current control context unavailable. Historical data is not action authority.`)})]}),d===`checks`&&(0,Q.jsx)(Vi,{client:e,taskId:D,seed:re,canAct:i,onAction:a,onObligations:ne}),d===`changes`&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Hi,{client:e,storeId:n.storeId,taskId:D}),(0,Q.jsx)(`h3`,{children:s(`Captured historical observations`)}),(0,Q.jsx)(Bi,{client:e,seed:{...re,reader:`changes`}})]}),d===`review`&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`h3`,{children:s(`Human review`)}),(0,Q.jsx)(`p`,{children:s(`Done records human acknowledgment, not execution success or certification. It cannot restart a blocked episode.`)}),(0,Q.jsxs)(`label`,{children:[s(`Episode to review`),(0,Q.jsxs)(`select`,{value:w,onChange:e=>T(e.target.value),children:[(0,Q.jsx)(`option`,{value:``,children:s(`Select an observed episode`)}),r.filter(e=>e.childRunId===null&&e.admission.kind!==`check`).map(e=>(0,Q.jsxs)(`option`,{value:e.runId,children:[e.runId,` · `,c(e.outcome??e.lifecycle)]},e.runId))]})]}),(0,Q.jsxs)(`label`,{children:[(0,Q.jsx)(`input`,{type:`checkbox`,checked:ee,onChange:e=>E(e.target.checked)}),s(`I acknowledge current unresolved issues if present; original results will not be rewritten.`)]}),(0,Q.jsx)(`button`,{type:`button`,disabled:!i||!u||!S||S.taskId!==D||!w,onClick:()=>{u&&S&&a({kind:`review`,taskId:D,runId:w,changesIdentity:u.observation.identity,checksRevision:S.revision,acceptIssues:ee})},children:s(`Preview human review / Done`)}),!S&&(0,Q.jsx)(`p`,{children:s(`Observe current obligations in Checks before requesting review.`)}),(0,Q.jsx)(Bi,{client:e,seed:{...re,reader:`reviews`}})]})]})]})}function Ki(e,t=new Set){let n=new Map(e.map(e=>[e.id,e])),r=new Map,i=[];for(let t of e)if(t.parentId&&n.has(t.parentId)){let e=r.get(t.parentId)??[];e.push(t),r.set(t.parentId,e)}else i.push(t);let a=e=>{let t=[],n=[...r.get(e)??[]],i=new Set;for(;n.length>0;){let e=n.shift();if(!e)break;if(i.has(e.id))continue;i.add(e.id),t.push(e);let a=r.get(e.id);a&&n.push(...a)}return t},o=[],s=new Set,c=new Set,l=(e,n)=>{if(s.has(e.id)||c.has(e.id))return;s.add(e.id);let i=r.get(e.id)??[],u=i.length>0,d=u&&t.has(e.id),f=0,p=!1,m=!1,h=!1;if(u){let t=a(e.id);if(f=t.length,p=t.some(e=>e.active),m=t.some(e=>e.failed),h=t.some(e=>e.unknown),d)for(let e of t)c.add(e.id)}if(o.push({c:e,depth:n,hasKids:u,isCollapsed:d,descendantCount:f,hasActive:p,hasFailure:m,hasUnknown:h}),!d)for(let e of i)l(e,n+1)};for(let e of i)l(e,0);for(let t of e)l(t,0);return o}function qi({title:e,children:t,className:n=``,count:r}){let[i,a]=(0,f.useState)(!0);return(0,Q.jsxs)(`section`,{className:`lp-section ${n}${i?``:` collapsed`}`,children:[(0,Q.jsx)(`header`,{className:`lp-section-header`,children:(0,Q.jsxs)(`button`,{type:`button`,className:`lp-section-heading`,"aria-expanded":i,onClick:()=>a(e=>!e),children:[i?(0,Q.jsx)(De,{"aria-hidden":`true`}):(0,Q.jsx)(O,{"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`lp-section-title`,children:e}),r&&(0,Q.jsx)(`span`,{className:`lp-count`,children:r})]})}),(0,Q.jsx)(`div`,{className:`lp-section-body`,hidden:!i,children:t})]})}function Ji({runs:e,scope:t,snapshot:n,onScope:r}){let{t:i,tx:a}=$(),[o,s]=(0,f.useState)(new Set),c=Ki(e.map(e=>({id:e.childRunId??e.runId,parentId:e.childRunId?e.runId:null,label:e.childRunId?e.assignmentId??i(`Subagent`):a(e.admission.kind),active:e.lifecycle!==`settled`,failed:e.outcome===`failed`,unknown:e.outcome===`unknown`})),o);return(0,Q.jsx)(`nav`,{className:`conversation-tree`,"aria-label":i(`Runs and assignments`),children:c.map(o=>{let c=e.find(e=>(e.childRunId??e.runId)===o.c.id),l=c?.childRunId?`child`:`run`,u=c?.outcome??c?.lifecycle??`unknown`,d=t?.kind===l&&t.id===o.c.id;return(0,Q.jsxs)(`div`,{className:`ep-row`,style:{paddingInlineStart:`${o.depth*14}px`},children:[o.hasKids?(0,Q.jsx)(`button`,{type:`button`,className:`ep-toggle`,"aria-label":i(`Toggle assignments`),"aria-expanded":!o.isCollapsed,onClick:()=>s(e=>{let t=new Set(e);return t.has(o.c.id)?t.delete(o.c.id):t.add(o.c.id),t}),children:o.isCollapsed?(0,Q.jsx)(O,{"aria-hidden":`true`}):(0,Q.jsx)(De,{"aria-hidden":`true`})}):(0,Q.jsx)(`span`,{className:`ep-toggle-spacer`,"aria-hidden":`true`}),(0,Q.jsxs)(`button`,{type:`button`,className:`session-item${d?` active`:``}`,"aria-current":d?`true`:void 0,title:`${o.c.label} · ${o.c.id}`,onClick:()=>r({kind:l,id:o.c.id},n,o.c.label),children:[(0,Q.jsx)(`span`,{className:`session-icon`,children:l===`child`?(0,Q.jsx)(Ce,{"aria-hidden":`true`}):(0,Q.jsx)(le,{"aria-hidden":`true`})}),(0,Q.jsxs)(`span`,{className:`session-info`,children:[(0,Q.jsx)(`span`,{className:`session-title`,children:o.c.label}),l===`child`&&(0,Q.jsx)(`span`,{className:`session-sub`,children:i(`Subagent`)}),o.isCollapsed&&(0,Q.jsx)(`span`,{className:`session-sub session-outcome`,children:`${i(`{count} descendants`,{count:o.descendantCount})}${o.hasFailure?i(` / failed child`):``}${o.hasUnknown?i(` / unknown child`):``}`})]}),(0,Q.jsx)(`span`,{className:`ep-state ${u}`,children:a(u)})]})]},o.c.id)})})}function Yi({pager:e,scope:t,onScope:n,exclude:r}){let{t:i}=$(),a=e.page;return(0,Q.jsxs)(`div`,{className:`retained-conversations`,children:[a&&!(`kind`in a)&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Ji,{runs:a.records.flatMap(e=>e.kind===`run`&&!r.includes(e.projection.runId)?[e.projection]:[]),scope:t,snapshot:a.request.snapshotSeq??void 0,onScope:n}),a.records.length===0&&(0,Q.jsx)(`p`,{className:`panel-hint`,children:i(`No retained conversations on this page.`)})]}),(0,Q.jsx)(si,{pager:e,compact:!0})]})}function Xi({client:e,workspace:t,taskId:n,scope:r,runs:i,snapshot:a,activeRuns:o,cancelCompatible:s,canceling:c,onCancel:l,onTask:u,onScope:d,onNew:f,onProject:p}){let{t:m,tx:h}=$(),g={reader:`tasks`,storeId:t.storeId,scope:{kind:`workspace`,id:t.workspaceId},snapshotSeq:null,after:null,limit:50},_=Qr(e,g),v=Qr(e,n?{...g,reader:`runs`,scope:{kind:`task`,id:n},snapshotSeq:a??t.committedSeq}:null),y=_.page&&!(`kind`in _.page)?_.page.records.flatMap(e=>e.kind===`task`?[e]:[]):[],b=o?.status===`complete`?o.runs:[],x=y.filter(e=>!b.some(t=>t.taskId===e.owner.taskId)),S=n&&(0,Q.jsxs)(`section`,{className:`task-conversations`,"aria-label":m(`Task conversations`),children:[(0,Q.jsx)(`h3`,{children:m(`Task conversations`)}),(0,Q.jsx)(Yi,{pager:v,scope:r,onScope:d,exclude:b.map(e=>e.runId)},n)]}),C=t.rootLabel.split(/[\\/]/).filter(Boolean).at(-1)??t.rootLabel;return(0,Q.jsxs)(`aside`,{className:`panel panel-left lp-panel`,children:[(0,Q.jsx)(`div`,{className:`lp-new`,children:(0,Q.jsxs)(`button`,{type:`button`,className:`new-conversation`,onClick:f,children:[(0,Q.jsx)(ce,{"aria-hidden":`true`}),m(`New task`)]})}),(0,Q.jsxs)(qi,{title:m(`Recent projects`),className:`projects`,children:[(0,Q.jsxs)(`button`,{type:`button`,className:`session-item project-item active`,title:t.rootLabel,onClick:p,children:[(0,Q.jsx)(`span`,{className:`session-icon`,children:(0,Q.jsx)(ve,{"aria-hidden":`true`})}),(0,Q.jsxs)(`span`,{className:`session-info`,children:[(0,Q.jsx)(`span`,{className:`session-title`,children:C}),(0,Q.jsx)(`span`,{className:`session-sub`,children:t.rootLabel})]})]}),(0,Q.jsx)(`p`,{className:`panel-hint`,children:m(`This service exposes one project. Opening it never starts work.`)})]}),(0,Q.jsxs)(qi,{title:m(`Running conversations`),count:o?.status===`complete`?String(b.length):`?`,className:`running-conversations`,children:[o?.status!==`complete`&&(0,Q.jsx)(`p`,{className:`panel-hint`,children:m(`Active roster unavailable; absence is not proof of settlement.`)}),o?.status===`complete`&&b.length===0&&(0,Q.jsx)(`p`,{className:`panel-hint`,children:m(`No active runs`)}),b.map(e=>{let t=y.find(t=>t.owner.taskId===e.taskId)?.goal;return(0,Q.jsxs)(`div`,{className:`conversation-group`,children:[(0,Q.jsxs)(`button`,{type:`button`,className:`session-item${n===e.taskId&&r?.kind===`task`?` active`:``}`,onClick:()=>u(e.taskId,t),title:e.runId,children:[(0,Q.jsx)(`span`,{className:`status-dot busy`,"aria-hidden":`true`}),(0,Q.jsxs)(`span`,{className:`session-info`,children:[(0,Q.jsx)(`span`,{className:`session-title`,children:t??m(`Task {id}`,{id:e.taskId.slice(0,8)})}),(0,Q.jsxs)(`span`,{className:`session-sub`,children:[h(e.kind),` · `,h(e.stage)]})]})]}),(0,Q.jsxs)(`button`,{type:`button`,className:`conversation-stop`,disabled:!s||c.has(e.runId),onClick:()=>l(e.runId),children:[(0,Q.jsx)(ie,{"aria-hidden":`true`}),m(`Cancel run — request stop`)]}),n===e.taskId&&(0,Q.jsx)(Ji,{runs:i.filter(t=>t.runId===e.runId),scope:r,onScope:d})]},e.runId)})]}),(0,Q.jsxs)(qi,{title:m(`Conversation history`),count:_.page&&!(`kind`in _.page)?`${x.length}${_.page.next||_.canPrevious?`+`:``}`:`?`,className:`grow`,children:[(0,Q.jsxs)(`nav`,{"aria-label":m(`Tasks`),className:`task-list`,children:[x.map(e=>(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`button`,{type:`button`,className:`session-item${e.owner.taskId===n&&r?.kind===`task`?` active`:``}`,"aria-current":e.owner.taskId===n&&r?.kind===`task`?`true`:void 0,title:e.goal,onClick:()=>u(e.owner.taskId,e.goal),children:[(0,Q.jsx)(`span`,{className:`session-icon`,children:(0,Q.jsx)(le,{"aria-hidden":`true`})}),(0,Q.jsxs)(`span`,{className:`session-info`,children:[(0,Q.jsx)(`span`,{className:`session-title`,children:e.goal}),(0,Q.jsx)(`span`,{className:`session-sub`,children:m(`Task {id}`,{id:e.owner.taskId.slice(0,8)})})]})]}),e.owner.taskId===n&&S]},e.owner.taskId)),_.page&&!(`kind`in _.page)&&x.length===0&&(0,Q.jsx)(`p`,{className:`panel-hint`,children:m(`No retained task on this page.`)}),(0,Q.jsx)(si,{pager:_,compact:!0})]}),!x.some(e=>e.owner.taskId===n)&&S]})]})}function Zi(e,t,n){let r=new URL(window.location.origin+window.location.pathname),i=new URLSearchParams({task:B(e)});if(n&&(i.set(`scope`,JSON.stringify(lt(n.scope))),n.snapshotSeq&&i.set(`snapshot`,H(n.snapshotSeq))),t){let{navigation:e,...n}=t;i.set(`detail`,JSON.stringify(n))}return r.hash=i.toString(),r.href}function Qi(){try{let e=new URLSearchParams(window.location.hash.slice(1)),t=B(e.get(`task`)),n=e.get(`detail`),r=e.get(`scope`),i=e.get(`snapshot`),a=r?lt(ze(r)):void 0,o=i?H(i):void 0;if(a?.kind===`task`&&a.id!==t||o&&!a)return null;if(!n)return{taskId:t,scope:a,snapshotSeq:o};let s=dt(ze(n));return s.navigation?null:{taskId:t,cursor:s,scope:a,snapshotSeq:o}}catch{return null}}function $i(e){let t=e.start.above+e.start.below,n=Math.max(1,e.availablePx)/(e.totalWeight>0?e.totalWeight:1),r=e.minAbovePx/n,i=e.minBelowPx/n;if(r+i>=t){let n=e.minAbovePx+e.minBelowPx||1,r=t*e.minAbovePx/n;return{above:r,below:t-r}}let a=Math.min(t-i,Math.max(r,e.start.above+e.deltaPx/n));return{above:a,below:t-a}}function ea({side:e,width:t,onResize:n}){let{t:r}=$(),i=(0,f.useRef)(void 0);return(0,f.useEffect)(()=>()=>i.current?.(),[]),(0,Q.jsx)(`input`,{type:`range`,min:220,max:600,step:20,value:t,onChange:e=>n(Number(e.target.value)),className:`resize-handle`,tabIndex:0,"aria-orientation":`vertical`,"aria-label":r(e===`left`?`Resize left pane`:`Resize right pane`),"aria-valuemin":220,"aria-valuemax":600,"aria-valuenow":t,onDoubleClick:()=>n(e===`left`?260:360),onPointerDown:r=>{r.preventDefault(),i.current?.();let a=r.clientX,o=window.innerWidth,s=r=>{let i=$i({start:{above:t,below:Math.max(1,o-t)},deltaPx:(r.clientX-a)*(e===`left`?1:-1),availablePx:o,totalWeight:o,minAbovePx:220,minBelowPx:320});n(Math.min(600,i.above))},c=()=>{window.removeEventListener(`pointermove`,s),window.removeEventListener(`pointerup`,c),window.removeEventListener(`pointercancel`,c),i.current=void 0};i.current=c,window.addEventListener(`pointermove`,s),window.addEventListener(`pointerup`,c,{once:!0}),window.addEventListener(`pointercancel`,c,{once:!0})}})}function ta(e,t,n,r){(0,f.useEffect)(()=>{if(!n||!t)return;let i=e.current?.querySelector(`.drawer-${t}`),a=document.activeElement,o=()=>Array.from(i?.querySelectorAll(`button:not(:disabled),input,textarea,select,a[href],[tabindex="0"]`)??[]).filter(e=>e.getClientRects().length>0);(o()[0]??i)?.focus();let s=e=>{if(e.key===`Escape`&&(e.preventDefault(),r()),e.key===`Tab`){let t=o(),n=t[0],r=t[t.length-1];if(!n){e.preventDefault();return}e.shiftKey&&document.activeElement===n?(e.preventDefault(),r.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),n.focus())}};return i?.addEventListener(`keydown`,s),()=>{i?.removeEventListener(`keydown`,s),a instanceof HTMLElement&&a.isConnected&&a.focus()}},[e,t,n,r])}var na=.4,ra=1.05;function ia(e){return Math.min(300,e*.86)}function aa(e,t,n){return n||(t<=144?null:e<=72?`left`:t-e<=72?`right`:null)}function oa(e,t){let n=Math.abs(e),r=Math.abs(t);return n<12&&r<12?`none`:n>r*1.2?`horizontal`:`vertical`}function sa(e,t){return e===`left`?t:-t}function ca(e,t){return Math.max(-e,Math.min(0,-e+t))}function la(e,t,n){let r=n?e+t:t;return Math.max(0,Math.min(1,r/e))}function ua(e){let{wasOpen:t,pull:n,width:r,durationMs:i}=e;return i<=320&&Math.abs(n)>=48?n>0:la(r*ra,n,t)>=na}var da=new Set([`auto`,`scroll`,`overlay`]);function fa(e,t){let n=e instanceof Element?e:null;for(;n;){if(n instanceof HTMLElement&&n.scrollWidth>n.clientWidth+4&&da.has(getComputedStyle(n).overflowX))return!0;if(n===t)break;n=n.parentElement}return!1}function pa(){let e=e=>{e.stopPropagation(),e.preventDefault()};window.addEventListener(`click`,e,{capture:!0,once:!0}),setTimeout(()=>window.removeEventListener(`click`,e,{capture:!0}),400)}function ma(e){let{enabled:t,open:n,onOpenChange:r,container:i}=e,{panelSelector:a,backdropSelector:o}=e;(0,f.useEffect)(()=>{let e=i.current;if(!t||!e)return;let s=null,c=`none`,l=0,u=0,d=0,f=0,p=!1,m=0,h=0,g=null,_=null,v=()=>{g&&(g.classList.remove(`drawer-dragging`),g.style.transform=``),_&&(_.style.opacity=``),s=null,c=`none`,g=null,_=null,f=0,p=!1},y=t=>{if(v(),t.touches.length!==1)return;let r=t.touches[0];if(!r)return;let i=aa(r.clientX,window.innerWidth,n);i&&!fa(t.target,e)&&(s=i,l=r.clientX,u=r.clientY,d=Date.now())},b=t=>{let r=s;if(!r||t.touches.length!==1)return;let i=t.touches[0];if(!i)return;let d=i.clientX-l,v=i.clientY-u;if(c===`none`){let t=oa(d,v);if(t===`none`)return;if(t===`vertical`){s=null;return}c=`horizontal`,p=n===r,m=ia(window.innerWidth),h=m*ra;let i=e.querySelector(a?a(r):`.panel-drawer.drawer-${r}`);if(!i){s=null;return}g=i,_=o===null?null:e.querySelector(o??`.drawer-backdrop`),i.classList.add(`drawer-dragging`)}let y=g;if(!y)return;f=sa(r,d);let b=ca(h,p?h+f:f);y.style.transform=`translateX(${r===`left`?b:-b}px)`,_&&(_.style.opacity=String(la(h,f,p))),t.preventDefault()},x=()=>{let e=s,t=c===`horizontal`&&e!==null&&g!==null,i=f,a=Date.now()-d,o=t?ua({wasOpen:p,pull:i,width:m,durationMs:a}):!1;v(),t&&e&&o!==(n===e)&&(pa(),r(o?e:null))},S=()=>v();return e.addEventListener(`touchstart`,y,{passive:!0}),e.addEventListener(`touchmove`,b,{passive:!1}),e.addEventListener(`touchend`,x),e.addEventListener(`touchcancel`,S),()=>{v(),e.removeEventListener(`touchstart`,y),e.removeEventListener(`touchmove`,b),e.removeEventListener(`touchend`,x),e.removeEventListener(`touchcancel`,S)}},[t,n,r,i,a,o])}function ha(e,t,n,r,i=`en`){let a=(e,t)=>yr(i,e,t),o=t.filter(e=>e.kind===`owner-fact`||e.kind===`capture-fact`),s=o.map((e,t)=>{let n=e.kind===`owner-fact`?e.fact.kind:e.capture.event.kind,r=e.kind===`capture-fact`?e.link.childRunId:null,o=n.startsWith(`tool`)?`tools`:n.startsWith(`message`)?`model`:`input`;return{key:e.recordId,lane:o,group:`${r??`owner`}:${o}`,groupLabel:`${r??a(`Owner`)} · ${yr(i,o)}`,kind:o===`tools`?`tool`:o===`model`?`text`:`system`,title:`#${e.committedSeq} ${n}`,summary:n,source:a(`Committed #{seq}; {who}`,{seq:e.committedSeq,who:r??a(`owner`)}),status:a(`recorded fact`),clock:e.kind===`capture-fact`?a(`Worker-local monotonic observations ({child}): {first}–{last} ms; not aligned to other workers.`,{child:e.link.childRunId,first:e.capture.source.firstObservedMs,last:e.capture.source.lastObservedMs}):a(`Owner observation ({epoch}): {ms} ms; clock origin not established by this reader.`,{epoch:e.link.epoch,ms:e.observedMs}),...e.kind===`owner-fact`&&e.fact.kind===`check-settled`?{dur:e.fact.native.durationMs}:{},t:t*1e3,end:t*1e3}}),c;return{lang:i,onData(e){return c=e,()=>{c=void 0}},readState(){c?.({kind:`state`,conversations:[{id:e,title:a(`{scope} — loaded committed page`,{scope:e}),isStreaming:!1,segCount:s.length}],activeId:e})},readSegments(t){t===e&&c?.({kind:`segs`,convId:t,segs:s,reset:!0})},readSegment(t,n){let r=s.findIndex(e=>e.key===n);t!==e||r<0||c?.({kind:`seg_detail`,convId:t,key:n,seg:s[r],detail:JSON.stringify(o[r],null,2),analysis:{position:a(`Committed sequence {seq}; page ordinal {ordinal}. Timing shown in raw facts only; clocks may not be comparable.`,{seq:o[r].committedSeq,ordinal:r+1})}})},openDetail(t,r){let i=o.find(e=>e.recordId===r);t===e&&i&&n(i)},searchHistory:r}}var ga=`modulepreload`,_a=function(e){return`/`+e},va={},ya=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=_a(t,n),t=s(t),t in va)return;va[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:ga,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})};function ba({client:e,seed:t,onSearch:n}){let{t:r}=$(),i=Qr(e,{...t,reader:`events`}),a=i.page;return(0,Q.jsxs)(`section`,{className:`timeline-view`,children:[(0,Q.jsx)(`p`,{children:r(`Committed order, not wall time. Replay advances visualization only. Raw observations retain clock/sequence provenance; unknown timing is not reconstructed.`)}),(0,Q.jsx)(si,{pager:i}),a&&!(`kind`in a)&&(0,Q.jsx)(xa,{client:e,seed:a.request,records:a.records,onSearch:n},`${a.request.snapshotSeq}:${a.request.after?.recordId??`first`}`)]})}function xa({client:e,seed:t,records:n,onSearch:r}){let{t:i,locale:a}=$(),o=(0,f.useRef)(null),[s,c]=(0,f.useState)(!1),[l,u]=(0,f.useState)(!1),d=(0,f.useRef)(r);return d.current=r,(0,f.useEffect)(()=>{let e=!1,r;return ya(()=>import(`./timeline-client.js`).then(i=>{!e&&o.current&&(r=i.default.mount(o.current,ha(t.scope.id,n,()=>c(!0),()=>d.current(),a)))}),[]).catch(()=>{e||u(!0)}),()=>{e=!0,r?.()}},[n,t.scope.id,a]),(0,Q.jsxs)(Q.Fragment,{children:[l&&(0,Q.jsx)(`p`,{role:`alert`,children:i(`Bundled timeline unavailable; retained events remain accessible, no CDN fallback.`)}),(0,Q.jsx)(`div`,{className:`timeline-mount`,ref:o}),s&&(0,Q.jsx)(ci,{client:e,seed:t})]})}var Sa=[[`tools`,re],[`context`,me],[`timeline`,Te],[`runs`,_e],[`outcomes`,Ae]];function Ca({error:e,observationError:t}){let{t:n,tx:r}=$();return!e&&!t?null:(0,Q.jsxs)(`p`,{className:`banner-notice`,role:`alert`,children:[e&&(0,Q.jsxs)(Q.Fragment,{children:[e,` `]}),t&&(0,Q.jsxs)(Q.Fragment,{children:[n(`{message}.`,{message:r(t)}),` `,t===`stale`?n(`Context changed. Observe again and request a fresh confirmation.`):(0,Q.jsx)(br,{text:n(`Explicit service guidance: {status} / {start}. No service is started by this page.`),slots:{status:(0,Q.jsx)(`code`,{children:`cadence-service status`}),start:(0,Q.jsx)(`code`,{children:`cadence-service start --workspace <path>`})}})]})]})}function wa({api:e,planMetadata:t}){let{t:n,tx:r,locale:i,setLocale:a}=$(),[o]=(0,f.useState)(()=>e??sr()),[s,c]=(0,f.useState)(!1),[l,u]=(0,f.useState)(!1),[d]=(0,f.useState)(Qi),[p,m]=(0,f.useState)(d?.taskId??null),[h,g]=(0,f.useState)(d?d.scope??{kind:`task`,id:d.taskId}:null),_=mr(o,p?{kind:`task`,id:p}:null,!l),v={state:_.observation,transportStatus:_.transportStatus,error:_.error,refresh:_.refresh},y=_.workspace?.storeId,b=(0,f.useMemo)(()=>t??(y?ur(o.client,y):void 0),[t,o,y]),x=v.state?.snapshot.scope.kind===`task`&&v.state.snapshot.scope.id===p?v.state.snapshot.context:void 0,S=x?.status===`available`?x.version:null,C=_.actions&&v.state?.connection===`current`&&v.transportStatus===`current`&&!!S&&S.epoch===_.workspace?.epoch,[w,T]=(0,f.useState)(null),[ee,E]=(0,f.useState)(!1),D=(0,f.useRef)(null),[te,ne]=(0,f.useState)(260),[re,oe]=(0,f.useState)(360),fe=(0,f.useCallback)(()=>T(null),[]);(0,f.useEffect)(()=>{let e=matchMedia(`(max-width: 900px)`),t=()=>E(e.matches);return t(),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]),ma({enabled:ee&&!l,open:w,onOpenChange:T,container:D}),ta(D,w,ee&&!l,fe);let[me,ge]=(0,f.useState)(d?.snapshotSeq),[_e,ye]=(0,f.useState)(``),[be,xe]=(0,f.useState)(``),[we,Te]=(0,f.useState)(!0),Ee=(0,f.useRef)(null),[O,Oe]=(0,f.useState)(`messages`),[ke,Ae]=(0,f.useState)(!1),[je,Me]=(0,f.useState)(!1),[Ne,k]=(0,f.useState)(),[Pe,A]=(0,f.useState)(d?.cursor),[Fe,j]=(0,f.useState)(!1),[M,Ie]=(0,f.useState)(``),[N,P]=(0,f.useState)(`code`),[F,I]=(0,f.useState)(),[L,R]=(0,f.useState)(!1),[z,B]=(0,f.useState)(``),[V,H]=(0,f.useState)([]),[Le,Re]=(0,f.useState)(new Set),ze=(0,f.useRef)(!0),Be=e=>{ze.current&&H(t=>{let n=t.findIndex(t=>t.commandId===e.commandId);return n<0?[...t,e]:t.map((t,r)=>r===n?dr(t,e):t)})},W=(0,f.useRef)(new hr),Ve=U({taskId:p,scope:h,selectedSnapshot:me??null,detached:l,context:S,attachment:_.attachmentVersion,workspaceContext:_.workspace?.context??null,observationError:_.error??null});W.current.select(Ve);let[He,Ue]=(0,f.useState)(Ve);He!==Ve&&(Ue(Ve),R(!1),I(void 0)),(0,f.useEffect)(()=>(ze.current=!0,()=>{ze.current=!1,W.current.depart()}),[]);let We=F?.preflight.preview.action.kind===`create`?_.workspace?.context.status===`available`?_.workspace.context.version:null:S,Ge=async e=>{let t=e.kind===`create`?_.workspace?.context.status===`available`?_.workspace.context.version:null:S;if(!_.actions||!t||L||l){B(n(`Current action context unavailable; observe again.`));return}W.current.depart();let r=W.current.ticket();R(!0),B(``);try{let i=await Un(o.client,t,e);if(!W.current.current(r))return;i.kind===`error`?B(n(`Preflight refused: {code}`,{code:i.error.code})):I(i.value)}catch{W.current.current(r)&&B(n(`Preflight unavailable. No automatic retry.`))}finally{W.current.current(r)&&R(!1)}},Ke=(e,t)=>{ye(t??``),xe(``),ge(void 0),W.current.depart(),I(void 0),R(!1),m(e),g({kind:`task`,id:e}),k(void 0),A(void 0),Oe(`messages`),fe(),history.replaceState(null,``,Zi(e))};(0,f.useEffect)(()=>{let e=()=>{let e=Qi();e&&(W.current.depart(),I(void 0),R(!1),ge(e.snapshotSeq),ye(``),xe(``),m(e.taskId),g(e.scope??{kind:`task`,id:e.taskId}),k(void 0),A(e.cursor),Oe(`messages`),fe())};return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},[fe]);let qe=(e,t,n)=>{ge(t),xe(n??``),W.current.depart(),I(void 0),R(!1),g(e),k(void 0),A(void 0),Oe(`messages`),fe(),p&&history.replaceState(null,``,Zi(p,void 0,{scope:e,snapshotSeq:t}))},Je=me??v.state?.snapshot.committedSeq??_.workspace?.committedSeq,G=_.workspace?.storeId,K=h&&G&&Je?{storeId:G,scope:h,snapshotSeq:Je,reader:`messages`,after:null,limit:50}:null,Ye=h&&G&&Je?{storeId:G,scope:h,snapshotSeq:Je,query:null,recordId:null,recordVersion:null,field:null,offset:0}:null,q=x?v.state?.snapshot.runs??[]:[],Xe=W.current.ticket(),Ze=e=>{Be(e),e.receipt&&W.current.current(Xe)&&(_.refresh(),e.receipt.created?.state===`published`&&Ke(e.receipt.created.taskId))},Qe=e=>{if(Le.has(e)||!_.cancelCompatible||!_.activeRuns)return;let t=crypto.randomUUID(),r=_.activeRuns.epoch;Re(t=>new Set(t).add(e)),Be({commandId:t,error:n(`Stop requested; settlement is not yet confirmed.`)}),o.client.cancel({commandId:t,epoch:r,runId:e}).then(e=>{Ze(e.kind===`ok`?{commandId:t,receipt:e.value}:{commandId:t,error:n(`{code}; cancellation effect {effect}. Observe exact receipt.`,{code:e.error.code,effect:e.error.effect})})}).catch(()=>Be({commandId:t,error:n(`Cancellation effect uncertain. Observe exact receipt.`)})).finally(()=>{ze.current&&Re(t=>{let n=new Set(t);return n.delete(e),n})})};if(l)return(0,Q.jsxs)(`main`,{className:`entry`,children:[(0,Q.jsx)(`span`,{className:`empty-logo`,"aria-hidden":`true`,children:`C`}),(0,Q.jsx)(`h1`,{children:n(`Detached`)}),(0,Q.jsx)(`p`,{children:n(`Accepted service work continues. No Cancel was requested.`)}),V.map(e=>(0,Q.jsxs)(`p`,{children:[n(`Observe command after reconnect:`),` `,(0,Q.jsx)(`code`,{children:e.commandId})]},e.commandId)),(0,Q.jsx)(`button`,{type:`button`,className:`primary`,onClick:()=>u(!1),children:n(`Reconnect as a viewer`)})]});let $e=_.activeRuns,et=$e?.status===`complete`?$e.runs:[],tt=v.state?.connection??(_.workspace?p?`Task snapshot not observed yet`:`No task selected`:`Service unavailable`);return(0,Q.jsxs)(`div`,{className:`app${we?``:` inspector-hidden`}`,children:[(0,Q.jsxs)(`header`,{className:`topbar`,children:[(0,Q.jsx)(`button`,{type:`button`,className:`panel-toggle`,"aria-label":n(`Tasks`),onClick:()=>T(e=>e===`left`?null:`left`),children:(0,Q.jsx)(ue,{"aria-hidden":`true`})}),(0,Q.jsxs)(`div`,{className:`topbar-flow`,children:[(0,Q.jsxs)(`span`,{className:`brand`,children:[(0,Q.jsx)(`span`,{className:`brand-logo`,"aria-hidden":`true`,children:`C`}),(0,Q.jsx)(`h1`,{className:`brand-name`,children:`Cadence`})]}),_.workspace&&(0,Q.jsxs)(`span`,{className:`chip static chip-root`,title:_.workspace.rootLabel,children:[(0,Q.jsx)(ve,{"aria-hidden":`true`}),(0,Q.jsx)(`span`,{children:_.workspace.rootLabel})]}),(0,Q.jsx)(`span`,{className:`tb-spacer`,"aria-hidden":`true`}),(0,Q.jsxs)(`nav`,{className:`tb-tabs`,"aria-label":n(`Recorded views`),children:[(0,Q.jsxs)(`button`,{type:`button`,className:`tb-tab`,"aria-pressed":O===`messages`&&!Pe,onClick:()=>{A(void 0),k(void 0),Oe(`messages`)},children:[(0,Q.jsx)(le,{"aria-hidden":`true`}),n(`Conversation`)]}),(0,Q.jsxs)(`details`,{className:`view-menu`,ref:Ee,onKeyDown:e=>{e.key===`Escape`&&Ee.current&&(Ee.current.open=!1,Ee.current.querySelector(`summary`)?.focus())},onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||(e.currentTarget.open=!1)},children:[(0,Q.jsxs)(`summary`,{className:`chip`,children:[O===`messages`?n(`Details`):r(O),(0,Q.jsx)(De,{"aria-hidden":`true`})]}),(0,Q.jsxs)(`div`,{className:`view-menu-items`,children:[Sa.map(([e,t])=>(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":O===e,onClick:()=>{A(void 0),k(void 0),Oe(e),Ee.current&&(Ee.current.open=!1,Ee.current.querySelector(`summary`)?.focus())},children:[(0,Q.jsx)(t,{"aria-hidden":`true`}),r(e)]},e)),(0,Q.jsxs)(`div`,{className:`view-menu-actions`,children:[(0,Q.jsxs)(`button`,{type:`button`,"aria-label":n(`Export selected scope`),disabled:!K,onClick:()=>{Ee.current&&(Ee.current.open=!1,Ee.current.querySelector(`summary`)?.focus()),Me(!0)},children:[(0,Q.jsx)(Se,{"aria-hidden":`true`}),n(`Export selected scope`)]}),(0,Q.jsxs)(`button`,{type:`button`,"aria-label":n(`Copy token-free link`),disabled:!p,onClick:()=>{p&&Mr(Zi(p,Pe,h?{scope:h,snapshotSeq:me}:void 0)).then(e=>B(e?``:n(`Link copy unavailable.`)))},children:[(0,Q.jsx)(pe,{"aria-hidden":`true`}),n(`Copy token-free link`)]})]})]})]})]}),(0,Q.jsx)(`span`,{className:`tb-spacer`,"aria-hidden":`true`}),(0,Q.jsxs)(`div`,{className:`tb-actions`,children:[(0,Q.jsx)(bi,{disabled:!Ye,onOpen:()=>Ae(!0)}),(0,Q.jsx)(`button`,{type:`button`,className:`chip`,"aria-label":n(`Observe current state`),"data-tip":n(`Observe current state`),onClick:()=>{_.refresh(),v.refresh()},children:(0,Q.jsx)(se,{"aria-hidden":`true`})}),(0,Q.jsxs)(`button`,{type:`button`,className:`chip`,"aria-label":n(`Choose owner model`),"data-tip":n(`Choose owner model`),onClick:()=>c(!0),children:[(0,Q.jsx)(Ce,{"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`chip-label`,children:n(`Model`)})]}),(0,Q.jsxs)(`button`,{type:`button`,className:`chip`,"aria-label":n(`Return — work continues`),"data-tip":n(`Return — accepted work continues`),onClick:()=>{I(void 0),T(null),Ae(!1),Me(!1),W.current.depart(),R(!1),u(!0)},children:[(0,Q.jsx)(de,{"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`chip-label`,children:n(`Return`)})]}),(0,Q.jsxs)(`button`,{type:`button`,className:`chip chip-lang`,lang:i===`zh`?`en`:`zh-CN`,"aria-label":i===`zh`?`Switch to English`:`切换到中文`,"data-tip":i===`zh`?`Switch to English`:`切换到中文`,onClick:()=>a(i===`zh`?`en`:`zh`),children:[(0,Q.jsx)(he,{"aria-hidden":`true`}),(0,Q.jsx)(`span`,{children:i===`zh`?`EN`:`中文`})]})]})]}),(0,Q.jsxs)(`button`,{type:`button`,className:`panel-toggle has-label inspector-toggle`,"aria-label":n(`Plan / review`),"aria-expanded":ee?w===`right`:we,onClick:()=>ee?T(e=>e===`right`?null:`right`):Te(e=>!e),children:[(0,Q.jsx)(ae,{"aria-hidden":`true`}),(0,Q.jsx)(`span`,{children:n(`Plan`)})]})]}),!_.workspace&&et.length>0&&(0,Q.jsx)(`section`,{className:`run-strip`,"aria-label":n(`Execution and cancellation`),children:et.map(e=>(0,Q.jsxs)(`div`,{className:`run-strip-row`,children:[(0,Q.jsx)(`span`,{className:`status-dot busy`,"aria-hidden":`true`}),(0,Q.jsxs)(`span`,{className:`run-strip-label`,children:[r(e.kind),` `,e.runId,` · `,r(e.stage)]}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>Ke(e.taskId),children:n(`Open active task`)}),(0,Q.jsxs)(`button`,{type:`button`,className:`danger`,disabled:!_.cancelCompatible||Le.has(e.runId),onClick:()=>Qe(e.runId),children:[(0,Q.jsx)(ie,{"aria-hidden":`true`}),n(`Cancel run — request stop`)]})]},e.runId))}),(0,Q.jsx)(Ca,{error:z,observationError:_.error}),(0,Q.jsxs)(`div`,{ref:D,className:`layout`,style:{"--left-w":`${te}px`,"--right-w":`${re}px`},children:[(0,Q.jsx)(`button`,{type:`button`,"aria-label":n(`Close drawer`),tabIndex:-1,className:`drawer-backdrop persistent${w?` on`:``}`,onClick:fe}),(0,Q.jsx)(`section`,{className:`panel-drawer drawer-left${w===`left`?` open`:``}`,"aria-label":n(`Task navigation drawer`),tabIndex:-1,inert:ee&&w!==`left`,children:_.workspace&&(0,Q.jsx)(Xi,{client:o.client,workspace:_.workspace,taskId:p,scope:h,runs:q,snapshot:v.state?.snapshot.committedSeq,activeRuns:_.activeRuns,cancelCompatible:!!_.cancelCompatible,canceling:Le,onCancel:Qe,onProject:()=>{W.current.depart(),I(void 0),R(!1),m(null),g(null),ye(``),A(void 0),k(void 0),ge(void 0),fe(),history.replaceState(null,``,location.pathname)},onTask:Ke,onScope:qe,onNew:()=>{fe(),j(!0)}})}),(0,Q.jsx)(ea,{side:`left`,width:te,onResize:ne}),(0,Q.jsxs)(`main`,{className:`main`,inert:ee&&w!==null,children:[h&&(0,Q.jsxs)(`header`,{className:`conversation-header`,children:[(0,Q.jsxs)(`div`,{className:`conversation-heading`,children:[h.kind!==`task`&&p&&(0,Q.jsx)(`button`,{type:`button`,className:`ghost`,onClick:()=>Ke(p,_e),children:n(`Back to task`)}),(0,Q.jsx)(`h2`,{title:_e||h.id,children:h.kind===`task`?_e||n(`Task {id}`,{id:h.id.slice(0,8)}):be||n(`{kind} {id}`,{kind:r(h.kind),id:h.id.slice(0,8)})}),h.kind===`child`&&(0,Q.jsx)(`span`,{className:`conversation-badge`,children:n(`Subagent`)})]}),(0,Q.jsxs)(`details`,{className:`conversation-info`,children:[(0,Q.jsxs)(`summary`,{children:[n(`Recorded conversation`),` ·`,` `,n(`snapshot {seq}`,{seq:Je??``})]}),(0,Q.jsx)(`code`,{children:h.id}),(0,Q.jsx)(`p`,{children:n(`Pages and old outcomes are historical observations, not renewed consent.`)})]})]}),(0,Q.jsxs)(`div`,{className:`workspace-content`,children:[!K&&(0,Q.jsxs)(`section`,{className:`empty-state`,children:[(0,Q.jsx)(`span`,{className:`empty-logo`,"aria-hidden":`true`,children:`C`}),(0,Q.jsx)(`h2`,{children:n(`Open a task or create one explicitly`)}),(0,Q.jsx)(`p`,{children:n(`Plans, children, checks and human review share one service owner. No chat or discovery activates execution.`)}),(0,Q.jsxs)(`button`,{type:`button`,className:`primary`,disabled:!_.workspace,onClick:()=>j(!0),children:[(0,Q.jsx)(ce,{"aria-hidden":`true`}),n(`Create task`)]})]}),K&&Pe?(0,Q.jsxs)(`div`,{className:`tab-body`,children:[Ne&&(Ne.owner.entity.kind===`task`||Ne.owner.entity.kind===`message`||Ne.owner.entity.kind===`tool`)&&(0,Q.jsx)(li,{client:o.client,seed:{storeId:Pe.storeId,scope:Pe.scope,snapshotSeq:Pe.snapshotSeq,kind:Ne.owner.entity.kind,id:Ne.owner.entity.id,version:Ne.owner.entity.version}},`${Ne.owner.entity.id}:${Ne.owner.entity.version}`),(0,Q.jsx)(oi,{client:o.client,cursor:Pe,highlight:Ne?.range},`${Pe.recordId}:${Pe.recordVersion}`)]}):K&&(0,Q.jsxs)(`div`,{className:O===`messages`||O===`tools`?`tab-body transcript-body`:`tab-body`,children:[O===`messages`&&(0,Q.jsx)(ki,{client:o.client,seed:K}),O===`tools`&&(0,Q.jsx)(Ta,{client:o.client,seed:K}),O===`context`&&(0,Q.jsx)(ci,{client:o.client,seed:K}),O===`timeline`&&(0,Q.jsx)(ba,{client:o.client,seed:K,onSearch:()=>Ae(!0)}),O===`runs`&&(0,Q.jsx)(yi,{client:o.client,seed:{...K,scope:{kind:`task`,id:p??K.scope.id}},onScope:qe},p),O===`outcomes`&&(q.length>0?q.map(e=>(0,Q.jsx)(gi,{run:e},e.childRunId??e.runId)):(0,Q.jsx)(`p`,{className:`panel-empty`,children:x&&v.state?n(`No owner run projection in this snapshot.`):n(`No snapshot observed yet; absence is not proof of settlement.`)}))]},`${h?.kind}:${h?.id}:${me??`current`}`)]}),_.workspace&&V.length>0&&(0,Q.jsx)(`div`,{className:`receipt-dock`,children:V.map(e=>(0,Q.jsx)(qr,{client:o.client,value:e,onChange:Be},e.commandId))})]}),(0,Q.jsx)(ea,{side:`right`,width:re,onResize:oe}),(0,Q.jsx)(`section`,{className:`panel-drawer drawer-right${w===`right`?` open`:``}`,"aria-label":n(`Plan and review drawer`),tabIndex:-1,inert:ee&&w!==`right`,children:K?(0,Q.jsx)(Gi,{client:o.client,context:S,seed:{...K,scope:{kind:`task`,id:p??K.scope.id}},runs:q,canAct:C&&!L,onAction:e=>void Ge(e),planMetadata:b},p):(0,Q.jsx)(Wi,{})})]}),(0,Q.jsxs)(`footer`,{className:`statusbar`,children:[(0,Q.jsxs)(`div`,{className:`statusbar-left`,children:[(0,Q.jsxs)(`span`,{className:`status-item`,role:`status`,title:n(`Connection freshness is not execution outcome.`),children:[(0,Q.jsx)(`span`,{className:`status-dot ${v.error||!_.workspace?`error`:v.transportStatus===`current`?v.state?v.state.connection===`current`?`ok`:`busy`:``:`busy`}`,"aria-hidden":`true`}),r(tt),n(` · transport {status}`,{status:r(v.transportStatus)}),v.error?` · ${r(v.error)}`:``]}),(0,Q.jsx)(`span`,{className:`status-item${$e?.status===`complete`?et.length>0?` warn`:``:` faint`}`,children:$e?.status===`complete`?et.length>0?n(et.length===1?`{count} active run`:`{count} active runs`,{count:et.length}):n(`No active runs`):n(`Active roster unavailable; absence is not proof of settlement.`)})]}),(0,Q.jsx)(`div`,{className:`statusbar-right`,children:(0,Q.jsxs)(`div`,{className:`status-item${_.compatible?` faint`:` warn`}`,title:or?.buildId??n(`unbuilt source`),children:[(0,Q.jsxs)(`details`,{className:`build-part`,children:[(0,Q.jsx)(`summary`,{children:n(`Build information`)}),(0,Q.jsx)(br,{text:n(`Local browser build: {build}.`),slots:{build:(0,Q.jsx)(`code`,{children:or?.buildId??n(`unbuilt source`)})}}),` `]}),(0,Q.jsx)(`span`,{children:n(`Shared compatibility: {state}.`,{state:_.compatible?n(`compatible`):n(`unavailable / mismatch — reload built assets; normal actions disabled`)})})]})})]}),s&&(0,Q.jsx)(Kr,{client:o.client,compatible:!!_.compatible&&_.transportStatus===`current`&&!_.error,onClose:()=>c(!1),onChanged:()=>{I(void 0),W.current.depart(),_.refresh(!0)}}),Fe&&(0,Q.jsxs)(Tr,{title:n(`Create task`),onClose:()=>j(!1),children:[(0,Q.jsxs)(`label`,{children:[n(`Kind`),(0,Q.jsxs)(`select`,{"aria-label":n(`Kind`),value:N,onChange:e=>P(e.target.value===`research`?`research`:e.target.value===`diagnosis`?`diagnosis`:`code`),children:[(0,Q.jsx)(`option`,{value:`code`,children:n(`Code`)}),(0,Q.jsx)(`option`,{value:`research`,children:n(`Readonly research`)}),(0,Q.jsx)(`option`,{value:`diagnosis`,children:n(`Readonly diagnosis`)})]})]}),(0,Q.jsxs)(`label`,{children:[n(`Goal`),(0,Q.jsx)(`textarea`,{"aria-label":n(`Goal`),value:M,onChange:e=>Ie(e.target.value),rows:6})]}),(0,Q.jsx)(`footer`,{children:(0,Q.jsx)(`button`,{type:`button`,className:`primary`,disabled:!_.actions||_.workspace?.context.status!==`available`||L||!M.trim(),onClick:()=>{j(!1),Ge({kind:`create`,taskKind:N,goal:M})},children:n(`Preview Create (does not Start)`)})})]}),F&&(0,Q.jsx)(Wr,{prepared:F,client:o.client,current:_.actions&&(C||F.preflight.preview.action.kind===`create`)?We:null,attachmentVersion:_.attachmentVersion,onClose:()=>{W.current.current(Xe)&&(W.current.depart(),I(e=>e===F?void 0:e))},onResult:Ze},F.commandId),ke&&Ye&&(0,Q.jsx)(hi,{client:o.client,seed:Ye,onClose:()=>Ae(!1),onHit:e=>{k(e),A(e.cursor),p&&history.replaceState(null,``,Zi(p,e.cursor,h?{scope:h,snapshotSeq:me}:void 0))}}),je&&Ye&&(0,Q.jsx)(fi,{request:{storeId:Ye.storeId,scope:Ye.scope,snapshotSeq:Ye.snapshotSeq,format:`ndjson`},onClose:()=>Me(!1)})]})}function Ta({client:e,seed:t}){let n=Qr(e,{...t,reader:`tools`}),r=n.page;return(0,Q.jsxs)(`section`,{className:`tools-list`,children:[(0,Q.jsx)(si,{pager:n}),(0,Q.jsx)(`div`,{className:`tools-body`,children:r&&!(`kind`in r)&&r.records.map(t=>t.kind===`tool`?(0,Q.jsx)(ji,{record:t,client:e,seed:r.request},`${t.owner.entity.id}:${t.version}`):null)})]})}function Ea(){let{t:e}=$();return(0,Q.jsxs)(`main`,{className:`entry`,children:[(0,Q.jsx)(`h1`,{children:e(`Presentation unavailable`)}),(0,Q.jsx)(`p`,{children:e(`No execution result is inferred. Reconnect to observe the owner; accepted work continues.`)}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>window.location.reload(),children:e(`Reload observation`)})]})}var Da=class extends f.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}render(){return this.state.failed?(0,Q.jsx)(Ea,{}):this.props.children}},Oa=document.getElementById(`root`);if(!Oa)throw Error(`Application root unavailable`);(0,E.createRoot)(Oa).render((0,Q.jsx)(wr,{children:(0,Q.jsx)(Da,{children:(0,Q.jsx)(wa,{})})}));export{ya as t};
|