cezarion 0.19.0-dev.8640 → 0.19.0-dev.8642
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 +3 -3
- package/web/dist/assets/{accounts-section-D7EK3_7b.js → accounts-section-RDVTJfi7.js} +1 -1
- package/web/dist/assets/{activity-motion-2BQBW4lA.js → activity-motion-B7km8QVK.js} +1 -1
- package/web/dist/assets/{activity-route-Ct06t8Y9.js → activity-route-CjE0yxn0.js} +1 -1
- package/web/dist/assets/{agent-config-section-D6Lcc7c5.js → agent-config-section-DQ1RaVK2.js} +1 -1
- package/web/dist/assets/{agent-defaults-section-BnDBbzuG.js → agent-defaults-section-Dzm7jIza.js} +1 -1
- package/web/dist/assets/{appearance-CM6ahUyy.js → appearance-DQLHHfI4.js} +1 -1
- package/web/dist/assets/{automations-route-7B_DF4O1.js → automations-route-BcdL5f0K.js} +1 -1
- package/web/dist/assets/{commit-list-O4ugJ12w.js → commit-list-CN1zX-0X.js} +1 -1
- package/web/dist/assets/{diff-controls-BpTFu29H.js → diff-controls-BRa3141W.js} +1 -1
- package/web/dist/assets/{diff-DKZvZQ2G.js → diff-hxqBOfZH.js} +2 -2
- package/web/dist/assets/{diff-view-D4yXb2w7.js → diff-view-CwlKCj5V.js} +1 -1
- package/web/dist/assets/{file-preview-CUhut4J9.js → file-preview-VvCzp02k.js} +1 -1
- package/web/dist/assets/{git-toolbar-po0QJciG.js → git-toolbar-BulcGzsv.js} +1 -1
- package/web/dist/assets/{github-TgLTixC7.js → github-By3yOcFH.js} +1 -1
- package/web/dist/assets/{global-activity-route-OHCmn0ZO.js → global-activity-route-C4-bmfh_.js} +1 -1
- package/web/dist/assets/{image-preview-Sisptm3b.js → image-preview-Pgf8bnzY.js} +1 -1
- package/web/dist/assets/{index-CvVmG4Yu.js → index-DNQcTHxV.js} +5 -5
- package/web/dist/assets/{markdown-jle_P0a2.js → markdown-9L65ixU6.js} +1 -1
- package/web/dist/assets/{notifications-section-Bhqr3yOz.js → notifications-section-QWmuj2j2.js} +1 -1
- package/web/dist/assets/{preview-pane-connected-CBt_nlmX.js → preview-pane-connected-DAM2Snwh.js} +1 -1
- package/web/dist/assets/{projects-section-DnGSWHZJ.js → projects-section-DxubjpZI.js} +1 -1
- package/web/dist/assets/{prompt-templates-section-8kBTviSw.js → prompt-templates-section-CkQneT1G.js} +1 -1
- package/web/dist/assets/{remote-settings-notice-D7G8cXSx.js → remote-settings-notice-COojb6XK.js} +1 -1
- package/web/dist/assets/{repo-git-DqBUjQMh.js → repo-git-Mgk4Qcmo.js} +1 -1
- package/web/dist/assets/{report-reader-DtSBGt0O.js → report-reader-zWwalJDN.js} +1 -1
- package/web/dist/assets/{reports-ea3-iuBm.js → reports-BCHWt3zy.js} +1 -1
- package/web/dist/assets/{resources-section-CpXFFHXl.js → resources-section-Cb2WIqNv.js} +1 -1
- package/web/dist/assets/{run-header-BWTrj0_2.js → run-header-DeprqSP7.js} +1 -1
- package/web/dist/assets/{select-aiSr0uTB.js → select-y3oRuA2s.js} +1 -1
- package/web/dist/assets/{session-context-section-BRaZbxVO.js → session-context-section-CiPNMiL7.js} +1 -1
- package/web/dist/assets/{settings-agent-picker-DMIqQhkC.js → settings-agent-picker-CJJJncuA.js} +1 -1
- package/web/dist/assets/{settings-shell-DwMbZhxp.js → settings-shell-CLToW28f.js} +1 -1
- package/web/dist/assets/{sidebar-section-ClrORHpO.js → sidebar-section-VOYJarPd.js} +1 -1
- package/web/dist/assets/{skills-B97qjJ7j.js → skills-BySF3yBA.js} +1 -1
- package/web/dist/assets/{task-changes-BEfLx9dF.js → task-changes-NUwvUglx.js} +1 -1
- package/web/dist/assets/{task-commits-6f0GpNF7.js → task-commits-CpV1Hz9L.js} +1 -1
- package/web/dist/assets/{task-files-CA2xTRaM.js → task-files-Bu-L_NRW.js} +1 -1
- package/web/dist/assets/{task-github-item-BWapcDJr.js → task-github-item-DhiTqCjk.js} +1 -1
- package/web/dist/assets/{task-thread-0rKVutjQ.js → task-thread-CKkTeQdi.js} +1 -1
- package/web/dist/assets/{thread-state-C3eDWXYs.js → thread-state-B_ZqjjRr.js} +1 -1
- package/web/dist/assets/{use-hand-to-agent-state-DrAmCxn8.js → use-hand-to-agent-state-K864D69i.js} +1 -1
- package/web/dist/assets/{workflows-CW-1K6tq.js → workflows-DlTkuM0J.js} +1 -1
- package/web/dist/assets/{workspace-tools-BzDQrP3y.js → workspace-tools-BRK7f1Hk.js} +1 -1
- package/web/dist/assets/{worktrees-section-ay1jJn_w.js → worktrees-section-BXI0-7HH.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{t}from"./utils-DSMR_WLb.js";import{$r as n,mr as r,pr as i}from"./project-scope-context-Rv6S_BXt.js";import{_ as a,g as o,h as s,k as c,p as l,v as ee}from"./live-protocol-DMhTnCmf.js";import{t as te}from"./createLucideIcon-BHp8sXmF.js";import{t as ne}from"./app-window-CSHwDX9N.js";import{t as re}from"./play-CmVAj_fu.js";import{t as ie}from"./square-terminal-B6RYYieR.js";import{t as ae}from"./button-B7MKxYjT.js";import{t as oe}from"./status-dot-BRzVlF2X.js";import{a as se,o as ce}from"./format-BU7D3IfE.js";import{$n as le,f as ue,p as de}from"./index-CvVmG4Yu.js";var fe=te(`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`}]]),pe=te(`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`}]]),u=e(),me={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 he(e){let{text:t,...n}=de(e),r={...n,status:t},i=me[e.state](e);return i?{...r,action:i}:r}var ge={"Run and open":re,Open:ne,View:le,"Start again":fe};function _e({entry:e,inPreview:n,onOpen:r}){let{server:i}=e,a=he(e),o=e.state===`unavailable`,s=r?a.action:void 0,c=ue(i.command),l=se(i.registeredAt);return(0,u.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,u.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2 text-xs text-soft-foreground`,children:[(0,u.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5 font-mono`,children:[(0,u.jsx)(pe,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),(0,u.jsx)(`span`,{className:`truncate`,children:`cezar_preview_serve`})]}),o?(0,u.jsx)(`span`,{children:`worktree removed`}):l?(0,u.jsx)(`span`,{children:ce(l)}):null]}),(0,u.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-x-3 gap-y-2`,children:[(0,u.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,u.jsx)(oe,{tone:a.tone,shape:a.ring?`ring`:`filled`,pulse:a.pulse===!0,"aria-hidden":`true`}),(0,u.jsx)(`span`,{className:`font-semibold text-foreground`,children:i.label}),(0,u.jsxs)(`span`,{className:`font-mono text-muted-foreground`,children:[`:`,i.port]}),(0,u.jsx)(`span`,{className:`text-muted-foreground`,children:a.status})]}),(0,u.jsx)(ve,{entry:e,inPreview:n,action:s,onOpen:r})]}),(0,u.jsxs)(`div`,{className:`mt-2.5 min-w-0 rounded-md bg-muted px-3 py-2 font-mono text-xs`,children:[(0,u.jsx)(`p`,{className:`break-words whitespace-pre-wrap text-foreground`,children:i.command}),i.cwd?(0,u.jsxs)(`p`,{className:`mt-1 flex gap-3 text-soft-foreground`,children:[(0,u.jsx)(`span`,{children:`cwd`}),(0,u.jsx)(`span`,{className:`break-all`,children:i.cwd})]}):null]}),s?.run?(0,u.jsx)(d,{icon:(0,u.jsx)(ie,{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,u.jsx)(d,{children:`The worktree this server ran in is gone. Register it again from a new task.`}):null]})}function ve({entry:e,inPreview:t,action:n,onOpen:r}){let{server:i}=e,a=t&&n!==void 0&&!n.run,o=a?`In preview`:n?.label,s=a?ne:n?ge[n.label]:null;return n&&o&&s?(0,u.jsxs)(ae,{variant:a||n.label===`View`||n.label===`Open`&&e.state===`starting`?`outline`:`contrast`,size:`sm`,className:`max-md:h-11 max-md:px-3.5`,onClick:()=>r?.({port:i.port,run:n.run}),children:[(0,u.jsx)(s,{"aria-hidden":`true`}),o]}):null}function d({icon:e,children:t}){return(0,u.jsxs)(`p`,{className:`mt-2.5 flex items-start gap-2 text-xs text-muted-foreground`,children:[e,(0,u.jsx)(`span`,{children:t})]})}function f(e,t){return e.kind===`message`&&e.role===`user`&&e.skillInput?.source===t&&typeof e.skillInput.id==`string`&&e.skillInput.id!==``}var p=120;function m(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function h(e){let t=e.replace(/\s+/g,` `).trim();return t.length>p?`${t.slice(0,p-1)}…`:t}var g=e=>e===void 0?void 0:h(e);function _(e,...t){if(m(e))for(let n of t){let t=e[n];if(typeof t==`string`&&t.trim()!==``)return t}}function v(e,...t){return g(_(e,...t))}function ye(e){if(!m(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 y(e){if(!m(e)||!Array.isArray(e.changes))return[];let t=[];for(let n of e.changes)m(n)&&typeof n.path==`string`&&n.path.trim()!==``&&t.push(n.path);return t}function b(e){return v(e,`description`,`query`,`url`,`filePath`,`file_path`,`path`,`pattern`,`name`)}function x(e,t){return t?`${e} ${t}`:e}var S=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 C(e,t){switch(e){case`notebookedit`:return _(t,`notebook_path`,`notebookPath`,`file_path`,`filePath`,`path`);case`filechange`:{let e=y(t);return e.length===1?e[0]:void 0}default:return _(t,`file_path`,`filePath`,`path`)}}function be(e,t){let n=e===`write`?`Write`:`Edit`;if(e!==`filechange`)return{toolKind:`edit`,title:x(n,g(C(e,t)))};let r=y(t);return{toolKind:`edit`,title:x(n,r.length>1?`${r.length} files`:r[0])}}function w(e,t){return e===`imageview`?_(t,`path`):_(t,`file_path`,`filePath`,`path`)}function xe(e,t){return{toolKind:`read`,title:x(e===`imageview`?`View image`:`Read`,g(w(e,t)))}}function T(e){return _(e,`pattern`,`query`)}function E(e,t){return e===`webfetch`?_(t,`url`):_(t,`query`)}function Se(e,t){return{toolKind:`fetch`,title:x(e===`webfetch`?`Fetch`:`Web search`,g(E(e,t)))}}var D=e=>_(e,`skill`,`name`,`command`),O=e=>_(e,`subagent_type`,`subagentType`);function Ce(e,t){return e===`skill`?D(t):_(t,`prompt`,`task`,`description`)??O(t)}function we(e,t){if(e===`skill`){let e=g(D(t));return{toolKind:`task`,title:e?`Skill: ${e}`:`Skill`,subtitle:v(t,`args`,`description`)}}let n=e===`agent`?`Agent`:`Task`,r=g(O(t)),i=v(t,`description`,`prompt`)??r;return{toolKind:`task`,title:i?`${n}: ${i}`:n,subtitle:i===r?void 0:r}}function Te(e,t,n){if(t===`contextcompaction`)return{toolKind:`other`,title:`Compacted context`};if(t===`mcptoolcall`){let e=v(n,`server`),t=v(n,`tool`);return e&&t?{toolKind:`other`,title:`${e}.${t}`}:{toolKind:`other`,title:`MCP tool`,subtitle:b(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()!==``?h(e):`Tool`,subtitle:b(n)}}function k(e,t){let n=typeof e==`string`?e.toLowerCase():``;switch(S.get(n)){case`execute`:return{toolKind:`execute`,title:x(`Ran`,g(ye(t))),subtitle:v(t,`description`)};case`edit`:return be(n,t);case`read`:return xe(n,t);case`search`:return{toolKind:`search`,title:x(`Search`,g(T(t))),subtitle:v(t,`path`)};case`fetch`:return Se(n,t);case`task`:return we(n,t);case`plan`:return{toolKind:`plan`,title:`Update plan`};default:return Te(e,n,t)}}function Ee(e,t){let n=typeof e==`string`?e.toLowerCase():``;switch(S.get(n)){case`execute`:return ye(t);case`edit`:return C(n,t);case`read`:return w(n,t);case`search`:return T(t);case`fetch`:return E(n,t);case`task`:return Ce(n,t);default:return}}function De(e,t){if(t.type===`ask.requested`&&typeof t.requestId==`string`&&c.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`?a:o).safeParse(t);if(n.success&&n.data.askSeq===e?.seq)return}return e}function Oe(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 ke(e){let t=Oe(e);return t&&{seq:e.seq,...t}}function Ae(e,t){let n=De(e&&{type:`ask.requested`,seq:e.seq,ts:``},t);return n===t?ke(t):n===void 0?void 0:e}function je(e){let t;for(let n of e)t=Ae(t,n);return t}function Me(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 Ne(){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 A(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function j(e){return typeof e==`string`?e:void 0}function M(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`,hourCycle:`h23`})}`}function N(e){if(!(typeof e!=`string`||e===``))return Number.isFinite(new Date(e).getTime())?e:void 0}function Pe(e){return n.safeParse(e).data}function P(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 F(e){return e.turns.at(-1)??P(e)}function I(e,t){let n={origin:`meta`,entry:t,firstSeq:e.eventSeq,lastSeq:e.eventSeq};return F(e).entries.push(n),n}var Fe=[/^run failed\s+[—-]\s+/,/^continue failed(?:\s+[—-]\s+|:\s+)/,/^step\s+"[^"]+"\s+failed:\s+/,/^step\s+\S+\s+failed\s+[—-]\s+/],Ie=/^(?:run failed\s+[—-]\s+|continue failed(?:\s+[—-]\s+|:\s+))/;function L(e){return e.trim().replace(/\s+/g,` `)}function R(e){let t=e.trim(),n=!0;for(;n;){n=!1;for(let e of Fe){let r=t.replace(e,``).trim();r!==t&&r!==``&&(t=r,n=!0)}}return L(t)}function z(e,t,n){if(t===e.primarySource&&n===e.primaryText||e.draft.entry.kind!==`note`)return;let r=e.draft.entry;r.details?.some(e=>e.source===t&&e.text===n)||(r.details=[...r.details??[],{source:t,text:n}])}function B(e,t,n){let r=e.failures;if(r)for(let e=r.length-1;e>=0;--e){let i=r[e];if(t!==``&&i.cause===t||t===``&&i.fatal&&(n===void 0||i.stepId===void 0||i.stepId===n))return i}}function V(e,t,n){let r=F(e),i=B(r,n.cause,n.stepId);if(i){i.draft.lastSeq=Math.max(i.draft.lastSeq,t.seq),n.fatal&&(i.fatal=!0),n.stepId!==void 0&&i.stepId===void 0&&(i.stepId=n.stepId),z(i,n.source,n.text);return}let a={draft:I(e,{kind:`note`,id:n.id,text:n.text,tone:`danger`}),cause:n.cause,primarySource:n.source,primaryText:n.text,...n.stepId===void 0?{}:{stepId:n.stepId},fatal:n.fatal};r.failures=[...r.failures??[],a]}function Le(e,t,n){if(!Ie.test(n))return!1;let r=e.turns.at(-1);if(!r)return!1;let i=R(n);if(i===``)return!1;let a=B(r,i,j(t.stepId));return a?(a.draft.lastSeq=Math.max(a.draft.lastSeq,t.seq),a.fatal=!0,z(a,`lifecycle`,n),!0):!1}function Re(e,t,n){let r=e.turns.at(-1);if(!r)return;let i=B(r,n?R(n):``,j(t.stepId));i&&(i.fatal=!0)}function H(e){for(let t of e.permissions.values())t.status===`pending`&&(t.status=`expired`)}function U(e,t){let n=j(e.stepId);return n===void 0?t:`${n}:${t}`}function ze(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 Be(e,t,n,r,i,a=!1){let o=n.kind===`message`&&i!==void 0?{...n,ts:i}:{...n};!t.v2Items&&o.kind!==`hook`&&ze(e,t);let s=e.itemsById.get(r);if(s&&s.turn===t){s.entry.entry=o,s.entry.lastSeq=e.eventSeq,s.entry.streaming=a;return}let c={origin:`v2`,entry:o,firstSeq:e.eventSeq,lastSeq:e.eventSeq,streaming:a};t.entries.push(c),e.itemsById.set(r,{turn:t,entry:c})}var W={"not-delivered":0,queued:1,delivered:2,consumed:3},Ve=[`instruction`,`resumed`,`requestId`,`relationship`,`state`,`createdAt`,`requestHash`,`deadline`];function G(e){let t={};for(let n of Ve)e[n]!==void 0&&Object.assign(t,{[n]:e[n]});return t}function K(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 He(e,t){let n=e.conversationEntries.get(t);n&&K(e,n)}function Ue(e,t,n,r){(W[e.delivery]<W.delivered||W[n]>W[e.delivery])&&(e.delivery=n),t.text!==``&&(e.text=t.text),Object.assign(e,G(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 q(e,t,n,r){let i=e.conversationEntries.get(t.id);if(i){Ue(i,t,n,r),K(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,...G(t)};K(e,a),e.conversationEntries.set(t.id,a),I(e,a)}function We(e,t){let n=M(t.ts),r=j(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,I(e,{kind:`note`,id:`v1:${t.seq}`,text:i,tone:`dim`,icon:`handoff`})}function Ge(e,t){let n=typeof t.attempts==`number`?t.attempts:void 0,r=j(t.webhookName),i=`${r?`Delivery to ${r} failed`:`Webhook delivery failed`}${j(t.event)?` (${j(t.event)})`:``}${n?` after ${n} attempt${n===1?``:`s`}`:``}: ${j(t.error)??`unknown error`}`;I(e,{kind:`note`,id:`v1:${t.seq}`,text:i,tone:`danger`})}function Ke(e,t){let n=j(t.webhookName)??`webhook`,r=j(t.title),i=`v1:${t.seq}`;if(t.ok===!1){I(e,{kind:`note`,id:i,text:`Report to ${n} failed: ${j(t.error)??`unknown error`}`,tone:`danger`});return}let a=`${t.dryRun===!0?`Report to ${n} (dry run, nothing sent)`:`Sent report to ${n}`}${M(t.ts)}${r?` — ${r}`:``}`;I(e,t.dryRun===!0?{kind:`note`,id:i,text:a,tone:`dim`}:{kind:`note`,id:i,text:a,tone:`dim`,icon:`handoff`})}function qe(e,t){let n=t.payload??{},r=`Webhook (dry run, nothing sent): ${j(t.event)??`delivery`}${j(n.status)?` · ${j(n.status)}`:``}`;I(e,{kind:`note`,id:`v1:${t.seq}`,text:r,tone:`dim`})}function Je(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=F(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 Ye(e,t){let n=r.safeParse(t.state),i=typeof t.port==`number`?e.previewByPort.get(t.port):void 0;if(!n.success||!i||i.draft.entry.kind!==`preview-server`)return;let{server:a,id:o}=i.draft.entry;i.draft.lastSeq=t.seq,i.draft.entry={kind:`preview-server`,id:o,server:a,state:n.data,stateAt:t.ts,...typeof t.exitCode==`number`?{exitCode:t.exitCode}:{},...t.reason===`user`||t.reason===`idle`?{reason:t.reason}:{}}}function Xe(e,t){let n=s.safeParse(t);if(!n.success)return;let{message:r,delivery:i,deliveredAt:a,consumedAt:o,ts:c}=n.data;q(e,r,i,{deliveredAt:a,consumedAt:o,recordedAt:c})}function Ze(e,t){let n=ee.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),He(e,r.requestId))}function Qe(e,t){let n=l.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){q(e,{id:r.id,text:r.text,createdAt:r.createdAt,...r.conversation},`delivered`,{deliveredAt:r.deliveredAt,recordedAt:n.data.ts});return}I(e,{kind:`note`,id:`agent-input:${r.id}`,text:r.text,tone:`dim`,attribution:{source:r.source,parentRunId:r.parentRunId}})}}function $e(e,t){let n=j(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=P(e,t.seq),a=N(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 et(e,t){let n=e.turns.at(-1),r=n&&n.turnId===void 0&&!n.v2Items?n:P(e,t.seq);r.turnId=j(t.turnId),r.startedAt??=N(t.ts)}function tt(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 nt(e,t){H(e);let n=tt(e,j(t.turnId));if(!n)return;let r=N(t.ts);n.completed={stopReason:j(t.stopReason)??`end_turn`,...typeof t.costUsd==`number`?{costUsd:t.costUsd}:{},...r===void 0?{}:{ts:r}}}var J=new Set([`message`,`reasoning`,`tool`,`hook`]),rt=e=>J.has(e.kind);function it(e){if(!(!A(e)||!J.has(e.kind)))return typeof e.id==`string`&&e.id!==``?e:void 0}function Y(e,t){let n=it(t.item);if(!n)return;let r=U(t,n.id),i=e.itemsById.get(r),a=t.type===`item.completed`,o=!a&&(n.kind===`message`||n.kind===`reasoning`);Be(e,i?.turn??F(e),n,r,a?N(t.ts):void 0,o)}function at(e,t){let n=e.itemsById.get(U(t,j(t.itemId)??``)),r=j(t.delta)??``;if(!n||r===``||!rt(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 ot(e,t){let n=F(e),r=j(t.text)??``;if(r===``)return;let i=N(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 st=new Set([`pending`,`in_progress`,`completed`,`cancelled`]);function ct(e){if(!A(e)||!Array.isArray(e.todos))return;let t=[];for(let n of e.todos){if(!A(n)||typeof n.content!=`string`)return;t.push({content:n.content,status:st.has(n.status)?n.status:`pending`,...typeof n.activeForm==`string`?{activeForm:n.activeForm}:{}})}return t}var lt=new Set([`subAgentActivity`,`collabAgentToolCall`,`collabToolCall`]);function ut(e,t){let n=F(e),r=j(t.tool)??`Tool`;if(n.v2Items||lt.has(r))return;let i=k(r,t.input),a=i.toolKind===`plan`?ct(t.input):void 0;a!==void 0&&(n.planEntries=a);let o={kind:`tool`,id:j(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 dt(e){if(typeof e==`string`)return e;if(e==null)return``;try{return JSON.stringify(e)}catch{return String(e)}}function ft(e,t){let n=e.itemsById.get(j(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=dt(t.result))}function pt(e,t,n,r){let i=j(t.message)??``;i!==``&&I(e,{kind:`note`,id:n,text:i,tone:r})}function mt(e,t){let n=j(t.message)??``;t.type===`lifecycle`&&n!==``&&Le(e,t,n)||pt(e,t,`v1:${t.seq}`,t.tone===`danger`?`danger`:`dim`)}function ht(e,t){let n=j(t.message)??``;n!==``&&V(e,t,{id:`v1:${t.seq}`,source:`error`,text:n,cause:R(n),stepId:j(t.stepId),fatal:!1})}function gt(e,t){let n=j(t.message)??``;n!==``&&V(e,t,{id:`v2:${t.seq}`,source:`session.error`,text:n,cause:R(n),stepId:j(t.stepId),fatal:t.fatal===!0})}function _t(e,t){if(t.status!==`failed`)return;let n=j(t.stepId),r=j(t.error),i=r?` — ${r}`:``;V(e,t,{id:`v1:${t.seq}`,source:`step-end`,text:`step ${n??`?`} failed${i}`,cause:r?R(r):``,stepId:n,fatal:!0})}function vt(e,t){let n=j(t.command)??`check`,r=typeof t.exitCode==`number`?t.exitCode:-1;I(e,{kind:`tool`,id:`v1:${t.seq}`,name:`check`,toolKind:`execute`,title:`Ran ${n}`,status:r===0?`completed`:`failed`,output:j(t.text)??``,exitCode:r})}function yt(e,t){let n=Pe(t.provider),r=j(t.authFailureId)??``;n===void 0||r.length<1||r.length>128||I(e,{kind:`provider-auth-required`,id:`v1:${t.seq}`,provider:n,authFailureId:r})}function bt(e,t){let n=j(t.url);if(n===void 0)return;let r={kind:`image`,id:`v1:${t.seq}`,url:n},i=j(t.name);i!==void 0&&(r.name=i),I(e,r)}function xt(e,t){Array.isArray(t.entries)&&(F(e).planEntries=t.entries)}function St(e,t){H(e);let n=j(t.reason)??`end_turn`,r=j(t.message);n===`error`&&Re(e,t,r),e.sessionEnded={reason:n,...r===void 0?{}:{message:r}}}var Ct=new Set([`allow_once`,`allow_always`,`reject_once`,`reject_always`]);function wt(e){return A(e)&&typeof e.id==`string`&&e.id!==``&&typeof e.label==`string`&&e.label!==``&&Ct.has(e.kind)}function Tt(e){if(!(!Array.isArray(e)||e.length===0||!e.every(wt)))return new Set(e.map(e=>e.id)).size===e.length?e:void 0}function Et(e,t){let n=j(t.requestId),r=j(t.title),i=Tt(t.options);if(!n||!r||e.permissions.has(n)||!i)return;let a=j(t.itemId),o=j(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),I(e,s)}function Dt(e,t){let n=e.permissions.get(j(t.requestId)??``);if(!n||n.status!==`pending`)return;let r=j(t.optionId);r!==void 0&&n.options.some(e=>e.id===r)?(n.status=`resolved`,n.optionId=r):n.status=`expired`;let i=j(t.reason);i!==void 0&&(n.reason=i)}function Ot(e,t){let n=ke(t),r=n&&Me(n);if(!r)return;let i={kind:`ask`,...r,questions:r.questions,resolved:!1};I(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 kt(e,t){let n=X(e,t);if(!n)return;n.routedToParent=!0;let r=j(t.parentRunId);r!==void 0&&(n.parentRunId=r)}function At(e,t){let n=X(e,t);n&&(n.routedToParent=!1)}function jt(e,t){let n=X(e,t);n&&Z(e,n,`undeliverable`)}var Mt=new Set([`finish`,`superseded`,`parent-stopped`,`worker-stopped`,`undeliverable`]);function Nt(e,t){let n=X(e,t);n&&Mt.has(t.reason)&&Z(e,n,t.reason)}function Z(e,t,n){t.resolved=!0,t.closed=n,e.pendingAsk=void 0}function Pt(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=()=>{},Ft=new Map([[`handoff`,We],[`webhook.failed`,Ge],[`webhook.dry-run`,qe],[`webhook.report`,Ke],[`preview.server-registered`,Je],[`preview.server-state`,Ye],[`conversation-message`,Xe],[`request-outcome`,Ze],[`agent-input`,Qe],[`user-message`,$e],[`turn.started`,et],[`turn.completed`,nt],[`item.started`,Y],[`item.updated`,Y],[`item.completed`,Y],[`item.delta`,at],[`text`,ot],[`tool-call`,ut],[`tool-result`,ft],[`note`,mt],[`lifecycle`,mt],[`error`,ht],[`session.error`,gt],[`step-end`,_t],[`check-output`,vt],[`provider-auth-required`,yt],[`image`,bt],[`plan.updated`,xt],[`session.started`,e=>H(e)],[`session.ended`,St],[`permission.requested`,Et],[`permission.resolved`,Dt],[`ask.requested`,Ot],[`worker-question-routed`,kt],[`worker-question-fallback`,At],[`worker-question-undelivered`,jt],[`human-ask-closed`,Nt],[`human-input-delivered`,Pt],[`step-start`,Q],[`token-usage`,Q],[`cost`,Q],[`turn-end`,Q],[`done`,Q],[`session`,Q]]);function It(e,t){e.eventSeq=t.seq,Ft.get(t.type)?.(e,t)}function Lt(e){for(let t=e.turns.length-1;t>=0;--t){let n=e.turns[t].planEntries;if(n!==void 0)return n}}function Rt(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=new Set;for(let e=t.length-1;e>=0;--e)n.add(t[e]);return[...n]}function zt(e,t){let n=e?.turns.at(-1);if(!n)return!1;let r=R(t);return r!==``&&n.items.some(e=>e.kind===`note`&&e.tone===`danger`&&R(e.text)===r)}function Bt(e,t,n){switch(e){case`waiting`:return{state:`waiting`};case`failed`:return{state:`closed`,tone:`danger`,label:t!==void 0&&t!==``&&!zt(n,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{t}from"./utils-DSMR_WLb.js";import{$r as n,mr as r,pr as i}from"./project-scope-context-Rv6S_BXt.js";import{_ as a,g as o,h as s,k as c,p as l,v as ee}from"./live-protocol-DMhTnCmf.js";import{t as te}from"./createLucideIcon-BHp8sXmF.js";import{t as ne}from"./app-window-CSHwDX9N.js";import{t as re}from"./play-CmVAj_fu.js";import{t as ie}from"./square-terminal-B6RYYieR.js";import{t as ae}from"./button-B7MKxYjT.js";import{t as oe}from"./status-dot-BRzVlF2X.js";import{a as se,o as ce}from"./format-BU7D3IfE.js";import{$n as le,f as ue,p as de}from"./index-DNQcTHxV.js";var fe=te(`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`}]]),pe=te(`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`}]]),u=e(),me={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 he(e){let{text:t,...n}=de(e),r={...n,status:t},i=me[e.state](e);return i?{...r,action:i}:r}var ge={"Run and open":re,Open:ne,View:le,"Start again":fe};function _e({entry:e,inPreview:n,onOpen:r}){let{server:i}=e,a=he(e),o=e.state===`unavailable`,s=r?a.action:void 0,c=ue(i.command),l=se(i.registeredAt);return(0,u.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,u.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2 text-xs text-soft-foreground`,children:[(0,u.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5 font-mono`,children:[(0,u.jsx)(pe,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),(0,u.jsx)(`span`,{className:`truncate`,children:`cezar_preview_serve`})]}),o?(0,u.jsx)(`span`,{children:`worktree removed`}):l?(0,u.jsx)(`span`,{children:ce(l)}):null]}),(0,u.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-x-3 gap-y-2`,children:[(0,u.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,u.jsx)(oe,{tone:a.tone,shape:a.ring?`ring`:`filled`,pulse:a.pulse===!0,"aria-hidden":`true`}),(0,u.jsx)(`span`,{className:`font-semibold text-foreground`,children:i.label}),(0,u.jsxs)(`span`,{className:`font-mono text-muted-foreground`,children:[`:`,i.port]}),(0,u.jsx)(`span`,{className:`text-muted-foreground`,children:a.status})]}),(0,u.jsx)(ve,{entry:e,inPreview:n,action:s,onOpen:r})]}),(0,u.jsxs)(`div`,{className:`mt-2.5 min-w-0 rounded-md bg-muted px-3 py-2 font-mono text-xs`,children:[(0,u.jsx)(`p`,{className:`break-words whitespace-pre-wrap text-foreground`,children:i.command}),i.cwd?(0,u.jsxs)(`p`,{className:`mt-1 flex gap-3 text-soft-foreground`,children:[(0,u.jsx)(`span`,{children:`cwd`}),(0,u.jsx)(`span`,{className:`break-all`,children:i.cwd})]}):null]}),s?.run?(0,u.jsx)(d,{icon:(0,u.jsx)(ie,{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,u.jsx)(d,{children:`The worktree this server ran in is gone. Register it again from a new task.`}):null]})}function ve({entry:e,inPreview:t,action:n,onOpen:r}){let{server:i}=e,a=t&&n!==void 0&&!n.run,o=a?`In preview`:n?.label,s=a?ne:n?ge[n.label]:null;return n&&o&&s?(0,u.jsxs)(ae,{variant:a||n.label===`View`||n.label===`Open`&&e.state===`starting`?`outline`:`contrast`,size:`sm`,className:`max-md:h-11 max-md:px-3.5`,onClick:()=>r?.({port:i.port,run:n.run}),children:[(0,u.jsx)(s,{"aria-hidden":`true`}),o]}):null}function d({icon:e,children:t}){return(0,u.jsxs)(`p`,{className:`mt-2.5 flex items-start gap-2 text-xs text-muted-foreground`,children:[e,(0,u.jsx)(`span`,{children:t})]})}function f(e,t){return e.kind===`message`&&e.role===`user`&&e.skillInput?.source===t&&typeof e.skillInput.id==`string`&&e.skillInput.id!==``}var p=120;function m(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function h(e){let t=e.replace(/\s+/g,` `).trim();return t.length>p?`${t.slice(0,p-1)}…`:t}var g=e=>e===void 0?void 0:h(e);function _(e,...t){if(m(e))for(let n of t){let t=e[n];if(typeof t==`string`&&t.trim()!==``)return t}}function v(e,...t){return g(_(e,...t))}function ye(e){if(!m(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 y(e){if(!m(e)||!Array.isArray(e.changes))return[];let t=[];for(let n of e.changes)m(n)&&typeof n.path==`string`&&n.path.trim()!==``&&t.push(n.path);return t}function b(e){return v(e,`description`,`query`,`url`,`filePath`,`file_path`,`path`,`pattern`,`name`)}function x(e,t){return t?`${e} ${t}`:e}var S=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 C(e,t){switch(e){case`notebookedit`:return _(t,`notebook_path`,`notebookPath`,`file_path`,`filePath`,`path`);case`filechange`:{let e=y(t);return e.length===1?e[0]:void 0}default:return _(t,`file_path`,`filePath`,`path`)}}function be(e,t){let n=e===`write`?`Write`:`Edit`;if(e!==`filechange`)return{toolKind:`edit`,title:x(n,g(C(e,t)))};let r=y(t);return{toolKind:`edit`,title:x(n,r.length>1?`${r.length} files`:r[0])}}function w(e,t){return e===`imageview`?_(t,`path`):_(t,`file_path`,`filePath`,`path`)}function xe(e,t){return{toolKind:`read`,title:x(e===`imageview`?`View image`:`Read`,g(w(e,t)))}}function T(e){return _(e,`pattern`,`query`)}function E(e,t){return e===`webfetch`?_(t,`url`):_(t,`query`)}function Se(e,t){return{toolKind:`fetch`,title:x(e===`webfetch`?`Fetch`:`Web search`,g(E(e,t)))}}var D=e=>_(e,`skill`,`name`,`command`),O=e=>_(e,`subagent_type`,`subagentType`);function Ce(e,t){return e===`skill`?D(t):_(t,`prompt`,`task`,`description`)??O(t)}function we(e,t){if(e===`skill`){let e=g(D(t));return{toolKind:`task`,title:e?`Skill: ${e}`:`Skill`,subtitle:v(t,`args`,`description`)}}let n=e===`agent`?`Agent`:`Task`,r=g(O(t)),i=v(t,`description`,`prompt`)??r;return{toolKind:`task`,title:i?`${n}: ${i}`:n,subtitle:i===r?void 0:r}}function Te(e,t,n){if(t===`contextcompaction`)return{toolKind:`other`,title:`Compacted context`};if(t===`mcptoolcall`){let e=v(n,`server`),t=v(n,`tool`);return e&&t?{toolKind:`other`,title:`${e}.${t}`}:{toolKind:`other`,title:`MCP tool`,subtitle:b(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()!==``?h(e):`Tool`,subtitle:b(n)}}function k(e,t){let n=typeof e==`string`?e.toLowerCase():``;switch(S.get(n)){case`execute`:return{toolKind:`execute`,title:x(`Ran`,g(ye(t))),subtitle:v(t,`description`)};case`edit`:return be(n,t);case`read`:return xe(n,t);case`search`:return{toolKind:`search`,title:x(`Search`,g(T(t))),subtitle:v(t,`path`)};case`fetch`:return Se(n,t);case`task`:return we(n,t);case`plan`:return{toolKind:`plan`,title:`Update plan`};default:return Te(e,n,t)}}function Ee(e,t){let n=typeof e==`string`?e.toLowerCase():``;switch(S.get(n)){case`execute`:return ye(t);case`edit`:return C(n,t);case`read`:return w(n,t);case`search`:return T(t);case`fetch`:return E(n,t);case`task`:return Ce(n,t);default:return}}function De(e,t){if(t.type===`ask.requested`&&typeof t.requestId==`string`&&c.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`?a:o).safeParse(t);if(n.success&&n.data.askSeq===e?.seq)return}return e}function Oe(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 ke(e){let t=Oe(e);return t&&{seq:e.seq,...t}}function Ae(e,t){let n=De(e&&{type:`ask.requested`,seq:e.seq,ts:``},t);return n===t?ke(t):n===void 0?void 0:e}function je(e){let t;for(let n of e)t=Ae(t,n);return t}function Me(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 Ne(){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 A(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function j(e){return typeof e==`string`?e:void 0}function M(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`,hourCycle:`h23`})}`}function N(e){if(!(typeof e!=`string`||e===``))return Number.isFinite(new Date(e).getTime())?e:void 0}function Pe(e){return n.safeParse(e).data}function P(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 F(e){return e.turns.at(-1)??P(e)}function I(e,t){let n={origin:`meta`,entry:t,firstSeq:e.eventSeq,lastSeq:e.eventSeq};return F(e).entries.push(n),n}var Fe=[/^run failed\s+[—-]\s+/,/^continue failed(?:\s+[—-]\s+|:\s+)/,/^step\s+"[^"]+"\s+failed:\s+/,/^step\s+\S+\s+failed\s+[—-]\s+/],Ie=/^(?:run failed\s+[—-]\s+|continue failed(?:\s+[—-]\s+|:\s+))/;function L(e){return e.trim().replace(/\s+/g,` `)}function R(e){let t=e.trim(),n=!0;for(;n;){n=!1;for(let e of Fe){let r=t.replace(e,``).trim();r!==t&&r!==``&&(t=r,n=!0)}}return L(t)}function z(e,t,n){if(t===e.primarySource&&n===e.primaryText||e.draft.entry.kind!==`note`)return;let r=e.draft.entry;r.details?.some(e=>e.source===t&&e.text===n)||(r.details=[...r.details??[],{source:t,text:n}])}function B(e,t,n){let r=e.failures;if(r)for(let e=r.length-1;e>=0;--e){let i=r[e];if(t!==``&&i.cause===t||t===``&&i.fatal&&(n===void 0||i.stepId===void 0||i.stepId===n))return i}}function V(e,t,n){let r=F(e),i=B(r,n.cause,n.stepId);if(i){i.draft.lastSeq=Math.max(i.draft.lastSeq,t.seq),n.fatal&&(i.fatal=!0),n.stepId!==void 0&&i.stepId===void 0&&(i.stepId=n.stepId),z(i,n.source,n.text);return}let a={draft:I(e,{kind:`note`,id:n.id,text:n.text,tone:`danger`}),cause:n.cause,primarySource:n.source,primaryText:n.text,...n.stepId===void 0?{}:{stepId:n.stepId},fatal:n.fatal};r.failures=[...r.failures??[],a]}function Le(e,t,n){if(!Ie.test(n))return!1;let r=e.turns.at(-1);if(!r)return!1;let i=R(n);if(i===``)return!1;let a=B(r,i,j(t.stepId));return a?(a.draft.lastSeq=Math.max(a.draft.lastSeq,t.seq),a.fatal=!0,z(a,`lifecycle`,n),!0):!1}function Re(e,t,n){let r=e.turns.at(-1);if(!r)return;let i=B(r,n?R(n):``,j(t.stepId));i&&(i.fatal=!0)}function H(e){for(let t of e.permissions.values())t.status===`pending`&&(t.status=`expired`)}function U(e,t){let n=j(e.stepId);return n===void 0?t:`${n}:${t}`}function ze(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 Be(e,t,n,r,i,a=!1){let o=n.kind===`message`&&i!==void 0?{...n,ts:i}:{...n};!t.v2Items&&o.kind!==`hook`&&ze(e,t);let s=e.itemsById.get(r);if(s&&s.turn===t){s.entry.entry=o,s.entry.lastSeq=e.eventSeq,s.entry.streaming=a;return}let c={origin:`v2`,entry:o,firstSeq:e.eventSeq,lastSeq:e.eventSeq,streaming:a};t.entries.push(c),e.itemsById.set(r,{turn:t,entry:c})}var W={"not-delivered":0,queued:1,delivered:2,consumed:3},Ve=[`instruction`,`resumed`,`requestId`,`relationship`,`state`,`createdAt`,`requestHash`,`deadline`];function G(e){let t={};for(let n of Ve)e[n]!==void 0&&Object.assign(t,{[n]:e[n]});return t}function K(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 He(e,t){let n=e.conversationEntries.get(t);n&&K(e,n)}function Ue(e,t,n,r){(W[e.delivery]<W.delivered||W[n]>W[e.delivery])&&(e.delivery=n),t.text!==``&&(e.text=t.text),Object.assign(e,G(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 q(e,t,n,r){let i=e.conversationEntries.get(t.id);if(i){Ue(i,t,n,r),K(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,...G(t)};K(e,a),e.conversationEntries.set(t.id,a),I(e,a)}function We(e,t){let n=M(t.ts),r=j(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,I(e,{kind:`note`,id:`v1:${t.seq}`,text:i,tone:`dim`,icon:`handoff`})}function Ge(e,t){let n=typeof t.attempts==`number`?t.attempts:void 0,r=j(t.webhookName),i=`${r?`Delivery to ${r} failed`:`Webhook delivery failed`}${j(t.event)?` (${j(t.event)})`:``}${n?` after ${n} attempt${n===1?``:`s`}`:``}: ${j(t.error)??`unknown error`}`;I(e,{kind:`note`,id:`v1:${t.seq}`,text:i,tone:`danger`})}function Ke(e,t){let n=j(t.webhookName)??`webhook`,r=j(t.title),i=`v1:${t.seq}`;if(t.ok===!1){I(e,{kind:`note`,id:i,text:`Report to ${n} failed: ${j(t.error)??`unknown error`}`,tone:`danger`});return}let a=`${t.dryRun===!0?`Report to ${n} (dry run, nothing sent)`:`Sent report to ${n}`}${M(t.ts)}${r?` — ${r}`:``}`;I(e,t.dryRun===!0?{kind:`note`,id:i,text:a,tone:`dim`}:{kind:`note`,id:i,text:a,tone:`dim`,icon:`handoff`})}function qe(e,t){let n=t.payload??{},r=`Webhook (dry run, nothing sent): ${j(t.event)??`delivery`}${j(n.status)?` · ${j(n.status)}`:``}`;I(e,{kind:`note`,id:`v1:${t.seq}`,text:r,tone:`dim`})}function Je(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=F(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 Ye(e,t){let n=r.safeParse(t.state),i=typeof t.port==`number`?e.previewByPort.get(t.port):void 0;if(!n.success||!i||i.draft.entry.kind!==`preview-server`)return;let{server:a,id:o}=i.draft.entry;i.draft.lastSeq=t.seq,i.draft.entry={kind:`preview-server`,id:o,server:a,state:n.data,stateAt:t.ts,...typeof t.exitCode==`number`?{exitCode:t.exitCode}:{},...t.reason===`user`||t.reason===`idle`?{reason:t.reason}:{}}}function Xe(e,t){let n=s.safeParse(t);if(!n.success)return;let{message:r,delivery:i,deliveredAt:a,consumedAt:o,ts:c}=n.data;q(e,r,i,{deliveredAt:a,consumedAt:o,recordedAt:c})}function Ze(e,t){let n=ee.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),He(e,r.requestId))}function Qe(e,t){let n=l.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){q(e,{id:r.id,text:r.text,createdAt:r.createdAt,...r.conversation},`delivered`,{deliveredAt:r.deliveredAt,recordedAt:n.data.ts});return}I(e,{kind:`note`,id:`agent-input:${r.id}`,text:r.text,tone:`dim`,attribution:{source:r.source,parentRunId:r.parentRunId}})}}function $e(e,t){let n=j(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=P(e,t.seq),a=N(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 et(e,t){let n=e.turns.at(-1),r=n&&n.turnId===void 0&&!n.v2Items?n:P(e,t.seq);r.turnId=j(t.turnId),r.startedAt??=N(t.ts)}function tt(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 nt(e,t){H(e);let n=tt(e,j(t.turnId));if(!n)return;let r=N(t.ts);n.completed={stopReason:j(t.stopReason)??`end_turn`,...typeof t.costUsd==`number`?{costUsd:t.costUsd}:{},...r===void 0?{}:{ts:r}}}var J=new Set([`message`,`reasoning`,`tool`,`hook`]),rt=e=>J.has(e.kind);function it(e){if(!(!A(e)||!J.has(e.kind)))return typeof e.id==`string`&&e.id!==``?e:void 0}function Y(e,t){let n=it(t.item);if(!n)return;let r=U(t,n.id),i=e.itemsById.get(r),a=t.type===`item.completed`,o=!a&&(n.kind===`message`||n.kind===`reasoning`);Be(e,i?.turn??F(e),n,r,a?N(t.ts):void 0,o)}function at(e,t){let n=e.itemsById.get(U(t,j(t.itemId)??``)),r=j(t.delta)??``;if(!n||r===``||!rt(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 ot(e,t){let n=F(e),r=j(t.text)??``;if(r===``)return;let i=N(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 st=new Set([`pending`,`in_progress`,`completed`,`cancelled`]);function ct(e){if(!A(e)||!Array.isArray(e.todos))return;let t=[];for(let n of e.todos){if(!A(n)||typeof n.content!=`string`)return;t.push({content:n.content,status:st.has(n.status)?n.status:`pending`,...typeof n.activeForm==`string`?{activeForm:n.activeForm}:{}})}return t}var lt=new Set([`subAgentActivity`,`collabAgentToolCall`,`collabToolCall`]);function ut(e,t){let n=F(e),r=j(t.tool)??`Tool`;if(n.v2Items||lt.has(r))return;let i=k(r,t.input),a=i.toolKind===`plan`?ct(t.input):void 0;a!==void 0&&(n.planEntries=a);let o={kind:`tool`,id:j(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 dt(e){if(typeof e==`string`)return e;if(e==null)return``;try{return JSON.stringify(e)}catch{return String(e)}}function ft(e,t){let n=e.itemsById.get(j(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=dt(t.result))}function pt(e,t,n,r){let i=j(t.message)??``;i!==``&&I(e,{kind:`note`,id:n,text:i,tone:r})}function mt(e,t){let n=j(t.message)??``;t.type===`lifecycle`&&n!==``&&Le(e,t,n)||pt(e,t,`v1:${t.seq}`,t.tone===`danger`?`danger`:`dim`)}function ht(e,t){let n=j(t.message)??``;n!==``&&V(e,t,{id:`v1:${t.seq}`,source:`error`,text:n,cause:R(n),stepId:j(t.stepId),fatal:!1})}function gt(e,t){let n=j(t.message)??``;n!==``&&V(e,t,{id:`v2:${t.seq}`,source:`session.error`,text:n,cause:R(n),stepId:j(t.stepId),fatal:t.fatal===!0})}function _t(e,t){if(t.status!==`failed`)return;let n=j(t.stepId),r=j(t.error),i=r?` — ${r}`:``;V(e,t,{id:`v1:${t.seq}`,source:`step-end`,text:`step ${n??`?`} failed${i}`,cause:r?R(r):``,stepId:n,fatal:!0})}function vt(e,t){let n=j(t.command)??`check`,r=typeof t.exitCode==`number`?t.exitCode:-1;I(e,{kind:`tool`,id:`v1:${t.seq}`,name:`check`,toolKind:`execute`,title:`Ran ${n}`,status:r===0?`completed`:`failed`,output:j(t.text)??``,exitCode:r})}function yt(e,t){let n=Pe(t.provider),r=j(t.authFailureId)??``;n===void 0||r.length<1||r.length>128||I(e,{kind:`provider-auth-required`,id:`v1:${t.seq}`,provider:n,authFailureId:r})}function bt(e,t){let n=j(t.url);if(n===void 0)return;let r={kind:`image`,id:`v1:${t.seq}`,url:n},i=j(t.name);i!==void 0&&(r.name=i),I(e,r)}function xt(e,t){Array.isArray(t.entries)&&(F(e).planEntries=t.entries)}function St(e,t){H(e);let n=j(t.reason)??`end_turn`,r=j(t.message);n===`error`&&Re(e,t,r),e.sessionEnded={reason:n,...r===void 0?{}:{message:r}}}var Ct=new Set([`allow_once`,`allow_always`,`reject_once`,`reject_always`]);function wt(e){return A(e)&&typeof e.id==`string`&&e.id!==``&&typeof e.label==`string`&&e.label!==``&&Ct.has(e.kind)}function Tt(e){if(!(!Array.isArray(e)||e.length===0||!e.every(wt)))return new Set(e.map(e=>e.id)).size===e.length?e:void 0}function Et(e,t){let n=j(t.requestId),r=j(t.title),i=Tt(t.options);if(!n||!r||e.permissions.has(n)||!i)return;let a=j(t.itemId),o=j(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),I(e,s)}function Dt(e,t){let n=e.permissions.get(j(t.requestId)??``);if(!n||n.status!==`pending`)return;let r=j(t.optionId);r!==void 0&&n.options.some(e=>e.id===r)?(n.status=`resolved`,n.optionId=r):n.status=`expired`;let i=j(t.reason);i!==void 0&&(n.reason=i)}function Ot(e,t){let n=ke(t),r=n&&Me(n);if(!r)return;let i={kind:`ask`,...r,questions:r.questions,resolved:!1};I(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 kt(e,t){let n=X(e,t);if(!n)return;n.routedToParent=!0;let r=j(t.parentRunId);r!==void 0&&(n.parentRunId=r)}function At(e,t){let n=X(e,t);n&&(n.routedToParent=!1)}function jt(e,t){let n=X(e,t);n&&Z(e,n,`undeliverable`)}var Mt=new Set([`finish`,`superseded`,`parent-stopped`,`worker-stopped`,`undeliverable`]);function Nt(e,t){let n=X(e,t);n&&Mt.has(t.reason)&&Z(e,n,t.reason)}function Z(e,t,n){t.resolved=!0,t.closed=n,e.pendingAsk=void 0}function Pt(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=()=>{},Ft=new Map([[`handoff`,We],[`webhook.failed`,Ge],[`webhook.dry-run`,qe],[`webhook.report`,Ke],[`preview.server-registered`,Je],[`preview.server-state`,Ye],[`conversation-message`,Xe],[`request-outcome`,Ze],[`agent-input`,Qe],[`user-message`,$e],[`turn.started`,et],[`turn.completed`,nt],[`item.started`,Y],[`item.updated`,Y],[`item.completed`,Y],[`item.delta`,at],[`text`,ot],[`tool-call`,ut],[`tool-result`,ft],[`note`,mt],[`lifecycle`,mt],[`error`,ht],[`session.error`,gt],[`step-end`,_t],[`check-output`,vt],[`provider-auth-required`,yt],[`image`,bt],[`plan.updated`,xt],[`session.started`,e=>H(e)],[`session.ended`,St],[`permission.requested`,Et],[`permission.resolved`,Dt],[`ask.requested`,Ot],[`worker-question-routed`,kt],[`worker-question-fallback`,At],[`worker-question-undelivered`,jt],[`human-ask-closed`,Nt],[`human-input-delivered`,Pt],[`step-start`,Q],[`token-usage`,Q],[`cost`,Q],[`turn-end`,Q],[`done`,Q],[`session`,Q]]);function It(e,t){e.eventSeq=t.seq,Ft.get(t.type)?.(e,t)}function Lt(e){for(let t=e.turns.length-1;t>=0;--t){let n=e.turns[t].planEntries;if(n!==void 0)return n}}function Rt(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=new Set;for(let e=t.length-1;e>=0;--e)n.add(t[e]);return[...n]}function zt(e,t){let n=e?.turns.at(-1);if(!n)return!1;let r=R(t);return r!==``&&n.items.some(e=>e.kind===`note`&&e.tone===`danger`&&R(e.text)===r)}function Bt(e,t,n){switch(e){case`waiting`:return{state:`waiting`};case`failed`:return{state:`closed`,tone:`danger`,label:t!==void 0&&t!==``&&!zt(n,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}var Vt=/\s*(?:^|\n)C(?:E(?:Z(?::.*)?)?)?$/,Ht=/[ \t]+CEZ(?::[A-Z]*)?$/;function Ut(e){return e.replace(Vt,``).replace(Ht,``)}function Wt(e,t,n){return t!==``&&e.some(e=>e.norm===``?n>e.firstSeq:e.norm.startsWith(t)||t.startsWith(e.norm))}function Gt(e,t){let n=e=>$(e,!0).replace(/\s+/g,``),r=new Set,i=[],a=[];for(let{origin:o,entry:s,firstSeq:c,streaming:l}of e.entries)if(o===`v2`&&s.kind===`message`){let e=n(s.text);r.add(e),i.push(e),t&&l===!0&&a.push({norm:e,firstSeq:c})}if(i.length===0)return;r.add(i.join(``));let o=[],s={entries:[],texts:[]},c=()=>{let e=n(s.texts.join(``)),t=s.entries[0],i=s.entries.length>=2&&r.has(e);if(t&&(i||Wt(a,e,t.firstSeq))){s={entries:[],texts:[]};return}o.push(...s.entries),s={entries:[],texts:[]}};for(let t of e.entries)t.origin===`v1`&&t.entry.kind===`message`?(s.entries.push(t),s.texts.push(t.entry.text)):(c(),o.push(t));c(),e.entries=o}function Kt(e,t){let n=new Set;for(let{origin:t,entry:r}of e.entries)t===`v2`&&r.kind===`message`&&n.add($(r.text,!0).trim());n.size!==0&&(e.entries=e.entries.filter(e=>!(e.origin===`v1`&&e.entry.kind===`message`&&n.has($(e.entry.text,!0).trim()))),Gt(e,t))}function qt(e){let t=e.failures?.filter(e=>e.fatal&&e.cause!==``);if(!t||t.length===0)return;let n=new Map;for(let e of t)n.set(e.cause,e);e.entries=e.entries.filter(e=>{if(e.entry.kind!==`message`||e.entry.role!==`assistant`)return!0;let t=$(e.entry.text,!0).trim();if(t===``)return!0;let r=n.get(L(t));return r?(r.draft.firstSeq=Math.min(r.draft.firstSeq,e.firstSeq),r.draft.lastSeq=Math.max(r.draft.lastSeq,e.lastSeq),z(r,`assistant`,t),!1):!0})}function Jt(e){e.userMessage&&(e.entries=e.entries.filter(({entry:e})=>!f(e,`human`)))}function Yt(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 Xt(e,t,n){let{entry:r}=e;if(r.kind!==`message`||r.role!==`assistant`)return r;let i=$(r.text,t);return n&&e.streaming===!0?{...r,text:Ut(i),streaming:!0}:{...r,text:i}}function Zt(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(e=>Xt(e,n,t)),itemSeqs:Qt(e.entries)}}function Qt(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 $t(e,t={}){let n=Ne();for(let t of e)It(n,t);let r=n.turns.length-1;for(let[e,i]of n.turns.entries())i.v2Items&&Kt(i,t.activeTurn===!0&&e===r),qt(i),Jt(i);return Yt(n),{turns:n.turns.map((e,n)=>Zt(e,t.activeTurn===!0&&n===r)),...n.sessionEnded===void 0?{}:{sessionEnded:n.sessionEnded}}}export{je as a,f as c,fe as d,Bt as i,_e as l,$t as n,Ee as o,Rt as r,k as s,Lt as t,pe as u};
|
package/web/dist/assets/{use-hand-to-agent-state-DrAmCxn8.js → use-hand-to-agent-state-K864D69i.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{n as r,t as i}from"./utils-DSMR_WLb.js";import{m as a}from"./live-reads-Crd6fVGH.js";import{K as o,Mr as s,P as c,Z as l,at as u,pi as d,q as f,r as p,ti as m}from"./project-scope-context-Rv6S_BXt.js";import{n as h}from"./toaster-BXnLIU3z.js";import{A as g,Bt as _,Jt as v,Qt as y,St as b,Wt as x,_ as S,a as C,c as w,f as T,k as E}from"./queries-qCF-eOqZ.js";import{Y as D,c as O,ct as k,ft as A,g as j,it as M,k as N,l as P,m as ee,ot as F,r as I,tt as L,u as te,ut as R,y as ne}from"./design-icons-CzEoMH9c.js";import{t as re}from"./chevron-down-CHGyCDBH.js";import{t as z}from"./external-link-BE6y205O.js";import{t as ie}from"./eye-B8okNWXU.js";import{t as ae}from"./loader-circle-CPBhhDbB.js";import{t as oe}from"./message-square-B-MD-8rD.js";import{t as se}from"./play-CmVAj_fu.js";import{t as B}from"./button-B7MKxYjT.js";import{i as ce,r as le,t as ue}from"./popover-BPgUYFyu.js";import{a as de,i as fe,o as pe,r as me,s as he,t as ge}from"./dialog-B531GGAo.js";import{t as V}from"./project-router-CLJTc7gv.js";import{a as _e,i as H,o as U,r as ve,s as ye,t as be}from"./command-KdW7aO0N.js";import{a as W}from"./format-BU7D3IfE.js";import{d as xe,f as G,i as Se,o as Ce,p as we,s as Te,t as Ee,u as De}from"./skills-pM_PouEs.js";import{$ as Oe,F as ke,G as Ae,H as je,Hn as K,I as Me,J as Ne,K as Pe,L as Fe,M as Ie,N as Le,P as Re,U as ze,W as q,X as Be,Z as Ve,ar as He,et as Ue,it as We,j as Ge,nt as Ke,rt as qe,vn as Je,xn as Ye,xt as J}from"./index-CvVmG4Yu.js";import{t as Xe}from"./markdown-jle_P0a2.js";import{t as Ze}from"./textarea-vJt9undk.js";import{t as Qe}from"./diff-DKZvZQ2G.js";import{t as Y}from"./change-counts-CW7O8g5Y.js";import{t as $e}from"./tab-link-Bu1g-ArE.js";var X=e(t(),1),Z=n(),et={squash:`Squash and merge`,merge:`Create a merge commit`,rebase:`Rebase and merge`};function tt({state:e}){let t=`size-4 shrink-0`;return e===`passing`?(0,Z.jsx)(O,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-passing`,className:i(t,`text-success`)}):e===`failing`?(0,Z.jsx)(j,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-failing`,className:i(t,`text-danger`)}):e===`pending`?(0,Z.jsx)(ae,{"aria-hidden":`true`,"data-slot":`gh-merge-status-pending`,className:i(t,`animate-spin text-warning`)}):(0,Z.jsx)(ee,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-unknown`,className:i(t,`text-soft-foreground`)})}function nt(e){return e?.available?e.mergeState:null}function rt(e,t){return e&&t?.methods.includes(e)?e:t?.defaultMethod??t?.methods[0]??null}function it(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 at(e){return e===`approved`||e===`not-required`?`passing`:e===`unknown`?`unknown`:`failing`}function ot(e){return e===`mergeable`?`passing`:e===`conflicting`?`failing`:`unknown`}function st(e){return e===`conflicting`?`present`:e===`mergeable`?`none`:`unknown`}function ct(e){return e===!0?` · required`:e===null?` · requiredness unknown`:``}function lt(e){return e?.available===!1?e.reason:`GitHub could not load merge requirements.`}function ut(e,t,n){return!!(e&&(t.canMerge||t.canOverride&&n))}function dt(e){return e?et[e]:`Merge`}function ft(e){return e===`conflicting`?`true`:void 0}function pt({check:e}){return(0,Z.jsxs)(`li`,{className:`flex items-center justify-between gap-3`,children:[(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsx)(tt,{state:e.state}),(0,Z.jsxs)(`span`,{children:[e.name,` · `,e.state,ct(e.required)]})]}),e.url&&r(e.url)?(0,Z.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`text-muted-foreground underline`,children:`details`}):null]})}function mt({reason:e}){return(0,Z.jsxs)(`section`,{"data-slot":`gh-merge-unavailable`,className:`mt-6 rounded-lg border border-border bg-card p-4 text-sm`,children:[(0,Z.jsx)(`p`,{className:`font-medium`,children:`Merge status unavailable`}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-soft-foreground`,children:e})]})}function ht({state:e,selectedMethod:t,overrideRules:n,mergeEnabled:r,refreshPending:a,onRefresh:o,onRunAgent:s,onConfirm:c,onMethodChange:l,onOverrideChange:u}){let d=it(e),f=at(e.reviewDecision),p=ot(e.mergeable);return(0,Z.jsxs)(`div`,{className:`flex items-start gap-3`,children:[e.canMerge?(0,Z.jsx)(O,{size:16,"aria-hidden":`true`,className:`mt-0.5 size-5 shrink-0 text-success`}):(0,Z.jsx)(F,{size:16,"aria-hidden":`true`,className:`mt-0.5 size-5 shrink-0 text-warning`}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Z.jsx)(`h3`,{className:`font-semibold`,children:d}),(0,Z.jsxs)(B,{type:`button`,variant:`ghost`,size:`sm`,disabled:a,onClick:o,children:[(0,Z.jsx)(D,{size:16,"aria-hidden":`true`,className:i(`size-3.5`,a&&`animate-spin`)}),`Refresh`]})]}),(0,Z.jsxs)(`p`,{className:`mt-1 font-mono text-[11px] text-soft-foreground`,children:[e.headRef,` (`,e.headSha.slice(0,7),`) → `,e.baseRef]}),(0,Z.jsxs)(`ul`,{className:`mt-3 space-y-2 text-xs`,children:[(0,Z.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(tt,{state:f}),(0,Z.jsxs)(`span`,{children:[`Reviews: `,e.reviewDecision.replaceAll(`-`,` `)]})]}),(0,Z.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(tt,{state:p}),(0,Z.jsxs)(`span`,{children:[`Conflicts: `,st(e.mergeable)]})]}),e.checks.length===0?(0,Z.jsx)(`li`,{children:`No checks configured`}):e.checks.map(e=>(0,Z.jsx)(pt,{check:e},e.name)),e.blockers.map(e=>(0,Z.jsx)(`li`,{className:`text-soft-foreground`,children:e.message},e.code))]}),e.mergeable===`conflicting`&&s?(0,Z.jsx)(B,{className:`mt-4`,onClick:s,children:`Run agent on this PR`}):null,e.canOverride?(0,Z.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,Z.jsx)(`input`,{type:`checkbox`,checked:n,onChange:e=>u(e.target.checked),className:`mt-0.5 size-4 accent-accent-strong`}),(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`block font-medium`,children:`Merge without waiting for requirements`}),(0,Z.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,Z.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,Z.jsxs)(`div`,{className:`mt-4 flex flex-col flex-wrap gap-2 sm:flex-row`,children:[(0,Z.jsx)(`select`,{"aria-label":`Merge method`,value:t??``,onChange:e=>l(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,Z.jsx)(`option`,{value:e,children:et[e]},e))}),(0,Z.jsx)(B,{disabled:!r,onClick:c,children:dt(t)})]}):null]})]})}function gt({number:e,state:t,selectedMethod:n,confirming:r,overrideRules:i,mergePending:a,mergeError:o,onOpenChange:s,onMerge:c}){return(0,Z.jsx)(ge,{open:r,onOpenChange:s,children:(0,Z.jsxs)(me,{"data-slot":`gh-merge-confirm`,showCloseButton:!1,children:[(0,Z.jsxs)(pe,{children:[(0,Z.jsxs)(he,{children:[dt(n),` pull request #`,e,`?`]}),(0,Z.jsx)(fe,{asChild:!0,children:(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`p`,{children:[`This will merge “`,t.title,`” into `,t.baseRef,`. GitHub will re-check the exact reviewed head before changing the repository.`]}),i&&t.canOverride?(0,Z.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]})})]}),o?(0,Z.jsx)(`p`,{className:`text-sm text-danger`,children:o.message}):null,(0,Z.jsxs)(de,{children:[(0,Z.jsx)(B,{variant:`outline`,disabled:a,onClick:()=>s(!1),children:`Cancel`}),(0,Z.jsx)(B,{disabled:a,onClick:c,children:a?`Merging…`:dt(n)})]})]})})}function _t({number:e,onRunAgent:t}){let n=d(),r=T(),i=m({queryKey:_.githubMergeState(e),queryFn:({signal:t})=>f(e,{},{signal:t}),retry:!1}),a=nt(i.data),[o,s]=(0,X.useState)(null),[c,u]=(0,X.useState)(!1),[p,g]=(0,X.useState)(!1),v=y({mutationFn:t=>f(e,{refresh:!0}),onSuccess:(e,t)=>n.setQueryData(t,e),onError:e=>h(e instanceof Error?e.message:String(e),{tone:`danger`})}),b=rt(o,a),x=()=>({mergeState:_.githubMergeState(e),list:_.githubPages(50),comments:_.githubComments(`pr`,e),item:_.githubItem(`pr`,e),refStatus:r===void 0?void 0:_.githubRefStatusOf(r)}),S=y({mutationFn:t=>{if(!a||!b)throw Error(`No merge method is available.`);return l(e,{method:b,expectedHeadSha:a.headSha,...p&&a.canOverride?{overrideRules:!0}:{}})},onSuccess:(t,r)=>{u(!1),h(`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)=>{h(e instanceof Error?e.message:String(e),{tone:`danger`}),n.invalidateQueries({queryKey:t.mergeState})}});return i.isPending?(0,Z.jsx)(K,{"data-slot":`gh-merge-loading`,className:`mt-6 h-32 w-full`}):a?(0,Z.jsxs)(`section`,{"data-slot":`gh-merge-box`,"data-eligibility":a.eligibility,"data-conflicting":ft(a.mergeable),"aria-live":`polite`,className:`mt-6 rounded-lg border border-border bg-card p-4`,children:[(0,Z.jsx)(ht,{state:a,selectedMethod:b,overrideRules:p,mergeEnabled:ut(b,a,p),refreshPending:v.isPending,onRefresh:()=>v.mutate(_.githubMergeState(e)),onRunAgent:t,onConfirm:()=>u(!0),onMethodChange:s,onOverrideChange:g}),(0,Z.jsx)(gt,{number:e,state:a,selectedMethod:b,confirming:c,overrideRules:p,mergePending:S.isPending,mergeError:S.error,onOpenChange:u,onMerge:()=>S.mutate(x())})]}):(0,Z.jsx)(mt,{reason:lt(i.data)})}function vt(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 yt(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 bt(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 xt(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 St({label:e,color:t,plain:n=!1}){return(0,Z.jsx)(`span`,{"data-slot":`gh-label`,"data-label":e,style:n?void 0:xt(t),className:n?`text-xs font-normal text-muted-foreground`:`rounded-full border px-1.5 py-px text-[12px] font-medium`,children:e})}function Ct(e){return e===`pr`?`pull request`:`issue`}function wt(e,t,n){return e===`pr`&&!!(t||n)}function Tt({backLink:e}){return e?(0,Z.jsxs)(V,{to:e.to,"data-slot":`gh-back`,className:`mb-3 inline-flex items-center gap-1.5 text-xs font-medium text-muted-foreground hover:text-foreground md:hidden`,children:[(0,Z.jsx)(I,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`Back to the list`]}):null}var Et=i(`text-sm`,`[&_[data-streamdown="code-block"]]:relative [&_[data-streamdown="code-block"]]:my-2.5 [&_[data-streamdown="code-block"]]:gap-0 [&_[data-streamdown="code-block"]]:overflow-hidden [&_[data-streamdown="code-block"]]:rounded-lg [&_[data-streamdown="code-block"]]:border [&_[data-streamdown="code-block"]]:border-border [&_[data-streamdown="code-block"]]:bg-background [&_[data-streamdown="code-block"]]:p-0 [&_[data-streamdown="code-block"]]:![content-visibility:visible] [&_[data-streamdown="code-block"]]:![contain-intrinsic-size:auto]`,`[&_[data-streamdown="code-block-header"]]:h-7 [&_[data-streamdown="code-block-header"]]:border-b [&_[data-streamdown="code-block-header"]]:border-border [&_[data-streamdown="code-block-header"]]:bg-muted/40 [&_[data-streamdown="code-block-header"]]:px-3 [&_[data-streamdown="code-block-header"]]:text-[11px]`,`[&_[data-streamdown="code-block-header"][data-language=""]]:hidden [&_[data-streamdown="code-block-header"]:not([data-language])]:hidden [&_[data-streamdown="code-block-header"]:has(>span:empty)]:hidden`,`[&_[data-streamdown="code-block"]>*:has([data-streamdown="code-block-actions"])]:absolute [&_[data-streamdown="code-block"]>*:has([data-streamdown="code-block-actions"])]:top-1 [&_[data-streamdown="code-block"]>*:has([data-streamdown="code-block-actions"])]:right-1.5 [&_[data-streamdown="code-block"]>*:has([data-streamdown="code-block-actions"])]:mt-0 [&_[data-streamdown="code-block"]>*:has([data-streamdown="code-block-actions"])]:h-auto`,`[&_[data-streamdown="code-block-actions"]]:border-0 [&_[data-streamdown="code-block-actions"]]:bg-transparent [&_[data-streamdown="code-block-actions"]]:p-0 [&_[data-streamdown="code-block-actions"]]:backdrop-blur-none`,`[&_[data-streamdown="image-fallback"]]:inline-flex [&_[data-streamdown="image-fallback"]]:rounded-md [&_[data-streamdown="image-fallback"]]:border [&_[data-streamdown="image-fallback"]]:border-dashed [&_[data-streamdown="image-fallback"]]:border-border [&_[data-streamdown="image-fallback"]]:bg-muted/40 [&_[data-streamdown="image-fallback"]]:px-3 [&_[data-streamdown="image-fallback"]]:py-2 [&_[data-streamdown="image-fallback"]]:not-italic [&_[data-streamdown="image-fallback"]]:after:content-["_—_open_on_GitHub_to_view"]`,`[&_[data-streamdown="code-block-body"]]:rounded-none [&_[data-streamdown="code-block-body"]]:border-0 [&_[data-streamdown="code-block-body"]]:bg-transparent [&_[data-streamdown="code-block-body"]]:px-3.5 [&_[data-streamdown="code-block-body"]]:py-2.5 [&_[data-streamdown="code-block-body"]]:pr-10`);function Dt(e){let t=Date.parse(e);return Number.isFinite(t)?new Date(t).toLocaleString():e}function Ot({item:e,kindWord:t,commentCount:n,hasDiffStat:i,additions:a,deletions:o}){return(0,Z.jsxs)(`p`,{"data-slot":`gh-meta`,className:`flex flex-wrap items-center gap-x-1.5 gap-y-1 text-xs text-muted-foreground`,children:[(0,Z.jsxs)(`span`,{className:`tabular-nums`,children:[`#`,e.number]}),`·`,(0,Z.jsx)(`span`,{children:t}),`·`,(0,Z.jsxs)(`span`,{children:[`opened by `,e.author]}),`·`,(0,Z.jsx)(`time`,{dateTime:e.createdAt,title:Dt(e.createdAt),children:W(e.createdAt)}),n?(0,Z.jsxs)(Z.Fragment,{children:[`·`,(0,Z.jsx)($t,{count:n})]}):null,i?(0,Z.jsxs)(Z.Fragment,{children:[`·`,(0,Z.jsx)(`span`,{"data-slot":`gh-diffstat`,children:(0,Z.jsx)(Y,{adds:a??0,dels:o??0})})]}):null,`·`,r(e.url)?(0,Z.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,Z.jsx)(z,{"aria-hidden":`true`,className:`size-2.5`})]}):(0,Z.jsx)(`span`,{"data-slot":`gh-open-link`,className:`text-muted-foreground`,children:`open on GitHub`})]})}function kt({item:e,subNav:t,changes:n}){return e.kind===`pr`?t?(0,Z.jsxs)(`nav`,{"aria-label":`Pull request detail`,className:`mt-4 flex border-b border-border`,children:[(0,Z.jsx)($e,{to:J(`prs`,t.filter,e.number),active:!n,children:`Conversation`}),(0,Z.jsx)($e,{to:J(`prs`,t.filter,e.number,`/changes`),active:n,children:`Changes`})]}):(0,Z.jsx)(V,{to:J(`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 At({item:e,colors:t,checks:n}){return e.labels.length>0||n?(0,Z.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-1.5`,children:[e.labels.map(e=>(0,Z.jsx)(St,{label:e,color:t[e]},e)),n?(0,Z.jsx)(en,{checks:n,url:e.url}):null]}):null}function jt({item:e,colors:t,body:n}){return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{"data-slot":`gh-body`,className:i(`mt-5`,Et),children:n?(0,Z.jsx)(Xe,{children:n}):(0,Z.jsx)(`p`,{className:`text-muted-foreground`,children:`(no description)`})}),(0,Z.jsx)(Ft,{item:e,colors:t})]})}function Mt({item:e,colors:t,checks:n,comments:r,backLink:i,subNav:a,onRunAgent:o,afterHeading:s,headerAction:c,children:l}){let u=a?.changes??!1,d=Ct(e.kind),f=C(e.kind,e.number,!u).data?.detail,p=f?.body??e.body,m=f?.additions??e.additions,h=f?.deletions??e.deletions,g=wt(e.kind,m,h),_=r??e.comments;return(0,Z.jsxs)(`article`,{"data-slot":`gh-detail-inner`,className:`min-w-0 px-4 py-4 md:px-7 md:py-5`,children:[(0,Z.jsx)(Tt,{backLink:i}),(0,Z.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,Z.jsx)(Nt,{action:c,className:`mb-4`,children:(0,Z.jsxs)(`h2`,{className:`min-w-0 text-[22px] leading-snug font-semibold tracking-tight`,children:[`#`,e.number,` `,e.title]})}):null,(0,Z.jsx)(Nt,{action:e.kind===`pr`?void 0:c,children:(0,Z.jsx)(Ot,{item:e,kindWord:d,commentCount:_,hasDiffStat:g,additions:m,deletions:h})}),e.kind===`pr`?null:(0,Z.jsx)(`h2`,{className:`mt-2 text-[22px] leading-snug font-semibold tracking-tight`,children:e.title}),s,(0,Z.jsx)(kt,{item:e,subNav:a,changes:u}),(0,Z.jsx)(At,{item:e,colors:t,checks:n}),u&&e.kind===`pr`?(0,Z.jsx)(Pt,{item:e}):(0,Z.jsx)(jt,{item:e,colors:t,body:p})]}),e.kind===`pr`?(0,Z.jsx)(_t,{number:e.number,onRunAgent:o}):null,l]})}function Nt({action:e,className:t,children:n}){return e?(0,Z.jsxs)(`div`,{"data-slot":`gh-header-row`,className:i(`flex flex-wrap items-center gap-x-3 gap-y-2`,t),children:[(0,Z.jsx)(`div`,{className:`min-w-0 flex-1`,children:n}),(0,Z.jsx)(`div`,{"data-slot":`gh-header-action`,className:`flex shrink-0 items-center gap-2`,children:e})]}):t?(0,Z.jsx)(`div`,{className:t,children:n}):(0,Z.jsx)(Z.Fragment,{children:n})}function Pt({item:e}){let t=d(),n=w(e.number),[a,s]=(0,X.useState)(``),[c,l]=(0,X.useState)(null),u=n.data,f=e=>u?.available?u.files.filter(t=>t.path.toLowerCase().includes(e.toLowerCase())):[],p=f(a),m=p.some(e=>e.path===c)?c:p[0]?.path??null,g=p.findIndex(e=>e.path===m),v=e=>{s(e);let t=f(e),n=m??c,r=t.some(e=>e.path===n)?n:t[0]?.path??n;r!==c&&l(r)},y=async()=>{let n=u?.available?u.headSha:null,r=_.githubPrChanges(e.number),i=await o(e.number,{refresh:!0});t.setQueryData(r,i),i.available&&n&&n!==i.headSha&&(l(i.files[0]?.path??null),h(`The reviewed revision changed.`))};if(n.isPending)return(0,Z.jsx)(`p`,{"aria-live":`polite`,className:`mt-6 text-sm text-muted-foreground`,children:`Loading changed files…`});if(n.isError||!u)return(0,Z.jsx)(`p`,{className:`mt-6 text-sm text-danger`,children:`Changed files could not be loaded.`});if(!u.available)return(0,Z.jsx)(`p`,{className:`mt-6 text-sm text-muted-foreground`,children:u.reason});let b=p.map(e=>({path:e.path,...e.previousPath?{oldPath:e.previousPath}:{},status:e.status===`removed`?`deleted`:e.status===`changed`?`modified`:e.status,adds:e.additions,dels:e.deletions,binary:e.patchUnavailableReason===`binary`,patch:e.patch??``})),x=r(e.url)?`${e.url}/files`:null,S=p.find(e=>e.path===m);return(0,Z.jsxs)(`section`,{"data-slot":`gh-pr-changes`,className:`mt-5 min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs`,children:[(0,Z.jsxs)(`strong`,{children:[u.files.length,` changed files`]}),(0,Z.jsx)(Y,{adds:u.additions,dels:u.deletions}),(0,Z.jsxs)(`span`,{className:`font-mono text-muted-foreground`,title:u.headSha,children:[`head `,u.headSha.slice(0,8)]}),(0,Z.jsx)(B,{type:`button`,variant:`outline`,size:`sm`,className:`ml-auto min-h-11`,onClick:()=>void y(),children:`Refresh`})]}),u.truncated?(0,Z.jsxs)(`p`,{role:`status`,className:`mt-3 rounded-md border border-warning/40 bg-warning/10 p-3 text-xs`,children:[u.reason??`This response is incomplete.`,` `,x?(0,Z.jsx)(`a`,{href:x,target:`_blank`,rel:`noopener noreferrer`,className:`underline`,children:`Open all files on GitHub`}):null]}):null,(0,Z.jsxs)(`div`,{className:`mt-4 grid min-w-0 gap-4 lg:grid-cols-[240px_minmax(0,1fr)]`,children:[(0,Z.jsxs)(`aside`,{className:`min-w-0`,children:[(0,Z.jsx)(`input`,{"aria-label":`Filter changed files`,value:a,onChange:e=>v(e.target.value),placeholder:`Filter files…`,className:`min-h-11 w-full rounded-md border border-input bg-background px-3 text-sm`}),(0,Z.jsxs)(`div`,{className:`relative mt-2 lg:hidden`,children:[(0,Z.jsx)(`select`,{"aria-label":`Select changed file`,value:m??``,onChange:e=>l(e.target.value),className:`min-h-11 w-full appearance-none rounded-md border border-input bg-background py-2 pr-8 pl-3 text-sm`,children:p.map(e=>(0,Z.jsx)(`option`,{children:e.path},e.path))}),(0,Z.jsx)(re,{"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 right-2.5 size-4 -translate-y-1/2 text-muted-foreground`})]}),(0,Z.jsx)(`ul`,{className:`mt-2 hidden max-h-[60vh] overflow-auto lg:block`,children:p.map(e=>(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>l(e.path),className:i(`min-h-11 w-full truncate rounded px-2 text-left text-xs`,m===e.path&&`bg-muted font-medium`),title:e.path,children:[e.status,` · `,e.path,` `,(0,Z.jsx)(Y,{adds:e.additions,dels:e.deletions})]})},e.path))})]}),(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`mb-2 flex justify-end gap-1`,children:[(0,Z.jsx)(B,{"aria-label":`Previous file`,variant:`outline`,size:`icon`,className:`min-h-11 min-w-11`,disabled:g<=0,onClick:()=>l(p[g-1]?.path??null),children:(0,Z.jsx)(He,{})}),(0,Z.jsx)(B,{"aria-label":`Next file`,variant:`outline`,size:`icon`,className:`min-h-11 min-w-11`,disabled:g<0||g>=p.length-1,onClick:()=>l(p[g+1]?.path??null),children:(0,Z.jsx)(te,{size:16})})]}),p.length===0?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No changed files match this filter.`}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Qe,{files:b.filter(e=>e.path===m),wrap:!0,className:`min-w-0`}),S&&!S.patch?(0,Z.jsxs)(`p`,{className:`rounded-b border border-border p-3 text-xs text-muted-foreground`,children:[`Patch unavailable: `,S.patchUnavailableReason??`not-provided`,`.`]}):null]})]})]})]})}function Ft({item:e,colors:t}){let n=C(e.kind,e.number),r=n.data,i=(0,X.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(It(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,Z.jsxs)(`section`,{"data-slot":`gh-thread-loading`,className:`mt-6 border-t border-border pt-5`,children:[(0,Z.jsx)(K,{className:`mb-3 h-3 w-24`}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Z.jsx)(K,{className:`h-14 w-full`}),(0,Z.jsx)(K,{className:`h-14 w-full`})]})]}):!r||!r.available?(0,Z.jsxs)(`section`,{"data-slot":`gh-thread-error`,className:`mt-6 border-t border-border pt-5 text-xs text-muted-foreground`,children:[(0,Z.jsxs)(`span`,{children:[`Couldn’t load comments — `,r?.reason??(n.error instanceof Error?n.error.message:`could not load comments`),`. `]}),(0,Z.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,Z.jsx)(z,{"aria-hidden":`true`,className:`size-2.5`})]})]}):i.length===0?null:(0,Z.jsxs)(`section`,{"data-slot":`gh-thread`,className:`mt-6 border-t border-border pt-5`,children:[(0,Z.jsxs)(`h3`,{"data-slot":`gh-thread-header`,className:`mb-4 text-[11px] font-semibold tracking-wide text-muted-foreground uppercase`,children:[`Activity · `,r.comments.length,` comment`,r.comments.length===1?``:`s`]}),(0,Z.jsx)(`ul`,{className:`flex flex-col gap-5`,children:Lt(i).map(e=>e.group===`commits`?(0,Z.jsx)(Rt,{commits:e.commits,colors:t},e.commits[0].id):e.entry.row===`comment`?(0,Z.jsx)(Yt,{comment:e.entry.comment},`${e.entry.comment.kind}-${e.entry.comment.id}`):(0,Z.jsx)(Bt,{event:e.entry.event,colors:t},e.entry.event.id))}),r.truncated?(0,Z.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-muted-foreground hover:text-foreground hover:underline`,children:[`thread truncated — open on GitHub`,(0,Z.jsx)(z,{"aria-hidden":`true`,className:`size-2.5`})]}):null]})}var It=e=>e.row===`comment`?e.comment.createdAt:e.event.createdAt;function Lt(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 Rt({commits:e,colors:t}){let[n,r]=(0,X.useState)(!1),i=e[0]?.actor??`?`;return n?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`true`,className:`min-w-0`,children:(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":!0,onClick:()=>r(!1),className:`flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground`,children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:zt.committed}),(0,Z.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,Z.jsxs)(`span`,{children:[`added `,e.length,` commits`]})]})}),e.map(e=>(0,Z.jsx)(Bt,{event:e,colors:t},e.id))]}):(0,Z.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`false`,className:`min-w-0`,children:(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":!1,onClick:()=>r(!0),className:`flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground`,children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:zt.committed}),(0,Z.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,Z.jsxs)(`span`,{children:[`added `,e.length,` commits`]}),(0,Z.jsx)(`span`,{className:`shrink-0`,children:W(e[e.length-1].createdAt)})]})})}var zt={committed:`⚙`,labeled:`◆`,unlabeled:`◇`,assigned:`◍`,unassigned:`◌`,merged:`⑃`,closed:`⊘`,reopened:`⊙`,head_ref_force_pushed:`↻`,"cross-referenced":`↗`,renamed:`✎`};function Bt({event:e,colors:t}){return(0,Z.jsxs)(`li`,{"data-slot":`gh-event-row`,"data-kind":e.kind,className:i(`flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground`,e.kind===`merged`&&`text-accent-foreground`),children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0`,children:zt[e.kind]}),(0,Z.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.actor}),(0,Z.jsx)(Kt,{event:e,colors:t}),(0,Z.jsx)(`span`,{className:`shrink-0`,children:W(e.createdAt)}),e.url?(0,Z.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,Z.jsx)(z,{"aria-hidden":`true`,className:`size-2.5`})}):null]})}function Vt({event:e}){return(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`shrink-0`,children:`committed`}),e.sha?(0,Z.jsx)(`span`,{className:`shrink-0 font-mono text-[11px] text-muted-foreground`,children:e.sha.slice(0,7)}):null,e.message?(0,Z.jsx)(`span`,{className:`truncate font-sans text-foreground`,children:e.message}):null,(0,Z.jsx)(qt,{checks:e.checks})]})}function Ht({event:e,colors:t}){return(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`shrink-0`,children:e.kind===`labeled`?`added the`:`removed the`}),e.label?(0,Z.jsx)(`span`,{"data-slot":`gh-event-label`,style:xt(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,Z.jsx)(`span`,{className:`shrink-0`,children:`label`})]})}function Ut({event:e}){return(0,Z.jsxs)(`span`,{className:`truncate`,children:[e.kind===`assigned`?`assigned`:`unassigned`,` `,e.subject??`someone`]})}function Wt({event:e}){return(0,Z.jsxs)(`span`,{className:`truncate`,children:[`referenced this in `,e.refNumber?`#${e.refNumber}`:`another thread`,e.refTitle?` ${e.refTitle}`:``]})}var Gt={committed:e=>(0,Z.jsx)(Vt,{event:e}),labeled:(e,t)=>(0,Z.jsx)(Ht,{event:e,colors:t}),unlabeled:(e,t)=>(0,Z.jsx)(Ht,{event:e,colors:t}),assigned:e=>(0,Z.jsx)(Ut,{event:e}),unassigned:e=>(0,Z.jsx)(Ut,{event:e}),merged:()=>(0,Z.jsx)(`span`,{children:`merged this`}),closed:()=>(0,Z.jsx)(`span`,{children:`closed this`}),reopened:()=>(0,Z.jsx)(`span`,{children:`reopened this`}),head_ref_force_pushed:()=>(0,Z.jsx)(`span`,{children:`force-pushed`}),renamed:e=>(0,Z.jsxs)(`span`,{className:`truncate`,children:[`renamed this to `,e.subject??`—`]}),"cross-referenced":e=>(0,Z.jsx)(Wt,{event:e})};function Kt({event:e,colors:t}){return Gt[e.kind]?.(e,t)??null}function qt({checks:e}){return e?(0,Z.jsx)(`span`,{"data-slot":`gh-commit-checks`,"data-checks":e,"aria-label":`checks ${e}`,className:i(`shrink-0`,Qt[e]),children:Zt[e]}):null}var Jt={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 Yt({comment:e}){let t=e.reviewState?Jt[e.reviewState]:null;return(0,Z.jsxs)(`li`,{"data-slot":`gh-thread-entry`,"data-kind":e.kind,className:`min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`mb-1.5 flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,Z.jsx)(Xt,{url:e.avatarUrl,login:e.author}),(0,Z.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.author}),(0,Z.jsx)(`span`,{children:W(e.createdAt)}),t?(0,Z.jsx)(`span`,{"data-slot":`gh-review-chip`,"data-review-state":e.reviewState,className:i(`rounded-full border px-1.5 py-px font-sans text-[12px] font-medium`,t.tone),children:t.label}):null,(0,Z.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,Z.jsx)(z,{"aria-hidden":`true`,className:`size-2.5`})})]}),(0,Z.jsx)(`div`,{"data-slot":`gh-thread-body`,className:Et,children:e.body?(0,Z.jsx)(Xe,{children:e.body}):(0,Z.jsx)(`p`,{className:`text-muted-foreground`,children:`(no body)`})})]})}function Xt({url:e,login:t}){let[n,r]=(0,X.useState)(!1);return e&&!n?(0,Z.jsx)(`img`,{src:e,alt:``,width:20,height:20,loading:`lazy`,onError:()=>r(!0),"data-slot":`gh-avatar`,className:`size-5 shrink-0 rounded-full`}):(0,Z.jsx)(`span`,{"data-slot":`gh-avatar-fallback`,"aria-hidden":`true`,className:`flex size-5 shrink-0 items-center justify-center rounded-full bg-muted text-[11px] font-semibold text-muted-foreground uppercase`,children:t.slice(0,1)||`?`})}var Zt={passing:`✓`,failing:`✗`,pending:`○`},Qt={passing:`text-success`,failing:`text-danger`,pending:`text-muted-foreground`};function $t({count:e}){return e?(0,Z.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,Z.jsx)(oe,{"aria-hidden":`true`,className:`size-3`}),e]}):null}function en({checks:e,url:t}){let n=i(`text-[11px] font-medium`,Qt[e],t&&`hover:underline`),r=`${Zt[e]} checks ${e}`;return t?(0,Z.jsx)(`a`,{href:`${t}/checks`,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-checks`,"data-checks":e,className:n,children:r}):(0,Z.jsx)(`span`,{"data-slot":`gh-checks`,"data-checks":e,className:n,children:r})}function tn({checks:e}){return(0,Z.jsx)(`span`,{"data-slot":`gh-row-checks`,"data-checks":e,title:`checks ${e}`,"aria-label":`checks ${e}`,className:i(`shrink-0 font-sans text-[11px] font-semibold`,Qt[e]),children:Zt[e]})}function Q(e){return`${e.kind===`pr`?`Address GitHub pull request`:`Fix GitHub issue`} #${e.number}: ${e.title}\n\n${e.url}`}function nn(e,t=[]){let n=Q(e);return e.body?.trim()&&(n+=`\n\n---\n\n${e.body.trim()}`),t.length&&(n+=rn(t)),n}function rn(e){return`\n\nUse these skills where relevant: ${e.join(`, `)}.`}function an(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 on(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 sn(e,t,n){let r=(n??``).trim();if(!r)return nn(e,t);let i=Q(e),a=r.startsWith(i)?i+an(r.slice(i.length),e):an(r,e),o=on(a,e)?a:`${i}\n\n${a}`;return t.length?o+rn(t):o}function cn(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 ln(e,t,n,r,i={}){return t?{...i,workflow:t,task:sn(e,n.map(e=>e.id),r)}:n.length?{...i,steps:cn(n.map(e=>e.id)).map((e,t)=>({...e,...n[t]?.path===void 0?{}:{skillPath:n[t].path}})),task:sn(e,[],r)}:{...i,workflow:`quick-task`,task:sn(e,[],r)}}function un(e){let t=b(),n=S(),r=a(),{runners:i,uninstalled:o,signedOut:s,accounts:c,repoAccount:l,accountFor:u}=Ye(),d=n.data?.defaultRunner,f=Me(e.runner,i,d??i[0]??`claude`),p=n.data?.modelsLocked===!0,m=u(f,e.account),h=v(f,!0,m??l?.[f]),g=ke(p?null:e.model,f,r.data,n.data?.defaultModels,h.data),_=Ie(g,h.data);return{runner:f,runnerExplicit:e.runner!==null,model:g,effort:p?``:Re(e.effort,_),effortOptions:_,runners:i,uninstalled:o,signedOut:s,defaultRunner:d,canRun:t.isSuccess&&i.length>0,modelsLocked:p,providerPending:t.isPending,providerError:t.isError,accounts:c,account:m,repoAccount:l}}function dn(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 fn(e){return{...dn(e),...e.account?{agentProfile:e.account}:{}}}function pn(e,t){let{runners:n,uninstalled:r,signedOut:i}=e;return n.length>1||r.length>0||i.length>0||n.some(e=>Je(t,e))}function mn({pick:e,onChange:t,disabled:n=!1,accounts:r=!1,layout:i}){let o=(0,X.useRef)(null),s=(0,X.useRef)(null),[c,l]=(0,X.useState)(()=>typeof window<`u`&&window.innerWidth<=767);(0,X.useLayoutEffect)(()=>{let e=o.current;if(i!==`row`||!e)return;let t=()=>{let t=window.innerWidth<=767||e.getBoundingClientRect().width<550,n=document.activeElement;s.current=n instanceof HTMLElement&&e.contains(n)?n:null,l(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,X.useLayoutEffect)(()=>{let e=s.current;s.current=null,e&&e.isConnected&&document.activeElement!==e&&e.focus()},[c]);let u=un(e),{runner:d,model:f,effort:p,effortOptions:m,runners:h,canRun:g,modelsLocked:_}=u,y=S(),b=a(),x=v(d,!0,u.account??u.repoAccount?.[d]),C=Le(d,b.data,x.data,[e.model,y.data?.defaultModels?.[d]]),w=n||!g,T=r?u.accounts:[],E=pn(u,T)?(0,Z.jsx)(Pe,{icon:(0,Z.jsx)(M,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,runners:h,uninstalled:u.uninstalled,signedOut:u.signedOut,value:d,accounts:T,account:r?u.account:null,repoAccount:r?u.repoAccount:void 0,disabled:w,onPick:(n,i)=>t(r?{runner:n,account:i,model:n===d?e.model:null,effort:e.effort}:{runner:n,account:null,model:null,effort:e.effort})},`runner`):null,D=(0,Z.jsx)(q,{icon:(0,Z.jsx)(ne,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,slot:`model-pill`,ariaLabel:`Model`,label:f===``?`Default`:C.find(e=>e.id===f).label,value:f,disabled:w,readOnly:_===!0,disabledHint:_?`Model selection is locked to native coding-agent settings.`:void 0,onPick:n=>{let r=Ie(n,x.data);t({...e,model:n,effort:e.effort===null?null:Re(e.effort,r)})},options:C.map(e=>({value:e.id,label:e.label,desc:e.desc})),status:Ge(d,b.data,x)},`model`),O=(0,Z.jsx)(q,{icon:(0,Z.jsx)(N,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,slot:`effort-pill`,ariaLabel:`Effort`,label:m.find(e=>e.value===p)?.label??`auto`,value:p,disabled:w,readOnly:_===!0,disabledHint:_?`Effort selection is locked to native coding-agent settings.`:void 0,onPick:n=>t({...e,effort:n}),options:m.map(e=>({value:e.value,label:e.label,desc:e.desc}))},`effort`);return i===`row`?(0,Z.jsx)(`div`,{ref:o,"data-slot":`engine-row-box`,children:(0,Z.jsx)(`div`,{"data-slot":`engine-row`,className:`engine-row`,role:`group`,"aria-label":`Agent settings`,children:(0,Z.jsx)(Ae,{fill:`model-pill`,children:c?[E,O,D]:[E,D,O]})})}):(0,Z.jsxs)(Ae,{children:[E,D,O]})}var hn={workflow:null,skills:[]},gn=`cez-followup-selection`;function _n(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 vn(){try{let e=localStorage.getItem(gn);return e?_n(JSON.parse(e)):{...hn}}catch{return{...hn}}}function yn(e){try{localStorage.setItem(gn,JSON.stringify(e))}catch{}}var $=`cez-followup-prompt:`;function bn(e){try{return localStorage.getItem($+e)??``}catch{return``}}function xn(e,t){try{t===``?localStorage.removeItem($+e):localStorage.setItem($+e,t)}catch{}}function Sn({item:e,workflows:t,skills:n,workflow:i,onWorkflowChange:a,selectedSkills:o,onSkillsChange:s,engine:l,onEngineChange:f,queuedRunId:p,onQueued:m}){let g=d(),v=E(),b=e.kind===`pr`?`PR`:`issue`,S=un(l),C=x(S.runner,S.account),w=o.filter(e=>C.unchecked||e.path===void 0||n.some(t=>t.id===e.id&&(e.path===void 0||t.path===e.path))),T=w.length!==o.length,[D]=(0,X.useState)(()=>Q(e)),[k,A]=(0,X.useState)(()=>bn(e.url)||D),j=(0,X.useRef)(null),M=(0,X.useRef)(null);(0,X.useEffect)(()=>{xn(e.url,k===D?``:k)},[e.url,k,D]);let N=(0,X.useMemo)(()=>Ke(v.data?.promptTemplates),[v.data?.promptTemplates]),P=e=>{let t=j.current,n=We({prompt:k,base:D,selectionStart:t?.selectionStart??null,focused:document.activeElement===t,remembered:M.current}),r=Ue(k,n,e);A(r.text),M.current=r.caret,requestAnimationFrame(()=>{j.current?.focus(),j.current?.setSelectionRange(r.caret,r.caret)})},ee=Oe(N,w.map(e=>e.id)),F=(0,X.useRef)(k);F.current=k;let I=(0,X.useRef)(``);(0,X.useEffect)(()=>{let e=qe(F.current,I.current,ee,D);I.current=e.applied,e.text!==F.current&&A(e.text)},[ee,D]);let L=y({mutationFn:async()=>!S.canRun||T?null:u(ln(e,i,w,k,fn(S))),onSuccess:t=>{if(t===null)return;let n=t;n&&m(e.url,n.id),h(`Added to the queue — ${b} #${e.number}`),w.length>0&&v.data!==void 0&&c({skillUsage:w.reduce((e,t)=>Ee(e,t.id),v.data.skillUsage)}).then(()=>g.invalidateQueries({queryKey:_.uiState})).catch(()=>{}),xn(e.url,``),A(D),I.current=``,g.invalidateQueries({queryKey:_.runs.all})},onError:e=>h(e.message,{tone:`danger`})}),te=e=>{Be({key:e.key,shiftKey:e.shiftKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,repeat:e.repeat,isComposing:e.nativeEvent.isComposing})&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),!L.isPending&&S.canRun&&L.mutate())},R=e=>s(o.some(t=>G(t)===G(e))?o.filter(t=>G(t)!==G(e)):[...o,Te(e)]);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`section`,{"data-slot":`gh-hand`,className:`mt-7 rounded-lg border border-border bg-card p-4`,children:[(0,Z.jsx)(`h3`,{className:`text-xl font-normal text-foreground`,children:`Hand this to the agent`}),(0,Z.jsxs)(`label`,{className:`gh-field gh-prompt-field`,children:[(0,Z.jsx)(`span`,{children:`Instructions for the agent`}),(0,Z.jsx)(Ze,{ref:j,"data-slot":`gh-custom-prompt`,"aria-label":`Custom prompt`,"aria-keyshortcuts":`Control+Enter Meta+Enter`,value:k,onChange:e=>A(e.target.value),onSelect:e=>{M.current=e.currentTarget.selectionStart},onKeyDown:te,placeholder:`Instructions for the agent… (#${e.number} and its link are always sent)`,className:`mt-3 min-h-20 text-[13px]`})]}),(0,Z.jsx)(ze,{templates:N,onInsert:P}),(0,Z.jsxs)(`div`,{className:`gh-handoff-settings`,children:[(0,Z.jsxs)(`div`,{className:`gh-field`,children:[(0,Z.jsx)(`span`,{children:`Workflow`}),(0,Z.jsx)(wn,{workflows:t,value:i,onChange:a})]}),(0,Z.jsxs)(`div`,{className:`gh-field`,children:[(0,Z.jsx)(`span`,{children:`Skills · select one or more`}),(0,Z.jsx)(En,{skills:n,skillUsage:v.data?.skillUsage,selected:o,onToggle:R})]}),o.length>0?(0,Z.jsx)(`div`,{"data-slot":`gh-skill-chips`,className:`mt-2.5 flex flex-wrap gap-1.5`,children:o.map(e=>(0,Z.jsx)(Cn,{skill:e,skills:n,unchecked:C.unchecked,onRemove:()=>R(e)},G(e)))}):null,T?(0,Z.jsx)(`p`,{role:`alert`,children:`A selected skill path is unavailable. Remove it or choose a current copy before starting.`}):null,(0,Z.jsx)(mn,{layout:`row`,pick:l,onChange:f,disabled:L.isPending||!S.canRun,accounts:!0}),(0,Z.jsxs)(`div`,{className:`gh-field`,children:[(0,Z.jsx)(`span`,{children:`Account`}),(0,Z.jsx)(Tn,{resolved:S,disabled:L.isPending||!S.canRun,onPick:e=>f({...l,account:e})})]}),!S.providerPending&&!S.canRun?(0,Z.jsxs)(`span`,{"data-slot":`gh-provider-gate`,className:`inline-flex flex-wrap items-center gap-1 text-xs text-muted-foreground`,children:[S.providerError?`Provider authentication could not be verified.`:`Connect an agent provider to run this item.`,(0,Z.jsx)(V,{to:`/settings/agent-defaults#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}):null]}),(0,Z.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,Z.jsxs)(`div`,{"data-slot":`gh-handoff-actions`,className:`mt-[22px] flex flex-wrap items-center gap-2.5`,children:[r(e.url)?(0,Z.jsx)(B,{asChild:!0,variant:`outline`,children:(0,Z.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,children:`Open in GitHub`})}):null,(0,Z.jsxs)(B,{variant:`primary`,"data-action":`gh-run`,disabled:L.isPending||!S.canRun||T,onClick:()=>L.mutate(),children:[(0,Z.jsx)(se,{"aria-hidden":`true`,className:`size-3.5`}),`Run agent on this `,b]}),(0,Z.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:Ve()}),p?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`span`,{"data-slot":`gh-queued`,className:`flex items-center gap-1 text-xs font-medium text-success`,children:[(0,Z.jsx)(O,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`queued`]}),(0,Z.jsx)(V,{to:`/tasks/${p}`,"data-slot":`gh-view-run`,className:`text-xs font-semibold text-accent-text hover:underline`,children:`View task →`})]}):null]})]})}function Cn({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,Z.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,Z.jsx)(A,{size:16,"aria-hidden":`true`,className:`size-3`})]})}function wn({workflows:e,value:t,onChange:n}){let[r,a]=(0,X.useState)(!1),[o,s]=(0,X.useState)(``),c=(0,X.useRef)(null),l=xe(e,o);return(0,Z.jsxs)(ue,{open:r,onOpenChange:e=>{a(e),e||s(``)},children:[(0,Z.jsx)(ce,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`gh-workflow-trigger`,"aria-label":`Choose a workflow`,className:i(Ne,t&&`border-foreground/60 font-mono text-[11px] font-semibold text-foreground`),children:[(0,Z.jsx)(R,{size:16,"aria-hidden":`true`,className:`size-3 shrink-0 text-accent-icon`}),(0,Z.jsx)(`span`,{className:`min-w-0 max-w-44 truncate`,children:t??`workflow`}),(0,Z.jsx)(P,{size:16,"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,Z.jsx)(le,{align:`start`,sideOffset:8,className:`w-[320px] max-w-[calc(100vw-2rem)] p-0`,children:(0,Z.jsxs)(be,{shouldFilter:!1,children:[(0,Z.jsx)(_e,{placeholder:`search workflows…`,value:o,onValueChange:s,onInput:()=>c.current?.scrollTo(0,0)}),(0,Z.jsxs)(ye,{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,Z.jsx)(ve,{children:`Nothing matches.`}):null,(0,Z.jsx)(H,{children:l.map(e=>{let r=t===e.name;return(0,Z.jsxs)(U,{value:`workflow ${e.name}`,keywords:we(e.name,e.description),"data-slot":`gh-workflow-option`,"data-workflow":e.name,onSelect:()=>{n(r?null:e.name),a(!1)},children:[(0,Z.jsx)(`span`,{className:`shrink-0 font-mono text-xs`,children:e.name}),e.description?(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,r?(0,Z.jsx)(O,{size:16,"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-link-foreground`}):null]},e.name)})})]})]})})]})}function Tn({resolved:e,disabled:t,onPick:n}){let r=e.accounts.filter(t=>t.provider===e.runner),i=[...r.some(e=>e.id==="default")?[]:[{value:s,label:`Default`}],...r.map(e=>({value:e.id,label:e.label,...e.configDir?{desc:e.configDir}:{}}))],a=e.account??e.repoAccount?.[e.runner]??`default`;return(0,Z.jsx)(q,{icon:(0,Z.jsx)(k,{"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 En({skills:e,skillUsage:t,selected:n,onToggle:r}){let[a,o]=(0,X.useState)(!1),[s,c]=(0,X.useState)(``),[l,u]=(0,X.useState)(null),d=(0,X.useRef)(null),{mostUsed:f,project:p,global:m,ranked:h}=De(e,s,t),g=(e,t)=>{let a=n.some(t=>G(t)===G(e));return(0,Z.jsxs)(U,{value:G(e),keywords:we(e.name,e.description),"data-slot":`gh-skill-option`,"data-skill":e.id,"data-selected":a?`true`:void 0,onSelect:()=>r(Te(e)),children:[(0,Z.jsx)(`span`,{className:i(`shrink-0 font-mono text-xs`,t&&`font-semibold`),children:e.name}),e.path?(0,Z.jsx)(`span`,{className:`min-w-0 truncate text-xs`,children:e.path}):null,e.description?(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,(0,Z.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,Z.jsx)(ie,{"aria-hidden":`true`,className:`size-3.5`})}),a?(0,Z.jsx)(O,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0 text-link-foreground`}):null]},G(e))};return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(je,{skill:l,onClose:()=>u(null)}),(0,Z.jsxs)(ue,{open:a,onOpenChange:e=>{o(e),e||c(``)},children:[(0,Z.jsx)(ce,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`gh-skills-trigger`,"aria-label":`Choose skills`,className:i(Ne,n.length>0&&`border-foreground/60 font-semibold text-foreground`),children:[(0,Z.jsx)(L,{size:16,"aria-hidden":`true`,className:`size-3 shrink-0 text-accent-icon`}),`skills`,n.length>0?` · ${n.length}`:``,(0,Z.jsx)(P,{size:16,"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,Z.jsx)(le,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,Z.jsxs)(be,{shouldFilter:!1,children:[(0,Z.jsx)(_e,{placeholder:`search skills…`,value:s,onValueChange:c,onInput:()=>d.current?.scrollTo(0,0)}),(0,Z.jsxs)(ye,{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,Z.jsx)(H,{children:(0,Z.jsxs)(U,{value:`typed-skill`,onSelect:()=>r({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,Z.jsx)(ve,{children:`Nothing matches.`}):null,h?h.length>0?(0,Z.jsx)(H,{children:h.map(e=>g(e,Se(e)))}):null:(0,Z.jsxs)(Z.Fragment,{children:[f.length>0?(0,Z.jsx)(H,{heading:`Most used`,children:f.map(e=>g(e,Se(e)))}):null,p.length>0?(0,Z.jsx)(H,{heading:`Project skills`,children:p.map(e=>g(e,!0))}):null,m.length>0?(0,Z.jsx)(H,{heading:`Global`,children:m.map(e=>g(e,!1))}):null]})]})]})})]})]})}var Dn=new WeakMap;function On(){let e=vn(),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)&&yn({workflow:t.workflow,skills:[...t.selectedSkills]}),n.forEach(e=>e())}}}function kn(){let e=d(),{projectId:t}=p(),n=Dn.get(e);n||Dn.set(e,n=new Map);let r=n.get(t);r||n.set(t,r=On());let{snapshot:i,subscribe:a,update:o}=r,s=(0,X.useSyncExternalStore)(a,i,i),c=g(),l=un(s.engine),u=x(l.runner,l.account),f=E(),m=c.data?.workflows;(0,X.useEffect)(()=>{m&&s.workflow!==null&&!m.some(e=>e.name===s.workflow)&&o({workflow:null})},[o,m,s.workflow]);let h=(0,X.useMemo)(()=>Ce(u.data??[],f.data?.skillUsage),[u.data,f.data?.skillUsage]);return{...s,workflows:c,skillList:h,skillsUnchecked:u.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{$t as a,Lt as c,xt as d,bt as f,tn as i,vt as l,Sn as n,Mt as o,nn as r,St as s,kn as t,yt 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{n as r,t as i}from"./utils-DSMR_WLb.js";import{m as a}from"./live-reads-Crd6fVGH.js";import{K as o,Mr as s,P as c,Z as l,at as u,pi as d,q as f,r as p,ti as m}from"./project-scope-context-Rv6S_BXt.js";import{n as h}from"./toaster-BXnLIU3z.js";import{A as g,Bt as _,Jt as v,Qt as y,St as b,Wt as x,_ as S,a as C,c as w,f as T,k as E}from"./queries-qCF-eOqZ.js";import{Y as D,c as O,ct as k,ft as A,g as j,it as M,k as N,l as P,m as ee,ot as F,r as I,tt as L,u as te,ut as R,y as ne}from"./design-icons-CzEoMH9c.js";import{t as re}from"./chevron-down-CHGyCDBH.js";import{t as z}from"./external-link-BE6y205O.js";import{t as ie}from"./eye-B8okNWXU.js";import{t as ae}from"./loader-circle-CPBhhDbB.js";import{t as oe}from"./message-square-B-MD-8rD.js";import{t as se}from"./play-CmVAj_fu.js";import{t as B}from"./button-B7MKxYjT.js";import{i as ce,r as le,t as ue}from"./popover-BPgUYFyu.js";import{a as de,i as fe,o as pe,r as me,s as he,t as ge}from"./dialog-B531GGAo.js";import{t as V}from"./project-router-CLJTc7gv.js";import{a as _e,i as H,o as U,r as ve,s as ye,t as be}from"./command-KdW7aO0N.js";import{a as W}from"./format-BU7D3IfE.js";import{d as xe,f as G,i as Se,o as Ce,p as we,s as Te,t as Ee,u as De}from"./skills-pM_PouEs.js";import{$ as Oe,F as ke,G as Ae,H as je,Hn as K,I as Me,J as Ne,K as Pe,L as Fe,M as Ie,N as Le,P as Re,U as ze,W as q,X as Be,Z as Ve,ar as He,et as Ue,it as We,j as Ge,nt as Ke,rt as qe,vn as Je,xn as Ye,xt as J}from"./index-DNQcTHxV.js";import{t as Xe}from"./markdown-9L65ixU6.js";import{t as Ze}from"./textarea-vJt9undk.js";import{t as Qe}from"./diff-hxqBOfZH.js";import{t as Y}from"./change-counts-CW7O8g5Y.js";import{t as $e}from"./tab-link-Bu1g-ArE.js";var X=e(t(),1),Z=n(),et={squash:`Squash and merge`,merge:`Create a merge commit`,rebase:`Rebase and merge`};function tt({state:e}){let t=`size-4 shrink-0`;return e===`passing`?(0,Z.jsx)(O,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-passing`,className:i(t,`text-success`)}):e===`failing`?(0,Z.jsx)(j,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-failing`,className:i(t,`text-danger`)}):e===`pending`?(0,Z.jsx)(ae,{"aria-hidden":`true`,"data-slot":`gh-merge-status-pending`,className:i(t,`animate-spin text-warning`)}):(0,Z.jsx)(ee,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-unknown`,className:i(t,`text-soft-foreground`)})}function nt(e){return e?.available?e.mergeState:null}function rt(e,t){return e&&t?.methods.includes(e)?e:t?.defaultMethod??t?.methods[0]??null}function it(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 at(e){return e===`approved`||e===`not-required`?`passing`:e===`unknown`?`unknown`:`failing`}function ot(e){return e===`mergeable`?`passing`:e===`conflicting`?`failing`:`unknown`}function st(e){return e===`conflicting`?`present`:e===`mergeable`?`none`:`unknown`}function ct(e){return e===!0?` · required`:e===null?` · requiredness unknown`:``}function lt(e){return e?.available===!1?e.reason:`GitHub could not load merge requirements.`}function ut(e,t,n){return!!(e&&(t.canMerge||t.canOverride&&n))}function dt(e){return e?et[e]:`Merge`}function ft(e){return e===`conflicting`?`true`:void 0}function pt({check:e}){return(0,Z.jsxs)(`li`,{className:`flex items-center justify-between gap-3`,children:[(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsx)(tt,{state:e.state}),(0,Z.jsxs)(`span`,{children:[e.name,` · `,e.state,ct(e.required)]})]}),e.url&&r(e.url)?(0,Z.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`text-muted-foreground underline`,children:`details`}):null]})}function mt({reason:e}){return(0,Z.jsxs)(`section`,{"data-slot":`gh-merge-unavailable`,className:`mt-6 rounded-lg border border-border bg-card p-4 text-sm`,children:[(0,Z.jsx)(`p`,{className:`font-medium`,children:`Merge status unavailable`}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-soft-foreground`,children:e})]})}function ht({state:e,selectedMethod:t,overrideRules:n,mergeEnabled:r,refreshPending:a,onRefresh:o,onRunAgent:s,onConfirm:c,onMethodChange:l,onOverrideChange:u}){let d=it(e),f=at(e.reviewDecision),p=ot(e.mergeable);return(0,Z.jsxs)(`div`,{className:`flex items-start gap-3`,children:[e.canMerge?(0,Z.jsx)(O,{size:16,"aria-hidden":`true`,className:`mt-0.5 size-5 shrink-0 text-success`}):(0,Z.jsx)(F,{size:16,"aria-hidden":`true`,className:`mt-0.5 size-5 shrink-0 text-warning`}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Z.jsx)(`h3`,{className:`font-semibold`,children:d}),(0,Z.jsxs)(B,{type:`button`,variant:`ghost`,size:`sm`,disabled:a,onClick:o,children:[(0,Z.jsx)(D,{size:16,"aria-hidden":`true`,className:i(`size-3.5`,a&&`animate-spin`)}),`Refresh`]})]}),(0,Z.jsxs)(`p`,{className:`mt-1 font-mono text-[11px] text-soft-foreground`,children:[e.headRef,` (`,e.headSha.slice(0,7),`) → `,e.baseRef]}),(0,Z.jsxs)(`ul`,{className:`mt-3 space-y-2 text-xs`,children:[(0,Z.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(tt,{state:f}),(0,Z.jsxs)(`span`,{children:[`Reviews: `,e.reviewDecision.replaceAll(`-`,` `)]})]}),(0,Z.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(tt,{state:p}),(0,Z.jsxs)(`span`,{children:[`Conflicts: `,st(e.mergeable)]})]}),e.checks.length===0?(0,Z.jsx)(`li`,{children:`No checks configured`}):e.checks.map(e=>(0,Z.jsx)(pt,{check:e},e.name)),e.blockers.map(e=>(0,Z.jsx)(`li`,{className:`text-soft-foreground`,children:e.message},e.code))]}),e.mergeable===`conflicting`&&s?(0,Z.jsx)(B,{className:`mt-4`,onClick:s,children:`Run agent on this PR`}):null,e.canOverride?(0,Z.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,Z.jsx)(`input`,{type:`checkbox`,checked:n,onChange:e=>u(e.target.checked),className:`mt-0.5 size-4 accent-accent-strong`}),(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`block font-medium`,children:`Merge without waiting for requirements`}),(0,Z.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,Z.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,Z.jsxs)(`div`,{className:`mt-4 flex flex-col flex-wrap gap-2 sm:flex-row`,children:[(0,Z.jsx)(`select`,{"aria-label":`Merge method`,value:t??``,onChange:e=>l(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,Z.jsx)(`option`,{value:e,children:et[e]},e))}),(0,Z.jsx)(B,{disabled:!r,onClick:c,children:dt(t)})]}):null]})]})}function gt({number:e,state:t,selectedMethod:n,confirming:r,overrideRules:i,mergePending:a,mergeError:o,onOpenChange:s,onMerge:c}){return(0,Z.jsx)(ge,{open:r,onOpenChange:s,children:(0,Z.jsxs)(me,{"data-slot":`gh-merge-confirm`,showCloseButton:!1,children:[(0,Z.jsxs)(pe,{children:[(0,Z.jsxs)(he,{children:[dt(n),` pull request #`,e,`?`]}),(0,Z.jsx)(fe,{asChild:!0,children:(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`p`,{children:[`This will merge “`,t.title,`” into `,t.baseRef,`. GitHub will re-check the exact reviewed head before changing the repository.`]}),i&&t.canOverride?(0,Z.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]})})]}),o?(0,Z.jsx)(`p`,{className:`text-sm text-danger`,children:o.message}):null,(0,Z.jsxs)(de,{children:[(0,Z.jsx)(B,{variant:`outline`,disabled:a,onClick:()=>s(!1),children:`Cancel`}),(0,Z.jsx)(B,{disabled:a,onClick:c,children:a?`Merging…`:dt(n)})]})]})})}function _t({number:e,onRunAgent:t}){let n=d(),r=T(),i=m({queryKey:_.githubMergeState(e),queryFn:({signal:t})=>f(e,{},{signal:t}),retry:!1}),a=nt(i.data),[o,s]=(0,X.useState)(null),[c,u]=(0,X.useState)(!1),[p,g]=(0,X.useState)(!1),v=y({mutationFn:t=>f(e,{refresh:!0}),onSuccess:(e,t)=>n.setQueryData(t,e),onError:e=>h(e instanceof Error?e.message:String(e),{tone:`danger`})}),b=rt(o,a),x=()=>({mergeState:_.githubMergeState(e),list:_.githubPages(50),comments:_.githubComments(`pr`,e),item:_.githubItem(`pr`,e),refStatus:r===void 0?void 0:_.githubRefStatusOf(r)}),S=y({mutationFn:t=>{if(!a||!b)throw Error(`No merge method is available.`);return l(e,{method:b,expectedHeadSha:a.headSha,...p&&a.canOverride?{overrideRules:!0}:{}})},onSuccess:(t,r)=>{u(!1),h(`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)=>{h(e instanceof Error?e.message:String(e),{tone:`danger`}),n.invalidateQueries({queryKey:t.mergeState})}});return i.isPending?(0,Z.jsx)(K,{"data-slot":`gh-merge-loading`,className:`mt-6 h-32 w-full`}):a?(0,Z.jsxs)(`section`,{"data-slot":`gh-merge-box`,"data-eligibility":a.eligibility,"data-conflicting":ft(a.mergeable),"aria-live":`polite`,className:`mt-6 rounded-lg border border-border bg-card p-4`,children:[(0,Z.jsx)(ht,{state:a,selectedMethod:b,overrideRules:p,mergeEnabled:ut(b,a,p),refreshPending:v.isPending,onRefresh:()=>v.mutate(_.githubMergeState(e)),onRunAgent:t,onConfirm:()=>u(!0),onMethodChange:s,onOverrideChange:g}),(0,Z.jsx)(gt,{number:e,state:a,selectedMethod:b,confirming:c,overrideRules:p,mergePending:S.isPending,mergeError:S.error,onOpenChange:u,onMerge:()=>S.mutate(x())})]}):(0,Z.jsx)(mt,{reason:lt(i.data)})}function vt(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 yt(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 bt(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 xt(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 St({label:e,color:t,plain:n=!1}){return(0,Z.jsx)(`span`,{"data-slot":`gh-label`,"data-label":e,style:n?void 0:xt(t),className:n?`text-xs font-normal text-muted-foreground`:`rounded-full border px-1.5 py-px text-[12px] font-medium`,children:e})}function Ct(e){return e===`pr`?`pull request`:`issue`}function wt(e,t,n){return e===`pr`&&!!(t||n)}function Tt({backLink:e}){return e?(0,Z.jsxs)(V,{to:e.to,"data-slot":`gh-back`,className:`mb-3 inline-flex items-center gap-1.5 text-xs font-medium text-muted-foreground hover:text-foreground md:hidden`,children:[(0,Z.jsx)(I,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`Back to the list`]}):null}var Et=i(`text-sm`,`[&_[data-streamdown="code-block"]]:relative [&_[data-streamdown="code-block"]]:my-2.5 [&_[data-streamdown="code-block"]]:gap-0 [&_[data-streamdown="code-block"]]:overflow-hidden [&_[data-streamdown="code-block"]]:rounded-lg [&_[data-streamdown="code-block"]]:border [&_[data-streamdown="code-block"]]:border-border [&_[data-streamdown="code-block"]]:bg-background [&_[data-streamdown="code-block"]]:p-0 [&_[data-streamdown="code-block"]]:![content-visibility:visible] [&_[data-streamdown="code-block"]]:![contain-intrinsic-size:auto]`,`[&_[data-streamdown="code-block-header"]]:h-7 [&_[data-streamdown="code-block-header"]]:border-b [&_[data-streamdown="code-block-header"]]:border-border [&_[data-streamdown="code-block-header"]]:bg-muted/40 [&_[data-streamdown="code-block-header"]]:px-3 [&_[data-streamdown="code-block-header"]]:text-[11px]`,`[&_[data-streamdown="code-block-header"][data-language=""]]:hidden [&_[data-streamdown="code-block-header"]:not([data-language])]:hidden [&_[data-streamdown="code-block-header"]:has(>span:empty)]:hidden`,`[&_[data-streamdown="code-block"]>*:has([data-streamdown="code-block-actions"])]:absolute [&_[data-streamdown="code-block"]>*:has([data-streamdown="code-block-actions"])]:top-1 [&_[data-streamdown="code-block"]>*:has([data-streamdown="code-block-actions"])]:right-1.5 [&_[data-streamdown="code-block"]>*:has([data-streamdown="code-block-actions"])]:mt-0 [&_[data-streamdown="code-block"]>*:has([data-streamdown="code-block-actions"])]:h-auto`,`[&_[data-streamdown="code-block-actions"]]:border-0 [&_[data-streamdown="code-block-actions"]]:bg-transparent [&_[data-streamdown="code-block-actions"]]:p-0 [&_[data-streamdown="code-block-actions"]]:backdrop-blur-none`,`[&_[data-streamdown="image-fallback"]]:inline-flex [&_[data-streamdown="image-fallback"]]:rounded-md [&_[data-streamdown="image-fallback"]]:border [&_[data-streamdown="image-fallback"]]:border-dashed [&_[data-streamdown="image-fallback"]]:border-border [&_[data-streamdown="image-fallback"]]:bg-muted/40 [&_[data-streamdown="image-fallback"]]:px-3 [&_[data-streamdown="image-fallback"]]:py-2 [&_[data-streamdown="image-fallback"]]:not-italic [&_[data-streamdown="image-fallback"]]:after:content-["_—_open_on_GitHub_to_view"]`,`[&_[data-streamdown="code-block-body"]]:rounded-none [&_[data-streamdown="code-block-body"]]:border-0 [&_[data-streamdown="code-block-body"]]:bg-transparent [&_[data-streamdown="code-block-body"]]:px-3.5 [&_[data-streamdown="code-block-body"]]:py-2.5 [&_[data-streamdown="code-block-body"]]:pr-10`);function Dt(e){let t=Date.parse(e);return Number.isFinite(t)?new Date(t).toLocaleString():e}function Ot({item:e,kindWord:t,commentCount:n,hasDiffStat:i,additions:a,deletions:o}){return(0,Z.jsxs)(`p`,{"data-slot":`gh-meta`,className:`flex flex-wrap items-center gap-x-1.5 gap-y-1 text-xs text-muted-foreground`,children:[(0,Z.jsxs)(`span`,{className:`tabular-nums`,children:[`#`,e.number]}),`·`,(0,Z.jsx)(`span`,{children:t}),`·`,(0,Z.jsxs)(`span`,{children:[`opened by `,e.author]}),`·`,(0,Z.jsx)(`time`,{dateTime:e.createdAt,title:Dt(e.createdAt),children:W(e.createdAt)}),n?(0,Z.jsxs)(Z.Fragment,{children:[`·`,(0,Z.jsx)($t,{count:n})]}):null,i?(0,Z.jsxs)(Z.Fragment,{children:[`·`,(0,Z.jsx)(`span`,{"data-slot":`gh-diffstat`,children:(0,Z.jsx)(Y,{adds:a??0,dels:o??0})})]}):null,`·`,r(e.url)?(0,Z.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,Z.jsx)(z,{"aria-hidden":`true`,className:`size-2.5`})]}):(0,Z.jsx)(`span`,{"data-slot":`gh-open-link`,className:`text-muted-foreground`,children:`open on GitHub`})]})}function kt({item:e,subNav:t,changes:n}){return e.kind===`pr`?t?(0,Z.jsxs)(`nav`,{"aria-label":`Pull request detail`,className:`mt-4 flex border-b border-border`,children:[(0,Z.jsx)($e,{to:J(`prs`,t.filter,e.number),active:!n,children:`Conversation`}),(0,Z.jsx)($e,{to:J(`prs`,t.filter,e.number,`/changes`),active:n,children:`Changes`})]}):(0,Z.jsx)(V,{to:J(`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 At({item:e,colors:t,checks:n}){return e.labels.length>0||n?(0,Z.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-1.5`,children:[e.labels.map(e=>(0,Z.jsx)(St,{label:e,color:t[e]},e)),n?(0,Z.jsx)(en,{checks:n,url:e.url}):null]}):null}function jt({item:e,colors:t,body:n}){return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{"data-slot":`gh-body`,className:i(`mt-5`,Et),children:n?(0,Z.jsx)(Xe,{children:n}):(0,Z.jsx)(`p`,{className:`text-muted-foreground`,children:`(no description)`})}),(0,Z.jsx)(Ft,{item:e,colors:t})]})}function Mt({item:e,colors:t,checks:n,comments:r,backLink:i,subNav:a,onRunAgent:o,afterHeading:s,headerAction:c,children:l}){let u=a?.changes??!1,d=Ct(e.kind),f=C(e.kind,e.number,!u).data?.detail,p=f?.body??e.body,m=f?.additions??e.additions,h=f?.deletions??e.deletions,g=wt(e.kind,m,h),_=r??e.comments;return(0,Z.jsxs)(`article`,{"data-slot":`gh-detail-inner`,className:`min-w-0 px-4 py-4 md:px-7 md:py-5`,children:[(0,Z.jsx)(Tt,{backLink:i}),(0,Z.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,Z.jsx)(Nt,{action:c,className:`mb-4`,children:(0,Z.jsxs)(`h2`,{className:`min-w-0 text-[22px] leading-snug font-semibold tracking-tight`,children:[`#`,e.number,` `,e.title]})}):null,(0,Z.jsx)(Nt,{action:e.kind===`pr`?void 0:c,children:(0,Z.jsx)(Ot,{item:e,kindWord:d,commentCount:_,hasDiffStat:g,additions:m,deletions:h})}),e.kind===`pr`?null:(0,Z.jsx)(`h2`,{className:`mt-2 text-[22px] leading-snug font-semibold tracking-tight`,children:e.title}),s,(0,Z.jsx)(kt,{item:e,subNav:a,changes:u}),(0,Z.jsx)(At,{item:e,colors:t,checks:n}),u&&e.kind===`pr`?(0,Z.jsx)(Pt,{item:e}):(0,Z.jsx)(jt,{item:e,colors:t,body:p})]}),e.kind===`pr`?(0,Z.jsx)(_t,{number:e.number,onRunAgent:o}):null,l]})}function Nt({action:e,className:t,children:n}){return e?(0,Z.jsxs)(`div`,{"data-slot":`gh-header-row`,className:i(`flex flex-wrap items-center gap-x-3 gap-y-2`,t),children:[(0,Z.jsx)(`div`,{className:`min-w-0 flex-1`,children:n}),(0,Z.jsx)(`div`,{"data-slot":`gh-header-action`,className:`flex shrink-0 items-center gap-2`,children:e})]}):t?(0,Z.jsx)(`div`,{className:t,children:n}):(0,Z.jsx)(Z.Fragment,{children:n})}function Pt({item:e}){let t=d(),n=w(e.number),[a,s]=(0,X.useState)(``),[c,l]=(0,X.useState)(null),u=n.data,f=e=>u?.available?u.files.filter(t=>t.path.toLowerCase().includes(e.toLowerCase())):[],p=f(a),m=p.some(e=>e.path===c)?c:p[0]?.path??null,g=p.findIndex(e=>e.path===m),v=e=>{s(e);let t=f(e),n=m??c,r=t.some(e=>e.path===n)?n:t[0]?.path??n;r!==c&&l(r)},y=async()=>{let n=u?.available?u.headSha:null,r=_.githubPrChanges(e.number),i=await o(e.number,{refresh:!0});t.setQueryData(r,i),i.available&&n&&n!==i.headSha&&(l(i.files[0]?.path??null),h(`The reviewed revision changed.`))};if(n.isPending)return(0,Z.jsx)(`p`,{"aria-live":`polite`,className:`mt-6 text-sm text-muted-foreground`,children:`Loading changed files…`});if(n.isError||!u)return(0,Z.jsx)(`p`,{className:`mt-6 text-sm text-danger`,children:`Changed files could not be loaded.`});if(!u.available)return(0,Z.jsx)(`p`,{className:`mt-6 text-sm text-muted-foreground`,children:u.reason});let b=p.map(e=>({path:e.path,...e.previousPath?{oldPath:e.previousPath}:{},status:e.status===`removed`?`deleted`:e.status===`changed`?`modified`:e.status,adds:e.additions,dels:e.deletions,binary:e.patchUnavailableReason===`binary`,patch:e.patch??``})),x=r(e.url)?`${e.url}/files`:null,S=p.find(e=>e.path===m);return(0,Z.jsxs)(`section`,{"data-slot":`gh-pr-changes`,className:`mt-5 min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs`,children:[(0,Z.jsxs)(`strong`,{children:[u.files.length,` changed files`]}),(0,Z.jsx)(Y,{adds:u.additions,dels:u.deletions}),(0,Z.jsxs)(`span`,{className:`font-mono text-muted-foreground`,title:u.headSha,children:[`head `,u.headSha.slice(0,8)]}),(0,Z.jsx)(B,{type:`button`,variant:`outline`,size:`sm`,className:`ml-auto min-h-11`,onClick:()=>void y(),children:`Refresh`})]}),u.truncated?(0,Z.jsxs)(`p`,{role:`status`,className:`mt-3 rounded-md border border-warning/40 bg-warning/10 p-3 text-xs`,children:[u.reason??`This response is incomplete.`,` `,x?(0,Z.jsx)(`a`,{href:x,target:`_blank`,rel:`noopener noreferrer`,className:`underline`,children:`Open all files on GitHub`}):null]}):null,(0,Z.jsxs)(`div`,{className:`mt-4 grid min-w-0 gap-4 lg:grid-cols-[240px_minmax(0,1fr)]`,children:[(0,Z.jsxs)(`aside`,{className:`min-w-0`,children:[(0,Z.jsx)(`input`,{"aria-label":`Filter changed files`,value:a,onChange:e=>v(e.target.value),placeholder:`Filter files…`,className:`min-h-11 w-full rounded-md border border-input bg-background px-3 text-sm`}),(0,Z.jsxs)(`div`,{className:`relative mt-2 lg:hidden`,children:[(0,Z.jsx)(`select`,{"aria-label":`Select changed file`,value:m??``,onChange:e=>l(e.target.value),className:`min-h-11 w-full appearance-none rounded-md border border-input bg-background py-2 pr-8 pl-3 text-sm`,children:p.map(e=>(0,Z.jsx)(`option`,{children:e.path},e.path))}),(0,Z.jsx)(re,{"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 right-2.5 size-4 -translate-y-1/2 text-muted-foreground`})]}),(0,Z.jsx)(`ul`,{className:`mt-2 hidden max-h-[60vh] overflow-auto lg:block`,children:p.map(e=>(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>l(e.path),className:i(`min-h-11 w-full truncate rounded px-2 text-left text-xs`,m===e.path&&`bg-muted font-medium`),title:e.path,children:[e.status,` · `,e.path,` `,(0,Z.jsx)(Y,{adds:e.additions,dels:e.deletions})]})},e.path))})]}),(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`mb-2 flex justify-end gap-1`,children:[(0,Z.jsx)(B,{"aria-label":`Previous file`,variant:`outline`,size:`icon`,className:`min-h-11 min-w-11`,disabled:g<=0,onClick:()=>l(p[g-1]?.path??null),children:(0,Z.jsx)(He,{})}),(0,Z.jsx)(B,{"aria-label":`Next file`,variant:`outline`,size:`icon`,className:`min-h-11 min-w-11`,disabled:g<0||g>=p.length-1,onClick:()=>l(p[g+1]?.path??null),children:(0,Z.jsx)(te,{size:16})})]}),p.length===0?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No changed files match this filter.`}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Qe,{files:b.filter(e=>e.path===m),wrap:!0,className:`min-w-0`}),S&&!S.patch?(0,Z.jsxs)(`p`,{className:`rounded-b border border-border p-3 text-xs text-muted-foreground`,children:[`Patch unavailable: `,S.patchUnavailableReason??`not-provided`,`.`]}):null]})]})]})]})}function Ft({item:e,colors:t}){let n=C(e.kind,e.number),r=n.data,i=(0,X.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(It(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,Z.jsxs)(`section`,{"data-slot":`gh-thread-loading`,className:`mt-6 border-t border-border pt-5`,children:[(0,Z.jsx)(K,{className:`mb-3 h-3 w-24`}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Z.jsx)(K,{className:`h-14 w-full`}),(0,Z.jsx)(K,{className:`h-14 w-full`})]})]}):!r||!r.available?(0,Z.jsxs)(`section`,{"data-slot":`gh-thread-error`,className:`mt-6 border-t border-border pt-5 text-xs text-muted-foreground`,children:[(0,Z.jsxs)(`span`,{children:[`Couldn’t load comments — `,r?.reason??(n.error instanceof Error?n.error.message:`could not load comments`),`. `]}),(0,Z.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,Z.jsx)(z,{"aria-hidden":`true`,className:`size-2.5`})]})]}):i.length===0?null:(0,Z.jsxs)(`section`,{"data-slot":`gh-thread`,className:`mt-6 border-t border-border pt-5`,children:[(0,Z.jsxs)(`h3`,{"data-slot":`gh-thread-header`,className:`mb-4 text-[11px] font-semibold tracking-wide text-muted-foreground uppercase`,children:[`Activity · `,r.comments.length,` comment`,r.comments.length===1?``:`s`]}),(0,Z.jsx)(`ul`,{className:`flex flex-col gap-5`,children:Lt(i).map(e=>e.group===`commits`?(0,Z.jsx)(Rt,{commits:e.commits,colors:t},e.commits[0].id):e.entry.row===`comment`?(0,Z.jsx)(Yt,{comment:e.entry.comment},`${e.entry.comment.kind}-${e.entry.comment.id}`):(0,Z.jsx)(Bt,{event:e.entry.event,colors:t},e.entry.event.id))}),r.truncated?(0,Z.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-muted-foreground hover:text-foreground hover:underline`,children:[`thread truncated — open on GitHub`,(0,Z.jsx)(z,{"aria-hidden":`true`,className:`size-2.5`})]}):null]})}var It=e=>e.row===`comment`?e.comment.createdAt:e.event.createdAt;function Lt(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 Rt({commits:e,colors:t}){let[n,r]=(0,X.useState)(!1),i=e[0]?.actor??`?`;return n?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`true`,className:`min-w-0`,children:(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":!0,onClick:()=>r(!1),className:`flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground`,children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:zt.committed}),(0,Z.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,Z.jsxs)(`span`,{children:[`added `,e.length,` commits`]})]})}),e.map(e=>(0,Z.jsx)(Bt,{event:e,colors:t},e.id))]}):(0,Z.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`false`,className:`min-w-0`,children:(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":!1,onClick:()=>r(!0),className:`flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground`,children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:zt.committed}),(0,Z.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,Z.jsxs)(`span`,{children:[`added `,e.length,` commits`]}),(0,Z.jsx)(`span`,{className:`shrink-0`,children:W(e[e.length-1].createdAt)})]})})}var zt={committed:`⚙`,labeled:`◆`,unlabeled:`◇`,assigned:`◍`,unassigned:`◌`,merged:`⑃`,closed:`⊘`,reopened:`⊙`,head_ref_force_pushed:`↻`,"cross-referenced":`↗`,renamed:`✎`};function Bt({event:e,colors:t}){return(0,Z.jsxs)(`li`,{"data-slot":`gh-event-row`,"data-kind":e.kind,className:i(`flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground`,e.kind===`merged`&&`text-accent-foreground`),children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0`,children:zt[e.kind]}),(0,Z.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.actor}),(0,Z.jsx)(Kt,{event:e,colors:t}),(0,Z.jsx)(`span`,{className:`shrink-0`,children:W(e.createdAt)}),e.url?(0,Z.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,Z.jsx)(z,{"aria-hidden":`true`,className:`size-2.5`})}):null]})}function Vt({event:e}){return(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`shrink-0`,children:`committed`}),e.sha?(0,Z.jsx)(`span`,{className:`shrink-0 font-mono text-[11px] text-muted-foreground`,children:e.sha.slice(0,7)}):null,e.message?(0,Z.jsx)(`span`,{className:`truncate font-sans text-foreground`,children:e.message}):null,(0,Z.jsx)(qt,{checks:e.checks})]})}function Ht({event:e,colors:t}){return(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`shrink-0`,children:e.kind===`labeled`?`added the`:`removed the`}),e.label?(0,Z.jsx)(`span`,{"data-slot":`gh-event-label`,style:xt(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,Z.jsx)(`span`,{className:`shrink-0`,children:`label`})]})}function Ut({event:e}){return(0,Z.jsxs)(`span`,{className:`truncate`,children:[e.kind===`assigned`?`assigned`:`unassigned`,` `,e.subject??`someone`]})}function Wt({event:e}){return(0,Z.jsxs)(`span`,{className:`truncate`,children:[`referenced this in `,e.refNumber?`#${e.refNumber}`:`another thread`,e.refTitle?` ${e.refTitle}`:``]})}var Gt={committed:e=>(0,Z.jsx)(Vt,{event:e}),labeled:(e,t)=>(0,Z.jsx)(Ht,{event:e,colors:t}),unlabeled:(e,t)=>(0,Z.jsx)(Ht,{event:e,colors:t}),assigned:e=>(0,Z.jsx)(Ut,{event:e}),unassigned:e=>(0,Z.jsx)(Ut,{event:e}),merged:()=>(0,Z.jsx)(`span`,{children:`merged this`}),closed:()=>(0,Z.jsx)(`span`,{children:`closed this`}),reopened:()=>(0,Z.jsx)(`span`,{children:`reopened this`}),head_ref_force_pushed:()=>(0,Z.jsx)(`span`,{children:`force-pushed`}),renamed:e=>(0,Z.jsxs)(`span`,{className:`truncate`,children:[`renamed this to `,e.subject??`—`]}),"cross-referenced":e=>(0,Z.jsx)(Wt,{event:e})};function Kt({event:e,colors:t}){return Gt[e.kind]?.(e,t)??null}function qt({checks:e}){return e?(0,Z.jsx)(`span`,{"data-slot":`gh-commit-checks`,"data-checks":e,"aria-label":`checks ${e}`,className:i(`shrink-0`,Qt[e]),children:Zt[e]}):null}var Jt={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 Yt({comment:e}){let t=e.reviewState?Jt[e.reviewState]:null;return(0,Z.jsxs)(`li`,{"data-slot":`gh-thread-entry`,"data-kind":e.kind,className:`min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`mb-1.5 flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,Z.jsx)(Xt,{url:e.avatarUrl,login:e.author}),(0,Z.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.author}),(0,Z.jsx)(`span`,{children:W(e.createdAt)}),t?(0,Z.jsx)(`span`,{"data-slot":`gh-review-chip`,"data-review-state":e.reviewState,className:i(`rounded-full border px-1.5 py-px font-sans text-[12px] font-medium`,t.tone),children:t.label}):null,(0,Z.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,Z.jsx)(z,{"aria-hidden":`true`,className:`size-2.5`})})]}),(0,Z.jsx)(`div`,{"data-slot":`gh-thread-body`,className:Et,children:e.body?(0,Z.jsx)(Xe,{children:e.body}):(0,Z.jsx)(`p`,{className:`text-muted-foreground`,children:`(no body)`})})]})}function Xt({url:e,login:t}){let[n,r]=(0,X.useState)(!1);return e&&!n?(0,Z.jsx)(`img`,{src:e,alt:``,width:20,height:20,loading:`lazy`,onError:()=>r(!0),"data-slot":`gh-avatar`,className:`size-5 shrink-0 rounded-full`}):(0,Z.jsx)(`span`,{"data-slot":`gh-avatar-fallback`,"aria-hidden":`true`,className:`flex size-5 shrink-0 items-center justify-center rounded-full bg-muted text-[11px] font-semibold text-muted-foreground uppercase`,children:t.slice(0,1)||`?`})}var Zt={passing:`✓`,failing:`✗`,pending:`○`},Qt={passing:`text-success`,failing:`text-danger`,pending:`text-muted-foreground`};function $t({count:e}){return e?(0,Z.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,Z.jsx)(oe,{"aria-hidden":`true`,className:`size-3`}),e]}):null}function en({checks:e,url:t}){let n=i(`text-[11px] font-medium`,Qt[e],t&&`hover:underline`),r=`${Zt[e]} checks ${e}`;return t?(0,Z.jsx)(`a`,{href:`${t}/checks`,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-checks`,"data-checks":e,className:n,children:r}):(0,Z.jsx)(`span`,{"data-slot":`gh-checks`,"data-checks":e,className:n,children:r})}function tn({checks:e}){return(0,Z.jsx)(`span`,{"data-slot":`gh-row-checks`,"data-checks":e,title:`checks ${e}`,"aria-label":`checks ${e}`,className:i(`shrink-0 font-sans text-[11px] font-semibold`,Qt[e]),children:Zt[e]})}function Q(e){return`${e.kind===`pr`?`Address GitHub pull request`:`Fix GitHub issue`} #${e.number}: ${e.title}\n\n${e.url}`}function nn(e,t=[]){let n=Q(e);return e.body?.trim()&&(n+=`\n\n---\n\n${e.body.trim()}`),t.length&&(n+=rn(t)),n}function rn(e){return`\n\nUse these skills where relevant: ${e.join(`, `)}.`}function an(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 on(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 sn(e,t,n){let r=(n??``).trim();if(!r)return nn(e,t);let i=Q(e),a=r.startsWith(i)?i+an(r.slice(i.length),e):an(r,e),o=on(a,e)?a:`${i}\n\n${a}`;return t.length?o+rn(t):o}function cn(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 ln(e,t,n,r,i={}){return t?{...i,workflow:t,task:sn(e,n.map(e=>e.id),r)}:n.length?{...i,steps:cn(n.map(e=>e.id)).map((e,t)=>({...e,...n[t]?.path===void 0?{}:{skillPath:n[t].path}})),task:sn(e,[],r)}:{...i,workflow:`quick-task`,task:sn(e,[],r)}}function un(e){let t=b(),n=S(),r=a(),{runners:i,uninstalled:o,signedOut:s,accounts:c,repoAccount:l,accountFor:u}=Ye(),d=n.data?.defaultRunner,f=Me(e.runner,i,d??i[0]??`claude`),p=n.data?.modelsLocked===!0,m=u(f,e.account),h=v(f,!0,m??l?.[f]),g=ke(p?null:e.model,f,r.data,n.data?.defaultModels,h.data),_=Ie(g,h.data);return{runner:f,runnerExplicit:e.runner!==null,model:g,effort:p?``:Re(e.effort,_),effortOptions:_,runners:i,uninstalled:o,signedOut:s,defaultRunner:d,canRun:t.isSuccess&&i.length>0,modelsLocked:p,providerPending:t.isPending,providerError:t.isError,accounts:c,account:m,repoAccount:l}}function dn(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 fn(e){return{...dn(e),...e.account?{agentProfile:e.account}:{}}}function pn(e,t){let{runners:n,uninstalled:r,signedOut:i}=e;return n.length>1||r.length>0||i.length>0||n.some(e=>Je(t,e))}function mn({pick:e,onChange:t,disabled:n=!1,accounts:r=!1,layout:i}){let o=(0,X.useRef)(null),s=(0,X.useRef)(null),[c,l]=(0,X.useState)(()=>typeof window<`u`&&window.innerWidth<=767);(0,X.useLayoutEffect)(()=>{let e=o.current;if(i!==`row`||!e)return;let t=()=>{let t=window.innerWidth<=767||e.getBoundingClientRect().width<550,n=document.activeElement;s.current=n instanceof HTMLElement&&e.contains(n)?n:null,l(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,X.useLayoutEffect)(()=>{let e=s.current;s.current=null,e&&e.isConnected&&document.activeElement!==e&&e.focus()},[c]);let u=un(e),{runner:d,model:f,effort:p,effortOptions:m,runners:h,canRun:g,modelsLocked:_}=u,y=S(),b=a(),x=v(d,!0,u.account??u.repoAccount?.[d]),C=Le(d,b.data,x.data,[e.model,y.data?.defaultModels?.[d]]),w=n||!g,T=r?u.accounts:[],E=pn(u,T)?(0,Z.jsx)(Pe,{icon:(0,Z.jsx)(M,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,runners:h,uninstalled:u.uninstalled,signedOut:u.signedOut,value:d,accounts:T,account:r?u.account:null,repoAccount:r?u.repoAccount:void 0,disabled:w,onPick:(n,i)=>t(r?{runner:n,account:i,model:n===d?e.model:null,effort:e.effort}:{runner:n,account:null,model:null,effort:e.effort})},`runner`):null,D=(0,Z.jsx)(q,{icon:(0,Z.jsx)(ne,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,slot:`model-pill`,ariaLabel:`Model`,label:f===``?`Default`:C.find(e=>e.id===f).label,value:f,disabled:w,readOnly:_===!0,disabledHint:_?`Model selection is locked to native coding-agent settings.`:void 0,onPick:n=>{let r=Ie(n,x.data);t({...e,model:n,effort:e.effort===null?null:Re(e.effort,r)})},options:C.map(e=>({value:e.id,label:e.label,desc:e.desc})),status:Ge(d,b.data,x)},`model`),O=(0,Z.jsx)(q,{icon:(0,Z.jsx)(N,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,slot:`effort-pill`,ariaLabel:`Effort`,label:m.find(e=>e.value===p)?.label??`auto`,value:p,disabled:w,readOnly:_===!0,disabledHint:_?`Effort selection is locked to native coding-agent settings.`:void 0,onPick:n=>t({...e,effort:n}),options:m.map(e=>({value:e.value,label:e.label,desc:e.desc}))},`effort`);return i===`row`?(0,Z.jsx)(`div`,{ref:o,"data-slot":`engine-row-box`,children:(0,Z.jsx)(`div`,{"data-slot":`engine-row`,className:`engine-row`,role:`group`,"aria-label":`Agent settings`,children:(0,Z.jsx)(Ae,{fill:`model-pill`,children:c?[E,O,D]:[E,D,O]})})}):(0,Z.jsxs)(Ae,{children:[E,D,O]})}var hn={workflow:null,skills:[]},gn=`cez-followup-selection`;function _n(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 vn(){try{let e=localStorage.getItem(gn);return e?_n(JSON.parse(e)):{...hn}}catch{return{...hn}}}function yn(e){try{localStorage.setItem(gn,JSON.stringify(e))}catch{}}var $=`cez-followup-prompt:`;function bn(e){try{return localStorage.getItem($+e)??``}catch{return``}}function xn(e,t){try{t===``?localStorage.removeItem($+e):localStorage.setItem($+e,t)}catch{}}function Sn({item:e,workflows:t,skills:n,workflow:i,onWorkflowChange:a,selectedSkills:o,onSkillsChange:s,engine:l,onEngineChange:f,queuedRunId:p,onQueued:m}){let g=d(),v=E(),b=e.kind===`pr`?`PR`:`issue`,S=un(l),C=x(S.runner,S.account),w=o.filter(e=>C.unchecked||e.path===void 0||n.some(t=>t.id===e.id&&(e.path===void 0||t.path===e.path))),T=w.length!==o.length,[D]=(0,X.useState)(()=>Q(e)),[k,A]=(0,X.useState)(()=>bn(e.url)||D),j=(0,X.useRef)(null),M=(0,X.useRef)(null);(0,X.useEffect)(()=>{xn(e.url,k===D?``:k)},[e.url,k,D]);let N=(0,X.useMemo)(()=>Ke(v.data?.promptTemplates),[v.data?.promptTemplates]),P=e=>{let t=j.current,n=We({prompt:k,base:D,selectionStart:t?.selectionStart??null,focused:document.activeElement===t,remembered:M.current}),r=Ue(k,n,e);A(r.text),M.current=r.caret,requestAnimationFrame(()=>{j.current?.focus(),j.current?.setSelectionRange(r.caret,r.caret)})},ee=Oe(N,w.map(e=>e.id)),F=(0,X.useRef)(k);F.current=k;let I=(0,X.useRef)(``);(0,X.useEffect)(()=>{let e=qe(F.current,I.current,ee,D);I.current=e.applied,e.text!==F.current&&A(e.text)},[ee,D]);let L=y({mutationFn:async()=>!S.canRun||T?null:u(ln(e,i,w,k,fn(S))),onSuccess:t=>{if(t===null)return;let n=t;n&&m(e.url,n.id),h(`Added to the queue — ${b} #${e.number}`),w.length>0&&v.data!==void 0&&c({skillUsage:w.reduce((e,t)=>Ee(e,t.id),v.data.skillUsage)}).then(()=>g.invalidateQueries({queryKey:_.uiState})).catch(()=>{}),xn(e.url,``),A(D),I.current=``,g.invalidateQueries({queryKey:_.runs.all})},onError:e=>h(e.message,{tone:`danger`})}),te=e=>{Be({key:e.key,shiftKey:e.shiftKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,repeat:e.repeat,isComposing:e.nativeEvent.isComposing})&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),!L.isPending&&S.canRun&&L.mutate())},R=e=>s(o.some(t=>G(t)===G(e))?o.filter(t=>G(t)!==G(e)):[...o,Te(e)]);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`section`,{"data-slot":`gh-hand`,className:`mt-7 rounded-lg border border-border bg-card p-4`,children:[(0,Z.jsx)(`h3`,{className:`text-xl font-normal text-foreground`,children:`Hand this to the agent`}),(0,Z.jsxs)(`label`,{className:`gh-field gh-prompt-field`,children:[(0,Z.jsx)(`span`,{children:`Instructions for the agent`}),(0,Z.jsx)(Ze,{ref:j,"data-slot":`gh-custom-prompt`,"aria-label":`Custom prompt`,"aria-keyshortcuts":`Control+Enter Meta+Enter`,value:k,onChange:e=>A(e.target.value),onSelect:e=>{M.current=e.currentTarget.selectionStart},onKeyDown:te,placeholder:`Instructions for the agent… (#${e.number} and its link are always sent)`,className:`mt-3 min-h-20 text-[13px]`})]}),(0,Z.jsx)(ze,{templates:N,onInsert:P}),(0,Z.jsxs)(`div`,{className:`gh-handoff-settings`,children:[(0,Z.jsxs)(`div`,{className:`gh-field`,children:[(0,Z.jsx)(`span`,{children:`Workflow`}),(0,Z.jsx)(wn,{workflows:t,value:i,onChange:a})]}),(0,Z.jsxs)(`div`,{className:`gh-field`,children:[(0,Z.jsx)(`span`,{children:`Skills · select one or more`}),(0,Z.jsx)(En,{skills:n,skillUsage:v.data?.skillUsage,selected:o,onToggle:R})]}),o.length>0?(0,Z.jsx)(`div`,{"data-slot":`gh-skill-chips`,className:`mt-2.5 flex flex-wrap gap-1.5`,children:o.map(e=>(0,Z.jsx)(Cn,{skill:e,skills:n,unchecked:C.unchecked,onRemove:()=>R(e)},G(e)))}):null,T?(0,Z.jsx)(`p`,{role:`alert`,children:`A selected skill path is unavailable. Remove it or choose a current copy before starting.`}):null,(0,Z.jsx)(mn,{layout:`row`,pick:l,onChange:f,disabled:L.isPending||!S.canRun,accounts:!0}),(0,Z.jsxs)(`div`,{className:`gh-field`,children:[(0,Z.jsx)(`span`,{children:`Account`}),(0,Z.jsx)(Tn,{resolved:S,disabled:L.isPending||!S.canRun,onPick:e=>f({...l,account:e})})]}),!S.providerPending&&!S.canRun?(0,Z.jsxs)(`span`,{"data-slot":`gh-provider-gate`,className:`inline-flex flex-wrap items-center gap-1 text-xs text-muted-foreground`,children:[S.providerError?`Provider authentication could not be verified.`:`Connect an agent provider to run this item.`,(0,Z.jsx)(V,{to:`/settings/agent-defaults#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}):null]}),(0,Z.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,Z.jsxs)(`div`,{"data-slot":`gh-handoff-actions`,className:`mt-[22px] flex flex-wrap items-center gap-2.5`,children:[r(e.url)?(0,Z.jsx)(B,{asChild:!0,variant:`outline`,children:(0,Z.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,children:`Open in GitHub`})}):null,(0,Z.jsxs)(B,{variant:`primary`,"data-action":`gh-run`,disabled:L.isPending||!S.canRun||T,onClick:()=>L.mutate(),children:[(0,Z.jsx)(se,{"aria-hidden":`true`,className:`size-3.5`}),`Run agent on this `,b]}),(0,Z.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:Ve()}),p?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`span`,{"data-slot":`gh-queued`,className:`flex items-center gap-1 text-xs font-medium text-success`,children:[(0,Z.jsx)(O,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`queued`]}),(0,Z.jsx)(V,{to:`/tasks/${p}`,"data-slot":`gh-view-run`,className:`text-xs font-semibold text-accent-text hover:underline`,children:`View task →`})]}):null]})]})}function Cn({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,Z.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,Z.jsx)(A,{size:16,"aria-hidden":`true`,className:`size-3`})]})}function wn({workflows:e,value:t,onChange:n}){let[r,a]=(0,X.useState)(!1),[o,s]=(0,X.useState)(``),c=(0,X.useRef)(null),l=xe(e,o);return(0,Z.jsxs)(ue,{open:r,onOpenChange:e=>{a(e),e||s(``)},children:[(0,Z.jsx)(ce,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`gh-workflow-trigger`,"aria-label":`Choose a workflow`,className:i(Ne,t&&`border-foreground/60 font-mono text-[11px] font-semibold text-foreground`),children:[(0,Z.jsx)(R,{size:16,"aria-hidden":`true`,className:`size-3 shrink-0 text-accent-icon`}),(0,Z.jsx)(`span`,{className:`min-w-0 max-w-44 truncate`,children:t??`workflow`}),(0,Z.jsx)(P,{size:16,"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,Z.jsx)(le,{align:`start`,sideOffset:8,className:`w-[320px] max-w-[calc(100vw-2rem)] p-0`,children:(0,Z.jsxs)(be,{shouldFilter:!1,children:[(0,Z.jsx)(_e,{placeholder:`search workflows…`,value:o,onValueChange:s,onInput:()=>c.current?.scrollTo(0,0)}),(0,Z.jsxs)(ye,{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,Z.jsx)(ve,{children:`Nothing matches.`}):null,(0,Z.jsx)(H,{children:l.map(e=>{let r=t===e.name;return(0,Z.jsxs)(U,{value:`workflow ${e.name}`,keywords:we(e.name,e.description),"data-slot":`gh-workflow-option`,"data-workflow":e.name,onSelect:()=>{n(r?null:e.name),a(!1)},children:[(0,Z.jsx)(`span`,{className:`shrink-0 font-mono text-xs`,children:e.name}),e.description?(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,r?(0,Z.jsx)(O,{size:16,"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-link-foreground`}):null]},e.name)})})]})]})})]})}function Tn({resolved:e,disabled:t,onPick:n}){let r=e.accounts.filter(t=>t.provider===e.runner),i=[...r.some(e=>e.id==="default")?[]:[{value:s,label:`Default`}],...r.map(e=>({value:e.id,label:e.label,...e.configDir?{desc:e.configDir}:{}}))],a=e.account??e.repoAccount?.[e.runner]??`default`;return(0,Z.jsx)(q,{icon:(0,Z.jsx)(k,{"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 En({skills:e,skillUsage:t,selected:n,onToggle:r}){let[a,o]=(0,X.useState)(!1),[s,c]=(0,X.useState)(``),[l,u]=(0,X.useState)(null),d=(0,X.useRef)(null),{mostUsed:f,project:p,global:m,ranked:h}=De(e,s,t),g=(e,t)=>{let a=n.some(t=>G(t)===G(e));return(0,Z.jsxs)(U,{value:G(e),keywords:we(e.name,e.description),"data-slot":`gh-skill-option`,"data-skill":e.id,"data-selected":a?`true`:void 0,onSelect:()=>r(Te(e)),children:[(0,Z.jsx)(`span`,{className:i(`shrink-0 font-mono text-xs`,t&&`font-semibold`),children:e.name}),e.path?(0,Z.jsx)(`span`,{className:`min-w-0 truncate text-xs`,children:e.path}):null,e.description?(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,(0,Z.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,Z.jsx)(ie,{"aria-hidden":`true`,className:`size-3.5`})}),a?(0,Z.jsx)(O,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0 text-link-foreground`}):null]},G(e))};return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(je,{skill:l,onClose:()=>u(null)}),(0,Z.jsxs)(ue,{open:a,onOpenChange:e=>{o(e),e||c(``)},children:[(0,Z.jsx)(ce,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`gh-skills-trigger`,"aria-label":`Choose skills`,className:i(Ne,n.length>0&&`border-foreground/60 font-semibold text-foreground`),children:[(0,Z.jsx)(L,{size:16,"aria-hidden":`true`,className:`size-3 shrink-0 text-accent-icon`}),`skills`,n.length>0?` · ${n.length}`:``,(0,Z.jsx)(P,{size:16,"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,Z.jsx)(le,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,Z.jsxs)(be,{shouldFilter:!1,children:[(0,Z.jsx)(_e,{placeholder:`search skills…`,value:s,onValueChange:c,onInput:()=>d.current?.scrollTo(0,0)}),(0,Z.jsxs)(ye,{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,Z.jsx)(H,{children:(0,Z.jsxs)(U,{value:`typed-skill`,onSelect:()=>r({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,Z.jsx)(ve,{children:`Nothing matches.`}):null,h?h.length>0?(0,Z.jsx)(H,{children:h.map(e=>g(e,Se(e)))}):null:(0,Z.jsxs)(Z.Fragment,{children:[f.length>0?(0,Z.jsx)(H,{heading:`Most used`,children:f.map(e=>g(e,Se(e)))}):null,p.length>0?(0,Z.jsx)(H,{heading:`Project skills`,children:p.map(e=>g(e,!0))}):null,m.length>0?(0,Z.jsx)(H,{heading:`Global`,children:m.map(e=>g(e,!1))}):null]})]})]})})]})]})}var Dn=new WeakMap;function On(){let e=vn(),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)&&yn({workflow:t.workflow,skills:[...t.selectedSkills]}),n.forEach(e=>e())}}}function kn(){let e=d(),{projectId:t}=p(),n=Dn.get(e);n||Dn.set(e,n=new Map);let r=n.get(t);r||n.set(t,r=On());let{snapshot:i,subscribe:a,update:o}=r,s=(0,X.useSyncExternalStore)(a,i,i),c=g(),l=un(s.engine),u=x(l.runner,l.account),f=E(),m=c.data?.workflows;(0,X.useEffect)(()=>{m&&s.workflow!==null&&!m.some(e=>e.name===s.workflow)&&o({workflow:null})},[o,m,s.workflow]);let h=(0,X.useMemo)(()=>Ce(u.data??[],f.data?.skillUsage),[u.data,f.data?.skillUsage]);return{...s,workflows:c,skillList:h,skillsUnchecked:u.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{$t as a,Lt as c,xt as d,bt as f,tn as i,vt as l,Sn as n,Mt as o,nn as r,St as s,kn as t,yt 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{t as r}from"./utils-DSMR_WLb.js";import{D as i,Nn as a,O as o,c as s,d as c,pi as l}from"./project-scope-context-Rv6S_BXt.js";import{n as u}from"./toaster-BXnLIU3z.js";import{A as d,Bt as f,Qt as p,Wt as ee,k as te}from"./queries-qCF-eOqZ.js";import{h as m}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{J as h,L as g,S as _,X as ne,at as re,b as ie,c as ae,ft as v,i as oe,l as se,lt as ce,n as le,ot as ue,st as de,tt as y,v as b,x}from"./design-icons-CzEoMH9c.js";import{t as S}from"./button-B7MKxYjT.js";import{i as fe,p as C,r as w,t as T}from"./dropdown-menu-4e2iKSMT.js";import{i as E,o as D,r as pe,s as O,t as k}from"./dialog-B531GGAo.js";import{i as A,l as me,o as he}from"./skills-pM_PouEs.js";import{d as ge,l as _e,s as ve}from"./page-shell-7pLJMOgh.js";import{t as ye}from"./centered-state-V15AR_qo.js";import{Gt as j,Ht as M,Jt as N,Kt as P,T as be,Ut as F,Wn as I,Wt as L,Yt as R,qt as z}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{t as r}from"./utils-DSMR_WLb.js";import{D as i,Nn as a,O as o,c as s,d as c,pi as l}from"./project-scope-context-Rv6S_BXt.js";import{n as u}from"./toaster-BXnLIU3z.js";import{A as d,Bt as f,Qt as p,Wt as ee,k as te}from"./queries-qCF-eOqZ.js";import{h as m}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{J as h,L as g,S as _,X as ne,at as re,b as ie,c as ae,ft as v,i as oe,l as se,lt as ce,n as le,ot as ue,st as de,tt as y,v as b,x}from"./design-icons-CzEoMH9c.js";import{t as S}from"./button-B7MKxYjT.js";import{i as fe,p as C,r as w,t as T}from"./dropdown-menu-4e2iKSMT.js";import{i as E,o as D,r as pe,s as O,t as k}from"./dialog-B531GGAo.js";import{i as A,l as me,o as he}from"./skills-pM_PouEs.js";import{d as ge,l as _e,s as ve}from"./page-shell-7pLJMOgh.js";import{t as ye}from"./centered-state-V15AR_qo.js";import{Gt as j,Ht as M,Jt as N,Kt as P,T as be,Ut as F,Wn as I,Wt as L,Yt as R,qt as z}from"./index-DNQcTHxV.js";import{_ as xe,a as Se,c as Ce,f as we,g as Te,h as Ee,i as De,m as B,n as Oe,o as ke,p as Ae,r as V,t as H,u as je}from"./sortable.esm-CAVTYaA3.js";import{t as U}from"./textarea-vJt9undk.js";var W=e(t(),1);function G(e){let t=[];for(let n of e){if(n.kind===`plugin`||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 Me(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 Ne(e,t,n){let r=[...e];return r.splice(Math.max(0,Math.min(n,r.length)),0,t),r}function Pe(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 Fe(e,t){return e.filter((e,n)=>n!==t)}function K(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 q(e,t,n){let r=` `.repeat(n);return t.includes(`
|
|
2
2
|
`)?[`${r}${e}: |`,...t.split(`
|
|
3
3
|
`).map(e=>`${r} ${e}`)]:[`${r}${e}: ${K(t)}`]}function J(e){let t=[];return e.name&&e.name!==e.id&&t.push(` name: ${K(e.name)}`),e.skill&&t.push(` skill: ${K(e.skill)}`),t}function Y(e){let t=[];return e.model&&t.push(` model: ${K(e.model)}`),e.timeoutMs!==void 0&&t.push(` timeoutMs: ${e.timeoutMs}`),e.effort!==void 0&&t.push(` effort: ${K(e.effort)}`),e.runner&&t.push(` runner: ${K(e.runner)}`),e.agentProfile&&t.push(` agentProfile: ${K(e.agentProfile)}`),t}function X(e){let t=[];return e.allowedTools&&t.push(` allowedTools: [${e.allowedTools.map(K).join(`, `)}]`),e.bashAllowlist&&t.push(` bashAllowlist: [${e.bashAllowlist.map(K).join(`, `)}]`),t}function Z(e){return e.onFail?[` onFail:`,` retry: ${K(e.onFail.retry)}`,` max: ${e.onFail.max??2}`]:[]}function Ie(e){return[` - id: ${K(e.id)}`,...J(e),...e.prompt?q(`prompt`,e.prompt,4):[],...e.kind===`plugin`?[` kind: plugin`,` pluginKind: ${K(e.pluginKind)}`,...e.config===void 0?[]:[` config: ${JSON.stringify(e.config)}`]]:[],...Y(e),...X(e),...e.command?q(`command`,e.command,4):[],...Z(e)]}function Le(e,t,n){let r=[`name: ${K(e.trim()||`my-workflow`)}`];t.trim()&&r.push(...q(`description`,t.trim(),0));let i=G(n);if(i){r.push(`skills:`);for(let e of i)r.push(` - ${K(e)}`)}else if(n.length){r.push(`steps:`);for(let e of n)r.push(...Ie(e))}else r.push(`skills: []`);return`${r.join(`
|
|
4
4
|
`)}\n`}function Re(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)||`workflow`}function ze(e){let t=G(e)?`skill`:`step`;return`${e.length} ${t}${e.length===1?``:`s`}`}function Be(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 Ve(e,t,n){let r=G(n);return{name:e.trim(),...t.trim()?{description:t.trim()}:{},...r?{skills:r}:{steps:[...n]}}}var Q=n();function He({workflows:e,draft:t,trimmedName:n,nameRef:r,onDraft:i,onLoadWorkflow:a}){return(0,Q.jsxs)(`section`,{"data-slot":`wb-metadata`,className:`grid min-w-0 grid-cols-1 gap-3 @xl:grid-cols-2 @4xl:grid-cols-[minmax(180px,240px)_minmax(200px,280px)_minmax(0,1fr)] @xl:items-start`,children:[(0,Q.jsxs)(`div`,{"data-slot":`wb-load`,className:`flex min-w-0 flex-col gap-1.5`,children:[(0,Q.jsx)(`label`,{htmlFor:`workflow-load`,className:`text-xs font-medium text-foreground`,children:`Load an existing workflow`}),(0,Q.jsxs)(`div`,{className:`relative flex min-w-0 items-center`,children:[(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-10 w-full min-w-0 appearance-none rounded-lg border border-border bg-card pr-9 pl-3.5 text-xs font-medium text-foreground focus-visible:outline-2 focus-visible:outline-ring max-md:h-11`,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)(se,{"aria-hidden":`true`,className:`pointer-events-none absolute right-3 size-4 text-muted-foreground`})]})]}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5`,children:[(0,Q.jsx)(`label`,{htmlFor:`workflow-name`,className:`text-xs font-medium text-foreground`,children:`Workflow name`}),(0,Q.jsx)(I,{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-10 bg-card text-sm max-md:h-11`})]}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5 @xl:col-span-2 @4xl:col-span-1`,children:[(0,Q.jsx)(`label`,{htmlFor:`workflow-description`,className:`text-xs font-medium text-foreground`,children:`Description`}),(0,Q.jsx)(U,{id:`workflow-description`,"data-slot":`wb-description`,"aria-label":`Description`,rows:1,value:t.description,onChange:e=>i({...t,description:e.target.value}),className:`min-h-10 bg-card px-3 py-2 text-sm max-md:min-h-11`})]})]})}function Ue({savedFile:e,autoOpen:t,onImportToggle:n,onExport:r,onAutoToggle:i,onDeleteRequest:a}){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)(S,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-import`,className:`col-span-2 justify-self-start`,onClick:n,children:[(0,Q.jsx)(de,{"aria-hidden":`true`,className:`size-3`}),`Import`]}),(0,Q.jsxs)(S,{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)(ie,{"aria-hidden":`true`,className:`size-3`}),`Export`]}),(0,Q.jsxs)(S,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-auto`,"aria-expanded":t,"aria-describedby":`wb-auto-hint`,title:`Auto-build: describe the chain in words and an agent drafts its steps for you to review`,onClick:i,children:[(0,Q.jsx)(ce,{"aria-hidden":`true`,className:`size-3`}),`Auto-build`]}),(0,Q.jsx)(`span`,{id:`wb-auto-hint`,className:`sr-only`,children:`Describe the chain in words and an agent drafts its steps for you to review.`}),e?(0,Q.jsxs)(S,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-delete`,className:`relative text-danger hover:text-danger sm:ms-3 sm:before:absolute sm:before:-start-[13px] sm:before:top-1/2 sm:before:h-5 sm:before:w-px sm:before:-translate-y-1/2 sm:before:bg-border sm:before:content-['']`,title:`Delete the saved workflow file`,onClick:a,children:[(0,Q.jsx)(re,{"aria-hidden":`true`,className:`size-3`}),`Delete`]}):null]})}function We({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)(U,{"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)(S,{type:`button`,variant:`primary`,size:`sm`,"data-slot":`wb-auto-run`,disabled:n||e.trim()===``,onClick:r,children:[(0,Q.jsx)(ce,{"aria-hidden":`true`,className:`size-3`}),n?`Building…`:`Build chain`]}),(0,Q.jsxs)(S,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-auto-cancel`,onClick:i,children:[(0,Q.jsx)(v,{"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 Ge({open:e,onOpenChange:t,text:n,onTextChange:r,error:i,pending:a,onRun:o,onCancel:s}){return(0,Q.jsx)(k,{open:e,onOpenChange:t,children:(0,Q.jsxs)(pe,{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)(O,{className:`text-xl font-normal`,children:`Import workflow YAML`}),(0,Q.jsx)(E,{className:`sr-only`,children:`Paste a portable workflow definition to import.`}),(0,Q.jsx)(U,{"data-slot":`wb-import-text`,"aria-label":`Workflow YAML to import`,rows:4,spellCheck:!1,placeholder:`name: my-flow
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{l as r,m as i}from"./live-reads-Crd6fVGH.js";import{n as a}from"./toaster-BXnLIU3z.js";import{vt as o,xt as s,zt as c}from"./queries-qCF-eOqZ.js";import{n as l}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import"./tasks-table-C5uoZMFs.js";import{t as u}from"./chevron-right-BENZ-1ZN.js";import{t as d}from"./button-B7MKxYjT.js";import{t as f}from"./status-dot-BRzVlF2X.js";import{r as p,t as m}from"./agents-settings-path-7X6_cvUg.js";import{a as h,d as g}from"./page-shell-7pLJMOgh.js";import{Gn as _,Qt as v,Un as y,Vn as b,Xt as x,Zt as S}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{l as r,m as i}from"./live-reads-Crd6fVGH.js";import{n as a}from"./toaster-BXnLIU3z.js";import{vt as o,xt as s,zt as c}from"./queries-qCF-eOqZ.js";import{n as l}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import"./tasks-table-C5uoZMFs.js";import{t as u}from"./chevron-right-BENZ-1ZN.js";import{t as d}from"./button-B7MKxYjT.js";import{t as f}from"./status-dot-BRzVlF2X.js";import{r as p,t as m}from"./agents-settings-path-7X6_cvUg.js";import{a as h,d as g}from"./page-shell-7pLJMOgh.js";import{Gn as _,Qt as v,Un as y,Vn as b,Xt as x,Zt as S}from"./index-DNQcTHxV.js";var C=e(t(),1),w=n();function T(e){let t=e.replace(/\binstall\b/g,(e,t)=>t===0?`Install`:e),n=t.split(/(`[^`]+`)/g);if(n.length===1){let e=t.split(/(\bgh auth login\b)/g);return e.length===1?t:e.map((e,t)=>e===`gh auth login`?(0,w.jsx)(`code`,{className:`rounded bg-muted px-1.5 py-0.5 font-mono text-[11.5px] text-foreground`,children:e},t):(0,w.jsx)(`span`,{children:e},t))}return n.map((e,t)=>e.startsWith("`")&&e.endsWith("`")&&e.length>2?(0,w.jsx)(`code`,{className:`rounded bg-muted px-1.5 py-0.5 font-mono text-[11.5px] text-foreground`,children:e.slice(1,-1)},t):e?(0,w.jsx)(`span`,{children:e},t):null)}function E(e,t){let n=r(t,e);return n?{label:n.displayName,isAgent:!0}:{label:e,isAgent:!1}}var D=/DRY_RUN=1\b/;function O({version:e}){return e?D.test(e)?(0,w.jsx)(`span`,{"data-slot":`tool-dry-run`,title:e,className:`shrink-0 rounded bg-muted/60 px-1.5 py-0.5 text-[11px] font-medium text-muted-foreground`,children:`Dry run`}):(0,w.jsxs)(`span`,{className:`min-w-0 break-words`,children:[`· `,e]}):null}var k=`h-8 text-xs font-medium max-md:h-11 no-hover:h-11`;function A({health:e,projects:t,repository:n,onAction:r}){let i=!!(e.data?.repoRoot||n||t.data?.projectsDir);return(0,w.jsxs)(`section`,{className:`space-y-4 rounded-xl border border-border bg-card p-6 max-md:p-4`,"aria-labelledby":`add-project-heading`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`h2`,{id:`add-project-heading`,className:`text-base font-semibold text-foreground`,children:`Add project`}),(0,w.jsx)(`p`,{className:`mt-1 text-[13px] leading-[1.5] text-muted-foreground`,children:`Start a new repository, open an existing local folder, or clone a GitHub repository.`})]}),i?(0,w.jsxs)(`div`,{className:`border-y border-border py-3.5`,children:[(0,w.jsx)(`h3`,{className:`mb-2.5 text-[11px] font-semibold tracking-wide text-muted-foreground uppercase`,children:`Active project`}),(0,w.jsxs)(`dl`,{className:`space-y-2 text-[13px] leading-[1.5] text-muted-foreground`,children:[e.data?.repoRoot?(0,w.jsxs)(`div`,{className:`grid grid-cols-1 gap-x-4 gap-y-0.5 sm:grid-cols-[160px_minmax(0,1fr)]`,children:[(0,w.jsx)(`dt`,{className:`font-medium text-foreground`,children:`Local folder`}),(0,w.jsx)(`dd`,{className:`min-w-0 font-mono text-xs break-all`,children:e.data.repo?.root??e.data.repoRoot})]}):null,n?(0,w.jsxs)(`div`,{className:`grid grid-cols-1 gap-x-4 gap-y-0.5 sm:grid-cols-[160px_minmax(0,1fr)]`,children:[(0,w.jsx)(`dt`,{className:`font-medium text-foreground`,children:`Repository`}),(0,w.jsx)(`dd`,{className:`min-w-0 font-mono text-xs break-all`,children:n.replace(/^https:\/\//,``)})]}):null,t.data?.projectsDir?(0,w.jsxs)(`div`,{className:`grid grid-cols-1 gap-x-4 gap-y-0.5 sm:grid-cols-[160px_minmax(0,1fr)]`,children:[(0,w.jsx)(`dt`,{className:`font-medium text-foreground`,children:`Checkout folder`}),(0,w.jsx)(`dd`,{className:`min-w-0 font-mono text-xs break-all`,children:t.data.projectsDir})]}):null]})]}):null,(0,w.jsxs)(`div`,{className:`flex flex-wrap gap-2.5`,children:[(0,w.jsx)(d,{variant:`outline`,className:`h-10 rounded-lg px-3.5 text-xs font-medium max-md:h-11`,"data-action":`new-project`,onClick:()=>r(`new`),children:`New project`}),(0,w.jsx)(d,{variant:`outline`,className:`h-10 rounded-lg px-3.5 text-xs font-medium max-md:h-11`,onClick:()=>r(`local`),children:`Open local folder`}),(0,w.jsx)(d,{variant:`outline`,className:`h-10 rounded-lg px-3.5 text-xs font-medium max-md:h-11`,onClick:()=>r(`clone`),children:`Clone from GitHub`})]})]})}function j({health:e,runners:t,copying:n,onCopy:r}){return(0,w.jsxs)(`section`,{className:`space-y-4 rounded-xl border border-border bg-card p-6 max-md:p-4`,"aria-labelledby":`tools-heading`,children:[(0,w.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`h2`,{id:`tools-heading`,className:`text-base font-semibold text-foreground`,children:`Tools diagnostics`}),(0,w.jsx)(`p`,{className:`mt-1 text-[13px] leading-[1.5] text-muted-foreground`,children:`Check the tools available to this local workspace.`})]}),(0,w.jsx)(d,{asChild:!0,variant:`outline`,size:`sm`,className:k,children:(0,w.jsxs)(l,{to:m,"data-slot":`tools-settings`,children:[`Tool settings`,(0,w.jsx)(u,{className:`size-3.5 shrink-0`,"aria-hidden":`true`})]})})]}),e.isError?(0,w.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:`Could not refresh tool diagnostics. Recheck to retry.`}):null,!e.data&&!e.isError?(0,w.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:`Checking installed tools…`}):null,e.data?(0,w.jsx)(`dl`,{className:`divide-y divide-border border-y border-border text-[13px] leading-[1.5] text-muted-foreground`,children:e.data.checks.map(e=>{let n=x(e),r=E(e.name,t);return(0,w.jsxs)(`div`,{"data-slot":`tool-row`,"data-tool":e.name,"data-available":e.available,className:`grid grid-cols-1 gap-x-4 gap-y-1 py-3 sm:grid-cols-[160px_minmax(0,1fr)] sm:items-center`,children:[(0,w.jsxs)(`dt`,{className:`flex items-center gap-2.5`,children:[(0,w.jsx)(f,{tone:v(e)}),(0,w.jsx)(`span`,{className:r.isAgent?`text-[14px] font-semibold text-foreground`:`font-mono text-[13px] font-semibold text-foreground`,children:r.label})]}),(0,w.jsxs)(`dd`,{className:`flex min-w-0 items-center gap-x-1.5 text-muted-foreground`,children:[(0,w.jsx)(`span`,{className:`shrink-0`,children:S(e)}),(0,w.jsx)(O,{version:e.version}),e.available?null:(0,w.jsx)(d,{asChild:!0,variant:`outline`,size:`sm`,className:`${k} ml-auto`,children:(0,w.jsxs)(l,{to:p(e.name),"data-slot":`tool-setup`,children:[`Set up`,(0,w.jsx)(u,{className:`size-3.5 shrink-0`,"aria-hidden":`true`})]})})]}),n?(0,w.jsx)(`dd`,{"data-slot":`tool-hint`,className:`min-w-0 break-words text-xs leading-relaxed text-muted-foreground sm:col-start-2`,children:T(n)}):null]},e.name)})}):null,e.data?.checks.length===0?(0,w.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No tool diagnostics reported by this server.`}):null,(0,w.jsxs)(`div`,{className:`flex flex-wrap gap-2.5`,children:[(0,w.jsx)(d,{variant:`outline`,className:`h-10 rounded-lg px-3.5 text-xs font-medium max-md:h-11`,disabled:e.isFetching,onClick:()=>void e.refetch(),children:e.isFetching?`Checking tools…`:`Recheck tools`}),(0,w.jsx)(d,{variant:`outline`,className:`h-10 rounded-lg px-3.5 text-xs font-medium max-md:h-11`,disabled:!e.data||n,onClick:()=>void r(),children:n?`Copying…`:`Copy diagnostics`})]})]})}function M(){let e=o(),t=s(),n=i().data,r=c(e.data?.repo?.remote),[l,u]=(0,C.useState)(null),[d,f]=(0,C.useState)(!1),p=async()=>{if(!(!e.data||d)){f(!0);try{await navigator.clipboard.writeText(JSON.stringify({version:e.data.version,checks:e.data.checks},null,2)),a(`Diagnostics copied`)}catch{a(`Could not copy diagnostics. Please try again.`,{tone:`danger`})}finally{f(!1)}}},m=e.data?.checks.length??4;return(0,w.jsxs)(h,{route:`workspace-tools`,density:e.data?g(m):`full`,bodyClassName:`gap-5`,header:{title:`Workspace tools`,subtitle:`Add projects and inspect local workspace CLI diagnostics.`},children:[(0,w.jsx)(A,{health:e,projects:t,repository:r,onAction:u}),(0,w.jsx)(j,{health:e,runners:n,copying:d,onCopy:p}),l===`new`?(0,w.jsx)(b,{open:!0,onOpenChange:e=>{e||u(null)}}):null,l===`local`?(0,w.jsx)(_,{open:!0,onOpenChange:e=>{e||u(null)}}):null,l===`clone`?(0,w.jsx)(y,{open:!0,onOpenChange:e=>{e||u(null)}}):null]})}export{M as WorkspaceToolsRoute};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{t as e}from"./react-runtime-CCIEwYL0.js";import{Fr as t,M as n,Nn as r,Pr as i,pi as a}from"./project-scope-context-Rv6S_BXt.js";import{n as o}from"./toaster-BXnLIU3z.js";import{Bt as s,Qt as c,_ as l,vt as u}from"./queries-qCF-eOqZ.js";import{u as d}from"./design-icons-CzEoMH9c.js";import{t as f}from"./button-B7MKxYjT.js";import{t as p}from"./project-router-CLJTc7gv.js";import{t as m}from"./centered-state-V15AR_qo.js";import{Qn as h,gn as g}from"./index-
|
|
1
|
+
import{t as e}from"./react-runtime-CCIEwYL0.js";import{Fr as t,M as n,Nn as r,Pr as i,pi as a}from"./project-scope-context-Rv6S_BXt.js";import{n as o}from"./toaster-BXnLIU3z.js";import{Bt as s,Qt as c,_ as l,vt as u}from"./queries-qCF-eOqZ.js";import{u as d}from"./design-icons-CzEoMH9c.js";import{t as f}from"./button-B7MKxYjT.js";import{t as p}from"./project-router-CLJTc7gv.js";import{t as m}from"./centered-state-V15AR_qo.js";import{Qn as h,gn as g}from"./index-DNQcTHxV.js";import{n as _,r as v,t as y}from"./remote-settings-notice-COojb6XK.js";import{n as b}from"./saved-draft-BwzBc-_Y.js";import{t as x}from"./save-cue-Cd3ZAPBS.js";import{n as S}from"./settings-field-DP9sYv5a.js";import{n as C}from"./project-location-BRxXN249.js";var w=e();function T({copy:e,savedCommandCount:t,settingsAdmin:n,configPath:r,issue:i,invalid:a,children:o}){let s=e.slot;return(0,w.jsxs)(w.Fragment,{children:[t===0&&i===null?(0,w.jsx)(`p`,{"data-slot":`${s}-empty`,className:`text-xs text-muted-foreground`,children:e.empty}):null,o,n===!1?(0,w.jsxs)(`p`,{"data-slot":`${s}-readonly`,className:`text-xs text-foreground`,children:[`Edit `,(0,w.jsxs)(`code`,{children:[e.key,`.commands`]}),` in`,` `,r===null?(0,w.jsxs)(w.Fragment,{children:[`the project’s `,(0,w.jsx)(`code`,{children:`.ai/cezar/config.json`})]}):(0,w.jsx)(`code`,{className:`break-all`,children:r}),` `,`on the machine running Squawk. `,e.fileEditApplies,` No restart is needed. To edit here, the host operator runs `,(0,w.jsx)(`code`,{children:y}),`.`]}):null,i===null?null:(0,w.jsxs)(`p`,{"data-slot":`${s}-issue`,className:`text-xs text-danger`,children:[`config.json has an invalid `,e.key,` (`,i,`) — saving replaces it.`]}),a===null?null:(0,w.jsx)(`p`,{"data-slot":`${s}-invalid`,className:`text-xs text-danger`,children:a})]})}function E(e,n){let r=e.split(`
|
|
2
2
|
`).map(e=>e.trim()).filter(e=>e!==``),a=Number(n);return{commands:r,timeoutSeconds:a,invalid:r.length>20?`Enter at most 20 commands.`:r.some(e=>e.length>4e3)?`Keep each command under ${i.toLocaleString(`en-US`)} characters.`:n.trim()===``||!Number.isInteger(a)||a<1||a>7200?`Enter a whole number of seconds from 1 to ${t}.`:null}}var D={setup:{key:`worktreeSetup`,issueKey:`worktreeSetupIssue`,slot:`worktree-setup`,title:`Prepare new worktrees`,hint:`Runs in order in every new task and worker worktree before the agent starts. The first failure stops setup.`,empty:`No setup commands configured. No commands will run in new worktrees.`,label:`Worktree setup commands, one per line`,example:`npm ci`,fileEditApplies:`Valid file edits apply to new worktrees.`,saved:`Worktree setup saved`,cleared:`Worktree setup cleared`,save:`Save setup`},teardown:{key:`worktreeTeardown`,issueKey:`worktreeTeardownIssue`,slot:`worktree-teardown`,title:`Stop worker services before destroy`,hint:`Runs in order in a worker’s worktree when the worker is destroyed, before its processes stop. The first failure stops teardown; destroy goes on and records it on the worker.`,empty:`No teardown commands configured. Destroy runs no commands in worker worktrees.`,label:`Worktree teardown commands, one per line`,example:`docker compose down`,fileEditApplies:`Valid file edits apply to the next worker destroy.`,saved:`Worktree teardown saved`,cleared:`Worktree teardown cleared`,save:`Save teardown`}};function O(e,t){return t?`One command per line, for example: ${e.example}`:void 0}function k({config:e,copy:i}){let l=a(),d=u(),p=v(),m=C(),h=m===null?null:`${m.replace(/\/$/,``)}/.ai/cezar/config.json`,y=d.data?.capabilities?.settingsAdmin===!0,D=e[i.key],k=e[i.issueKey],A=D?.commands??[],j=D?.timeoutSeconds??900,[M,N]=b(A.join(`
|
|
3
3
|
`)),[P,F]=b(String(j)),{commands:I,timeoutSeconds:L,invalid:R}=E(M,P),z=I.length===A.length&&I.every((e,t)=>e===A[t])&&(I.length===0||L===j),B=k===null&&z;g(y&&!z);let V=c({mutationFn:e=>n(e),onSuccess:e=>{l.setQueryData(s.config,e),N(I.join(`
|
|
4
4
|
`)),o(I.length===0?i.cleared:i.saved)},onError:e=>{o(e.message,{tone:`danger`}),e instanceof r&&e.status===409&&p()}}),H=()=>V.mutate({[i.key]:I.length===0?null:{commands:I,...L===900?{}:{timeoutSeconds:L}}}),U=`block rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50 read-only:bg-muted read-only:text-muted-foreground`;return(0,w.jsxs)(S,{title:i.title,hint:i.hint,children:[(0,w.jsx)(_,{risk:`These commands run on the machine running Squawk`}),(0,w.jsxs)(T,{copy:i,savedCommandCount:A.length,settingsAdmin:d.data?.capabilities?.settingsAdmin,configPath:h,issue:k,invalid:R,children:[(0,w.jsx)(`textarea`,{"data-slot":`${i.slot}-commands`,"data-reports-dirty":``,"aria-label":i.label,rows:4,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,value:M,placeholder:O(i,y),readOnly:!y,disabled:V.isPending,onChange:e=>N(e.target.value),className:`${U} field-sizing-content min-h-24 max-h-[min(24rem,60dvh)] w-full resize-none overflow-y-auto font-mono text-[13px] leading-relaxed`}),(0,w.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,w.jsxs)(`label`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,w.jsx)(`span`,{children:`Timeout per command`}),(0,w.jsx)(`input`,{type:`number`,inputMode:`numeric`,min:1,max:t,step:1,"data-slot":`${i.slot}-timeout`,"data-reports-dirty":``,value:P,readOnly:!y,disabled:V.isPending,onChange:e=>F(e.target.value),className:`${U} min-h-11 w-28 md:min-h-0`}),(0,w.jsx)(`span`,{children:`seconds`})]}),(0,w.jsx)(x,{show:y&&B&&!V.isPending,children:(0,w.jsx)(f,{type:`button`,variant:`primary`,size:`sm`,className:`min-h-11 md:min-h-0`,"data-action":`${i.slot}-save`,disabled:!y||B||R!==null||V.isPending,onClick:H,children:i.save})})]})]})]})}var A=0,j=1e3;function M(){let e=l();return e.isPending?(0,w.jsx)(`p`,{"data-slot":`worktrees-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading worktree settings…`}):e.isError?(0,w.jsx)(m,{icon:(0,w.jsx)(h,{}),tone:`danger`,title:`Worktree settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,w.jsx)(N,{config:e.data})}function N({config:e}){let t=a(),r=c({mutationFn:e=>n(e),onSuccess:e=>t.setQueryData(s.config,e),onError:e=>o(e.message,{tone:`danger`})}),[i,l]=b(String(e.worktreeRetention)),u=Number(i),m=i.trim()===``||!Number.isInteger(u)||u<A||u>j,h=e.worktreeRetention===(m?-1:u);return g(!h),(0,w.jsxs)(`div`,{"data-slot":`worktrees-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,w.jsxs)(S,{title:`Keep N finished worktrees`,hint:`Older finished worktrees are removed to free disk; their branch stays, so the work is recoverable. 0 keeps all. Running and in-review tasks are never removed.`,children:[(0,w.jsxs)(`div`,{"data-reports-dirty":``,className:`flex items-center gap-2`,children:[(0,w.jsx)(`input`,{type:`number`,inputMode:`numeric`,min:A,max:j,step:1,"aria-label":`Keep last N finished worktrees`,"data-slot":`resources-worktree-retention`,value:i,disabled:r.isPending,onChange:e=>l(e.target.value),className:`block w-32 rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`}),(0,w.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`worktrees`}),(0,w.jsx)(x,{show:h&&!m&&!r.isPending,children:(0,w.jsx)(f,{type:`button`,variant:`primary`,size:`sm`,"data-action":`resources-save-retention`,disabled:h||m||r.isPending,onClick:()=>r.mutate({worktreeRetention:u},{onSuccess:()=>{t.invalidateQueries({queryKey:s.worktrees}),o(u===0?`Keeping all worktrees (unlimited)`:`Keeping the last ${u} finished worktree${u===1?``:`s`}`)}}),children:`Save retention`})})]}),m?(0,w.jsxs)(`p`,{"data-slot":`resources-retention-invalid`,className:`text-xs text-danger`,children:[`Enter a whole number from `,A,` to `,j,` (0 = unlimited).`]}):(0,w.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:u===0?`Keeping every finished worktree.`:`Keeping the last ${u} finished worktree${u===1?``:`s`} on disk.`})]}),(0,w.jsx)(k,{config:e,copy:D.setup}),(0,w.jsx)(k,{config:e,copy:D.teardown}),(0,w.jsxs)(p,{to:`/git/cleanup`,"data-slot":`worktrees-manage-link`,className:`inline-flex min-h-11 items-center gap-1 self-start text-[13px] font-medium text-link-foreground hover:underline focus-visible:outline-2 focus-visible:outline-ring md:min-h-0`,children:[`Manage worktrees on Git`,(0,w.jsx)(d,{"aria-hidden":`true`,className:`size-[14px]`})]})]})}export{M as WorktreesSection};
|
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-DNQcTHxV.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-rHxsej31.js">
|