@hearsay-tools/squawk 0.18.0-dev.6807 → 0.18.0-dev.6810
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ci-wait/controller.d.ts +4 -4
- package/dist/contract/delegation.d.ts +20 -0
- package/dist/contract/index.js +4 -1
- package/dist/core/agent-runner.d.ts +16 -0
- package/dist/core/agent-runner.js +7 -0
- package/dist/core/agent-runner.js.map +1 -1
- package/dist/core/claude-cli-runner.js +3 -2
- package/dist/core/claude-cli-runner.js.map +1 -1
- package/dist/core/codex-app-server-runner.js +3 -3
- package/dist/core/codex-app-server-runner.js.map +1 -1
- package/dist/core/codex-app-server-transport.d.ts +2 -0
- package/dist/core/codex-app-server-transport.js +1 -1
- package/dist/core/codex-app-server-transport.js.map +1 -1
- package/dist/core/cursor-print-process.d.ts +3 -0
- package/dist/core/cursor-print-process.js +1 -1
- package/dist/core/cursor-print-process.js.map +1 -1
- package/dist/core/cursor-print-runner.js +3 -2
- package/dist/core/cursor-print-runner.js.map +1 -1
- package/dist/core/omp-runner.js +3 -1
- package/dist/core/omp-runner.js.map +1 -1
- package/dist/core/opencode-server-runner.js +3 -3
- package/dist/core/opencode-server-runner.js.map +1 -1
- package/dist/core/pi-runner.js +3 -2
- package/dist/core/pi-runner.js.map +1 -1
- package/dist/core/session-process.d.ts +6 -0
- package/dist/core/session-process.js +53 -2
- package/dist/core/session-process.js.map +1 -1
- package/dist/delegation/family-end.js +2 -4
- package/dist/delegation/family-end.js.map +1 -1
- package/dist/delegation/owned-workspace-release.d.ts +1 -2
- package/dist/delegation/owned-workspace-release.js +2 -2
- package/dist/delegation/owned-workspace-release.js.map +1 -1
- package/dist/delegation/process-liveness.d.ts +8 -58
- package/dist/delegation/process-liveness.js +9 -86
- package/dist/delegation/process-liveness.js.map +1 -1
- package/dist/delegation/routes.d.ts +87 -83
- package/dist/delegation/scratch-cleanup.d.ts +1 -1
- package/dist/delegation/scratch-cleanup.js +7 -10
- package/dist/delegation/scratch-cleanup.js.map +1 -1
- package/dist/delegation/service.js +2 -1
- package/dist/delegation/service.js.map +1 -1
- package/dist/delegation/transport.d.ts +20 -16
- package/dist/delegation/worker-cleanup.d.ts +2 -9
- package/dist/delegation/worker-cleanup.js +44 -86
- package/dist/delegation/worker-cleanup.js.map +1 -1
- package/dist/delegation/workspace-removal.d.ts +4 -12
- package/dist/delegation/workspace-removal.js +18 -51
- package/dist/delegation/workspace-removal.js.map +1 -1
- package/dist/git-worktree.js +2 -6
- package/dist/git-worktree.js.map +1 -1
- package/dist/preview/dev-server.d.ts +3 -0
- package/dist/preview/dev-server.js +40 -1
- package/dist/preview/dev-server.js.map +1 -1
- package/dist/preview/host.d.ts +3 -1
- package/dist/preview/host.js +2 -1
- package/dist/preview/host.js.map +1 -1
- package/dist/runs/private-record-file.d.ts +7 -0
- package/dist/runs/private-record-file.js +55 -0
- package/dist/runs/private-record-file.js.map +1 -0
- package/dist/runs/store.d.ts +18 -6
- package/dist/runs/store.js +43 -99
- package/dist/runs/store.js.map +1 -1
- package/dist/runs/worker-execution.d.ts +1 -0
- package/dist/runs/worker-execution.js +4 -1
- package/dist/runs/worker-execution.js.map +1 -1
- package/dist/runs/worker-resource-holders.d.ts +10 -7
- package/dist/runs/worker-resource-holders.js +9 -25
- package/dist/runs/worker-resource-holders.js.map +1 -1
- package/dist/server/server.d.ts +8 -0
- package/dist/server/workspace-live-routes.d.ts +6 -6
- package/dist/worker-scope/cgroup.d.ts +41 -0
- package/dist/worker-scope/cgroup.js +173 -0
- package/dist/worker-scope/cgroup.js.map +1 -0
- package/dist/worker-scope/groups.d.ts +24 -0
- package/dist/worker-scope/groups.js +60 -0
- package/dist/worker-scope/groups.js.map +1 -0
- package/dist/worker-scope/scope.d.ts +32 -0
- package/dist/worker-scope/scope.js +18 -0
- package/dist/worker-scope/scope.js.map +1 -0
- package/dist/worker-scope/worker-scopes.d.ts +63 -0
- package/dist/worker-scope/worker-scopes.js +181 -0
- package/dist/worker-scope/worker-scopes.js.map +1 -0
- package/dist/workflows/grouped-command.d.ts +3 -0
- package/dist/workflows/grouped-command.js +28 -2
- package/dist/workflows/grouped-command.js.map +1 -1
- package/dist/workflows/run/compose.d.ts +0 -2
- package/dist/workflows/run/compose.js.map +1 -1
- package/dist/workflows/run/continuation-session.js +1 -0
- package/dist/workflows/run/continuation-session.js.map +1 -1
- package/dist/workflows/run/step-loop.d.ts +1 -1
- package/dist/workflows/run/step-loop.js +4 -2
- package/dist/workflows/run/step-loop.js.map +1 -1
- package/dist/workflows/run/step-session.js +1 -0
- package/dist/workflows/run/step-session.js.map +1 -1
- package/dist/workflows/run/worker-executions.d.ts +2 -1
- package/dist/workflows/run/worker-executions.js +8 -4
- package/dist/workflows/run/worker-executions.js.map +1 -1
- package/dist/workflows/run/worker-orphans.d.ts +16 -31
- package/dist/workflows/run/worker-orphans.js +71 -123
- package/dist/workflows/run/worker-orphans.js.map +1 -1
- package/dist/workflows/run.d.ts +0 -2
- package/dist/workflows/run.js +1 -4
- package/dist/workflows/run.js.map +1 -1
- package/dist/worktree-setup.d.ts +3 -0
- package/dist/worktree-setup.js +2 -1
- package/dist/worktree-setup.js.map +1 -1
- package/package.json +4 -4
- package/web/dist/assets/{activity-motion-ankV4z_y.js → activity-motion-AuQA350-.js} +1 -1
- package/web/dist/assets/{activity-route-C7Lo4d_1.js → activity-route-BNZ9bOOZ.js} +1 -1
- package/web/dist/assets/{agent-accounts-BAUPVmTO.js → agent-accounts-D2uZHuiM.js} +1 -1
- package/web/dist/assets/attention-B7icDSLh.js +1 -0
- package/web/dist/assets/{cez-idle-TVRD1sce.js → cez-idle-MToU9Wv_.js} +1 -1
- package/web/dist/assets/{commit-diff-panel-Cmqi-EvU.js → commit-diff-panel-DBW7us79.js} +1 -1
- package/web/dist/assets/{diff-BawymO3F.js → diff-C3Cms5Ep.js} +2 -2
- package/web/dist/assets/{diff-view-DHx_pu8b.js → diff-view-D5zTYOKV.js} +1 -1
- package/web/dist/assets/{file-preview-DV7f2pOk.js → file-preview-FhzIdXZ3.js} +1 -1
- package/web/dist/assets/{git-toolbar-BrVfyYBr.js → git-toolbar-MFjkjDDG.js} +1 -1
- package/web/dist/assets/{github-DVXWmfeu.js → github-CYmdc5Dh.js} +1 -1
- package/web/dist/assets/{global-activity-route-ybR1xgLf.js → global-activity-route-C41ofuHV.js} +1 -1
- package/web/dist/assets/{index-Dc_KmL4Z.js → index-e1OpsDKN.js} +4 -4
- package/web/dist/assets/{live-protocol-aMLJJ0MQ.js → live-protocol-B8boP96Z.js} +1 -1
- package/web/dist/assets/{preview-pane-connected-CT7tXifI.js → preview-pane-connected-Ds209_UZ.js} +1 -1
- package/web/dist/assets/{project-router-CbWELZZ9.js → project-router-F1inY-EB.js} +1 -1
- package/web/dist/assets/{project-scope-context-p1OpXpSJ.js → project-scope-context-0Z0nsheq.js} +1 -1
- package/web/dist/assets/{prompt-template-menu-Ct3m86h1.js → prompt-template-menu-uUjg9v98.js} +1 -1
- package/web/dist/assets/{queries-BAUtqJph.js → queries-7W9tOZsg.js} +1 -1
- package/web/dist/assets/{reference-chip-B2B-Ky7w.js → reference-chip-BqRpnpaI.js} +1 -1
- package/web/dist/assets/{repo-git-DRONt4_i.js → repo-git-BZcRanYE.js} +1 -1
- package/web/dist/assets/{report-reader-BF8rmJRD.js → report-reader-BLlV3dPF.js} +1 -1
- package/web/dist/assets/{reports-Bv91XlcP.js → reports-C--EXqf1.js} +1 -1
- package/web/dist/assets/{run-header-CvJ84kr2.js → run-header-CJg8dyfz.js} +1 -1
- package/web/dist/assets/{skills-Ceg2Y9LM.js → skills-CHWVejdV.js} +1 -1
- package/web/dist/assets/{tab-link-CT5gqdai.js → tab-link-XI9xWLwR.js} +1 -1
- package/web/dist/assets/{task-changes-BplRsiSs.js → task-changes-DFm_EHnj.js} +1 -1
- package/web/dist/assets/{task-commits-CYLy-lg-.js → task-commits-BX-GVdXG.js} +1 -1
- package/web/dist/assets/{task-files-COYxL8mg.js → task-files-Dsn11PYu.js} +1 -1
- package/web/dist/assets/{task-github-item-DAD__wEa.js → task-github-item-3N6jEijR.js} +1 -1
- package/web/dist/assets/{task-thread-CTEobEyX.js → task-thread-VNPhkI8i.js} +1 -1
- package/web/dist/assets/{thread-state-CpdUCQVd.js → thread-state-D1XLo7ab.js} +1 -1
- package/web/dist/assets/{use-desktop-Bok38AjX.js → use-desktop-DdcA0Atl.js} +1 -1
- package/web/dist/assets/{use-hand-to-agent-state-DiBEjj2Y.js → use-hand-to-agent-state-2tzEmCDo.js} +1 -1
- package/web/dist/assets/{useInfiniteQuery-DD7iZHIJ.js → useInfiniteQuery-BmmIZbVY.js} +1 -1
- package/web/dist/assets/useQuery-CBKC2lBX.js +1 -0
- package/web/dist/assets/{workflows-Cq6Fg1ZT.js → workflows-CqqdPBFr.js} +1 -1
- package/web/dist/assets/{ws-CqtLOaJ8.js → ws-BvDSfSVH.js} +1 -1
- package/web/dist/index.html +14 -14
- package/web/dist/live-worker.js +1 -1
- package/dist/delegation/destroy-observation.d.ts +0 -44
- package/dist/delegation/destroy-observation.js +0 -116
- package/dist/delegation/destroy-observation.js.map +0 -1
- package/web/dist/assets/attention-C6XIgMqB.js +0 -1
- package/web/dist/assets/useQuery-DVAeyc_X.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Nr as e,Wr as t}from"./project-scope-context-0Z0nsheq.js";function n(n,r){return e(n,t,r)}export{n as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{E as t,t as n,u as r}from"./button-DGwhwRuD.js";import{i,t as a}from"./react-runtime-CCIEwYL0.js";import{A as o,Kt as s,T as c,Ur as l,Yt as u,i as d}from"./project-scope-context-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{E as t,t as n,u as r}from"./button-DGwhwRuD.js";import{i,t as a}from"./react-runtime-CCIEwYL0.js";import{A as o,Kt as s,T as c,Ur as l,Yt as u,i as d}from"./project-scope-context-0Z0nsheq.js";import{At as f,Lt as p,Nt as ee,n as te,nn as m}from"./queries-7W9tOZsg.js";import{n as h}from"./toaster-CoMJoQvk.js";import{C as g,Q as _,S as ne,X as v,a as re,ct as ie,dt as y,l as ae,lt as b,mt as x,n as oe,rt as se,st as S,u as ce,x as C,y as w}from"./design-icons-DmYTv2r1.js";import{i as T,p as le,r as E,t as D}from"./dropdown-menu-DPrTX-zi.js";import{a as O,c as k,i as A,n as j,o as M,r as ue,s as N,t as P}from"./alert-dialog-CH4SXGfX.js";import{i as F,o as de,r as I,s as L,t as R}from"./dialog-B7p5oc5r.js";import{_ as fe,a as z,d as pe,g as me,h as B,i as V,l as he,m as ge,o as _e,p as ve,r as ye,s as be,t as H,v as U}from"./sortable.esm-zp_qkYGV.js";import{i as W,l as xe,s as Se}from"./skills-DFBiAuJG.js";import{t as Ce}from"./centered-state-B5QmAy2y.js";import{$ as G,O as we,Zt as K}from"./index-e1OpsDKN.js";import{n as Te}from"./skill-empty-hint-YDmkqgo-.js";var q=e(i(),1);function J(e){let t=[];for(let n of e){if(n.command||!n.skill||n.prompt!==void 0&&n.prompt!==`{{task}}`||n.name!==void 0&&n.name!==n.skill||n.timeoutMs!==void 0||n.model||n.effort!==void 0||n.runner||n.agentProfile||n.allowedTools||n.bashAllowlist||n.onFail)return null;t.push(n.skill)}return t.length?t:null}function Ee(e,t){let n=new Set(t.map(e=>e.id)),r=e;for(let t=2;n.has(r);t++)r=`${e}-${t}`;return{id:r,name:e,skill:e,prompt:`{{task}}`}}function De(e,t,n){let r=[...e];return r.splice(Math.max(0,Math.min(n,r.length)),0,t),r}function Oe(e,t,n){if(t===n||t<0||t>=e.length||n<0||n>=e.length)return[...e];let r=[...e],[i]=r.splice(t,1);return i===void 0?[...e]:(r.splice(n,0,i),r)}function ke(e,t){return e.filter((e,n)=>n!==t)}function Y(e){let t=String(e),n=/^[A-Za-z0-9._][A-Za-z0-9 ._/-]*$/.test(t)&&!t.endsWith(` `),r=/^(true|false|yes|no|on|off|null|~)$/i.test(t)||/^[-+.]?\d/.test(t);return n&&!r?t:JSON.stringify(t)}function X(e,t,n){let r=` `.repeat(n);return t.includes(`
|
|
2
2
|
`)?[`${r}${e}: |`,...t.split(`
|
|
3
3
|
`).map(e=>`${r} ${e}`)]:[`${r}${e}: ${Y(t)}`]}function Ae(e){let t=[];return e.name&&e.name!==e.id&&t.push(` name: ${Y(e.name)}`),e.skill&&t.push(` skill: ${Y(e.skill)}`),t}function Z(e){let t=[];return e.model&&t.push(` model: ${Y(e.model)}`),e.timeoutMs!==void 0&&t.push(` timeoutMs: ${e.timeoutMs}`),e.effort!==void 0&&t.push(` effort: ${Y(e.effort)}`),e.runner&&t.push(` runner: ${Y(e.runner)}`),e.agentProfile&&t.push(` agentProfile: ${Y(e.agentProfile)}`),t}function je(e){let t=[];return e.allowedTools&&t.push(` allowedTools: [${e.allowedTools.map(Y).join(`, `)}]`),e.bashAllowlist&&t.push(` bashAllowlist: [${e.bashAllowlist.map(Y).join(`, `)}]`),t}function Me(e){return e.onFail?[` onFail:`,` retry: ${Y(e.onFail.retry)}`,` max: ${e.onFail.max??2}`]:[]}function Ne(e){return[` - id: ${Y(e.id)}`,...Ae(e),...e.prompt?X(`prompt`,e.prompt,4):[],...Z(e),...je(e),...e.command?X(`command`,e.command,4):[],...Me(e)]}function Pe(e,t,n){let r=[`name: ${Y(e.trim()||`my-workflow`)}`];t.trim()&&r.push(...X(`description`,t.trim(),0));let i=J(n);if(i){r.push(`skills:`);for(let e of i)r.push(` - ${Y(e)}`)}else if(n.length){r.push(`steps:`);for(let e of n)r.push(...Ne(e))}else r.push(`skills: []`);return`${r.join(`
|
|
4
4
|
`)}\n`}function Fe(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)||`workflow`}function Ie(e){let t=J(e)?`skill`:`step`;return`${e.length} ${t}${e.length===1?``:`s`}`}function Le(e,t){let n=new Set,r=[];for(let t of e.steps.slice(0,8)){let e=t.id||`step`,i=e;for(let t=2;n.has(i);t++)i=`${e}-${t}`;n.add(i),r.push({...t,id:i})}return{name:e.name?.trim()||t,steps:r}}function Re(e,t,n){let r=J(n);return{name:e.trim(),...t.trim()?{description:t.trim()}:{},...r?{skills:r}:{steps:[...n]}}}var Q=a();function ze({workflows:e,draft:t,trimmedName:n,nameRef:r,onDraft:i,onLoadWorkflow:a}){return(0,Q.jsxs)(`section`,{"data-slot":`wb-metadata`,className:`flex min-w-0 flex-col gap-3`,children:[(0,Q.jsxs)(`div`,{"data-slot":`wb-load`,className:`flex flex-col items-start gap-2`,children:[(0,Q.jsx)(`label`,{htmlFor:`workflow-load`,className:`text-xs text-muted-foreground`,children:`Load an existing workflow`}),(0,Q.jsxs)(`div`,{className:`relative max-w-full`,children:[(0,Q.jsx)(ce,{"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,Q.jsxs)(`select`,{id:`workflow-load`,value:e.some(e=>e.name===n)?n:``,onChange:t=>{let n=e.find(e=>e.name===t.target.value);n&&a(n)},className:`h-11 max-w-full rounded-lg border border-border bg-card pl-9 pr-3 text-xs font-medium appearance-none focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,Q.jsx)(`option`,{value:``,disabled:!0,children:`Choose a workflow`}),e.map(e=>(0,Q.jsx)(`option`,{value:e.name,"data-slot":`wb-load-option`,"data-name":e.name,children:e.name},e.name))]})]})]}),(0,Q.jsx)(`label`,{htmlFor:`workflow-name`,className:`text-xs font-semibold`,children:`Workflow name`}),(0,Q.jsx)(K,{id:`workflow-name`,ref:r,"data-slot":`wb-name`,"aria-label":`Workflow name`,spellCheck:!1,value:t.name,onChange:e=>i({...t,name:e.target.value}),className:`h-12 bg-card text-sm`}),(0,Q.jsx)(`label`,{htmlFor:`workflow-description`,className:`text-xs font-semibold`,children:`Description`}),(0,Q.jsx)(G,{id:`workflow-description`,"data-slot":`wb-description`,"aria-label":`Description`,value:t.description,onChange:e=>i({...t,description:e.target.value}),className:`min-h-[72px] bg-card p-3.5 text-sm`})]})}function Be({savedFile:e,autoOpen:t,onImportToggle:r,onExport:i,onAutoToggle:a,onDeleteRequest:o}){return(0,Q.jsxs)(`div`,{"data-slot":`wb-actions`,className:`grid grid-cols-[max-content_max-content] items-center justify-start gap-2 sm:flex sm:flex-wrap [&_button]:min-h-11 [&_button]:border [&_button]:border-border [&_button]:bg-card`,children:[(0,Q.jsxs)(n,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-import`,className:`col-span-2 justify-self-start`,onClick:r,children:[(0,Q.jsx)(b,{"aria-hidden":`true`,className:`size-3`}),`Import`]}),(0,Q.jsxs)(n,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-export`,className:`col-span-2 justify-self-start`,title:`Download workflow.yaml`,onClick:i,children:[(0,Q.jsx)(C,{"aria-hidden":`true`,className:`size-3`}),`Export`]}),(0,Q.jsxs)(n,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-auto`,"aria-expanded":t,title:`Describe a chain — the agent builds it`,onClick:a,children:[(0,Q.jsx)(y,{"aria-hidden":`true`,className:`size-3`}),`Auto`]}),e?(0,Q.jsxs)(n,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-delete`,className:`text-danger hover:text-danger`,title:`Delete the saved workflow file`,onClick:o,children:[(0,Q.jsx)(S,{"aria-hidden":`true`,className:`size-3`}),`Delete`]}):null]})}function Ve({text:e,onTextChange:t,pending:r,onRun:i,onCancel:a}){return(0,Q.jsxs)(`div`,{"data-slot":`wb-auto-panel`,className:`rounded-xl border border-border bg-card p-5 [&_button]:min-h-11`,children:[(0,Q.jsx)(`h2`,{className:`text-lg font-normal`,children:`Build a chain from a prompt`}),(0,Q.jsx)(`p`,{className:`mt-4 text-[13px] leading-relaxed text-muted-foreground`,children:`Describe the outcome. An agent proposes a title and ordered skill/check steps. Review the result, edit it, then Save.`}),(0,Q.jsx)(G,{"data-slot":`wb-auto-text`,"aria-label":`Describe the chain to build`,rows:3,autoFocus:!0,placeholder:`e.g. Fix the bug, run the tests, then review the diff for regressions.`,value:e,onChange:e=>t(e.target.value),onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),i())},className:`mt-4 min-h-[108px] bg-background p-4 text-sm`}),(0,Q.jsxs)(`div`,{className:`mt-3 flex items-center gap-1.5`,children:[(0,Q.jsxs)(n,{type:`button`,variant:`primary`,size:`sm`,"data-slot":`wb-auto-run`,disabled:r||e.trim()===``,onClick:i,children:[(0,Q.jsx)(y,{"aria-hidden":`true`,className:`size-3`}),r?`Building…`:`Build chain`]}),(0,Q.jsxs)(n,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-auto-cancel`,onClick:a,children:[(0,Q.jsx)(x,{"aria-hidden":`true`,className:`size-4`}),`Cancel`]})]}),(0,Q.jsx)(`p`,{className:`mt-4 text-xs text-muted-foreground`,children:`Creates an editable draft. Review the generated name and steps before saving.`})]})}function He({open:e,onOpenChange:t,text:r,onTextChange:i,error:a,pending:o,onRun:s,onCancel:c}){return(0,Q.jsx)(R,{open:e,onOpenChange:t,children:(0,Q.jsxs)(I,{showCloseButton:!1,"data-slot":`wb-import-panel`,className:`max-md:translate-x-0 max-md:translate-y-0 sm:max-w-[660px] rounded-xl border border-border bg-card p-5 [&_button]:min-h-11`,children:[(0,Q.jsx)(L,{className:`text-xl font-normal`,children:`Import workflow YAML`}),(0,Q.jsx)(F,{className:`sr-only`,children:`Paste a portable workflow definition to import.`}),(0,Q.jsx)(G,{"data-slot":`wb-import-text`,"aria-label":`Workflow YAML to import`,rows:4,spellCheck:!1,placeholder:`name: my-flow
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t}from"./react-runtime-CCIEwYL0.js";import{Dr as n,Ur as r}from"./project-scope-context-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t}from"./react-runtime-CCIEwYL0.js";import{Dr as n,Ur as r}from"./project-scope-context-0Z0nsheq.js";import{i}from"./live-protocol-B8boP96Z.js";var a=e(t(),1);function o(e,t){if(!i(e.path))throw Error(`unsupported shared read`);let r=new URL(e.path,`http://cezar.invalid`);return r.searchParams.sort(),n({kind:`read`,path:`${r.pathname}${r.search}`,intervalMs:e.intervalMs},{value:t})}function s(e,t,n,i){let s=r(),c=JSON.stringify(t),l=(0,a.useMemo)(()=>JSON.parse(c),[c]);(0,a.useEffect)(()=>{if(!e||n===!1)return;let t=!0,r=o({path:e,intervalMs:n},(e,n)=>{n||s.cancelQueries({queryKey:l,exact:!0}).then(()=>{t&&s.setQueryData(l,i?i(e,s):e)})});return()=>{t=!1,r()}},[s,e,l,n,i])}function c(e,t){return n({kind:`topic`,topic:e},{value:t})}export{o as n,s as r,c as t};
|
package/web/dist/index.html
CHANGED
|
@@ -47,38 +47,38 @@
|
|
|
47
47
|
}
|
|
48
48
|
})()
|
|
49
49
|
</script>
|
|
50
|
-
<script type="module" crossorigin src="/assets/index-
|
|
50
|
+
<script type="module" crossorigin src="/assets/index-e1OpsDKN.js"></script>
|
|
51
51
|
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-QTnfLwEv.js">
|
|
52
52
|
<link rel="modulepreload" crossorigin href="/assets/react-runtime-CCIEwYL0.js">
|
|
53
53
|
<link rel="modulepreload" crossorigin href="/assets/bundle-mjs-BT31bpU6.js">
|
|
54
54
|
<link rel="modulepreload" crossorigin href="/assets/button-DGwhwRuD.js">
|
|
55
55
|
<link rel="modulepreload" crossorigin href="/assets/live-refetch-CZb2VOyu.js">
|
|
56
|
-
<link rel="modulepreload" crossorigin href="/assets/live-protocol-
|
|
57
|
-
<link rel="modulepreload" crossorigin href="/assets/project-scope-context-
|
|
58
|
-
<link rel="modulepreload" crossorigin href="/assets/useInfiniteQuery-
|
|
59
|
-
<link rel="modulepreload" crossorigin href="/assets/useQuery-
|
|
60
|
-
<link rel="modulepreload" crossorigin href="/assets/ws-
|
|
56
|
+
<link rel="modulepreload" crossorigin href="/assets/live-protocol-B8boP96Z.js">
|
|
57
|
+
<link rel="modulepreload" crossorigin href="/assets/project-scope-context-0Z0nsheq.js">
|
|
58
|
+
<link rel="modulepreload" crossorigin href="/assets/useInfiniteQuery-BmmIZbVY.js">
|
|
59
|
+
<link rel="modulepreload" crossorigin href="/assets/useQuery-CBKC2lBX.js">
|
|
60
|
+
<link rel="modulepreload" crossorigin href="/assets/ws-BvDSfSVH.js">
|
|
61
61
|
<link rel="modulepreload" crossorigin href="/assets/toaster-CoMJoQvk.js">
|
|
62
|
-
<link rel="modulepreload" crossorigin href="/assets/queries-
|
|
63
|
-
<link rel="modulepreload" crossorigin href="/assets/cez-idle-
|
|
62
|
+
<link rel="modulepreload" crossorigin href="/assets/queries-7W9tOZsg.js">
|
|
63
|
+
<link rel="modulepreload" crossorigin href="/assets/cez-idle-MToU9Wv_.js">
|
|
64
64
|
<link rel="modulepreload" crossorigin href="/assets/createLucideIcon-BHp8sXmF.js">
|
|
65
65
|
<link rel="modulepreload" crossorigin href="/assets/es2015-DTn4s5Lh.js">
|
|
66
66
|
<link rel="modulepreload" crossorigin href="/assets/design-icons-DmYTv2r1.js">
|
|
67
67
|
<link rel="modulepreload" crossorigin href="/assets/dist-ClnpAEgV.js">
|
|
68
68
|
<link rel="modulepreload" crossorigin href="/assets/dropdown-menu-DPrTX-zi.js">
|
|
69
|
-
<link rel="modulepreload" crossorigin href="/assets/attention-
|
|
70
|
-
<link rel="modulepreload" crossorigin href="/assets/use-desktop-
|
|
69
|
+
<link rel="modulepreload" crossorigin href="/assets/attention-B7icDSLh.js">
|
|
70
|
+
<link rel="modulepreload" crossorigin href="/assets/use-desktop-DdcA0Atl.js">
|
|
71
71
|
<link rel="modulepreload" crossorigin href="/assets/nav-row-styles-DSBuSnEE.js">
|
|
72
72
|
<link rel="modulepreload" crossorigin href="/assets/eye-B8okNWXU.js">
|
|
73
73
|
<link rel="modulepreload" crossorigin href="/assets/format-BNCkW110.js">
|
|
74
74
|
<link rel="modulepreload" crossorigin href="/assets/play-CmVAj_fu.js">
|
|
75
|
-
<link rel="modulepreload" crossorigin href="/assets/reference-chip-
|
|
75
|
+
<link rel="modulepreload" crossorigin href="/assets/reference-chip-BqRpnpaI.js">
|
|
76
76
|
<link rel="modulepreload" crossorigin href="/assets/alert-dialog-CH4SXGfX.js">
|
|
77
77
|
<link rel="modulepreload" crossorigin href="/assets/dialog-B7p5oc5r.js">
|
|
78
|
-
<link rel="modulepreload" crossorigin href="/assets/project-router-
|
|
79
|
-
<link rel="modulepreload" crossorigin href="/assets/agent-accounts-
|
|
78
|
+
<link rel="modulepreload" crossorigin href="/assets/project-router-F1inY-EB.js">
|
|
79
|
+
<link rel="modulepreload" crossorigin href="/assets/agent-accounts-D2uZHuiM.js">
|
|
80
80
|
<link rel="modulepreload" crossorigin href="/assets/skills-DFBiAuJG.js">
|
|
81
|
-
<link rel="modulepreload" crossorigin href="/assets/prompt-template-menu-
|
|
81
|
+
<link rel="modulepreload" crossorigin href="/assets/prompt-template-menu-uUjg9v98.js">
|
|
82
82
|
<link rel="modulepreload" crossorigin href="/assets/sortable.esm-zp_qkYGV.js">
|
|
83
83
|
<link rel="modulepreload" crossorigin href="/assets/centered-state-B5QmAy2y.js">
|
|
84
84
|
<link rel="modulepreload" crossorigin href="/assets/lib-BxQXEXDF.js">
|
package/web/dist/live-worker.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as e,o as t,u as n}from"./assets/live-protocol-
|
|
1
|
+
import{c as e,o as t,u as n}from"./assets/live-protocol-B8boP96Z.js";import{n as r}from"./assets/cez-idle-MToU9Wv_.js";var i=new Set;function a(e,t){t?i.add(e):i.delete(e),r(`ws`,i.size>0)}var o=`/api/v1/ws`,s=3e3,c=1e3,l=7e4,u=0,d=1;function f(e){let t=new Map,n=new Set,r={},i=!1,f=null,p,m,h,g=()=>{a(r,i||n.size>0)},_=()=>{clearTimeout(h),h=setTimeout(()=>{h=void 0,f?.close()},l)},v=()=>e??`${location.protocol===`https:`?`wss:`:`ws:`}//${location.host}${o}`,y=e=>{f?.readyState===d&&f.send(JSON.stringify(e))},b=()=>{let e=globalThis.WebSocket;if(typeof e!=`function`||f&&(f.readyState===u||f.readyState===d))return;let r=new e(v());f=r,i=!0,g(),r.addEventListener(`open`,()=>{if(r===f){i=!1;for(let e of t.keys())n.add(e);g(),_();for(let e of t.keys())y({type:`subscribe`,topic:e})}}),r.addEventListener(`message`,e=>{if(r!==f)return;_();let i;try{i=JSON.parse(e.data)}catch{return}if(typeof i!=`object`||!i)return;let{type:a,topic:o,data:s}=i;if(a!==`event`||typeof o!=`string`)return;let c=t.get(o);if(c){n.delete(o),g();for(let e of[...c])e(s)}}),r.addEventListener(`close`,()=>{r===f&&(f=null,i=!1,g(),clearTimeout(h),h=void 0,t.size>0&&p===void 0&&(p=setTimeout(()=>{p=void 0,t.size>0&&b()},s)))}),r.addEventListener(`error`,()=>void 0)};return{subscribe(e,r){let i=t.get(e);i||(i=new Set,t.set(e,i));let a=i.size===0;i.add(r),a&&n.add(e),g(),clearTimeout(m),m=void 0,f?a&&y({type:`subscribe`,topic:e}):(clearTimeout(p),p=void 0,b());let o=!0;return()=>{o&&(o=!1,i.delete(r),!(i.size>0)&&(t.delete(e),n.delete(e),g(),y({type:`unsubscribe`,topic:e}),t.size===0&&m===void 0&&(m=setTimeout(()=>{m=void 0,!(t.size>0)&&(clearTimeout(p),p=void 0,clearTimeout(h),h=void 0,f?.close(),f=null)},c))))}}}}function p(n){let r=new Set,i={workspace:{signature:``,lastFrame:0},runs:{signature:``,lastFrame:0}},a=new Map,o=new Map,s=new Map,c,l=!1,u=!1,d=!1,f=!1,p,m,h=0,g=(e,t,n=h)=>{m===void 0||e.readyGeneration===m||(e.readyGeneration=m,C(e,t,{event:`ready`,data:JSON.stringify({generation:m,seq:n}),id:``}))},_=e=>{`event`in e&&e.event===`ping`&&(d=!0);let t=h,n=v(e);for(let{doc:r,entry:i}of y(`workspace`))n===void 0?g(r,i,t):r.readyGeneration=n,C(r,i,e)},v=e=>{if(!(!(`data`in e)||![`ready`,`run-summary`,`run-deleted`].includes(e.event)))try{let t=JSON.parse(e.data);if(e.event===`ready`&&typeof t.generation==`string`&&typeof t.seq==`number`)return m=t.generation,h=t.seq,t.generation;typeof t.seq==`number`&&(h=Math.max(h,t.seq))}catch{}},y=e=>[...r].flatMap(t=>[...t.entries.values()].filter(t=>!t.paused&&(!e||t.demand.kind===e)).map(e=>({doc:t,entry:e}))),b=(e,t)=>{try{e.port.postMessage(t)}catch{P(e)}},x=e=>{if(!(!(e instanceof Error)||e.message!==`authentication required`))for(let t of[...r])b(t,{type:`unavailable`,version:3,epoch:t.epoch,reason:e.message}),P(t)},S=(e,t,n)=>{t.paused=!0,t.unacked=[],t.bytes=0,b(e,{type:`reset`,version:3,epoch:e.epoch,id:t.id,reason:n}),N()},C=(e,t,n)=>{if(`type`in n&&n.type===`event`){if(n.event.seq<=t.sent)return;let r=new TextEncoder().encode(JSON.stringify(n)).length;if(t.bytes+r>1048576){S(e,t,`subscriber fell behind — reload history`);return}t.sent=n.event.seq,t.bytes+=r,t.unacked.push({seq:t.sent,bytes:r})}b(e,{type:`frame`,version:3,epoch:e.epoch,id:t.id,frame:n})},w=e=>{let t=p!==void 0&&e!==p;if(p=e,t)for(let{doc:e,entry:t}of y())S(e,t,`server restarted`)},T=e=>{clearTimeout(e.retry),e.retry=void 0;let t=e.controller;e.controller=void 0,t?.abort()},E=t=>{let r=i[t];if(!r.signature||u)return;T(r);let a=new AbortController;if(r.controller=a,r.lastFrame=Date.now(),t===`workspace`){if(d||f)for(let{doc:e,entry:t}of y(`workspace`))C(e,t,{event:`reconnect`,data:``,id:``});d=!1,f=!1}let o=new Map;if(t===`runs`)for(let{entry:t}of y(`run`)){let n=t.demand,r=o.get(e(n));if(!r||t.ack<r.afterSeq){let{kind:r,...i}=n;o.set(e(i),{...i,afterSeq:t.ack})}}n.stream(t,[...o.values()],n=>{if(!(r.controller!==a||a.signal.aborted)){if(r.lastFrame=Date.now(),`type`in n&&n.type===`ready`&&w(n.generation),`data`in n&&n.event===`ready`)try{let e=JSON.parse(n.data);typeof e.generation==`string`&&w(e.generation)}catch{}if(t===`workspace`){_(n);return}for(let{doc:t,entry:r}of y(`run`))r.demand.kind===`run`&&`type`in n&&`runId`in n&&e(n)!==e(r.demand)||C(t,r,n)}},a.signal).catch(x).finally(()=>{if(!(r.controller!==a||a.signal.aborted||u)){if(r.controller=void 0,t===`workspace`&&d){for(let{doc:e,entry:t}of y(`workspace`))C(e,t,{event:`disconnect`,data:``,id:``});d=!1,f=!0}r.retry=setTimeout(()=>{r.retry=void 0,E(t)},1500)}})},D=(e,t)=>{clearTimeout(t.timer),t.timer=void 0;let r=++t.revision;t.controller.abort(),t.controller=new AbortController,clearTimeout(t.deadline);let i=t.controller,a=t.deadline=setTimeout(()=>i.abort(),1e4);n.read(e,t.controller.signal).then(n=>{if(!(s.get(e)!==t||r!==t.revision))for(let{doc:t,entry:r}of y(`read`))r.demand.kind===`read`&&r.demand.path===e&&b(t,{type:`value`,version:3,epoch:t.epoch,id:r.id,...n})}).catch(x).finally(()=>{clearTimeout(a),s.get(e)===t&&r===t.revision&&(t.deadline=void 0,t.nextAt=Date.now()+t.interval,t.timer=setTimeout(()=>D(e,t),t.interval))})},O=()=>{let t=new Set;for(let{doc:n,entry:r}of y(`run`)){let i=e(r.demand);!t.has(i)&&t.size>=32?S(n,r,`shared task capacity reached`):t.add(i)}},k=e=>{let t={workspace:e.length?`workspace`:``,runs:y(`run`).map(({doc:e,entry:t})=>`${e.id}:${e.epoch}:${t.id}`).sort().join(`|`)};for(let e of[`workspace`,`runs`]){let n=i[e];n.signature!==t[e]&&(n.signature=t[e],T(n),n.signature?E(e):e===`workspace`&&(d=!1))}},A=()=>{let e=new Set(y(`topic`).map(({entry:e})=>e.demand.topic));for(let[t,n]of a)e.has(t)||(n(),a.delete(t),o.delete(t));for(let t of e)a.has(t)||a.set(t,n.topic(t,e=>{o.set(t,e);for(let{doc:n,entry:r}of y(`topic`))r.demand.kind===`topic`&&r.demand.topic===t&&b(n,{type:`value`,version:3,epoch:n.epoch,id:r.id,value:e})}))},j=()=>{let e=new Map;for(let{entry:t}of y(`read`))t.demand.kind===`read`&&e.set(t.demand.path,Math.min(e.get(t.demand.path)??1/0,t.demand.intervalMs));for(let[t,n]of s)e.has(t)||(s.delete(t),clearTimeout(n.timer),clearTimeout(n.deadline),n.controller.abort());for(let[t,n]of e){let e=s.get(t);if(e){n<e.interval&&e.timer&&(clearTimeout(e.timer),e.nextAt=Math.min(e.nextAt,Date.now()+n),e.timer=setTimeout(()=>D(t,e),Math.max(0,e.nextAt-Date.now()))),e.interval=n;continue}let r={controller:new AbortController,revision:0,interval:n,nextAt:Date.now()+n};s.set(t,r),r.timer=setTimeout(()=>D(t,r),n)}},M=()=>{if(l=!1,u)return;let e=y(`workspace`);O(),k(e),A(),j(),r.size||(clearInterval(c),c=void 0)};function N(){!l&&!u&&(l=!0,queueMicrotask(M))}function P(e){r.delete(e),e.port.onmessage=null,e.port.onmessageerror=null;try{e.port.close()}catch{}N()}let F=(e,t)=>(t&&(e.readyGeneration=void 0),![...e.entries.values()].some(e=>e.demand.kind===`workspace`)),I=(e,t)=>{let n=[...t.values()].find(e=>e.demand.kind===`workspace`&&!e.paused);n&&g(e,n)},L=e=>{let t=e.demand.kind===`run`?e.demand.afterSeq:0;return{...e,sent:t,ack:t,unacked:[],bytes:0,paused:!1}},R=(e,t,n)=>{let r=t.demand;r.kind===`topic`&&o.has(r.topic)&&b(e,{type:`value`,version:3,epoch:e.epoch,id:t.id,value:o.get(r.topic)}),r.kind===`workspace`&&n&&(e.readyGeneration=void 0),r.kind===`workspace`&&d&&(g(e,t),C(e,t,{event:`ping`,data:``,id:``}))};return{attach:e=>{if(u||r.size>=128)return e.close(),()=>{};let n={port:e,id:``,epoch:-1,seenAt:Date.now(),entries:new Map};return r.add(n),e.onmessageerror=()=>P(n),e.onmessage=({data:e})=>{let r=t.safeParse(e);if(!r.success){P(n);return}let i=r.data;if(!(n.id&&i.documentId!==n.id||i.epoch<n.epoch)){if(i.type===`sync`){n.id=i.documentId;let e=n.epoch!==i.epoch;n.epoch=i.epoch,n.seenAt=Date.now();let t=new Map,r=F(n,i.workspaceReady);for(let a of i.entries){let i=e?void 0:n.entries.get(a.id),o=i??L(a);t.set(a.id,o),i||R(n,o,r)}if(I(n,t),n.entries=t,!t.size){P(n);return}b(n,{type:`alive`,version:3,epoch:n.epoch}),N()}else if(i.epoch===n.epoch){let e=n.entries.get(i.id);if(!e)return;if(i.type===`ack`&&i.seq<=e.sent&&i.seq>e.ack&&(e.ack=i.seq,e.unacked=e.unacked.filter(t=>t.seq>i.seq?!0:(e.bytes-=t.bytes,!1))),i.type===`refresh`&&e.demand.kind===`read`){let t=s.get(e.demand.path);t&&D(e.demand.path,t)}}}},e.start(),b(n,{type:`hello`,version:3}),c??=setInterval(()=>{for(let e of[...r])Date.now()-e.seenAt>=15e3&&P(e);for(let e of[`workspace`,`runs`])i[e].controller&&Date.now()-i[e].lastFrame>=4e4&&E(e)},1e3),()=>P(n)},dispose(){u=!0;for(let e of[...r])P(e);for(let e of Object.values(i))T(e);for(let e of a.values())e();a.clear(),o.clear();for(let e of s.values())clearTimeout(e.timer),clearTimeout(e.deadline),e.controller.abort();s.clear(),clearInterval(c),c=void 0}}}async function m(e,t,n){if(!e.ok||!e.body)throw Error(`live stream HTTP ${e.status}`);let r=e.body.getReader(),i=new TextDecoder,a=new TextEncoder,o=``,s=[],c=``,l=``,u=0,d=()=>{r.cancel().catch(()=>{})};n.addEventListener(`abort`,d,{once:!0});let f=(e,n)=>{if(u+=a.encode(e).length+n,u>1048576)throw Error(`SSE frame exceeds limit`);if(e===``){s.length&&t({event:c||`message`,data:s.join(`
|
|
2
2
|
`),id:l}),s=[],c=``,u=0;return}if(e.startsWith(`:`))return;let r=e.indexOf(`:`),i=r<0?e:e.slice(0,r),o=r<0?``:e.slice(r+1).replace(/^ /,``);i===`data`?s.push(o):i===`event`?c=o:i===`id`&&!o.includes(`\0`)&&(l=o)};try{for(;;){n.throwIfAborted();let{done:e,value:t}=await r.read();if(e)break;o+=i.decode(t,{stream:!0});let s=0;for(let e=0;e<o.length;e++){let t=o[e];if(t!==`
|
|
3
3
|
`&&t!==`\r`)continue;if(t===`\r`&&e===o.length-1)break;let n=t===`\r`&&o[e+1]===`
|
|
4
4
|
`;f(o.slice(s,e),n?2:1),n&&e++,s=e+1}if(o=o.slice(s),a.encode(o).length+u>1048576)throw Error(`SSE frame exceeds limit`)}n.throwIfAborted()}finally{n.removeEventListener(`abort`,d),await r.cancel().catch(()=>{}),r.releaseLock()}}var h=f(),g=p({async stream(e,t,r,i){let a=await fetch(e===`workspace`?`/api/v1/workspace/events?runs=summary`:`/api/v1/workspace/run-events`,{credentials:`include`,signal:i,...e===`runs`?{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({runs:t})}:{}});if(a.status===401||a.status===403)throw Error(`authentication required`);await m(a,t=>{if(e===`workspace`){r(t);return}if(t.event===`live`)try{let e=n.safeParse(JSON.parse(t.data));e.success&&r(e.data)}catch{}},i)},topic:(e,t)=>h.subscribe(e,t),async read(e,t){let n=await fetch(e,{credentials:`include`,signal:t});if(n.status===401||n.status===403)throw Error(`authentication required`);if(!n.ok)throw Error(`HTTP ${n.status}`);return{value:await n.json()}}}),_=globalThis;_.onconnect=e=>{let t=e.ports[0];t&&g.attach(t)};
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import type { RunStore } from '../runs/store.ts';
|
|
2
|
-
import { type RecordedProcess } from './process-liveness.ts';
|
|
3
|
-
/**
|
|
4
|
-
* What a full destroy attempt started from, and the processes it found holding the worker's
|
|
5
|
-
* resources (hearsay-tools/cezarion#879). A scheduled retry that would observe the same, with
|
|
6
|
-
* every holder still the same live process, has nothing new to try: it skips the transcript
|
|
7
|
-
* read, the git spawns, the `/proc` scans and the snapshot writes.
|
|
8
|
-
*/
|
|
9
|
-
export type DestroyObservation = {
|
|
10
|
-
key: string;
|
|
11
|
-
holders: RecordedProcess[];
|
|
12
|
-
};
|
|
13
|
-
/**
|
|
14
|
-
* Everything a destroy attempt's outcome depends on that a stat or a small file read can see:
|
|
15
|
-
* the worker's record (minus `destroy`, which every attempt rewrites), the parent's receipt, the
|
|
16
|
-
* execution checkpoint, the process record, the scratch locations, the worktree and its own admin
|
|
17
|
-
* dir, lock and ownership marker and, given the repository's common Git dir, the ownership receipt
|
|
18
|
-
* and its cleanup checkpoint, the branch ref, `packed-refs`, the branch reflog and the
|
|
19
|
-
* linked-worktree admin dirs, and the project's `worktreeTeardown` value the caller read.
|
|
20
|
-
* Synchronous, with no git and no `/proc` scan. The worktree mutation
|
|
21
|
-
* lock is not here: every full attempt takes it, so its stamp would change on every attempt.
|
|
22
|
-
*/
|
|
23
|
-
export declare function observeDestroy({ store, dataDir, commonDir, workerId, teardown }: {
|
|
24
|
-
store: RunStore;
|
|
25
|
-
dataDir: string;
|
|
26
|
-
commonDir?: string | undefined;
|
|
27
|
-
workerId: string;
|
|
28
|
-
teardown?: unknown;
|
|
29
|
-
}): string;
|
|
30
|
-
/** The holders a failed attempt named, pinned to their current incarnation. */
|
|
31
|
-
export declare function recordHolders(pids: readonly number[]): RecordedProcess[];
|
|
32
|
-
/**
|
|
33
|
-
* Every holder the last attempt named still holds: the same live process and, unless it belongs to
|
|
34
|
-
* the generation's own process record (which blocks wherever it works), still working under the
|
|
35
|
-
* worktree or a scratch location. A holder that exited, was replaced or moved away is a change.
|
|
36
|
-
* One `readlink` (Linux) or one-process `lsof` (darwin) per holder; on win32, whose scan names no
|
|
37
|
-
* holder, only recorded processes reach this, and liveness decides.
|
|
38
|
-
*/
|
|
39
|
-
export declare function holdersStillHold({ store, dataDir, workerId, holders }: {
|
|
40
|
-
store: RunStore;
|
|
41
|
-
dataDir: string;
|
|
42
|
-
workerId: string;
|
|
43
|
-
holders: readonly RecordedProcess[];
|
|
44
|
-
}): boolean;
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import { createHash } from 'node:crypto';
|
|
2
|
-
import { lstatSync, readFileSync } from 'node:fs';
|
|
3
|
-
import { join, resolve } from 'node:path';
|
|
4
|
-
import { agentTmpDirLocations } from '../runs/agent-tmpdir.js';
|
|
5
|
-
import { processCwdUnder, processStartToken, recordedProcessLive } from './process-liveness.js';
|
|
6
|
-
/** A file's identity, content and permission stamp, or why it cannot be read. `ctime` and `mode`
|
|
7
|
-
* catch a repair that keeps the size and the second (an in-place rewrite, a `chmod`). */
|
|
8
|
-
function fileSignature(path) {
|
|
9
|
-
try {
|
|
10
|
-
const info = lstatSync(path);
|
|
11
|
-
return `${info.ino}:${info.size}:${info.mtimeMs}:${info.ctimeMs}:${info.mode}`;
|
|
12
|
-
}
|
|
13
|
-
catch (error) {
|
|
14
|
-
return error.code ?? 'error';
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
/** A small identity file's bytes and permissions. Each removal attempt rewrites its cleanup
|
|
18
|
-
* checkpoint atomically (a new inode, the same bytes), so only what such a file says, and who may
|
|
19
|
-
* read it, is a change; an in-place repair or a `chmod` still is. */
|
|
20
|
-
function contentSignature(path) {
|
|
21
|
-
try {
|
|
22
|
-
const info = lstatSync(path);
|
|
23
|
-
if (!info.isFile() || info.size > 65_536)
|
|
24
|
-
return `${info.ino}:${info.size}:${info.mtimeMs}:${info.ctimeMs}:${info.mode}`;
|
|
25
|
-
return `${info.mode}:${createHash('sha256').update(readFileSync(path)).digest('hex')}`;
|
|
26
|
-
}
|
|
27
|
-
catch (error) {
|
|
28
|
-
return error.code ?? 'error';
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
/** A directory's identity and permissions only: a holder working inside it changes its times,
|
|
32
|
-
* never whether the directory is there, which one it is, or who may read it. */
|
|
33
|
-
function dirSignature(path) {
|
|
34
|
-
try {
|
|
35
|
-
const info = lstatSync(path);
|
|
36
|
-
return `${info.ino}:${info.mode}`;
|
|
37
|
-
}
|
|
38
|
-
catch (error) {
|
|
39
|
-
return error.code ?? 'error';
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
/** The linked worktree's own admin dir, which its `.git` file names: its lock and its ownership
|
|
43
|
-
* marker live there. */
|
|
44
|
-
function adminDir(worktree) {
|
|
45
|
-
try {
|
|
46
|
-
const gitdir = /^gitdir: (.+)$/m.exec(readFileSync(join(worktree, '.git'), 'utf8'))?.[1]?.trim();
|
|
47
|
-
return gitdir ? resolve(worktree, gitdir) : undefined;
|
|
48
|
-
}
|
|
49
|
-
catch {
|
|
50
|
-
return undefined;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Everything a destroy attempt's outcome depends on that a stat or a small file read can see:
|
|
55
|
-
* the worker's record (minus `destroy`, which every attempt rewrites), the parent's receipt, the
|
|
56
|
-
* execution checkpoint, the process record, the scratch locations, the worktree and its own admin
|
|
57
|
-
* dir, lock and ownership marker and, given the repository's common Git dir, the ownership receipt
|
|
58
|
-
* and its cleanup checkpoint, the branch ref, `packed-refs`, the branch reflog and the
|
|
59
|
-
* linked-worktree admin dirs, and the project's `worktreeTeardown` value the caller read.
|
|
60
|
-
* Synchronous, with no git and no `/proc` scan. The worktree mutation
|
|
61
|
-
* lock is not here: every full attempt takes it, so its stamp would change on every attempt.
|
|
62
|
-
*/
|
|
63
|
-
export function observeDestroy({ store, dataDir, commonDir, workerId, teardown }) {
|
|
64
|
-
const run = store.getRun(workerId);
|
|
65
|
-
if (run?.delegation?.role !== 'worker')
|
|
66
|
-
return JSON.stringify({ status: run?.status, role: run?.delegation?.role });
|
|
67
|
-
const { destroy: _destroy, ...delegation } = run.delegation;
|
|
68
|
-
const parent = store.getRun(delegation.parentRunId);
|
|
69
|
-
const receipt = parent?.delegation?.role === 'root' ? parent.delegation.receipts.find(entry => entry.workerId === workerId) : undefined;
|
|
70
|
-
const execution = store.readWorkerExecution(workerId);
|
|
71
|
-
const { path, branch, resourceId } = delegation.workspace;
|
|
72
|
-
const admin = adminDir(path);
|
|
73
|
-
return JSON.stringify({
|
|
74
|
-
status: run.status, delegation, teardown: teardown ?? null,
|
|
75
|
-
receipt: receipt ? receipt.deletion ?? 'present' : 'absent',
|
|
76
|
-
execution: execution ?? 'absent',
|
|
77
|
-
processes: execution ? store.readWorkerProcesses(workerId, execution.generation) : 'absent',
|
|
78
|
-
scratch: agentTmpDirLocations(dataDir, workerId).map(dirSignature),
|
|
79
|
-
worktree: dirSignature(path),
|
|
80
|
-
admin: admin ? [fileSignature(admin), fileSignature(join(admin, 'locked')), contentSignature(join(admin, 'cezar-owned-resource'))] : 'absent',
|
|
81
|
-
...(commonDir ? { git: [
|
|
82
|
-
contentSignature(join(commonDir, 'cezar-owned-workspaces', `${resourceId}.json`)),
|
|
83
|
-
contentSignature(join(commonDir, 'cezar-owned-workspaces', `${resourceId}.cleanup.json`)),
|
|
84
|
-
fileSignature(join(commonDir, 'refs/heads', branch)),
|
|
85
|
-
fileSignature(join(commonDir, 'packed-refs')),
|
|
86
|
-
fileSignature(join(commonDir, 'logs/refs/heads', branch)),
|
|
87
|
-
fileSignature(join(commonDir, 'worktrees')),
|
|
88
|
-
] } : {}),
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
/** The holders a failed attempt named, pinned to their current incarnation. */
|
|
92
|
-
export function recordHolders(pids) {
|
|
93
|
-
return pids.map(pid => { const startToken = processStartToken(pid); return { pid, ...(startToken ? { startToken } : {}) }; });
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Every holder the last attempt named still holds: the same live process and, unless it belongs to
|
|
97
|
-
* the generation's own process record (which blocks wherever it works), still working under the
|
|
98
|
-
* worktree or a scratch location. A holder that exited, was replaced or moved away is a change.
|
|
99
|
-
* One `readlink` (Linux) or one-process `lsof` (darwin) per holder; on win32, whose scan names no
|
|
100
|
-
* holder, only recorded processes reach this, and liveness decides.
|
|
101
|
-
*/
|
|
102
|
-
export function holdersStillHold({ store, dataDir, workerId, holders }) {
|
|
103
|
-
if (!holders.length)
|
|
104
|
-
return true;
|
|
105
|
-
const run = store.getRun(workerId);
|
|
106
|
-
if (run?.delegation?.role !== 'worker')
|
|
107
|
-
return false;
|
|
108
|
-
const execution = store.readWorkerExecution(workerId);
|
|
109
|
-
const record = execution ? store.readWorkerProcesses(workerId, execution.generation) : 'absent';
|
|
110
|
-
const recorded = typeof record === 'string' ? [] : [record.controller, ...record.processes];
|
|
111
|
-
const paths = [run.delegation.workspace.path, ...agentTmpDirLocations(dataDir, workerId)];
|
|
112
|
-
// A recorded entry speaks for a holder only while it is that same incarnation: a reused PID is not the generation's.
|
|
113
|
-
const inRecord = (holder) => recorded.some(entry => entry.pid === holder.pid && recordedProcessLive(entry));
|
|
114
|
-
return holders.every(holder => recordedProcessLive(holder) && (inRecord(holder) || processCwdUnder(holder.pid, paths) !== false));
|
|
115
|
-
}
|
|
116
|
-
//# sourceMappingURL=destroy-observation.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"destroy-observation.js","sourceRoot":"","sources":["../../src/delegation/destroy-observation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,mBAAmB,EAAwB,MAAM,uBAAuB,CAAC;AAUtH;yFACyF;AACzF,SAAS,aAAa,CAAC,IAAY;IACjC,IAAI,CAAC;QAAC,MAAM,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;QAAC,OAAO,GAAG,IAAI,CAAC,GAAG,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,IAA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AAO,EAAE,QAAQ,CAAC,CAAC,CAAC;IAC1F,qHAAqH;IACrH,MAAM,QAAQ,GAAG,CAAC,MAAuB,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,KAAK,MAAM,CAAC,GAAG,IAAI,mBAAmB,CAAC,KAAK,CAAC,CAAC,CAAC;IAC7H,OAAO,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,mBAAmB,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,eAAe,CAAC,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC;AACpI,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Ln as e,Mn as t}from"./project-scope-context-p1OpXpSJ.js";function n(n){return t[e(n).bucket]<=t.waiting}export{n as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Nr as e,Wr as t}from"./project-scope-context-p1OpXpSJ.js";function n(n,r){return e(n,t,r)}export{n as t};
|