@hearsay-tools/squawk 0.17.0-pr3272.5740 → 0.18.0
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/contract/discovery.d.ts +32 -1
- package/dist/contract/health.d.ts +17 -2
- package/dist/contract/index.js +2565 -2573
- package/dist/contract/repo.d.ts +2 -1
- package/dist/contract/waits.d.ts +11 -2
- package/dist/contract/workflows.d.ts +1 -1
- package/dist/contract/workspace.d.ts +1 -36
- package/dist/delegation/routes.d.ts +4 -4
- package/dist/delegation/transport.d.ts +9 -9
- package/dist/runs/run-exits.js.map +1 -1
- package/dist/server/server.d.ts +58 -58
- package/dist/workflows/run/wait-engine.d.ts +72 -72
- package/dist/workflows/run-states.js +4 -4
- package/dist/workflows/run-states.js.map +1 -1
- package/package.json +4 -4
- package/web/dist/assets/activity-motion-hhx0e841.js +2 -0
- package/web/dist/assets/{activity-route-Z8SMpPLm.js → activity-route-De0BnSrc.js} +1 -1
- package/web/dist/assets/{agent-accounts-f1cxwgfz.js → agent-accounts-BCg-578Q.js} +2 -2
- package/web/dist/assets/{cez-idle-EVoUsgU3.js → cez-idle-BT0U4GN_.js} +1 -1
- package/web/dist/assets/{commit-diff-panel-DZutYRbq.js → commit-diff-panel-DYtYc_dH.js} +1 -1
- package/web/dist/assets/{control-locations-C9II3kPz.js → control-locations-CA9TMupq.js} +1 -1
- package/web/dist/assets/{diff-DNAtaTLC.js → diff-tVGVhYyc.js} +2 -2
- package/web/dist/assets/{diff-view---8Bt-0a.js → diff-view-CNM3u77o.js} +1 -1
- package/web/dist/assets/{file-preview-D08Kq15E.js → file-preview-C1eTdJLJ.js} +1 -1
- package/web/dist/assets/{git-toolbar-DMDmGits.js → git-toolbar-Dwz8p8GW.js} +1 -1
- package/web/dist/assets/{github-DlMu4p0I.js → github-BSezqH6f.js} +1 -1
- package/web/dist/assets/{github-sidebar-model-B0Ufci5S.js → github-sidebar-model-Ct0DltOv.js} +1 -1
- package/web/dist/assets/{global-activity-route-mJrrP9I0.js → global-activity-route-BZiYz-B0.js} +1 -1
- package/web/dist/assets/{index-FoxgrgAH.js → index-D489J7QW.js} +8 -8
- package/web/dist/assets/{live-protocol-BVn0UA_g.js → live-protocol-BDY7JJpT.js} +1 -1
- package/web/dist/assets/{live-refetch-BdnmTJ_8.js → live-refetch-C0kQc3-z.js} +1 -1
- package/web/dist/assets/{preview-pane-connected-KzJn9jAG.js → preview-pane-connected-DGkEs_L3.js} +1 -1
- package/web/dist/assets/{project-router-MMOk9VbW.js → project-router-1m_VlC22.js} +1 -1
- package/web/dist/assets/project-scope-context-CaUqlAd7.js +4 -0
- package/web/dist/assets/{queries-DORTKwyN.js → queries-DYfIpJ-d.js} +1 -1
- package/web/dist/assets/{repo-git-Bf_EfIHt.js → repo-git-CU1S5P-y.js} +1 -1
- package/web/dist/assets/{report-reader-ztLhC9gp.js → report-reader-DlZol2Ux.js} +1 -1
- package/web/dist/assets/reports-DIGGjk7C.js +1 -0
- package/web/dist/assets/{run-header-CDMGqoPE.js → run-header-DPjiPKRe.js} +1 -1
- package/web/dist/assets/skills-BMwanop_.js +1 -0
- package/web/dist/assets/{tab-link-BvoGfK8S.js → tab-link-DCUifQ46.js} +1 -1
- package/web/dist/assets/{task-changes-CfUCDwcL.js → task-changes-BZXWvQN3.js} +1 -1
- package/web/dist/assets/{task-commits-IOjoz_mL.js → task-commits-ByI9MSfc.js} +1 -1
- package/web/dist/assets/{task-files-CpUYhIpd.js → task-files-LJbenpiH.js} +1 -1
- package/web/dist/assets/{task-github-item-B8YPhQDV.js → task-github-item-B0CU9lGR.js} +1 -1
- package/web/dist/assets/task-thread-CXCN__1a.js +9 -0
- package/web/dist/assets/{thread-state-C136Em0C.js → thread-state-BLaCzqeX.js} +1 -1
- package/web/dist/assets/{use-hand-to-agent-state-C6u70P2A.js → use-hand-to-agent-state-BkmKad8x.js} +1 -1
- package/web/dist/assets/{useInfiniteQuery-BbYMWe23.js → useInfiniteQuery-qEY8OhKb.js} +1 -1
- package/web/dist/assets/useQuery-DOJQOEBO.js +1 -0
- package/web/dist/assets/{workflows-CWrdqLII.js → workflows-Dbxb-d-6.js} +1 -1
- package/web/dist/assets/{ws-BtSVmivO.js → ws-DvGmrP4z.js} +1 -1
- package/web/dist/index.html +13 -13
- package/web/dist/live-worker.js +1 -1
- package/dist/contract/repo-info.d.ts +0 -12
- package/dist/contract/runner.d.ts +0 -15
- package/dist/contract/usage-limit-hold.d.ts +0 -15
- package/web/dist/assets/activity-motion-Deqj_hcK.js +0 -2
- package/web/dist/assets/project-scope-context-B3M-u8R0.js +0 -4
- package/web/dist/assets/reports-BxGqf1aC.js +0 -1
- package/web/dist/assets/skills-D2r8n5IP.js +0 -1
- package/web/dist/assets/task-thread-2Kme3Fc0.js +0 -9
- package/web/dist/assets/useQuery-CqqnAJvu.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{t as e,u as t}from"./button-CHUAMTHK.js";import{t as n}from"./react-runtime-CCIEwYL0.js";import{_r as r,vr as i}from"./project-scope-context-B3M-u8R0.js";import{U as a,W as o,_ as s,f as c,g as l,h as u,m as d}from"./live-protocol-BVn0UA_g.js";import{a as ee}from"./loader-circle-CZkGEdoI.js";import{t as f}from"./createLucideIcon-BHp8sXmF.js";import{t as p}from"./app-window-CSHwDX9N.js";import{Bt as te,Lt as ne,dt as re,ft as ie,ot as ae,qt as oe}from"./index-FoxgrgAH.js";var m=f(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),h=f(`server`,[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]),g=n(),_={registered:e=>e.server.answeredAtRegistration?{label:`Open`,run:!1}:{label:`Run and open`,run:!0},adopted:()=>({label:`Open`,run:!1}),starting:()=>({label:`Open`,run:!1}),up:()=>({label:`Open`,run:!1}),stalled:()=>({label:`View`,run:!1}),exited:()=>({label:`Start again`,run:!0}),stopped:()=>({label:`Start again`,run:!0}),unavailable:()=>void 0};function v(e){let{text:t,...n}=ie(e),r={...n,status:t},i=_[e.state](e);return i?{...r,action:i}:r}var se={"Run and open":te,Open:p,View:oe,"Start again":m};function ce({entry:e,inPreview:n,onOpen:r}){let{server:i}=e,a=v(e),o=e.state===`unavailable`,s=r?a.action:void 0,c=re(i.command),l=ee(i.registeredAt);return(0,g.jsxs)(`div`,{"data-slot":`preview-server-card`,"data-state":e.state,className:t(`min-w-0 rounded-lg border border-border bg-card px-3.5 py-3 text-sm`,o&&`text-muted-foreground`),children:[(0,g.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2 text-xs text-soft-foreground`,children:[(0,g.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5 font-mono`,children:[(0,g.jsx)(h,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),(0,g.jsx)(`span`,{className:`truncate`,children:`cezar_preview_serve`})]}),o?(0,g.jsx)(`span`,{children:`worktree removed`}):l?(0,g.jsxs)(`span`,{children:[l,` ago`]}):null]}),(0,g.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-x-3 gap-y-2`,children:[(0,g.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,g.jsx)(ae,{tone:a.tone,shape:a.ring?`ring`:`filled`,pulse:a.pulse===!0,"aria-hidden":`true`}),(0,g.jsx)(`span`,{className:`font-semibold text-foreground`,children:i.label}),(0,g.jsxs)(`span`,{className:`font-mono text-muted-foreground`,children:[`:`,i.port]}),(0,g.jsx)(`span`,{className:`text-muted-foreground`,children:a.status})]}),(0,g.jsx)(le,{entry:e,inPreview:n,action:s,onOpen:r})]}),(0,g.jsxs)(`div`,{className:`mt-2.5 min-w-0 rounded-md bg-muted px-3 py-2 font-mono text-xs`,children:[(0,g.jsx)(`p`,{className:`break-words whitespace-pre-wrap text-foreground`,children:i.command}),i.cwd?(0,g.jsxs)(`p`,{className:`mt-1 flex gap-3 text-soft-foreground`,children:[(0,g.jsx)(`span`,{children:`cwd`}),(0,g.jsx)(`span`,{className:`break-all`,children:i.cwd})]}):null]}),s?.run?(0,g.jsx)(y,{icon:(0,g.jsx)(ne,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),children:`${s.label===`Start again`?`Starting again`:`Opening`} runs ${c} in this task's worktree, on the host.`}):null,o?(0,g.jsx)(y,{children:`The worktree this server ran in is gone. Register it again from a new task.`}):null]})}function le({entry:t,inPreview:n,action:r,onOpen:i}){let{server:a}=t,o=n&&r!==void 0&&!r.run,s=o?`In preview`:r?.label,c=o?p:r?se[r.label]:null;return r&&s&&c?(0,g.jsxs)(e,{variant:o||r.label===`View`||r.label===`Open`&&t.state===`starting`?`outline`:`contrast`,size:`sm`,className:`max-md:h-11 max-md:px-3.5`,onClick:()=>i?.({port:a.port,run:r.run}),children:[(0,g.jsx)(c,{"aria-hidden":`true`}),s]}):null}function y({icon:e,children:t}){return(0,g.jsxs)(`p`,{className:`mt-2.5 flex items-start gap-2 text-xs text-muted-foreground`,children:[e,(0,g.jsx)(`span`,{children:t})]})}var b=120;function x(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function S(e){let t=e.replace(/\s+/g,` `).trim();return t.length>b?`${t.slice(0,b-1)}…`:t}function C(e,...t){if(x(e))for(let n of t){let t=e[n];if(typeof t==`string`&&t.trim()!==``)return S(t)}}function ue(e){if(!x(e))return;let t=e.command;if(typeof t==`string`&&t.trim()!==``)return S(t);if(Array.isArray(t)){let e=t.filter(e=>typeof e==`string`);if(e.length>0)return S(e.join(` `))}}function de(e){if(!x(e)||!Array.isArray(e.changes))return[];let t=[];for(let n of e.changes)x(n)&&typeof n.path==`string`&&n.path.trim()!==``&&t.push(n.path);return t}function w(e){return C(e,`description`,`query`,`url`,`filePath`,`file_path`,`path`,`pattern`,`name`)}function T(e,t){return t?`${e} ${t}`:e}var fe=new Map([[`bash`,`execute`],[`commandexecution`,`execute`],[`edit`,`edit`],[`multiedit`,`edit`],[`write`,`edit`],[`notebookedit`,`edit`],[`filechange`,`edit`],[`read`,`read`],[`imageview`,`read`],[`glob`,`search`],[`grep`,`search`],[`webfetch`,`fetch`],[`websearch`,`fetch`],[`task`,`task`],[`agent`,`task`],[`skill`,`task`],[`todowrite`,`plan`],[`todolist`,`plan`],[`plan`,`plan`],[`taskcreate`,`plan`],[`taskupdate`,`plan`],[`tasklist`,`plan`],[`contextcompaction`,`other`],[`mcptoolcall`,`other`]]);function pe(e,t){switch(e){case`write`:return{toolKind:`edit`,title:T(`Write`,C(t,`file_path`,`filePath`,`path`))};case`notebookedit`:return{toolKind:`edit`,title:T(`Edit`,C(t,`notebook_path`,`notebookPath`,`file_path`,`filePath`,`path`))};case`filechange`:{let e=de(t);return{toolKind:`edit`,title:T(`Edit`,e.length===1?e[0]:e.length>1?`${e.length} files`:void 0)}}default:return{toolKind:`edit`,title:T(`Edit`,C(t,`file_path`,`filePath`,`path`))}}}function me(e,t){return e===`imageview`?{toolKind:`read`,title:T(`View image`,C(t,`path`))}:{toolKind:`read`,title:T(`Read`,C(t,`file_path`,`filePath`,`path`))}}function he(e,t){return e===`webfetch`?{toolKind:`fetch`,title:T(`Fetch`,C(t,`url`))}:{toolKind:`fetch`,title:T(`Web search`,C(t,`query`))}}function ge(e,t){if(e===`skill`){let e=C(t,`skill`,`name`,`command`);return{toolKind:`task`,title:e?`Skill: ${e}`:`Skill`,subtitle:C(t,`args`,`description`)}}let n=e===`agent`?`Agent`:`Task`,r=C(t,`subagent_type`,`subagentType`),i=C(t,`description`,`prompt`)??r;return{toolKind:`task`,title:i?`${n}: ${i}`:n,subtitle:i===r?void 0:r}}function _e(e,t,n){if(t===`contextcompaction`)return{toolKind:`other`,title:`Compacted context`};if(t===`mcptoolcall`){let e=C(n,`server`),t=C(n,`tool`);return e&&t?{toolKind:`other`,title:`${e}.${t}`}:{toolKind:`other`,title:`MCP tool`,subtitle:w(n)}}if(t.startsWith(`mcp__`)){let t=e.split(`__`).filter(e=>e!==``);if(t.length>=3)return{toolKind:`other`,title:`${t[1]}.${t.slice(2).join(`__`)}`}}return{toolKind:`other`,title:typeof e==`string`&&e.trim()!==``?S(e):`Tool`,subtitle:w(n)}}function ve(e,t){let n=typeof e==`string`?e.toLowerCase():``;switch(fe.get(n)){case`execute`:return{toolKind:`execute`,title:T(`Ran`,ue(t)),subtitle:C(t,`description`)};case`edit`:return pe(n,t);case`read`:return me(n,t);case`search`:return{toolKind:`search`,title:T(`Search`,C(t,`pattern`,`query`)),subtitle:C(t,`path`)};case`fetch`:return he(n,t);case`task`:return ge(n,t);case`plan`:return{toolKind:`plan`,title:`Update plan`};default:return _e(e,n,t)}}function ye(e,t){if(t.type===`ask.requested`&&typeof t.requestId==`string`&&a.safeParse({questions:t.questions}).success)return t;if(t.type===`human-input-delivered`||t.type===`human-ask-closed`){let n=(t.type===`human-input-delivered`?l:u).safeParse(t);if(n.success&&n.data.askSeq===e?.seq)return}return e}function E(e){if(!(e.type!==`ask.requested`||typeof e.requestId!=`string`))return{requestId:e.requestId,questions:e.questions,...e.context===void 0?{}:{context:e.context}}}function D(e){let t=E(e);return t&&{seq:e.seq,...t}}function O(e,t){let n=ye(e&&{type:`ask.requested`,seq:e.seq,ts:``},t);return n===t?D(t):n===void 0?void 0:e}function k(e){let t;for(let n of e)t=O(t,n);return t}function A(e){let t=Array.isArray(e.questions)?e.questions.filter(e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&typeof e.header==`string`&&(e.options===void 0||Array.isArray(e.options))):[];if(t.length===0)return;let n=typeof e.context==`string`&&e.context!==``?e.context:void 0;return{id:e.requestId,questions:t,...n===void 0?{}:{context:n},askSeq:e.seq}}function j(){return{turns:[],itemsById:new Map,turnSeq:0,permissions:new Map,conversationEntries:new Map,outcomesByRequest:new Map,seenInputs:new Set,previewByPort:new Map,handedOff:!1}}function M(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function N(e){return typeof e==`string`?e:void 0}function P(e){let t=typeof e==`string`?new Date(e):void 0;return!t||Number.isNaN(t.getTime())?``:` · ${t.toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`})}`}function F(e){if(!(typeof e!=`string`||e===``))return Number.isFinite(new Date(e).getTime())?e:void 0}var be=new Set(o.options);function xe(e){return typeof e==`string`&&be.has(e)?e:void 0}function I(e,t){e.turnSeq+=1;let n={id:t===void 0?`turn-fallback-${e.turnSeq}`:`turn-seq-${t}`,entries:[],v2Items:!1};return e.turns.push(n),n}function L(e){return e.turns.at(-1)??I(e)}function R(e,t){L(e).entries.push({origin:`meta`,entry:t})}function z(e){for(let t of e.permissions.values())t.status===`pending`&&(t.status=`expired`)}function B(e,t){let n=N(e.stepId);return n===void 0?t:`${n}:${t}`}function Se(e,t){t.v2Items=!0;for(let n of t.entries)n.origin===`v1`&&n.entry.kind===`tool`&&e.itemsById.delete(n.entry.id);t.entries=t.entries.filter(e=>!(e.origin===`v1`&&e.entry.kind===`tool`))}function Ce(e,t,n,r,i){let a=n.kind===`message`&&i!==void 0?{...n,ts:i}:{...n};!t.v2Items&&a.kind!==`hook`&&Se(e,t);let o=e.itemsById.get(r);if(o&&o.turn===t){o.entry.entry=a;return}let s={origin:`v2`,entry:a};t.entries.push(s),e.itemsById.set(r,{turn:t,entry:s})}var V={"not-delivered":0,queued:1,delivered:2,consumed:3},we=[`instruction`,`resumed`,`requestId`,`relationship`,`state`,`createdAt`,`requestHash`,`deadline`];function H(e){let t={};for(let n of we)e[n]!==void 0&&Object.assign(t,{[n]:e[n]});return t}function U(e,t){if(t.messageKind!==`request`)return;let n=e.outcomesByRequest.get(t.messageId);n&&(t.outcome={status:n.status,...n.replyId===void 0?{}:{replyId:n.replyId},observedAt:n.observedAt})}function Te(e,t){let n=e.conversationEntries.get(t);n&&U(e,n)}function Ee(e,t,n,r){(V[e.delivery]<V.delivered||V[n]>V[e.delivery])&&(e.delivery=n),t.text!==``&&(e.text=t.text),Object.assign(e,H(t)),r.deliveredAt!==void 0&&(e.deliveredAt=r.deliveredAt),r.consumedAt!==void 0&&(e.consumedAt=r.consumedAt),r.recordedAt!==void 0&&(n===`delivered`||e.delivery!==`delivered`)&&(e.recordedAt=r.recordedAt)}function W(e,t,n,r){let i=e.conversationEntries.get(t.id);if(i){Ee(i,t,n,r),U(e,i);return}let a={kind:`conversation`,id:`conversation-message:${t.id}`,messageId:t.id,text:t.text,senderRunId:t.senderRunId,recipientRunId:t.recipientRunId,messageKind:t.kind,delivery:n,...r,...H(t)};U(e,a),e.conversationEntries.set(t.id,a),R(e,a)}function De(e,t){let n=P(t.ts),r=N(t.message),i=t.notify===!1?`Stopped notifying the webhook${n}`:`${e.handedOff?`Note sent to webhook`:`Handed off to webhook`}${n}${r?` — ${r}`:``}`;e.handedOff=t.notify!==!1,R(e,{kind:`note`,id:`v1:${t.seq}`,text:i,tone:`dim`,icon:`handoff`})}function Oe(e,t){let n=typeof t.attempts==`number`?t.attempts:void 0,r=N(t.webhookName),i=`${r?`Delivery to ${r} failed`:`Webhook delivery failed`}${N(t.event)?` (${N(t.event)})`:``}${n?` after ${n} attempt${n===1?``:`s`}`:``}: ${N(t.error)??`unknown error`}`;R(e,{kind:`note`,id:`v1:${t.seq}`,text:i,tone:`danger`})}function ke(e,t){let n=N(t.webhookName)??`webhook`,r=N(t.title),i=`v1:${t.seq}`;if(t.ok===!1){R(e,{kind:`note`,id:i,text:`Report to ${n} failed: ${N(t.error)??`unknown error`}`,tone:`danger`});return}let a=`${t.dryRun===!0?`Report to ${n} (dry run, nothing sent)`:`Sent report to ${n}`}${P(t.ts)}${r?` — ${r}`:``}`;R(e,t.dryRun===!0?{kind:`note`,id:i,text:a,tone:`dim`}:{kind:`note`,id:i,text:a,tone:`dim`,icon:`handoff`})}function Ae(e,t){let n=t.payload??{},r=`Webhook (dry run, nothing sent): ${N(t.event)??`delivery`}${N(n.status)?` · ${N(n.status)}`:``}`;R(e,{kind:`note`,id:`v1:${t.seq}`,text:r,tone:`dim`})}function je(e,t){let n=r.safeParse(t.server);if(!n.success)return;let i=e.previewByPort.get(n.data.port);i&&(i.turn.entries=i.turn.entries.filter(e=>e!==i.draft));let a=L(e),o={origin:`meta`,entry:{kind:`preview-server`,id:`preview-server:${n.data.port}`,server:n.data,state:`registered`,stateAt:t.ts}};a.entries.push(o),e.previewByPort.set(n.data.port,{turn:a,draft:o})}function Me(e,t){let n=i.safeParse(t.state),r=typeof t.port==`number`?e.previewByPort.get(t.port):void 0;if(!n.success||!r||r.draft.entry.kind!==`preview-server`)return;let{server:a,id:o}=r.draft.entry;r.draft.entry={kind:`preview-server`,id:o,server:a,state:n.data,stateAt:t.ts,...typeof t.exitCode==`number`?{exitCode:t.exitCode}:{},...t.reason===`user`||t.reason===`idle`?{reason:t.reason}:{}}}function Ne(e,t){let n=d.safeParse(t);if(!n.success)return;let{message:r,delivery:i,deliveredAt:a,consumedAt:o,ts:s}=n.data;W(e,r,i,{deliveredAt:a,consumedAt:o,recordedAt:s})}function Pe(e,t){let n=s.safeParse(t);if(!n.success)return;let{outcome:r}=n.data,i=e.outcomesByRequest.get(r.requestId);i&&!(i.status===`timed-out`&&r.status===`replied-late`)||(e.outcomesByRequest.set(r.requestId,r),Te(e,r.requestId))}function Fe(e,t){let n=c.safeParse(t);if(!n.success)return;let{input:r}=n.data;if(!e.seenInputs.has(r.id)){if(e.seenInputs.add(r.id),r.conversation){W(e,{id:r.id,text:r.text,createdAt:r.createdAt,...r.conversation},`delivered`,{deliveredAt:r.deliveredAt,recordedAt:n.data.ts});return}R(e,{kind:`note`,id:`agent-input:${r.id}`,text:r.text,tone:`dim`,attribution:{source:r.source,parentRunId:r.parentRunId}})}}function Ie(e,t){let n=N(t.text)??``,r=e.pendingAsk;e.pendingAsk&&!e.pendingAsk.resolved&&(e.pendingAsk.resolved=!0,e.pendingAsk.answeredBy=`human`,n!==``&&(e.pendingAsk.answer=n),e.pendingAsk=void 0);let i=I(e,t.seq),a=F(t.ts);i.userMessage={text:n,ask:r,imageCount:typeof t.imageCount==`number`?t.imageCount:0,images:Array.isArray(t.images)?t.images.filter(e=>typeof e==`string`):[],...a===void 0?{}:{ts:a}},a!==void 0&&(i.startedAt=a)}function Le(e,t){let n=e.turns.at(-1),r=n&&n.turnId===void 0&&!n.v2Items?n:I(e,t.seq);r.turnId=N(t.turnId),r.startedAt??=F(t.ts)}function Re(e,t){for(let n=e.turns.length-1;n>=0;--n)if(e.turns[n].turnId===t)return e.turns[n];return e.turns.at(-1)}function ze(e,t){z(e);let n=Re(e,N(t.turnId));if(!n)return;let r=F(t.ts);n.completed={stopReason:N(t.stopReason)??`end_turn`,...typeof t.costUsd==`number`?{costUsd:t.costUsd}:{},...r===void 0?{}:{ts:r}}}var G=new Set([`message`,`reasoning`,`tool`,`hook`]),Be=e=>G.has(e.kind);function Ve(e){if(!(!M(e)||!G.has(e.kind)))return typeof e.id==`string`&&e.id!==``?e:void 0}function K(e,t){let n=Ve(t.item);if(!n)return;let r=B(t,n.id);Ce(e,e.itemsById.get(r)?.turn??L(e),n,r,t.type===`item.completed`?F(t.ts):void 0)}function He(e,t){let n=e.itemsById.get(B(t,N(t.itemId)??``)),r=N(t.delta)??``;if(!n||r===``||!Be(n.entry.entry))return;let i=n.entry.entry;t.field===`output`&&i.kind===`tool`?i.output=(i.output??``)+r:t.field!==`output`&&(i.kind===`message`||i.kind===`reasoning`)&&(i.text+=r)}function Ue(e,t){let n=L(e),r=N(t.text)??``;if(r===``)return;let i=F(t.ts);n.entries.push({origin:`v1`,entry:{kind:`message`,id:`v1:${t.seq}`,role:`assistant`,text:r,...i===void 0?{}:{ts:i}}})}var We=new Set([`pending`,`in_progress`,`completed`,`cancelled`]);function Ge(e){if(!M(e)||!Array.isArray(e.todos))return;let t=[];for(let n of e.todos){if(!M(n)||typeof n.content!=`string`)return;t.push({content:n.content,status:We.has(n.status)?n.status:`pending`,...typeof n.activeForm==`string`?{activeForm:n.activeForm}:{}})}return t}var Ke=new Set([`subAgentActivity`,`collabAgentToolCall`,`collabToolCall`]);function qe(e,t){let n=L(e),r=N(t.tool)??`Tool`;if(n.v2Items||Ke.has(r))return;let i=ve(r,t.input),a=i.toolKind===`plan`?Ge(t.input):void 0;a!==void 0&&(n.planEntries=a);let o={kind:`tool`,id:N(t.id)??`v1:${t.seq}`,name:r,toolKind:i.toolKind,title:i.title,status:`running`,input:t.input},s={origin:`v1`,entry:o};n.entries.push(s),e.itemsById.set(o.id,{turn:n,entry:s})}function Je(e){if(typeof e==`string`)return e;if(e==null)return``;try{return JSON.stringify(e)}catch{return String(e)}}function Ye(e,t){let n=e.itemsById.get(N(t.toolCallId)??``);if(!n||n.turn.v2Items||n.entry.origin!==`v1`)return;let r=n.entry.entry;r.kind===`tool`&&(r.status=`completed`,r.output=Je(t.result))}function q(e,t,n,r){let i=N(t.message)??``;i!==``&&R(e,{kind:`note`,id:n,text:i,tone:r})}function J(e,t){q(e,t,`v1:${t.seq}`,t.tone===`danger`?`danger`:`dim`)}function Xe(e,t){q(e,t,`v1:${t.seq}`,`danger`)}function Ze(e,t){q(e,t,`v2:${t.seq}`,`danger`)}function Qe(e,t){if(t.status!==`failed`)return;let n=N(t.error)?` — ${N(t.error)}`:``;R(e,{kind:`note`,id:`v1:${t.seq}`,text:`step ${N(t.stepId)??`?`} failed${n}`,tone:`danger`})}function $e(e,t){let n=N(t.command)??`check`,r=typeof t.exitCode==`number`?t.exitCode:-1;R(e,{kind:`tool`,id:`v1:${t.seq}`,name:`check`,toolKind:`execute`,title:`Ran ${n}`,status:r===0?`completed`:`failed`,output:N(t.text)??``,exitCode:r})}function et(e,t){let n=xe(t.provider),r=N(t.authFailureId)??``;n===void 0||r.length<1||r.length>128||R(e,{kind:`provider-auth-required`,id:`v1:${t.seq}`,provider:n,authFailureId:r})}function tt(e,t){let n=N(t.url);if(n===void 0)return;let r={kind:`image`,id:`v1:${t.seq}`,url:n},i=N(t.name);i!==void 0&&(r.name=i),R(e,r)}function nt(e,t){Array.isArray(t.entries)&&(L(e).planEntries=t.entries)}function rt(e,t){z(e);let n=N(t.message);e.sessionEnded={reason:N(t.reason)??`end_turn`,...n===void 0?{}:{message:n}}}var it=new Set([`allow_once`,`allow_always`,`reject_once`,`reject_always`]);function at(e){return M(e)&&typeof e.id==`string`&&e.id!==``&&typeof e.label==`string`&&e.label!==``&&it.has(e.kind)}function ot(e){if(!(!Array.isArray(e)||e.length===0||!e.every(at)))return new Set(e.map(e=>e.id)).size===e.length?e:void 0}function st(e,t){let n=N(t.requestId),r=N(t.title),i=ot(t.options);if(!n||!r||e.permissions.has(n)||!i)return;let a=N(t.itemId),o=N(t.details),s={kind:`permission`,id:`permission:${n}`,requestId:n,title:r,options:i.map(e=>({...e})),status:`pending`,...a===void 0?{}:{itemId:a},...o===void 0?{}:{details:o}};e.permissions.set(n,s),R(e,s)}function ct(e,t){let n=e.permissions.get(N(t.requestId)??``);if(!n||n.status!==`pending`)return;let r=N(t.optionId);r!==void 0&&n.options.some(e=>e.id===r)?(n.status=`resolved`,n.optionId=r):n.status=`expired`;let i=N(t.reason);i!==void 0&&(n.reason=i)}function lt(e,t){let n=D(t),r=n&&A(n);if(!r)return;let i={kind:`ask`,...r,questions:r.questions,resolved:!1};R(e,i),e.pendingAsk=i}function Y(e,t){let n=e.pendingAsk;return n&&!n.resolved&&n.askSeq===t.askSeq?n:void 0}function ut(e,t){let n=Y(e,t);if(!n)return;n.routedToParent=!0;let r=N(t.parentRunId);r!==void 0&&(n.parentRunId=r)}function dt(e,t){let n=Y(e,t);n&&(n.routedToParent=!1)}function ft(e,t){let n=Y(e,t);n&&X(e,n,`undeliverable`)}var pt=new Set([`finish`,`superseded`,`parent-stopped`,`worker-stopped`,`undeliverable`]);function mt(e,t){let n=Y(e,t);n&&pt.has(t.reason)&&X(e,n,t.reason)}function X(e,t,n){t.resolved=!0,t.closed=n,e.pendingAsk=void 0}function Z(e,t){let n=Y(e,t);if(n){if(t.source===`cezar`){X(e,n,`undeliverable`);return}t.source===`parent`&&(n.resolved=!0,n.answeredBy=`parent`,e.pendingAsk=void 0)}}var Q=()=>{},ht=new Map([[`handoff`,De],[`webhook.failed`,Oe],[`webhook.dry-run`,Ae],[`webhook.report`,ke],[`preview.server-registered`,je],[`preview.server-state`,Me],[`conversation-message`,Ne],[`request-outcome`,Pe],[`agent-input`,Fe],[`user-message`,Ie],[`turn.started`,Le],[`turn.completed`,ze],[`item.started`,K],[`item.updated`,K],[`item.completed`,K],[`item.delta`,He],[`text`,Ue],[`tool-call`,qe],[`tool-result`,Ye],[`note`,J],[`lifecycle`,J],[`error`,Xe],[`session.error`,Ze],[`step-end`,Qe],[`check-output`,$e],[`provider-auth-required`,et],[`image`,tt],[`plan.updated`,nt],[`session.started`,e=>z(e)],[`session.ended`,rt],[`permission.requested`,st],[`permission.resolved`,ct],[`ask.requested`,lt],[`worker-question-routed`,ut],[`worker-question-fallback`,dt],[`worker-question-undelivered`,ft],[`human-ask-closed`,mt],[`human-input-delivered`,Z],[`step-start`,Q],[`token-usage`,Q],[`cost`,Q],[`turn-end`,Q],[`done`,Q],[`session`,Q]]);function gt(e,t){ht.get(t.type)?.(e,t)}function _t(e){for(let t=e.turns.length-1;t>=0;--t){let n=e.turns[t].planEntries;if(n!==void 0)return n}}function vt(e){let t=[];for(let n of e.turns)for(let e of n.items)if(e.kind===`tool`){for(let n of e.locations??[])t.push(n.path);for(let n of e.diffs??[])t.push(n.path)}let n=[];for(let e=t.length-1;e>=0;--e)n.includes(t[e])||n.push(t[e]);return n}function yt(e,t){switch(e){case`waiting`:return{state:`waiting`};case`failed`:return{state:`closed`,tone:`danger`,label:t?`Session failed — ${t}`:`Session failed`};case`review`:return{state:`closed`,tone:`dim`,label:`Session closed — waiting for your review`};case`done`:case`cancelled`:return{state:`closed`,tone:`dim`,label:`Session closed`};default:return null}}function $(e,t){let n=e.replace(/\s*CEZ:DONE\s*$/,``).replace(/\s*CEZ:MONITORING\s*$/,``);if(t){let e=n.trimEnd(),t=e.lastIndexOf(`
|
|
1
|
+
import{t as e,u as t}from"./button-CHUAMTHK.js";import{t as n}from"./react-runtime-CCIEwYL0.js";import{_r as r,vr as i}from"./project-scope-context-CaUqlAd7.js";import{U as a,_ as o,f as s,g as c,h as l,m as u,q as d}from"./live-protocol-BDY7JJpT.js";import{a as ee}from"./loader-circle-CZkGEdoI.js";import{t as f}from"./createLucideIcon-BHp8sXmF.js";import{t as p}from"./app-window-CSHwDX9N.js";import{Bt as te,Lt as ne,dt as re,ft as ie,ot as ae,qt as oe}from"./index-D489J7QW.js";var m=f(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),h=f(`server`,[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]),g=n(),_={registered:e=>e.server.answeredAtRegistration?{label:`Open`,run:!1}:{label:`Run and open`,run:!0},adopted:()=>({label:`Open`,run:!1}),starting:()=>({label:`Open`,run:!1}),up:()=>({label:`Open`,run:!1}),stalled:()=>({label:`View`,run:!1}),exited:()=>({label:`Start again`,run:!0}),stopped:()=>({label:`Start again`,run:!0}),unavailable:()=>void 0};function v(e){let{text:t,...n}=ie(e),r={...n,status:t},i=_[e.state](e);return i?{...r,action:i}:r}var se={"Run and open":te,Open:p,View:oe,"Start again":m};function ce({entry:e,inPreview:n,onOpen:r}){let{server:i}=e,a=v(e),o=e.state===`unavailable`,s=r?a.action:void 0,c=re(i.command),l=ee(i.registeredAt);return(0,g.jsxs)(`div`,{"data-slot":`preview-server-card`,"data-state":e.state,className:t(`min-w-0 rounded-lg border border-border bg-card px-3.5 py-3 text-sm`,o&&`text-muted-foreground`),children:[(0,g.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2 text-xs text-soft-foreground`,children:[(0,g.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5 font-mono`,children:[(0,g.jsx)(h,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),(0,g.jsx)(`span`,{className:`truncate`,children:`cezar_preview_serve`})]}),o?(0,g.jsx)(`span`,{children:`worktree removed`}):l?(0,g.jsxs)(`span`,{children:[l,` ago`]}):null]}),(0,g.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-x-3 gap-y-2`,children:[(0,g.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,g.jsx)(ae,{tone:a.tone,shape:a.ring?`ring`:`filled`,pulse:a.pulse===!0,"aria-hidden":`true`}),(0,g.jsx)(`span`,{className:`font-semibold text-foreground`,children:i.label}),(0,g.jsxs)(`span`,{className:`font-mono text-muted-foreground`,children:[`:`,i.port]}),(0,g.jsx)(`span`,{className:`text-muted-foreground`,children:a.status})]}),(0,g.jsx)(le,{entry:e,inPreview:n,action:s,onOpen:r})]}),(0,g.jsxs)(`div`,{className:`mt-2.5 min-w-0 rounded-md bg-muted px-3 py-2 font-mono text-xs`,children:[(0,g.jsx)(`p`,{className:`break-words whitespace-pre-wrap text-foreground`,children:i.command}),i.cwd?(0,g.jsxs)(`p`,{className:`mt-1 flex gap-3 text-soft-foreground`,children:[(0,g.jsx)(`span`,{children:`cwd`}),(0,g.jsx)(`span`,{className:`break-all`,children:i.cwd})]}):null]}),s?.run?(0,g.jsx)(y,{icon:(0,g.jsx)(ne,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),children:`${s.label===`Start again`?`Starting again`:`Opening`} runs ${c} in this task's worktree, on the host.`}):null,o?(0,g.jsx)(y,{children:`The worktree this server ran in is gone. Register it again from a new task.`}):null]})}function le({entry:t,inPreview:n,action:r,onOpen:i}){let{server:a}=t,o=n&&r!==void 0&&!r.run,s=o?`In preview`:r?.label,c=o?p:r?se[r.label]:null;return r&&s&&c?(0,g.jsxs)(e,{variant:o||r.label===`View`||r.label===`Open`&&t.state===`starting`?`outline`:`contrast`,size:`sm`,className:`max-md:h-11 max-md:px-3.5`,onClick:()=>i?.({port:a.port,run:r.run}),children:[(0,g.jsx)(c,{"aria-hidden":`true`}),s]}):null}function y({icon:e,children:t}){return(0,g.jsxs)(`p`,{className:`mt-2.5 flex items-start gap-2 text-xs text-muted-foreground`,children:[e,(0,g.jsx)(`span`,{children:t})]})}var b=120;function x(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function S(e){let t=e.replace(/\s+/g,` `).trim();return t.length>b?`${t.slice(0,b-1)}…`:t}function C(e,...t){if(x(e))for(let n of t){let t=e[n];if(typeof t==`string`&&t.trim()!==``)return S(t)}}function ue(e){if(!x(e))return;let t=e.command;if(typeof t==`string`&&t.trim()!==``)return S(t);if(Array.isArray(t)){let e=t.filter(e=>typeof e==`string`);if(e.length>0)return S(e.join(` `))}}function de(e){if(!x(e)||!Array.isArray(e.changes))return[];let t=[];for(let n of e.changes)x(n)&&typeof n.path==`string`&&n.path.trim()!==``&&t.push(n.path);return t}function w(e){return C(e,`description`,`query`,`url`,`filePath`,`file_path`,`path`,`pattern`,`name`)}function T(e,t){return t?`${e} ${t}`:e}var fe=new Map([[`bash`,`execute`],[`commandexecution`,`execute`],[`edit`,`edit`],[`multiedit`,`edit`],[`write`,`edit`],[`notebookedit`,`edit`],[`filechange`,`edit`],[`read`,`read`],[`imageview`,`read`],[`glob`,`search`],[`grep`,`search`],[`webfetch`,`fetch`],[`websearch`,`fetch`],[`task`,`task`],[`agent`,`task`],[`skill`,`task`],[`todowrite`,`plan`],[`todolist`,`plan`],[`plan`,`plan`],[`taskcreate`,`plan`],[`taskupdate`,`plan`],[`tasklist`,`plan`],[`contextcompaction`,`other`],[`mcptoolcall`,`other`]]);function pe(e,t){switch(e){case`write`:return{toolKind:`edit`,title:T(`Write`,C(t,`file_path`,`filePath`,`path`))};case`notebookedit`:return{toolKind:`edit`,title:T(`Edit`,C(t,`notebook_path`,`notebookPath`,`file_path`,`filePath`,`path`))};case`filechange`:{let e=de(t);return{toolKind:`edit`,title:T(`Edit`,e.length===1?e[0]:e.length>1?`${e.length} files`:void 0)}}default:return{toolKind:`edit`,title:T(`Edit`,C(t,`file_path`,`filePath`,`path`))}}}function me(e,t){return e===`imageview`?{toolKind:`read`,title:T(`View image`,C(t,`path`))}:{toolKind:`read`,title:T(`Read`,C(t,`file_path`,`filePath`,`path`))}}function he(e,t){return e===`webfetch`?{toolKind:`fetch`,title:T(`Fetch`,C(t,`url`))}:{toolKind:`fetch`,title:T(`Web search`,C(t,`query`))}}function ge(e,t){if(e===`skill`){let e=C(t,`skill`,`name`,`command`);return{toolKind:`task`,title:e?`Skill: ${e}`:`Skill`,subtitle:C(t,`args`,`description`)}}let n=e===`agent`?`Agent`:`Task`,r=C(t,`subagent_type`,`subagentType`),i=C(t,`description`,`prompt`)??r;return{toolKind:`task`,title:i?`${n}: ${i}`:n,subtitle:i===r?void 0:r}}function _e(e,t,n){if(t===`contextcompaction`)return{toolKind:`other`,title:`Compacted context`};if(t===`mcptoolcall`){let e=C(n,`server`),t=C(n,`tool`);return e&&t?{toolKind:`other`,title:`${e}.${t}`}:{toolKind:`other`,title:`MCP tool`,subtitle:w(n)}}if(t.startsWith(`mcp__`)){let t=e.split(`__`).filter(e=>e!==``);if(t.length>=3)return{toolKind:`other`,title:`${t[1]}.${t.slice(2).join(`__`)}`}}return{toolKind:`other`,title:typeof e==`string`&&e.trim()!==``?S(e):`Tool`,subtitle:w(n)}}function ve(e,t){let n=typeof e==`string`?e.toLowerCase():``;switch(fe.get(n)){case`execute`:return{toolKind:`execute`,title:T(`Ran`,ue(t)),subtitle:C(t,`description`)};case`edit`:return pe(n,t);case`read`:return me(n,t);case`search`:return{toolKind:`search`,title:T(`Search`,C(t,`pattern`,`query`)),subtitle:C(t,`path`)};case`fetch`:return he(n,t);case`task`:return ge(n,t);case`plan`:return{toolKind:`plan`,title:`Update plan`};default:return _e(e,n,t)}}function ye(e,t){if(t.type===`ask.requested`&&typeof t.requestId==`string`&&a.safeParse({questions:t.questions}).success)return t;if(t.type===`human-input-delivered`||t.type===`human-ask-closed`){let n=(t.type===`human-input-delivered`?c:l).safeParse(t);if(n.success&&n.data.askSeq===e?.seq)return}return e}function E(e){if(!(e.type!==`ask.requested`||typeof e.requestId!=`string`))return{requestId:e.requestId,questions:e.questions,...e.context===void 0?{}:{context:e.context}}}function D(e){let t=E(e);return t&&{seq:e.seq,...t}}function O(e,t){let n=ye(e&&{type:`ask.requested`,seq:e.seq,ts:``},t);return n===t?D(t):n===void 0?void 0:e}function k(e){let t;for(let n of e)t=O(t,n);return t}function A(e){let t=Array.isArray(e.questions)?e.questions.filter(e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&typeof e.header==`string`&&(e.options===void 0||Array.isArray(e.options))):[];if(t.length===0)return;let n=typeof e.context==`string`&&e.context!==``?e.context:void 0;return{id:e.requestId,questions:t,...n===void 0?{}:{context:n},askSeq:e.seq}}function j(){return{turns:[],itemsById:new Map,turnSeq:0,permissions:new Map,conversationEntries:new Map,outcomesByRequest:new Map,seenInputs:new Set,previewByPort:new Map,handedOff:!1}}function M(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function N(e){return typeof e==`string`?e:void 0}function P(e){let t=typeof e==`string`?new Date(e):void 0;return!t||Number.isNaN(t.getTime())?``:` · ${t.toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`})}`}function F(e){if(!(typeof e!=`string`||e===``))return Number.isFinite(new Date(e).getTime())?e:void 0}var be=new Set(d.options);function xe(e){return typeof e==`string`&&be.has(e)?e:void 0}function I(e,t){e.turnSeq+=1;let n={id:t===void 0?`turn-fallback-${e.turnSeq}`:`turn-seq-${t}`,entries:[],v2Items:!1};return e.turns.push(n),n}function L(e){return e.turns.at(-1)??I(e)}function R(e,t){L(e).entries.push({origin:`meta`,entry:t})}function z(e){for(let t of e.permissions.values())t.status===`pending`&&(t.status=`expired`)}function B(e,t){let n=N(e.stepId);return n===void 0?t:`${n}:${t}`}function Se(e,t){t.v2Items=!0;for(let n of t.entries)n.origin===`v1`&&n.entry.kind===`tool`&&e.itemsById.delete(n.entry.id);t.entries=t.entries.filter(e=>!(e.origin===`v1`&&e.entry.kind===`tool`))}function Ce(e,t,n,r,i){let a=n.kind===`message`&&i!==void 0?{...n,ts:i}:{...n};!t.v2Items&&a.kind!==`hook`&&Se(e,t);let o=e.itemsById.get(r);if(o&&o.turn===t){o.entry.entry=a;return}let s={origin:`v2`,entry:a};t.entries.push(s),e.itemsById.set(r,{turn:t,entry:s})}var V={"not-delivered":0,queued:1,delivered:2,consumed:3},we=[`instruction`,`resumed`,`requestId`,`relationship`,`state`,`createdAt`,`requestHash`,`deadline`];function H(e){let t={};for(let n of we)e[n]!==void 0&&Object.assign(t,{[n]:e[n]});return t}function U(e,t){if(t.messageKind!==`request`)return;let n=e.outcomesByRequest.get(t.messageId);n&&(t.outcome={status:n.status,...n.replyId===void 0?{}:{replyId:n.replyId},observedAt:n.observedAt})}function Te(e,t){let n=e.conversationEntries.get(t);n&&U(e,n)}function Ee(e,t,n,r){(V[e.delivery]<V.delivered||V[n]>V[e.delivery])&&(e.delivery=n),t.text!==``&&(e.text=t.text),Object.assign(e,H(t)),r.deliveredAt!==void 0&&(e.deliveredAt=r.deliveredAt),r.consumedAt!==void 0&&(e.consumedAt=r.consumedAt),r.recordedAt!==void 0&&(n===`delivered`||e.delivery!==`delivered`)&&(e.recordedAt=r.recordedAt)}function W(e,t,n,r){let i=e.conversationEntries.get(t.id);if(i){Ee(i,t,n,r),U(e,i);return}let a={kind:`conversation`,id:`conversation-message:${t.id}`,messageId:t.id,text:t.text,senderRunId:t.senderRunId,recipientRunId:t.recipientRunId,messageKind:t.kind,delivery:n,...r,...H(t)};U(e,a),e.conversationEntries.set(t.id,a),R(e,a)}function De(e,t){let n=P(t.ts),r=N(t.message),i=t.notify===!1?`Stopped notifying the webhook${n}`:`${e.handedOff?`Note sent to webhook`:`Handed off to webhook`}${n}${r?` — ${r}`:``}`;e.handedOff=t.notify!==!1,R(e,{kind:`note`,id:`v1:${t.seq}`,text:i,tone:`dim`,icon:`handoff`})}function Oe(e,t){let n=typeof t.attempts==`number`?t.attempts:void 0,r=N(t.webhookName),i=`${r?`Delivery to ${r} failed`:`Webhook delivery failed`}${N(t.event)?` (${N(t.event)})`:``}${n?` after ${n} attempt${n===1?``:`s`}`:``}: ${N(t.error)??`unknown error`}`;R(e,{kind:`note`,id:`v1:${t.seq}`,text:i,tone:`danger`})}function ke(e,t){let n=N(t.webhookName)??`webhook`,r=N(t.title),i=`v1:${t.seq}`;if(t.ok===!1){R(e,{kind:`note`,id:i,text:`Report to ${n} failed: ${N(t.error)??`unknown error`}`,tone:`danger`});return}let a=`${t.dryRun===!0?`Report to ${n} (dry run, nothing sent)`:`Sent report to ${n}`}${P(t.ts)}${r?` — ${r}`:``}`;R(e,t.dryRun===!0?{kind:`note`,id:i,text:a,tone:`dim`}:{kind:`note`,id:i,text:a,tone:`dim`,icon:`handoff`})}function Ae(e,t){let n=t.payload??{},r=`Webhook (dry run, nothing sent): ${N(t.event)??`delivery`}${N(n.status)?` · ${N(n.status)}`:``}`;R(e,{kind:`note`,id:`v1:${t.seq}`,text:r,tone:`dim`})}function je(e,t){let n=r.safeParse(t.server);if(!n.success)return;let i=e.previewByPort.get(n.data.port);i&&(i.turn.entries=i.turn.entries.filter(e=>e!==i.draft));let a=L(e),o={origin:`meta`,entry:{kind:`preview-server`,id:`preview-server:${n.data.port}`,server:n.data,state:`registered`,stateAt:t.ts}};a.entries.push(o),e.previewByPort.set(n.data.port,{turn:a,draft:o})}function Me(e,t){let n=i.safeParse(t.state),r=typeof t.port==`number`?e.previewByPort.get(t.port):void 0;if(!n.success||!r||r.draft.entry.kind!==`preview-server`)return;let{server:a,id:o}=r.draft.entry;r.draft.entry={kind:`preview-server`,id:o,server:a,state:n.data,stateAt:t.ts,...typeof t.exitCode==`number`?{exitCode:t.exitCode}:{},...t.reason===`user`||t.reason===`idle`?{reason:t.reason}:{}}}function Ne(e,t){let n=u.safeParse(t);if(!n.success)return;let{message:r,delivery:i,deliveredAt:a,consumedAt:o,ts:s}=n.data;W(e,r,i,{deliveredAt:a,consumedAt:o,recordedAt:s})}function Pe(e,t){let n=o.safeParse(t);if(!n.success)return;let{outcome:r}=n.data,i=e.outcomesByRequest.get(r.requestId);i&&!(i.status===`timed-out`&&r.status===`replied-late`)||(e.outcomesByRequest.set(r.requestId,r),Te(e,r.requestId))}function Fe(e,t){let n=s.safeParse(t);if(!n.success)return;let{input:r}=n.data;if(!e.seenInputs.has(r.id)){if(e.seenInputs.add(r.id),r.conversation){W(e,{id:r.id,text:r.text,createdAt:r.createdAt,...r.conversation},`delivered`,{deliveredAt:r.deliveredAt,recordedAt:n.data.ts});return}R(e,{kind:`note`,id:`agent-input:${r.id}`,text:r.text,tone:`dim`,attribution:{source:r.source,parentRunId:r.parentRunId}})}}function Ie(e,t){let n=N(t.text)??``,r=e.pendingAsk;e.pendingAsk&&!e.pendingAsk.resolved&&(e.pendingAsk.resolved=!0,e.pendingAsk.answeredBy=`human`,n!==``&&(e.pendingAsk.answer=n),e.pendingAsk=void 0);let i=I(e,t.seq),a=F(t.ts);i.userMessage={text:n,ask:r,imageCount:typeof t.imageCount==`number`?t.imageCount:0,images:Array.isArray(t.images)?t.images.filter(e=>typeof e==`string`):[],...a===void 0?{}:{ts:a}},a!==void 0&&(i.startedAt=a)}function Le(e,t){let n=e.turns.at(-1),r=n&&n.turnId===void 0&&!n.v2Items?n:I(e,t.seq);r.turnId=N(t.turnId),r.startedAt??=F(t.ts)}function Re(e,t){for(let n=e.turns.length-1;n>=0;--n)if(e.turns[n].turnId===t)return e.turns[n];return e.turns.at(-1)}function ze(e,t){z(e);let n=Re(e,N(t.turnId));if(!n)return;let r=F(t.ts);n.completed={stopReason:N(t.stopReason)??`end_turn`,...typeof t.costUsd==`number`?{costUsd:t.costUsd}:{},...r===void 0?{}:{ts:r}}}var G=new Set([`message`,`reasoning`,`tool`,`hook`]),Be=e=>G.has(e.kind);function Ve(e){if(!(!M(e)||!G.has(e.kind)))return typeof e.id==`string`&&e.id!==``?e:void 0}function K(e,t){let n=Ve(t.item);if(!n)return;let r=B(t,n.id);Ce(e,e.itemsById.get(r)?.turn??L(e),n,r,t.type===`item.completed`?F(t.ts):void 0)}function He(e,t){let n=e.itemsById.get(B(t,N(t.itemId)??``)),r=N(t.delta)??``;if(!n||r===``||!Be(n.entry.entry))return;let i=n.entry.entry;t.field===`output`&&i.kind===`tool`?i.output=(i.output??``)+r:t.field!==`output`&&(i.kind===`message`||i.kind===`reasoning`)&&(i.text+=r)}function Ue(e,t){let n=L(e),r=N(t.text)??``;if(r===``)return;let i=F(t.ts);n.entries.push({origin:`v1`,entry:{kind:`message`,id:`v1:${t.seq}`,role:`assistant`,text:r,...i===void 0?{}:{ts:i}}})}var We=new Set([`pending`,`in_progress`,`completed`,`cancelled`]);function Ge(e){if(!M(e)||!Array.isArray(e.todos))return;let t=[];for(let n of e.todos){if(!M(n)||typeof n.content!=`string`)return;t.push({content:n.content,status:We.has(n.status)?n.status:`pending`,...typeof n.activeForm==`string`?{activeForm:n.activeForm}:{}})}return t}var Ke=new Set([`subAgentActivity`,`collabAgentToolCall`,`collabToolCall`]);function qe(e,t){let n=L(e),r=N(t.tool)??`Tool`;if(n.v2Items||Ke.has(r))return;let i=ve(r,t.input),a=i.toolKind===`plan`?Ge(t.input):void 0;a!==void 0&&(n.planEntries=a);let o={kind:`tool`,id:N(t.id)??`v1:${t.seq}`,name:r,toolKind:i.toolKind,title:i.title,status:`running`,input:t.input},s={origin:`v1`,entry:o};n.entries.push(s),e.itemsById.set(o.id,{turn:n,entry:s})}function Je(e){if(typeof e==`string`)return e;if(e==null)return``;try{return JSON.stringify(e)}catch{return String(e)}}function Ye(e,t){let n=e.itemsById.get(N(t.toolCallId)??``);if(!n||n.turn.v2Items||n.entry.origin!==`v1`)return;let r=n.entry.entry;r.kind===`tool`&&(r.status=`completed`,r.output=Je(t.result))}function q(e,t,n,r){let i=N(t.message)??``;i!==``&&R(e,{kind:`note`,id:n,text:i,tone:r})}function J(e,t){q(e,t,`v1:${t.seq}`,t.tone===`danger`?`danger`:`dim`)}function Xe(e,t){q(e,t,`v1:${t.seq}`,`danger`)}function Ze(e,t){q(e,t,`v2:${t.seq}`,`danger`)}function Qe(e,t){if(t.status!==`failed`)return;let n=N(t.error)?` — ${N(t.error)}`:``;R(e,{kind:`note`,id:`v1:${t.seq}`,text:`step ${N(t.stepId)??`?`} failed${n}`,tone:`danger`})}function $e(e,t){let n=N(t.command)??`check`,r=typeof t.exitCode==`number`?t.exitCode:-1;R(e,{kind:`tool`,id:`v1:${t.seq}`,name:`check`,toolKind:`execute`,title:`Ran ${n}`,status:r===0?`completed`:`failed`,output:N(t.text)??``,exitCode:r})}function et(e,t){let n=xe(t.provider),r=N(t.authFailureId)??``;n===void 0||r.length<1||r.length>128||R(e,{kind:`provider-auth-required`,id:`v1:${t.seq}`,provider:n,authFailureId:r})}function tt(e,t){let n=N(t.url);if(n===void 0)return;let r={kind:`image`,id:`v1:${t.seq}`,url:n},i=N(t.name);i!==void 0&&(r.name=i),R(e,r)}function nt(e,t){Array.isArray(t.entries)&&(L(e).planEntries=t.entries)}function rt(e,t){z(e);let n=N(t.message);e.sessionEnded={reason:N(t.reason)??`end_turn`,...n===void 0?{}:{message:n}}}var it=new Set([`allow_once`,`allow_always`,`reject_once`,`reject_always`]);function at(e){return M(e)&&typeof e.id==`string`&&e.id!==``&&typeof e.label==`string`&&e.label!==``&&it.has(e.kind)}function ot(e){if(!(!Array.isArray(e)||e.length===0||!e.every(at)))return new Set(e.map(e=>e.id)).size===e.length?e:void 0}function st(e,t){let n=N(t.requestId),r=N(t.title),i=ot(t.options);if(!n||!r||e.permissions.has(n)||!i)return;let a=N(t.itemId),o=N(t.details),s={kind:`permission`,id:`permission:${n}`,requestId:n,title:r,options:i.map(e=>({...e})),status:`pending`,...a===void 0?{}:{itemId:a},...o===void 0?{}:{details:o}};e.permissions.set(n,s),R(e,s)}function ct(e,t){let n=e.permissions.get(N(t.requestId)??``);if(!n||n.status!==`pending`)return;let r=N(t.optionId);r!==void 0&&n.options.some(e=>e.id===r)?(n.status=`resolved`,n.optionId=r):n.status=`expired`;let i=N(t.reason);i!==void 0&&(n.reason=i)}function lt(e,t){let n=D(t),r=n&&A(n);if(!r)return;let i={kind:`ask`,...r,questions:r.questions,resolved:!1};R(e,i),e.pendingAsk=i}function Y(e,t){let n=e.pendingAsk;return n&&!n.resolved&&n.askSeq===t.askSeq?n:void 0}function ut(e,t){let n=Y(e,t);if(!n)return;n.routedToParent=!0;let r=N(t.parentRunId);r!==void 0&&(n.parentRunId=r)}function dt(e,t){let n=Y(e,t);n&&(n.routedToParent=!1)}function ft(e,t){let n=Y(e,t);n&&X(e,n,`undeliverable`)}var pt=new Set([`finish`,`superseded`,`parent-stopped`,`worker-stopped`,`undeliverable`]);function mt(e,t){let n=Y(e,t);n&&pt.has(t.reason)&&X(e,n,t.reason)}function X(e,t,n){t.resolved=!0,t.closed=n,e.pendingAsk=void 0}function Z(e,t){let n=Y(e,t);if(n){if(t.source===`cezar`){X(e,n,`undeliverable`);return}t.source===`parent`&&(n.resolved=!0,n.answeredBy=`parent`,e.pendingAsk=void 0)}}var Q=()=>{},ht=new Map([[`handoff`,De],[`webhook.failed`,Oe],[`webhook.dry-run`,Ae],[`webhook.report`,ke],[`preview.server-registered`,je],[`preview.server-state`,Me],[`conversation-message`,Ne],[`request-outcome`,Pe],[`agent-input`,Fe],[`user-message`,Ie],[`turn.started`,Le],[`turn.completed`,ze],[`item.started`,K],[`item.updated`,K],[`item.completed`,K],[`item.delta`,He],[`text`,Ue],[`tool-call`,qe],[`tool-result`,Ye],[`note`,J],[`lifecycle`,J],[`error`,Xe],[`session.error`,Ze],[`step-end`,Qe],[`check-output`,$e],[`provider-auth-required`,et],[`image`,tt],[`plan.updated`,nt],[`session.started`,e=>z(e)],[`session.ended`,rt],[`permission.requested`,st],[`permission.resolved`,ct],[`ask.requested`,lt],[`worker-question-routed`,ut],[`worker-question-fallback`,dt],[`worker-question-undelivered`,ft],[`human-ask-closed`,mt],[`human-input-delivered`,Z],[`step-start`,Q],[`token-usage`,Q],[`cost`,Q],[`turn-end`,Q],[`done`,Q],[`session`,Q]]);function gt(e,t){ht.get(t.type)?.(e,t)}function _t(e){for(let t=e.turns.length-1;t>=0;--t){let n=e.turns[t].planEntries;if(n!==void 0)return n}}function vt(e){let t=[];for(let n of e.turns)for(let e of n.items)if(e.kind===`tool`){for(let n of e.locations??[])t.push(n.path);for(let n of e.diffs??[])t.push(n.path)}let n=[];for(let e=t.length-1;e>=0;--e)n.includes(t[e])||n.push(t[e]);return n}function yt(e,t){switch(e){case`waiting`:return{state:`waiting`};case`failed`:return{state:`closed`,tone:`danger`,label:t?`Session failed — ${t}`:`Session failed`};case`review`:return{state:`closed`,tone:`dim`,label:`Session closed — waiting for your review`};case`done`:case`cancelled`:return{state:`closed`,tone:`dim`,label:`Session closed`};default:return null}}function $(e,t){let n=e.replace(/\s*CEZ:DONE\s*$/,``).replace(/\s*CEZ:MONITORING\s*$/,``);if(t){let e=n.trimEnd(),t=e.lastIndexOf(`
|
|
2
2
|
`)+1;/^CEZ:ASK[ \t]+.+$/.test(e.slice(t))&&(n=e.slice(0,t).trimEnd())}return n.includes(`CEZ:`)?n.split(`
|
|
3
3
|
`).filter(e=>!/^CEZ:(?:PR=\d+|ISSUE=\d+|TITLE=.+)\s*$/.test(e)).join(`
|
|
4
4
|
`):n}function bt(e){let t=e=>$(e,!0).replace(/\s+/g,``),n=new Set,r=[];for(let{origin:i,entry:a}of e.entries)if(i===`v2`&&a.kind===`message`){let e=t(a.text);n.add(e),r.push(e)}if(r.length===0)return;n.add(r.join(``));let i=[],a={entries:[],texts:[]},o=()=>{if(a.entries.length>=2&&n.has(t(a.texts.join(``)))){a={entries:[],texts:[]};return}i.push(...a.entries),a={entries:[],texts:[]}};for(let t of e.entries)t.origin===`v1`&&t.entry.kind===`message`?(a.entries.push(t),a.texts.push(t.entry.text)):(o(),i.push(t));o(),e.entries=i}function xt(e){let t=new Set;for(let{origin:n,entry:r}of e.entries)n===`v2`&&r.kind===`message`&&t.add($(r.text,!0).trim());t.size!==0&&(e.entries=e.entries.filter(e=>!(e.origin===`v1`&&e.entry.kind===`message`&&t.has($(e.entry.text,!0).trim()))),bt(e))}function St(e){for(let t of e.conversationEntries.values())t.messageKind!==`request`||t.outcome!==void 0||t.delivery!==`not-delivered`&&(t.state!==void 0&&t.state!==`accepted`||(t.outcome={status:`pending`}))}function Ct(e,t){let n=t||e.entries.some(({entry:e})=>e.kind===`ask`);return{id:e.id,...e.turnId===void 0?{}:{turnId:e.turnId},...e.userMessage===void 0?{}:{userMessage:e.userMessage},...e.startedAt===void 0?{}:{startedAt:e.startedAt},...e.planEntries===void 0?{}:{planEntries:e.planEntries},...e.completed===void 0?{}:{completed:e.completed},items:e.entries.map(({entry:e})=>e.kind===`message`&&e.role===`assistant`?{...e,text:$(e.text,n)}:e)}}function wt(e,t={}){let n=j();for(let t of e)gt(n,t);for(let e of n.turns)e.v2Items&&xt(e);St(n);let r=n.turns.length-1;return{turns:n.turns.map((e,n)=>Ct(e,t.activeTurn===!0&&n===r)),...n.sessionEnded===void 0?{}:{sessionEnded:n.sessionEnded}}}export{k as a,m as c,yt as i,wt as n,ce as o,vt as r,h as s,_t as t};
|
package/web/dist/assets/{use-hand-to-agent-state-C6u70P2A.js → use-hand-to-agent-state-BkmKad8x.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{d as t,t as n,u as r}from"./button-CHUAMTHK.js";import{i,t as a}from"./react-runtime-CCIEwYL0.js";import{Jr as o,Vt as s,it as c,nn as l,r as u,rt as d,w as f,wr as p}from"./project-scope-context-B3M-u8R0.js";import{M as m,O as h,P as g,Pt as _,Rt as v,Tt as y,Un as b,et as x,h as S,jt as C,n as w,rt as T}from"./queries-DORTKwyN.js";import{t as E}from"./useQuery-CqqnAJvu.js";import{n as D}from"./toaster-B1MyeHiE.js";import{C as ee,b as O,u as k,v as A}from"./github-sidebar-model-B0Ufci5S.js";import{i as j,r as M,s as N,t as P}from"./popover-DRcRI46x.js";import{A as F,Z as I,_ as L,b as te,ct as R,d as ne,ft as re,h as ie,l as z,mt as ae,ot as oe,r as se,rt as ce,u as le,ut as ue}from"./design-icons-DmYTv2r1.js";import{a as de,c as fe,i as pe,n as me,o as he,s as ge,t as _e}from"./textarea-DlVUfdWG.js";import{a as B,t as ve}from"./loader-circle-CZkGEdoI.js";import{t as ye}from"./eye-B8okNWXU.js";import{t as be}from"./message-square-B-MD-8rD.js";import{t as V}from"./project-router-MMOk9VbW.js";import{A as xe,B as Se,E as Ce,H as we,I as Te,L as Ee,M as De,O as Oe,V as ke,_ as Ae,a as je,b as Me,f as Ne,g as Pe,i as Fe,j as Ie,k as H,m as Le,n as Re,p as ze,r as U,s as Be,t as Ve,v as He,w as Ue,z as We}from"./agent-accounts-f1cxwgfz.js";import{d as Ge,f as Ke,i as qe,s as Je,t as Ye,u as Xe}from"./skills-DFBiAuJG.js";import{t as Ze}from"./markdown-D7DUNWcJ.js";import{Bt as Qe,Mt as $e,Nt as et,Qt as tt}from"./index-FoxgrgAH.js";import{t as nt}from"./diff-DNAtaTLC.js";import{t as rt}from"./tab-link-BvoGfK8S.js";var W=e(i(),1),G=a(),it={squash:`Squash and merge`,merge:`Create a merge commit`,rebase:`Rebase and merge`};function K({state:e}){let t=`size-4 shrink-0`;return e===`passing`?(0,G.jsx)(z,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-passing`,className:r(t,`text-success`)}):e===`failing`?(0,G.jsx)(L,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-failing`,className:r(t,`text-danger`)}):e===`pending`?(0,G.jsx)(ve,{"aria-hidden":`true`,"data-slot":`gh-merge-status-pending`,className:r(t,`animate-spin text-warning`)}):(0,G.jsx)(ie,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-unknown`,className:r(t,`text-soft-foreground`)})}function at(e){return e?.available?e.mergeState:null}function ot(e,t){return e&&t?.methods.includes(e)?e:t?.defaultMethod??t?.methods[0]??null}function st(e){return e.state===`merged`?`Merged`:e.state===`closed`?`Closed`:e.isDraft?`Draft`:e.mergeable===`conflicting`?`Conflicts must be resolved`:e.canMerge?`Ready to merge`:e.eligibility===`unknown`?`Merge blocked · Requirements unknown`:`Merge blocked`}function ct(e){return e===`approved`||e===`not-required`?`passing`:e===`unknown`?`unknown`:`failing`}function lt(e){return e===`mergeable`?`passing`:e===`conflicting`?`failing`:`unknown`}function ut(e){return e===`conflicting`?`present`:e===`mergeable`?`none`:`unknown`}function dt(e){return e===!0?` · required`:e===null?` · requiredness unknown`:``}function ft(e){return e?.available===!1?e.reason:`GitHub could not load merge requirements.`}function pt(e,t,n){return!!(e&&(t.canMerge||t.canOverride&&n))}function q(e){return e?it[e]:`Merge`}function mt(e){return e===`conflicting`?`true`:void 0}function ht({check:e}){return(0,G.jsxs)(`li`,{className:`flex items-center justify-between gap-3`,children:[(0,G.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,G.jsx)(K,{state:e.state}),(0,G.jsxs)(`span`,{children:[e.name,` · `,e.state,dt(e.required)]})]}),e.url&&t(e.url)?(0,G.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`text-muted-foreground underline`,children:`details`}):null]})}function gt({reason:e}){return(0,G.jsxs)(`section`,{"data-slot":`gh-merge-unavailable`,className:`mt-6 rounded-lg border border-border bg-card p-4 text-sm`,children:[(0,G.jsx)(`p`,{className:`font-medium`,children:`Merge status unavailable`}),(0,G.jsx)(`p`,{className:`mt-1 text-xs text-soft-foreground`,children:e})]})}function _t({state:e,selectedMethod:t,overrideRules:i,mergeEnabled:a,refreshPending:o,onRefresh:s,onRunAgent:c,onConfirm:l,onMethodChange:u,onOverrideChange:d}){let f=st(e),p=ct(e.reviewDecision),m=lt(e.mergeable);return(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[e.canMerge?(0,G.jsx)(z,{size:16,"aria-hidden":`true`,className:`mt-0.5 size-5 shrink-0 text-success`}):(0,G.jsx)(R,{size:16,"aria-hidden":`true`,className:`mt-0.5 size-5 shrink-0 text-warning`}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,G.jsx)(`h3`,{className:`font-semibold`,children:f}),(0,G.jsxs)(n,{type:`button`,variant:`ghost`,size:`sm`,disabled:o,onClick:s,children:[(0,G.jsx)(I,{size:16,"aria-hidden":`true`,className:r(`size-3.5`,o&&`animate-spin`)}),`Refresh`]})]}),(0,G.jsxs)(`p`,{className:`mt-1 font-mono text-[11px] text-soft-foreground`,children:[e.headRef,` (`,e.headSha.slice(0,7),`) → `,e.baseRef]}),(0,G.jsxs)(`ul`,{className:`mt-3 space-y-2 text-xs`,children:[(0,G.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(K,{state:p}),(0,G.jsxs)(`span`,{children:[`Reviews: `,e.reviewDecision.replaceAll(`-`,` `)]})]}),(0,G.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(K,{state:m}),(0,G.jsxs)(`span`,{children:[`Conflicts: `,ut(e.mergeable)]})]}),e.checks.length===0?(0,G.jsx)(`li`,{children:`No checks configured`}):e.checks.map(e=>(0,G.jsx)(ht,{check:e},e.name)),e.blockers.map(e=>(0,G.jsx)(`li`,{className:`text-soft-foreground`,children:e.message},e.code))]}),e.mergeable===`conflicting`&&c?(0,G.jsx)(n,{className:`mt-4`,onClick:c,children:`Run agent on this PR`}):null,e.canOverride?(0,G.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 rounded-md border border-warning/40 bg-warning/5 p-3 text-xs`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:i,onChange:e=>d(e.target.checked),className:`mt-0.5 size-4 accent-accent-strong`}),(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`span`,{className:`block font-medium`,children:`Merge without waiting for requirements`}),(0,G.jsx)(`span`,{className:`mt-0.5 block text-soft-foreground`,children:`GitHub will allow this only if your permissions can bypass the repository rules.`})]})]}):null,e.eligibility===`unknown`?(0,G.jsx)(`p`,{className:`mt-4 text-xs text-muted-foreground`,children:`GitHub could not confirm review and branch-protection requirements. Passing checks do not establish merge readiness.`}):null,e.state===`open`&&e.methods.length>0?(0,G.jsxs)(`div`,{className:`mt-4 flex flex-col flex-wrap gap-2 sm:flex-row`,children:[(0,G.jsx)(`select`,{"aria-label":`Merge method`,value:t??``,onChange:e=>u(e.target.value),className:`h-9 min-w-0 flex-1 rounded-md border border-input bg-background px-3 text-sm`,children:e.methods.map(e=>(0,G.jsx)(`option`,{value:e,children:it[e]},e))}),(0,G.jsx)(n,{disabled:!a,onClick:l,children:q(t)})]}):null]})]})}function vt({number:e,state:t,selectedMethod:r,confirming:i,overrideRules:a,mergePending:o,mergeError:s,onOpenChange:c,onMerge:l}){return(0,G.jsx)(me,{open:i,onOpenChange:c,children:(0,G.jsxs)(pe,{"data-slot":`gh-merge-confirm`,showCloseButton:!1,children:[(0,G.jsxs)(ge,{children:[(0,G.jsxs)(fe,{children:[q(r),` pull request #`,e,`?`]}),(0,G.jsx)(de,{asChild:!0,children:(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`p`,{children:[`This will merge “`,t.title,`” into `,t.baseRef,`. GitHub will re-check the exact reviewed head before changing the repository.`]}),a&&t.canOverride?(0,G.jsx)(`p`,{"data-slot":`gh-bypass-warning`,className:`mt-4 text-sm text-warning`,children:`You are asking GitHub to bypass unmet repository requirements; GitHub may refuse if your permissions do not allow it.`}):null]})})]}),s?(0,G.jsx)(`p`,{className:`text-sm text-danger`,children:s.message}):null,(0,G.jsxs)(he,{children:[(0,G.jsx)(n,{variant:`outline`,disabled:o,onClick:()=>c(!1),children:`Cancel`}),(0,G.jsx)(n,{disabled:o,onClick:l,children:o?`Merging…`:q(r)})]})]})})}function yt({number:e,onRunAgent:t}){let n=o(),r=T(),i=E({queryKey:w.githubMergeState(e),queryFn:({signal:t})=>c(e,{},{signal:t}),retry:!1}),a=at(i.data),[l,u]=(0,W.useState)(null),[d,f]=(0,W.useState)(!1),[p,m]=(0,W.useState)(!1),h=b({mutationFn:t=>c(e,{refresh:!0}),onSuccess:(e,t)=>n.setQueryData(t,e),onError:e=>D(e instanceof Error?e.message:String(e),{tone:`danger`})}),g=ot(l,a),_=()=>({mergeState:w.githubMergeState(e),list:w.githubPages(50),comments:w.githubComments(`pr`,e),item:w.githubItem(`pr`,e),refStatus:r===void 0?void 0:w.githubRefStatusOf(r)}),v=b({mutationFn:t=>{if(!a||!g)throw Error(`No merge method is available.`);return s(e,{method:g,expectedHeadSha:a.headSha,...p&&a.canOverride?{overrideRules:!0}:{}})},onSuccess:(t,r)=>{f(!1),D(`Pull request #${e} merged`),n.invalidateQueries({queryKey:r.mergeState}),n.invalidateQueries({queryKey:r.list}),n.invalidateQueries({queryKey:r.comments}),n.invalidateQueries({queryKey:r.item}),r.refStatus&&n.invalidateQueries({queryKey:r.refStatus})},onError:(e,t)=>{D(e instanceof Error?e.message:String(e),{tone:`danger`}),n.invalidateQueries({queryKey:t.mergeState})}});return i.isPending?(0,G.jsx)(A,{"data-slot":`gh-merge-loading`,className:`mt-6 h-32 w-full`}):a?(0,G.jsxs)(`section`,{"data-slot":`gh-merge-box`,"data-eligibility":a.eligibility,"data-conflicting":mt(a.mergeable),"aria-live":`polite`,className:`mt-6 rounded-lg border border-border bg-card p-4`,children:[(0,G.jsx)(_t,{state:a,selectedMethod:g,overrideRules:p,mergeEnabled:pt(g,a,p),refreshPending:h.isPending,onRefresh:()=>h.mutate(w.githubMergeState(e)),onRunAgent:t,onConfirm:()=>f(!0),onMethodChange:u,onOverrideChange:m}),(0,G.jsx)(vt,{number:e,state:a,selectedMethod:g,confirming:d,overrideRules:p,mergePending:v.isPending,mergeError:v.error,onOpenChange:f,onMerge:()=>v.mutate(_())})]}):(0,G.jsx)(gt,{reason:ft(i.data)})}function bt(e){let t=new Set;for(let n of e)for(let e of n.labels)t.add(e);return[...t].sort((e,t)=>e.toLowerCase().localeCompare(t.toLowerCase()))}function xt(e,t={}){let n=(t.query??``).trim().toLowerCase(),r=t.labels??[],i=n.replace(/^#/,``),a=i!==``&&/^\d+$/.test(i);return e.filter(e=>r.length>0&&!r.every(t=>e.labels.includes(t))||t.assignees?.length&&!e.assignees?.some(e=>t.assignees.some(t=>t.toLowerCase()===e.toLowerCase()))||t.author!==void 0&&e.author.toLowerCase()!==t.author.toLowerCase()||t.includeNumbers&&!t.includeNumbers.has(e.number)||t.excludeNumbers?.has(e.number)||t.projectId&&e.projectIds!==void 0&&!e.projectIds.includes(t.projectId)?!1:n===``?!0:a?String(e.number).includes(i):`#${e.number} ${e.title} ${e.author} ${e.body??``}`.toLowerCase().includes(n))}function St(e,t){let n=e.trim();if(n===``)return!1;let r=n.replace(/^#/,``);return/^\d+$/.test(r)?!t.some(e=>e.number===Number(r)):t.length===0}function J(e){if(!e||!/^[0-9a-fA-F]{6}$/.test(e))return{borderColor:`var(--border)`,color:`var(--muted-foreground)`};let t=`#${e}`;return{backgroundColor:`${t}22`,borderColor:`${t}66`,color:`color-mix(in srgb, ${t} 50%, var(--foreground))`}}function Ct({label:e,color:t,plain:n=!1}){return(0,G.jsx)(`span`,{"data-slot":`gh-label`,"data-label":e,style:n?void 0:J(t),className:n?`text-[11px] font-normal text-muted-foreground`:`rounded-full border px-1.5 py-px text-[12px] font-medium`,children:e})}function wt(e){return e===`pr`?`pull request`:`issue`}function Tt(e,t,n){return e===`pr`&&!!(t||n)}function Et({backLink:e}){return e?(0,G.jsxs)(V,{to:e.to,"data-slot":`gh-back`,className:`mb-3 inline-flex items-center gap-1.5 text-xs font-medium text-muted-foreground hover:text-foreground md:hidden`,children:[(0,G.jsx)(se,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`Back to the list`]}):null}function Dt({item:e,kindWord:n,commentCount:r,hasDiffStat:i,additions:a,deletions:o}){return(0,G.jsxs)(`p`,{"data-slot":`gh-meta`,className:`flex flex-wrap items-center gap-x-1.5 font-mono text-[11px] text-soft-foreground`,children:[(0,G.jsxs)(`span`,{children:[`#`,e.number]}),`·`,(0,G.jsx)(`span`,{children:n}),`·`,(0,G.jsxs)(`span`,{children:[`opened by `,e.author]}),`·`,(0,G.jsxs)(`span`,{children:[B(e.createdAt),` ago`]}),r?(0,G.jsxs)(G.Fragment,{children:[`·`,(0,G.jsx)(Jt,{count:r})]}):null,i?(0,G.jsxs)(G.Fragment,{children:[`·`,(0,G.jsxs)(`span`,{"data-slot":`gh-diffstat`,children:[(0,G.jsxs)(`span`,{className:`text-success`,children:[`+`,a??0]}),` `,(0,G.jsxs)(`span`,{className:`text-danger`,children:[`−`,o??0]})]})]}):null,`·`,t(e.url)?(0,G.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-open-link`,className:`inline-flex items-center gap-0.5 text-muted-foreground hover:text-foreground hover:underline`,children:[`open on GitHub`,(0,G.jsx)(N,{"aria-hidden":`true`,className:`size-2.5`})]}):(0,G.jsx)(`span`,{"data-slot":`gh-open-link`,className:`text-muted-foreground`,children:`open on GitHub`})]})}function Ot({item:e,subNav:t,changes:n}){return e.kind===`pr`?t?(0,G.jsxs)(`nav`,{"aria-label":`Pull request detail`,className:`mt-4 flex border-b border-border`,children:[(0,G.jsx)(rt,{to:k(`prs`,t.filter,e.number),active:!n,children:`Conversation`}),(0,G.jsx)(rt,{to:k(`prs`,t.filter,e.number,`/changes`),active:n,children:`Changes`})]}):(0,G.jsx)(V,{to:k(`prs`,null,e.number,`/changes`),"data-slot":`gh-files-changed`,className:`mt-3 inline-flex items-center gap-1 text-xs font-medium text-muted-foreground hover:text-foreground hover:underline`,children:`Files changed`}):null}function kt({item:e,colors:t,checks:n}){return e.labels.length>0||n?(0,G.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-1.5`,children:[e.labels.map(e=>(0,G.jsx)(Ct,{label:e,color:t[e]},e)),n?(0,G.jsx)(Yt,{checks:n,url:e.url}):null]}):null}function At({item:e,colors:t,body:n}){return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{"data-slot":`gh-body`,className:`mt-5 text-sm`,children:n?(0,G.jsx)(Ze,{children:n}):(0,G.jsx)(`p`,{className:`text-soft-foreground`,children:`(no description)`})}),(0,G.jsx)(Nt,{item:e,colors:t})]})}function jt({item:e,colors:t,checks:n,comments:r,backLink:i,subNav:a,onRunAgent:o,afterHeading:s,children:c}){let l=a?.changes??!1,u=wt(e.kind),d=h(e.kind,e.number,!l).data?.detail,f=d?.body??e.body,p=d?.additions??e.additions,m=d?.deletions??e.deletions,g=Tt(e.kind,p,m),_=r??e.comments;return(0,G.jsxs)(`article`,{"data-slot":`gh-detail-inner`,className:`min-w-0 px-4 py-4 md:px-7 md:py-5`,children:[(0,G.jsx)(Et,{backLink:i}),(0,G.jsxs)(`div`,{"data-slot":`gh-description-card`,className:e.kind===`pr`?`rounded-xl border border-border bg-card p-6`:void 0,children:[e.kind===`pr`?(0,G.jsxs)(`h2`,{className:`mb-4 text-[22px] leading-snug font-normal`,children:[`#`,e.number,` `,e.title]}):null,(0,G.jsx)(Dt,{item:e,kindWord:u,commentCount:_,hasDiffStat:g,additions:p,deletions:m}),e.kind===`pr`?null:(0,G.jsx)(`h2`,{className:`mt-2 text-[22px] leading-snug font-normal`,children:e.title}),s,(0,G.jsx)(Ot,{item:e,subNav:a,changes:l}),(0,G.jsx)(kt,{item:e,colors:t,checks:n}),l&&e.kind===`pr`?(0,G.jsx)(Mt,{item:e}):(0,G.jsx)(At,{item:e,colors:t,body:f})]}),e.kind===`pr`?(0,G.jsx)(yt,{number:e.number,onRunAgent:o}):null,c]})}function Mt({item:e}){let i=o(),a=m(e.number),[s,c]=(0,W.useState)(``),[l,u]=(0,W.useState)(null),f=a.data,p=f?.available?f.files.filter(e=>e.path.toLowerCase().includes(s.toLowerCase())):[],h=p.findIndex(e=>e.path===l);(0,W.useEffect)(()=>{p.length>0&&!p.some(e=>e.path===l)&&u(p[0].path)},[f?.available?f.headSha:``,s]);let g=async()=>{let t=f?.available?f.headSha:null,n=w.githubPrChanges(e.number),r=await d(e.number,{refresh:!0});i.setQueryData(n,r),r.available&&t&&t!==r.headSha&&(u(r.files[0]?.path??null),D(`The reviewed revision changed.`))};if(a.isPending)return(0,G.jsx)(`p`,{"aria-live":`polite`,className:`mt-6 text-sm text-muted-foreground`,children:`Loading changed files…`});if(a.isError||!f)return(0,G.jsx)(`p`,{className:`mt-6 text-sm text-danger`,children:`Changed files could not be loaded.`});if(!f.available)return(0,G.jsx)(`p`,{className:`mt-6 text-sm text-muted-foreground`,children:f.reason});let _=p.map(e=>({path:e.path,...e.previousPath?{oldPath:e.previousPath}:{},status:e.status===`removed`?`deleted`:e.status===`changed`?`modified`:e.status,adds:e.additions,dels:e.deletions,binary:e.patchUnavailableReason===`binary`,patch:e.patch??``})),v=t(e.url)?`${e.url}/files`:null,y=p.find(e=>e.path===l);return(0,G.jsxs)(`section`,{"data-slot":`gh-pr-changes`,className:`mt-5 min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs`,children:[(0,G.jsxs)(`strong`,{children:[f.files.length,` changed files`]}),(0,G.jsxs)(`span`,{className:`text-success`,children:[`+`,f.additions]}),(0,G.jsxs)(`span`,{className:`text-danger`,children:[`−`,f.deletions]}),(0,G.jsxs)(`span`,{className:`font-mono text-muted-foreground`,title:f.headSha,children:[`head `,f.headSha.slice(0,8)]}),(0,G.jsx)(n,{type:`button`,variant:`outline`,size:`sm`,className:`ml-auto min-h-11`,onClick:()=>void g(),children:`Refresh`})]}),f.truncated?(0,G.jsxs)(`p`,{role:`status`,className:`mt-3 rounded-md border border-warning/40 bg-warning/10 p-3 text-xs`,children:[f.reason??`This response is incomplete.`,` `,v?(0,G.jsx)(`a`,{href:v,target:`_blank`,rel:`noopener noreferrer`,className:`underline`,children:`Open all files on GitHub`}):null]}):null,(0,G.jsxs)(`div`,{className:`mt-4 grid min-w-0 gap-4 lg:grid-cols-[240px_minmax(0,1fr)]`,children:[(0,G.jsxs)(`aside`,{className:`min-w-0`,children:[(0,G.jsx)(`input`,{"aria-label":`Filter changed files`,value:s,onChange:e=>c(e.target.value),placeholder:`Filter files…`,className:`min-h-11 w-full rounded-md border border-input bg-background px-3 text-sm`}),(0,G.jsx)(`select`,{"aria-label":`Select changed file`,value:l??``,onChange:e=>u(e.target.value),className:`mt-2 min-h-11 w-full rounded-md border border-input bg-background px-2 text-sm lg:hidden`,children:p.map(e=>(0,G.jsx)(`option`,{children:e.path},e.path))}),(0,G.jsx)(`ul`,{className:`mt-2 hidden max-h-[60vh] overflow-auto lg:block`,children:p.map(e=>(0,G.jsx)(`li`,{children:(0,G.jsxs)(`button`,{type:`button`,onClick:()=>u(e.path),className:r(`min-h-11 w-full truncate rounded px-2 text-left text-xs`,l===e.path&&`bg-muted font-medium`),title:e.path,children:[e.status,` · `,e.path,` `,(0,G.jsxs)(`span`,{className:`text-success`,children:[`+`,e.additions]}),` `,(0,G.jsxs)(`span`,{className:`text-danger`,children:[`−`,e.deletions]})]})},e.path))})]}),(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsxs)(`div`,{className:`mb-2 flex justify-end gap-1`,children:[(0,G.jsx)(n,{"aria-label":`Previous file`,variant:`outline`,size:`icon`,className:`min-h-11 min-w-11`,disabled:h<=0,onClick:()=>u(p[h-1]?.path??null),children:(0,G.jsx)(tt,{})}),(0,G.jsx)(n,{"aria-label":`Next file`,variant:`outline`,size:`icon`,className:`min-h-11 min-w-11`,disabled:h<0||h>=p.length-1,onClick:()=>u(p[h+1]?.path??null),children:(0,G.jsx)(ne,{size:16})})]}),p.length===0?(0,G.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No changed files match this filter.`}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(nt,{files:_.filter(e=>e.path===l),wrap:!0,className:`min-w-0`}),y&&!y.patch?(0,G.jsxs)(`p`,{className:`rounded-b border border-border p-3 text-xs text-muted-foreground`,children:[`Patch unavailable: `,y.patchUnavailableReason??`not-provided`,`.`]}):null]})]})]})]})}function Nt({item:e,colors:t}){let n=h(e.kind,e.number),r=n.data,i=(0,W.useMemo)(()=>{let e=[...(r?.comments??[]).map(e=>({row:`comment`,comment:e})),...(r?.events??[]).map(e=>({row:`event`,event:e}))],t=e=>{let t=Date.parse(Pt(e));return Number.isNaN(t)?-1/0:t};return e.sort((e,n)=>t(e)-t(n))},[r?.comments,r?.events]);return n.isPending?(0,G.jsxs)(`section`,{"data-slot":`gh-thread-loading`,className:`mt-6 border-t border-border pt-5`,children:[(0,G.jsx)(A,{className:`mb-3 h-3 w-24`}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,G.jsx)(A,{className:`h-14 w-full`}),(0,G.jsx)(A,{className:`h-14 w-full`})]})]}):!r||!r.available?(0,G.jsxs)(`section`,{"data-slot":`gh-thread-error`,className:`mt-6 border-t border-border pt-5 text-xs text-soft-foreground`,children:[(0,G.jsxs)(`span`,{children:[`Couldn’t load comments — `,r?.reason??(n.error instanceof Error?n.error.message:`could not load comments`),`. `]}),(0,G.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-0.5 text-muted-foreground hover:text-foreground hover:underline`,children:[`open on GitHub`,(0,G.jsx)(N,{"aria-hidden":`true`,className:`size-2.5`})]})]}):i.length===0?null:(0,G.jsxs)(`section`,{"data-slot":`gh-thread`,className:`mt-6 border-t border-border pt-5`,children:[(0,G.jsxs)(`h3`,{"data-slot":`gh-thread-header`,className:`mb-4 text-[11px] font-semibold tracking-wide text-soft-foreground uppercase`,children:[`Activity · `,r.comments.length,` comment`,r.comments.length===1?``:`s`]}),(0,G.jsx)(`ul`,{className:`flex flex-col gap-5`,children:Ft(i).map(e=>e.group===`commits`?(0,G.jsx)(It,{commits:e.commits,colors:t},e.commits[0].id):e.entry.row===`comment`?(0,G.jsx)(Kt,{comment:e.entry.comment},`${e.entry.comment.kind}-${e.entry.comment.id}`):(0,G.jsx)(Lt,{event:e.entry.event,colors:t},e.entry.event.id))}),r.truncated?(0,G.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-thread-truncated`,className:`mt-4 inline-flex items-center gap-0.5 text-xs text-soft-foreground hover:text-foreground hover:underline`,children:[`thread truncated — open on GitHub`,(0,G.jsx)(N,{"aria-hidden":`true`,className:`size-2.5`})]}):null]})}var Pt=e=>e.row===`comment`?e.comment.createdAt:e.event.createdAt;function Ft(e){let t=[],n=[],r=()=>{n.length!==0&&(n.length===1?t.push({group:`single`,entry:{row:`event`,event:n[0]}}):t.push({group:`commits`,commits:n}),n=[])};for(let i of e){if(i.row===`event`&&i.event.kind===`committed`&&i.row===`event`){let e=n[n.length-1];e&&e.actor!==i.event.actor&&r(),n.push(i.event);continue}r(),t.push({group:`single`,entry:i})}return r(),t}function It({commits:e,colors:t}){let[n,r]=(0,W.useState)(!1),i=e[0]?.actor??`?`;return n?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`true`,className:`min-w-0`,children:(0,G.jsxs)(`button`,{type:`button`,"aria-expanded":!0,onClick:()=>r(!1),className:`flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground hover:text-foreground`,children:[(0,G.jsx)(`span`,{"aria-hidden":`true`,children:Y.committed}),(0,G.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,G.jsxs)(`span`,{children:[`added `,e.length,` commits`]})]})}),e.map(e=>(0,G.jsx)(Lt,{event:e,colors:t},e.id))]}):(0,G.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`false`,className:`min-w-0`,children:(0,G.jsxs)(`button`,{type:`button`,"aria-expanded":!1,onClick:()=>r(!0),className:`flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground hover:text-foreground`,children:[(0,G.jsx)(`span`,{"aria-hidden":`true`,children:Y.committed}),(0,G.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,G.jsxs)(`span`,{children:[`added `,e.length,` commits`]}),(0,G.jsx)(`span`,{className:`shrink-0`,children:B(e[e.length-1].createdAt)})]})})}var Y={committed:`⚙`,labeled:`◆`,unlabeled:`◇`,assigned:`◍`,unassigned:`◌`,merged:`⑃`,closed:`⊘`,reopened:`⊙`,head_ref_force_pushed:`↻`,"cross-referenced":`↗`,renamed:`✎`};function Lt({event:e,colors:t}){return(0,G.jsxs)(`li`,{"data-slot":`gh-event-row`,"data-kind":e.kind,className:r(`flex min-w-0 items-center gap-1.5 font-mono text-[11px] text-soft-foreground`,e.kind===`merged`&&`text-accent-foreground`),children:[(0,G.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0`,children:Y[e.kind]}),(0,G.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.actor}),(0,G.jsx)(Ut,{event:e,colors:t}),(0,G.jsx)(`span`,{className:`shrink-0`,children:B(e.createdAt)}),e.url?(0,G.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`open ${e.kind} on GitHub`,className:`ml-auto shrink-0 text-muted-foreground hover:text-foreground`,children:(0,G.jsx)(N,{"aria-hidden":`true`,className:`size-2.5`})}):null]})}function Rt({event:e}){return(0,G.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,G.jsx)(`span`,{className:`shrink-0`,children:`committed`}),e.sha?(0,G.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:e.sha.slice(0,7)}):null,e.message?(0,G.jsx)(`span`,{className:`truncate font-sans text-foreground`,children:e.message}):null,(0,G.jsx)(Wt,{checks:e.checks})]})}function zt({event:e,colors:t}){return(0,G.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,G.jsx)(`span`,{className:`shrink-0`,children:e.kind===`labeled`?`added the`:`removed the`}),e.label?(0,G.jsx)(`span`,{"data-slot":`gh-event-label`,style:J(e.label.color??t[e.label.name]),className:`max-w-[12rem] truncate rounded-full border px-1.5 py-px font-sans text-[12px]`,children:e.label.name}):null,(0,G.jsx)(`span`,{className:`shrink-0`,children:`label`})]})}function Bt({event:e}){return(0,G.jsxs)(`span`,{className:`truncate`,children:[e.kind===`assigned`?`assigned`:`unassigned`,` `,e.subject??`someone`]})}function Vt({event:e}){return(0,G.jsxs)(`span`,{className:`truncate`,children:[`referenced this in `,e.refNumber?`#${e.refNumber}`:`another thread`,e.refTitle?` ${e.refTitle}`:``]})}var Ht={committed:e=>(0,G.jsx)(Rt,{event:e}),labeled:(e,t)=>(0,G.jsx)(zt,{event:e,colors:t}),unlabeled:(e,t)=>(0,G.jsx)(zt,{event:e,colors:t}),assigned:e=>(0,G.jsx)(Bt,{event:e}),unassigned:e=>(0,G.jsx)(Bt,{event:e}),merged:()=>(0,G.jsx)(`span`,{children:`merged this`}),closed:()=>(0,G.jsx)(`span`,{children:`closed this`}),reopened:()=>(0,G.jsx)(`span`,{children:`reopened this`}),head_ref_force_pushed:()=>(0,G.jsx)(`span`,{children:`force-pushed`}),renamed:e=>(0,G.jsxs)(`span`,{className:`truncate`,children:[`renamed this to `,e.subject??`—`]}),"cross-referenced":e=>(0,G.jsx)(Vt,{event:e})};function Ut({event:e,colors:t}){return Ht[e.kind]?.(e,t)??null}function Wt({checks:e}){return e?(0,G.jsx)(`span`,{"data-slot":`gh-commit-checks`,"data-checks":e,"aria-label":`checks ${e}`,className:r(`shrink-0`,Z[e]),children:X[e]}):null}var Gt={approved:{label:`approved`,tone:`border-success/40 text-success`},changes_requested:{label:`changes requested`,tone:`border-danger/40 text-danger`},commented:{label:`commented`,tone:`border-border text-muted-foreground`},dismissed:{label:`dismissed`,tone:`border-border text-muted-foreground`}};function Kt({comment:e}){let t=e.reviewState?Gt[e.reviewState]:null;return(0,G.jsxs)(`li`,{"data-slot":`gh-thread-entry`,"data-kind":e.kind,className:`min-w-0`,children:[(0,G.jsxs)(`div`,{className:`mb-1.5 flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground`,children:[(0,G.jsx)(qt,{url:e.avatarUrl,login:e.author}),(0,G.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.author}),(0,G.jsx)(`span`,{children:B(e.createdAt)}),t?(0,G.jsx)(`span`,{"data-slot":`gh-review-chip`,"data-review-state":e.reviewState,className:r(`rounded-full border px-1.5 py-px font-sans text-[12px] font-medium`,t.tone),children:t.label}):null,(0,G.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`open comment on GitHub`,className:`ml-auto shrink-0 text-muted-foreground hover:text-foreground`,children:(0,G.jsx)(N,{"aria-hidden":`true`,className:`size-2.5`})})]}),(0,G.jsx)(`div`,{"data-slot":`gh-thread-body`,className:`text-sm`,children:e.body?(0,G.jsx)(Ze,{children:e.body}):(0,G.jsx)(`p`,{className:`text-soft-foreground`,children:`(no body)`})})]})}function qt({url:e,login:t}){let[n,r]=(0,W.useState)(!1);return e&&!n?(0,G.jsx)(`img`,{src:e,alt:``,width:16,height:16,loading:`lazy`,onError:()=>r(!0),"data-slot":`gh-avatar`,className:`size-4 shrink-0 rounded-full`}):(0,G.jsx)(`span`,{"data-slot":`gh-avatar-fallback`,"aria-hidden":`true`,className:`flex size-4 shrink-0 items-center justify-center rounded-full bg-muted text-[8px] font-semibold text-muted-foreground uppercase`,children:t.slice(0,1)||`?`})}var X={passing:`✓`,failing:`✗`,pending:`○`},Z={passing:`text-success`,failing:`text-danger`,pending:`text-muted-foreground`};function Jt({count:e}){return e?(0,G.jsxs)(`span`,{"data-slot":`gh-comment-count`,"data-count":e,"aria-label":`${e} comment${e===1?``:`s`}`,className:`inline-flex shrink-0 items-center gap-0.5`,children:[(0,G.jsx)(be,{"aria-hidden":`true`,className:`size-3`}),e]}):null}function Yt({checks:e,url:t}){let n=r(`text-[11px] font-medium`,Z[e],t&&`hover:underline`),i=`${X[e]} checks ${e}`;return t?(0,G.jsx)(`a`,{href:`${t}/checks`,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-checks`,"data-checks":e,className:n,children:i}):(0,G.jsx)(`span`,{"data-slot":`gh-checks`,"data-checks":e,className:n,children:i})}function Xt({checks:e}){return(0,G.jsx)(`span`,{"data-slot":`gh-row-checks`,"data-checks":e,title:`checks ${e}`,"aria-label":`checks ${e}`,className:r(`shrink-0 font-sans text-[11px] font-semibold`,Z[e]),children:X[e]})}function Q(e){return`${e.kind===`pr`?`Address GitHub pull request`:`Fix GitHub issue`} #${e.number}: ${e.title}\n\n${e.url}`}function Zt(e,t=[]){let n=Q(e);return e.body?.trim()&&(n+=`\n\n---\n\n${e.body.trim()}`),t.length&&(n+=Qt(t)),n}function Qt(e){return`\n\nUse these skills where relevant: ${e.join(`, `)}.`}function $t(e,t){return e.replace(/\{\{\s*number\s*\}\}/gi,()=>`#${t.number}`).replace(/\{\{\s*title\s*\}\}/gi,()=>t.title).replace(/\{\{\s*url\s*\}\}/gi,()=>t.url)}function en(e,t){if(e.includes(t.url))return!0;let n=t.kind===`pr`?String.raw`(?:pull\s+request|pr)`:String.raw`issue`;return new RegExp(String.raw`\b${n}\s*#?\s*${t.number}\b`,`i`).test(e)}function tn(e,t,n){let r=(n??``).trim();if(!r)return Zt(e,t);let i=Q(e),a=r.startsWith(i)?i+$t(r.slice(i.length),e):$t(r,e),o=en(a,e)?a:`${i}\n\n${a}`;return t.length?o+Qt(t):o}function nn(e){let t=[];for(let n of e.slice(0,8)){let e=new Set(t.map(e=>e.id)),r=n;for(let t=2;e.has(r);t++)r=`${n}-${t}`;t.push({id:r,name:n,skill:n,prompt:`{{task}}`})}return t}function rn(e,t,n,r,i={}){return t?{...i,workflow:t,task:tn(e,n,r)}:n.length?{...i,steps:nn(n),task:tn(e,[],r)}:{...i,workflow:`quick-task`,task:tn(e,[],r)}}function an(e){let t=x(),n=S(),r=p(t.data),i=n.data?.defaultRunner,a=He(e.runner,r,i??r[0]??`claude`),o=y(a),s=n.data?.modelsLocked===!0,{accounts:c,repoAccount:l}=Re(),u=c.some(t=>t.provider===a&&t.id===e.account)?e.account:null,d=Ae(s?null:e.model,a,n.data?.defaultModels,o.data),f=Ne(a,d,o.data);return{runner:a,runnerExplicit:e.runner!==null,model:d,effort:s?``:Pe(e.effort,f),effortOptions:f,runners:r,defaultRunner:i,canRun:t.isSuccess&&r.length>0,modelsLocked:s,providerPending:t.isPending,providerError:t.isError,accounts:c,account:u,repoAccount:l}}function on(e){return{runner:Me(e.runner,e.defaultRunner,e.runnerExplicit),model:e.modelsLocked?void 0:e.model||void 0,effort:e.modelsLocked?void 0:e.effort||void 0}}function sn(e){return{...on(e),...e.account?{agentProfile:e.account}:{}}}function cn({pick:e,onChange:t,disabled:n=!1,accounts:r=!1,layout:i}){let a=(0,W.useRef)(null),o=(0,W.useRef)(null),[s,c]=(0,W.useState)(()=>typeof window<`u`&&window.innerWidth<=767);(0,W.useLayoutEffect)(()=>{let e=a.current;if(i!==`row`||!e)return;let t=()=>{let t=window.innerWidth<=767||e.getBoundingClientRect().width<550,n=document.activeElement;o.current=n instanceof HTMLElement&&e.contains(n)?n:null,c(t)};t();let n=typeof ResizeObserver>`u`?null:new ResizeObserver(t);return n?.observe(e),window.addEventListener(`resize`,t),()=>{n?.disconnect(),window.removeEventListener(`resize`,t)}},[i]),(0,W.useLayoutEffect)(()=>{let e=o.current;o.current=null,e&&e.isConnected&&document.activeElement!==e&&e.focus()},[s]);let l=an(e),{runner:u,model:d,effort:f,effortOptions:p,runners:m,canRun:h,modelsLocked:g}=l,_=S(),v=y(u),b=Le(u,v.data,[e.model,_.data?.defaultModels?.[u]]),x=n||!h,C=r?l.accounts:[],w=m.length>1||m.some(e=>Ve(C,e))?(0,G.jsx)(je,{icon:(0,G.jsx)(oe,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,runners:m,value:u,accounts:C,account:r?l.account:null,repoAccount:r?l.repoAccount:void 0,disabled:x,onPick:(n,i)=>t(r?{runner:n,account:i,model:n===u?e.model:null,effort:e.effort}:{runner:n,account:null,model:null,effort:e.effort})},`runner`):null,T=(0,G.jsx)(U,{icon:(0,G.jsx)(te,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,slot:`model-pill`,ariaLabel:`Model`,label:d===``?`Default`:b.find(e=>e.id===d).label,value:d,disabled:x,readOnly:g===!0,disabledHint:g?`Model selection is locked to native coding-agent settings.`:void 0,onPick:n=>{let r=Ne(u,n,v.data);t({...e,model:n,effort:e.effort===null?null:Pe(e.effort,r)})},options:b.map(e=>({value:e.id,label:e.label,desc:e.desc})),status:ze(u,v.data,v.isError,v.isFetching)},`model`),E=(0,G.jsx)(U,{icon:(0,G.jsx)(F,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,slot:`effort-pill`,ariaLabel:`Effort`,label:p.find(e=>e.value===f)?.label??`auto`,value:f,disabled:x,readOnly:g===!0,disabledHint:g?`Effort selection is locked to native coding-agent settings.`:void 0,onPick:n=>t({...e,effort:n}),options:p.map(e=>({value:e.value,label:e.label,desc:e.desc}))},`effort`);return i===`row`?(0,G.jsx)(`div`,{ref:a,"data-slot":`engine-row-box`,children:(0,G.jsx)(`div`,{"data-slot":`engine-row`,className:`engine-row`,role:`group`,"aria-label":`Agent settings`,children:(0,G.jsx)(Fe,{children:s?[w,E,T]:[w,T,E]})})}):(0,G.jsxs)(Fe,{children:[w,T,E]})}var ln={workflow:null,skills:[]},un=`cez-followup-selection`;function dn(e){let t=e&&typeof e==`object`?e:{};return{workflow:typeof t.workflow==`string`?t.workflow:null,skills:Array.isArray(t.skills)?t.skills.filter(e=>typeof e==`string`):[]}}function fn(){try{let e=localStorage.getItem(un);return e?dn(JSON.parse(e)):{...ln}}catch{return{...ln}}}function pn(e){try{localStorage.setItem(un,JSON.stringify(e))}catch{}}var $=`cez-followup-prompt:`;function mn(e){try{return localStorage.getItem($+e)??``}catch{return``}}function hn(e,t){try{t===``?localStorage.removeItem($+e):localStorage.setItem($+e,t)}catch{}}function gn({item:e,workflows:r,skills:i,workflow:a,onWorkflowChange:s,selectedSkills:c,onSkillsChange:u,engine:d,onEngineChange:p,queuedRunId:m,onQueued:h}){let v=o(),y=_(),x=g().data?.capabilities.automations===!0,S=e.kind===`pr`?`PR`:`issue`,C=c.filter(e=>i.some(t=>t.name===e)),[T]=(0,W.useState)(()=>Q(e)),[E,O]=(0,W.useState)(()=>mn(e.url)||T),k=an(d),A=(0,W.useRef)(null),j=(0,W.useRef)(null);(0,W.useEffect)(()=>{hn(e.url,E===T?``:E)},[e.url,E,T]);let M=(0,W.useMemo)(()=>we(We(y.data?.promptTemplates),{automations:x}),[y.data?.promptTemplates,x]),N=e=>{let t=A.current,n=ke({prompt:E,base:T,selectionStart:t?.selectionStart??null,focused:document.activeElement===t,remembered:j.current}),r=Ee(E,n,e);O(r.text),j.current=r.caret,requestAnimationFrame(()=>{A.current?.focus(),A.current?.setSelectionRange(r.caret,r.caret)})},P=Te(M,C),F=(0,W.useRef)(E);F.current=E;let I=(0,W.useRef)(``);(0,W.useEffect)(()=>{let e=Se(F.current,I.current,P,T);I.current=e.applied,e.text!==F.current&&O(e.text)},[P,T]);let L=b({mutationFn:async()=>k.canRun?f(rn(e,a,C,E,sn(k))):null,onSuccess:t=>{if(t===null)return;let n=t;n&&h(e.url,n.id),D(`Added to the queue — ${S} #${e.number}`),C.length>0&&y.data!==void 0&&l({skillUsage:C.reduce((e,t)=>Ye(e,t),y.data.skillUsage)}).then(()=>v.invalidateQueries({queryKey:w.uiState})).catch(()=>{}),hn(e.url,``),O(T),I.current=``,v.invalidateQueries({queryKey:w.runs.all})},onError:e=>D(e.message,{tone:`danger`})}),te=e=>{$e({key:e.key,shiftKey:e.shiftKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,repeat:e.repeat,isComposing:e.nativeEvent.isComposing})&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),!L.isPending&&k.canRun&&L.mutate())},R=e=>u(c.includes(e)?c.filter(t=>t!==e):[...c,e]);return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`section`,{"data-slot":`gh-hand`,className:`mt-7 rounded-lg border border-border bg-card p-4`,children:[(0,G.jsx)(`h3`,{className:`text-xl font-normal text-foreground`,children:`Hand this to the agent`}),(0,G.jsxs)(`label`,{className:`gh-field gh-prompt-field`,children:[(0,G.jsx)(`span`,{children:`Instructions for the agent`}),(0,G.jsx)(_e,{ref:A,"data-slot":`gh-custom-prompt`,"aria-label":`Custom prompt`,"aria-keyshortcuts":`Control+Enter Meta+Enter`,value:E,onChange:e=>O(e.target.value),onSelect:e=>{j.current=e.currentTarget.selectionStart},onKeyDown:te,placeholder:`Instructions for the agent… (#${e.number} and its link are always sent)`,className:`mt-3 min-h-20 text-[13px]`})]}),(0,G.jsx)(ee,{templates:M,onInsert:N}),(0,G.jsxs)(`div`,{className:`gh-handoff-settings`,children:[(0,G.jsxs)(`div`,{className:`gh-field`,children:[(0,G.jsx)(`span`,{children:`Workflow`}),(0,G.jsx)(_n,{workflows:r,value:a,onChange:s})]}),(0,G.jsxs)(`div`,{className:`gh-field`,children:[(0,G.jsx)(`span`,{children:`Skills · select one or more`}),(0,G.jsx)(yn,{skills:i,skillUsage:y.data?.skillUsage,selected:C,onToggle:R})]}),C.length>0?(0,G.jsx)(`div`,{"data-slot":`gh-skill-chips`,className:`mt-2.5 flex flex-wrap gap-1.5`,children:C.map(e=>(0,G.jsxs)(`button`,{type:`button`,"data-slot":`gh-skill-chip`,"data-skill":e,onClick:()=>R(e),title:`Remove this skill`,className:`inline-flex min-h-11 items-center gap-2 rounded-lg border border-border bg-card px-3 text-xs font-medium text-foreground transition-colors hover:bg-danger/10 hover:text-danger`,children:[e,(0,G.jsx)(ae,{size:16,"aria-hidden":`true`,className:`size-3`})]},e))}):null,(0,G.jsx)(cn,{layout:`row`,pick:d,onChange:p,disabled:L.isPending||!k.canRun,accounts:!0}),(0,G.jsxs)(`div`,{className:`gh-field`,children:[(0,G.jsx)(`span`,{children:`Account`}),(0,G.jsx)(vn,{resolved:k,disabled:L.isPending||!k.canRun,onPick:e=>p({...d,account:e})})]}),!k.providerPending&&!k.canRun?(0,G.jsxs)(`span`,{"data-slot":`gh-provider-gate`,className:`inline-flex flex-wrap items-center gap-1 text-xs text-muted-foreground`,children:[k.providerError?`Provider authentication could not be verified.`:`Connect an agent provider to run this item.`,(0,G.jsx)(V,{to:`/settings/agents#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}):null]}),(0,G.jsxs)(`p`,{className:`text-[11px] leading-relaxed text-muted-foreground`,children:[e.kind===`pr`?`PR`:`Issue`,` number and link remain attached to the task. Edit the prompt before starting. Cmd/Ctrl+Enter submits; Enter adds a new line.`]})]}),(0,G.jsxs)(`div`,{"data-slot":`gh-handoff-actions`,className:`mt-[22px] flex flex-wrap items-center gap-2.5`,children:[t(e.url)?(0,G.jsx)(n,{asChild:!0,variant:`outline`,children:(0,G.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,children:`Open in GitHub`})}):null,(0,G.jsxs)(n,{variant:`primary`,"data-action":`gh-run`,disabled:L.isPending||!k.canRun,onClick:()=>L.mutate(),children:[(0,G.jsx)(Qe,{"aria-hidden":`true`,className:`size-3.5`}),`Run agent on this `,S]}),(0,G.jsx)(`kbd`,{"aria-hidden":`true`,className:`rounded-[5px] border border-b-2 border-border bg-card px-[5px] py-px font-mono text-[11px] font-medium text-muted-foreground`,children:et()}),m?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`span`,{"data-slot":`gh-queued`,className:`flex items-center gap-1 text-xs font-medium text-success`,children:[(0,G.jsx)(z,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`queued`]}),(0,G.jsx)(V,{to:`/tasks/${m}`,"data-slot":`gh-view-run`,className:`text-xs font-semibold text-accent-text hover:underline`,children:`View task →`})]}):null]})]})}function _n({workflows:e,value:t,onChange:n}){let[i,a]=(0,W.useState)(!1),[o,s]=(0,W.useState)(``),c=(0,W.useRef)(null),l=Ge(e,o);return(0,G.jsxs)(P,{open:i,onOpenChange:e=>{a(e),e||s(``)},children:[(0,G.jsx)(j,{asChild:!0,children:(0,G.jsxs)(`button`,{type:`button`,"data-slot":`gh-workflow-trigger`,"aria-label":`Choose a workflow`,className:r(Be,t&&`border-foreground/60 font-mono text-[11px] font-semibold text-foreground`),children:[(0,G.jsx)(re,{size:16,"aria-hidden":`true`,className:`size-3 shrink-0 text-accent-icon`}),(0,G.jsx)(`span`,{className:`min-w-0 max-w-44 truncate`,children:t??`workflow`}),(0,G.jsx)(le,{size:16,"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,G.jsx)(M,{align:`start`,sideOffset:8,className:`w-[320px] max-w-[calc(100vw-2rem)] p-0`,children:(0,G.jsxs)(Ce,{shouldFilter:!1,children:[(0,G.jsx)(xe,{placeholder:`search workflows…`,value:o,onValueChange:s,onInput:()=>c.current?.scrollTo(0,0)}),(0,G.jsxs)(De,{ref:c,"data-slot":`gh-workflow-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[l.length===0?(0,G.jsx)(Oe,{children:`Nothing matches.`}):null,(0,G.jsx)(H,{children:l.map(e=>{let r=t===e.name;return(0,G.jsxs)(Ie,{value:`workflow ${e.name}`,keywords:Ke(e.name,e.description),"data-slot":`gh-workflow-option`,"data-workflow":e.name,onSelect:()=>{n(r?null:e.name),a(!1)},children:[(0,G.jsx)(`span`,{className:`shrink-0 font-mono text-xs`,children:e.name}),e.description?(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,r?(0,G.jsx)(z,{size:16,"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-link-foreground`}):null]},e.name)})})]})]})})]})}function vn({resolved:e,disabled:t,onPick:n}){let r=e.accounts.filter(t=>t.provider===e.runner),i=[...r.some(e=>e.id==="default")?[]:[{value:Ue,label:`Default`}],...r.map(e=>({value:e.id,label:e.label,desc:e.configDir}))],a=e.account??e.repoAccount?.[e.runner]??`default`;return(0,G.jsx)(U,{icon:(0,G.jsx)(ue,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),slot:`account-pill`,ariaLabel:`Account`,label:i.find(e=>e.value===a)?.label??`Default`,value:a,options:i,disabled:t,onPick:n})}function yn({skills:e,skillUsage:t,selected:n,onToggle:i}){let[a,o]=(0,W.useState)(!1),[s,c]=(0,W.useState)(``),[l,u]=(0,W.useState)(null),d=(0,W.useRef)(null),{mostUsed:f,project:p,global:m,ranked:h}=Xe(e,s,t),g=(e,t)=>{let a=n.includes(e.name);return(0,G.jsxs)(Ie,{value:`skill ${e.name} ${e.path}`,keywords:Ke(e.name,e.description),"data-slot":`gh-skill-option`,"data-skill":e.name,"data-selected":a?`true`:void 0,onSelect:()=>i(e.name),children:[(0,G.jsx)(`span`,{className:r(`shrink-0 font-mono text-xs`,t&&`font-semibold`),children:e.name}),e.description?(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,(0,G.jsx)(`button`,{type:`button`,"data-slot":`gh-skill-view`,"aria-label":`View skill ${e.name}`,title:`View skill`,onClick:t=>{t.preventDefault(),t.stopPropagation(),u(e)},className:`ml-auto shrink-0 rounded-sm p-0.5 text-soft-foreground transition-colors hover:text-foreground`,children:(0,G.jsx)(ye,{"aria-hidden":`true`,className:`size-3.5`})}),a?(0,G.jsx)(z,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0 text-link-foreground`}):null]},e.path)};return e.length===0?null:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(O,{skill:l,onClose:()=>u(null)}),(0,G.jsxs)(P,{open:a,onOpenChange:e=>{o(e),e||c(``)},children:[(0,G.jsx)(j,{asChild:!0,children:(0,G.jsxs)(`button`,{type:`button`,"data-slot":`gh-skills-trigger`,"aria-label":`Choose skills`,className:r(Be,n.length>0&&`border-foreground/60 font-semibold text-foreground`),children:[(0,G.jsx)(ce,{size:16,"aria-hidden":`true`,className:`size-3 shrink-0 text-accent-icon`}),`skills`,n.length>0?` · ${n.length}`:``,(0,G.jsx)(le,{size:16,"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,G.jsx)(M,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,G.jsxs)(Ce,{shouldFilter:!1,children:[(0,G.jsx)(xe,{placeholder:`search skills…`,value:s,onValueChange:c,onInput:()=>d.current?.scrollTo(0,0)}),(0,G.jsxs)(De,{ref:d,"data-slot":`gh-skill-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[(h?h.length===0:f.length===0&&p.length===0&&m.length===0)?(0,G.jsx)(Oe,{children:`Nothing matches.`}):null,h?h.length>0?(0,G.jsx)(H,{children:h.map(e=>g(e,qe(e)))}):null:(0,G.jsxs)(G.Fragment,{children:[f.length>0?(0,G.jsx)(H,{heading:`Most used`,children:f.map(e=>g(e,qe(e)))}):null,p.length>0?(0,G.jsx)(H,{heading:`Project skills`,children:p.map(e=>g(e,!0))}):null,m.length>0?(0,G.jsx)(H,{heading:`Global`,children:m.map(e=>g(e,!1))}):null]})]})]})})]})]})}var bn=new WeakMap;function xn(){let e=fn(),t={workflow:e.workflow,selectedSkills:e.skills,engine:{runner:null,model:null,effort:null,account:null},queued:new Map},n=new Set;return{snapshot:()=>t,subscribe:e=>(n.add(e),()=>{n.delete(e)}),update:e=>{t={...t,...e},(e.workflow!==void 0||e.selectedSkills!==void 0)&&pn({workflow:t.workflow,skills:[...t.selectedSkills]}),n.forEach(e=>e())}}}function Sn(){let e=o(),{projectId:t}=u(),n=bn.get(e);n||bn.set(e,n=new Map);let r=n.get(t);r||n.set(t,r=xn());let{snapshot:i,subscribe:a,update:s}=r,c=(0,W.useSyncExternalStore)(a,i,i),l=v(),d=C(),f=_(),p=l.data?.workflows;(0,W.useEffect)(()=>{p&&c.workflow!==null&&!p.some(e=>e.name===c.workflow)&&s({workflow:null})},[s,p,c.workflow]);let m=(0,W.useMemo)(()=>Je(d.data??[],f.data?.skillUsage),[d.data,f.data?.skillUsage]);return{...c,workflows:l,skillList:m,setWorkflow:e=>s({workflow:e}),setSelectedSkills:e=>s({selectedSkills:e}),setEngine:e=>s({engine:e}),onQueued:(e,t)=>s({queued:new Map(i().queued).set(e,t)})}}export{Jt as a,Ft as c,J as d,St as f,Xt as i,bt as l,gn as n,jt as o,Zt as r,Ct as s,Sn as t,xt as u};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{d as t,t as n,u as r}from"./button-CHUAMTHK.js";import{i,t as a}from"./react-runtime-CCIEwYL0.js";import{Jr as o,Vt as s,it as c,nn as l,r as u,rt as d,w as f,wr as p}from"./project-scope-context-CaUqlAd7.js";import{M as m,O as h,P as g,Pt as _,Rt as v,Tt as y,Un as b,et as x,h as S,jt as C,n as w,rt as T}from"./queries-DYfIpJ-d.js";import{t as E}from"./useQuery-DOJQOEBO.js";import{n as D}from"./toaster-B1MyeHiE.js";import{C as ee,b as O,u as k,v as A}from"./github-sidebar-model-Ct0DltOv.js";import{i as j,r as M,s as N,t as P}from"./popover-DRcRI46x.js";import{A as F,Z as I,_ as L,b as te,ct as R,d as ne,ft as re,h as ie,l as z,mt as ae,ot as oe,r as se,rt as ce,u as le,ut as ue}from"./design-icons-DmYTv2r1.js";import{a as de,c as fe,i as pe,n as me,o as he,s as ge,t as _e}from"./textarea-DlVUfdWG.js";import{a as B,t as ve}from"./loader-circle-CZkGEdoI.js";import{t as ye}from"./eye-B8okNWXU.js";import{t as be}from"./message-square-B-MD-8rD.js";import{t as V}from"./project-router-1m_VlC22.js";import{A as xe,B as Se,E as Ce,H as we,I as Te,L as Ee,M as De,O as Oe,V as ke,_ as Ae,a as je,b as Me,f as Ne,g as Pe,i as Fe,j as Ie,k as H,m as Le,n as Re,p as ze,r as U,s as Be,t as Ve,v as He,w as Ue,z as We}from"./agent-accounts-BCg-578Q.js";import{d as Ge,f as Ke,i as qe,s as Je,t as Ye,u as Xe}from"./skills-DFBiAuJG.js";import{t as Ze}from"./markdown-D7DUNWcJ.js";import{Bt as Qe,Mt as $e,Nt as et,Qt as tt}from"./index-D489J7QW.js";import{t as nt}from"./diff-tVGVhYyc.js";import{t as rt}from"./tab-link-DCUifQ46.js";var W=e(i(),1),G=a(),it={squash:`Squash and merge`,merge:`Create a merge commit`,rebase:`Rebase and merge`};function K({state:e}){let t=`size-4 shrink-0`;return e===`passing`?(0,G.jsx)(z,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-passing`,className:r(t,`text-success`)}):e===`failing`?(0,G.jsx)(L,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-failing`,className:r(t,`text-danger`)}):e===`pending`?(0,G.jsx)(ve,{"aria-hidden":`true`,"data-slot":`gh-merge-status-pending`,className:r(t,`animate-spin text-warning`)}):(0,G.jsx)(ie,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-unknown`,className:r(t,`text-soft-foreground`)})}function at(e){return e?.available?e.mergeState:null}function ot(e,t){return e&&t?.methods.includes(e)?e:t?.defaultMethod??t?.methods[0]??null}function st(e){return e.state===`merged`?`Merged`:e.state===`closed`?`Closed`:e.isDraft?`Draft`:e.mergeable===`conflicting`?`Conflicts must be resolved`:e.canMerge?`Ready to merge`:e.eligibility===`unknown`?`Merge blocked · Requirements unknown`:`Merge blocked`}function ct(e){return e===`approved`||e===`not-required`?`passing`:e===`unknown`?`unknown`:`failing`}function lt(e){return e===`mergeable`?`passing`:e===`conflicting`?`failing`:`unknown`}function ut(e){return e===`conflicting`?`present`:e===`mergeable`?`none`:`unknown`}function dt(e){return e===!0?` · required`:e===null?` · requiredness unknown`:``}function ft(e){return e?.available===!1?e.reason:`GitHub could not load merge requirements.`}function pt(e,t,n){return!!(e&&(t.canMerge||t.canOverride&&n))}function q(e){return e?it[e]:`Merge`}function mt(e){return e===`conflicting`?`true`:void 0}function ht({check:e}){return(0,G.jsxs)(`li`,{className:`flex items-center justify-between gap-3`,children:[(0,G.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,G.jsx)(K,{state:e.state}),(0,G.jsxs)(`span`,{children:[e.name,` · `,e.state,dt(e.required)]})]}),e.url&&t(e.url)?(0,G.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`text-muted-foreground underline`,children:`details`}):null]})}function gt({reason:e}){return(0,G.jsxs)(`section`,{"data-slot":`gh-merge-unavailable`,className:`mt-6 rounded-lg border border-border bg-card p-4 text-sm`,children:[(0,G.jsx)(`p`,{className:`font-medium`,children:`Merge status unavailable`}),(0,G.jsx)(`p`,{className:`mt-1 text-xs text-soft-foreground`,children:e})]})}function _t({state:e,selectedMethod:t,overrideRules:i,mergeEnabled:a,refreshPending:o,onRefresh:s,onRunAgent:c,onConfirm:l,onMethodChange:u,onOverrideChange:d}){let f=st(e),p=ct(e.reviewDecision),m=lt(e.mergeable);return(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[e.canMerge?(0,G.jsx)(z,{size:16,"aria-hidden":`true`,className:`mt-0.5 size-5 shrink-0 text-success`}):(0,G.jsx)(R,{size:16,"aria-hidden":`true`,className:`mt-0.5 size-5 shrink-0 text-warning`}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,G.jsx)(`h3`,{className:`font-semibold`,children:f}),(0,G.jsxs)(n,{type:`button`,variant:`ghost`,size:`sm`,disabled:o,onClick:s,children:[(0,G.jsx)(I,{size:16,"aria-hidden":`true`,className:r(`size-3.5`,o&&`animate-spin`)}),`Refresh`]})]}),(0,G.jsxs)(`p`,{className:`mt-1 font-mono text-[11px] text-soft-foreground`,children:[e.headRef,` (`,e.headSha.slice(0,7),`) → `,e.baseRef]}),(0,G.jsxs)(`ul`,{className:`mt-3 space-y-2 text-xs`,children:[(0,G.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(K,{state:p}),(0,G.jsxs)(`span`,{children:[`Reviews: `,e.reviewDecision.replaceAll(`-`,` `)]})]}),(0,G.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(K,{state:m}),(0,G.jsxs)(`span`,{children:[`Conflicts: `,ut(e.mergeable)]})]}),e.checks.length===0?(0,G.jsx)(`li`,{children:`No checks configured`}):e.checks.map(e=>(0,G.jsx)(ht,{check:e},e.name)),e.blockers.map(e=>(0,G.jsx)(`li`,{className:`text-soft-foreground`,children:e.message},e.code))]}),e.mergeable===`conflicting`&&c?(0,G.jsx)(n,{className:`mt-4`,onClick:c,children:`Run agent on this PR`}):null,e.canOverride?(0,G.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 rounded-md border border-warning/40 bg-warning/5 p-3 text-xs`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:i,onChange:e=>d(e.target.checked),className:`mt-0.5 size-4 accent-accent-strong`}),(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`span`,{className:`block font-medium`,children:`Merge without waiting for requirements`}),(0,G.jsx)(`span`,{className:`mt-0.5 block text-soft-foreground`,children:`GitHub will allow this only if your permissions can bypass the repository rules.`})]})]}):null,e.eligibility===`unknown`?(0,G.jsx)(`p`,{className:`mt-4 text-xs text-muted-foreground`,children:`GitHub could not confirm review and branch-protection requirements. Passing checks do not establish merge readiness.`}):null,e.state===`open`&&e.methods.length>0?(0,G.jsxs)(`div`,{className:`mt-4 flex flex-col flex-wrap gap-2 sm:flex-row`,children:[(0,G.jsx)(`select`,{"aria-label":`Merge method`,value:t??``,onChange:e=>u(e.target.value),className:`h-9 min-w-0 flex-1 rounded-md border border-input bg-background px-3 text-sm`,children:e.methods.map(e=>(0,G.jsx)(`option`,{value:e,children:it[e]},e))}),(0,G.jsx)(n,{disabled:!a,onClick:l,children:q(t)})]}):null]})]})}function vt({number:e,state:t,selectedMethod:r,confirming:i,overrideRules:a,mergePending:o,mergeError:s,onOpenChange:c,onMerge:l}){return(0,G.jsx)(me,{open:i,onOpenChange:c,children:(0,G.jsxs)(pe,{"data-slot":`gh-merge-confirm`,showCloseButton:!1,children:[(0,G.jsxs)(ge,{children:[(0,G.jsxs)(fe,{children:[q(r),` pull request #`,e,`?`]}),(0,G.jsx)(de,{asChild:!0,children:(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`p`,{children:[`This will merge “`,t.title,`” into `,t.baseRef,`. GitHub will re-check the exact reviewed head before changing the repository.`]}),a&&t.canOverride?(0,G.jsx)(`p`,{"data-slot":`gh-bypass-warning`,className:`mt-4 text-sm text-warning`,children:`You are asking GitHub to bypass unmet repository requirements; GitHub may refuse if your permissions do not allow it.`}):null]})})]}),s?(0,G.jsx)(`p`,{className:`text-sm text-danger`,children:s.message}):null,(0,G.jsxs)(he,{children:[(0,G.jsx)(n,{variant:`outline`,disabled:o,onClick:()=>c(!1),children:`Cancel`}),(0,G.jsx)(n,{disabled:o,onClick:l,children:o?`Merging…`:q(r)})]})]})})}function yt({number:e,onRunAgent:t}){let n=o(),r=T(),i=E({queryKey:w.githubMergeState(e),queryFn:({signal:t})=>c(e,{},{signal:t}),retry:!1}),a=at(i.data),[l,u]=(0,W.useState)(null),[d,f]=(0,W.useState)(!1),[p,m]=(0,W.useState)(!1),h=b({mutationFn:t=>c(e,{refresh:!0}),onSuccess:(e,t)=>n.setQueryData(t,e),onError:e=>D(e instanceof Error?e.message:String(e),{tone:`danger`})}),g=ot(l,a),_=()=>({mergeState:w.githubMergeState(e),list:w.githubPages(50),comments:w.githubComments(`pr`,e),item:w.githubItem(`pr`,e),refStatus:r===void 0?void 0:w.githubRefStatusOf(r)}),v=b({mutationFn:t=>{if(!a||!g)throw Error(`No merge method is available.`);return s(e,{method:g,expectedHeadSha:a.headSha,...p&&a.canOverride?{overrideRules:!0}:{}})},onSuccess:(t,r)=>{f(!1),D(`Pull request #${e} merged`),n.invalidateQueries({queryKey:r.mergeState}),n.invalidateQueries({queryKey:r.list}),n.invalidateQueries({queryKey:r.comments}),n.invalidateQueries({queryKey:r.item}),r.refStatus&&n.invalidateQueries({queryKey:r.refStatus})},onError:(e,t)=>{D(e instanceof Error?e.message:String(e),{tone:`danger`}),n.invalidateQueries({queryKey:t.mergeState})}});return i.isPending?(0,G.jsx)(A,{"data-slot":`gh-merge-loading`,className:`mt-6 h-32 w-full`}):a?(0,G.jsxs)(`section`,{"data-slot":`gh-merge-box`,"data-eligibility":a.eligibility,"data-conflicting":mt(a.mergeable),"aria-live":`polite`,className:`mt-6 rounded-lg border border-border bg-card p-4`,children:[(0,G.jsx)(_t,{state:a,selectedMethod:g,overrideRules:p,mergeEnabled:pt(g,a,p),refreshPending:h.isPending,onRefresh:()=>h.mutate(w.githubMergeState(e)),onRunAgent:t,onConfirm:()=>f(!0),onMethodChange:u,onOverrideChange:m}),(0,G.jsx)(vt,{number:e,state:a,selectedMethod:g,confirming:d,overrideRules:p,mergePending:v.isPending,mergeError:v.error,onOpenChange:f,onMerge:()=>v.mutate(_())})]}):(0,G.jsx)(gt,{reason:ft(i.data)})}function bt(e){let t=new Set;for(let n of e)for(let e of n.labels)t.add(e);return[...t].sort((e,t)=>e.toLowerCase().localeCompare(t.toLowerCase()))}function xt(e,t={}){let n=(t.query??``).trim().toLowerCase(),r=t.labels??[],i=n.replace(/^#/,``),a=i!==``&&/^\d+$/.test(i);return e.filter(e=>r.length>0&&!r.every(t=>e.labels.includes(t))||t.assignees?.length&&!e.assignees?.some(e=>t.assignees.some(t=>t.toLowerCase()===e.toLowerCase()))||t.author!==void 0&&e.author.toLowerCase()!==t.author.toLowerCase()||t.includeNumbers&&!t.includeNumbers.has(e.number)||t.excludeNumbers?.has(e.number)||t.projectId&&e.projectIds!==void 0&&!e.projectIds.includes(t.projectId)?!1:n===``?!0:a?String(e.number).includes(i):`#${e.number} ${e.title} ${e.author} ${e.body??``}`.toLowerCase().includes(n))}function St(e,t){let n=e.trim();if(n===``)return!1;let r=n.replace(/^#/,``);return/^\d+$/.test(r)?!t.some(e=>e.number===Number(r)):t.length===0}function J(e){if(!e||!/^[0-9a-fA-F]{6}$/.test(e))return{borderColor:`var(--border)`,color:`var(--muted-foreground)`};let t=`#${e}`;return{backgroundColor:`${t}22`,borderColor:`${t}66`,color:`color-mix(in srgb, ${t} 50%, var(--foreground))`}}function Ct({label:e,color:t,plain:n=!1}){return(0,G.jsx)(`span`,{"data-slot":`gh-label`,"data-label":e,style:n?void 0:J(t),className:n?`text-[11px] font-normal text-muted-foreground`:`rounded-full border px-1.5 py-px text-[12px] font-medium`,children:e})}function wt(e){return e===`pr`?`pull request`:`issue`}function Tt(e,t,n){return e===`pr`&&!!(t||n)}function Et({backLink:e}){return e?(0,G.jsxs)(V,{to:e.to,"data-slot":`gh-back`,className:`mb-3 inline-flex items-center gap-1.5 text-xs font-medium text-muted-foreground hover:text-foreground md:hidden`,children:[(0,G.jsx)(se,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`Back to the list`]}):null}function Dt({item:e,kindWord:n,commentCount:r,hasDiffStat:i,additions:a,deletions:o}){return(0,G.jsxs)(`p`,{"data-slot":`gh-meta`,className:`flex flex-wrap items-center gap-x-1.5 font-mono text-[11px] text-soft-foreground`,children:[(0,G.jsxs)(`span`,{children:[`#`,e.number]}),`·`,(0,G.jsx)(`span`,{children:n}),`·`,(0,G.jsxs)(`span`,{children:[`opened by `,e.author]}),`·`,(0,G.jsxs)(`span`,{children:[B(e.createdAt),` ago`]}),r?(0,G.jsxs)(G.Fragment,{children:[`·`,(0,G.jsx)(Jt,{count:r})]}):null,i?(0,G.jsxs)(G.Fragment,{children:[`·`,(0,G.jsxs)(`span`,{"data-slot":`gh-diffstat`,children:[(0,G.jsxs)(`span`,{className:`text-success`,children:[`+`,a??0]}),` `,(0,G.jsxs)(`span`,{className:`text-danger`,children:[`−`,o??0]})]})]}):null,`·`,t(e.url)?(0,G.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-open-link`,className:`inline-flex items-center gap-0.5 text-muted-foreground hover:text-foreground hover:underline`,children:[`open on GitHub`,(0,G.jsx)(N,{"aria-hidden":`true`,className:`size-2.5`})]}):(0,G.jsx)(`span`,{"data-slot":`gh-open-link`,className:`text-muted-foreground`,children:`open on GitHub`})]})}function Ot({item:e,subNav:t,changes:n}){return e.kind===`pr`?t?(0,G.jsxs)(`nav`,{"aria-label":`Pull request detail`,className:`mt-4 flex border-b border-border`,children:[(0,G.jsx)(rt,{to:k(`prs`,t.filter,e.number),active:!n,children:`Conversation`}),(0,G.jsx)(rt,{to:k(`prs`,t.filter,e.number,`/changes`),active:n,children:`Changes`})]}):(0,G.jsx)(V,{to:k(`prs`,null,e.number,`/changes`),"data-slot":`gh-files-changed`,className:`mt-3 inline-flex items-center gap-1 text-xs font-medium text-muted-foreground hover:text-foreground hover:underline`,children:`Files changed`}):null}function kt({item:e,colors:t,checks:n}){return e.labels.length>0||n?(0,G.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-1.5`,children:[e.labels.map(e=>(0,G.jsx)(Ct,{label:e,color:t[e]},e)),n?(0,G.jsx)(Yt,{checks:n,url:e.url}):null]}):null}function At({item:e,colors:t,body:n}){return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{"data-slot":`gh-body`,className:`mt-5 text-sm`,children:n?(0,G.jsx)(Ze,{children:n}):(0,G.jsx)(`p`,{className:`text-soft-foreground`,children:`(no description)`})}),(0,G.jsx)(Nt,{item:e,colors:t})]})}function jt({item:e,colors:t,checks:n,comments:r,backLink:i,subNav:a,onRunAgent:o,afterHeading:s,children:c}){let l=a?.changes??!1,u=wt(e.kind),d=h(e.kind,e.number,!l).data?.detail,f=d?.body??e.body,p=d?.additions??e.additions,m=d?.deletions??e.deletions,g=Tt(e.kind,p,m),_=r??e.comments;return(0,G.jsxs)(`article`,{"data-slot":`gh-detail-inner`,className:`min-w-0 px-4 py-4 md:px-7 md:py-5`,children:[(0,G.jsx)(Et,{backLink:i}),(0,G.jsxs)(`div`,{"data-slot":`gh-description-card`,className:e.kind===`pr`?`rounded-xl border border-border bg-card p-6`:void 0,children:[e.kind===`pr`?(0,G.jsxs)(`h2`,{className:`mb-4 text-[22px] leading-snug font-normal`,children:[`#`,e.number,` `,e.title]}):null,(0,G.jsx)(Dt,{item:e,kindWord:u,commentCount:_,hasDiffStat:g,additions:p,deletions:m}),e.kind===`pr`?null:(0,G.jsx)(`h2`,{className:`mt-2 text-[22px] leading-snug font-normal`,children:e.title}),s,(0,G.jsx)(Ot,{item:e,subNav:a,changes:l}),(0,G.jsx)(kt,{item:e,colors:t,checks:n}),l&&e.kind===`pr`?(0,G.jsx)(Mt,{item:e}):(0,G.jsx)(At,{item:e,colors:t,body:f})]}),e.kind===`pr`?(0,G.jsx)(yt,{number:e.number,onRunAgent:o}):null,c]})}function Mt({item:e}){let i=o(),a=m(e.number),[s,c]=(0,W.useState)(``),[l,u]=(0,W.useState)(null),f=a.data,p=f?.available?f.files.filter(e=>e.path.toLowerCase().includes(s.toLowerCase())):[],h=p.findIndex(e=>e.path===l);(0,W.useEffect)(()=>{p.length>0&&!p.some(e=>e.path===l)&&u(p[0].path)},[f?.available?f.headSha:``,s]);let g=async()=>{let t=f?.available?f.headSha:null,n=w.githubPrChanges(e.number),r=await d(e.number,{refresh:!0});i.setQueryData(n,r),r.available&&t&&t!==r.headSha&&(u(r.files[0]?.path??null),D(`The reviewed revision changed.`))};if(a.isPending)return(0,G.jsx)(`p`,{"aria-live":`polite`,className:`mt-6 text-sm text-muted-foreground`,children:`Loading changed files…`});if(a.isError||!f)return(0,G.jsx)(`p`,{className:`mt-6 text-sm text-danger`,children:`Changed files could not be loaded.`});if(!f.available)return(0,G.jsx)(`p`,{className:`mt-6 text-sm text-muted-foreground`,children:f.reason});let _=p.map(e=>({path:e.path,...e.previousPath?{oldPath:e.previousPath}:{},status:e.status===`removed`?`deleted`:e.status===`changed`?`modified`:e.status,adds:e.additions,dels:e.deletions,binary:e.patchUnavailableReason===`binary`,patch:e.patch??``})),v=t(e.url)?`${e.url}/files`:null,y=p.find(e=>e.path===l);return(0,G.jsxs)(`section`,{"data-slot":`gh-pr-changes`,className:`mt-5 min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs`,children:[(0,G.jsxs)(`strong`,{children:[f.files.length,` changed files`]}),(0,G.jsxs)(`span`,{className:`text-success`,children:[`+`,f.additions]}),(0,G.jsxs)(`span`,{className:`text-danger`,children:[`−`,f.deletions]}),(0,G.jsxs)(`span`,{className:`font-mono text-muted-foreground`,title:f.headSha,children:[`head `,f.headSha.slice(0,8)]}),(0,G.jsx)(n,{type:`button`,variant:`outline`,size:`sm`,className:`ml-auto min-h-11`,onClick:()=>void g(),children:`Refresh`})]}),f.truncated?(0,G.jsxs)(`p`,{role:`status`,className:`mt-3 rounded-md border border-warning/40 bg-warning/10 p-3 text-xs`,children:[f.reason??`This response is incomplete.`,` `,v?(0,G.jsx)(`a`,{href:v,target:`_blank`,rel:`noopener noreferrer`,className:`underline`,children:`Open all files on GitHub`}):null]}):null,(0,G.jsxs)(`div`,{className:`mt-4 grid min-w-0 gap-4 lg:grid-cols-[240px_minmax(0,1fr)]`,children:[(0,G.jsxs)(`aside`,{className:`min-w-0`,children:[(0,G.jsx)(`input`,{"aria-label":`Filter changed files`,value:s,onChange:e=>c(e.target.value),placeholder:`Filter files…`,className:`min-h-11 w-full rounded-md border border-input bg-background px-3 text-sm`}),(0,G.jsx)(`select`,{"aria-label":`Select changed file`,value:l??``,onChange:e=>u(e.target.value),className:`mt-2 min-h-11 w-full rounded-md border border-input bg-background px-2 text-sm lg:hidden`,children:p.map(e=>(0,G.jsx)(`option`,{children:e.path},e.path))}),(0,G.jsx)(`ul`,{className:`mt-2 hidden max-h-[60vh] overflow-auto lg:block`,children:p.map(e=>(0,G.jsx)(`li`,{children:(0,G.jsxs)(`button`,{type:`button`,onClick:()=>u(e.path),className:r(`min-h-11 w-full truncate rounded px-2 text-left text-xs`,l===e.path&&`bg-muted font-medium`),title:e.path,children:[e.status,` · `,e.path,` `,(0,G.jsxs)(`span`,{className:`text-success`,children:[`+`,e.additions]}),` `,(0,G.jsxs)(`span`,{className:`text-danger`,children:[`−`,e.deletions]})]})},e.path))})]}),(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsxs)(`div`,{className:`mb-2 flex justify-end gap-1`,children:[(0,G.jsx)(n,{"aria-label":`Previous file`,variant:`outline`,size:`icon`,className:`min-h-11 min-w-11`,disabled:h<=0,onClick:()=>u(p[h-1]?.path??null),children:(0,G.jsx)(tt,{})}),(0,G.jsx)(n,{"aria-label":`Next file`,variant:`outline`,size:`icon`,className:`min-h-11 min-w-11`,disabled:h<0||h>=p.length-1,onClick:()=>u(p[h+1]?.path??null),children:(0,G.jsx)(ne,{size:16})})]}),p.length===0?(0,G.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No changed files match this filter.`}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(nt,{files:_.filter(e=>e.path===l),wrap:!0,className:`min-w-0`}),y&&!y.patch?(0,G.jsxs)(`p`,{className:`rounded-b border border-border p-3 text-xs text-muted-foreground`,children:[`Patch unavailable: `,y.patchUnavailableReason??`not-provided`,`.`]}):null]})]})]})]})}function Nt({item:e,colors:t}){let n=h(e.kind,e.number),r=n.data,i=(0,W.useMemo)(()=>{let e=[...(r?.comments??[]).map(e=>({row:`comment`,comment:e})),...(r?.events??[]).map(e=>({row:`event`,event:e}))],t=e=>{let t=Date.parse(Pt(e));return Number.isNaN(t)?-1/0:t};return e.sort((e,n)=>t(e)-t(n))},[r?.comments,r?.events]);return n.isPending?(0,G.jsxs)(`section`,{"data-slot":`gh-thread-loading`,className:`mt-6 border-t border-border pt-5`,children:[(0,G.jsx)(A,{className:`mb-3 h-3 w-24`}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,G.jsx)(A,{className:`h-14 w-full`}),(0,G.jsx)(A,{className:`h-14 w-full`})]})]}):!r||!r.available?(0,G.jsxs)(`section`,{"data-slot":`gh-thread-error`,className:`mt-6 border-t border-border pt-5 text-xs text-soft-foreground`,children:[(0,G.jsxs)(`span`,{children:[`Couldn’t load comments — `,r?.reason??(n.error instanceof Error?n.error.message:`could not load comments`),`. `]}),(0,G.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-0.5 text-muted-foreground hover:text-foreground hover:underline`,children:[`open on GitHub`,(0,G.jsx)(N,{"aria-hidden":`true`,className:`size-2.5`})]})]}):i.length===0?null:(0,G.jsxs)(`section`,{"data-slot":`gh-thread`,className:`mt-6 border-t border-border pt-5`,children:[(0,G.jsxs)(`h3`,{"data-slot":`gh-thread-header`,className:`mb-4 text-[11px] font-semibold tracking-wide text-soft-foreground uppercase`,children:[`Activity · `,r.comments.length,` comment`,r.comments.length===1?``:`s`]}),(0,G.jsx)(`ul`,{className:`flex flex-col gap-5`,children:Ft(i).map(e=>e.group===`commits`?(0,G.jsx)(It,{commits:e.commits,colors:t},e.commits[0].id):e.entry.row===`comment`?(0,G.jsx)(Kt,{comment:e.entry.comment},`${e.entry.comment.kind}-${e.entry.comment.id}`):(0,G.jsx)(Lt,{event:e.entry.event,colors:t},e.entry.event.id))}),r.truncated?(0,G.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-thread-truncated`,className:`mt-4 inline-flex items-center gap-0.5 text-xs text-soft-foreground hover:text-foreground hover:underline`,children:[`thread truncated — open on GitHub`,(0,G.jsx)(N,{"aria-hidden":`true`,className:`size-2.5`})]}):null]})}var Pt=e=>e.row===`comment`?e.comment.createdAt:e.event.createdAt;function Ft(e){let t=[],n=[],r=()=>{n.length!==0&&(n.length===1?t.push({group:`single`,entry:{row:`event`,event:n[0]}}):t.push({group:`commits`,commits:n}),n=[])};for(let i of e){if(i.row===`event`&&i.event.kind===`committed`&&i.row===`event`){let e=n[n.length-1];e&&e.actor!==i.event.actor&&r(),n.push(i.event);continue}r(),t.push({group:`single`,entry:i})}return r(),t}function It({commits:e,colors:t}){let[n,r]=(0,W.useState)(!1),i=e[0]?.actor??`?`;return n?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`true`,className:`min-w-0`,children:(0,G.jsxs)(`button`,{type:`button`,"aria-expanded":!0,onClick:()=>r(!1),className:`flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground hover:text-foreground`,children:[(0,G.jsx)(`span`,{"aria-hidden":`true`,children:Y.committed}),(0,G.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,G.jsxs)(`span`,{children:[`added `,e.length,` commits`]})]})}),e.map(e=>(0,G.jsx)(Lt,{event:e,colors:t},e.id))]}):(0,G.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`false`,className:`min-w-0`,children:(0,G.jsxs)(`button`,{type:`button`,"aria-expanded":!1,onClick:()=>r(!0),className:`flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground hover:text-foreground`,children:[(0,G.jsx)(`span`,{"aria-hidden":`true`,children:Y.committed}),(0,G.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,G.jsxs)(`span`,{children:[`added `,e.length,` commits`]}),(0,G.jsx)(`span`,{className:`shrink-0`,children:B(e[e.length-1].createdAt)})]})})}var Y={committed:`⚙`,labeled:`◆`,unlabeled:`◇`,assigned:`◍`,unassigned:`◌`,merged:`⑃`,closed:`⊘`,reopened:`⊙`,head_ref_force_pushed:`↻`,"cross-referenced":`↗`,renamed:`✎`};function Lt({event:e,colors:t}){return(0,G.jsxs)(`li`,{"data-slot":`gh-event-row`,"data-kind":e.kind,className:r(`flex min-w-0 items-center gap-1.5 font-mono text-[11px] text-soft-foreground`,e.kind===`merged`&&`text-accent-foreground`),children:[(0,G.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0`,children:Y[e.kind]}),(0,G.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.actor}),(0,G.jsx)(Ut,{event:e,colors:t}),(0,G.jsx)(`span`,{className:`shrink-0`,children:B(e.createdAt)}),e.url?(0,G.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`open ${e.kind} on GitHub`,className:`ml-auto shrink-0 text-muted-foreground hover:text-foreground`,children:(0,G.jsx)(N,{"aria-hidden":`true`,className:`size-2.5`})}):null]})}function Rt({event:e}){return(0,G.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,G.jsx)(`span`,{className:`shrink-0`,children:`committed`}),e.sha?(0,G.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:e.sha.slice(0,7)}):null,e.message?(0,G.jsx)(`span`,{className:`truncate font-sans text-foreground`,children:e.message}):null,(0,G.jsx)(Wt,{checks:e.checks})]})}function zt({event:e,colors:t}){return(0,G.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,G.jsx)(`span`,{className:`shrink-0`,children:e.kind===`labeled`?`added the`:`removed the`}),e.label?(0,G.jsx)(`span`,{"data-slot":`gh-event-label`,style:J(e.label.color??t[e.label.name]),className:`max-w-[12rem] truncate rounded-full border px-1.5 py-px font-sans text-[12px]`,children:e.label.name}):null,(0,G.jsx)(`span`,{className:`shrink-0`,children:`label`})]})}function Bt({event:e}){return(0,G.jsxs)(`span`,{className:`truncate`,children:[e.kind===`assigned`?`assigned`:`unassigned`,` `,e.subject??`someone`]})}function Vt({event:e}){return(0,G.jsxs)(`span`,{className:`truncate`,children:[`referenced this in `,e.refNumber?`#${e.refNumber}`:`another thread`,e.refTitle?` ${e.refTitle}`:``]})}var Ht={committed:e=>(0,G.jsx)(Rt,{event:e}),labeled:(e,t)=>(0,G.jsx)(zt,{event:e,colors:t}),unlabeled:(e,t)=>(0,G.jsx)(zt,{event:e,colors:t}),assigned:e=>(0,G.jsx)(Bt,{event:e}),unassigned:e=>(0,G.jsx)(Bt,{event:e}),merged:()=>(0,G.jsx)(`span`,{children:`merged this`}),closed:()=>(0,G.jsx)(`span`,{children:`closed this`}),reopened:()=>(0,G.jsx)(`span`,{children:`reopened this`}),head_ref_force_pushed:()=>(0,G.jsx)(`span`,{children:`force-pushed`}),renamed:e=>(0,G.jsxs)(`span`,{className:`truncate`,children:[`renamed this to `,e.subject??`—`]}),"cross-referenced":e=>(0,G.jsx)(Vt,{event:e})};function Ut({event:e,colors:t}){return Ht[e.kind]?.(e,t)??null}function Wt({checks:e}){return e?(0,G.jsx)(`span`,{"data-slot":`gh-commit-checks`,"data-checks":e,"aria-label":`checks ${e}`,className:r(`shrink-0`,Z[e]),children:X[e]}):null}var Gt={approved:{label:`approved`,tone:`border-success/40 text-success`},changes_requested:{label:`changes requested`,tone:`border-danger/40 text-danger`},commented:{label:`commented`,tone:`border-border text-muted-foreground`},dismissed:{label:`dismissed`,tone:`border-border text-muted-foreground`}};function Kt({comment:e}){let t=e.reviewState?Gt[e.reviewState]:null;return(0,G.jsxs)(`li`,{"data-slot":`gh-thread-entry`,"data-kind":e.kind,className:`min-w-0`,children:[(0,G.jsxs)(`div`,{className:`mb-1.5 flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground`,children:[(0,G.jsx)(qt,{url:e.avatarUrl,login:e.author}),(0,G.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.author}),(0,G.jsx)(`span`,{children:B(e.createdAt)}),t?(0,G.jsx)(`span`,{"data-slot":`gh-review-chip`,"data-review-state":e.reviewState,className:r(`rounded-full border px-1.5 py-px font-sans text-[12px] font-medium`,t.tone),children:t.label}):null,(0,G.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`open comment on GitHub`,className:`ml-auto shrink-0 text-muted-foreground hover:text-foreground`,children:(0,G.jsx)(N,{"aria-hidden":`true`,className:`size-2.5`})})]}),(0,G.jsx)(`div`,{"data-slot":`gh-thread-body`,className:`text-sm`,children:e.body?(0,G.jsx)(Ze,{children:e.body}):(0,G.jsx)(`p`,{className:`text-soft-foreground`,children:`(no body)`})})]})}function qt({url:e,login:t}){let[n,r]=(0,W.useState)(!1);return e&&!n?(0,G.jsx)(`img`,{src:e,alt:``,width:16,height:16,loading:`lazy`,onError:()=>r(!0),"data-slot":`gh-avatar`,className:`size-4 shrink-0 rounded-full`}):(0,G.jsx)(`span`,{"data-slot":`gh-avatar-fallback`,"aria-hidden":`true`,className:`flex size-4 shrink-0 items-center justify-center rounded-full bg-muted text-[8px] font-semibold text-muted-foreground uppercase`,children:t.slice(0,1)||`?`})}var X={passing:`✓`,failing:`✗`,pending:`○`},Z={passing:`text-success`,failing:`text-danger`,pending:`text-muted-foreground`};function Jt({count:e}){return e?(0,G.jsxs)(`span`,{"data-slot":`gh-comment-count`,"data-count":e,"aria-label":`${e} comment${e===1?``:`s`}`,className:`inline-flex shrink-0 items-center gap-0.5`,children:[(0,G.jsx)(be,{"aria-hidden":`true`,className:`size-3`}),e]}):null}function Yt({checks:e,url:t}){let n=r(`text-[11px] font-medium`,Z[e],t&&`hover:underline`),i=`${X[e]} checks ${e}`;return t?(0,G.jsx)(`a`,{href:`${t}/checks`,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-checks`,"data-checks":e,className:n,children:i}):(0,G.jsx)(`span`,{"data-slot":`gh-checks`,"data-checks":e,className:n,children:i})}function Xt({checks:e}){return(0,G.jsx)(`span`,{"data-slot":`gh-row-checks`,"data-checks":e,title:`checks ${e}`,"aria-label":`checks ${e}`,className:r(`shrink-0 font-sans text-[11px] font-semibold`,Z[e]),children:X[e]})}function Q(e){return`${e.kind===`pr`?`Address GitHub pull request`:`Fix GitHub issue`} #${e.number}: ${e.title}\n\n${e.url}`}function Zt(e,t=[]){let n=Q(e);return e.body?.trim()&&(n+=`\n\n---\n\n${e.body.trim()}`),t.length&&(n+=Qt(t)),n}function Qt(e){return`\n\nUse these skills where relevant: ${e.join(`, `)}.`}function $t(e,t){return e.replace(/\{\{\s*number\s*\}\}/gi,()=>`#${t.number}`).replace(/\{\{\s*title\s*\}\}/gi,()=>t.title).replace(/\{\{\s*url\s*\}\}/gi,()=>t.url)}function en(e,t){if(e.includes(t.url))return!0;let n=t.kind===`pr`?String.raw`(?:pull\s+request|pr)`:String.raw`issue`;return new RegExp(String.raw`\b${n}\s*#?\s*${t.number}\b`,`i`).test(e)}function tn(e,t,n){let r=(n??``).trim();if(!r)return Zt(e,t);let i=Q(e),a=r.startsWith(i)?i+$t(r.slice(i.length),e):$t(r,e),o=en(a,e)?a:`${i}\n\n${a}`;return t.length?o+Qt(t):o}function nn(e){let t=[];for(let n of e.slice(0,8)){let e=new Set(t.map(e=>e.id)),r=n;for(let t=2;e.has(r);t++)r=`${n}-${t}`;t.push({id:r,name:n,skill:n,prompt:`{{task}}`})}return t}function rn(e,t,n,r,i={}){return t?{...i,workflow:t,task:tn(e,n,r)}:n.length?{...i,steps:nn(n),task:tn(e,[],r)}:{...i,workflow:`quick-task`,task:tn(e,[],r)}}function an(e){let t=x(),n=S(),r=p(t.data),i=n.data?.defaultRunner,a=He(e.runner,r,i??r[0]??`claude`),o=y(a),s=n.data?.modelsLocked===!0,{accounts:c,repoAccount:l}=Re(),u=c.some(t=>t.provider===a&&t.id===e.account)?e.account:null,d=Ae(s?null:e.model,a,n.data?.defaultModels,o.data),f=Ne(a,d,o.data);return{runner:a,runnerExplicit:e.runner!==null,model:d,effort:s?``:Pe(e.effort,f),effortOptions:f,runners:r,defaultRunner:i,canRun:t.isSuccess&&r.length>0,modelsLocked:s,providerPending:t.isPending,providerError:t.isError,accounts:c,account:u,repoAccount:l}}function on(e){return{runner:Me(e.runner,e.defaultRunner,e.runnerExplicit),model:e.modelsLocked?void 0:e.model||void 0,effort:e.modelsLocked?void 0:e.effort||void 0}}function sn(e){return{...on(e),...e.account?{agentProfile:e.account}:{}}}function cn({pick:e,onChange:t,disabled:n=!1,accounts:r=!1,layout:i}){let a=(0,W.useRef)(null),o=(0,W.useRef)(null),[s,c]=(0,W.useState)(()=>typeof window<`u`&&window.innerWidth<=767);(0,W.useLayoutEffect)(()=>{let e=a.current;if(i!==`row`||!e)return;let t=()=>{let t=window.innerWidth<=767||e.getBoundingClientRect().width<550,n=document.activeElement;o.current=n instanceof HTMLElement&&e.contains(n)?n:null,c(t)};t();let n=typeof ResizeObserver>`u`?null:new ResizeObserver(t);return n?.observe(e),window.addEventListener(`resize`,t),()=>{n?.disconnect(),window.removeEventListener(`resize`,t)}},[i]),(0,W.useLayoutEffect)(()=>{let e=o.current;o.current=null,e&&e.isConnected&&document.activeElement!==e&&e.focus()},[s]);let l=an(e),{runner:u,model:d,effort:f,effortOptions:p,runners:m,canRun:h,modelsLocked:g}=l,_=S(),v=y(u),b=Le(u,v.data,[e.model,_.data?.defaultModels?.[u]]),x=n||!h,C=r?l.accounts:[],w=m.length>1||m.some(e=>Ve(C,e))?(0,G.jsx)(je,{icon:(0,G.jsx)(oe,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,runners:m,value:u,accounts:C,account:r?l.account:null,repoAccount:r?l.repoAccount:void 0,disabled:x,onPick:(n,i)=>t(r?{runner:n,account:i,model:n===u?e.model:null,effort:e.effort}:{runner:n,account:null,model:null,effort:e.effort})},`runner`):null,T=(0,G.jsx)(U,{icon:(0,G.jsx)(te,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,slot:`model-pill`,ariaLabel:`Model`,label:d===``?`Default`:b.find(e=>e.id===d).label,value:d,disabled:x,readOnly:g===!0,disabledHint:g?`Model selection is locked to native coding-agent settings.`:void 0,onPick:n=>{let r=Ne(u,n,v.data);t({...e,model:n,effort:e.effort===null?null:Pe(e.effort,r)})},options:b.map(e=>({value:e.id,label:e.label,desc:e.desc})),status:ze(u,v.data,v.isError,v.isFetching)},`model`),E=(0,G.jsx)(U,{icon:(0,G.jsx)(F,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,slot:`effort-pill`,ariaLabel:`Effort`,label:p.find(e=>e.value===f)?.label??`auto`,value:f,disabled:x,readOnly:g===!0,disabledHint:g?`Effort selection is locked to native coding-agent settings.`:void 0,onPick:n=>t({...e,effort:n}),options:p.map(e=>({value:e.value,label:e.label,desc:e.desc}))},`effort`);return i===`row`?(0,G.jsx)(`div`,{ref:a,"data-slot":`engine-row-box`,children:(0,G.jsx)(`div`,{"data-slot":`engine-row`,className:`engine-row`,role:`group`,"aria-label":`Agent settings`,children:(0,G.jsx)(Fe,{children:s?[w,E,T]:[w,T,E]})})}):(0,G.jsxs)(Fe,{children:[w,T,E]})}var ln={workflow:null,skills:[]},un=`cez-followup-selection`;function dn(e){let t=e&&typeof e==`object`?e:{};return{workflow:typeof t.workflow==`string`?t.workflow:null,skills:Array.isArray(t.skills)?t.skills.filter(e=>typeof e==`string`):[]}}function fn(){try{let e=localStorage.getItem(un);return e?dn(JSON.parse(e)):{...ln}}catch{return{...ln}}}function pn(e){try{localStorage.setItem(un,JSON.stringify(e))}catch{}}var $=`cez-followup-prompt:`;function mn(e){try{return localStorage.getItem($+e)??``}catch{return``}}function hn(e,t){try{t===``?localStorage.removeItem($+e):localStorage.setItem($+e,t)}catch{}}function gn({item:e,workflows:r,skills:i,workflow:a,onWorkflowChange:s,selectedSkills:c,onSkillsChange:u,engine:d,onEngineChange:p,queuedRunId:m,onQueued:h}){let v=o(),y=_(),x=g().data?.capabilities.automations===!0,S=e.kind===`pr`?`PR`:`issue`,C=c.filter(e=>i.some(t=>t.name===e)),[T]=(0,W.useState)(()=>Q(e)),[E,O]=(0,W.useState)(()=>mn(e.url)||T),k=an(d),A=(0,W.useRef)(null),j=(0,W.useRef)(null);(0,W.useEffect)(()=>{hn(e.url,E===T?``:E)},[e.url,E,T]);let M=(0,W.useMemo)(()=>we(We(y.data?.promptTemplates),{automations:x}),[y.data?.promptTemplates,x]),N=e=>{let t=A.current,n=ke({prompt:E,base:T,selectionStart:t?.selectionStart??null,focused:document.activeElement===t,remembered:j.current}),r=Ee(E,n,e);O(r.text),j.current=r.caret,requestAnimationFrame(()=>{A.current?.focus(),A.current?.setSelectionRange(r.caret,r.caret)})},P=Te(M,C),F=(0,W.useRef)(E);F.current=E;let I=(0,W.useRef)(``);(0,W.useEffect)(()=>{let e=Se(F.current,I.current,P,T);I.current=e.applied,e.text!==F.current&&O(e.text)},[P,T]);let L=b({mutationFn:async()=>k.canRun?f(rn(e,a,C,E,sn(k))):null,onSuccess:t=>{if(t===null)return;let n=t;n&&h(e.url,n.id),D(`Added to the queue — ${S} #${e.number}`),C.length>0&&y.data!==void 0&&l({skillUsage:C.reduce((e,t)=>Ye(e,t),y.data.skillUsage)}).then(()=>v.invalidateQueries({queryKey:w.uiState})).catch(()=>{}),hn(e.url,``),O(T),I.current=``,v.invalidateQueries({queryKey:w.runs.all})},onError:e=>D(e.message,{tone:`danger`})}),te=e=>{$e({key:e.key,shiftKey:e.shiftKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,repeat:e.repeat,isComposing:e.nativeEvent.isComposing})&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),!L.isPending&&k.canRun&&L.mutate())},R=e=>u(c.includes(e)?c.filter(t=>t!==e):[...c,e]);return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`section`,{"data-slot":`gh-hand`,className:`mt-7 rounded-lg border border-border bg-card p-4`,children:[(0,G.jsx)(`h3`,{className:`text-xl font-normal text-foreground`,children:`Hand this to the agent`}),(0,G.jsxs)(`label`,{className:`gh-field gh-prompt-field`,children:[(0,G.jsx)(`span`,{children:`Instructions for the agent`}),(0,G.jsx)(_e,{ref:A,"data-slot":`gh-custom-prompt`,"aria-label":`Custom prompt`,"aria-keyshortcuts":`Control+Enter Meta+Enter`,value:E,onChange:e=>O(e.target.value),onSelect:e=>{j.current=e.currentTarget.selectionStart},onKeyDown:te,placeholder:`Instructions for the agent… (#${e.number} and its link are always sent)`,className:`mt-3 min-h-20 text-[13px]`})]}),(0,G.jsx)(ee,{templates:M,onInsert:N}),(0,G.jsxs)(`div`,{className:`gh-handoff-settings`,children:[(0,G.jsxs)(`div`,{className:`gh-field`,children:[(0,G.jsx)(`span`,{children:`Workflow`}),(0,G.jsx)(_n,{workflows:r,value:a,onChange:s})]}),(0,G.jsxs)(`div`,{className:`gh-field`,children:[(0,G.jsx)(`span`,{children:`Skills · select one or more`}),(0,G.jsx)(yn,{skills:i,skillUsage:y.data?.skillUsage,selected:C,onToggle:R})]}),C.length>0?(0,G.jsx)(`div`,{"data-slot":`gh-skill-chips`,className:`mt-2.5 flex flex-wrap gap-1.5`,children:C.map(e=>(0,G.jsxs)(`button`,{type:`button`,"data-slot":`gh-skill-chip`,"data-skill":e,onClick:()=>R(e),title:`Remove this skill`,className:`inline-flex min-h-11 items-center gap-2 rounded-lg border border-border bg-card px-3 text-xs font-medium text-foreground transition-colors hover:bg-danger/10 hover:text-danger`,children:[e,(0,G.jsx)(ae,{size:16,"aria-hidden":`true`,className:`size-3`})]},e))}):null,(0,G.jsx)(cn,{layout:`row`,pick:d,onChange:p,disabled:L.isPending||!k.canRun,accounts:!0}),(0,G.jsxs)(`div`,{className:`gh-field`,children:[(0,G.jsx)(`span`,{children:`Account`}),(0,G.jsx)(vn,{resolved:k,disabled:L.isPending||!k.canRun,onPick:e=>p({...d,account:e})})]}),!k.providerPending&&!k.canRun?(0,G.jsxs)(`span`,{"data-slot":`gh-provider-gate`,className:`inline-flex flex-wrap items-center gap-1 text-xs text-muted-foreground`,children:[k.providerError?`Provider authentication could not be verified.`:`Connect an agent provider to run this item.`,(0,G.jsx)(V,{to:`/settings/agents#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}):null]}),(0,G.jsxs)(`p`,{className:`text-[11px] leading-relaxed text-muted-foreground`,children:[e.kind===`pr`?`PR`:`Issue`,` number and link remain attached to the task. Edit the prompt before starting. Cmd/Ctrl+Enter submits; Enter adds a new line.`]})]}),(0,G.jsxs)(`div`,{"data-slot":`gh-handoff-actions`,className:`mt-[22px] flex flex-wrap items-center gap-2.5`,children:[t(e.url)?(0,G.jsx)(n,{asChild:!0,variant:`outline`,children:(0,G.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,children:`Open in GitHub`})}):null,(0,G.jsxs)(n,{variant:`primary`,"data-action":`gh-run`,disabled:L.isPending||!k.canRun,onClick:()=>L.mutate(),children:[(0,G.jsx)(Qe,{"aria-hidden":`true`,className:`size-3.5`}),`Run agent on this `,S]}),(0,G.jsx)(`kbd`,{"aria-hidden":`true`,className:`rounded-[5px] border border-b-2 border-border bg-card px-[5px] py-px font-mono text-[11px] font-medium text-muted-foreground`,children:et()}),m?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`span`,{"data-slot":`gh-queued`,className:`flex items-center gap-1 text-xs font-medium text-success`,children:[(0,G.jsx)(z,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`queued`]}),(0,G.jsx)(V,{to:`/tasks/${m}`,"data-slot":`gh-view-run`,className:`text-xs font-semibold text-accent-text hover:underline`,children:`View task →`})]}):null]})]})}function _n({workflows:e,value:t,onChange:n}){let[i,a]=(0,W.useState)(!1),[o,s]=(0,W.useState)(``),c=(0,W.useRef)(null),l=Ge(e,o);return(0,G.jsxs)(P,{open:i,onOpenChange:e=>{a(e),e||s(``)},children:[(0,G.jsx)(j,{asChild:!0,children:(0,G.jsxs)(`button`,{type:`button`,"data-slot":`gh-workflow-trigger`,"aria-label":`Choose a workflow`,className:r(Be,t&&`border-foreground/60 font-mono text-[11px] font-semibold text-foreground`),children:[(0,G.jsx)(re,{size:16,"aria-hidden":`true`,className:`size-3 shrink-0 text-accent-icon`}),(0,G.jsx)(`span`,{className:`min-w-0 max-w-44 truncate`,children:t??`workflow`}),(0,G.jsx)(le,{size:16,"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,G.jsx)(M,{align:`start`,sideOffset:8,className:`w-[320px] max-w-[calc(100vw-2rem)] p-0`,children:(0,G.jsxs)(Ce,{shouldFilter:!1,children:[(0,G.jsx)(xe,{placeholder:`search workflows…`,value:o,onValueChange:s,onInput:()=>c.current?.scrollTo(0,0)}),(0,G.jsxs)(De,{ref:c,"data-slot":`gh-workflow-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[l.length===0?(0,G.jsx)(Oe,{children:`Nothing matches.`}):null,(0,G.jsx)(H,{children:l.map(e=>{let r=t===e.name;return(0,G.jsxs)(Ie,{value:`workflow ${e.name}`,keywords:Ke(e.name,e.description),"data-slot":`gh-workflow-option`,"data-workflow":e.name,onSelect:()=>{n(r?null:e.name),a(!1)},children:[(0,G.jsx)(`span`,{className:`shrink-0 font-mono text-xs`,children:e.name}),e.description?(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,r?(0,G.jsx)(z,{size:16,"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-link-foreground`}):null]},e.name)})})]})]})})]})}function vn({resolved:e,disabled:t,onPick:n}){let r=e.accounts.filter(t=>t.provider===e.runner),i=[...r.some(e=>e.id==="default")?[]:[{value:Ue,label:`Default`}],...r.map(e=>({value:e.id,label:e.label,desc:e.configDir}))],a=e.account??e.repoAccount?.[e.runner]??`default`;return(0,G.jsx)(U,{icon:(0,G.jsx)(ue,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),slot:`account-pill`,ariaLabel:`Account`,label:i.find(e=>e.value===a)?.label??`Default`,value:a,options:i,disabled:t,onPick:n})}function yn({skills:e,skillUsage:t,selected:n,onToggle:i}){let[a,o]=(0,W.useState)(!1),[s,c]=(0,W.useState)(``),[l,u]=(0,W.useState)(null),d=(0,W.useRef)(null),{mostUsed:f,project:p,global:m,ranked:h}=Xe(e,s,t),g=(e,t)=>{let a=n.includes(e.name);return(0,G.jsxs)(Ie,{value:`skill ${e.name} ${e.path}`,keywords:Ke(e.name,e.description),"data-slot":`gh-skill-option`,"data-skill":e.name,"data-selected":a?`true`:void 0,onSelect:()=>i(e.name),children:[(0,G.jsx)(`span`,{className:r(`shrink-0 font-mono text-xs`,t&&`font-semibold`),children:e.name}),e.description?(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,(0,G.jsx)(`button`,{type:`button`,"data-slot":`gh-skill-view`,"aria-label":`View skill ${e.name}`,title:`View skill`,onClick:t=>{t.preventDefault(),t.stopPropagation(),u(e)},className:`ml-auto shrink-0 rounded-sm p-0.5 text-soft-foreground transition-colors hover:text-foreground`,children:(0,G.jsx)(ye,{"aria-hidden":`true`,className:`size-3.5`})}),a?(0,G.jsx)(z,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0 text-link-foreground`}):null]},e.path)};return e.length===0?null:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(O,{skill:l,onClose:()=>u(null)}),(0,G.jsxs)(P,{open:a,onOpenChange:e=>{o(e),e||c(``)},children:[(0,G.jsx)(j,{asChild:!0,children:(0,G.jsxs)(`button`,{type:`button`,"data-slot":`gh-skills-trigger`,"aria-label":`Choose skills`,className:r(Be,n.length>0&&`border-foreground/60 font-semibold text-foreground`),children:[(0,G.jsx)(ce,{size:16,"aria-hidden":`true`,className:`size-3 shrink-0 text-accent-icon`}),`skills`,n.length>0?` · ${n.length}`:``,(0,G.jsx)(le,{size:16,"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,G.jsx)(M,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,G.jsxs)(Ce,{shouldFilter:!1,children:[(0,G.jsx)(xe,{placeholder:`search skills…`,value:s,onValueChange:c,onInput:()=>d.current?.scrollTo(0,0)}),(0,G.jsxs)(De,{ref:d,"data-slot":`gh-skill-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[(h?h.length===0:f.length===0&&p.length===0&&m.length===0)?(0,G.jsx)(Oe,{children:`Nothing matches.`}):null,h?h.length>0?(0,G.jsx)(H,{children:h.map(e=>g(e,qe(e)))}):null:(0,G.jsxs)(G.Fragment,{children:[f.length>0?(0,G.jsx)(H,{heading:`Most used`,children:f.map(e=>g(e,qe(e)))}):null,p.length>0?(0,G.jsx)(H,{heading:`Project skills`,children:p.map(e=>g(e,!0))}):null,m.length>0?(0,G.jsx)(H,{heading:`Global`,children:m.map(e=>g(e,!1))}):null]})]})]})})]})]})}var bn=new WeakMap;function xn(){let e=fn(),t={workflow:e.workflow,selectedSkills:e.skills,engine:{runner:null,model:null,effort:null,account:null},queued:new Map},n=new Set;return{snapshot:()=>t,subscribe:e=>(n.add(e),()=>{n.delete(e)}),update:e=>{t={...t,...e},(e.workflow!==void 0||e.selectedSkills!==void 0)&&pn({workflow:t.workflow,skills:[...t.selectedSkills]}),n.forEach(e=>e())}}}function Sn(){let e=o(),{projectId:t}=u(),n=bn.get(e);n||bn.set(e,n=new Map);let r=n.get(t);r||n.set(t,r=xn());let{snapshot:i,subscribe:a,update:s}=r,c=(0,W.useSyncExternalStore)(a,i,i),l=v(),d=C(),f=_(),p=l.data?.workflows;(0,W.useEffect)(()=>{p&&c.workflow!==null&&!p.some(e=>e.name===c.workflow)&&s({workflow:null})},[s,p,c.workflow]);let m=(0,W.useMemo)(()=>Je(d.data??[],f.data?.skillUsage),[d.data,f.data?.skillUsage]);return{...c,workflows:l,skillList:m,setWorkflow:e=>s({workflow:e}),setSelectedSkills:e=>s({selectedSkills:e}),setEngine:e=>s({engine:e}),onQueued:(e,t)=>s({queued:new Map(i().queued).set(e,t)})}}export{Jt as a,Ft as c,J as d,St as f,Xt as i,bt as l,gn as n,jt as o,Zt as r,Ct as s,Sn as t,xt as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Qr as e,Rr as t,Yr as n,Zr as r}from"./project-scope-context-
|
|
1
|
+
import{Qr as e,Rr as t,Yr as n,Zr as r}from"./project-scope-context-CaUqlAd7.js";var i=class extends n{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type=`infinite`,super.setOptions(e)}getOptimisticResult(e){return e._type=`infinite`,super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(t,n){let{state:i}=t,a=super.createResult(t,n),{isFetching:o,isRefetching:s,isError:c,isRefetchError:l}=a,u=i.fetchMeta?.fetchMore?.direction,d=c&&u===`forward`,f=o&&u===`forward`,p=c&&u===`backward`,m=o&&u===`backward`;return{...a,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:r(n,i.data),hasPreviousPage:e(n,i.data),isFetchNextPageError:d,isFetchingNextPage:f,isFetchPreviousPageError:p,isFetchingPreviousPage:m,isRefetchError:l&&!d&&!p,isRefetching:s&&!f&&!m}}};function a(e,n){return t(e,i,n)}export{a as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Rr as e,Yr as t}from"./project-scope-context-CaUqlAd7.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-CHUAMTHK.js";import{i,t as a}from"./react-runtime-CCIEwYL0.js";import{E as o,Jr as s,Jt as c,Zt as l,i as u,j 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-CHUAMTHK.js";import{i,t as a}from"./react-runtime-CCIEwYL0.js";import{E as o,Jr as s,Jt as c,Zt as l,i as u,j as d}from"./project-scope-context-CaUqlAd7.js";import{Pt as f,Rt as ee,Un as p,jt as te,n as ne}from"./queries-DYfIpJ-d.js";import{n as m}from"./toaster-B1MyeHiE.js";import{i as h,p as g,r as re,t as ie}from"./dropdown-menu-DhrBcVgr.js";import{a as _,c as v,i as y,n as b,o as ae,r as x,s as S,t as C}from"./alert-dialog-Dj464rjk.js";import{C as w,Q as T,S as oe,X as se,a as E,ct as ce,dt as D,l as le,lt as O,mt as k,n as A,rt as ue,st as j,u as de,x as M,y as N}from"./design-icons-DmYTv2r1.js";import{a as P,c as F,i as I,n as L,s as R,t as z}from"./textarea-DlVUfdWG.js";import{t as fe}from"./centered-state-DGyy0SuA.js";import{i as B,l as pe,s as me}from"./skills-DFBiAuJG.js";/* empty css */import{_ as he,a as V,d as ge,g as _e,h as ve,i as H,l as ye,m as U,o as be,p as xe,r as Se,s as Ce,t as W,v as G}from"./sortable.esm-zp_qkYGV.js";import{rn as K,wt as we}from"./index-D489J7QW.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)(de,{"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)(z,{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)(O,{"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)(M,{"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)(D,{"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)(j,{"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)(z,{"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)(D,{"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)(k,{"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)(L,{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)(F,{className:`text-xl font-normal`,children:`Import workflow YAML`}),(0,Q.jsx)(P,{className:`sr-only`,children:`Paste a portable workflow definition to import.`}),(0,Q.jsx)(z,{"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{Jr as n,Mr 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{Jr as n,Mr as r}from"./project-scope-context-CaUqlAd7.js";import{i}from"./live-protocol-BDY7JJpT.js";var a=e(t(),1);function o(e,t){if(!i(e.path))throw Error(`unsupported shared read`);let n=new URL(e.path,`http://cezar.invalid`);return n.searchParams.sort(),r({kind:`read`,path:`${n.pathname}${n.search}`,intervalMs:e.intervalMs},{value:t})}function s(e,t,r,i){let s=n(),c=JSON.stringify(t),l=(0,a.useMemo)(()=>JSON.parse(c),[c]);(0,a.useEffect)(()=>{if(!e||r===!1)return;let t=!0,n=o({path:e,intervalMs:r},(e,n)=>{n||s.cancelQueries({queryKey:l,exact:!0}).then(()=>{t&&s.setQueryData(l,i?i(e,s):e)})});return()=>{t=!1,n()}},[s,e,l,r,i])}function c(e,t){return r({kind:`topic`,topic:e},{value:t})}export{o as n,s as r,c as t};
|
package/web/dist/index.html
CHANGED
|
@@ -47,20 +47,20 @@
|
|
|
47
47
|
}
|
|
48
48
|
})()
|
|
49
49
|
</script>
|
|
50
|
-
<script type="module" crossorigin src="/assets/index-
|
|
50
|
+
<script type="module" crossorigin src="/assets/index-D489J7QW.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-CHUAMTHK.js">
|
|
55
|
-
<link rel="modulepreload" crossorigin href="/assets/live-protocol-
|
|
56
|
-
<link rel="modulepreload" crossorigin href="/assets/project-scope-context-
|
|
57
|
-
<link rel="modulepreload" crossorigin href="/assets/live-refetch-
|
|
58
|
-
<link rel="modulepreload" crossorigin href="/assets/useInfiniteQuery-
|
|
59
|
-
<link rel="modulepreload" crossorigin href="/assets/useQuery-
|
|
60
|
-
<link rel="modulepreload" crossorigin href="/assets/ws-
|
|
55
|
+
<link rel="modulepreload" crossorigin href="/assets/live-protocol-BDY7JJpT.js">
|
|
56
|
+
<link rel="modulepreload" crossorigin href="/assets/project-scope-context-CaUqlAd7.js">
|
|
57
|
+
<link rel="modulepreload" crossorigin href="/assets/live-refetch-C0kQc3-z.js">
|
|
58
|
+
<link rel="modulepreload" crossorigin href="/assets/useInfiniteQuery-qEY8OhKb.js">
|
|
59
|
+
<link rel="modulepreload" crossorigin href="/assets/useQuery-DOJQOEBO.js">
|
|
60
|
+
<link rel="modulepreload" crossorigin href="/assets/ws-DvGmrP4z.js">
|
|
61
61
|
<link rel="modulepreload" crossorigin href="/assets/toaster-B1MyeHiE.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-DYfIpJ-d.js">
|
|
63
|
+
<link rel="modulepreload" crossorigin href="/assets/cez-idle-BT0U4GN_.js">
|
|
64
64
|
<link rel="modulepreload" crossorigin href="/assets/es2015-D345RR4o.js">
|
|
65
65
|
<link rel="modulepreload" crossorigin href="/assets/design-icons-DmYTv2r1.js">
|
|
66
66
|
<link rel="modulepreload" crossorigin href="/assets/dropdown-menu-DhrBcVgr.js">
|
|
@@ -68,17 +68,17 @@
|
|
|
68
68
|
<link rel="modulepreload" crossorigin href="/assets/createLucideIcon-BHp8sXmF.js">
|
|
69
69
|
<link rel="modulepreload" crossorigin href="/assets/popover-DRcRI46x.js">
|
|
70
70
|
<link rel="modulepreload" crossorigin href="/assets/textarea-DlVUfdWG.js">
|
|
71
|
-
<link rel="modulepreload" crossorigin href="/assets/project-router-
|
|
72
|
-
<link rel="modulepreload" crossorigin href="/assets/agent-accounts-
|
|
71
|
+
<link rel="modulepreload" crossorigin href="/assets/project-router-1m_VlC22.js">
|
|
72
|
+
<link rel="modulepreload" crossorigin href="/assets/agent-accounts-BCg-578Q.js">
|
|
73
73
|
<link rel="modulepreload" crossorigin href="/assets/skills-DFBiAuJG.js">
|
|
74
74
|
<link rel="modulepreload" crossorigin href="/assets/lib-BxQXEXDF.js">
|
|
75
75
|
<link rel="modulepreload" crossorigin href="/assets/chunk-BO2N2NFS-DE6qKn3r.js">
|
|
76
76
|
<link rel="modulepreload" crossorigin href="/assets/markdown-D7DUNWcJ.js">
|
|
77
|
-
<link rel="modulepreload" crossorigin href="/assets/github-sidebar-model-
|
|
77
|
+
<link rel="modulepreload" crossorigin href="/assets/github-sidebar-model-Ct0DltOv.js">
|
|
78
78
|
<link rel="modulepreload" crossorigin href="/assets/loader-circle-CZkGEdoI.js">
|
|
79
79
|
<link rel="modulepreload" crossorigin href="/assets/nav-row-styles-BZUUavOF.js">
|
|
80
80
|
<link rel="modulepreload" crossorigin href="/assets/eye-B8okNWXU.js">
|
|
81
|
-
<link rel="modulepreload" crossorigin href="/assets/control-locations-
|
|
81
|
+
<link rel="modulepreload" crossorigin href="/assets/control-locations-CA9TMupq.js">
|
|
82
82
|
<link rel="modulepreload" crossorigin href="/assets/centered-state-DGyy0SuA.js">
|
|
83
83
|
<link rel="modulepreload" crossorigin href="/assets/sortable.esm-zp_qkYGV.js">
|
|
84
84
|
<link rel="stylesheet" crossorigin href="/assets/skills-workflows-C21NystW.css">
|
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-BDY7JJpT.js";import{n as r}from"./assets/cez-idle-BT0U4GN_.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,12 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
/**
|
|
3
|
-
* Git facts about the project root, or `null` when it is not a repository. Health and the Repo
|
|
4
|
-
* view serve the same record. This module imports only zod, so `repo.ts` does not load
|
|
5
|
-
* `health.ts` (hearsay-tools/cezarion#3241); `health.ts` re-exports both names.
|
|
6
|
-
*/
|
|
7
|
-
export declare const repoInfoSchema: z.ZodObject<{
|
|
8
|
-
root: z.ZodString;
|
|
9
|
-
branch: z.ZodString;
|
|
10
|
-
remote: z.ZodOptional<z.ZodString>;
|
|
11
|
-
}, z.core.$strip>;
|
|
12
|
-
export type RepoInfo = z.infer<typeof repoInfoSchema>;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
/**
|
|
3
|
-
* The agent backends a run can be dispatched to. This module imports only zod: most contract
|
|
4
|
-
* modules import the roster, and a schema module behind it would load in nearly every test
|
|
5
|
-
* (hearsay-tools/cezarion#3241). `health.ts` re-exports both names.
|
|
6
|
-
*/
|
|
7
|
-
export declare const runnerSchema: z.ZodEnum<{
|
|
8
|
-
claude: "claude";
|
|
9
|
-
codex: "codex";
|
|
10
|
-
cursor: "cursor";
|
|
11
|
-
omp: "omp";
|
|
12
|
-
opencode: "opencode";
|
|
13
|
-
pi: "pi";
|
|
14
|
-
}>;
|
|
15
|
-
export type Runner = z.infer<typeof runnerSchema>;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { RunRecord } from './runs.ts';
|
|
2
|
-
/**
|
|
3
|
-
* A usage-limit hold (hearsay-tools/cezarion#1236): a `waiting` run with a booked resume time. It
|
|
4
|
-
* holds no slot and no session, so the engine does not own it; its resume or the user's Continue
|
|
5
|
-
* wakes it. The one definition every reader calls (hearsay-tools/cezarion#1496). It takes the
|
|
6
|
-
* record, never a bare status, and the store clears the resume time on every write that leaves
|
|
7
|
-
* `waiting`, so a resume time on any other run is stale and this reads it as no hold. It narrows
|
|
8
|
-
* the time only, so a caller can still settle the hold to another status.
|
|
9
|
-
*
|
|
10
|
-
* This module has no runtime imports: `vitest.setup.ts` loads it through `run-exits.ts`, so every
|
|
11
|
-
* cezar test loads it (hearsay-tools/cezarion#3241). `waits.ts` re-exports it.
|
|
12
|
-
*/
|
|
13
|
-
export declare function isUsageLimitHold<T extends Partial<Pick<RunRecord, 'status' | 'autoResumeAt'>>>(run: T): run is T & {
|
|
14
|
-
autoResumeAt: string;
|
|
15
|
-
};
|