@wjarka/cezarion 0.18.0-dev.7764 → 0.18.0-dev.7777
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/package.json +2 -2
- package/web/dist/assets/{activity-motion-BSsgWgJe.js → activity-motion-CMaQA87f.js} +1 -1
- package/web/dist/assets/{activity-route-q9sOR4Wb.js → activity-route-CTJT4zv2.js} +1 -1
- package/web/dist/assets/{commit-diff-panel-Btiebm6D.js → commit-diff-panel-BoK-qLXZ.js} +1 -1
- package/web/dist/assets/{diff-DNIkChMc.js → diff-BHFOGiZQ.js} +2 -2
- package/web/dist/assets/{diff-view-jhjgH27W.js → diff-view-BcEpsdxN.js} +1 -1
- package/web/dist/assets/{file-preview-De5UjJTG.js → file-preview-DQmUdQku.js} +1 -1
- package/web/dist/assets/{git-toolbar-Ol1142ti.js → git-toolbar-CIMGnrx-.js} +1 -1
- package/web/dist/assets/{github-BylUlaAL.js → github-DNt7fatG.js} +1 -1
- package/web/dist/assets/{global-activity-route-DI3QqvQL.js → global-activity-route-DvJfgzVz.js} +1 -1
- package/web/dist/assets/{index-Dbb0-RtK.js → index-Bcs60T3F.js} +4 -4
- package/web/dist/assets/{markdown-D3aDM4O5.js → markdown-C78nwKGh.js} +1 -1
- package/web/dist/assets/{preview-pane-connected-C-f5rJGZ.js → preview-pane-connected-DAkxP33O.js} +1 -1
- package/web/dist/assets/{repo-git-D-j1tyQj.js → repo-git-DTINuV7R.js} +1 -1
- package/web/dist/assets/{report-reader-0-k8FTCM.js → report-reader-TsL5jS1q.js} +1 -1
- package/web/dist/assets/{reports--2BDXGSj.js → reports-MBONm90i.js} +1 -1
- package/web/dist/assets/{run-header-B69_lBSt.js → run-header-BbuegkrJ.js} +1 -1
- package/web/dist/assets/{skills-CzyYKL6l.js → skills-Cc2FsHZq.js} +1 -1
- package/web/dist/assets/{task-changes-D1Oi0yoX.js → task-changes-Bis3iY6D.js} +1 -1
- package/web/dist/assets/{task-commits-DV91fVHF.js → task-commits-CELN07IE.js} +1 -1
- package/web/dist/assets/{task-files-_ap-MUjL.js → task-files-Xj9SbIQY.js} +1 -1
- package/web/dist/assets/{task-github-item-9oibIBa8.js → task-github-item-8Wi29msX.js} +1 -1
- package/web/dist/assets/{task-thread-D8IfseH4.js → task-thread-BpprgiEm.js} +1 -1
- package/web/dist/assets/{thread-state-BLS3a1XA.js → thread-state-DjdzGdTP.js} +1 -1
- package/web/dist/assets/{use-hand-to-agent-state-DaPTyzCV.js → use-hand-to-agent-state-BrTzbU6r.js} +1 -1
- package/web/dist/assets/{workflows-BAIP3wxi.js → workflows-BgbhcFeb.js} +1 -1
- package/web/dist/index.html +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{t as e}from"./react-runtime-CCIEwYL0.js";import{l as t,t as n}from"./button-C1fD-ZFr.js";import{Hr as r,fr as i,pr as a}from"./project-scope-context-CR3cozni.js";import{D as o,_ as s,g as c,h as l,p as ee,v as te}from"./live-protocol-60uiPDg6.js";import{t as u}from"./createLucideIcon-BHp8sXmF.js";import{t as d}from"./app-window-CSHwDX9N.js";import{i as ne}from"./format-BNCkW110.js";import{t as re}from"./play-CmVAj_fu.js";import{Zt as ie,fn as ae,g as oe,h as se,rn as ce}from"./index-Dbb0-RtK.js";var f=u(`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`}]]),p=u(`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`}]]),m=e(),le={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 ue(e){let{text:t,...n}=oe(e),r={...n,status:t},i=le[e.state](e);return i?{...r,action:i}:r}var de={"Run and open":re,Open:d,View:ae,"Start again":f};function fe({entry:e,inPreview:n,onOpen:r}){let{server:i}=e,a=ue(e),o=e.state===`unavailable`,s=r?a.action:void 0,c=se(i.command),l=ne(i.registeredAt);return(0,m.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,m.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2 text-xs text-soft-foreground`,children:[(0,m.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5 font-mono`,children:[(0,m.jsx)(p,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),(0,m.jsx)(`span`,{className:`truncate`,children:`cezar_preview_serve`})]}),o?(0,m.jsx)(`span`,{children:`worktree removed`}):l?(0,m.jsxs)(`span`,{children:[l,` ago`]}):null]}),(0,m.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-x-3 gap-y-2`,children:[(0,m.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,m.jsx)(ie,{tone:a.tone,shape:a.ring?`ring`:`filled`,pulse:a.pulse===!0,"aria-hidden":`true`}),(0,m.jsx)(`span`,{className:`font-semibold text-foreground`,children:i.label}),(0,m.jsxs)(`span`,{className:`font-mono text-muted-foreground`,children:[`:`,i.port]}),(0,m.jsx)(`span`,{className:`text-muted-foreground`,children:a.status})]}),(0,m.jsx)(pe,{entry:e,inPreview:n,action:s,onOpen:r})]}),(0,m.jsxs)(`div`,{className:`mt-2.5 min-w-0 rounded-md bg-muted px-3 py-2 font-mono text-xs`,children:[(0,m.jsx)(`p`,{className:`break-words whitespace-pre-wrap text-foreground`,children:i.command}),i.cwd?(0,m.jsxs)(`p`,{className:`mt-1 flex gap-3 text-soft-foreground`,children:[(0,m.jsx)(`span`,{children:`cwd`}),(0,m.jsx)(`span`,{className:`break-all`,children:i.cwd})]}):null]}),s?.run?(0,m.jsx)(h,{icon:(0,m.jsx)(ce,{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,m.jsx)(h,{children:`The worktree this server ran in is gone. Register it again from a new task.`}):null]})}function pe({entry:e,inPreview:t,action:r,onOpen:i}){let{server:a}=e,o=t&&r!==void 0&&!r.run,s=o?`In preview`:r?.label,c=o?d:r?de[r.label]:null;return r&&s&&c?(0,m.jsxs)(n,{variant:o||r.label===`View`||r.label===`Open`&&e.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,m.jsx)(c,{"aria-hidden":`true`}),s]}):null}function h({icon:e,children:t}){return(0,m.jsxs)(`p`,{className:`mt-2.5 flex items-start gap-2 text-xs text-muted-foreground`,children:[e,(0,m.jsx)(`span`,{children:t})]})}function g(e,t){return e.kind===`message`&&e.role===`user`&&e.skillInput?.source===t&&typeof e.skillInput.id==`string`&&e.skillInput.id!==``}var _=120;function v(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function y(e){let t=e.replace(/\s+/g,` `).trim();return t.length>_?`${t.slice(0,_-1)}…`:t}var b=e=>e===void 0?void 0:y(e);function x(e,...t){if(v(e))for(let n of t){let t=e[n];if(typeof t==`string`&&t.trim()!==``)return t}}function S(e,...t){return b(x(e,...t))}function me(e){if(!v(e))return;let t=e.command;if(typeof t==`string`&&t.trim()!==``)return t;if(Array.isArray(t)){let e=t.filter(e=>typeof e==`string`);if(e.length>0)return e.join(` `)}}function he(e){if(!v(e)||!Array.isArray(e.changes))return[];let t=[];for(let n of e.changes)v(n)&&typeof n.path==`string`&&n.path.trim()!==``&&t.push(n.path);return t}function ge(e){return S(e,`description`,`query`,`url`,`filePath`,`file_path`,`path`,`pattern`,`name`)}function C(e,t){return t?`${e} ${t}`:e}var w=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`],[`spawnagent`,`task`],[`subtask`,`task`],[`todowrite`,`plan`],[`todolist`,`plan`],[`plan`,`plan`],[`taskcreate`,`plan`],[`taskupdate`,`plan`],[`tasklist`,`plan`],[`contextcompaction`,`other`],[`mcptoolcall`,`other`]]);function T(e,t){switch(e){case`notebookedit`:return x(t,`notebook_path`,`notebookPath`,`file_path`,`filePath`,`path`);case`filechange`:{let e=he(t);return e.length===1?e[0]:void 0}default:return x(t,`file_path`,`filePath`,`path`)}}function _e(e,t){let n=e===`write`?`Write`:`Edit`;if(e!==`filechange`)return{toolKind:`edit`,title:C(n,b(T(e,t)))};let r=he(t);return{toolKind:`edit`,title:C(n,r.length>1?`${r.length} files`:r[0])}}function E(e,t){return e===`imageview`?x(t,`path`):x(t,`file_path`,`filePath`,`path`)}function ve(e,t){return{toolKind:`read`,title:C(e===`imageview`?`View image`:`Read`,b(E(e,t)))}}function D(e){return x(e,`pattern`,`query`)}function O(e,t){return e===`webfetch`?x(t,`url`):x(t,`query`)}function ye(e,t){return{toolKind:`fetch`,title:C(e===`webfetch`?`Fetch`:`Web search`,b(O(e,t)))}}var k=e=>x(e,`skill`,`name`,`command`),A=e=>x(e,`subagent_type`,`subagentType`);function be(e,t){return e===`skill`?k(t):x(t,`prompt`,`task`,`description`)??A(t)}function xe(e,t){if(e===`skill`){let e=b(k(t));return{toolKind:`task`,title:e?`Skill: ${e}`:`Skill`,subtitle:S(t,`args`,`description`)}}let n=e===`agent`?`Agent`:`Task`,r=b(A(t)),i=S(t,`description`,`prompt`)??r;return{toolKind:`task`,title:i?`${n}: ${i}`:n,subtitle:i===r?void 0:r}}function Se(e,t,n){if(t===`contextcompaction`)return{toolKind:`other`,title:`Compacted context`};if(t===`mcptoolcall`){let e=S(n,`server`),t=S(n,`tool`);return e&&t?{toolKind:`other`,title:`${e}.${t}`}:{toolKind:`other`,title:`MCP tool`,subtitle:ge(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()!==``?y(e):`Tool`,subtitle:ge(n)}}function j(e,t){let n=typeof e==`string`?e.toLowerCase():``;switch(w.get(n)){case`execute`:return{toolKind:`execute`,title:C(`Ran`,b(me(t))),subtitle:S(t,`description`)};case`edit`:return _e(n,t);case`read`:return ve(n,t);case`search`:return{toolKind:`search`,title:C(`Search`,b(D(t))),subtitle:S(t,`path`)};case`fetch`:return ye(n,t);case`task`:return xe(n,t);case`plan`:return{toolKind:`plan`,title:`Update plan`};default:return Se(e,n,t)}}function Ce(e,t){let n=typeof e==`string`?e.toLowerCase():``;switch(w.get(n)){case`execute`:return me(t);case`edit`:return T(n,t);case`read`:return E(n,t);case`search`:return D(t);case`fetch`:return O(n,t);case`task`:return be(n,t);default:return}}function we(e,t){if(t.type===`ask.requested`&&typeof t.requestId==`string`&&o.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`?s:c).safeParse(t);if(n.success&&n.data.askSeq===e?.seq)return}return e}function Te(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 M(e){let t=Te(e);return t&&{seq:e.seq,...t}}function Ee(e,t){let n=we(e&&{type:`ask.requested`,seq:e.seq,ts:``},t);return n===t?M(t):n===void 0?void 0:e}function De(e){let t;for(let n of e)t=Ee(t,n);return t}function Oe(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 ke(){return{turns:[],itemsById:new Map,turnSeq:0,eventSeq:0,permissions:new Map,conversationEntries:new Map,outcomesByRequest:new Map,seenInputs:new Set,previewByPort:new Map,handedOff:!1}}function N(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function P(e){return typeof e==`string`?e:void 0}function F(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 I(e){if(!(typeof e!=`string`||e===``))return Number.isFinite(new Date(e).getTime())?e:void 0}function Ae(e){return r.safeParse(e).data}function L(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 R(e){return e.turns.at(-1)??L(e)}function z(e,t){R(e).entries.push({origin:`meta`,entry:t,firstSeq:e.eventSeq,lastSeq:e.eventSeq})}function B(e){for(let t of e.permissions.values())t.status===`pending`&&(t.status=`expired`)}function V(e,t){let n=P(e.stepId);return n===void 0?t:`${n}:${t}`}function je(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 Me(e,t,n,r,i){let a=n.kind===`message`&&i!==void 0?{...n,ts:i}:{...n};!t.v2Items&&a.kind!==`hook`&&je(e,t);let o=e.itemsById.get(r);if(o&&o.turn===t){o.entry.entry=a,o.entry.lastSeq=e.eventSeq;return}let s={origin:`v2`,entry:a,firstSeq:e.eventSeq,lastSeq:e.eventSeq};t.entries.push(s),e.itemsById.set(r,{turn:t,entry:s})}var H={"not-delivered":0,queued:1,delivered:2,consumed:3},Ne=[`instruction`,`resumed`,`requestId`,`relationship`,`state`,`createdAt`,`requestHash`,`deadline`];function U(e){let t={};for(let n of Ne)e[n]!==void 0&&Object.assign(t,{[n]:e[n]});return t}function W(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 Pe(e,t){let n=e.conversationEntries.get(t);n&&W(e,n)}function Fe(e,t,n,r){(H[e.delivery]<H.delivered||H[n]>H[e.delivery])&&(e.delivery=n),t.text!==``&&(e.text=t.text),Object.assign(e,U(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 G(e,t,n,r){let i=e.conversationEntries.get(t.id);if(i){Fe(i,t,n,r),W(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,...U(t)};W(e,a),e.conversationEntries.set(t.id,a),z(e,a)}function Ie(e,t){let n=F(t.ts),r=P(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,z(e,{kind:`note`,id:`v1:${t.seq}`,text:i,tone:`dim`,icon:`handoff`})}function Le(e,t){let n=typeof t.attempts==`number`?t.attempts:void 0,r=P(t.webhookName),i=`${r?`Delivery to ${r} failed`:`Webhook delivery failed`}${P(t.event)?` (${P(t.event)})`:``}${n?` after ${n} attempt${n===1?``:`s`}`:``}: ${P(t.error)??`unknown error`}`;z(e,{kind:`note`,id:`v1:${t.seq}`,text:i,tone:`danger`})}function Re(e,t){let n=P(t.webhookName)??`webhook`,r=P(t.title),i=`v1:${t.seq}`;if(t.ok===!1){z(e,{kind:`note`,id:i,text:`Report to ${n} failed: ${P(t.error)??`unknown error`}`,tone:`danger`});return}let a=`${t.dryRun===!0?`Report to ${n} (dry run, nothing sent)`:`Sent report to ${n}`}${F(t.ts)}${r?` — ${r}`:``}`;z(e,t.dryRun===!0?{kind:`note`,id:i,text:a,tone:`dim`}:{kind:`note`,id:i,text:a,tone:`dim`,icon:`handoff`})}function ze(e,t){let n=t.payload??{},r=`Webhook (dry run, nothing sent): ${P(t.event)??`delivery`}${P(n.status)?` · ${P(n.status)}`:``}`;z(e,{kind:`note`,id:`v1:${t.seq}`,text:r,tone:`dim`})}function Be(e,t){let n=i.safeParse(t.server);if(!n.success)return;let r=e.previewByPort.get(n.data.port);r&&(r.turn.entries=r.turn.entries.filter(e=>e!==r.draft));let a=R(e),o={origin:`meta`,firstSeq:t.seq,lastSeq:t.seq,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 Ve(e,t){let n=a.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:i,id:o}=r.draft.entry;r.draft.lastSeq=t.seq,r.draft.entry={kind:`preview-server`,id:o,server:i,state:n.data,stateAt:t.ts,...typeof t.exitCode==`number`?{exitCode:t.exitCode}:{},...t.reason===`user`||t.reason===`idle`?{reason:t.reason}:{}}}function He(e,t){let n=l.safeParse(t);if(!n.success)return;let{message:r,delivery:i,deliveredAt:a,consumedAt:o,ts:s}=n.data;G(e,r,i,{deliveredAt:a,consumedAt:o,recordedAt:s})}function Ue(e,t){let n=te.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),Pe(e,r.requestId))}function We(e,t){let n=ee.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){G(e,{id:r.id,text:r.text,createdAt:r.createdAt,...r.conversation},`delivered`,{deliveredAt:r.deliveredAt,recordedAt:n.data.ts});return}z(e,{kind:`note`,id:`agent-input:${r.id}`,text:r.text,tone:`dim`,attribution:{source:r.source,parentRunId:r.parentRunId}})}}function Ge(e,t){let n=P(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=L(e,t.seq),a=I(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 Ke(e,t){let n=e.turns.at(-1),r=n&&n.turnId===void 0&&!n.v2Items?n:L(e,t.seq);r.turnId=P(t.turnId),r.startedAt??=I(t.ts)}function qe(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 Je(e,t){B(e);let n=qe(e,P(t.turnId));if(!n)return;let r=I(t.ts);n.completed={stopReason:P(t.stopReason)??`end_turn`,...typeof t.costUsd==`number`?{costUsd:t.costUsd}:{},...r===void 0?{}:{ts:r}}}var K=new Set([`message`,`reasoning`,`tool`,`hook`]),Ye=e=>K.has(e.kind);function Xe(e){if(!(!N(e)||!K.has(e.kind)))return typeof e.id==`string`&&e.id!==``?e:void 0}function q(e,t){let n=Xe(t.item);if(!n)return;let r=V(t,n.id);Me(e,e.itemsById.get(r)?.turn??R(e),n,r,t.type===`item.completed`?I(t.ts):void 0)}function Ze(e,t){let n=e.itemsById.get(V(t,P(t.itemId)??``)),r=P(t.delta)??``;if(!n||r===``||!Ye(n.entry.entry))return;let i=n.entry.entry;n.entry.lastSeq=t.seq,t.field===`output`&&i.kind===`tool`?i.output=(i.output??``)+r:t.field!==`output`&&(i.kind===`message`||i.kind===`reasoning`)&&(i.text+=r)}function Qe(e,t){let n=R(e),r=P(t.text)??``;if(r===``)return;let i=I(t.ts);n.entries.push({origin:`v1`,firstSeq:t.seq,lastSeq:t.seq,entry:{kind:`message`,id:`v1:${t.seq}`,role:`assistant`,text:r,...i===void 0?{}:{ts:i}}})}var $e=new Set([`pending`,`in_progress`,`completed`,`cancelled`]);function et(e){if(!N(e)||!Array.isArray(e.todos))return;let t=[];for(let n of e.todos){if(!N(n)||typeof n.content!=`string`)return;t.push({content:n.content,status:$e.has(n.status)?n.status:`pending`,...typeof n.activeForm==`string`?{activeForm:n.activeForm}:{}})}return t}var tt=new Set([`subAgentActivity`,`collabAgentToolCall`,`collabToolCall`]);function nt(e,t){let n=R(e),r=P(t.tool)??`Tool`;if(n.v2Items||tt.has(r))return;let i=j(r,t.input),a=i.toolKind===`plan`?et(t.input):void 0;a!==void 0&&(n.planEntries=a);let o={kind:`tool`,id:P(t.id)??`v1:${t.seq}`,name:r,toolKind:i.toolKind,title:i.title,status:`running`,input:t.input},s={origin:`v1`,entry:o,firstSeq:t.seq,lastSeq:t.seq};n.entries.push(s),e.itemsById.set(o.id,{turn:n,entry:s})}function rt(e){if(typeof e==`string`)return e;if(e==null)return``;try{return JSON.stringify(e)}catch{return String(e)}}function it(e,t){let n=e.itemsById.get(P(t.toolCallId)??``);if(!n||n.turn.v2Items||n.entry.origin!==`v1`)return;let r=n.entry.entry;r.kind===`tool`&&(n.entry.lastSeq=t.seq,r.status=`completed`,r.output=rt(t.result))}function J(e,t,n,r){let i=P(t.message)??``;i!==``&&z(e,{kind:`note`,id:n,text:i,tone:r})}function Y(e,t){J(e,t,`v1:${t.seq}`,t.tone===`danger`?`danger`:`dim`)}function at(e,t){J(e,t,`v1:${t.seq}`,`danger`)}function ot(e,t){J(e,t,`v2:${t.seq}`,`danger`)}function st(e,t){if(t.status!==`failed`)return;let n=P(t.error)?` — ${P(t.error)}`:``;z(e,{kind:`note`,id:`v1:${t.seq}`,text:`step ${P(t.stepId)??`?`} failed${n}`,tone:`danger`})}function ct(e,t){let n=P(t.command)??`check`,r=typeof t.exitCode==`number`?t.exitCode:-1;z(e,{kind:`tool`,id:`v1:${t.seq}`,name:`check`,toolKind:`execute`,title:`Ran ${n}`,status:r===0?`completed`:`failed`,output:P(t.text)??``,exitCode:r})}function lt(e,t){let n=Ae(t.provider),r=P(t.authFailureId)??``;n===void 0||r.length<1||r.length>128||z(e,{kind:`provider-auth-required`,id:`v1:${t.seq}`,provider:n,authFailureId:r})}function ut(e,t){let n=P(t.url);if(n===void 0)return;let r={kind:`image`,id:`v1:${t.seq}`,url:n},i=P(t.name);i!==void 0&&(r.name=i),z(e,r)}function dt(e,t){Array.isArray(t.entries)&&(R(e).planEntries=t.entries)}function ft(e,t){B(e);let n=P(t.message);e.sessionEnded={reason:P(t.reason)??`end_turn`,...n===void 0?{}:{message:n}}}var pt=new Set([`allow_once`,`allow_always`,`reject_once`,`reject_always`]);function mt(e){return N(e)&&typeof e.id==`string`&&e.id!==``&&typeof e.label==`string`&&e.label!==``&&pt.has(e.kind)}function ht(e){if(!(!Array.isArray(e)||e.length===0||!e.every(mt)))return new Set(e.map(e=>e.id)).size===e.length?e:void 0}function gt(e,t){let n=P(t.requestId),r=P(t.title),i=ht(t.options);if(!n||!r||e.permissions.has(n)||!i)return;let a=P(t.itemId),o=P(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),z(e,s)}function _t(e,t){let n=e.permissions.get(P(t.requestId)??``);if(!n||n.status!==`pending`)return;let r=P(t.optionId);r!==void 0&&n.options.some(e=>e.id===r)?(n.status=`resolved`,n.optionId=r):n.status=`expired`;let i=P(t.reason);i!==void 0&&(n.reason=i)}function vt(e,t){let n=M(t),r=n&&Oe(n);if(!r)return;let i={kind:`ask`,...r,questions:r.questions,resolved:!1};z(e,i),e.pendingAsk=i}function X(e,t){let n=e.pendingAsk;return n&&!n.resolved&&n.askSeq===t.askSeq?n:void 0}function yt(e,t){let n=X(e,t);if(!n)return;n.routedToParent=!0;let r=P(t.parentRunId);r!==void 0&&(n.parentRunId=r)}function bt(e,t){let n=X(e,t);n&&(n.routedToParent=!1)}function xt(e,t){let n=X(e,t);n&&Z(e,n,`undeliverable`)}var St=new Set([`finish`,`superseded`,`parent-stopped`,`worker-stopped`,`undeliverable`]);function Ct(e,t){let n=X(e,t);n&&St.has(t.reason)&&Z(e,n,t.reason)}function Z(e,t,n){t.resolved=!0,t.closed=n,e.pendingAsk=void 0}function wt(e,t){let n=X(e,t);if(n){if(t.source===`cezar`){Z(e,n,`undeliverable`);return}t.source===`parent`&&(n.resolved=!0,n.answeredBy=`parent`,e.pendingAsk=void 0)}}var Q=()=>{},Tt=new Map([[`handoff`,Ie],[`webhook.failed`,Le],[`webhook.dry-run`,ze],[`webhook.report`,Re],[`preview.server-registered`,Be],[`preview.server-state`,Ve],[`conversation-message`,He],[`request-outcome`,Ue],[`agent-input`,We],[`user-message`,Ge],[`turn.started`,Ke],[`turn.completed`,Je],[`item.started`,q],[`item.updated`,q],[`item.completed`,q],[`item.delta`,Ze],[`text`,Qe],[`tool-call`,nt],[`tool-result`,it],[`note`,Y],[`lifecycle`,Y],[`error`,at],[`session.error`,ot],[`step-end`,st],[`check-output`,ct],[`provider-auth-required`,lt],[`image`,ut],[`plan.updated`,dt],[`session.started`,e=>B(e)],[`session.ended`,ft],[`permission.requested`,gt],[`permission.resolved`,_t],[`ask.requested`,vt],[`worker-question-routed`,yt],[`worker-question-fallback`,bt],[`worker-question-undelivered`,xt],[`human-ask-closed`,Ct],[`human-input-delivered`,wt],[`step-start`,Q],[`token-usage`,Q],[`cost`,Q],[`turn-end`,Q],[`done`,Q],[`session`,Q]]);function Et(e,t){e.eventSeq=t.seq,Tt.get(t.type)?.(e,t)}function Dt(e){for(let t=e.turns.length-1;t>=0;--t){let n=e.turns[t].planEntries;if(n!==void 0)return n}}function Ot(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 kt(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}from"./react-runtime-CCIEwYL0.js";import{l as t,t as n}from"./button-C1fD-ZFr.js";import{Hr as r,fr as i,pr as a}from"./project-scope-context-CR3cozni.js";import{D as o,_ as s,g as c,h as l,p as ee,v as te}from"./live-protocol-60uiPDg6.js";import{t as u}from"./createLucideIcon-BHp8sXmF.js";import{t as d}from"./app-window-CSHwDX9N.js";import{i as ne}from"./format-BNCkW110.js";import{t as re}from"./play-CmVAj_fu.js";import{Zt as ie,fn as ae,g as oe,h as se,rn as ce}from"./index-Bcs60T3F.js";var f=u(`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`}]]),p=u(`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`}]]),m=e(),le={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 ue(e){let{text:t,...n}=oe(e),r={...n,status:t},i=le[e.state](e);return i?{...r,action:i}:r}var de={"Run and open":re,Open:d,View:ae,"Start again":f};function fe({entry:e,inPreview:n,onOpen:r}){let{server:i}=e,a=ue(e),o=e.state===`unavailable`,s=r?a.action:void 0,c=se(i.command),l=ne(i.registeredAt);return(0,m.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,m.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2 text-xs text-soft-foreground`,children:[(0,m.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5 font-mono`,children:[(0,m.jsx)(p,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),(0,m.jsx)(`span`,{className:`truncate`,children:`cezar_preview_serve`})]}),o?(0,m.jsx)(`span`,{children:`worktree removed`}):l?(0,m.jsxs)(`span`,{children:[l,` ago`]}):null]}),(0,m.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-x-3 gap-y-2`,children:[(0,m.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,m.jsx)(ie,{tone:a.tone,shape:a.ring?`ring`:`filled`,pulse:a.pulse===!0,"aria-hidden":`true`}),(0,m.jsx)(`span`,{className:`font-semibold text-foreground`,children:i.label}),(0,m.jsxs)(`span`,{className:`font-mono text-muted-foreground`,children:[`:`,i.port]}),(0,m.jsx)(`span`,{className:`text-muted-foreground`,children:a.status})]}),(0,m.jsx)(pe,{entry:e,inPreview:n,action:s,onOpen:r})]}),(0,m.jsxs)(`div`,{className:`mt-2.5 min-w-0 rounded-md bg-muted px-3 py-2 font-mono text-xs`,children:[(0,m.jsx)(`p`,{className:`break-words whitespace-pre-wrap text-foreground`,children:i.command}),i.cwd?(0,m.jsxs)(`p`,{className:`mt-1 flex gap-3 text-soft-foreground`,children:[(0,m.jsx)(`span`,{children:`cwd`}),(0,m.jsx)(`span`,{className:`break-all`,children:i.cwd})]}):null]}),s?.run?(0,m.jsx)(h,{icon:(0,m.jsx)(ce,{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,m.jsx)(h,{children:`The worktree this server ran in is gone. Register it again from a new task.`}):null]})}function pe({entry:e,inPreview:t,action:r,onOpen:i}){let{server:a}=e,o=t&&r!==void 0&&!r.run,s=o?`In preview`:r?.label,c=o?d:r?de[r.label]:null;return r&&s&&c?(0,m.jsxs)(n,{variant:o||r.label===`View`||r.label===`Open`&&e.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,m.jsx)(c,{"aria-hidden":`true`}),s]}):null}function h({icon:e,children:t}){return(0,m.jsxs)(`p`,{className:`mt-2.5 flex items-start gap-2 text-xs text-muted-foreground`,children:[e,(0,m.jsx)(`span`,{children:t})]})}function g(e,t){return e.kind===`message`&&e.role===`user`&&e.skillInput?.source===t&&typeof e.skillInput.id==`string`&&e.skillInput.id!==``}var _=120;function v(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function y(e){let t=e.replace(/\s+/g,` `).trim();return t.length>_?`${t.slice(0,_-1)}…`:t}var b=e=>e===void 0?void 0:y(e);function x(e,...t){if(v(e))for(let n of t){let t=e[n];if(typeof t==`string`&&t.trim()!==``)return t}}function S(e,...t){return b(x(e,...t))}function me(e){if(!v(e))return;let t=e.command;if(typeof t==`string`&&t.trim()!==``)return t;if(Array.isArray(t)){let e=t.filter(e=>typeof e==`string`);if(e.length>0)return e.join(` `)}}function he(e){if(!v(e)||!Array.isArray(e.changes))return[];let t=[];for(let n of e.changes)v(n)&&typeof n.path==`string`&&n.path.trim()!==``&&t.push(n.path);return t}function ge(e){return S(e,`description`,`query`,`url`,`filePath`,`file_path`,`path`,`pattern`,`name`)}function C(e,t){return t?`${e} ${t}`:e}var w=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`],[`spawnagent`,`task`],[`subtask`,`task`],[`todowrite`,`plan`],[`todolist`,`plan`],[`plan`,`plan`],[`taskcreate`,`plan`],[`taskupdate`,`plan`],[`tasklist`,`plan`],[`contextcompaction`,`other`],[`mcptoolcall`,`other`]]);function T(e,t){switch(e){case`notebookedit`:return x(t,`notebook_path`,`notebookPath`,`file_path`,`filePath`,`path`);case`filechange`:{let e=he(t);return e.length===1?e[0]:void 0}default:return x(t,`file_path`,`filePath`,`path`)}}function _e(e,t){let n=e===`write`?`Write`:`Edit`;if(e!==`filechange`)return{toolKind:`edit`,title:C(n,b(T(e,t)))};let r=he(t);return{toolKind:`edit`,title:C(n,r.length>1?`${r.length} files`:r[0])}}function E(e,t){return e===`imageview`?x(t,`path`):x(t,`file_path`,`filePath`,`path`)}function ve(e,t){return{toolKind:`read`,title:C(e===`imageview`?`View image`:`Read`,b(E(e,t)))}}function D(e){return x(e,`pattern`,`query`)}function O(e,t){return e===`webfetch`?x(t,`url`):x(t,`query`)}function ye(e,t){return{toolKind:`fetch`,title:C(e===`webfetch`?`Fetch`:`Web search`,b(O(e,t)))}}var k=e=>x(e,`skill`,`name`,`command`),A=e=>x(e,`subagent_type`,`subagentType`);function be(e,t){return e===`skill`?k(t):x(t,`prompt`,`task`,`description`)??A(t)}function xe(e,t){if(e===`skill`){let e=b(k(t));return{toolKind:`task`,title:e?`Skill: ${e}`:`Skill`,subtitle:S(t,`args`,`description`)}}let n=e===`agent`?`Agent`:`Task`,r=b(A(t)),i=S(t,`description`,`prompt`)??r;return{toolKind:`task`,title:i?`${n}: ${i}`:n,subtitle:i===r?void 0:r}}function Se(e,t,n){if(t===`contextcompaction`)return{toolKind:`other`,title:`Compacted context`};if(t===`mcptoolcall`){let e=S(n,`server`),t=S(n,`tool`);return e&&t?{toolKind:`other`,title:`${e}.${t}`}:{toolKind:`other`,title:`MCP tool`,subtitle:ge(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()!==``?y(e):`Tool`,subtitle:ge(n)}}function j(e,t){let n=typeof e==`string`?e.toLowerCase():``;switch(w.get(n)){case`execute`:return{toolKind:`execute`,title:C(`Ran`,b(me(t))),subtitle:S(t,`description`)};case`edit`:return _e(n,t);case`read`:return ve(n,t);case`search`:return{toolKind:`search`,title:C(`Search`,b(D(t))),subtitle:S(t,`path`)};case`fetch`:return ye(n,t);case`task`:return xe(n,t);case`plan`:return{toolKind:`plan`,title:`Update plan`};default:return Se(e,n,t)}}function Ce(e,t){let n=typeof e==`string`?e.toLowerCase():``;switch(w.get(n)){case`execute`:return me(t);case`edit`:return T(n,t);case`read`:return E(n,t);case`search`:return D(t);case`fetch`:return O(n,t);case`task`:return be(n,t);default:return}}function we(e,t){if(t.type===`ask.requested`&&typeof t.requestId==`string`&&o.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`?s:c).safeParse(t);if(n.success&&n.data.askSeq===e?.seq)return}return e}function Te(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 M(e){let t=Te(e);return t&&{seq:e.seq,...t}}function Ee(e,t){let n=we(e&&{type:`ask.requested`,seq:e.seq,ts:``},t);return n===t?M(t):n===void 0?void 0:e}function De(e){let t;for(let n of e)t=Ee(t,n);return t}function Oe(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 ke(){return{turns:[],itemsById:new Map,turnSeq:0,eventSeq:0,permissions:new Map,conversationEntries:new Map,outcomesByRequest:new Map,seenInputs:new Set,previewByPort:new Map,handedOff:!1}}function N(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function P(e){return typeof e==`string`?e:void 0}function F(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 I(e){if(!(typeof e!=`string`||e===``))return Number.isFinite(new Date(e).getTime())?e:void 0}function Ae(e){return r.safeParse(e).data}function L(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 R(e){return e.turns.at(-1)??L(e)}function z(e,t){R(e).entries.push({origin:`meta`,entry:t,firstSeq:e.eventSeq,lastSeq:e.eventSeq})}function B(e){for(let t of e.permissions.values())t.status===`pending`&&(t.status=`expired`)}function V(e,t){let n=P(e.stepId);return n===void 0?t:`${n}:${t}`}function je(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 Me(e,t,n,r,i){let a=n.kind===`message`&&i!==void 0?{...n,ts:i}:{...n};!t.v2Items&&a.kind!==`hook`&&je(e,t);let o=e.itemsById.get(r);if(o&&o.turn===t){o.entry.entry=a,o.entry.lastSeq=e.eventSeq;return}let s={origin:`v2`,entry:a,firstSeq:e.eventSeq,lastSeq:e.eventSeq};t.entries.push(s),e.itemsById.set(r,{turn:t,entry:s})}var H={"not-delivered":0,queued:1,delivered:2,consumed:3},Ne=[`instruction`,`resumed`,`requestId`,`relationship`,`state`,`createdAt`,`requestHash`,`deadline`];function U(e){let t={};for(let n of Ne)e[n]!==void 0&&Object.assign(t,{[n]:e[n]});return t}function W(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 Pe(e,t){let n=e.conversationEntries.get(t);n&&W(e,n)}function Fe(e,t,n,r){(H[e.delivery]<H.delivered||H[n]>H[e.delivery])&&(e.delivery=n),t.text!==``&&(e.text=t.text),Object.assign(e,U(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 G(e,t,n,r){let i=e.conversationEntries.get(t.id);if(i){Fe(i,t,n,r),W(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,...U(t)};W(e,a),e.conversationEntries.set(t.id,a),z(e,a)}function Ie(e,t){let n=F(t.ts),r=P(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,z(e,{kind:`note`,id:`v1:${t.seq}`,text:i,tone:`dim`,icon:`handoff`})}function Le(e,t){let n=typeof t.attempts==`number`?t.attempts:void 0,r=P(t.webhookName),i=`${r?`Delivery to ${r} failed`:`Webhook delivery failed`}${P(t.event)?` (${P(t.event)})`:``}${n?` after ${n} attempt${n===1?``:`s`}`:``}: ${P(t.error)??`unknown error`}`;z(e,{kind:`note`,id:`v1:${t.seq}`,text:i,tone:`danger`})}function Re(e,t){let n=P(t.webhookName)??`webhook`,r=P(t.title),i=`v1:${t.seq}`;if(t.ok===!1){z(e,{kind:`note`,id:i,text:`Report to ${n} failed: ${P(t.error)??`unknown error`}`,tone:`danger`});return}let a=`${t.dryRun===!0?`Report to ${n} (dry run, nothing sent)`:`Sent report to ${n}`}${F(t.ts)}${r?` — ${r}`:``}`;z(e,t.dryRun===!0?{kind:`note`,id:i,text:a,tone:`dim`}:{kind:`note`,id:i,text:a,tone:`dim`,icon:`handoff`})}function ze(e,t){let n=t.payload??{},r=`Webhook (dry run, nothing sent): ${P(t.event)??`delivery`}${P(n.status)?` · ${P(n.status)}`:``}`;z(e,{kind:`note`,id:`v1:${t.seq}`,text:r,tone:`dim`})}function Be(e,t){let n=i.safeParse(t.server);if(!n.success)return;let r=e.previewByPort.get(n.data.port);r&&(r.turn.entries=r.turn.entries.filter(e=>e!==r.draft));let a=R(e),o={origin:`meta`,firstSeq:t.seq,lastSeq:t.seq,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 Ve(e,t){let n=a.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:i,id:o}=r.draft.entry;r.draft.lastSeq=t.seq,r.draft.entry={kind:`preview-server`,id:o,server:i,state:n.data,stateAt:t.ts,...typeof t.exitCode==`number`?{exitCode:t.exitCode}:{},...t.reason===`user`||t.reason===`idle`?{reason:t.reason}:{}}}function He(e,t){let n=l.safeParse(t);if(!n.success)return;let{message:r,delivery:i,deliveredAt:a,consumedAt:o,ts:s}=n.data;G(e,r,i,{deliveredAt:a,consumedAt:o,recordedAt:s})}function Ue(e,t){let n=te.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),Pe(e,r.requestId))}function We(e,t){let n=ee.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){G(e,{id:r.id,text:r.text,createdAt:r.createdAt,...r.conversation},`delivered`,{deliveredAt:r.deliveredAt,recordedAt:n.data.ts});return}z(e,{kind:`note`,id:`agent-input:${r.id}`,text:r.text,tone:`dim`,attribution:{source:r.source,parentRunId:r.parentRunId}})}}function Ge(e,t){let n=P(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=L(e,t.seq),a=I(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 Ke(e,t){let n=e.turns.at(-1),r=n&&n.turnId===void 0&&!n.v2Items?n:L(e,t.seq);r.turnId=P(t.turnId),r.startedAt??=I(t.ts)}function qe(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 Je(e,t){B(e);let n=qe(e,P(t.turnId));if(!n)return;let r=I(t.ts);n.completed={stopReason:P(t.stopReason)??`end_turn`,...typeof t.costUsd==`number`?{costUsd:t.costUsd}:{},...r===void 0?{}:{ts:r}}}var K=new Set([`message`,`reasoning`,`tool`,`hook`]),Ye=e=>K.has(e.kind);function Xe(e){if(!(!N(e)||!K.has(e.kind)))return typeof e.id==`string`&&e.id!==``?e:void 0}function q(e,t){let n=Xe(t.item);if(!n)return;let r=V(t,n.id);Me(e,e.itemsById.get(r)?.turn??R(e),n,r,t.type===`item.completed`?I(t.ts):void 0)}function Ze(e,t){let n=e.itemsById.get(V(t,P(t.itemId)??``)),r=P(t.delta)??``;if(!n||r===``||!Ye(n.entry.entry))return;let i=n.entry.entry;n.entry.lastSeq=t.seq,t.field===`output`&&i.kind===`tool`?i.output=(i.output??``)+r:t.field!==`output`&&(i.kind===`message`||i.kind===`reasoning`)&&(i.text+=r)}function Qe(e,t){let n=R(e),r=P(t.text)??``;if(r===``)return;let i=I(t.ts);n.entries.push({origin:`v1`,firstSeq:t.seq,lastSeq:t.seq,entry:{kind:`message`,id:`v1:${t.seq}`,role:`assistant`,text:r,...i===void 0?{}:{ts:i}}})}var $e=new Set([`pending`,`in_progress`,`completed`,`cancelled`]);function et(e){if(!N(e)||!Array.isArray(e.todos))return;let t=[];for(let n of e.todos){if(!N(n)||typeof n.content!=`string`)return;t.push({content:n.content,status:$e.has(n.status)?n.status:`pending`,...typeof n.activeForm==`string`?{activeForm:n.activeForm}:{}})}return t}var tt=new Set([`subAgentActivity`,`collabAgentToolCall`,`collabToolCall`]);function nt(e,t){let n=R(e),r=P(t.tool)??`Tool`;if(n.v2Items||tt.has(r))return;let i=j(r,t.input),a=i.toolKind===`plan`?et(t.input):void 0;a!==void 0&&(n.planEntries=a);let o={kind:`tool`,id:P(t.id)??`v1:${t.seq}`,name:r,toolKind:i.toolKind,title:i.title,status:`running`,input:t.input},s={origin:`v1`,entry:o,firstSeq:t.seq,lastSeq:t.seq};n.entries.push(s),e.itemsById.set(o.id,{turn:n,entry:s})}function rt(e){if(typeof e==`string`)return e;if(e==null)return``;try{return JSON.stringify(e)}catch{return String(e)}}function it(e,t){let n=e.itemsById.get(P(t.toolCallId)??``);if(!n||n.turn.v2Items||n.entry.origin!==`v1`)return;let r=n.entry.entry;r.kind===`tool`&&(n.entry.lastSeq=t.seq,r.status=`completed`,r.output=rt(t.result))}function J(e,t,n,r){let i=P(t.message)??``;i!==``&&z(e,{kind:`note`,id:n,text:i,tone:r})}function Y(e,t){J(e,t,`v1:${t.seq}`,t.tone===`danger`?`danger`:`dim`)}function at(e,t){J(e,t,`v1:${t.seq}`,`danger`)}function ot(e,t){J(e,t,`v2:${t.seq}`,`danger`)}function st(e,t){if(t.status!==`failed`)return;let n=P(t.error)?` — ${P(t.error)}`:``;z(e,{kind:`note`,id:`v1:${t.seq}`,text:`step ${P(t.stepId)??`?`} failed${n}`,tone:`danger`})}function ct(e,t){let n=P(t.command)??`check`,r=typeof t.exitCode==`number`?t.exitCode:-1;z(e,{kind:`tool`,id:`v1:${t.seq}`,name:`check`,toolKind:`execute`,title:`Ran ${n}`,status:r===0?`completed`:`failed`,output:P(t.text)??``,exitCode:r})}function lt(e,t){let n=Ae(t.provider),r=P(t.authFailureId)??``;n===void 0||r.length<1||r.length>128||z(e,{kind:`provider-auth-required`,id:`v1:${t.seq}`,provider:n,authFailureId:r})}function ut(e,t){let n=P(t.url);if(n===void 0)return;let r={kind:`image`,id:`v1:${t.seq}`,url:n},i=P(t.name);i!==void 0&&(r.name=i),z(e,r)}function dt(e,t){Array.isArray(t.entries)&&(R(e).planEntries=t.entries)}function ft(e,t){B(e);let n=P(t.message);e.sessionEnded={reason:P(t.reason)??`end_turn`,...n===void 0?{}:{message:n}}}var pt=new Set([`allow_once`,`allow_always`,`reject_once`,`reject_always`]);function mt(e){return N(e)&&typeof e.id==`string`&&e.id!==``&&typeof e.label==`string`&&e.label!==``&&pt.has(e.kind)}function ht(e){if(!(!Array.isArray(e)||e.length===0||!e.every(mt)))return new Set(e.map(e=>e.id)).size===e.length?e:void 0}function gt(e,t){let n=P(t.requestId),r=P(t.title),i=ht(t.options);if(!n||!r||e.permissions.has(n)||!i)return;let a=P(t.itemId),o=P(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),z(e,s)}function _t(e,t){let n=e.permissions.get(P(t.requestId)??``);if(!n||n.status!==`pending`)return;let r=P(t.optionId);r!==void 0&&n.options.some(e=>e.id===r)?(n.status=`resolved`,n.optionId=r):n.status=`expired`;let i=P(t.reason);i!==void 0&&(n.reason=i)}function vt(e,t){let n=M(t),r=n&&Oe(n);if(!r)return;let i={kind:`ask`,...r,questions:r.questions,resolved:!1};z(e,i),e.pendingAsk=i}function X(e,t){let n=e.pendingAsk;return n&&!n.resolved&&n.askSeq===t.askSeq?n:void 0}function yt(e,t){let n=X(e,t);if(!n)return;n.routedToParent=!0;let r=P(t.parentRunId);r!==void 0&&(n.parentRunId=r)}function bt(e,t){let n=X(e,t);n&&(n.routedToParent=!1)}function xt(e,t){let n=X(e,t);n&&Z(e,n,`undeliverable`)}var St=new Set([`finish`,`superseded`,`parent-stopped`,`worker-stopped`,`undeliverable`]);function Ct(e,t){let n=X(e,t);n&&St.has(t.reason)&&Z(e,n,t.reason)}function Z(e,t,n){t.resolved=!0,t.closed=n,e.pendingAsk=void 0}function wt(e,t){let n=X(e,t);if(n){if(t.source===`cezar`){Z(e,n,`undeliverable`);return}t.source===`parent`&&(n.resolved=!0,n.answeredBy=`parent`,e.pendingAsk=void 0)}}var Q=()=>{},Tt=new Map([[`handoff`,Ie],[`webhook.failed`,Le],[`webhook.dry-run`,ze],[`webhook.report`,Re],[`preview.server-registered`,Be],[`preview.server-state`,Ve],[`conversation-message`,He],[`request-outcome`,Ue],[`agent-input`,We],[`user-message`,Ge],[`turn.started`,Ke],[`turn.completed`,Je],[`item.started`,q],[`item.updated`,q],[`item.completed`,q],[`item.delta`,Ze],[`text`,Qe],[`tool-call`,nt],[`tool-result`,it],[`note`,Y],[`lifecycle`,Y],[`error`,at],[`session.error`,ot],[`step-end`,st],[`check-output`,ct],[`provider-auth-required`,lt],[`image`,ut],[`plan.updated`,dt],[`session.started`,e=>B(e)],[`session.ended`,ft],[`permission.requested`,gt],[`permission.resolved`,_t],[`ask.requested`,vt],[`worker-question-routed`,yt],[`worker-question-fallback`,bt],[`worker-question-undelivered`,xt],[`human-ask-closed`,Ct],[`human-input-delivered`,wt],[`step-start`,Q],[`token-usage`,Q],[`cost`,Q],[`turn-end`,Q],[`done`,Q],[`session`,Q]]);function Et(e,t){e.eventSeq=t.seq,Tt.get(t.type)?.(e,t)}function Dt(e){for(let t=e.turns.length-1;t>=0;--t){let n=e.turns[t].planEntries;if(n!==void 0)return n}}function Ot(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 kt(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 At(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 jt(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()))),At(e))}function Mt(e){e.userMessage&&(e.entries=e.entries.filter(({entry:e})=>!g(e,`human`)))}function Nt(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 Pt(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),itemSeqs:Ft(e.entries)}}function Ft(e){let t=new Map;for(let{entry:n,firstSeq:r,lastSeq:i}of e)t.has(n.id)||t.set(n.id,{first:r,last:i});return t}function It(e,t={}){let n=ke();for(let t of e)Et(n,t);for(let e of n.turns)e.v2Items&&jt(e),Mt(e);Nt(n);let r=n.turns.length-1;return{turns:n.turns.map((e,n)=>Pt(e,t.activeTurn===!0&&n===r)),...n.sessionEnded===void 0?{}:{sessionEnded:n.sessionEnded}}}export{De as a,g as c,f as d,kt as i,fe as l,It as n,Ce as o,Ot as r,j as s,Dt as t,p as u};
|
package/web/dist/assets/{use-hand-to-agent-state-DaPTyzCV.js → use-hand-to-agent-state-BrTzbU6r.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{l as r,t as i,u as a}from"./button-C1fD-ZFr.js";import{Er as o,Jt as s,Ln as c,Pt as l,ei as u,nt as d,r as f,tt as p,w as m}from"./project-scope-context-CR3cozni.js";import{A as h,At as g,E as _,Et as v,Ft as y,Kt as b,Q as x,Y as S,Yt as C,p as w,t as T}from"./queries-BCXjp1_j.js";import{t as E}from"./useQuery-Ct6O0RmO.js";import{a as D,o as O,r as k,tt as A}from"./use-desktop-CEB_iBfH.js";import{n as j}from"./toaster-Cxgzn9ip.js";import{s as M}from"./runners-BZb4ezwE.js";import{Y as N,c as P,ct as ee,ft as F,g as I,it as L,k as R,l as z,m as B,ot as te,r as ne,tt as re,u as ie,ut as ae,y as oe}from"./design-icons-B6-0w7Aw.js";import{t as se}from"./eye-B8okNWXU.js";import{a as ce,i as V}from"./format-BNCkW110.js";import{t as le}from"./message-square-B-MD-8rD.js";import{t as ue}from"./play-CmVAj_fu.js";import{a as de,i as fe,o as pe,r as me,s as he,t as ge}from"./dialog-DSwzMeY3.js";import{d as H,t as _e,y as U}from"./prompt-template-menu-ntY16IJm.js";import{t as W}from"./project-router-BLLH9tz9.js";import{F as ve,M as G,N as ye,P as K,S as be,_ as xe,a as Se,b as Ce,c as we,d as Te,f as Ee,g as De,j as Oe,k as ke,n as Ae,r as je,s as Me,t as q,u as Ne,v as Pe,w as Fe,x as Ie}from"./picker-pill-DW8uRjlV.js";import{d as Le,f as J,i as Re,o as ze,p as Be,s as Ve,t as He,u as Ue}from"./skills-pM_PouEs.js";import{B as We,F as Ge,L as Ke,P as qe,U as Je,_n as Ye,z as Xe}from"./index-Dbb0-RtK.js";import{t as Ze}from"./markdown-D3aDM4O5.js";import{t as Qe}from"./diff-DNIkChMc.js";import{t as $e}from"./tab-link-DkArCoa9.js";var Y=e(t(),1),X=n(),et={squash:`Squash and merge`,merge:`Create a merge commit`,rebase:`Rebase and merge`};function Z({state:e}){let t=`size-4 shrink-0`;return e===`passing`?(0,X.jsx)(P,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-passing`,className:r(t,`text-success`)}):e===`failing`?(0,X.jsx)(I,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-failing`,className:r(t,`text-danger`)}):e===`pending`?(0,X.jsx)(ce,{"aria-hidden":`true`,"data-slot":`gh-merge-status-pending`,className:r(t,`animate-spin text-warning`)}):(0,X.jsx)(B,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-unknown`,className:r(t,`text-soft-foreground`)})}function tt(e){return e?.available?e.mergeState:null}function nt(e,t){return e&&t?.methods.includes(e)?e:t?.defaultMethod??t?.methods[0]??null}function rt(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 it(e){return e===`approved`||e===`not-required`?`passing`:e===`unknown`?`unknown`:`failing`}function at(e){return e===`mergeable`?`passing`:e===`conflicting`?`failing`:`unknown`}function ot(e){return e===`conflicting`?`present`:e===`mergeable`?`none`:`unknown`}function st(e){return e===!0?` · required`:e===null?` · requiredness unknown`:``}function ct(e){return e?.available===!1?e.reason:`GitHub could not load merge requirements.`}function lt(e,t,n){return!!(e&&(t.canMerge||t.canOverride&&n))}function Q(e){return e?et[e]:`Merge`}function ut(e){return e===`conflicting`?`true`:void 0}function dt({check:e}){return(0,X.jsxs)(`li`,{className:`flex items-center justify-between gap-3`,children:[(0,X.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,X.jsx)(Z,{state:e.state}),(0,X.jsxs)(`span`,{children:[e.name,` · `,e.state,st(e.required)]})]}),e.url&&a(e.url)?(0,X.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`text-muted-foreground underline`,children:`details`}):null]})}function ft({reason:e}){return(0,X.jsxs)(`section`,{"data-slot":`gh-merge-unavailable`,className:`mt-6 rounded-lg border border-border bg-card p-4 text-sm`,children:[(0,X.jsx)(`p`,{className:`font-medium`,children:`Merge status unavailable`}),(0,X.jsx)(`p`,{className:`mt-1 text-xs text-soft-foreground`,children:e})]})}function pt({state:e,selectedMethod:t,overrideRules:n,mergeEnabled:a,refreshPending:o,onRefresh:s,onRunAgent:c,onConfirm:l,onMethodChange:u,onOverrideChange:d}){let f=rt(e),p=it(e.reviewDecision),m=at(e.mergeable);return(0,X.jsxs)(`div`,{className:`flex items-start gap-3`,children:[e.canMerge?(0,X.jsx)(P,{size:16,"aria-hidden":`true`,className:`mt-0.5 size-5 shrink-0 text-success`}):(0,X.jsx)(te,{size:16,"aria-hidden":`true`,className:`mt-0.5 size-5 shrink-0 text-warning`}),(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,X.jsx)(`h3`,{className:`font-semibold`,children:f}),(0,X.jsxs)(i,{type:`button`,variant:`ghost`,size:`sm`,disabled:o,onClick:s,children:[(0,X.jsx)(N,{size:16,"aria-hidden":`true`,className:r(`size-3.5`,o&&`animate-spin`)}),`Refresh`]})]}),(0,X.jsxs)(`p`,{className:`mt-1 font-mono text-[11px] text-soft-foreground`,children:[e.headRef,` (`,e.headSha.slice(0,7),`) → `,e.baseRef]}),(0,X.jsxs)(`ul`,{className:`mt-3 space-y-2 text-xs`,children:[(0,X.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(Z,{state:p}),(0,X.jsxs)(`span`,{children:[`Reviews: `,e.reviewDecision.replaceAll(`-`,` `)]})]}),(0,X.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(Z,{state:m}),(0,X.jsxs)(`span`,{children:[`Conflicts: `,ot(e.mergeable)]})]}),e.checks.length===0?(0,X.jsx)(`li`,{children:`No checks configured`}):e.checks.map(e=>(0,X.jsx)(dt,{check:e},e.name)),e.blockers.map(e=>(0,X.jsx)(`li`,{className:`text-soft-foreground`,children:e.message},e.code))]}),e.mergeable===`conflicting`&&c?(0,X.jsx)(i,{className:`mt-4`,onClick:c,children:`Run agent on this PR`}):null,e.canOverride?(0,X.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,X.jsx)(`input`,{type:`checkbox`,checked:n,onChange:e=>d(e.target.checked),className:`mt-0.5 size-4 accent-accent-strong`}),(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`span`,{className:`block font-medium`,children:`Merge without waiting for requirements`}),(0,X.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,X.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,X.jsxs)(`div`,{className:`mt-4 flex flex-col flex-wrap gap-2 sm:flex-row`,children:[(0,X.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,X.jsx)(`option`,{value:e,children:et[e]},e))}),(0,X.jsx)(i,{disabled:!a,onClick:l,children:Q(t)})]}):null]})]})}function mt({number:e,state:t,selectedMethod:n,confirming:r,overrideRules:a,mergePending:o,mergeError:s,onOpenChange:c,onMerge:l}){return(0,X.jsx)(ge,{open:r,onOpenChange:c,children:(0,X.jsxs)(me,{"data-slot":`gh-merge-confirm`,showCloseButton:!1,children:[(0,X.jsxs)(pe,{children:[(0,X.jsxs)(he,{children:[Q(n),` pull request #`,e,`?`]}),(0,X.jsx)(fe,{asChild:!0,children:(0,X.jsxs)(`div`,{children:[(0,X.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,X.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,X.jsx)(`p`,{className:`text-sm text-danger`,children:s.message}):null,(0,X.jsxs)(de,{children:[(0,X.jsx)(i,{variant:`outline`,disabled:o,onClick:()=>c(!1),children:`Cancel`}),(0,X.jsx)(i,{disabled:o,onClick:l,children:o?`Merging…`:Q(n)})]})]})})}function ht({number:e,onRunAgent:t}){let n=u(),r=x(),i=E({queryKey:T.githubMergeState(e),queryFn:({signal:t})=>d(e,{},{signal:t}),retry:!1}),a=tt(i.data),[o,s]=(0,Y.useState)(null),[c,f]=(0,Y.useState)(!1),[p,m]=(0,Y.useState)(!1),h=C({mutationFn:t=>d(e,{refresh:!0}),onSuccess:(e,t)=>n.setQueryData(t,e),onError:e=>j(e instanceof Error?e.message:String(e),{tone:`danger`})}),g=nt(o,a),_=()=>({mergeState:T.githubMergeState(e),list:T.githubPages(50),comments:T.githubComments(`pr`,e),item:T.githubItem(`pr`,e),refStatus:r===void 0?void 0:T.githubRefStatusOf(r)}),v=C({mutationFn:t=>{if(!a||!g)throw Error(`No merge method is available.`);return l(e,{method:g,expectedHeadSha:a.headSha,...p&&a.canOverride?{overrideRules:!0}:{}})},onSuccess:(t,r)=>{f(!1),j(`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)=>{j(e instanceof Error?e.message:String(e),{tone:`danger`}),n.invalidateQueries({queryKey:t.mergeState})}});return i.isPending?(0,X.jsx)(U,{"data-slot":`gh-merge-loading`,className:`mt-6 h-32 w-full`}):a?(0,X.jsxs)(`section`,{"data-slot":`gh-merge-box`,"data-eligibility":a.eligibility,"data-conflicting":ut(a.mergeable),"aria-live":`polite`,className:`mt-6 rounded-lg border border-border bg-card p-4`,children:[(0,X.jsx)(pt,{state:a,selectedMethod:g,overrideRules:p,mergeEnabled:lt(g,a,p),refreshPending:h.isPending,onRefresh:()=>h.mutate(T.githubMergeState(e)),onRunAgent:t,onConfirm:()=>f(!0),onMethodChange:s,onOverrideChange:m}),(0,X.jsx)(mt,{number:e,state:a,selectedMethod:g,confirming:c,overrideRules:p,mergePending:v.isPending,mergeError:v.error,onOpenChange:f,onMerge:()=>v.mutate(_())})]}):(0,X.jsx)(ft,{reason:ct(i.data)})}function gt(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 _t(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 vt(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 $(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 yt({label:e,color:t,plain:n=!1}){return(0,X.jsx)(`span`,{"data-slot":`gh-label`,"data-label":e,style:n?void 0:$(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 bt(e){return e===`pr`?`pull request`:`issue`}function xt(e,t,n){return e===`pr`&&!!(t||n)}function St({backLink:e}){return e?(0,X.jsxs)(W,{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,X.jsx)(ne,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`Back to the list`]}):null}function Ct({item:e,kindWord:t,commentCount:n,hasDiffStat:r,additions:i,deletions:o}){return(0,X.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,X.jsxs)(`span`,{children:[`#`,e.number]}),`·`,(0,X.jsx)(`span`,{children:t}),`·`,(0,X.jsxs)(`span`,{children:[`opened by `,e.author]}),`·`,(0,X.jsxs)(`span`,{children:[V(e.createdAt),` ago`]}),n?(0,X.jsxs)(X.Fragment,{children:[`·`,(0,X.jsx)(qt,{count:n})]}):null,r?(0,X.jsxs)(X.Fragment,{children:[`·`,(0,X.jsxs)(`span`,{"data-slot":`gh-diffstat`,children:[(0,X.jsxs)(`span`,{className:`text-success`,children:[`+`,i??0]}),` `,(0,X.jsxs)(`span`,{className:`text-danger`,children:[`−`,o??0]})]})]}):null,`·`,a(e.url)?(0,X.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,X.jsx)(A,{"aria-hidden":`true`,className:`size-2.5`})]}):(0,X.jsx)(`span`,{"data-slot":`gh-open-link`,className:`text-muted-foreground`,children:`open on GitHub`})]})}function wt({item:e,subNav:t,changes:n}){return e.kind===`pr`?t?(0,X.jsxs)(`nav`,{"aria-label":`Pull request detail`,className:`mt-4 flex border-b border-border`,children:[(0,X.jsx)($e,{to:H(`prs`,t.filter,e.number),active:!n,children:`Conversation`}),(0,X.jsx)($e,{to:H(`prs`,t.filter,e.number,`/changes`),active:n,children:`Changes`})]}):(0,X.jsx)(W,{to:H(`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 Tt({item:e,colors:t,checks:n}){return e.labels.length>0||n?(0,X.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-1.5`,children:[e.labels.map(e=>(0,X.jsx)(yt,{label:e,color:t[e]},e)),n?(0,X.jsx)(Jt,{checks:n,url:e.url}):null]}):null}function Et({item:e,colors:t,body:n}){return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{"data-slot":`gh-body`,className:`mt-5 text-sm`,children:n?(0,X.jsx)(Ze,{children:n}):(0,X.jsx)(`p`,{className:`text-soft-foreground`,children:`(no description)`})}),(0,X.jsx)(kt,{item:e,colors:t})]})}function Dt({item:e,colors:t,checks:n,comments:r,backLink:i,subNav:a,onRunAgent:o,afterHeading:s,children:c}){let l=a?.changes??!1,u=bt(e.kind),d=_(e.kind,e.number,!l).data?.detail,f=d?.body??e.body,p=d?.additions??e.additions,m=d?.deletions??e.deletions,h=xt(e.kind,p,m),g=r??e.comments;return(0,X.jsxs)(`article`,{"data-slot":`gh-detail-inner`,className:`min-w-0 px-4 py-4 md:px-7 md:py-5`,children:[(0,X.jsx)(St,{backLink:i}),(0,X.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,X.jsxs)(`h2`,{className:`mb-4 text-[22px] leading-snug font-normal`,children:[`#`,e.number,` `,e.title]}):null,(0,X.jsx)(Ct,{item:e,kindWord:u,commentCount:g,hasDiffStat:h,additions:p,deletions:m}),e.kind===`pr`?null:(0,X.jsx)(`h2`,{className:`mt-2 text-[22px] leading-snug font-normal`,children:e.title}),s,(0,X.jsx)(wt,{item:e,subNav:a,changes:l}),(0,X.jsx)(Tt,{item:e,colors:t,checks:n}),l&&e.kind===`pr`?(0,X.jsx)(Ot,{item:e}):(0,X.jsx)(Et,{item:e,colors:t,body:f})]}),e.kind===`pr`?(0,X.jsx)(ht,{number:e.number,onRunAgent:o}):null,c]})}function Ot({item:e}){let t=u(),n=h(e.number),[o,s]=(0,Y.useState)(``),[c,l]=(0,Y.useState)(null),d=n.data,f=d?.available?d.files.filter(e=>e.path.toLowerCase().includes(o.toLowerCase())):[],m=f.findIndex(e=>e.path===c);(0,Y.useEffect)(()=>{f.length>0&&!f.some(e=>e.path===c)&&l(f[0].path)},[d?.available?d.headSha:``,o]);let g=async()=>{let n=d?.available?d.headSha:null,r=T.githubPrChanges(e.number),i=await p(e.number,{refresh:!0});t.setQueryData(r,i),i.available&&n&&n!==i.headSha&&(l(i.files[0]?.path??null),j(`The reviewed revision changed.`))};if(n.isPending)return(0,X.jsx)(`p`,{"aria-live":`polite`,className:`mt-6 text-sm text-muted-foreground`,children:`Loading changed files…`});if(n.isError||!d)return(0,X.jsx)(`p`,{className:`mt-6 text-sm text-danger`,children:`Changed files could not be loaded.`});if(!d.available)return(0,X.jsx)(`p`,{className:`mt-6 text-sm text-muted-foreground`,children:d.reason});let _=f.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=a(e.url)?`${e.url}/files`:null,y=f.find(e=>e.path===c);return(0,X.jsxs)(`section`,{"data-slot":`gh-pr-changes`,className:`mt-5 min-w-0`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs`,children:[(0,X.jsxs)(`strong`,{children:[d.files.length,` changed files`]}),(0,X.jsxs)(`span`,{className:`text-success`,children:[`+`,d.additions]}),(0,X.jsxs)(`span`,{className:`text-danger`,children:[`−`,d.deletions]}),(0,X.jsxs)(`span`,{className:`font-mono text-muted-foreground`,title:d.headSha,children:[`head `,d.headSha.slice(0,8)]}),(0,X.jsx)(i,{type:`button`,variant:`outline`,size:`sm`,className:`ml-auto min-h-11`,onClick:()=>void g(),children:`Refresh`})]}),d.truncated?(0,X.jsxs)(`p`,{role:`status`,className:`mt-3 rounded-md border border-warning/40 bg-warning/10 p-3 text-xs`,children:[d.reason??`This response is incomplete.`,` `,v?(0,X.jsx)(`a`,{href:v,target:`_blank`,rel:`noopener noreferrer`,className:`underline`,children:`Open all files on GitHub`}):null]}):null,(0,X.jsxs)(`div`,{className:`mt-4 grid min-w-0 gap-4 lg:grid-cols-[240px_minmax(0,1fr)]`,children:[(0,X.jsxs)(`aside`,{className:`min-w-0`,children:[(0,X.jsx)(`input`,{"aria-label":`Filter changed files`,value:o,onChange:e=>s(e.target.value),placeholder:`Filter files…`,className:`min-h-11 w-full rounded-md border border-input bg-background px-3 text-sm`}),(0,X.jsx)(`select`,{"aria-label":`Select changed file`,value:c??``,onChange:e=>l(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:f.map(e=>(0,X.jsx)(`option`,{children:e.path},e.path))}),(0,X.jsx)(`ul`,{className:`mt-2 hidden max-h-[60vh] overflow-auto lg:block`,children:f.map(e=>(0,X.jsx)(`li`,{children:(0,X.jsxs)(`button`,{type:`button`,onClick:()=>l(e.path),className:r(`min-h-11 w-full truncate rounded px-2 text-left text-xs`,c===e.path&&`bg-muted font-medium`),title:e.path,children:[e.status,` · `,e.path,` `,(0,X.jsxs)(`span`,{className:`text-success`,children:[`+`,e.additions]}),` `,(0,X.jsxs)(`span`,{className:`text-danger`,children:[`−`,e.deletions]})]})},e.path))})]}),(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsxs)(`div`,{className:`mb-2 flex justify-end gap-1`,children:[(0,X.jsx)(i,{"aria-label":`Previous file`,variant:`outline`,size:`icon`,className:`min-h-11 min-w-11`,disabled:m<=0,onClick:()=>l(f[m-1]?.path??null),children:(0,X.jsx)(Ye,{})}),(0,X.jsx)(i,{"aria-label":`Next file`,variant:`outline`,size:`icon`,className:`min-h-11 min-w-11`,disabled:m<0||m>=f.length-1,onClick:()=>l(f[m+1]?.path??null),children:(0,X.jsx)(ie,{size:16})})]}),f.length===0?(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No changed files match this filter.`}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Qe,{files:_.filter(e=>e.path===c),wrap:!0,className:`min-w-0`}),y&&!y.patch?(0,X.jsxs)(`p`,{className:`rounded-b border border-border p-3 text-xs text-muted-foreground`,children:[`Patch unavailable: `,y.patchUnavailableReason??`not-provided`,`.`]}):null]})]})]})]})}function kt({item:e,colors:t}){let n=_(e.kind,e.number),r=n.data,i=(0,Y.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(At(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,X.jsxs)(`section`,{"data-slot":`gh-thread-loading`,className:`mt-6 border-t border-border pt-5`,children:[(0,X.jsx)(U,{className:`mb-3 h-3 w-24`}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,X.jsx)(U,{className:`h-14 w-full`}),(0,X.jsx)(U,{className:`h-14 w-full`})]})]}):!r||!r.available?(0,X.jsxs)(`section`,{"data-slot":`gh-thread-error`,className:`mt-6 border-t border-border pt-5 text-xs text-soft-foreground`,children:[(0,X.jsxs)(`span`,{children:[`Couldn’t load comments — `,r?.reason??(n.error instanceof Error?n.error.message:`could not load comments`),`. `]}),(0,X.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,X.jsx)(A,{"aria-hidden":`true`,className:`size-2.5`})]})]}):i.length===0?null:(0,X.jsxs)(`section`,{"data-slot":`gh-thread`,className:`mt-6 border-t border-border pt-5`,children:[(0,X.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,X.jsx)(`ul`,{className:`flex flex-col gap-5`,children:jt(i).map(e=>e.group===`commits`?(0,X.jsx)(Mt,{commits:e.commits,colors:t},e.commits[0].id):e.entry.row===`comment`?(0,X.jsx)(Ut,{comment:e.entry.comment},`${e.entry.comment.kind}-${e.entry.comment.id}`):(0,X.jsx)(Pt,{event:e.entry.event,colors:t},e.entry.event.id))}),r.truncated?(0,X.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,X.jsx)(A,{"aria-hidden":`true`,className:`size-2.5`})]}):null]})}var At=e=>e.row===`comment`?e.comment.createdAt:e.event.createdAt;function jt(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 Mt({commits:e,colors:t}){let[n,r]=(0,Y.useState)(!1),i=e[0]?.actor??`?`;return n?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`true`,className:`min-w-0`,children:(0,X.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,X.jsx)(`span`,{"aria-hidden":`true`,children:Nt.committed}),(0,X.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,X.jsxs)(`span`,{children:[`added `,e.length,` commits`]})]})}),e.map(e=>(0,X.jsx)(Pt,{event:e,colors:t},e.id))]}):(0,X.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`false`,className:`min-w-0`,children:(0,X.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,X.jsx)(`span`,{"aria-hidden":`true`,children:Nt.committed}),(0,X.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,X.jsxs)(`span`,{children:[`added `,e.length,` commits`]}),(0,X.jsx)(`span`,{className:`shrink-0`,children:V(e[e.length-1].createdAt)})]})})}var Nt={committed:`⚙`,labeled:`◆`,unlabeled:`◇`,assigned:`◍`,unassigned:`◌`,merged:`⑃`,closed:`⊘`,reopened:`⊙`,head_ref_force_pushed:`↻`,"cross-referenced":`↗`,renamed:`✎`};function Pt({event:e,colors:t}){return(0,X.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,X.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0`,children:Nt[e.kind]}),(0,X.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.actor}),(0,X.jsx)(Bt,{event:e,colors:t}),(0,X.jsx)(`span`,{className:`shrink-0`,children:V(e.createdAt)}),e.url?(0,X.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,X.jsx)(A,{"aria-hidden":`true`,className:`size-2.5`})}):null]})}function Ft({event:e}){return(0,X.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,X.jsx)(`span`,{className:`shrink-0`,children:`committed`}),e.sha?(0,X.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:e.sha.slice(0,7)}):null,e.message?(0,X.jsx)(`span`,{className:`truncate font-sans text-foreground`,children:e.message}):null,(0,X.jsx)(Vt,{checks:e.checks})]})}function It({event:e,colors:t}){return(0,X.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,X.jsx)(`span`,{className:`shrink-0`,children:e.kind===`labeled`?`added the`:`removed the`}),e.label?(0,X.jsx)(`span`,{"data-slot":`gh-event-label`,style:$(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,X.jsx)(`span`,{className:`shrink-0`,children:`label`})]})}function Lt({event:e}){return(0,X.jsxs)(`span`,{className:`truncate`,children:[e.kind===`assigned`?`assigned`:`unassigned`,` `,e.subject??`someone`]})}function Rt({event:e}){return(0,X.jsxs)(`span`,{className:`truncate`,children:[`referenced this in `,e.refNumber?`#${e.refNumber}`:`another thread`,e.refTitle?` ${e.refTitle}`:``]})}var zt={committed:e=>(0,X.jsx)(Ft,{event:e}),labeled:(e,t)=>(0,X.jsx)(It,{event:e,colors:t}),unlabeled:(e,t)=>(0,X.jsx)(It,{event:e,colors:t}),assigned:e=>(0,X.jsx)(Lt,{event:e}),unassigned:e=>(0,X.jsx)(Lt,{event:e}),merged:()=>(0,X.jsx)(`span`,{children:`merged this`}),closed:()=>(0,X.jsx)(`span`,{children:`closed this`}),reopened:()=>(0,X.jsx)(`span`,{children:`reopened this`}),head_ref_force_pushed:()=>(0,X.jsx)(`span`,{children:`force-pushed`}),renamed:e=>(0,X.jsxs)(`span`,{className:`truncate`,children:[`renamed this to `,e.subject??`—`]}),"cross-referenced":e=>(0,X.jsx)(Rt,{event:e})};function Bt({event:e,colors:t}){return zt[e.kind]?.(e,t)??null}function Vt({checks:e}){return e?(0,X.jsx)(`span`,{"data-slot":`gh-commit-checks`,"data-checks":e,"aria-label":`checks ${e}`,className:r(`shrink-0`,Kt[e]),children:Gt[e]}):null}var Ht={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 Ut({comment:e}){let t=e.reviewState?Ht[e.reviewState]:null;return(0,X.jsxs)(`li`,{"data-slot":`gh-thread-entry`,"data-kind":e.kind,className:`min-w-0`,children:[(0,X.jsxs)(`div`,{className:`mb-1.5 flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground`,children:[(0,X.jsx)(Wt,{url:e.avatarUrl,login:e.author}),(0,X.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.author}),(0,X.jsx)(`span`,{children:V(e.createdAt)}),t?(0,X.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,X.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,X.jsx)(A,{"aria-hidden":`true`,className:`size-2.5`})})]}),(0,X.jsx)(`div`,{"data-slot":`gh-thread-body`,className:`text-sm`,children:e.body?(0,X.jsx)(Ze,{children:e.body}):(0,X.jsx)(`p`,{className:`text-soft-foreground`,children:`(no body)`})})]})}function Wt({url:e,login:t}){let[n,r]=(0,Y.useState)(!1);return e&&!n?(0,X.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,X.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 Gt={passing:`✓`,failing:`✗`,pending:`○`},Kt={passing:`text-success`,failing:`text-danger`,pending:`text-muted-foreground`};function qt({count:e}){return e?(0,X.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,X.jsx)(le,{"aria-hidden":`true`,className:`size-3`}),e]}):null}function Jt({checks:e,url:t}){let n=r(`text-[11px] font-medium`,Kt[e],t&&`hover:underline`),i=`${Gt[e]} checks ${e}`;return t?(0,X.jsx)(`a`,{href:`${t}/checks`,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-checks`,"data-checks":e,className:n,children:i}):(0,X.jsx)(`span`,{"data-slot":`gh-checks`,"data-checks":e,className:n,children:i})}function Yt({checks:e}){return(0,X.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`,Kt[e]),children:Gt[e]})}function Xt(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=Xt(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=Xt(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.map(e=>e.id),r)}:n.length?{...i,steps:nn(n.map(e=>e.id)).map((e,t)=>({...e,...n[t]?.path===void 0?{}:{skillPath:n[t].path}})),task:tn(e,[],r)}:{...i,workflow:`quick-task`,task:tn(e,[],r)}}function an(e){let t=S(),n=w(),r=M(),i=o(t.data,r.data),a=n.data?.defaultRunner,s=be(e.runner,i,a??i[0]??`claude`),c=n.data?.modelsLocked===!0,{accounts:l,repoAccount:u}=Ge(),d=l.some(t=>t.provider===s&&t.id===e.account)?e.account:null,f=b(s,!0,d??u?.[s]),p=Ie(c?null:e.model,s,r.data,n.data?.defaultModels,f.data),m=xe(p,f.data);return{runner:s,runnerExplicit:e.runner!==null,model:p,effort:c?``:Ce(e.effort,m),effortOptions:m,runners:i,defaultRunner:a,canRun:t.isSuccess&&i.length>0,modelsLocked:c,providerPending:t.isPending,providerError:t.isError,accounts:l,account:d,repoAccount:u}}function on(e){return{runner:Fe(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,Y.useRef)(null),o=(0,Y.useRef)(null),[s,c]=(0,Y.useState)(()=>typeof window<`u`&&window.innerWidth<=767);(0,Y.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,Y.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,_=w(),v=M(),y=b(u,!0,l.account??l.repoAccount?.[u]),x=Pe(u,v.data,y.data,[e.model,_.data?.defaultModels?.[u]]),S=n||!h,C=r?l.accounts:[],T=m.length>1||m.some(e=>qe(C,e))?(0,X.jsx)(je,{icon:(0,X.jsx)(L,{"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:S,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,E=(0,X.jsx)(q,{icon:(0,X.jsx)(oe,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,slot:`model-pill`,ariaLabel:`Model`,label:d===``?`Default`:x.find(e=>e.id===d).label,value:d,disabled:S,readOnly:g===!0,disabledHint:g?`Model selection is locked to native coding-agent settings.`:void 0,onPick:n=>{let r=xe(n,y.data);t({...e,model:n,effort:e.effort===null?null:Ce(e.effort,r)})},options:x.map(e=>({value:e.id,label:e.label,desc:e.desc})),status:De(u,v.data,y)},`model`),D=(0,X.jsx)(q,{icon:(0,X.jsx)(R,{"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:S,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,X.jsx)(`div`,{ref:a,"data-slot":`engine-row-box`,children:(0,X.jsx)(`div`,{"data-slot":`engine-row`,className:`engine-row`,role:`group`,"aria-label":`Agent settings`,children:(0,X.jsx)(Ae,{children:s?[T,D,E]:[T,E,D]})})}):(0,X.jsxs)(Ae,{children:[T,E,D]})}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.flatMap(e=>typeof e==`string`?[{id:e}]:!e||typeof e!=`object`||typeof e.id!=`string`?[]:[{id:e.id,...typeof e.path==`string`?{path:e.path}:{}}]):[]}}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 mn=`cez-followup-prompt:`;function hn(e){try{return localStorage.getItem(mn+e)??``}catch{return``}}function gn(e,t){try{t===``?localStorage.removeItem(mn+e):localStorage.setItem(mn+e,t)}catch{}}function _n({item:e,workflows:t,skills:n,workflow:r,onWorkflowChange:o,selectedSkills:c,onSkillsChange:l,engine:d,onEngineChange:f,queuedRunId:p,onQueued:h}){let g=u(),_=v(),b=e.kind===`pr`?`PR`:`issue`,x=an(d),S=y(x.runner,x.account),w=c.filter(e=>S.unchecked||e.path===void 0||n.some(t=>t.id===e.id&&(e.path===void 0||t.path===e.path))),E=w.length!==c.length,[D]=(0,Y.useState)(()=>Xt(e)),[O,k]=(0,Y.useState)(()=>hn(e.url)||D),A=(0,Y.useRef)(null),M=(0,Y.useRef)(null);(0,Y.useEffect)(()=>{gn(e.url,O===D?``:O)},[e.url,O,D]);let N=(0,Y.useMemo)(()=>Ne(_.data?.promptTemplates),[_.data?.promptTemplates]),ee=e=>{let t=A.current,n=Ee({prompt:O,base:D,selectionStart:t?.selectionStart??null,focused:document.activeElement===t,remembered:M.current}),r=we(O,n,e);k(r.text),M.current=r.caret,requestAnimationFrame(()=>{A.current?.focus(),A.current?.setSelectionRange(r.caret,r.caret)})},F=Me(N,w.map(e=>e.id)),I=(0,Y.useRef)(O);I.current=O;let L=(0,Y.useRef)(``);(0,Y.useEffect)(()=>{let e=Te(I.current,L.current,F,D);L.current=e.applied,e.text!==I.current&&k(e.text)},[F,D]);let R=C({mutationFn:async()=>!x.canRun||E?null:m(rn(e,r,w,O,sn(x))),onSuccess:t=>{if(t===null)return;let n=t;n&&h(e.url,n.id),j(`Added to the queue — ${b} #${e.number}`),w.length>0&&_.data!==void 0&&s({skillUsage:w.reduce((e,t)=>He(e,t.id),_.data.skillUsage)}).then(()=>g.invalidateQueries({queryKey:T.uiState})).catch(()=>{}),gn(e.url,``),k(D),L.current=``,g.invalidateQueries({queryKey:T.runs.all})},onError:e=>j(e.message,{tone:`danger`})}),z=e=>{Xe({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(),!R.isPending&&x.canRun&&R.mutate())},B=e=>l(c.some(t=>J(t)===J(e))?c.filter(t=>J(t)!==J(e)):[...c,Ve(e)]);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`section`,{"data-slot":`gh-hand`,className:`mt-7 rounded-lg border border-border bg-card p-4`,children:[(0,X.jsx)(`h3`,{className:`text-xl font-normal text-foreground`,children:`Hand this to the agent`}),(0,X.jsxs)(`label`,{className:`gh-field gh-prompt-field`,children:[(0,X.jsx)(`span`,{children:`Instructions for the agent`}),(0,X.jsx)(Je,{ref:A,"data-slot":`gh-custom-prompt`,"aria-label":`Custom prompt`,"aria-keyshortcuts":`Control+Enter Meta+Enter`,value:O,onChange:e=>k(e.target.value),onSelect:e=>{M.current=e.currentTarget.selectionStart},onKeyDown:z,placeholder:`Instructions for the agent… (#${e.number} and its link are always sent)`,className:`mt-3 min-h-20 text-[13px]`})]}),(0,X.jsx)(_e,{templates:N,onInsert:ee}),(0,X.jsxs)(`div`,{className:`gh-handoff-settings`,children:[(0,X.jsxs)(`div`,{className:`gh-field`,children:[(0,X.jsx)(`span`,{children:`Workflow`}),(0,X.jsx)(yn,{workflows:t,value:r,onChange:o})]}),(0,X.jsxs)(`div`,{className:`gh-field`,children:[(0,X.jsx)(`span`,{children:`Skills · select one or more`}),(0,X.jsx)(xn,{skills:n,skillUsage:_.data?.skillUsage,selected:c,onToggle:B})]}),c.length>0?(0,X.jsx)(`div`,{"data-slot":`gh-skill-chips`,className:`mt-2.5 flex flex-wrap gap-1.5`,children:c.map(e=>(0,X.jsx)(vn,{skill:e,skills:n,unchecked:S.unchecked,onRemove:()=>B(e)},J(e)))}):null,E?(0,X.jsx)(`p`,{role:`alert`,children:`A selected skill path is unavailable. Remove it or choose a current copy before starting.`}):null,(0,X.jsx)(cn,{layout:`row`,pick:d,onChange:f,disabled:R.isPending||!x.canRun,accounts:!0}),(0,X.jsxs)(`div`,{className:`gh-field`,children:[(0,X.jsx)(`span`,{children:`Account`}),(0,X.jsx)(bn,{resolved:x,disabled:R.isPending||!x.canRun,onPick:e=>f({...d,account:e})})]}),!x.providerPending&&!x.canRun?(0,X.jsxs)(`span`,{"data-slot":`gh-provider-gate`,className:`inline-flex flex-wrap items-center gap-1 text-xs text-muted-foreground`,children:[x.providerError?`Provider authentication could not be verified.`:`Connect an agent provider to run this item.`,(0,X.jsx)(W,{to:`/settings/agents#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}):null]}),(0,X.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,X.jsxs)(`div`,{"data-slot":`gh-handoff-actions`,className:`mt-[22px] flex flex-wrap items-center gap-2.5`,children:[a(e.url)?(0,X.jsx)(i,{asChild:!0,variant:`outline`,children:(0,X.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,children:`Open in GitHub`})}):null,(0,X.jsxs)(i,{variant:`primary`,"data-action":`gh-run`,disabled:R.isPending||!x.canRun||E,onClick:()=>R.mutate(),children:[(0,X.jsx)(ue,{"aria-hidden":`true`,className:`size-3.5`}),`Run agent on this `,b]}),(0,X.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:We()}),p?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`span`,{"data-slot":`gh-queued`,className:`flex items-center gap-1 text-xs font-medium text-success`,children:[(0,X.jsx)(P,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`queued`]}),(0,X.jsx)(W,{to:`/tasks/${p}`,"data-slot":`gh-view-run`,className:`text-xs font-semibold text-accent-text hover:underline`,children:`View task →`})]}):null]})]})}function vn({skill:e,skills:t,unchecked:n,onRemove:r}){let i=t.find(t=>t.id===e.id&&(e.path===void 0||t.path===e.path)),a=[i?.name??e.id,e.path].filter(Boolean).join(` · `),o=!n&&e.path!==void 0&&!i?` (unavailable)`:n||!i?` (unchecked)`:``;return(0,X.jsxs)(`button`,{type:`button`,"data-slot":`gh-skill-chip`,"data-skill":e.id,onClick:r,title:`Remove skill ${a}`,"aria-label":`Remove skill ${a}`,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:[a,o,(0,X.jsx)(F,{size:16,"aria-hidden":`true`,className:`size-3`})]})}function yn({workflows:e,value:t,onChange:n}){let[i,a]=(0,Y.useState)(!1),[o,s]=(0,Y.useState)(``),c=(0,Y.useRef)(null),l=Le(e,o);return(0,X.jsxs)(k,{open:i,onOpenChange:e=>{a(e),e||s(``)},children:[(0,X.jsx)(O,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,"data-slot":`gh-workflow-trigger`,"aria-label":`Choose a workflow`,className:r(Se,t&&`border-foreground/60 font-mono text-[11px] font-semibold text-foreground`),children:[(0,X.jsx)(ae,{size:16,"aria-hidden":`true`,className:`size-3 shrink-0 text-accent-icon`}),(0,X.jsx)(`span`,{className:`min-w-0 max-w-44 truncate`,children:t??`workflow`}),(0,X.jsx)(z,{size:16,"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,X.jsx)(D,{align:`start`,sideOffset:8,className:`w-[320px] max-w-[calc(100vw-2rem)] p-0`,children:(0,X.jsxs)(ke,{shouldFilter:!1,children:[(0,X.jsx)(ye,{placeholder:`search workflows…`,value:o,onValueChange:s,onInput:()=>c.current?.scrollTo(0,0)}),(0,X.jsxs)(ve,{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,X.jsx)(Oe,{children:`Nothing matches.`}):null,(0,X.jsx)(G,{children:l.map(e=>{let r=t===e.name;return(0,X.jsxs)(K,{value:`workflow ${e.name}`,keywords:Be(e.name,e.description),"data-slot":`gh-workflow-option`,"data-workflow":e.name,onSelect:()=>{n(r?null:e.name),a(!1)},children:[(0,X.jsx)(`span`,{className:`shrink-0 font-mono text-xs`,children:e.name}),e.description?(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,r?(0,X.jsx)(P,{size:16,"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-link-foreground`}):null]},e.name)})})]})]})})]})}function bn({resolved:e,disabled:t,onPick:n}){let r=e.accounts.filter(t=>t.provider===e.runner),i=[...r.some(e=>e.id==="default")?[]:[{value:c,label:`Default`}],...r.map(e=>({value:e.id,label:e.label,desc:e.configDir}))],a=e.account??e.repoAccount?.[e.runner]??`default`;return(0,X.jsx)(q,{icon:(0,X.jsx)(ee,{"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 xn({skills:e,skillUsage:t,selected:n,onToggle:i}){let[a,o]=(0,Y.useState)(!1),[s,c]=(0,Y.useState)(``),[l,u]=(0,Y.useState)(null),d=(0,Y.useRef)(null),{mostUsed:f,project:p,global:m,ranked:h}=Ue(e,s,t),g=(e,t)=>{let a=n.some(t=>J(t)===J(e));return(0,X.jsxs)(K,{value:J(e),keywords:Be(e.name,e.description),"data-slot":`gh-skill-option`,"data-skill":e.id,"data-selected":a?`true`:void 0,onSelect:()=>i(Ve(e)),children:[(0,X.jsx)(`span`,{className:r(`shrink-0 font-mono text-xs`,t&&`font-semibold`),children:e.name}),e.path?(0,X.jsx)(`span`,{className:`min-w-0 truncate text-xs`,children:e.path}):null,e.description?(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,(0,X.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,X.jsx)(se,{"aria-hidden":`true`,className:`size-3.5`})}),a?(0,X.jsx)(P,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0 text-link-foreground`}):null]},J(e))};return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Ke,{skill:l,onClose:()=>u(null)}),(0,X.jsxs)(k,{open:a,onOpenChange:e=>{o(e),e||c(``)},children:[(0,X.jsx)(O,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,"data-slot":`gh-skills-trigger`,"aria-label":`Choose skills`,className:r(Se,n.length>0&&`border-foreground/60 font-semibold text-foreground`),children:[(0,X.jsx)(re,{size:16,"aria-hidden":`true`,className:`size-3 shrink-0 text-accent-icon`}),`skills`,n.length>0?` · ${n.length}`:``,(0,X.jsx)(z,{size:16,"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,X.jsx)(D,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,X.jsxs)(ke,{shouldFilter:!1,children:[(0,X.jsx)(ye,{placeholder:`search skills…`,value:s,onValueChange:c,onInput:()=>d.current?.scrollTo(0,0)}),(0,X.jsxs)(ve,{ref:d,"data-slot":`gh-skill-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[s.trim()&&!e.some(e=>e.id===s.trim())?(0,X.jsx)(G,{children:(0,X.jsxs)(K,{value:`typed-skill`,onSelect:()=>i({id:s.trim()}),children:[`Use skill id “`,s.trim(),`” (unchecked)`]})}):null,(h?h.length===0:f.length===0&&p.length===0&&m.length===0)?(0,X.jsx)(Oe,{children:`Nothing matches.`}):null,h?h.length>0?(0,X.jsx)(G,{children:h.map(e=>g(e,Re(e)))}):null:(0,X.jsxs)(X.Fragment,{children:[f.length>0?(0,X.jsx)(G,{heading:`Most used`,children:f.map(e=>g(e,Re(e)))}):null,p.length>0?(0,X.jsx)(G,{heading:`Project skills`,children:p.map(e=>g(e,!0))}):null,m.length>0?(0,X.jsx)(G,{heading:`Global`,children:m.map(e=>g(e,!1))}):null]})]})]})})]})]})}var Sn=new WeakMap;function Cn(){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 wn(){let e=u(),{projectId:t}=f(),n=Sn.get(e);n||Sn.set(e,n=new Map);let r=n.get(t);r||n.set(t,r=Cn());let{snapshot:i,subscribe:a,update:o}=r,s=(0,Y.useSyncExternalStore)(a,i,i),c=g(),l=an(s.engine),d=y(l.runner,l.account),p=v(),m=c.data?.workflows;(0,Y.useEffect)(()=>{m&&s.workflow!==null&&!m.some(e=>e.name===s.workflow)&&o({workflow:null})},[o,m,s.workflow]);let h=(0,Y.useMemo)(()=>ze(d.data??[],p.data?.skillUsage),[d.data,p.data?.skillUsage]);return{...s,workflows:c,skillList:h,skillsUnchecked:d.unchecked,setWorkflow:e=>o({workflow:e}),setSelectedSkills:e=>o({selectedSkills:e}),setEngine:e=>o({engine:e}),onQueued:(e,t)=>o({queued:new Map(i().queued).set(e,t)})}}export{qt as a,jt as c,$ as d,vt as f,Yt as i,gt as l,_n as n,Dt as o,Zt as r,yt as s,wn as t,_t as u};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{l as r,t as i,u as a}from"./button-C1fD-ZFr.js";import{Er as o,Jt as s,Ln as c,Pt as l,ei as u,nt as d,r as f,tt as p,w as m}from"./project-scope-context-CR3cozni.js";import{A as h,At as g,E as _,Et as v,Ft as y,Kt as b,Q as x,Y as S,Yt as C,p as w,t as T}from"./queries-BCXjp1_j.js";import{t as E}from"./useQuery-Ct6O0RmO.js";import{a as D,o as O,r as k,tt as A}from"./use-desktop-CEB_iBfH.js";import{n as j}from"./toaster-Cxgzn9ip.js";import{s as M}from"./runners-BZb4ezwE.js";import{Y as N,c as P,ct as ee,ft as F,g as I,it as L,k as R,l as z,m as B,ot as te,r as ne,tt as re,u as ie,ut as ae,y as oe}from"./design-icons-B6-0w7Aw.js";import{t as se}from"./eye-B8okNWXU.js";import{a as ce,i as V}from"./format-BNCkW110.js";import{t as le}from"./message-square-B-MD-8rD.js";import{t as ue}from"./play-CmVAj_fu.js";import{a as de,i as fe,o as pe,r as me,s as he,t as ge}from"./dialog-DSwzMeY3.js";import{d as H,t as _e,y as U}from"./prompt-template-menu-ntY16IJm.js";import{t as W}from"./project-router-BLLH9tz9.js";import{F as ve,M as G,N as ye,P as K,S as be,_ as xe,a as Se,b as Ce,c as we,d as Te,f as Ee,g as De,j as Oe,k as ke,n as Ae,r as je,s as Me,t as q,u as Ne,v as Pe,w as Fe,x as Ie}from"./picker-pill-DW8uRjlV.js";import{d as Le,f as J,i as Re,o as ze,p as Be,s as Ve,t as He,u as Ue}from"./skills-pM_PouEs.js";import{B as We,F as Ge,L as Ke,P as qe,U as Je,_n as Ye,z as Xe}from"./index-Bcs60T3F.js";import{t as Ze}from"./markdown-C78nwKGh.js";import{t as Qe}from"./diff-BHFOGiZQ.js";import{t as $e}from"./tab-link-DkArCoa9.js";var Y=e(t(),1),X=n(),et={squash:`Squash and merge`,merge:`Create a merge commit`,rebase:`Rebase and merge`};function Z({state:e}){let t=`size-4 shrink-0`;return e===`passing`?(0,X.jsx)(P,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-passing`,className:r(t,`text-success`)}):e===`failing`?(0,X.jsx)(I,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-failing`,className:r(t,`text-danger`)}):e===`pending`?(0,X.jsx)(ce,{"aria-hidden":`true`,"data-slot":`gh-merge-status-pending`,className:r(t,`animate-spin text-warning`)}):(0,X.jsx)(B,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-unknown`,className:r(t,`text-soft-foreground`)})}function tt(e){return e?.available?e.mergeState:null}function nt(e,t){return e&&t?.methods.includes(e)?e:t?.defaultMethod??t?.methods[0]??null}function rt(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 it(e){return e===`approved`||e===`not-required`?`passing`:e===`unknown`?`unknown`:`failing`}function at(e){return e===`mergeable`?`passing`:e===`conflicting`?`failing`:`unknown`}function ot(e){return e===`conflicting`?`present`:e===`mergeable`?`none`:`unknown`}function st(e){return e===!0?` · required`:e===null?` · requiredness unknown`:``}function ct(e){return e?.available===!1?e.reason:`GitHub could not load merge requirements.`}function lt(e,t,n){return!!(e&&(t.canMerge||t.canOverride&&n))}function Q(e){return e?et[e]:`Merge`}function ut(e){return e===`conflicting`?`true`:void 0}function dt({check:e}){return(0,X.jsxs)(`li`,{className:`flex items-center justify-between gap-3`,children:[(0,X.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,X.jsx)(Z,{state:e.state}),(0,X.jsxs)(`span`,{children:[e.name,` · `,e.state,st(e.required)]})]}),e.url&&a(e.url)?(0,X.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`text-muted-foreground underline`,children:`details`}):null]})}function ft({reason:e}){return(0,X.jsxs)(`section`,{"data-slot":`gh-merge-unavailable`,className:`mt-6 rounded-lg border border-border bg-card p-4 text-sm`,children:[(0,X.jsx)(`p`,{className:`font-medium`,children:`Merge status unavailable`}),(0,X.jsx)(`p`,{className:`mt-1 text-xs text-soft-foreground`,children:e})]})}function pt({state:e,selectedMethod:t,overrideRules:n,mergeEnabled:a,refreshPending:o,onRefresh:s,onRunAgent:c,onConfirm:l,onMethodChange:u,onOverrideChange:d}){let f=rt(e),p=it(e.reviewDecision),m=at(e.mergeable);return(0,X.jsxs)(`div`,{className:`flex items-start gap-3`,children:[e.canMerge?(0,X.jsx)(P,{size:16,"aria-hidden":`true`,className:`mt-0.5 size-5 shrink-0 text-success`}):(0,X.jsx)(te,{size:16,"aria-hidden":`true`,className:`mt-0.5 size-5 shrink-0 text-warning`}),(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,X.jsx)(`h3`,{className:`font-semibold`,children:f}),(0,X.jsxs)(i,{type:`button`,variant:`ghost`,size:`sm`,disabled:o,onClick:s,children:[(0,X.jsx)(N,{size:16,"aria-hidden":`true`,className:r(`size-3.5`,o&&`animate-spin`)}),`Refresh`]})]}),(0,X.jsxs)(`p`,{className:`mt-1 font-mono text-[11px] text-soft-foreground`,children:[e.headRef,` (`,e.headSha.slice(0,7),`) → `,e.baseRef]}),(0,X.jsxs)(`ul`,{className:`mt-3 space-y-2 text-xs`,children:[(0,X.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(Z,{state:p}),(0,X.jsxs)(`span`,{children:[`Reviews: `,e.reviewDecision.replaceAll(`-`,` `)]})]}),(0,X.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(Z,{state:m}),(0,X.jsxs)(`span`,{children:[`Conflicts: `,ot(e.mergeable)]})]}),e.checks.length===0?(0,X.jsx)(`li`,{children:`No checks configured`}):e.checks.map(e=>(0,X.jsx)(dt,{check:e},e.name)),e.blockers.map(e=>(0,X.jsx)(`li`,{className:`text-soft-foreground`,children:e.message},e.code))]}),e.mergeable===`conflicting`&&c?(0,X.jsx)(i,{className:`mt-4`,onClick:c,children:`Run agent on this PR`}):null,e.canOverride?(0,X.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,X.jsx)(`input`,{type:`checkbox`,checked:n,onChange:e=>d(e.target.checked),className:`mt-0.5 size-4 accent-accent-strong`}),(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`span`,{className:`block font-medium`,children:`Merge without waiting for requirements`}),(0,X.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,X.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,X.jsxs)(`div`,{className:`mt-4 flex flex-col flex-wrap gap-2 sm:flex-row`,children:[(0,X.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,X.jsx)(`option`,{value:e,children:et[e]},e))}),(0,X.jsx)(i,{disabled:!a,onClick:l,children:Q(t)})]}):null]})]})}function mt({number:e,state:t,selectedMethod:n,confirming:r,overrideRules:a,mergePending:o,mergeError:s,onOpenChange:c,onMerge:l}){return(0,X.jsx)(ge,{open:r,onOpenChange:c,children:(0,X.jsxs)(me,{"data-slot":`gh-merge-confirm`,showCloseButton:!1,children:[(0,X.jsxs)(pe,{children:[(0,X.jsxs)(he,{children:[Q(n),` pull request #`,e,`?`]}),(0,X.jsx)(fe,{asChild:!0,children:(0,X.jsxs)(`div`,{children:[(0,X.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,X.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,X.jsx)(`p`,{className:`text-sm text-danger`,children:s.message}):null,(0,X.jsxs)(de,{children:[(0,X.jsx)(i,{variant:`outline`,disabled:o,onClick:()=>c(!1),children:`Cancel`}),(0,X.jsx)(i,{disabled:o,onClick:l,children:o?`Merging…`:Q(n)})]})]})})}function ht({number:e,onRunAgent:t}){let n=u(),r=x(),i=E({queryKey:T.githubMergeState(e),queryFn:({signal:t})=>d(e,{},{signal:t}),retry:!1}),a=tt(i.data),[o,s]=(0,Y.useState)(null),[c,f]=(0,Y.useState)(!1),[p,m]=(0,Y.useState)(!1),h=C({mutationFn:t=>d(e,{refresh:!0}),onSuccess:(e,t)=>n.setQueryData(t,e),onError:e=>j(e instanceof Error?e.message:String(e),{tone:`danger`})}),g=nt(o,a),_=()=>({mergeState:T.githubMergeState(e),list:T.githubPages(50),comments:T.githubComments(`pr`,e),item:T.githubItem(`pr`,e),refStatus:r===void 0?void 0:T.githubRefStatusOf(r)}),v=C({mutationFn:t=>{if(!a||!g)throw Error(`No merge method is available.`);return l(e,{method:g,expectedHeadSha:a.headSha,...p&&a.canOverride?{overrideRules:!0}:{}})},onSuccess:(t,r)=>{f(!1),j(`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)=>{j(e instanceof Error?e.message:String(e),{tone:`danger`}),n.invalidateQueries({queryKey:t.mergeState})}});return i.isPending?(0,X.jsx)(U,{"data-slot":`gh-merge-loading`,className:`mt-6 h-32 w-full`}):a?(0,X.jsxs)(`section`,{"data-slot":`gh-merge-box`,"data-eligibility":a.eligibility,"data-conflicting":ut(a.mergeable),"aria-live":`polite`,className:`mt-6 rounded-lg border border-border bg-card p-4`,children:[(0,X.jsx)(pt,{state:a,selectedMethod:g,overrideRules:p,mergeEnabled:lt(g,a,p),refreshPending:h.isPending,onRefresh:()=>h.mutate(T.githubMergeState(e)),onRunAgent:t,onConfirm:()=>f(!0),onMethodChange:s,onOverrideChange:m}),(0,X.jsx)(mt,{number:e,state:a,selectedMethod:g,confirming:c,overrideRules:p,mergePending:v.isPending,mergeError:v.error,onOpenChange:f,onMerge:()=>v.mutate(_())})]}):(0,X.jsx)(ft,{reason:ct(i.data)})}function gt(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 _t(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 vt(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 $(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 yt({label:e,color:t,plain:n=!1}){return(0,X.jsx)(`span`,{"data-slot":`gh-label`,"data-label":e,style:n?void 0:$(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 bt(e){return e===`pr`?`pull request`:`issue`}function xt(e,t,n){return e===`pr`&&!!(t||n)}function St({backLink:e}){return e?(0,X.jsxs)(W,{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,X.jsx)(ne,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`Back to the list`]}):null}function Ct({item:e,kindWord:t,commentCount:n,hasDiffStat:r,additions:i,deletions:o}){return(0,X.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,X.jsxs)(`span`,{children:[`#`,e.number]}),`·`,(0,X.jsx)(`span`,{children:t}),`·`,(0,X.jsxs)(`span`,{children:[`opened by `,e.author]}),`·`,(0,X.jsxs)(`span`,{children:[V(e.createdAt),` ago`]}),n?(0,X.jsxs)(X.Fragment,{children:[`·`,(0,X.jsx)(qt,{count:n})]}):null,r?(0,X.jsxs)(X.Fragment,{children:[`·`,(0,X.jsxs)(`span`,{"data-slot":`gh-diffstat`,children:[(0,X.jsxs)(`span`,{className:`text-success`,children:[`+`,i??0]}),` `,(0,X.jsxs)(`span`,{className:`text-danger`,children:[`−`,o??0]})]})]}):null,`·`,a(e.url)?(0,X.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,X.jsx)(A,{"aria-hidden":`true`,className:`size-2.5`})]}):(0,X.jsx)(`span`,{"data-slot":`gh-open-link`,className:`text-muted-foreground`,children:`open on GitHub`})]})}function wt({item:e,subNav:t,changes:n}){return e.kind===`pr`?t?(0,X.jsxs)(`nav`,{"aria-label":`Pull request detail`,className:`mt-4 flex border-b border-border`,children:[(0,X.jsx)($e,{to:H(`prs`,t.filter,e.number),active:!n,children:`Conversation`}),(0,X.jsx)($e,{to:H(`prs`,t.filter,e.number,`/changes`),active:n,children:`Changes`})]}):(0,X.jsx)(W,{to:H(`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 Tt({item:e,colors:t,checks:n}){return e.labels.length>0||n?(0,X.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-1.5`,children:[e.labels.map(e=>(0,X.jsx)(yt,{label:e,color:t[e]},e)),n?(0,X.jsx)(Jt,{checks:n,url:e.url}):null]}):null}function Et({item:e,colors:t,body:n}){return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{"data-slot":`gh-body`,className:`mt-5 text-sm`,children:n?(0,X.jsx)(Ze,{children:n}):(0,X.jsx)(`p`,{className:`text-soft-foreground`,children:`(no description)`})}),(0,X.jsx)(kt,{item:e,colors:t})]})}function Dt({item:e,colors:t,checks:n,comments:r,backLink:i,subNav:a,onRunAgent:o,afterHeading:s,children:c}){let l=a?.changes??!1,u=bt(e.kind),d=_(e.kind,e.number,!l).data?.detail,f=d?.body??e.body,p=d?.additions??e.additions,m=d?.deletions??e.deletions,h=xt(e.kind,p,m),g=r??e.comments;return(0,X.jsxs)(`article`,{"data-slot":`gh-detail-inner`,className:`min-w-0 px-4 py-4 md:px-7 md:py-5`,children:[(0,X.jsx)(St,{backLink:i}),(0,X.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,X.jsxs)(`h2`,{className:`mb-4 text-[22px] leading-snug font-normal`,children:[`#`,e.number,` `,e.title]}):null,(0,X.jsx)(Ct,{item:e,kindWord:u,commentCount:g,hasDiffStat:h,additions:p,deletions:m}),e.kind===`pr`?null:(0,X.jsx)(`h2`,{className:`mt-2 text-[22px] leading-snug font-normal`,children:e.title}),s,(0,X.jsx)(wt,{item:e,subNav:a,changes:l}),(0,X.jsx)(Tt,{item:e,colors:t,checks:n}),l&&e.kind===`pr`?(0,X.jsx)(Ot,{item:e}):(0,X.jsx)(Et,{item:e,colors:t,body:f})]}),e.kind===`pr`?(0,X.jsx)(ht,{number:e.number,onRunAgent:o}):null,c]})}function Ot({item:e}){let t=u(),n=h(e.number),[o,s]=(0,Y.useState)(``),[c,l]=(0,Y.useState)(null),d=n.data,f=d?.available?d.files.filter(e=>e.path.toLowerCase().includes(o.toLowerCase())):[],m=f.findIndex(e=>e.path===c);(0,Y.useEffect)(()=>{f.length>0&&!f.some(e=>e.path===c)&&l(f[0].path)},[d?.available?d.headSha:``,o]);let g=async()=>{let n=d?.available?d.headSha:null,r=T.githubPrChanges(e.number),i=await p(e.number,{refresh:!0});t.setQueryData(r,i),i.available&&n&&n!==i.headSha&&(l(i.files[0]?.path??null),j(`The reviewed revision changed.`))};if(n.isPending)return(0,X.jsx)(`p`,{"aria-live":`polite`,className:`mt-6 text-sm text-muted-foreground`,children:`Loading changed files…`});if(n.isError||!d)return(0,X.jsx)(`p`,{className:`mt-6 text-sm text-danger`,children:`Changed files could not be loaded.`});if(!d.available)return(0,X.jsx)(`p`,{className:`mt-6 text-sm text-muted-foreground`,children:d.reason});let _=f.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=a(e.url)?`${e.url}/files`:null,y=f.find(e=>e.path===c);return(0,X.jsxs)(`section`,{"data-slot":`gh-pr-changes`,className:`mt-5 min-w-0`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs`,children:[(0,X.jsxs)(`strong`,{children:[d.files.length,` changed files`]}),(0,X.jsxs)(`span`,{className:`text-success`,children:[`+`,d.additions]}),(0,X.jsxs)(`span`,{className:`text-danger`,children:[`−`,d.deletions]}),(0,X.jsxs)(`span`,{className:`font-mono text-muted-foreground`,title:d.headSha,children:[`head `,d.headSha.slice(0,8)]}),(0,X.jsx)(i,{type:`button`,variant:`outline`,size:`sm`,className:`ml-auto min-h-11`,onClick:()=>void g(),children:`Refresh`})]}),d.truncated?(0,X.jsxs)(`p`,{role:`status`,className:`mt-3 rounded-md border border-warning/40 bg-warning/10 p-3 text-xs`,children:[d.reason??`This response is incomplete.`,` `,v?(0,X.jsx)(`a`,{href:v,target:`_blank`,rel:`noopener noreferrer`,className:`underline`,children:`Open all files on GitHub`}):null]}):null,(0,X.jsxs)(`div`,{className:`mt-4 grid min-w-0 gap-4 lg:grid-cols-[240px_minmax(0,1fr)]`,children:[(0,X.jsxs)(`aside`,{className:`min-w-0`,children:[(0,X.jsx)(`input`,{"aria-label":`Filter changed files`,value:o,onChange:e=>s(e.target.value),placeholder:`Filter files…`,className:`min-h-11 w-full rounded-md border border-input bg-background px-3 text-sm`}),(0,X.jsx)(`select`,{"aria-label":`Select changed file`,value:c??``,onChange:e=>l(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:f.map(e=>(0,X.jsx)(`option`,{children:e.path},e.path))}),(0,X.jsx)(`ul`,{className:`mt-2 hidden max-h-[60vh] overflow-auto lg:block`,children:f.map(e=>(0,X.jsx)(`li`,{children:(0,X.jsxs)(`button`,{type:`button`,onClick:()=>l(e.path),className:r(`min-h-11 w-full truncate rounded px-2 text-left text-xs`,c===e.path&&`bg-muted font-medium`),title:e.path,children:[e.status,` · `,e.path,` `,(0,X.jsxs)(`span`,{className:`text-success`,children:[`+`,e.additions]}),` `,(0,X.jsxs)(`span`,{className:`text-danger`,children:[`−`,e.deletions]})]})},e.path))})]}),(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsxs)(`div`,{className:`mb-2 flex justify-end gap-1`,children:[(0,X.jsx)(i,{"aria-label":`Previous file`,variant:`outline`,size:`icon`,className:`min-h-11 min-w-11`,disabled:m<=0,onClick:()=>l(f[m-1]?.path??null),children:(0,X.jsx)(Ye,{})}),(0,X.jsx)(i,{"aria-label":`Next file`,variant:`outline`,size:`icon`,className:`min-h-11 min-w-11`,disabled:m<0||m>=f.length-1,onClick:()=>l(f[m+1]?.path??null),children:(0,X.jsx)(ie,{size:16})})]}),f.length===0?(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No changed files match this filter.`}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Qe,{files:_.filter(e=>e.path===c),wrap:!0,className:`min-w-0`}),y&&!y.patch?(0,X.jsxs)(`p`,{className:`rounded-b border border-border p-3 text-xs text-muted-foreground`,children:[`Patch unavailable: `,y.patchUnavailableReason??`not-provided`,`.`]}):null]})]})]})]})}function kt({item:e,colors:t}){let n=_(e.kind,e.number),r=n.data,i=(0,Y.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(At(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,X.jsxs)(`section`,{"data-slot":`gh-thread-loading`,className:`mt-6 border-t border-border pt-5`,children:[(0,X.jsx)(U,{className:`mb-3 h-3 w-24`}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,X.jsx)(U,{className:`h-14 w-full`}),(0,X.jsx)(U,{className:`h-14 w-full`})]})]}):!r||!r.available?(0,X.jsxs)(`section`,{"data-slot":`gh-thread-error`,className:`mt-6 border-t border-border pt-5 text-xs text-soft-foreground`,children:[(0,X.jsxs)(`span`,{children:[`Couldn’t load comments — `,r?.reason??(n.error instanceof Error?n.error.message:`could not load comments`),`. `]}),(0,X.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,X.jsx)(A,{"aria-hidden":`true`,className:`size-2.5`})]})]}):i.length===0?null:(0,X.jsxs)(`section`,{"data-slot":`gh-thread`,className:`mt-6 border-t border-border pt-5`,children:[(0,X.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,X.jsx)(`ul`,{className:`flex flex-col gap-5`,children:jt(i).map(e=>e.group===`commits`?(0,X.jsx)(Mt,{commits:e.commits,colors:t},e.commits[0].id):e.entry.row===`comment`?(0,X.jsx)(Ut,{comment:e.entry.comment},`${e.entry.comment.kind}-${e.entry.comment.id}`):(0,X.jsx)(Pt,{event:e.entry.event,colors:t},e.entry.event.id))}),r.truncated?(0,X.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,X.jsx)(A,{"aria-hidden":`true`,className:`size-2.5`})]}):null]})}var At=e=>e.row===`comment`?e.comment.createdAt:e.event.createdAt;function jt(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 Mt({commits:e,colors:t}){let[n,r]=(0,Y.useState)(!1),i=e[0]?.actor??`?`;return n?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`true`,className:`min-w-0`,children:(0,X.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,X.jsx)(`span`,{"aria-hidden":`true`,children:Nt.committed}),(0,X.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,X.jsxs)(`span`,{children:[`added `,e.length,` commits`]})]})}),e.map(e=>(0,X.jsx)(Pt,{event:e,colors:t},e.id))]}):(0,X.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`false`,className:`min-w-0`,children:(0,X.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,X.jsx)(`span`,{"aria-hidden":`true`,children:Nt.committed}),(0,X.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,X.jsxs)(`span`,{children:[`added `,e.length,` commits`]}),(0,X.jsx)(`span`,{className:`shrink-0`,children:V(e[e.length-1].createdAt)})]})})}var Nt={committed:`⚙`,labeled:`◆`,unlabeled:`◇`,assigned:`◍`,unassigned:`◌`,merged:`⑃`,closed:`⊘`,reopened:`⊙`,head_ref_force_pushed:`↻`,"cross-referenced":`↗`,renamed:`✎`};function Pt({event:e,colors:t}){return(0,X.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,X.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0`,children:Nt[e.kind]}),(0,X.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.actor}),(0,X.jsx)(Bt,{event:e,colors:t}),(0,X.jsx)(`span`,{className:`shrink-0`,children:V(e.createdAt)}),e.url?(0,X.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,X.jsx)(A,{"aria-hidden":`true`,className:`size-2.5`})}):null]})}function Ft({event:e}){return(0,X.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,X.jsx)(`span`,{className:`shrink-0`,children:`committed`}),e.sha?(0,X.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:e.sha.slice(0,7)}):null,e.message?(0,X.jsx)(`span`,{className:`truncate font-sans text-foreground`,children:e.message}):null,(0,X.jsx)(Vt,{checks:e.checks})]})}function It({event:e,colors:t}){return(0,X.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,X.jsx)(`span`,{className:`shrink-0`,children:e.kind===`labeled`?`added the`:`removed the`}),e.label?(0,X.jsx)(`span`,{"data-slot":`gh-event-label`,style:$(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,X.jsx)(`span`,{className:`shrink-0`,children:`label`})]})}function Lt({event:e}){return(0,X.jsxs)(`span`,{className:`truncate`,children:[e.kind===`assigned`?`assigned`:`unassigned`,` `,e.subject??`someone`]})}function Rt({event:e}){return(0,X.jsxs)(`span`,{className:`truncate`,children:[`referenced this in `,e.refNumber?`#${e.refNumber}`:`another thread`,e.refTitle?` ${e.refTitle}`:``]})}var zt={committed:e=>(0,X.jsx)(Ft,{event:e}),labeled:(e,t)=>(0,X.jsx)(It,{event:e,colors:t}),unlabeled:(e,t)=>(0,X.jsx)(It,{event:e,colors:t}),assigned:e=>(0,X.jsx)(Lt,{event:e}),unassigned:e=>(0,X.jsx)(Lt,{event:e}),merged:()=>(0,X.jsx)(`span`,{children:`merged this`}),closed:()=>(0,X.jsx)(`span`,{children:`closed this`}),reopened:()=>(0,X.jsx)(`span`,{children:`reopened this`}),head_ref_force_pushed:()=>(0,X.jsx)(`span`,{children:`force-pushed`}),renamed:e=>(0,X.jsxs)(`span`,{className:`truncate`,children:[`renamed this to `,e.subject??`—`]}),"cross-referenced":e=>(0,X.jsx)(Rt,{event:e})};function Bt({event:e,colors:t}){return zt[e.kind]?.(e,t)??null}function Vt({checks:e}){return e?(0,X.jsx)(`span`,{"data-slot":`gh-commit-checks`,"data-checks":e,"aria-label":`checks ${e}`,className:r(`shrink-0`,Kt[e]),children:Gt[e]}):null}var Ht={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 Ut({comment:e}){let t=e.reviewState?Ht[e.reviewState]:null;return(0,X.jsxs)(`li`,{"data-slot":`gh-thread-entry`,"data-kind":e.kind,className:`min-w-0`,children:[(0,X.jsxs)(`div`,{className:`mb-1.5 flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground`,children:[(0,X.jsx)(Wt,{url:e.avatarUrl,login:e.author}),(0,X.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.author}),(0,X.jsx)(`span`,{children:V(e.createdAt)}),t?(0,X.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,X.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,X.jsx)(A,{"aria-hidden":`true`,className:`size-2.5`})})]}),(0,X.jsx)(`div`,{"data-slot":`gh-thread-body`,className:`text-sm`,children:e.body?(0,X.jsx)(Ze,{children:e.body}):(0,X.jsx)(`p`,{className:`text-soft-foreground`,children:`(no body)`})})]})}function Wt({url:e,login:t}){let[n,r]=(0,Y.useState)(!1);return e&&!n?(0,X.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,X.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 Gt={passing:`✓`,failing:`✗`,pending:`○`},Kt={passing:`text-success`,failing:`text-danger`,pending:`text-muted-foreground`};function qt({count:e}){return e?(0,X.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,X.jsx)(le,{"aria-hidden":`true`,className:`size-3`}),e]}):null}function Jt({checks:e,url:t}){let n=r(`text-[11px] font-medium`,Kt[e],t&&`hover:underline`),i=`${Gt[e]} checks ${e}`;return t?(0,X.jsx)(`a`,{href:`${t}/checks`,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-checks`,"data-checks":e,className:n,children:i}):(0,X.jsx)(`span`,{"data-slot":`gh-checks`,"data-checks":e,className:n,children:i})}function Yt({checks:e}){return(0,X.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`,Kt[e]),children:Gt[e]})}function Xt(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=Xt(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=Xt(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.map(e=>e.id),r)}:n.length?{...i,steps:nn(n.map(e=>e.id)).map((e,t)=>({...e,...n[t]?.path===void 0?{}:{skillPath:n[t].path}})),task:tn(e,[],r)}:{...i,workflow:`quick-task`,task:tn(e,[],r)}}function an(e){let t=S(),n=w(),r=M(),i=o(t.data,r.data),a=n.data?.defaultRunner,s=be(e.runner,i,a??i[0]??`claude`),c=n.data?.modelsLocked===!0,{accounts:l,repoAccount:u}=Ge(),d=l.some(t=>t.provider===s&&t.id===e.account)?e.account:null,f=b(s,!0,d??u?.[s]),p=Ie(c?null:e.model,s,r.data,n.data?.defaultModels,f.data),m=xe(p,f.data);return{runner:s,runnerExplicit:e.runner!==null,model:p,effort:c?``:Ce(e.effort,m),effortOptions:m,runners:i,defaultRunner:a,canRun:t.isSuccess&&i.length>0,modelsLocked:c,providerPending:t.isPending,providerError:t.isError,accounts:l,account:d,repoAccount:u}}function on(e){return{runner:Fe(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,Y.useRef)(null),o=(0,Y.useRef)(null),[s,c]=(0,Y.useState)(()=>typeof window<`u`&&window.innerWidth<=767);(0,Y.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,Y.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,_=w(),v=M(),y=b(u,!0,l.account??l.repoAccount?.[u]),x=Pe(u,v.data,y.data,[e.model,_.data?.defaultModels?.[u]]),S=n||!h,C=r?l.accounts:[],T=m.length>1||m.some(e=>qe(C,e))?(0,X.jsx)(je,{icon:(0,X.jsx)(L,{"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:S,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,E=(0,X.jsx)(q,{icon:(0,X.jsx)(oe,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,slot:`model-pill`,ariaLabel:`Model`,label:d===``?`Default`:x.find(e=>e.id===d).label,value:d,disabled:S,readOnly:g===!0,disabledHint:g?`Model selection is locked to native coding-agent settings.`:void 0,onPick:n=>{let r=xe(n,y.data);t({...e,model:n,effort:e.effort===null?null:Ce(e.effort,r)})},options:x.map(e=>({value:e.id,label:e.label,desc:e.desc})),status:De(u,v.data,y)},`model`),D=(0,X.jsx)(q,{icon:(0,X.jsx)(R,{"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:S,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,X.jsx)(`div`,{ref:a,"data-slot":`engine-row-box`,children:(0,X.jsx)(`div`,{"data-slot":`engine-row`,className:`engine-row`,role:`group`,"aria-label":`Agent settings`,children:(0,X.jsx)(Ae,{children:s?[T,D,E]:[T,E,D]})})}):(0,X.jsxs)(Ae,{children:[T,E,D]})}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.flatMap(e=>typeof e==`string`?[{id:e}]:!e||typeof e!=`object`||typeof e.id!=`string`?[]:[{id:e.id,...typeof e.path==`string`?{path:e.path}:{}}]):[]}}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 mn=`cez-followup-prompt:`;function hn(e){try{return localStorage.getItem(mn+e)??``}catch{return``}}function gn(e,t){try{t===``?localStorage.removeItem(mn+e):localStorage.setItem(mn+e,t)}catch{}}function _n({item:e,workflows:t,skills:n,workflow:r,onWorkflowChange:o,selectedSkills:c,onSkillsChange:l,engine:d,onEngineChange:f,queuedRunId:p,onQueued:h}){let g=u(),_=v(),b=e.kind===`pr`?`PR`:`issue`,x=an(d),S=y(x.runner,x.account),w=c.filter(e=>S.unchecked||e.path===void 0||n.some(t=>t.id===e.id&&(e.path===void 0||t.path===e.path))),E=w.length!==c.length,[D]=(0,Y.useState)(()=>Xt(e)),[O,k]=(0,Y.useState)(()=>hn(e.url)||D),A=(0,Y.useRef)(null),M=(0,Y.useRef)(null);(0,Y.useEffect)(()=>{gn(e.url,O===D?``:O)},[e.url,O,D]);let N=(0,Y.useMemo)(()=>Ne(_.data?.promptTemplates),[_.data?.promptTemplates]),ee=e=>{let t=A.current,n=Ee({prompt:O,base:D,selectionStart:t?.selectionStart??null,focused:document.activeElement===t,remembered:M.current}),r=we(O,n,e);k(r.text),M.current=r.caret,requestAnimationFrame(()=>{A.current?.focus(),A.current?.setSelectionRange(r.caret,r.caret)})},F=Me(N,w.map(e=>e.id)),I=(0,Y.useRef)(O);I.current=O;let L=(0,Y.useRef)(``);(0,Y.useEffect)(()=>{let e=Te(I.current,L.current,F,D);L.current=e.applied,e.text!==I.current&&k(e.text)},[F,D]);let R=C({mutationFn:async()=>!x.canRun||E?null:m(rn(e,r,w,O,sn(x))),onSuccess:t=>{if(t===null)return;let n=t;n&&h(e.url,n.id),j(`Added to the queue — ${b} #${e.number}`),w.length>0&&_.data!==void 0&&s({skillUsage:w.reduce((e,t)=>He(e,t.id),_.data.skillUsage)}).then(()=>g.invalidateQueries({queryKey:T.uiState})).catch(()=>{}),gn(e.url,``),k(D),L.current=``,g.invalidateQueries({queryKey:T.runs.all})},onError:e=>j(e.message,{tone:`danger`})}),z=e=>{Xe({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(),!R.isPending&&x.canRun&&R.mutate())},B=e=>l(c.some(t=>J(t)===J(e))?c.filter(t=>J(t)!==J(e)):[...c,Ve(e)]);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`section`,{"data-slot":`gh-hand`,className:`mt-7 rounded-lg border border-border bg-card p-4`,children:[(0,X.jsx)(`h3`,{className:`text-xl font-normal text-foreground`,children:`Hand this to the agent`}),(0,X.jsxs)(`label`,{className:`gh-field gh-prompt-field`,children:[(0,X.jsx)(`span`,{children:`Instructions for the agent`}),(0,X.jsx)(Je,{ref:A,"data-slot":`gh-custom-prompt`,"aria-label":`Custom prompt`,"aria-keyshortcuts":`Control+Enter Meta+Enter`,value:O,onChange:e=>k(e.target.value),onSelect:e=>{M.current=e.currentTarget.selectionStart},onKeyDown:z,placeholder:`Instructions for the agent… (#${e.number} and its link are always sent)`,className:`mt-3 min-h-20 text-[13px]`})]}),(0,X.jsx)(_e,{templates:N,onInsert:ee}),(0,X.jsxs)(`div`,{className:`gh-handoff-settings`,children:[(0,X.jsxs)(`div`,{className:`gh-field`,children:[(0,X.jsx)(`span`,{children:`Workflow`}),(0,X.jsx)(yn,{workflows:t,value:r,onChange:o})]}),(0,X.jsxs)(`div`,{className:`gh-field`,children:[(0,X.jsx)(`span`,{children:`Skills · select one or more`}),(0,X.jsx)(xn,{skills:n,skillUsage:_.data?.skillUsage,selected:c,onToggle:B})]}),c.length>0?(0,X.jsx)(`div`,{"data-slot":`gh-skill-chips`,className:`mt-2.5 flex flex-wrap gap-1.5`,children:c.map(e=>(0,X.jsx)(vn,{skill:e,skills:n,unchecked:S.unchecked,onRemove:()=>B(e)},J(e)))}):null,E?(0,X.jsx)(`p`,{role:`alert`,children:`A selected skill path is unavailable. Remove it or choose a current copy before starting.`}):null,(0,X.jsx)(cn,{layout:`row`,pick:d,onChange:f,disabled:R.isPending||!x.canRun,accounts:!0}),(0,X.jsxs)(`div`,{className:`gh-field`,children:[(0,X.jsx)(`span`,{children:`Account`}),(0,X.jsx)(bn,{resolved:x,disabled:R.isPending||!x.canRun,onPick:e=>f({...d,account:e})})]}),!x.providerPending&&!x.canRun?(0,X.jsxs)(`span`,{"data-slot":`gh-provider-gate`,className:`inline-flex flex-wrap items-center gap-1 text-xs text-muted-foreground`,children:[x.providerError?`Provider authentication could not be verified.`:`Connect an agent provider to run this item.`,(0,X.jsx)(W,{to:`/settings/agents#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}):null]}),(0,X.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,X.jsxs)(`div`,{"data-slot":`gh-handoff-actions`,className:`mt-[22px] flex flex-wrap items-center gap-2.5`,children:[a(e.url)?(0,X.jsx)(i,{asChild:!0,variant:`outline`,children:(0,X.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,children:`Open in GitHub`})}):null,(0,X.jsxs)(i,{variant:`primary`,"data-action":`gh-run`,disabled:R.isPending||!x.canRun||E,onClick:()=>R.mutate(),children:[(0,X.jsx)(ue,{"aria-hidden":`true`,className:`size-3.5`}),`Run agent on this `,b]}),(0,X.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:We()}),p?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`span`,{"data-slot":`gh-queued`,className:`flex items-center gap-1 text-xs font-medium text-success`,children:[(0,X.jsx)(P,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`queued`]}),(0,X.jsx)(W,{to:`/tasks/${p}`,"data-slot":`gh-view-run`,className:`text-xs font-semibold text-accent-text hover:underline`,children:`View task →`})]}):null]})]})}function vn({skill:e,skills:t,unchecked:n,onRemove:r}){let i=t.find(t=>t.id===e.id&&(e.path===void 0||t.path===e.path)),a=[i?.name??e.id,e.path].filter(Boolean).join(` · `),o=!n&&e.path!==void 0&&!i?` (unavailable)`:n||!i?` (unchecked)`:``;return(0,X.jsxs)(`button`,{type:`button`,"data-slot":`gh-skill-chip`,"data-skill":e.id,onClick:r,title:`Remove skill ${a}`,"aria-label":`Remove skill ${a}`,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:[a,o,(0,X.jsx)(F,{size:16,"aria-hidden":`true`,className:`size-3`})]})}function yn({workflows:e,value:t,onChange:n}){let[i,a]=(0,Y.useState)(!1),[o,s]=(0,Y.useState)(``),c=(0,Y.useRef)(null),l=Le(e,o);return(0,X.jsxs)(k,{open:i,onOpenChange:e=>{a(e),e||s(``)},children:[(0,X.jsx)(O,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,"data-slot":`gh-workflow-trigger`,"aria-label":`Choose a workflow`,className:r(Se,t&&`border-foreground/60 font-mono text-[11px] font-semibold text-foreground`),children:[(0,X.jsx)(ae,{size:16,"aria-hidden":`true`,className:`size-3 shrink-0 text-accent-icon`}),(0,X.jsx)(`span`,{className:`min-w-0 max-w-44 truncate`,children:t??`workflow`}),(0,X.jsx)(z,{size:16,"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,X.jsx)(D,{align:`start`,sideOffset:8,className:`w-[320px] max-w-[calc(100vw-2rem)] p-0`,children:(0,X.jsxs)(ke,{shouldFilter:!1,children:[(0,X.jsx)(ye,{placeholder:`search workflows…`,value:o,onValueChange:s,onInput:()=>c.current?.scrollTo(0,0)}),(0,X.jsxs)(ve,{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,X.jsx)(Oe,{children:`Nothing matches.`}):null,(0,X.jsx)(G,{children:l.map(e=>{let r=t===e.name;return(0,X.jsxs)(K,{value:`workflow ${e.name}`,keywords:Be(e.name,e.description),"data-slot":`gh-workflow-option`,"data-workflow":e.name,onSelect:()=>{n(r?null:e.name),a(!1)},children:[(0,X.jsx)(`span`,{className:`shrink-0 font-mono text-xs`,children:e.name}),e.description?(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,r?(0,X.jsx)(P,{size:16,"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-link-foreground`}):null]},e.name)})})]})]})})]})}function bn({resolved:e,disabled:t,onPick:n}){let r=e.accounts.filter(t=>t.provider===e.runner),i=[...r.some(e=>e.id==="default")?[]:[{value:c,label:`Default`}],...r.map(e=>({value:e.id,label:e.label,desc:e.configDir}))],a=e.account??e.repoAccount?.[e.runner]??`default`;return(0,X.jsx)(q,{icon:(0,X.jsx)(ee,{"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 xn({skills:e,skillUsage:t,selected:n,onToggle:i}){let[a,o]=(0,Y.useState)(!1),[s,c]=(0,Y.useState)(``),[l,u]=(0,Y.useState)(null),d=(0,Y.useRef)(null),{mostUsed:f,project:p,global:m,ranked:h}=Ue(e,s,t),g=(e,t)=>{let a=n.some(t=>J(t)===J(e));return(0,X.jsxs)(K,{value:J(e),keywords:Be(e.name,e.description),"data-slot":`gh-skill-option`,"data-skill":e.id,"data-selected":a?`true`:void 0,onSelect:()=>i(Ve(e)),children:[(0,X.jsx)(`span`,{className:r(`shrink-0 font-mono text-xs`,t&&`font-semibold`),children:e.name}),e.path?(0,X.jsx)(`span`,{className:`min-w-0 truncate text-xs`,children:e.path}):null,e.description?(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,(0,X.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,X.jsx)(se,{"aria-hidden":`true`,className:`size-3.5`})}),a?(0,X.jsx)(P,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0 text-link-foreground`}):null]},J(e))};return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Ke,{skill:l,onClose:()=>u(null)}),(0,X.jsxs)(k,{open:a,onOpenChange:e=>{o(e),e||c(``)},children:[(0,X.jsx)(O,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,"data-slot":`gh-skills-trigger`,"aria-label":`Choose skills`,className:r(Se,n.length>0&&`border-foreground/60 font-semibold text-foreground`),children:[(0,X.jsx)(re,{size:16,"aria-hidden":`true`,className:`size-3 shrink-0 text-accent-icon`}),`skills`,n.length>0?` · ${n.length}`:``,(0,X.jsx)(z,{size:16,"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,X.jsx)(D,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,X.jsxs)(ke,{shouldFilter:!1,children:[(0,X.jsx)(ye,{placeholder:`search skills…`,value:s,onValueChange:c,onInput:()=>d.current?.scrollTo(0,0)}),(0,X.jsxs)(ve,{ref:d,"data-slot":`gh-skill-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[s.trim()&&!e.some(e=>e.id===s.trim())?(0,X.jsx)(G,{children:(0,X.jsxs)(K,{value:`typed-skill`,onSelect:()=>i({id:s.trim()}),children:[`Use skill id “`,s.trim(),`” (unchecked)`]})}):null,(h?h.length===0:f.length===0&&p.length===0&&m.length===0)?(0,X.jsx)(Oe,{children:`Nothing matches.`}):null,h?h.length>0?(0,X.jsx)(G,{children:h.map(e=>g(e,Re(e)))}):null:(0,X.jsxs)(X.Fragment,{children:[f.length>0?(0,X.jsx)(G,{heading:`Most used`,children:f.map(e=>g(e,Re(e)))}):null,p.length>0?(0,X.jsx)(G,{heading:`Project skills`,children:p.map(e=>g(e,!0))}):null,m.length>0?(0,X.jsx)(G,{heading:`Global`,children:m.map(e=>g(e,!1))}):null]})]})]})})]})]})}var Sn=new WeakMap;function Cn(){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 wn(){let e=u(),{projectId:t}=f(),n=Sn.get(e);n||Sn.set(e,n=new Map);let r=n.get(t);r||n.set(t,r=Cn());let{snapshot:i,subscribe:a,update:o}=r,s=(0,Y.useSyncExternalStore)(a,i,i),c=g(),l=an(s.engine),d=y(l.runner,l.account),p=v(),m=c.data?.workflows;(0,Y.useEffect)(()=>{m&&s.workflow!==null&&!m.some(e=>e.name===s.workflow)&&o({workflow:null})},[o,m,s.workflow]);let h=(0,Y.useMemo)(()=>ze(d.data??[],p.data?.skillUsage),[d.data,p.data?.skillUsage]);return{...s,workflows:c,skillList:h,skillsUnchecked:d.unchecked,setWorkflow:e=>o({workflow:e}),setSelectedSkills:e=>o({selectedSkills:e}),setEngine:e=>o({engine:e}),onQueued:(e,t)=>o({queued:new Map(i().queued).set(e,t)})}}export{qt as a,jt as c,$ as d,vt as f,Yt as i,gt as l,_n as n,Dt as o,Zt as r,yt as s,wn as t,_t as u};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{E as r,l as i,t as a}from"./button-C1fD-ZFr.js";import{Bt as o,E as s,Ut as c,a as l,ei as u,j as d}from"./project-scope-context-CR3cozni.js";import{At as f,Et as p,Ft as ee,Yt as m,t as te}from"./queries-BCXjp1_j.js";import{n as h}from"./toaster-Cxgzn9ip.js";import{J as g,S as _,X as v,at as y,b as ne,c as re,ft as ie,i as b,l as x,lt as S,n as ae,ot as oe,st as C,tt as se,v as w,x as T}from"./design-icons-B6-0w7Aw.js";import{i as E,p as ce,r as D,t as O}from"./dropdown-menu-DRFDwG2X.js";import{i as k,o as A,r as j,s as le,t as M}from"./dialog-DSwzMeY3.js";import{_ as ue,a as de,d as fe,g as pe,h as N,i as P,l as me,m as F,o as he,p as ge,r as _e,s as ve,t as ye,v as I}from"./sortable.esm-zp_qkYGV.js";import{i as L,l as be,o as xe}from"./skills-pM_PouEs.js";import{t as Se}from"./centered-state-CiiA8Vgw.js";import{O as Ce,U as R,dt as z,ft as B,gt as V,ht as H,lt as U,mt as W,pt as G,tn as K,ut as we}from"./index-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{E as r,l as i,t as a}from"./button-C1fD-ZFr.js";import{Bt as o,E as s,Ut as c,a as l,ei as u,j as d}from"./project-scope-context-CR3cozni.js";import{At as f,Et as p,Ft as ee,Yt as m,t as te}from"./queries-BCXjp1_j.js";import{n as h}from"./toaster-Cxgzn9ip.js";import{J as g,S as _,X as v,at as y,b as ne,c as re,ft as ie,i as b,l as x,lt as S,n as ae,ot as oe,st as C,tt as se,v as w,x as T}from"./design-icons-B6-0w7Aw.js";import{i as E,p as ce,r as D,t as O}from"./dropdown-menu-DRFDwG2X.js";import{i as k,o as A,r as j,s as le,t as M}from"./dialog-DSwzMeY3.js";import{_ as ue,a as de,d as fe,g as pe,h as N,i as P,l as me,m as F,o as he,p as ge,r as _e,s as ve,t as ye,v as I}from"./sortable.esm-zp_qkYGV.js";import{i as L,l as be,o as xe}from"./skills-pM_PouEs.js";import{t as Se}from"./centered-state-CiiA8Vgw.js";import{O as Ce,U as R,dt as z,ft as B,gt as V,ht as H,lt as U,mt as W,pt as G,tn as K,ut as we}from"./index-Bcs60T3F.js";var q=e(t(),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 Te(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 Ee(e,t,n){let r=[...e];return r.splice(Math.max(0,Math.min(n,r.length)),0,t),r}function De(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 Oe(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 ke(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 Ae(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 Z(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 je(e){return e.onFail?[` onFail:`,` retry: ${Y(e.onFail.retry)}`,` max: ${e.onFail.max??2}`]:[]}function Me(e){return[` - id: ${Y(e.id)}`,...ke(e),...e.prompt?X(`prompt`,e.prompt,4):[],...Ae(e),...Z(e),...e.command?X(`command`,e.command,4):[],...je(e)]}function Ne(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(...Me(e))}else r.push(`skills: []`);return`${r.join(`
|
|
4
4
|
`)}\n`}function Pe(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)||`workflow`}function Fe(e){let t=J(e)?`skill`:`step`;return`${e.length} ${t}${e.length===1?``:`s`}`}function Ie(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 Le(e,t,n){let r=J(n);return{name:e.trim(),...t.trim()?{description:t.trim()}:{},...r?{skills:r}:{steps:[...n]}}}var Q=n();function Re({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)(x,{"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)(R,{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 ze({savedFile:e,autoOpen:t,onImportToggle:n,onExport:r,onAutoToggle:i,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)(a,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-import`,className:`col-span-2 justify-self-start`,onClick:n,children:[(0,Q.jsx)(C,{"aria-hidden":`true`,className:`size-3`}),`Import`]}),(0,Q.jsxs)(a,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-export`,className:`col-span-2 justify-self-start`,title:`Download workflow.yaml`,onClick:r,children:[(0,Q.jsx)(ne,{"aria-hidden":`true`,className:`size-3`}),`Export`]}),(0,Q.jsxs)(a,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-auto`,"aria-expanded":t,title:`Describe a chain — the agent builds it`,onClick:i,children:[(0,Q.jsx)(S,{"aria-hidden":`true`,className:`size-3`}),`Auto`]}),e?(0,Q.jsxs)(a,{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)(y,{"aria-hidden":`true`,className:`size-3`}),`Delete`]}):null]})}function Be({text:e,onTextChange:t,pending:n,onRun:r,onCancel:i}){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)(R,{"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(),r())},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)(a,{type:`button`,variant:`primary`,size:`sm`,"data-slot":`wb-auto-run`,disabled:n||e.trim()===``,onClick:r,children:[(0,Q.jsx)(S,{"aria-hidden":`true`,className:`size-3`}),n?`Building…`:`Build chain`]}),(0,Q.jsxs)(a,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-auto-cancel`,onClick:i,children:[(0,Q.jsx)(ie,{"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 Ve({open:e,onOpenChange:t,text:n,onTextChange:r,error:i,pending:o,onRun:s,onCancel:c}){return(0,Q.jsx)(M,{open:e,onOpenChange:t,children:(0,Q.jsxs)(j,{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)(le,{className:`text-xl font-normal`,children:`Import workflow YAML`}),(0,Q.jsx)(k,{className:`sr-only`,children:`Paste a portable workflow definition to import.`}),(0,Q.jsx)(R,{"data-slot":`wb-import-text`,"aria-label":`Workflow YAML to import`,rows:4,spellCheck:!1,placeholder:`name: my-flow
|
package/web/dist/index.html
CHANGED
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
}
|
|
60
60
|
})()
|
|
61
61
|
</script>
|
|
62
|
-
<script type="module" crossorigin src="/assets/index-
|
|
62
|
+
<script type="module" crossorigin src="/assets/index-Bcs60T3F.js"></script>
|
|
63
63
|
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-QTnfLwEv.js">
|
|
64
64
|
<link rel="modulepreload" crossorigin href="/assets/react-runtime-CCIEwYL0.js">
|
|
65
65
|
<link rel="modulepreload" crossorigin href="/assets/bundle-mjs-BT31bpU6.js">
|