@wjarka/cezarion 0.18.0-dev.6043 → 0.18.0-dev.6052
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/web/dist/assets/{activity-motion-Dld5ms7x.js → activity-motion-sKbBXp7S.js} +1 -1
- package/web/dist/assets/activity-route-Bc971l0i.js +1 -0
- package/web/dist/assets/agent-accounts-BNlpWTOY.js +18 -0
- package/web/dist/assets/commit-diff-panel-Cu568QdG.js +1 -0
- package/web/dist/assets/diff-DgaFdLIQ.js +3 -0
- package/web/dist/assets/{diff-view-DcvEkA3I.js → diff-view-DsKxwBj0.js} +4 -4
- package/web/dist/assets/file-preview-BI5HqN7l.js +2 -0
- package/web/dist/assets/git-toolbar-kRtfi1Yi.js +1 -0
- package/web/dist/assets/github-BuL-Adsj.js +1 -0
- package/web/dist/assets/global-activity-route-R-usJ0UM.js +1 -0
- package/web/dist/assets/index-CHoW3yXD.js +17 -0
- package/web/dist/assets/preview-pane-connected-Xcbaz2aB.js +3 -0
- package/web/dist/assets/prompt-template-menu-D4-inlE4.js +1 -0
- package/web/dist/assets/reference-chip-Drpbf-MP.js +1 -0
- package/web/dist/assets/repo-git-BDqD1dCO.js +1 -0
- package/web/dist/assets/report-reader-BeiX7yOI.js +1 -0
- package/web/dist/assets/reports-CLFWm79E.js +1 -0
- package/web/dist/assets/{run-header-BDtR-uVy.js → run-header-B_y-PAUo.js} +2 -2
- package/web/dist/assets/skills-CT19EfH4.js +1 -0
- package/web/dist/assets/{task-changes-NqJ_-tod.js → task-changes-CIg3ZS_4.js} +1 -1
- package/web/dist/assets/task-commits-lvxO5xlm.js +1 -0
- package/web/dist/assets/task-files-DU4jN7tw.js +1 -0
- package/web/dist/assets/task-github-item-SGV4rF5y.js +1 -0
- package/web/dist/assets/{task-thread-DkF28KyV.js → task-thread-fIg_7gsa.js} +7 -7
- package/web/dist/assets/{thread-state-C8XI1WNf.js → thread-state-Chr_zQzb.js} +1 -1
- package/web/dist/assets/use-hand-to-agent-state-BL5MkZ-b.js +1 -0
- package/web/dist/assets/workflows-8CuG-k4b.js +7 -0
- package/web/dist/index.html +5 -5
- package/web/dist/assets/activity-route-CNZPeNfz.js +0 -1
- package/web/dist/assets/agent-accounts-B-Gpf8IN.js +0 -18
- package/web/dist/assets/commit-diff-panel-NClCG68F.js +0 -1
- package/web/dist/assets/control-locations-B88tMDqg.js +0 -1
- package/web/dist/assets/diff-nIehE-T6.js +0 -3
- package/web/dist/assets/file-preview-D5OEhi_p.js +0 -2
- package/web/dist/assets/git-toolbar-6nOTPb_C.js +0 -1
- package/web/dist/assets/github-kqE3kY6l.js +0 -1
- package/web/dist/assets/github-sidebar-model-DkUAF09l.js +0 -1
- package/web/dist/assets/global-activity-route-BExanylS.js +0 -1
- package/web/dist/assets/index-DBNT3CYH.js +0 -17
- package/web/dist/assets/preview-pane-connected-BN0BWrKD.js +0 -3
- package/web/dist/assets/repo-git-CPEbNCTy.js +0 -1
- package/web/dist/assets/report-reader-Ltc8JdIV.js +0 -1
- package/web/dist/assets/reports-DHuR8gwU.js +0 -1
- package/web/dist/assets/skills-DTowIB5z.js +0 -1
- package/web/dist/assets/task-commits-BbhrfhCT.js +0 -1
- package/web/dist/assets/task-files-n29-eIMD.js +0 -1
- package/web/dist/assets/task-github-item-BwS8ltjs.js +0 -1
- package/web/dist/assets/use-hand-to-agent-state-CY43kvaa.js +0 -1
- package/web/dist/assets/workflows-CWFMDlCn.js +0 -7
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{t as e,u as t}from"./button-CS5tOblf.js";import{t as n}from"./react-runtime-CCIEwYL0.js";import{hr as r,mr as i}from"./project-scope-context-DSkcNKO7.js";import{U as a,W as o,_ as s,f as c,g as l,h as ee,m as u}from"./live-protocol-DBPXI6ks.js";import{t as d}from"./createLucideIcon-BHp8sXmF.js";import{t as f}from"./app-window-CSHwDX9N.js";import{i as p}from"./format-BNCkW110.js";import{t as te}from"./play-CmVAj_fu.js";import{X as ne,Xt as re,Z as ie,dn as ae,nn as oe}from"./index-DBNT3CYH.js";var m=d(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),h=d(`server`,[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]),g=n(),_={registered:e=>e.server.answeredAtRegistration?{label:`Open`,run:!1}:{label:`Run and open`,run:!0},adopted:()=>({label:`Open`,run:!1}),starting:()=>({label:`Open`,run:!1}),up:()=>({label:`Open`,run:!1}),stalled:()=>({label:`View`,run:!1}),exited:()=>({label:`Start again`,run:!0}),stopped:()=>({label:`Start again`,run:!0}),unavailable:()=>void 0};function v(e){let{text:t,...n}=ie(e),r={...n,status:t},i=_[e.state](e);return i?{...r,action:i}:r}var se={"Run and open":te,Open:f,View:ae,"Start again":m};function ce({entry:e,inPreview:n,onOpen:r}){let{server:i}=e,a=v(e),o=e.state===`unavailable`,s=r?a.action:void 0,c=ne(i.command),l=p(i.registeredAt);return(0,g.jsxs)(`div`,{"data-slot":`preview-server-card`,"data-state":e.state,className:t(`min-w-0 rounded-lg border border-border bg-card px-3.5 py-3 text-sm`,o&&`text-muted-foreground`),children:[(0,g.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2 text-xs text-soft-foreground`,children:[(0,g.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5 font-mono`,children:[(0,g.jsx)(h,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),(0,g.jsx)(`span`,{className:`truncate`,children:`cezar_preview_serve`})]}),o?(0,g.jsx)(`span`,{children:`worktree removed`}):l?(0,g.jsxs)(`span`,{children:[l,` ago`]}):null]}),(0,g.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-x-3 gap-y-2`,children:[(0,g.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,g.jsx)(re,{tone:a.tone,shape:a.ring?`ring`:`filled`,pulse:a.pulse===!0,"aria-hidden":`true`}),(0,g.jsx)(`span`,{className:`font-semibold text-foreground`,children:i.label}),(0,g.jsxs)(`span`,{className:`font-mono text-muted-foreground`,children:[`:`,i.port]}),(0,g.jsx)(`span`,{className:`text-muted-foreground`,children:a.status})]}),(0,g.jsx)(le,{entry:e,inPreview:n,action:s,onOpen:r})]}),(0,g.jsxs)(`div`,{className:`mt-2.5 min-w-0 rounded-md bg-muted px-3 py-2 font-mono text-xs`,children:[(0,g.jsx)(`p`,{className:`break-words whitespace-pre-wrap text-foreground`,children:i.command}),i.cwd?(0,g.jsxs)(`p`,{className:`mt-1 flex gap-3 text-soft-foreground`,children:[(0,g.jsx)(`span`,{children:`cwd`}),(0,g.jsx)(`span`,{className:`break-all`,children:i.cwd})]}):null]}),s?.run?(0,g.jsx)(y,{icon:(0,g.jsx)(oe,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),children:`${s.label===`Start again`?`Starting again`:`Opening`} runs ${c} in this task's worktree, on the host.`}):null,o?(0,g.jsx)(y,{children:`The worktree this server ran in is gone. Register it again from a new task.`}):null]})}function le({entry:t,inPreview:n,action:r,onOpen:i}){let{server:a}=t,o=n&&r!==void 0&&!r.run,s=o?`In preview`:r?.label,c=o?f:r?se[r.label]:null;return r&&s&&c?(0,g.jsxs)(e,{variant:o||r.label===`View`||r.label===`Open`&&t.state===`starting`?`outline`:`contrast`,size:`sm`,className:`max-md:h-11 max-md:px-3.5`,onClick:()=>i?.({port:a.port,run:r.run}),children:[(0,g.jsx)(c,{"aria-hidden":`true`}),s]}):null}function y({icon:e,children:t}){return(0,g.jsxs)(`p`,{className:`mt-2.5 flex items-start gap-2 text-xs text-muted-foreground`,children:[e,(0,g.jsx)(`span`,{children:t})]})}var b=120;function x(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function S(e){let t=e.replace(/\s+/g,` `).trim();return t.length>b?`${t.slice(0,b-1)}…`:t}function C(e,...t){if(x(e))for(let n of t){let t=e[n];if(typeof t==`string`&&t.trim()!==``)return S(t)}}function ue(e){if(!x(e))return;let t=e.command;if(typeof t==`string`&&t.trim()!==``)return S(t);if(Array.isArray(t)){let e=t.filter(e=>typeof e==`string`);if(e.length>0)return S(e.join(` `))}}function de(e){if(!x(e)||!Array.isArray(e.changes))return[];let t=[];for(let n of e.changes)x(n)&&typeof n.path==`string`&&n.path.trim()!==``&&t.push(n.path);return t}function w(e){return C(e,`description`,`query`,`url`,`filePath`,`file_path`,`path`,`pattern`,`name`)}function T(e,t){return t?`${e} ${t}`:e}var fe=new Map([[`bash`,`execute`],[`commandexecution`,`execute`],[`edit`,`edit`],[`multiedit`,`edit`],[`write`,`edit`],[`notebookedit`,`edit`],[`filechange`,`edit`],[`read`,`read`],[`imageview`,`read`],[`glob`,`search`],[`grep`,`search`],[`webfetch`,`fetch`],[`websearch`,`fetch`],[`task`,`task`],[`agent`,`task`],[`skill`,`task`],[`todowrite`,`plan`],[`todolist`,`plan`],[`plan`,`plan`],[`taskcreate`,`plan`],[`taskupdate`,`plan`],[`tasklist`,`plan`],[`contextcompaction`,`other`],[`mcptoolcall`,`other`]]);function pe(e,t){switch(e){case`write`:return{toolKind:`edit`,title:T(`Write`,C(t,`file_path`,`filePath`,`path`))};case`notebookedit`:return{toolKind:`edit`,title:T(`Edit`,C(t,`notebook_path`,`notebookPath`,`file_path`,`filePath`,`path`))};case`filechange`:{let e=de(t);return{toolKind:`edit`,title:T(`Edit`,e.length===1?e[0]:e.length>1?`${e.length} files`:void 0)}}default:return{toolKind:`edit`,title:T(`Edit`,C(t,`file_path`,`filePath`,`path`))}}}function me(e,t){return e===`imageview`?{toolKind:`read`,title:T(`View image`,C(t,`path`))}:{toolKind:`read`,title:T(`Read`,C(t,`file_path`,`filePath`,`path`))}}function he(e,t){return e===`webfetch`?{toolKind:`fetch`,title:T(`Fetch`,C(t,`url`))}:{toolKind:`fetch`,title:T(`Web search`,C(t,`query`))}}function ge(e,t){if(e===`skill`){let e=C(t,`skill`,`name`,`command`);return{toolKind:`task`,title:e?`Skill: ${e}`:`Skill`,subtitle:C(t,`args`,`description`)}}let n=e===`agent`?`Agent`:`Task`,r=C(t,`subagent_type`,`subagentType`),i=C(t,`description`,`prompt`)??r;return{toolKind:`task`,title:i?`${n}: ${i}`:n,subtitle:i===r?void 0:r}}function _e(e,t,n){if(t===`contextcompaction`)return{toolKind:`other`,title:`Compacted context`};if(t===`mcptoolcall`){let e=C(n,`server`),t=C(n,`tool`);return e&&t?{toolKind:`other`,title:`${e}.${t}`}:{toolKind:`other`,title:`MCP tool`,subtitle:w(n)}}if(t.startsWith(`mcp__`)){let t=e.split(`__`).filter(e=>e!==``);if(t.length>=3)return{toolKind:`other`,title:`${t[1]}.${t.slice(2).join(`__`)}`}}return{toolKind:`other`,title:typeof e==`string`&&e.trim()!==``?S(e):`Tool`,subtitle:w(n)}}function ve(e,t){let n=typeof e==`string`?e.toLowerCase():``;switch(fe.get(n)){case`execute`:return{toolKind:`execute`,title:T(`Ran`,ue(t)),subtitle:C(t,`description`)};case`edit`:return pe(n,t);case`read`:return me(n,t);case`search`:return{toolKind:`search`,title:T(`Search`,C(t,`pattern`,`query`)),subtitle:C(t,`path`)};case`fetch`:return he(n,t);case`task`:return ge(n,t);case`plan`:return{toolKind:`plan`,title:`Update plan`};default:return _e(e,n,t)}}function ye(e,t){if(t.type===`ask.requested`&&typeof t.requestId==`string`&&a.safeParse({questions:t.questions}).success)return t;if(t.type===`human-input-delivered`||t.type===`human-ask-closed`){let n=(t.type===`human-input-delivered`?l:ee).safeParse(t);if(n.success&&n.data.askSeq===e?.seq)return}return e}function E(e){if(!(e.type!==`ask.requested`||typeof e.requestId!=`string`))return{requestId:e.requestId,questions:e.questions,...e.context===void 0?{}:{context:e.context}}}function D(e){let t=E(e);return t&&{seq:e.seq,...t}}function O(e,t){let n=ye(e&&{type:`ask.requested`,seq:e.seq,ts:``},t);return n===t?D(t):n===void 0?void 0:e}function k(e){let t;for(let n of e)t=O(t,n);return t}function A(e){let t=Array.isArray(e.questions)?e.questions.filter(e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&typeof e.header==`string`&&(e.options===void 0||Array.isArray(e.options))):[];if(t.length===0)return;let n=typeof e.context==`string`&&e.context!==``?e.context:void 0;return{id:e.requestId,questions:t,...n===void 0?{}:{context:n},askSeq:e.seq}}function j(){return{turns:[],itemsById:new Map,turnSeq:0,permissions:new Map,conversationEntries:new Map,outcomesByRequest:new Map,seenInputs:new Set,previewByPort:new Map,handedOff:!1}}function M(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function N(e){return typeof e==`string`?e:void 0}function P(e){let t=typeof e==`string`?new Date(e):void 0;return!t||Number.isNaN(t.getTime())?``:` · ${t.toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`})}`}function F(e){if(!(typeof e!=`string`||e===``))return Number.isFinite(new Date(e).getTime())?e:void 0}var be=new Set(o.options);function xe(e){return typeof e==`string`&&be.has(e)?e:void 0}function I(e,t){e.turnSeq+=1;let n={id:t===void 0?`turn-fallback-${e.turnSeq}`:`turn-seq-${t}`,entries:[],v2Items:!1};return e.turns.push(n),n}function L(e){return e.turns.at(-1)??I(e)}function R(e,t){L(e).entries.push({origin:`meta`,entry:t})}function z(e){for(let t of e.permissions.values())t.status===`pending`&&(t.status=`expired`)}function B(e,t){let n=N(e.stepId);return n===void 0?t:`${n}:${t}`}function Se(e,t){t.v2Items=!0;for(let n of t.entries)n.origin===`v1`&&n.entry.kind===`tool`&&e.itemsById.delete(n.entry.id);t.entries=t.entries.filter(e=>!(e.origin===`v1`&&e.entry.kind===`tool`))}function Ce(e,t,n,r,i){let a=n.kind===`message`&&i!==void 0?{...n,ts:i}:{...n};!t.v2Items&&a.kind!==`hook`&&Se(e,t);let o=e.itemsById.get(r);if(o&&o.turn===t){o.entry.entry=a;return}let s={origin:`v2`,entry:a};t.entries.push(s),e.itemsById.set(r,{turn:t,entry:s})}var V={"not-delivered":0,queued:1,delivered:2,consumed:3},we=[`instruction`,`resumed`,`requestId`,`relationship`,`state`,`createdAt`,`requestHash`,`deadline`];function H(e){let t={};for(let n of we)e[n]!==void 0&&Object.assign(t,{[n]:e[n]});return t}function U(e,t){if(t.messageKind!==`request`)return;let n=e.outcomesByRequest.get(t.messageId);n&&(t.outcome={status:n.status,...n.replyId===void 0?{}:{replyId:n.replyId},observedAt:n.observedAt})}function Te(e,t){let n=e.conversationEntries.get(t);n&&U(e,n)}function Ee(e,t,n,r){(V[e.delivery]<V.delivered||V[n]>V[e.delivery])&&(e.delivery=n),t.text!==``&&(e.text=t.text),Object.assign(e,H(t)),r.deliveredAt!==void 0&&(e.deliveredAt=r.deliveredAt),r.consumedAt!==void 0&&(e.consumedAt=r.consumedAt),r.recordedAt!==void 0&&(n===`delivered`||e.delivery!==`delivered`)&&(e.recordedAt=r.recordedAt)}function W(e,t,n,r){let i=e.conversationEntries.get(t.id);if(i){Ee(i,t,n,r),U(e,i);return}let a={kind:`conversation`,id:`conversation-message:${t.id}`,messageId:t.id,text:t.text,senderRunId:t.senderRunId,recipientRunId:t.recipientRunId,messageKind:t.kind,delivery:n,...r,...H(t)};U(e,a),e.conversationEntries.set(t.id,a),R(e,a)}function De(e,t){let n=P(t.ts),r=N(t.message),i=t.notify===!1?`Stopped notifying the webhook${n}`:`${e.handedOff?`Note sent to webhook`:`Handed off to webhook`}${n}${r?` — ${r}`:``}`;e.handedOff=t.notify!==!1,R(e,{kind:`note`,id:`v1:${t.seq}`,text:i,tone:`dim`,icon:`handoff`})}function Oe(e,t){let n=typeof t.attempts==`number`?t.attempts:void 0,r=N(t.webhookName),i=`${r?`Delivery to ${r} failed`:`Webhook delivery failed`}${N(t.event)?` (${N(t.event)})`:``}${n?` after ${n} attempt${n===1?``:`s`}`:``}: ${N(t.error)??`unknown error`}`;R(e,{kind:`note`,id:`v1:${t.seq}`,text:i,tone:`danger`})}function ke(e,t){let n=N(t.webhookName)??`webhook`,r=N(t.title),i=`v1:${t.seq}`;if(t.ok===!1){R(e,{kind:`note`,id:i,text:`Report to ${n} failed: ${N(t.error)??`unknown error`}`,tone:`danger`});return}let a=`${t.dryRun===!0?`Report to ${n} (dry run, nothing sent)`:`Sent report to ${n}`}${P(t.ts)}${r?` — ${r}`:``}`;R(e,t.dryRun===!0?{kind:`note`,id:i,text:a,tone:`dim`}:{kind:`note`,id:i,text:a,tone:`dim`,icon:`handoff`})}function Ae(e,t){let n=t.payload??{},r=`Webhook (dry run, nothing sent): ${N(t.event)??`delivery`}${N(n.status)?` · ${N(n.status)}`:``}`;R(e,{kind:`note`,id:`v1:${t.seq}`,text:r,tone:`dim`})}function je(e,t){let n=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=L(e),o={origin:`meta`,entry:{kind:`preview-server`,id:`preview-server:${n.data.port}`,server:n.data,state:`registered`,stateAt:t.ts}};a.entries.push(o),e.previewByPort.set(n.data.port,{turn:a,draft:o})}function Me(e,t){let n=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.entry={kind:`preview-server`,id:o,server:a,state:n.data,stateAt:t.ts,...typeof t.exitCode==`number`?{exitCode:t.exitCode}:{},...t.reason===`user`||t.reason===`idle`?{reason:t.reason}:{}}}function Ne(e,t){let n=u.safeParse(t);if(!n.success)return;let{message:r,delivery:i,deliveredAt:a,consumedAt:o,ts:s}=n.data;W(e,r,i,{deliveredAt:a,consumedAt:o,recordedAt:s})}function Pe(e,t){let n=s.safeParse(t);if(!n.success)return;let{outcome:r}=n.data,i=e.outcomesByRequest.get(r.requestId);i&&!(i.status===`timed-out`&&r.status===`replied-late`)||(e.outcomesByRequest.set(r.requestId,r),Te(e,r.requestId))}function Fe(e,t){let n=c.safeParse(t);if(!n.success)return;let{input:r}=n.data;if(!e.seenInputs.has(r.id)){if(e.seenInputs.add(r.id),r.conversation){W(e,{id:r.id,text:r.text,createdAt:r.createdAt,...r.conversation},`delivered`,{deliveredAt:r.deliveredAt,recordedAt:n.data.ts});return}R(e,{kind:`note`,id:`agent-input:${r.id}`,text:r.text,tone:`dim`,attribution:{source:r.source,parentRunId:r.parentRunId}})}}function Ie(e,t){let n=N(t.text)??``,r=e.pendingAsk;e.pendingAsk&&!e.pendingAsk.resolved&&(e.pendingAsk.resolved=!0,e.pendingAsk.answeredBy=`human`,n!==``&&(e.pendingAsk.answer=n),e.pendingAsk=void 0);let i=I(e,t.seq),a=F(t.ts);i.userMessage={text:n,ask:r,imageCount:typeof t.imageCount==`number`?t.imageCount:0,images:Array.isArray(t.images)?t.images.filter(e=>typeof e==`string`):[],...a===void 0?{}:{ts:a}},a!==void 0&&(i.startedAt=a)}function Le(e,t){let n=e.turns.at(-1),r=n&&n.turnId===void 0&&!n.v2Items?n:I(e,t.seq);r.turnId=N(t.turnId),r.startedAt??=F(t.ts)}function Re(e,t){for(let n=e.turns.length-1;n>=0;--n)if(e.turns[n].turnId===t)return e.turns[n];return e.turns.at(-1)}function ze(e,t){z(e);let n=Re(e,N(t.turnId));if(!n)return;let r=F(t.ts);n.completed={stopReason:N(t.stopReason)??`end_turn`,...typeof t.costUsd==`number`?{costUsd:t.costUsd}:{},...r===void 0?{}:{ts:r}}}var G=new Set([`message`,`reasoning`,`tool`,`hook`]),Be=e=>G.has(e.kind);function Ve(e){if(!(!M(e)||!G.has(e.kind)))return typeof e.id==`string`&&e.id!==``?e:void 0}function K(e,t){let n=Ve(t.item);if(!n)return;let r=B(t,n.id);Ce(e,e.itemsById.get(r)?.turn??L(e),n,r,t.type===`item.completed`?F(t.ts):void 0)}function He(e,t){let n=e.itemsById.get(B(t,N(t.itemId)??``)),r=N(t.delta)??``;if(!n||r===``||!Be(n.entry.entry))return;let i=n.entry.entry;t.field===`output`&&i.kind===`tool`?i.output=(i.output??``)+r:t.field!==`output`&&(i.kind===`message`||i.kind===`reasoning`)&&(i.text+=r)}function Ue(e,t){let n=L(e),r=N(t.text)??``;if(r===``)return;let i=F(t.ts);n.entries.push({origin:`v1`,entry:{kind:`message`,id:`v1:${t.seq}`,role:`assistant`,text:r,...i===void 0?{}:{ts:i}}})}var We=new Set([`pending`,`in_progress`,`completed`,`cancelled`]);function Ge(e){if(!M(e)||!Array.isArray(e.todos))return;let t=[];for(let n of e.todos){if(!M(n)||typeof n.content!=`string`)return;t.push({content:n.content,status:We.has(n.status)?n.status:`pending`,...typeof n.activeForm==`string`?{activeForm:n.activeForm}:{}})}return t}var Ke=new Set([`subAgentActivity`,`collabAgentToolCall`,`collabToolCall`]);function qe(e,t){let n=L(e),r=N(t.tool)??`Tool`;if(n.v2Items||Ke.has(r))return;let i=ve(r,t.input),a=i.toolKind===`plan`?Ge(t.input):void 0;a!==void 0&&(n.planEntries=a);let o={kind:`tool`,id:N(t.id)??`v1:${t.seq}`,name:r,toolKind:i.toolKind,title:i.title,status:`running`,input:t.input},s={origin:`v1`,entry:o};n.entries.push(s),e.itemsById.set(o.id,{turn:n,entry:s})}function Je(e){if(typeof e==`string`)return e;if(e==null)return``;try{return JSON.stringify(e)}catch{return String(e)}}function Ye(e,t){let n=e.itemsById.get(N(t.toolCallId)??``);if(!n||n.turn.v2Items||n.entry.origin!==`v1`)return;let r=n.entry.entry;r.kind===`tool`&&(r.status=`completed`,r.output=Je(t.result))}function q(e,t,n,r){let i=N(t.message)??``;i!==``&&R(e,{kind:`note`,id:n,text:i,tone:r})}function J(e,t){q(e,t,`v1:${t.seq}`,t.tone===`danger`?`danger`:`dim`)}function Xe(e,t){q(e,t,`v1:${t.seq}`,`danger`)}function Ze(e,t){q(e,t,`v2:${t.seq}`,`danger`)}function Qe(e,t){if(t.status!==`failed`)return;let n=N(t.error)?` — ${N(t.error)}`:``;R(e,{kind:`note`,id:`v1:${t.seq}`,text:`step ${N(t.stepId)??`?`} failed${n}`,tone:`danger`})}function $e(e,t){let n=N(t.command)??`check`,r=typeof t.exitCode==`number`?t.exitCode:-1;R(e,{kind:`tool`,id:`v1:${t.seq}`,name:`check`,toolKind:`execute`,title:`Ran ${n}`,status:r===0?`completed`:`failed`,output:N(t.text)??``,exitCode:r})}function et(e,t){let n=xe(t.provider),r=N(t.authFailureId)??``;n===void 0||r.length<1||r.length>128||R(e,{kind:`provider-auth-required`,id:`v1:${t.seq}`,provider:n,authFailureId:r})}function tt(e,t){let n=N(t.url);if(n===void 0)return;let r={kind:`image`,id:`v1:${t.seq}`,url:n},i=N(t.name);i!==void 0&&(r.name=i),R(e,r)}function nt(e,t){Array.isArray(t.entries)&&(L(e).planEntries=t.entries)}function rt(e,t){z(e);let n=N(t.message);e.sessionEnded={reason:N(t.reason)??`end_turn`,...n===void 0?{}:{message:n}}}var it=new Set([`allow_once`,`allow_always`,`reject_once`,`reject_always`]);function at(e){return M(e)&&typeof e.id==`string`&&e.id!==``&&typeof e.label==`string`&&e.label!==``&&it.has(e.kind)}function ot(e){if(!(!Array.isArray(e)||e.length===0||!e.every(at)))return new Set(e.map(e=>e.id)).size===e.length?e:void 0}function st(e,t){let n=N(t.requestId),r=N(t.title),i=ot(t.options);if(!n||!r||e.permissions.has(n)||!i)return;let a=N(t.itemId),o=N(t.details),s={kind:`permission`,id:`permission:${n}`,requestId:n,title:r,options:i.map(e=>({...e})),status:`pending`,...a===void 0?{}:{itemId:a},...o===void 0?{}:{details:o}};e.permissions.set(n,s),R(e,s)}function ct(e,t){let n=e.permissions.get(N(t.requestId)??``);if(!n||n.status!==`pending`)return;let r=N(t.optionId);r!==void 0&&n.options.some(e=>e.id===r)?(n.status=`resolved`,n.optionId=r):n.status=`expired`;let i=N(t.reason);i!==void 0&&(n.reason=i)}function lt(e,t){let n=D(t),r=n&&A(n);if(!r)return;let i={kind:`ask`,...r,questions:r.questions,resolved:!1};R(e,i),e.pendingAsk=i}function Y(e,t){let n=e.pendingAsk;return n&&!n.resolved&&n.askSeq===t.askSeq?n:void 0}function ut(e,t){let n=Y(e,t);if(!n)return;n.routedToParent=!0;let r=N(t.parentRunId);r!==void 0&&(n.parentRunId=r)}function dt(e,t){let n=Y(e,t);n&&(n.routedToParent=!1)}function ft(e,t){let n=Y(e,t);n&&X(e,n,`undeliverable`)}var pt=new Set([`finish`,`superseded`,`parent-stopped`,`worker-stopped`,`undeliverable`]);function mt(e,t){let n=Y(e,t);n&&pt.has(t.reason)&&X(e,n,t.reason)}function X(e,t,n){t.resolved=!0,t.closed=n,e.pendingAsk=void 0}function Z(e,t){let n=Y(e,t);if(n){if(t.source===`cezar`){X(e,n,`undeliverable`);return}t.source===`parent`&&(n.resolved=!0,n.answeredBy=`parent`,e.pendingAsk=void 0)}}var Q=()=>{},ht=new Map([[`handoff`,De],[`webhook.failed`,Oe],[`webhook.dry-run`,Ae],[`webhook.report`,ke],[`preview.server-registered`,je],[`preview.server-state`,Me],[`conversation-message`,Ne],[`request-outcome`,Pe],[`agent-input`,Fe],[`user-message`,Ie],[`turn.started`,Le],[`turn.completed`,ze],[`item.started`,K],[`item.updated`,K],[`item.completed`,K],[`item.delta`,He],[`text`,Ue],[`tool-call`,qe],[`tool-result`,Ye],[`note`,J],[`lifecycle`,J],[`error`,Xe],[`session.error`,Ze],[`step-end`,Qe],[`check-output`,$e],[`provider-auth-required`,et],[`image`,tt],[`plan.updated`,nt],[`session.started`,e=>z(e)],[`session.ended`,rt],[`permission.requested`,st],[`permission.resolved`,ct],[`ask.requested`,lt],[`worker-question-routed`,ut],[`worker-question-fallback`,dt],[`worker-question-undelivered`,ft],[`human-ask-closed`,mt],[`human-input-delivered`,Z],[`step-start`,Q],[`token-usage`,Q],[`cost`,Q],[`turn-end`,Q],[`done`,Q],[`session`,Q]]);function gt(e,t){ht.get(t.type)?.(e,t)}function _t(e){for(let t=e.turns.length-1;t>=0;--t){let n=e.turns[t].planEntries;if(n!==void 0)return n}}function vt(e){let t=[];for(let n of e.turns)for(let e of n.items)if(e.kind===`tool`){for(let n of e.locations??[])t.push(n.path);for(let n of e.diffs??[])t.push(n.path)}let n=[];for(let e=t.length-1;e>=0;--e)n.includes(t[e])||n.push(t[e]);return n}function yt(e,t){switch(e){case`waiting`:return{state:`waiting`};case`failed`:return{state:`closed`,tone:`danger`,label:t?`Session failed — ${t}`:`Session failed`};case`review`:return{state:`closed`,tone:`dim`,label:`Session closed — waiting for your review`};case`done`:case`cancelled`:return{state:`closed`,tone:`dim`,label:`Session closed`};default:return null}}function $(e,t){let n=e.replace(/\s*CEZ:DONE\s*$/,``).replace(/\s*CEZ:MONITORING\s*$/,``);if(t){let e=n.trimEnd(),t=e.lastIndexOf(`
|
|
1
|
+
import{t as e,u as t}from"./button-CS5tOblf.js";import{t as n}from"./react-runtime-CCIEwYL0.js";import{hr as r,mr as i}from"./project-scope-context-DSkcNKO7.js";import{U as a,W as o,_ as s,f as c,g as l,h as ee,m as u}from"./live-protocol-DBPXI6ks.js";import{t as d}from"./createLucideIcon-BHp8sXmF.js";import{t as f}from"./app-window-CSHwDX9N.js";import{i as p}from"./format-BNCkW110.js";import{t as te}from"./play-CmVAj_fu.js";import{Xt as ne,dn as re,g as ie,h as ae,nn as oe}from"./index-CHoW3yXD.js";var m=d(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),h=d(`server`,[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]),g=n(),_={registered:e=>e.server.answeredAtRegistration?{label:`Open`,run:!1}:{label:`Run and open`,run:!0},adopted:()=>({label:`Open`,run:!1}),starting:()=>({label:`Open`,run:!1}),up:()=>({label:`Open`,run:!1}),stalled:()=>({label:`View`,run:!1}),exited:()=>({label:`Start again`,run:!0}),stopped:()=>({label:`Start again`,run:!0}),unavailable:()=>void 0};function v(e){let{text:t,...n}=ie(e),r={...n,status:t},i=_[e.state](e);return i?{...r,action:i}:r}var se={"Run and open":te,Open:f,View:re,"Start again":m};function ce({entry:e,inPreview:n,onOpen:r}){let{server:i}=e,a=v(e),o=e.state===`unavailable`,s=r?a.action:void 0,c=ae(i.command),l=p(i.registeredAt);return(0,g.jsxs)(`div`,{"data-slot":`preview-server-card`,"data-state":e.state,className:t(`min-w-0 rounded-lg border border-border bg-card px-3.5 py-3 text-sm`,o&&`text-muted-foreground`),children:[(0,g.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2 text-xs text-soft-foreground`,children:[(0,g.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5 font-mono`,children:[(0,g.jsx)(h,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),(0,g.jsx)(`span`,{className:`truncate`,children:`cezar_preview_serve`})]}),o?(0,g.jsx)(`span`,{children:`worktree removed`}):l?(0,g.jsxs)(`span`,{children:[l,` ago`]}):null]}),(0,g.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-x-3 gap-y-2`,children:[(0,g.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,g.jsx)(ne,{tone:a.tone,shape:a.ring?`ring`:`filled`,pulse:a.pulse===!0,"aria-hidden":`true`}),(0,g.jsx)(`span`,{className:`font-semibold text-foreground`,children:i.label}),(0,g.jsxs)(`span`,{className:`font-mono text-muted-foreground`,children:[`:`,i.port]}),(0,g.jsx)(`span`,{className:`text-muted-foreground`,children:a.status})]}),(0,g.jsx)(le,{entry:e,inPreview:n,action:s,onOpen:r})]}),(0,g.jsxs)(`div`,{className:`mt-2.5 min-w-0 rounded-md bg-muted px-3 py-2 font-mono text-xs`,children:[(0,g.jsx)(`p`,{className:`break-words whitespace-pre-wrap text-foreground`,children:i.command}),i.cwd?(0,g.jsxs)(`p`,{className:`mt-1 flex gap-3 text-soft-foreground`,children:[(0,g.jsx)(`span`,{children:`cwd`}),(0,g.jsx)(`span`,{className:`break-all`,children:i.cwd})]}):null]}),s?.run?(0,g.jsx)(y,{icon:(0,g.jsx)(oe,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),children:`${s.label===`Start again`?`Starting again`:`Opening`} runs ${c} in this task's worktree, on the host.`}):null,o?(0,g.jsx)(y,{children:`The worktree this server ran in is gone. Register it again from a new task.`}):null]})}function le({entry:t,inPreview:n,action:r,onOpen:i}){let{server:a}=t,o=n&&r!==void 0&&!r.run,s=o?`In preview`:r?.label,c=o?f:r?se[r.label]:null;return r&&s&&c?(0,g.jsxs)(e,{variant:o||r.label===`View`||r.label===`Open`&&t.state===`starting`?`outline`:`contrast`,size:`sm`,className:`max-md:h-11 max-md:px-3.5`,onClick:()=>i?.({port:a.port,run:r.run}),children:[(0,g.jsx)(c,{"aria-hidden":`true`}),s]}):null}function y({icon:e,children:t}){return(0,g.jsxs)(`p`,{className:`mt-2.5 flex items-start gap-2 text-xs text-muted-foreground`,children:[e,(0,g.jsx)(`span`,{children:t})]})}var b=120;function x(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function S(e){let t=e.replace(/\s+/g,` `).trim();return t.length>b?`${t.slice(0,b-1)}…`:t}function C(e,...t){if(x(e))for(let n of t){let t=e[n];if(typeof t==`string`&&t.trim()!==``)return S(t)}}function ue(e){if(!x(e))return;let t=e.command;if(typeof t==`string`&&t.trim()!==``)return S(t);if(Array.isArray(t)){let e=t.filter(e=>typeof e==`string`);if(e.length>0)return S(e.join(` `))}}function de(e){if(!x(e)||!Array.isArray(e.changes))return[];let t=[];for(let n of e.changes)x(n)&&typeof n.path==`string`&&n.path.trim()!==``&&t.push(n.path);return t}function w(e){return C(e,`description`,`query`,`url`,`filePath`,`file_path`,`path`,`pattern`,`name`)}function T(e,t){return t?`${e} ${t}`:e}var fe=new Map([[`bash`,`execute`],[`commandexecution`,`execute`],[`edit`,`edit`],[`multiedit`,`edit`],[`write`,`edit`],[`notebookedit`,`edit`],[`filechange`,`edit`],[`read`,`read`],[`imageview`,`read`],[`glob`,`search`],[`grep`,`search`],[`webfetch`,`fetch`],[`websearch`,`fetch`],[`task`,`task`],[`agent`,`task`],[`skill`,`task`],[`todowrite`,`plan`],[`todolist`,`plan`],[`plan`,`plan`],[`taskcreate`,`plan`],[`taskupdate`,`plan`],[`tasklist`,`plan`],[`contextcompaction`,`other`],[`mcptoolcall`,`other`]]);function pe(e,t){switch(e){case`write`:return{toolKind:`edit`,title:T(`Write`,C(t,`file_path`,`filePath`,`path`))};case`notebookedit`:return{toolKind:`edit`,title:T(`Edit`,C(t,`notebook_path`,`notebookPath`,`file_path`,`filePath`,`path`))};case`filechange`:{let e=de(t);return{toolKind:`edit`,title:T(`Edit`,e.length===1?e[0]:e.length>1?`${e.length} files`:void 0)}}default:return{toolKind:`edit`,title:T(`Edit`,C(t,`file_path`,`filePath`,`path`))}}}function me(e,t){return e===`imageview`?{toolKind:`read`,title:T(`View image`,C(t,`path`))}:{toolKind:`read`,title:T(`Read`,C(t,`file_path`,`filePath`,`path`))}}function he(e,t){return e===`webfetch`?{toolKind:`fetch`,title:T(`Fetch`,C(t,`url`))}:{toolKind:`fetch`,title:T(`Web search`,C(t,`query`))}}function ge(e,t){if(e===`skill`){let e=C(t,`skill`,`name`,`command`);return{toolKind:`task`,title:e?`Skill: ${e}`:`Skill`,subtitle:C(t,`args`,`description`)}}let n=e===`agent`?`Agent`:`Task`,r=C(t,`subagent_type`,`subagentType`),i=C(t,`description`,`prompt`)??r;return{toolKind:`task`,title:i?`${n}: ${i}`:n,subtitle:i===r?void 0:r}}function _e(e,t,n){if(t===`contextcompaction`)return{toolKind:`other`,title:`Compacted context`};if(t===`mcptoolcall`){let e=C(n,`server`),t=C(n,`tool`);return e&&t?{toolKind:`other`,title:`${e}.${t}`}:{toolKind:`other`,title:`MCP tool`,subtitle:w(n)}}if(t.startsWith(`mcp__`)){let t=e.split(`__`).filter(e=>e!==``);if(t.length>=3)return{toolKind:`other`,title:`${t[1]}.${t.slice(2).join(`__`)}`}}return{toolKind:`other`,title:typeof e==`string`&&e.trim()!==``?S(e):`Tool`,subtitle:w(n)}}function ve(e,t){let n=typeof e==`string`?e.toLowerCase():``;switch(fe.get(n)){case`execute`:return{toolKind:`execute`,title:T(`Ran`,ue(t)),subtitle:C(t,`description`)};case`edit`:return pe(n,t);case`read`:return me(n,t);case`search`:return{toolKind:`search`,title:T(`Search`,C(t,`pattern`,`query`)),subtitle:C(t,`path`)};case`fetch`:return he(n,t);case`task`:return ge(n,t);case`plan`:return{toolKind:`plan`,title:`Update plan`};default:return _e(e,n,t)}}function ye(e,t){if(t.type===`ask.requested`&&typeof t.requestId==`string`&&a.safeParse({questions:t.questions}).success)return t;if(t.type===`human-input-delivered`||t.type===`human-ask-closed`){let n=(t.type===`human-input-delivered`?l:ee).safeParse(t);if(n.success&&n.data.askSeq===e?.seq)return}return e}function E(e){if(!(e.type!==`ask.requested`||typeof e.requestId!=`string`))return{requestId:e.requestId,questions:e.questions,...e.context===void 0?{}:{context:e.context}}}function D(e){let t=E(e);return t&&{seq:e.seq,...t}}function O(e,t){let n=ye(e&&{type:`ask.requested`,seq:e.seq,ts:``},t);return n===t?D(t):n===void 0?void 0:e}function k(e){let t;for(let n of e)t=O(t,n);return t}function A(e){let t=Array.isArray(e.questions)?e.questions.filter(e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&typeof e.header==`string`&&(e.options===void 0||Array.isArray(e.options))):[];if(t.length===0)return;let n=typeof e.context==`string`&&e.context!==``?e.context:void 0;return{id:e.requestId,questions:t,...n===void 0?{}:{context:n},askSeq:e.seq}}function j(){return{turns:[],itemsById:new Map,turnSeq:0,permissions:new Map,conversationEntries:new Map,outcomesByRequest:new Map,seenInputs:new Set,previewByPort:new Map,handedOff:!1}}function M(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function N(e){return typeof e==`string`?e:void 0}function P(e){let t=typeof e==`string`?new Date(e):void 0;return!t||Number.isNaN(t.getTime())?``:` · ${t.toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`})}`}function F(e){if(!(typeof e!=`string`||e===``))return Number.isFinite(new Date(e).getTime())?e:void 0}var be=new Set(o.options);function xe(e){return typeof e==`string`&&be.has(e)?e:void 0}function I(e,t){e.turnSeq+=1;let n={id:t===void 0?`turn-fallback-${e.turnSeq}`:`turn-seq-${t}`,entries:[],v2Items:!1};return e.turns.push(n),n}function L(e){return e.turns.at(-1)??I(e)}function R(e,t){L(e).entries.push({origin:`meta`,entry:t})}function z(e){for(let t of e.permissions.values())t.status===`pending`&&(t.status=`expired`)}function B(e,t){let n=N(e.stepId);return n===void 0?t:`${n}:${t}`}function Se(e,t){t.v2Items=!0;for(let n of t.entries)n.origin===`v1`&&n.entry.kind===`tool`&&e.itemsById.delete(n.entry.id);t.entries=t.entries.filter(e=>!(e.origin===`v1`&&e.entry.kind===`tool`))}function Ce(e,t,n,r,i){let a=n.kind===`message`&&i!==void 0?{...n,ts:i}:{...n};!t.v2Items&&a.kind!==`hook`&&Se(e,t);let o=e.itemsById.get(r);if(o&&o.turn===t){o.entry.entry=a;return}let s={origin:`v2`,entry:a};t.entries.push(s),e.itemsById.set(r,{turn:t,entry:s})}var V={"not-delivered":0,queued:1,delivered:2,consumed:3},we=[`instruction`,`resumed`,`requestId`,`relationship`,`state`,`createdAt`,`requestHash`,`deadline`];function H(e){let t={};for(let n of we)e[n]!==void 0&&Object.assign(t,{[n]:e[n]});return t}function U(e,t){if(t.messageKind!==`request`)return;let n=e.outcomesByRequest.get(t.messageId);n&&(t.outcome={status:n.status,...n.replyId===void 0?{}:{replyId:n.replyId},observedAt:n.observedAt})}function Te(e,t){let n=e.conversationEntries.get(t);n&&U(e,n)}function Ee(e,t,n,r){(V[e.delivery]<V.delivered||V[n]>V[e.delivery])&&(e.delivery=n),t.text!==``&&(e.text=t.text),Object.assign(e,H(t)),r.deliveredAt!==void 0&&(e.deliveredAt=r.deliveredAt),r.consumedAt!==void 0&&(e.consumedAt=r.consumedAt),r.recordedAt!==void 0&&(n===`delivered`||e.delivery!==`delivered`)&&(e.recordedAt=r.recordedAt)}function W(e,t,n,r){let i=e.conversationEntries.get(t.id);if(i){Ee(i,t,n,r),U(e,i);return}let a={kind:`conversation`,id:`conversation-message:${t.id}`,messageId:t.id,text:t.text,senderRunId:t.senderRunId,recipientRunId:t.recipientRunId,messageKind:t.kind,delivery:n,...r,...H(t)};U(e,a),e.conversationEntries.set(t.id,a),R(e,a)}function De(e,t){let n=P(t.ts),r=N(t.message),i=t.notify===!1?`Stopped notifying the webhook${n}`:`${e.handedOff?`Note sent to webhook`:`Handed off to webhook`}${n}${r?` — ${r}`:``}`;e.handedOff=t.notify!==!1,R(e,{kind:`note`,id:`v1:${t.seq}`,text:i,tone:`dim`,icon:`handoff`})}function Oe(e,t){let n=typeof t.attempts==`number`?t.attempts:void 0,r=N(t.webhookName),i=`${r?`Delivery to ${r} failed`:`Webhook delivery failed`}${N(t.event)?` (${N(t.event)})`:``}${n?` after ${n} attempt${n===1?``:`s`}`:``}: ${N(t.error)??`unknown error`}`;R(e,{kind:`note`,id:`v1:${t.seq}`,text:i,tone:`danger`})}function ke(e,t){let n=N(t.webhookName)??`webhook`,r=N(t.title),i=`v1:${t.seq}`;if(t.ok===!1){R(e,{kind:`note`,id:i,text:`Report to ${n} failed: ${N(t.error)??`unknown error`}`,tone:`danger`});return}let a=`${t.dryRun===!0?`Report to ${n} (dry run, nothing sent)`:`Sent report to ${n}`}${P(t.ts)}${r?` — ${r}`:``}`;R(e,t.dryRun===!0?{kind:`note`,id:i,text:a,tone:`dim`}:{kind:`note`,id:i,text:a,tone:`dim`,icon:`handoff`})}function Ae(e,t){let n=t.payload??{},r=`Webhook (dry run, nothing sent): ${N(t.event)??`delivery`}${N(n.status)?` · ${N(n.status)}`:``}`;R(e,{kind:`note`,id:`v1:${t.seq}`,text:r,tone:`dim`})}function je(e,t){let n=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=L(e),o={origin:`meta`,entry:{kind:`preview-server`,id:`preview-server:${n.data.port}`,server:n.data,state:`registered`,stateAt:t.ts}};a.entries.push(o),e.previewByPort.set(n.data.port,{turn:a,draft:o})}function Me(e,t){let n=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.entry={kind:`preview-server`,id:o,server:a,state:n.data,stateAt:t.ts,...typeof t.exitCode==`number`?{exitCode:t.exitCode}:{},...t.reason===`user`||t.reason===`idle`?{reason:t.reason}:{}}}function Ne(e,t){let n=u.safeParse(t);if(!n.success)return;let{message:r,delivery:i,deliveredAt:a,consumedAt:o,ts:s}=n.data;W(e,r,i,{deliveredAt:a,consumedAt:o,recordedAt:s})}function Pe(e,t){let n=s.safeParse(t);if(!n.success)return;let{outcome:r}=n.data,i=e.outcomesByRequest.get(r.requestId);i&&!(i.status===`timed-out`&&r.status===`replied-late`)||(e.outcomesByRequest.set(r.requestId,r),Te(e,r.requestId))}function Fe(e,t){let n=c.safeParse(t);if(!n.success)return;let{input:r}=n.data;if(!e.seenInputs.has(r.id)){if(e.seenInputs.add(r.id),r.conversation){W(e,{id:r.id,text:r.text,createdAt:r.createdAt,...r.conversation},`delivered`,{deliveredAt:r.deliveredAt,recordedAt:n.data.ts});return}R(e,{kind:`note`,id:`agent-input:${r.id}`,text:r.text,tone:`dim`,attribution:{source:r.source,parentRunId:r.parentRunId}})}}function Ie(e,t){let n=N(t.text)??``,r=e.pendingAsk;e.pendingAsk&&!e.pendingAsk.resolved&&(e.pendingAsk.resolved=!0,e.pendingAsk.answeredBy=`human`,n!==``&&(e.pendingAsk.answer=n),e.pendingAsk=void 0);let i=I(e,t.seq),a=F(t.ts);i.userMessage={text:n,ask:r,imageCount:typeof t.imageCount==`number`?t.imageCount:0,images:Array.isArray(t.images)?t.images.filter(e=>typeof e==`string`):[],...a===void 0?{}:{ts:a}},a!==void 0&&(i.startedAt=a)}function Le(e,t){let n=e.turns.at(-1),r=n&&n.turnId===void 0&&!n.v2Items?n:I(e,t.seq);r.turnId=N(t.turnId),r.startedAt??=F(t.ts)}function Re(e,t){for(let n=e.turns.length-1;n>=0;--n)if(e.turns[n].turnId===t)return e.turns[n];return e.turns.at(-1)}function ze(e,t){z(e);let n=Re(e,N(t.turnId));if(!n)return;let r=F(t.ts);n.completed={stopReason:N(t.stopReason)??`end_turn`,...typeof t.costUsd==`number`?{costUsd:t.costUsd}:{},...r===void 0?{}:{ts:r}}}var G=new Set([`message`,`reasoning`,`tool`,`hook`]),Be=e=>G.has(e.kind);function Ve(e){if(!(!M(e)||!G.has(e.kind)))return typeof e.id==`string`&&e.id!==``?e:void 0}function K(e,t){let n=Ve(t.item);if(!n)return;let r=B(t,n.id);Ce(e,e.itemsById.get(r)?.turn??L(e),n,r,t.type===`item.completed`?F(t.ts):void 0)}function He(e,t){let n=e.itemsById.get(B(t,N(t.itemId)??``)),r=N(t.delta)??``;if(!n||r===``||!Be(n.entry.entry))return;let i=n.entry.entry;t.field===`output`&&i.kind===`tool`?i.output=(i.output??``)+r:t.field!==`output`&&(i.kind===`message`||i.kind===`reasoning`)&&(i.text+=r)}function Ue(e,t){let n=L(e),r=N(t.text)??``;if(r===``)return;let i=F(t.ts);n.entries.push({origin:`v1`,entry:{kind:`message`,id:`v1:${t.seq}`,role:`assistant`,text:r,...i===void 0?{}:{ts:i}}})}var We=new Set([`pending`,`in_progress`,`completed`,`cancelled`]);function Ge(e){if(!M(e)||!Array.isArray(e.todos))return;let t=[];for(let n of e.todos){if(!M(n)||typeof n.content!=`string`)return;t.push({content:n.content,status:We.has(n.status)?n.status:`pending`,...typeof n.activeForm==`string`?{activeForm:n.activeForm}:{}})}return t}var Ke=new Set([`subAgentActivity`,`collabAgentToolCall`,`collabToolCall`]);function qe(e,t){let n=L(e),r=N(t.tool)??`Tool`;if(n.v2Items||Ke.has(r))return;let i=ve(r,t.input),a=i.toolKind===`plan`?Ge(t.input):void 0;a!==void 0&&(n.planEntries=a);let o={kind:`tool`,id:N(t.id)??`v1:${t.seq}`,name:r,toolKind:i.toolKind,title:i.title,status:`running`,input:t.input},s={origin:`v1`,entry:o};n.entries.push(s),e.itemsById.set(o.id,{turn:n,entry:s})}function Je(e){if(typeof e==`string`)return e;if(e==null)return``;try{return JSON.stringify(e)}catch{return String(e)}}function Ye(e,t){let n=e.itemsById.get(N(t.toolCallId)??``);if(!n||n.turn.v2Items||n.entry.origin!==`v1`)return;let r=n.entry.entry;r.kind===`tool`&&(r.status=`completed`,r.output=Je(t.result))}function q(e,t,n,r){let i=N(t.message)??``;i!==``&&R(e,{kind:`note`,id:n,text:i,tone:r})}function J(e,t){q(e,t,`v1:${t.seq}`,t.tone===`danger`?`danger`:`dim`)}function Xe(e,t){q(e,t,`v1:${t.seq}`,`danger`)}function Ze(e,t){q(e,t,`v2:${t.seq}`,`danger`)}function Qe(e,t){if(t.status!==`failed`)return;let n=N(t.error)?` — ${N(t.error)}`:``;R(e,{kind:`note`,id:`v1:${t.seq}`,text:`step ${N(t.stepId)??`?`} failed${n}`,tone:`danger`})}function $e(e,t){let n=N(t.command)??`check`,r=typeof t.exitCode==`number`?t.exitCode:-1;R(e,{kind:`tool`,id:`v1:${t.seq}`,name:`check`,toolKind:`execute`,title:`Ran ${n}`,status:r===0?`completed`:`failed`,output:N(t.text)??``,exitCode:r})}function et(e,t){let n=xe(t.provider),r=N(t.authFailureId)??``;n===void 0||r.length<1||r.length>128||R(e,{kind:`provider-auth-required`,id:`v1:${t.seq}`,provider:n,authFailureId:r})}function tt(e,t){let n=N(t.url);if(n===void 0)return;let r={kind:`image`,id:`v1:${t.seq}`,url:n},i=N(t.name);i!==void 0&&(r.name=i),R(e,r)}function nt(e,t){Array.isArray(t.entries)&&(L(e).planEntries=t.entries)}function rt(e,t){z(e);let n=N(t.message);e.sessionEnded={reason:N(t.reason)??`end_turn`,...n===void 0?{}:{message:n}}}var it=new Set([`allow_once`,`allow_always`,`reject_once`,`reject_always`]);function at(e){return M(e)&&typeof e.id==`string`&&e.id!==``&&typeof e.label==`string`&&e.label!==``&&it.has(e.kind)}function ot(e){if(!(!Array.isArray(e)||e.length===0||!e.every(at)))return new Set(e.map(e=>e.id)).size===e.length?e:void 0}function st(e,t){let n=N(t.requestId),r=N(t.title),i=ot(t.options);if(!n||!r||e.permissions.has(n)||!i)return;let a=N(t.itemId),o=N(t.details),s={kind:`permission`,id:`permission:${n}`,requestId:n,title:r,options:i.map(e=>({...e})),status:`pending`,...a===void 0?{}:{itemId:a},...o===void 0?{}:{details:o}};e.permissions.set(n,s),R(e,s)}function ct(e,t){let n=e.permissions.get(N(t.requestId)??``);if(!n||n.status!==`pending`)return;let r=N(t.optionId);r!==void 0&&n.options.some(e=>e.id===r)?(n.status=`resolved`,n.optionId=r):n.status=`expired`;let i=N(t.reason);i!==void 0&&(n.reason=i)}function lt(e,t){let n=D(t),r=n&&A(n);if(!r)return;let i={kind:`ask`,...r,questions:r.questions,resolved:!1};R(e,i),e.pendingAsk=i}function Y(e,t){let n=e.pendingAsk;return n&&!n.resolved&&n.askSeq===t.askSeq?n:void 0}function ut(e,t){let n=Y(e,t);if(!n)return;n.routedToParent=!0;let r=N(t.parentRunId);r!==void 0&&(n.parentRunId=r)}function dt(e,t){let n=Y(e,t);n&&(n.routedToParent=!1)}function ft(e,t){let n=Y(e,t);n&&X(e,n,`undeliverable`)}var pt=new Set([`finish`,`superseded`,`parent-stopped`,`worker-stopped`,`undeliverable`]);function mt(e,t){let n=Y(e,t);n&&pt.has(t.reason)&&X(e,n,t.reason)}function X(e,t,n){t.resolved=!0,t.closed=n,e.pendingAsk=void 0}function Z(e,t){let n=Y(e,t);if(n){if(t.source===`cezar`){X(e,n,`undeliverable`);return}t.source===`parent`&&(n.resolved=!0,n.answeredBy=`parent`,e.pendingAsk=void 0)}}var Q=()=>{},ht=new Map([[`handoff`,De],[`webhook.failed`,Oe],[`webhook.dry-run`,Ae],[`webhook.report`,ke],[`preview.server-registered`,je],[`preview.server-state`,Me],[`conversation-message`,Ne],[`request-outcome`,Pe],[`agent-input`,Fe],[`user-message`,Ie],[`turn.started`,Le],[`turn.completed`,ze],[`item.started`,K],[`item.updated`,K],[`item.completed`,K],[`item.delta`,He],[`text`,Ue],[`tool-call`,qe],[`tool-result`,Ye],[`note`,J],[`lifecycle`,J],[`error`,Xe],[`session.error`,Ze],[`step-end`,Qe],[`check-output`,$e],[`provider-auth-required`,et],[`image`,tt],[`plan.updated`,nt],[`session.started`,e=>z(e)],[`session.ended`,rt],[`permission.requested`,st],[`permission.resolved`,ct],[`ask.requested`,lt],[`worker-question-routed`,ut],[`worker-question-fallback`,dt],[`worker-question-undelivered`,ft],[`human-ask-closed`,mt],[`human-input-delivered`,Z],[`step-start`,Q],[`token-usage`,Q],[`cost`,Q],[`turn-end`,Q],[`done`,Q],[`session`,Q]]);function gt(e,t){ht.get(t.type)?.(e,t)}function _t(e){for(let t=e.turns.length-1;t>=0;--t){let n=e.turns[t].planEntries;if(n!==void 0)return n}}function vt(e){let t=[];for(let n of e.turns)for(let e of n.items)if(e.kind===`tool`){for(let n of e.locations??[])t.push(n.path);for(let n of e.diffs??[])t.push(n.path)}let n=[];for(let e=t.length-1;e>=0;--e)n.includes(t[e])||n.push(t[e]);return n}function yt(e,t){switch(e){case`waiting`:return{state:`waiting`};case`failed`:return{state:`closed`,tone:`danger`,label:t?`Session failed — ${t}`:`Session failed`};case`review`:return{state:`closed`,tone:`dim`,label:`Session closed — waiting for your review`};case`done`:case`cancelled`:return{state:`closed`,tone:`dim`,label:`Session closed`};default:return null}}function $(e,t){let n=e.replace(/\s*CEZ:DONE\s*$/,``).replace(/\s*CEZ:MONITORING\s*$/,``);if(t){let e=n.trimEnd(),t=e.lastIndexOf(`
|
|
2
2
|
`)+1;/^CEZ:ASK[ \t]+.+$/.test(e.slice(t))&&(n=e.slice(0,t).trimEnd())}return n.includes(`CEZ:`)?n.split(`
|
|
3
3
|
`).filter(e=>!/^CEZ:(?:PR=\d+|ISSUE=\d+|TITLE=.+)\s*$/.test(e)).join(`
|
|
4
4
|
`):n}function bt(e){let t=e=>$(e,!0).replace(/\s+/g,``),n=new Set,r=[];for(let{origin:i,entry:a}of e.entries)if(i===`v2`&&a.kind===`message`){let e=t(a.text);n.add(e),r.push(e)}if(r.length===0)return;n.add(r.join(``));let i=[],a={entries:[],texts:[]},o=()=>{if(a.entries.length>=2&&n.has(t(a.texts.join(``)))){a={entries:[],texts:[]};return}i.push(...a.entries),a={entries:[],texts:[]}};for(let t of e.entries)t.origin===`v1`&&t.entry.kind===`message`?(a.entries.push(t),a.texts.push(t.entry.text)):(o(),i.push(t));o(),e.entries=i}function xt(e){let t=new Set;for(let{origin:n,entry:r}of e.entries)n===`v2`&&r.kind===`message`&&t.add($(r.text,!0).trim());t.size!==0&&(e.entries=e.entries.filter(e=>!(e.origin===`v1`&&e.entry.kind===`message`&&t.has($(e.entry.text,!0).trim()))),bt(e))}function St(e){for(let t of e.conversationEntries.values())t.messageKind!==`request`||t.outcome!==void 0||t.delivery!==`not-delivered`&&(t.state!==void 0&&t.state!==`accepted`||(t.outcome={status:`pending`}))}function Ct(e,t){let n=t||e.entries.some(({entry:e})=>e.kind===`ask`);return{id:e.id,...e.turnId===void 0?{}:{turnId:e.turnId},...e.userMessage===void 0?{}:{userMessage:e.userMessage},...e.startedAt===void 0?{}:{startedAt:e.startedAt},...e.planEntries===void 0?{}:{planEntries:e.planEntries},...e.completed===void 0?{}:{completed:e.completed},items:e.entries.map(({entry:e})=>e.kind===`message`&&e.role===`assistant`?{...e,text:$(e.text,n)}:e)}}function wt(e,t={}){let n=j();for(let t of e)gt(n,t);for(let e of n.turns)e.v2Items&&xt(e);St(n);let r=n.turns.length-1;return{turns:n.turns.map((e,n)=>Ct(e,t.activeTurn===!0&&n===r)),...n.sessionEnded===void 0?{}:{sessionEnded:n.sessionEnded}}}export{k as a,m as c,yt as i,wt as n,ce as o,vt as r,h as s,_t as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{d as t,t as n,u as r}from"./button-CS5tOblf.js";import{i,t as a}from"./react-runtime-CCIEwYL0.js";import{Bt as o,C as s,Kr as c,Sr as l,nt as u,r as d,rt as f,tn as p}from"./project-scope-context-DSkcNKO7.js";import{$t as m,M as h,O as g,P as _,Pt as v,Rt as y,Tt as b,et as x,h as S,jt as C,n as w,rt as T}from"./queries-D2MPDhtr.js";import{t as E}from"./useQuery-8pHkglP4.js";import{Z as D,i as O,r as k,t as A}from"./popover-G6KGT-qq.js";import{n as j}from"./toaster-CRVRHlMR.js";import{A as M,Z as ee,_ as N,b as P,ct as F,d as I,ft as te,h as ne,l as L,mt as re,ot as ie,r as ae,rt as oe,u as se,ut as ce}from"./design-icons-DmYTv2r1.js";import{t as le}from"./eye-B8okNWXU.js";import{a as ue,i as R}from"./format-BNCkW110.js";import{t as de}from"./message-square-B-MD-8rD.js";import{t as fe}from"./play-CmVAj_fu.js";import{a as pe,i as me,o as he,r as ge,s as _e,t as ve}from"./dialog-Dw7fMdDQ.js";import{d as z,t as ye,y as B}from"./prompt-template-menu-D4-inlE4.js";import{t as V}from"./project-router-BFKfAFvq.js";import{B as be,E as xe,I as Se,L as H,M as Ce,O as we,P as Te,R as Ee,S as De,T as Oe,a as ke,b as Ae,f as je,h as Me,i as Ne,l as Pe,m as Fe,n as Ie,p as Le,r as U,s as Re,t as ze,u as Be,w as Ve,x as He,z as Ue}from"./agent-accounts-BNlpWTOY.js";import{d as We,f as Ge,i as Ke,s as qe,t as Je,u as Ye}from"./skills-DFBiAuJG.js";import{F as Xe,L as Ze,X as Qe,Y as $e,et,gn as tt}from"./index-CHoW3yXD.js";import{t as nt}from"./diff-DgaFdLIQ.js";import{t as rt}from"./tab-link-DDpdYMnv.js";var W=e(i(),1),G=a(),it={squash:`Squash and merge`,merge:`Create a merge commit`,rebase:`Rebase and merge`};function K({state:e}){let t=`size-4 shrink-0`;return e===`passing`?(0,G.jsx)(L,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-passing`,className:r(t,`text-success`)}):e===`failing`?(0,G.jsx)(N,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-failing`,className:r(t,`text-danger`)}):e===`pending`?(0,G.jsx)(ue,{"aria-hidden":`true`,"data-slot":`gh-merge-status-pending`,className:r(t,`animate-spin text-warning`)}):(0,G.jsx)(ne,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-unknown`,className:r(t,`text-soft-foreground`)})}function at(e){return e?.available?e.mergeState:null}function ot(e,t){return e&&t?.methods.includes(e)?e:t?.defaultMethod??t?.methods[0]??null}function st(e){return e.state===`merged`?`Merged`:e.state===`closed`?`Closed`:e.isDraft?`Draft`:e.mergeable===`conflicting`?`Conflicts must be resolved`:e.canMerge?`Ready to merge`:e.eligibility===`unknown`?`Merge blocked · Requirements unknown`:`Merge blocked`}function ct(e){return e===`approved`||e===`not-required`?`passing`:e===`unknown`?`unknown`:`failing`}function lt(e){return e===`mergeable`?`passing`:e===`conflicting`?`failing`:`unknown`}function ut(e){return e===`conflicting`?`present`:e===`mergeable`?`none`:`unknown`}function dt(e){return e===!0?` · required`:e===null?` · requiredness unknown`:``}function ft(e){return e?.available===!1?e.reason:`GitHub could not load merge requirements.`}function pt(e,t,n){return!!(e&&(t.canMerge||t.canOverride&&n))}function q(e){return e?it[e]:`Merge`}function mt(e){return e===`conflicting`?`true`:void 0}function ht({check:e}){return(0,G.jsxs)(`li`,{className:`flex items-center justify-between gap-3`,children:[(0,G.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,G.jsx)(K,{state:e.state}),(0,G.jsxs)(`span`,{children:[e.name,` · `,e.state,dt(e.required)]})]}),e.url&&t(e.url)?(0,G.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`text-muted-foreground underline`,children:`details`}):null]})}function gt({reason:e}){return(0,G.jsxs)(`section`,{"data-slot":`gh-merge-unavailable`,className:`mt-6 rounded-lg border border-border bg-card p-4 text-sm`,children:[(0,G.jsx)(`p`,{className:`font-medium`,children:`Merge status unavailable`}),(0,G.jsx)(`p`,{className:`mt-1 text-xs text-soft-foreground`,children:e})]})}function _t({state:e,selectedMethod:t,overrideRules:i,mergeEnabled:a,refreshPending:o,onRefresh:s,onRunAgent:c,onConfirm:l,onMethodChange:u,onOverrideChange:d}){let f=st(e),p=ct(e.reviewDecision),m=lt(e.mergeable);return(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[e.canMerge?(0,G.jsx)(L,{size:16,"aria-hidden":`true`,className:`mt-0.5 size-5 shrink-0 text-success`}):(0,G.jsx)(F,{size:16,"aria-hidden":`true`,className:`mt-0.5 size-5 shrink-0 text-warning`}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,G.jsx)(`h3`,{className:`font-semibold`,children:f}),(0,G.jsxs)(n,{type:`button`,variant:`ghost`,size:`sm`,disabled:o,onClick:s,children:[(0,G.jsx)(ee,{size:16,"aria-hidden":`true`,className:r(`size-3.5`,o&&`animate-spin`)}),`Refresh`]})]}),(0,G.jsxs)(`p`,{className:`mt-1 font-mono text-[11px] text-soft-foreground`,children:[e.headRef,` (`,e.headSha.slice(0,7),`) → `,e.baseRef]}),(0,G.jsxs)(`ul`,{className:`mt-3 space-y-2 text-xs`,children:[(0,G.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(K,{state:p}),(0,G.jsxs)(`span`,{children:[`Reviews: `,e.reviewDecision.replaceAll(`-`,` `)]})]}),(0,G.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(K,{state:m}),(0,G.jsxs)(`span`,{children:[`Conflicts: `,ut(e.mergeable)]})]}),e.checks.length===0?(0,G.jsx)(`li`,{children:`No checks configured`}):e.checks.map(e=>(0,G.jsx)(ht,{check:e},e.name)),e.blockers.map(e=>(0,G.jsx)(`li`,{className:`text-soft-foreground`,children:e.message},e.code))]}),e.mergeable===`conflicting`&&c?(0,G.jsx)(n,{className:`mt-4`,onClick:c,children:`Run agent on this PR`}):null,e.canOverride?(0,G.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 rounded-md border border-warning/40 bg-warning/5 p-3 text-xs`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:i,onChange:e=>d(e.target.checked),className:`mt-0.5 size-4 accent-accent-strong`}),(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`span`,{className:`block font-medium`,children:`Merge without waiting for requirements`}),(0,G.jsx)(`span`,{className:`mt-0.5 block text-soft-foreground`,children:`GitHub will allow this only if your permissions can bypass the repository rules.`})]})]}):null,e.eligibility===`unknown`?(0,G.jsx)(`p`,{className:`mt-4 text-xs text-muted-foreground`,children:`GitHub could not confirm review and branch-protection requirements. Passing checks do not establish merge readiness.`}):null,e.state===`open`&&e.methods.length>0?(0,G.jsxs)(`div`,{className:`mt-4 flex flex-col flex-wrap gap-2 sm:flex-row`,children:[(0,G.jsx)(`select`,{"aria-label":`Merge method`,value:t??``,onChange:e=>u(e.target.value),className:`h-9 min-w-0 flex-1 rounded-md border border-input bg-background px-3 text-sm`,children:e.methods.map(e=>(0,G.jsx)(`option`,{value:e,children:it[e]},e))}),(0,G.jsx)(n,{disabled:!a,onClick:l,children:q(t)})]}):null]})]})}function vt({number:e,state:t,selectedMethod:r,confirming:i,overrideRules:a,mergePending:o,mergeError:s,onOpenChange:c,onMerge:l}){return(0,G.jsx)(ve,{open:i,onOpenChange:c,children:(0,G.jsxs)(ge,{"data-slot":`gh-merge-confirm`,showCloseButton:!1,children:[(0,G.jsxs)(he,{children:[(0,G.jsxs)(_e,{children:[q(r),` pull request #`,e,`?`]}),(0,G.jsx)(me,{asChild:!0,children:(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`p`,{children:[`This will merge “`,t.title,`” into `,t.baseRef,`. GitHub will re-check the exact reviewed head before changing the repository.`]}),a&&t.canOverride?(0,G.jsx)(`p`,{"data-slot":`gh-bypass-warning`,className:`mt-4 text-sm text-warning`,children:`You are asking GitHub to bypass unmet repository requirements; GitHub may refuse if your permissions do not allow it.`}):null]})})]}),s?(0,G.jsx)(`p`,{className:`text-sm text-danger`,children:s.message}):null,(0,G.jsxs)(pe,{children:[(0,G.jsx)(n,{variant:`outline`,disabled:o,onClick:()=>c(!1),children:`Cancel`}),(0,G.jsx)(n,{disabled:o,onClick:l,children:o?`Merging…`:q(r)})]})]})})}function yt({number:e,onRunAgent:t}){let n=c(),r=T(),i=E({queryKey:w.githubMergeState(e),queryFn:({signal:t})=>f(e,{},{signal:t}),retry:!1}),a=at(i.data),[s,l]=(0,W.useState)(null),[u,d]=(0,W.useState)(!1),[p,h]=(0,W.useState)(!1),g=m({mutationFn:t=>f(e,{refresh:!0}),onSuccess:(e,t)=>n.setQueryData(t,e),onError:e=>j(e instanceof Error?e.message:String(e),{tone:`danger`})}),_=ot(s,a),v=()=>({mergeState:w.githubMergeState(e),list:w.githubPages(50),comments:w.githubComments(`pr`,e),item:w.githubItem(`pr`,e),refStatus:r===void 0?void 0:w.githubRefStatusOf(r)}),y=m({mutationFn:t=>{if(!a||!_)throw Error(`No merge method is available.`);return o(e,{method:_,expectedHeadSha:a.headSha,...p&&a.canOverride?{overrideRules:!0}:{}})},onSuccess:(t,r)=>{d(!1),j(`Pull request #${e} merged`),n.invalidateQueries({queryKey:r.mergeState}),n.invalidateQueries({queryKey:r.list}),n.invalidateQueries({queryKey:r.comments}),n.invalidateQueries({queryKey:r.item}),r.refStatus&&n.invalidateQueries({queryKey:r.refStatus})},onError:(e,t)=>{j(e instanceof Error?e.message:String(e),{tone:`danger`}),n.invalidateQueries({queryKey:t.mergeState})}});return i.isPending?(0,G.jsx)(B,{"data-slot":`gh-merge-loading`,className:`mt-6 h-32 w-full`}):a?(0,G.jsxs)(`section`,{"data-slot":`gh-merge-box`,"data-eligibility":a.eligibility,"data-conflicting":mt(a.mergeable),"aria-live":`polite`,className:`mt-6 rounded-lg border border-border bg-card p-4`,children:[(0,G.jsx)(_t,{state:a,selectedMethod:_,overrideRules:p,mergeEnabled:pt(_,a,p),refreshPending:g.isPending,onRefresh:()=>g.mutate(w.githubMergeState(e)),onRunAgent:t,onConfirm:()=>d(!0),onMethodChange:l,onOverrideChange:h}),(0,G.jsx)(vt,{number:e,state:a,selectedMethod:_,confirming:u,overrideRules:p,mergePending:y.isPending,mergeError:y.error,onOpenChange:d,onMerge:()=>y.mutate(v())})]}):(0,G.jsx)(gt,{reason:ft(i.data)})}function bt(e){let t=new Set;for(let n of e)for(let e of n.labels)t.add(e);return[...t].sort((e,t)=>e.toLowerCase().localeCompare(t.toLowerCase()))}function xt(e,t={}){let n=(t.query??``).trim().toLowerCase(),r=t.labels??[],i=n.replace(/^#/,``),a=i!==``&&/^\d+$/.test(i);return e.filter(e=>r.length>0&&!r.every(t=>e.labels.includes(t))||t.assignees?.length&&!e.assignees?.some(e=>t.assignees.some(t=>t.toLowerCase()===e.toLowerCase()))||t.author!==void 0&&e.author.toLowerCase()!==t.author.toLowerCase()||t.includeNumbers&&!t.includeNumbers.has(e.number)||t.excludeNumbers?.has(e.number)||t.projectId&&e.projectIds!==void 0&&!e.projectIds.includes(t.projectId)?!1:n===``?!0:a?String(e.number).includes(i):`#${e.number} ${e.title} ${e.author} ${e.body??``}`.toLowerCase().includes(n))}function St(e,t){let n=e.trim();if(n===``)return!1;let r=n.replace(/^#/,``);return/^\d+$/.test(r)?!t.some(e=>e.number===Number(r)):t.length===0}function J(e){if(!e||!/^[0-9a-fA-F]{6}$/.test(e))return{borderColor:`var(--border)`,color:`var(--muted-foreground)`};let t=`#${e}`;return{backgroundColor:`${t}22`,borderColor:`${t}66`,color:`color-mix(in srgb, ${t} 50%, var(--foreground))`}}function Ct({label:e,color:t,plain:n=!1}){return(0,G.jsx)(`span`,{"data-slot":`gh-label`,"data-label":e,style:n?void 0:J(t),className:n?`text-[11px] font-normal text-muted-foreground`:`rounded-full border px-1.5 py-px text-[12px] font-medium`,children:e})}function wt(e){return e===`pr`?`pull request`:`issue`}function Tt(e,t,n){return e===`pr`&&!!(t||n)}function Et({backLink:e}){return e?(0,G.jsxs)(V,{to:e.to,"data-slot":`gh-back`,className:`mb-3 inline-flex items-center gap-1.5 text-xs font-medium text-muted-foreground hover:text-foreground md:hidden`,children:[(0,G.jsx)(ae,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`Back to the list`]}):null}function Dt({item:e,kindWord:n,commentCount:r,hasDiffStat:i,additions:a,deletions:o}){return(0,G.jsxs)(`p`,{"data-slot":`gh-meta`,className:`flex flex-wrap items-center gap-x-1.5 font-mono text-[11px] text-soft-foreground`,children:[(0,G.jsxs)(`span`,{children:[`#`,e.number]}),`·`,(0,G.jsx)(`span`,{children:n}),`·`,(0,G.jsxs)(`span`,{children:[`opened by `,e.author]}),`·`,(0,G.jsxs)(`span`,{children:[R(e.createdAt),` ago`]}),r?(0,G.jsxs)(G.Fragment,{children:[`·`,(0,G.jsx)(Jt,{count:r})]}):null,i?(0,G.jsxs)(G.Fragment,{children:[`·`,(0,G.jsxs)(`span`,{"data-slot":`gh-diffstat`,children:[(0,G.jsxs)(`span`,{className:`text-success`,children:[`+`,a??0]}),` `,(0,G.jsxs)(`span`,{className:`text-danger`,children:[`−`,o??0]})]})]}):null,`·`,t(e.url)?(0,G.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-open-link`,className:`inline-flex items-center gap-0.5 text-muted-foreground hover:text-foreground hover:underline`,children:[`open on GitHub`,(0,G.jsx)(D,{"aria-hidden":`true`,className:`size-2.5`})]}):(0,G.jsx)(`span`,{"data-slot":`gh-open-link`,className:`text-muted-foreground`,children:`open on GitHub`})]})}function Ot({item:e,subNav:t,changes:n}){return e.kind===`pr`?t?(0,G.jsxs)(`nav`,{"aria-label":`Pull request detail`,className:`mt-4 flex border-b border-border`,children:[(0,G.jsx)(rt,{to:z(`prs`,t.filter,e.number),active:!n,children:`Conversation`}),(0,G.jsx)(rt,{to:z(`prs`,t.filter,e.number,`/changes`),active:n,children:`Changes`})]}):(0,G.jsx)(V,{to:z(`prs`,null,e.number,`/changes`),"data-slot":`gh-files-changed`,className:`mt-3 inline-flex items-center gap-1 text-xs font-medium text-muted-foreground hover:text-foreground hover:underline`,children:`Files changed`}):null}function kt({item:e,colors:t,checks:n}){return e.labels.length>0||n?(0,G.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-1.5`,children:[e.labels.map(e=>(0,G.jsx)(Ct,{label:e,color:t[e]},e)),n?(0,G.jsx)(Yt,{checks:n,url:e.url}):null]}):null}function At({item:e,colors:t,body:n}){return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{"data-slot":`gh-body`,className:`mt-5 text-sm`,children:n?(0,G.jsx)(Ze,{children:n}):(0,G.jsx)(`p`,{className:`text-soft-foreground`,children:`(no description)`})}),(0,G.jsx)(Nt,{item:e,colors:t})]})}function jt({item:e,colors:t,checks:n,comments:r,backLink:i,subNav:a,onRunAgent:o,afterHeading:s,children:c}){let l=a?.changes??!1,u=wt(e.kind),d=g(e.kind,e.number,!l).data?.detail,f=d?.body??e.body,p=d?.additions??e.additions,m=d?.deletions??e.deletions,h=Tt(e.kind,p,m),_=r??e.comments;return(0,G.jsxs)(`article`,{"data-slot":`gh-detail-inner`,className:`min-w-0 px-4 py-4 md:px-7 md:py-5`,children:[(0,G.jsx)(Et,{backLink:i}),(0,G.jsxs)(`div`,{"data-slot":`gh-description-card`,className:e.kind===`pr`?`rounded-xl border border-border bg-card p-6`:void 0,children:[e.kind===`pr`?(0,G.jsxs)(`h2`,{className:`mb-4 text-[22px] leading-snug font-normal`,children:[`#`,e.number,` `,e.title]}):null,(0,G.jsx)(Dt,{item:e,kindWord:u,commentCount:_,hasDiffStat:h,additions:p,deletions:m}),e.kind===`pr`?null:(0,G.jsx)(`h2`,{className:`mt-2 text-[22px] leading-snug font-normal`,children:e.title}),s,(0,G.jsx)(Ot,{item:e,subNav:a,changes:l}),(0,G.jsx)(kt,{item:e,colors:t,checks:n}),l&&e.kind===`pr`?(0,G.jsx)(Mt,{item:e}):(0,G.jsx)(At,{item:e,colors:t,body:f})]}),e.kind===`pr`?(0,G.jsx)(yt,{number:e.number,onRunAgent:o}):null,c]})}function Mt({item:e}){let i=c(),a=h(e.number),[o,s]=(0,W.useState)(``),[l,d]=(0,W.useState)(null),f=a.data,p=f?.available?f.files.filter(e=>e.path.toLowerCase().includes(o.toLowerCase())):[],m=p.findIndex(e=>e.path===l);(0,W.useEffect)(()=>{p.length>0&&!p.some(e=>e.path===l)&&d(p[0].path)},[f?.available?f.headSha:``,o]);let g=async()=>{let t=f?.available?f.headSha:null,n=w.githubPrChanges(e.number),r=await u(e.number,{refresh:!0});i.setQueryData(n,r),r.available&&t&&t!==r.headSha&&(d(r.files[0]?.path??null),j(`The reviewed revision changed.`))};if(a.isPending)return(0,G.jsx)(`p`,{"aria-live":`polite`,className:`mt-6 text-sm text-muted-foreground`,children:`Loading changed files…`});if(a.isError||!f)return(0,G.jsx)(`p`,{className:`mt-6 text-sm text-danger`,children:`Changed files could not be loaded.`});if(!f.available)return(0,G.jsx)(`p`,{className:`mt-6 text-sm text-muted-foreground`,children:f.reason});let _=p.map(e=>({path:e.path,...e.previousPath?{oldPath:e.previousPath}:{},status:e.status===`removed`?`deleted`:e.status===`changed`?`modified`:e.status,adds:e.additions,dels:e.deletions,binary:e.patchUnavailableReason===`binary`,patch:e.patch??``})),v=t(e.url)?`${e.url}/files`:null,y=p.find(e=>e.path===l);return(0,G.jsxs)(`section`,{"data-slot":`gh-pr-changes`,className:`mt-5 min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs`,children:[(0,G.jsxs)(`strong`,{children:[f.files.length,` changed files`]}),(0,G.jsxs)(`span`,{className:`text-success`,children:[`+`,f.additions]}),(0,G.jsxs)(`span`,{className:`text-danger`,children:[`−`,f.deletions]}),(0,G.jsxs)(`span`,{className:`font-mono text-muted-foreground`,title:f.headSha,children:[`head `,f.headSha.slice(0,8)]}),(0,G.jsx)(n,{type:`button`,variant:`outline`,size:`sm`,className:`ml-auto min-h-11`,onClick:()=>void g(),children:`Refresh`})]}),f.truncated?(0,G.jsxs)(`p`,{role:`status`,className:`mt-3 rounded-md border border-warning/40 bg-warning/10 p-3 text-xs`,children:[f.reason??`This response is incomplete.`,` `,v?(0,G.jsx)(`a`,{href:v,target:`_blank`,rel:`noopener noreferrer`,className:`underline`,children:`Open all files on GitHub`}):null]}):null,(0,G.jsxs)(`div`,{className:`mt-4 grid min-w-0 gap-4 lg:grid-cols-[240px_minmax(0,1fr)]`,children:[(0,G.jsxs)(`aside`,{className:`min-w-0`,children:[(0,G.jsx)(`input`,{"aria-label":`Filter changed files`,value:o,onChange:e=>s(e.target.value),placeholder:`Filter files…`,className:`min-h-11 w-full rounded-md border border-input bg-background px-3 text-sm`}),(0,G.jsx)(`select`,{"aria-label":`Select changed file`,value:l??``,onChange:e=>d(e.target.value),className:`mt-2 min-h-11 w-full rounded-md border border-input bg-background px-2 text-sm lg:hidden`,children:p.map(e=>(0,G.jsx)(`option`,{children:e.path},e.path))}),(0,G.jsx)(`ul`,{className:`mt-2 hidden max-h-[60vh] overflow-auto lg:block`,children:p.map(e=>(0,G.jsx)(`li`,{children:(0,G.jsxs)(`button`,{type:`button`,onClick:()=>d(e.path),className:r(`min-h-11 w-full truncate rounded px-2 text-left text-xs`,l===e.path&&`bg-muted font-medium`),title:e.path,children:[e.status,` · `,e.path,` `,(0,G.jsxs)(`span`,{className:`text-success`,children:[`+`,e.additions]}),` `,(0,G.jsxs)(`span`,{className:`text-danger`,children:[`−`,e.deletions]})]})},e.path))})]}),(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsxs)(`div`,{className:`mb-2 flex justify-end gap-1`,children:[(0,G.jsx)(n,{"aria-label":`Previous file`,variant:`outline`,size:`icon`,className:`min-h-11 min-w-11`,disabled:m<=0,onClick:()=>d(p[m-1]?.path??null),children:(0,G.jsx)(tt,{})}),(0,G.jsx)(n,{"aria-label":`Next file`,variant:`outline`,size:`icon`,className:`min-h-11 min-w-11`,disabled:m<0||m>=p.length-1,onClick:()=>d(p[m+1]?.path??null),children:(0,G.jsx)(I,{size:16})})]}),p.length===0?(0,G.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No changed files match this filter.`}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(nt,{files:_.filter(e=>e.path===l),wrap:!0,className:`min-w-0`}),y&&!y.patch?(0,G.jsxs)(`p`,{className:`rounded-b border border-border p-3 text-xs text-muted-foreground`,children:[`Patch unavailable: `,y.patchUnavailableReason??`not-provided`,`.`]}):null]})]})]})]})}function Nt({item:e,colors:t}){let n=g(e.kind,e.number),r=n.data,i=(0,W.useMemo)(()=>{let e=[...(r?.comments??[]).map(e=>({row:`comment`,comment:e})),...(r?.events??[]).map(e=>({row:`event`,event:e}))],t=e=>{let t=Date.parse(Pt(e));return Number.isNaN(t)?-1/0:t};return e.sort((e,n)=>t(e)-t(n))},[r?.comments,r?.events]);return n.isPending?(0,G.jsxs)(`section`,{"data-slot":`gh-thread-loading`,className:`mt-6 border-t border-border pt-5`,children:[(0,G.jsx)(B,{className:`mb-3 h-3 w-24`}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,G.jsx)(B,{className:`h-14 w-full`}),(0,G.jsx)(B,{className:`h-14 w-full`})]})]}):!r||!r.available?(0,G.jsxs)(`section`,{"data-slot":`gh-thread-error`,className:`mt-6 border-t border-border pt-5 text-xs text-soft-foreground`,children:[(0,G.jsxs)(`span`,{children:[`Couldn’t load comments — `,r?.reason??(n.error instanceof Error?n.error.message:`could not load comments`),`. `]}),(0,G.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-0.5 text-muted-foreground hover:text-foreground hover:underline`,children:[`open on GitHub`,(0,G.jsx)(D,{"aria-hidden":`true`,className:`size-2.5`})]})]}):i.length===0?null:(0,G.jsxs)(`section`,{"data-slot":`gh-thread`,className:`mt-6 border-t border-border pt-5`,children:[(0,G.jsxs)(`h3`,{"data-slot":`gh-thread-header`,className:`mb-4 text-[11px] font-semibold tracking-wide text-soft-foreground uppercase`,children:[`Activity · `,r.comments.length,` comment`,r.comments.length===1?``:`s`]}),(0,G.jsx)(`ul`,{className:`flex flex-col gap-5`,children:Ft(i).map(e=>e.group===`commits`?(0,G.jsx)(It,{commits:e.commits,colors:t},e.commits[0].id):e.entry.row===`comment`?(0,G.jsx)(Kt,{comment:e.entry.comment},`${e.entry.comment.kind}-${e.entry.comment.id}`):(0,G.jsx)(Lt,{event:e.entry.event,colors:t},e.entry.event.id))}),r.truncated?(0,G.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-thread-truncated`,className:`mt-4 inline-flex items-center gap-0.5 text-xs text-soft-foreground hover:text-foreground hover:underline`,children:[`thread truncated — open on GitHub`,(0,G.jsx)(D,{"aria-hidden":`true`,className:`size-2.5`})]}):null]})}var Pt=e=>e.row===`comment`?e.comment.createdAt:e.event.createdAt;function Ft(e){let t=[],n=[],r=()=>{n.length!==0&&(n.length===1?t.push({group:`single`,entry:{row:`event`,event:n[0]}}):t.push({group:`commits`,commits:n}),n=[])};for(let i of e){if(i.row===`event`&&i.event.kind===`committed`&&i.row===`event`){let e=n[n.length-1];e&&e.actor!==i.event.actor&&r(),n.push(i.event);continue}r(),t.push({group:`single`,entry:i})}return r(),t}function It({commits:e,colors:t}){let[n,r]=(0,W.useState)(!1),i=e[0]?.actor??`?`;return n?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`true`,className:`min-w-0`,children:(0,G.jsxs)(`button`,{type:`button`,"aria-expanded":!0,onClick:()=>r(!1),className:`flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground hover:text-foreground`,children:[(0,G.jsx)(`span`,{"aria-hidden":`true`,children:Y.committed}),(0,G.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,G.jsxs)(`span`,{children:[`added `,e.length,` commits`]})]})}),e.map(e=>(0,G.jsx)(Lt,{event:e,colors:t},e.id))]}):(0,G.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`false`,className:`min-w-0`,children:(0,G.jsxs)(`button`,{type:`button`,"aria-expanded":!1,onClick:()=>r(!0),className:`flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground hover:text-foreground`,children:[(0,G.jsx)(`span`,{"aria-hidden":`true`,children:Y.committed}),(0,G.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,G.jsxs)(`span`,{children:[`added `,e.length,` commits`]}),(0,G.jsx)(`span`,{className:`shrink-0`,children:R(e[e.length-1].createdAt)})]})})}var Y={committed:`⚙`,labeled:`◆`,unlabeled:`◇`,assigned:`◍`,unassigned:`◌`,merged:`⑃`,closed:`⊘`,reopened:`⊙`,head_ref_force_pushed:`↻`,"cross-referenced":`↗`,renamed:`✎`};function Lt({event:e,colors:t}){return(0,G.jsxs)(`li`,{"data-slot":`gh-event-row`,"data-kind":e.kind,className:r(`flex min-w-0 items-center gap-1.5 font-mono text-[11px] text-soft-foreground`,e.kind===`merged`&&`text-accent-foreground`),children:[(0,G.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0`,children:Y[e.kind]}),(0,G.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.actor}),(0,G.jsx)(Ut,{event:e,colors:t}),(0,G.jsx)(`span`,{className:`shrink-0`,children:R(e.createdAt)}),e.url?(0,G.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`open ${e.kind} on GitHub`,className:`ml-auto shrink-0 text-muted-foreground hover:text-foreground`,children:(0,G.jsx)(D,{"aria-hidden":`true`,className:`size-2.5`})}):null]})}function Rt({event:e}){return(0,G.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,G.jsx)(`span`,{className:`shrink-0`,children:`committed`}),e.sha?(0,G.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:e.sha.slice(0,7)}):null,e.message?(0,G.jsx)(`span`,{className:`truncate font-sans text-foreground`,children:e.message}):null,(0,G.jsx)(Wt,{checks:e.checks})]})}function zt({event:e,colors:t}){return(0,G.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,G.jsx)(`span`,{className:`shrink-0`,children:e.kind===`labeled`?`added the`:`removed the`}),e.label?(0,G.jsx)(`span`,{"data-slot":`gh-event-label`,style:J(e.label.color??t[e.label.name]),className:`max-w-[12rem] truncate rounded-full border px-1.5 py-px font-sans text-[12px]`,children:e.label.name}):null,(0,G.jsx)(`span`,{className:`shrink-0`,children:`label`})]})}function Bt({event:e}){return(0,G.jsxs)(`span`,{className:`truncate`,children:[e.kind===`assigned`?`assigned`:`unassigned`,` `,e.subject??`someone`]})}function Vt({event:e}){return(0,G.jsxs)(`span`,{className:`truncate`,children:[`referenced this in `,e.refNumber?`#${e.refNumber}`:`another thread`,e.refTitle?` ${e.refTitle}`:``]})}var Ht={committed:e=>(0,G.jsx)(Rt,{event:e}),labeled:(e,t)=>(0,G.jsx)(zt,{event:e,colors:t}),unlabeled:(e,t)=>(0,G.jsx)(zt,{event:e,colors:t}),assigned:e=>(0,G.jsx)(Bt,{event:e}),unassigned:e=>(0,G.jsx)(Bt,{event:e}),merged:()=>(0,G.jsx)(`span`,{children:`merged this`}),closed:()=>(0,G.jsx)(`span`,{children:`closed this`}),reopened:()=>(0,G.jsx)(`span`,{children:`reopened this`}),head_ref_force_pushed:()=>(0,G.jsx)(`span`,{children:`force-pushed`}),renamed:e=>(0,G.jsxs)(`span`,{className:`truncate`,children:[`renamed this to `,e.subject??`—`]}),"cross-referenced":e=>(0,G.jsx)(Vt,{event:e})};function Ut({event:e,colors:t}){return Ht[e.kind]?.(e,t)??null}function Wt({checks:e}){return e?(0,G.jsx)(`span`,{"data-slot":`gh-commit-checks`,"data-checks":e,"aria-label":`checks ${e}`,className:r(`shrink-0`,Z[e]),children:X[e]}):null}var Gt={approved:{label:`approved`,tone:`border-success/40 text-success`},changes_requested:{label:`changes requested`,tone:`border-danger/40 text-danger`},commented:{label:`commented`,tone:`border-border text-muted-foreground`},dismissed:{label:`dismissed`,tone:`border-border text-muted-foreground`}};function Kt({comment:e}){let t=e.reviewState?Gt[e.reviewState]:null;return(0,G.jsxs)(`li`,{"data-slot":`gh-thread-entry`,"data-kind":e.kind,className:`min-w-0`,children:[(0,G.jsxs)(`div`,{className:`mb-1.5 flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground`,children:[(0,G.jsx)(qt,{url:e.avatarUrl,login:e.author}),(0,G.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.author}),(0,G.jsx)(`span`,{children:R(e.createdAt)}),t?(0,G.jsx)(`span`,{"data-slot":`gh-review-chip`,"data-review-state":e.reviewState,className:r(`rounded-full border px-1.5 py-px font-sans text-[12px] font-medium`,t.tone),children:t.label}):null,(0,G.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`open comment on GitHub`,className:`ml-auto shrink-0 text-muted-foreground hover:text-foreground`,children:(0,G.jsx)(D,{"aria-hidden":`true`,className:`size-2.5`})})]}),(0,G.jsx)(`div`,{"data-slot":`gh-thread-body`,className:`text-sm`,children:e.body?(0,G.jsx)(Ze,{children:e.body}):(0,G.jsx)(`p`,{className:`text-soft-foreground`,children:`(no body)`})})]})}function qt({url:e,login:t}){let[n,r]=(0,W.useState)(!1);return e&&!n?(0,G.jsx)(`img`,{src:e,alt:``,width:16,height:16,loading:`lazy`,onError:()=>r(!0),"data-slot":`gh-avatar`,className:`size-4 shrink-0 rounded-full`}):(0,G.jsx)(`span`,{"data-slot":`gh-avatar-fallback`,"aria-hidden":`true`,className:`flex size-4 shrink-0 items-center justify-center rounded-full bg-muted text-[8px] font-semibold text-muted-foreground uppercase`,children:t.slice(0,1)||`?`})}var X={passing:`✓`,failing:`✗`,pending:`○`},Z={passing:`text-success`,failing:`text-danger`,pending:`text-muted-foreground`};function Jt({count:e}){return e?(0,G.jsxs)(`span`,{"data-slot":`gh-comment-count`,"data-count":e,"aria-label":`${e} comment${e===1?``:`s`}`,className:`inline-flex shrink-0 items-center gap-0.5`,children:[(0,G.jsx)(de,{"aria-hidden":`true`,className:`size-3`}),e]}):null}function Yt({checks:e,url:t}){let n=r(`text-[11px] font-medium`,Z[e],t&&`hover:underline`),i=`${X[e]} checks ${e}`;return t?(0,G.jsx)(`a`,{href:`${t}/checks`,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-checks`,"data-checks":e,className:n,children:i}):(0,G.jsx)(`span`,{"data-slot":`gh-checks`,"data-checks":e,className:n,children:i})}function Xt({checks:e}){return(0,G.jsx)(`span`,{"data-slot":`gh-row-checks`,"data-checks":e,title:`checks ${e}`,"aria-label":`checks ${e}`,className:r(`shrink-0 font-sans text-[11px] font-semibold`,Z[e]),children:X[e]})}function Zt(e){return`${e.kind===`pr`?`Address GitHub pull request`:`Fix GitHub issue`} #${e.number}: ${e.title}\n\n${e.url}`}function Qt(e,t=[]){let n=Zt(e);return e.body?.trim()&&(n+=`\n\n---\n\n${e.body.trim()}`),t.length&&(n+=$t(t)),n}function $t(e){return`\n\nUse these skills where relevant: ${e.join(`, `)}.`}function en(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 tn(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 Q(e,t,n){let r=(n??``).trim();if(!r)return Qt(e,t);let i=Zt(e),a=r.startsWith(i)?i+en(r.slice(i.length),e):en(r,e),o=tn(a,e)?a:`${i}\n\n${a}`;return t.length?o+$t(t):o}function nn(e){let t=[];for(let n of e.slice(0,8)){let e=new Set(t.map(e=>e.id)),r=n;for(let t=2;e.has(r);t++)r=`${n}-${t}`;t.push({id:r,name:n,skill:n,prompt:`{{task}}`})}return t}function rn(e,t,n,r,i={}){return t?{...i,workflow:t,task:Q(e,n,r)}:n.length?{...i,steps:nn(n),task:Q(e,[],r)}:{...i,workflow:`quick-task`,task:Q(e,[],r)}}function an(e){let t=x(),n=S(),r=l(t.data),i=n.data?.defaultRunner,a=xe(e.runner,r,i??r[0]??`claude`),o=b(a),s=n.data?.modelsLocked===!0,{accounts:c,repoAccount:u}=Ie(),d=c.some(t=>t.provider===a&&t.id===e.account)?e.account:null,f=Oe(s?null:e.model,a,n.data?.defaultModels,o.data),p=Ae(a,f,o.data);return{runner:a,runnerExplicit:e.runner!==null,model:f,effort:s?``:Ve(e.effort,p),effortOptions:p,runners:r,defaultRunner:i,canRun:t.isSuccess&&r.length>0,modelsLocked:s,providerPending:t.isPending,providerError:t.isError,accounts:c,account:d,repoAccount:u}}function on(e){return{runner:we(e.runner,e.defaultRunner,e.runnerExplicit),model:e.modelsLocked?void 0:e.model||void 0,effort:e.modelsLocked?void 0:e.effort||void 0}}function sn(e){return{...on(e),...e.account?{agentProfile:e.account}:{}}}function cn({pick:e,onChange:t,disabled:n=!1,accounts:r=!1,layout:i}){let a=(0,W.useRef)(null),o=(0,W.useRef)(null),[s,c]=(0,W.useState)(()=>typeof window<`u`&&window.innerWidth<=767);(0,W.useLayoutEffect)(()=>{let e=a.current;if(i!==`row`||!e)return;let t=()=>{let t=window.innerWidth<=767||e.getBoundingClientRect().width<550,n=document.activeElement;o.current=n instanceof HTMLElement&&e.contains(n)?n:null,c(t)};t();let n=typeof ResizeObserver>`u`?null:new ResizeObserver(t);return n?.observe(e),window.addEventListener(`resize`,t),()=>{n?.disconnect(),window.removeEventListener(`resize`,t)}},[i]),(0,W.useLayoutEffect)(()=>{let e=o.current;o.current=null,e&&e.isConnected&&document.activeElement!==e&&e.focus()},[s]);let l=an(e),{runner:u,model:d,effort:f,effortOptions:p,runners:m,canRun:h,modelsLocked:g}=l,_=S(),v=b(u),y=De(u,v.data,[e.model,_.data?.defaultModels?.[u]]),x=n||!h,C=r?l.accounts:[],w=m.length>1||m.some(e=>ze(C,e))?(0,G.jsx)(ke,{icon:(0,G.jsx)(ie,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,runners:m,value:u,accounts:C,account:r?l.account:null,repoAccount:r?l.repoAccount:void 0,disabled:x,onPick:(n,i)=>t(r?{runner:n,account:i,model:n===u?e.model:null,effort:e.effort}:{runner:n,account:null,model:null,effort:e.effort})},`runner`):null,T=(0,G.jsx)(U,{icon:(0,G.jsx)(P,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,slot:`model-pill`,ariaLabel:`Model`,label:d===``?`Default`:y.find(e=>e.id===d).label,value:d,disabled:x,readOnly:g===!0,disabledHint:g?`Model selection is locked to native coding-agent settings.`:void 0,onPick:n=>{let r=Ae(u,n,v.data);t({...e,model:n,effort:e.effort===null?null:Ve(e.effort,r)})},options:y.map(e=>({value:e.id,label:e.label,desc:e.desc})),status:He(u,v.data,v.isError,v.isFetching)},`model`),E=(0,G.jsx)(U,{icon:(0,G.jsx)(M,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,slot:`effort-pill`,ariaLabel:`Effort`,label:p.find(e=>e.value===f)?.label??`auto`,value:f,disabled:x,readOnly:g===!0,disabledHint:g?`Effort selection is locked to native coding-agent settings.`:void 0,onPick:n=>t({...e,effort:n}),options:p.map(e=>({value:e.value,label:e.label,desc:e.desc}))},`effort`);return i===`row`?(0,G.jsx)(`div`,{ref:a,"data-slot":`engine-row-box`,children:(0,G.jsx)(`div`,{"data-slot":`engine-row`,className:`engine-row`,role:`group`,"aria-label":`Agent settings`,children:(0,G.jsx)(Ne,{children:s?[w,E,T]:[w,T,E]})})}):(0,G.jsxs)(Ne,{children:[w,T,E]})}var ln={workflow:null,skills:[]},un=`cez-followup-selection`;function dn(e){let t=e&&typeof e==`object`?e:{};return{workflow:typeof t.workflow==`string`?t.workflow:null,skills:Array.isArray(t.skills)?t.skills.filter(e=>typeof e==`string`):[]}}function fn(){try{let e=localStorage.getItem(un);return e?dn(JSON.parse(e)):{...ln}}catch{return{...ln}}}function pn(e){try{localStorage.setItem(un,JSON.stringify(e))}catch{}}var $=`cez-followup-prompt:`;function mn(e){try{return localStorage.getItem($+e)??``}catch{return``}}function hn(e,t){try{t===``?localStorage.removeItem($+e):localStorage.setItem($+e,t)}catch{}}function gn({item:e,workflows:r,skills:i,workflow:a,onWorkflowChange:o,selectedSkills:l,onSkillsChange:u,engine:d,onEngineChange:f,queuedRunId:h,onQueued:g}){let y=c(),b=v(),x=_().data?.capabilities.automations===!0,S=e.kind===`pr`?`PR`:`issue`,C=l.filter(e=>i.some(t=>t.name===e)),[T]=(0,W.useState)(()=>Zt(e)),[E,D]=(0,W.useState)(()=>mn(e.url)||T),O=an(d),k=(0,W.useRef)(null),A=(0,W.useRef)(null);(0,W.useEffect)(()=>{hn(e.url,E===T?``:E)},[e.url,E,T]);let M=(0,W.useMemo)(()=>Me(je(b.data?.promptTemplates),{automations:x}),[b.data?.promptTemplates,x]),ee=e=>{let t=k.current,n=Fe({prompt:E,base:T,selectionStart:t?.selectionStart??null,focused:document.activeElement===t,remembered:A.current}),r=Be(E,n,e);D(r.text),A.current=r.caret,requestAnimationFrame(()=>{k.current?.focus(),k.current?.setSelectionRange(r.caret,r.caret)})},N=Pe(M,C),P=(0,W.useRef)(E);P.current=E;let F=(0,W.useRef)(``);(0,W.useEffect)(()=>{let e=Le(P.current,F.current,N,T);F.current=e.applied,e.text!==P.current&&D(e.text)},[N,T]);let I=m({mutationFn:async()=>O.canRun?s(rn(e,a,C,E,sn(O))):null,onSuccess:t=>{if(t===null)return;let n=t;n&&g(e.url,n.id),j(`Added to the queue — ${S} #${e.number}`),C.length>0&&b.data!==void 0&&p({skillUsage:C.reduce((e,t)=>Je(e,t),b.data.skillUsage)}).then(()=>y.invalidateQueries({queryKey:w.uiState})).catch(()=>{}),hn(e.url,``),D(T),F.current=``,y.invalidateQueries({queryKey:w.runs.all})},onError:e=>j(e.message,{tone:`danger`})}),te=e=>{$e({key:e.key,shiftKey:e.shiftKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,repeat:e.repeat,isComposing:e.nativeEvent.isComposing})&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),!I.isPending&&O.canRun&&I.mutate())},ne=e=>u(l.includes(e)?l.filter(t=>t!==e):[...l,e]);return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`section`,{"data-slot":`gh-hand`,className:`mt-7 rounded-lg border border-border bg-card p-4`,children:[(0,G.jsx)(`h3`,{className:`text-xl font-normal text-foreground`,children:`Hand this to the agent`}),(0,G.jsxs)(`label`,{className:`gh-field gh-prompt-field`,children:[(0,G.jsx)(`span`,{children:`Instructions for the agent`}),(0,G.jsx)(et,{ref:k,"data-slot":`gh-custom-prompt`,"aria-label":`Custom prompt`,"aria-keyshortcuts":`Control+Enter Meta+Enter`,value:E,onChange:e=>D(e.target.value),onSelect:e=>{A.current=e.currentTarget.selectionStart},onKeyDown:te,placeholder:`Instructions for the agent… (#${e.number} and its link are always sent)`,className:`mt-3 min-h-20 text-[13px]`})]}),(0,G.jsx)(ye,{templates:M,onInsert:ee}),(0,G.jsxs)(`div`,{className:`gh-handoff-settings`,children:[(0,G.jsxs)(`div`,{className:`gh-field`,children:[(0,G.jsx)(`span`,{children:`Workflow`}),(0,G.jsx)(_n,{workflows:r,value:a,onChange:o})]}),(0,G.jsxs)(`div`,{className:`gh-field`,children:[(0,G.jsx)(`span`,{children:`Skills · select one or more`}),(0,G.jsx)(yn,{skills:i,skillUsage:b.data?.skillUsage,selected:C,onToggle:ne})]}),C.length>0?(0,G.jsx)(`div`,{"data-slot":`gh-skill-chips`,className:`mt-2.5 flex flex-wrap gap-1.5`,children:C.map(e=>(0,G.jsxs)(`button`,{type:`button`,"data-slot":`gh-skill-chip`,"data-skill":e,onClick:()=>ne(e),title:`Remove this skill`,className:`inline-flex min-h-11 items-center gap-2 rounded-lg border border-border bg-card px-3 text-xs font-medium text-foreground transition-colors hover:bg-danger/10 hover:text-danger`,children:[e,(0,G.jsx)(re,{size:16,"aria-hidden":`true`,className:`size-3`})]},e))}):null,(0,G.jsx)(cn,{layout:`row`,pick:d,onChange:f,disabled:I.isPending||!O.canRun,accounts:!0}),(0,G.jsxs)(`div`,{className:`gh-field`,children:[(0,G.jsx)(`span`,{children:`Account`}),(0,G.jsx)(vn,{resolved:O,disabled:I.isPending||!O.canRun,onPick:e=>f({...d,account:e})})]}),!O.providerPending&&!O.canRun?(0,G.jsxs)(`span`,{"data-slot":`gh-provider-gate`,className:`inline-flex flex-wrap items-center gap-1 text-xs text-muted-foreground`,children:[O.providerError?`Provider authentication could not be verified.`:`Connect an agent provider to run this item.`,(0,G.jsx)(V,{to:`/settings/agents#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}):null]}),(0,G.jsxs)(`p`,{className:`text-[11px] leading-relaxed text-muted-foreground`,children:[e.kind===`pr`?`PR`:`Issue`,` number and link remain attached to the task. Edit the prompt before starting. Cmd/Ctrl+Enter submits; Enter adds a new line.`]})]}),(0,G.jsxs)(`div`,{"data-slot":`gh-handoff-actions`,className:`mt-[22px] flex flex-wrap items-center gap-2.5`,children:[t(e.url)?(0,G.jsx)(n,{asChild:!0,variant:`outline`,children:(0,G.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,children:`Open in GitHub`})}):null,(0,G.jsxs)(n,{variant:`primary`,"data-action":`gh-run`,disabled:I.isPending||!O.canRun,onClick:()=>I.mutate(),children:[(0,G.jsx)(fe,{"aria-hidden":`true`,className:`size-3.5`}),`Run agent on this `,S]}),(0,G.jsx)(`kbd`,{"aria-hidden":`true`,className:`rounded-[5px] border border-b-2 border-border bg-card px-[5px] py-px font-mono text-[11px] font-medium text-muted-foreground`,children:Qe()}),h?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`span`,{"data-slot":`gh-queued`,className:`flex items-center gap-1 text-xs font-medium text-success`,children:[(0,G.jsx)(L,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`queued`]}),(0,G.jsx)(V,{to:`/tasks/${h}`,"data-slot":`gh-view-run`,className:`text-xs font-semibold text-accent-text hover:underline`,children:`View task →`})]}):null]})]})}function _n({workflows:e,value:t,onChange:n}){let[i,a]=(0,W.useState)(!1),[o,s]=(0,W.useState)(``),c=(0,W.useRef)(null),l=We(e,o);return(0,G.jsxs)(A,{open:i,onOpenChange:e=>{a(e),e||s(``)},children:[(0,G.jsx)(O,{asChild:!0,children:(0,G.jsxs)(`button`,{type:`button`,"data-slot":`gh-workflow-trigger`,"aria-label":`Choose a workflow`,className:r(Re,t&&`border-foreground/60 font-mono text-[11px] font-semibold text-foreground`),children:[(0,G.jsx)(te,{size:16,"aria-hidden":`true`,className:`size-3 shrink-0 text-accent-icon`}),(0,G.jsx)(`span`,{className:`min-w-0 max-w-44 truncate`,children:t??`workflow`}),(0,G.jsx)(se,{size:16,"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,G.jsx)(k,{align:`start`,sideOffset:8,className:`w-[320px] max-w-[calc(100vw-2rem)] p-0`,children:(0,G.jsxs)(Te,{shouldFilter:!1,children:[(0,G.jsx)(Ee,{placeholder:`search workflows…`,value:o,onValueChange:s,onInput:()=>c.current?.scrollTo(0,0)}),(0,G.jsxs)(be,{ref:c,"data-slot":`gh-workflow-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[l.length===0?(0,G.jsx)(Se,{children:`Nothing matches.`}):null,(0,G.jsx)(H,{children:l.map(e=>{let r=t===e.name;return(0,G.jsxs)(Ue,{value:`workflow ${e.name}`,keywords:Ge(e.name,e.description),"data-slot":`gh-workflow-option`,"data-workflow":e.name,onSelect:()=>{n(r?null:e.name),a(!1)},children:[(0,G.jsx)(`span`,{className:`shrink-0 font-mono text-xs`,children:e.name}),e.description?(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,r?(0,G.jsx)(L,{size:16,"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-link-foreground`}):null]},e.name)})})]})]})})]})}function vn({resolved:e,disabled:t,onPick:n}){let r=e.accounts.filter(t=>t.provider===e.runner),i=[...r.some(e=>e.id==="default")?[]:[{value:Ce,label:`Default`}],...r.map(e=>({value:e.id,label:e.label,desc:e.configDir}))],a=e.account??e.repoAccount?.[e.runner]??`default`;return(0,G.jsx)(U,{icon:(0,G.jsx)(ce,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),slot:`account-pill`,ariaLabel:`Account`,label:i.find(e=>e.value===a)?.label??`Default`,value:a,options:i,disabled:t,onPick:n})}function yn({skills:e,skillUsage:t,selected:n,onToggle:i}){let[a,o]=(0,W.useState)(!1),[s,c]=(0,W.useState)(``),[l,u]=(0,W.useState)(null),d=(0,W.useRef)(null),{mostUsed:f,project:p,global:m,ranked:h}=Ye(e,s,t),g=(e,t)=>{let a=n.includes(e.name);return(0,G.jsxs)(Ue,{value:`skill ${e.name} ${e.path}`,keywords:Ge(e.name,e.description),"data-slot":`gh-skill-option`,"data-skill":e.name,"data-selected":a?`true`:void 0,onSelect:()=>i(e.name),children:[(0,G.jsx)(`span`,{className:r(`shrink-0 font-mono text-xs`,t&&`font-semibold`),children:e.name}),e.description?(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,(0,G.jsx)(`button`,{type:`button`,"data-slot":`gh-skill-view`,"aria-label":`View skill ${e.name}`,title:`View skill`,onClick:t=>{t.preventDefault(),t.stopPropagation(),u(e)},className:`ml-auto shrink-0 rounded-sm p-0.5 text-soft-foreground transition-colors hover:text-foreground`,children:(0,G.jsx)(le,{"aria-hidden":`true`,className:`size-3.5`})}),a?(0,G.jsx)(L,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0 text-link-foreground`}):null]},e.path)};return e.length===0?null:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Xe,{skill:l,onClose:()=>u(null)}),(0,G.jsxs)(A,{open:a,onOpenChange:e=>{o(e),e||c(``)},children:[(0,G.jsx)(O,{asChild:!0,children:(0,G.jsxs)(`button`,{type:`button`,"data-slot":`gh-skills-trigger`,"aria-label":`Choose skills`,className:r(Re,n.length>0&&`border-foreground/60 font-semibold text-foreground`),children:[(0,G.jsx)(oe,{size:16,"aria-hidden":`true`,className:`size-3 shrink-0 text-accent-icon`}),`skills`,n.length>0?` · ${n.length}`:``,(0,G.jsx)(se,{size:16,"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,G.jsx)(k,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,G.jsxs)(Te,{shouldFilter:!1,children:[(0,G.jsx)(Ee,{placeholder:`search skills…`,value:s,onValueChange:c,onInput:()=>d.current?.scrollTo(0,0)}),(0,G.jsxs)(be,{ref:d,"data-slot":`gh-skill-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[(h?h.length===0:f.length===0&&p.length===0&&m.length===0)?(0,G.jsx)(Se,{children:`Nothing matches.`}):null,h?h.length>0?(0,G.jsx)(H,{children:h.map(e=>g(e,Ke(e)))}):null:(0,G.jsxs)(G.Fragment,{children:[f.length>0?(0,G.jsx)(H,{heading:`Most used`,children:f.map(e=>g(e,Ke(e)))}):null,p.length>0?(0,G.jsx)(H,{heading:`Project skills`,children:p.map(e=>g(e,!0))}):null,m.length>0?(0,G.jsx)(H,{heading:`Global`,children:m.map(e=>g(e,!1))}):null]})]})]})})]})]})}var bn=new WeakMap;function xn(){let e=fn(),t={workflow:e.workflow,selectedSkills:e.skills,engine:{runner:null,model:null,effort:null,account:null},queued:new Map},n=new Set;return{snapshot:()=>t,subscribe:e=>(n.add(e),()=>{n.delete(e)}),update:e=>{t={...t,...e},(e.workflow!==void 0||e.selectedSkills!==void 0)&&pn({workflow:t.workflow,skills:[...t.selectedSkills]}),n.forEach(e=>e())}}}function Sn(){let e=c(),{projectId:t}=d(),n=bn.get(e);n||bn.set(e,n=new Map);let r=n.get(t);r||n.set(t,r=xn());let{snapshot:i,subscribe:a,update:o}=r,s=(0,W.useSyncExternalStore)(a,i,i),l=y(),u=C(),f=v(),p=l.data?.workflows;(0,W.useEffect)(()=>{p&&s.workflow!==null&&!p.some(e=>e.name===s.workflow)&&o({workflow:null})},[o,p,s.workflow]);let m=(0,W.useMemo)(()=>qe(u.data??[],f.data?.skillUsage),[u.data,f.data?.skillUsage]);return{...s,workflows:l,skillList:m,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{Jt as a,Ft as c,J as d,St as f,Xt as i,bt as l,gn as n,jt as o,Qt as r,Ct as s,Sn as t,xt as u};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{E as t,t as n,u as r}from"./button-CS5tOblf.js";import{i,t as a}from"./react-runtime-CCIEwYL0.js";import{A as o,Kr as s,T as c,Xt as l,i as u,qt as d}from"./project-scope-context-DSkcNKO7.js";import{$t as f,Pt as p,Rt as ee,jt as te,n as ne}from"./queries-D2MPDhtr.js";import{n as m}from"./toaster-CRVRHlMR.js";import{C as h,Q as g,S as re,X as _,a as ie,ct as ae,dt as oe,l as se,lt as v,mt as y,n as b,rt as ce,st as x,u as le,x as S,y as C}from"./design-icons-DmYTv2r1.js";import{i as w,p as ue,r as T,t as E}from"./dropdown-menu-D7f0O7xR.js";import{a as D,c as O,i as k,n as A,o as j,r as M,s as N,t as P}from"./alert-dialog-h-3h9B4l.js";import{i as F,o as de,r as I,s as L,t as R}from"./dialog-Dw7fMdDQ.js";import{t as z}from"./input-DIwJvCgi.js";import{_ as fe,a as B,d as pe,g as me,h as V,i as he,l as ge,m as H,o as _e,p as ve,r as ye,s as be,t as U,v as W}from"./sortable.esm-zp_qkYGV.js";import{i as G,l as xe,s as Se}from"./skills-DFBiAuJG.js";import{t as Ce}from"./centered-state-BmsqxbI8.js";import{O as we,et as K}from"./index-CHoW3yXD.js";import{n as Te}from"./skill-empty-hint-YDmkqgo-.js";var q=e(i(),1);function J(e){let t=[];for(let n of e){if(n.command||!n.skill||n.prompt!==void 0&&n.prompt!==`{{task}}`||n.name!==void 0&&n.name!==n.skill||n.timeoutMs!==void 0||n.model||n.effort!==void 0||n.runner||n.agentProfile||n.allowedTools||n.bashAllowlist||n.onFail)return null;t.push(n.skill)}return t.length?t:null}function Ee(e,t){let n=new Set(t.map(e=>e.id)),r=e;for(let t=2;n.has(r);t++)r=`${e}-${t}`;return{id:r,name:e,skill:e,prompt:`{{task}}`}}function De(e,t,n){let r=[...e];return r.splice(Math.max(0,Math.min(n,r.length)),0,t),r}function Oe(e,t,n){if(t===n||t<0||t>=e.length||n<0||n>=e.length)return[...e];let r=[...e],[i]=r.splice(t,1);return i===void 0?[...e]:(r.splice(n,0,i),r)}function ke(e,t){return e.filter((e,n)=>n!==t)}function Y(e){let t=String(e),n=/^[A-Za-z0-9._][A-Za-z0-9 ._/-]*$/.test(t)&&!t.endsWith(` `),r=/^(true|false|yes|no|on|off|null|~)$/i.test(t)||/^[-+.]?\d/.test(t);return n&&!r?t:JSON.stringify(t)}function X(e,t,n){let r=` `.repeat(n);return t.includes(`
|
|
2
|
+
`)?[`${r}${e}: |`,...t.split(`
|
|
3
|
+
`).map(e=>`${r} ${e}`)]:[`${r}${e}: ${Y(t)}`]}function Ae(e){let t=[];return e.name&&e.name!==e.id&&t.push(` name: ${Y(e.name)}`),e.skill&&t.push(` skill: ${Y(e.skill)}`),t}function Z(e){let t=[];return e.model&&t.push(` model: ${Y(e.model)}`),e.timeoutMs!==void 0&&t.push(` timeoutMs: ${e.timeoutMs}`),e.effort!==void 0&&t.push(` effort: ${Y(e.effort)}`),e.runner&&t.push(` runner: ${Y(e.runner)}`),e.agentProfile&&t.push(` agentProfile: ${Y(e.agentProfile)}`),t}function je(e){let t=[];return e.allowedTools&&t.push(` allowedTools: [${e.allowedTools.map(Y).join(`, `)}]`),e.bashAllowlist&&t.push(` bashAllowlist: [${e.bashAllowlist.map(Y).join(`, `)}]`),t}function Me(e){return e.onFail?[` onFail:`,` retry: ${Y(e.onFail.retry)}`,` max: ${e.onFail.max??2}`]:[]}function Ne(e){return[` - id: ${Y(e.id)}`,...Ae(e),...e.prompt?X(`prompt`,e.prompt,4):[],...Z(e),...je(e),...e.command?X(`command`,e.command,4):[],...Me(e)]}function Pe(e,t,n){let r=[`name: ${Y(e.trim()||`my-workflow`)}`];t.trim()&&r.push(...X(`description`,t.trim(),0));let i=J(n);if(i){r.push(`skills:`);for(let e of i)r.push(` - ${Y(e)}`)}else if(n.length){r.push(`steps:`);for(let e of n)r.push(...Ne(e))}else r.push(`skills: []`);return`${r.join(`
|
|
4
|
+
`)}\n`}function Fe(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)||`workflow`}function Ie(e){let t=J(e)?`skill`:`step`;return`${e.length} ${t}${e.length===1?``:`s`}`}function Le(e,t){let n=new Set,r=[];for(let t of e.steps.slice(0,8)){let e=t.id||`step`,i=e;for(let t=2;n.has(i);t++)i=`${e}-${t}`;n.add(i),r.push({...t,id:i})}return{name:e.name?.trim()||t,steps:r}}function Re(e,t,n){let r=J(n);return{name:e.trim(),...t.trim()?{description:t.trim()}:{},...r?{skills:r}:{steps:[...n]}}}var Q=a();function ze({workflows:e,draft:t,trimmedName:n,nameRef:r,onDraft:i,onLoadWorkflow:a}){return(0,Q.jsxs)(`section`,{"data-slot":`wb-metadata`,className:`flex min-w-0 flex-col gap-3`,children:[(0,Q.jsxs)(`div`,{"data-slot":`wb-load`,className:`flex flex-col items-start gap-2`,children:[(0,Q.jsx)(`label`,{htmlFor:`workflow-load`,className:`text-xs text-muted-foreground`,children:`Load an existing workflow`}),(0,Q.jsxs)(`div`,{className:`relative max-w-full`,children:[(0,Q.jsx)(le,{"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,Q.jsxs)(`select`,{id:`workflow-load`,value:e.some(e=>e.name===n)?n:``,onChange:t=>{let n=e.find(e=>e.name===t.target.value);n&&a(n)},className:`h-11 max-w-full rounded-lg border border-border bg-card pl-9 pr-3 text-xs font-medium appearance-none focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,Q.jsx)(`option`,{value:``,disabled:!0,children:`Choose a workflow`}),e.map(e=>(0,Q.jsx)(`option`,{value:e.name,"data-slot":`wb-load-option`,"data-name":e.name,children:e.name},e.name))]})]})]}),(0,Q.jsx)(`label`,{htmlFor:`workflow-name`,className:`text-xs font-semibold`,children:`Workflow name`}),(0,Q.jsx)(z,{id:`workflow-name`,ref:r,"data-slot":`wb-name`,"aria-label":`Workflow name`,spellCheck:!1,value:t.name,onChange:e=>i({...t,name:e.target.value}),className:`h-12 bg-card text-sm`}),(0,Q.jsx)(`label`,{htmlFor:`workflow-description`,className:`text-xs font-semibold`,children:`Description`}),(0,Q.jsx)(K,{id:`workflow-description`,"data-slot":`wb-description`,"aria-label":`Description`,value:t.description,onChange:e=>i({...t,description:e.target.value}),className:`min-h-[72px] bg-card p-3.5 text-sm`})]})}function Be({savedFile:e,autoOpen:t,onImportToggle:r,onExport:i,onAutoToggle:a,onDeleteRequest:o}){return(0,Q.jsxs)(`div`,{"data-slot":`wb-actions`,className:`grid grid-cols-[max-content_max-content] items-center justify-start gap-2 sm:flex sm:flex-wrap [&_button]:min-h-11 [&_button]:border [&_button]:border-border [&_button]:bg-card`,children:[(0,Q.jsxs)(n,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-import`,className:`col-span-2 justify-self-start`,onClick:r,children:[(0,Q.jsx)(v,{"aria-hidden":`true`,className:`size-3`}),`Import`]}),(0,Q.jsxs)(n,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-export`,className:`col-span-2 justify-self-start`,title:`Download workflow.yaml`,onClick:i,children:[(0,Q.jsx)(S,{"aria-hidden":`true`,className:`size-3`}),`Export`]}),(0,Q.jsxs)(n,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-auto`,"aria-expanded":t,title:`Describe a chain — the agent builds it`,onClick:a,children:[(0,Q.jsx)(oe,{"aria-hidden":`true`,className:`size-3`}),`Auto`]}),e?(0,Q.jsxs)(n,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-delete`,className:`text-danger hover:text-danger`,title:`Delete the saved workflow file`,onClick:o,children:[(0,Q.jsx)(x,{"aria-hidden":`true`,className:`size-3`}),`Delete`]}):null]})}function Ve({text:e,onTextChange:t,pending:r,onRun:i,onCancel:a}){return(0,Q.jsxs)(`div`,{"data-slot":`wb-auto-panel`,className:`rounded-xl border border-border bg-card p-5 [&_button]:min-h-11`,children:[(0,Q.jsx)(`h2`,{className:`text-lg font-normal`,children:`Build a chain from a prompt`}),(0,Q.jsx)(`p`,{className:`mt-4 text-[13px] leading-relaxed text-muted-foreground`,children:`Describe the outcome. An agent proposes a title and ordered skill/check steps. Review the result, edit it, then Save.`}),(0,Q.jsx)(K,{"data-slot":`wb-auto-text`,"aria-label":`Describe the chain to build`,rows:3,autoFocus:!0,placeholder:`e.g. Fix the bug, run the tests, then review the diff for regressions.`,value:e,onChange:e=>t(e.target.value),onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),i())},className:`mt-4 min-h-[108px] bg-background p-4 text-sm`}),(0,Q.jsxs)(`div`,{className:`mt-3 flex items-center gap-1.5`,children:[(0,Q.jsxs)(n,{type:`button`,variant:`primary`,size:`sm`,"data-slot":`wb-auto-run`,disabled:r||e.trim()===``,onClick:i,children:[(0,Q.jsx)(oe,{"aria-hidden":`true`,className:`size-3`}),r?`Building…`:`Build chain`]}),(0,Q.jsxs)(n,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-auto-cancel`,onClick:a,children:[(0,Q.jsx)(y,{"aria-hidden":`true`,className:`size-4`}),`Cancel`]})]}),(0,Q.jsx)(`p`,{className:`mt-4 text-xs text-muted-foreground`,children:`Creates an editable draft. Review the generated name and steps before saving.`})]})}function He({open:e,onOpenChange:t,text:r,onTextChange:i,error:a,pending:o,onRun:s,onCancel:c}){return(0,Q.jsx)(R,{open:e,onOpenChange:t,children:(0,Q.jsxs)(I,{showCloseButton:!1,"data-slot":`wb-import-panel`,className:`max-md:translate-x-0 max-md:translate-y-0 sm:max-w-[660px] rounded-xl border border-border bg-card p-5 [&_button]:min-h-11`,children:[(0,Q.jsx)(L,{className:`text-xl font-normal`,children:`Import workflow YAML`}),(0,Q.jsx)(F,{className:`sr-only`,children:`Paste a portable workflow definition to import.`}),(0,Q.jsx)(K,{"data-slot":`wb-import-text`,"aria-label":`Workflow YAML to import`,rows:4,spellCheck:!1,placeholder:`name: my-flow
|
|
5
|
+
skills:
|
|
6
|
+
- test-conventions
|
|
7
|
+
- commit-style`,value:r,onChange:e=>i(e.target.value),className:`mt-4 min-h-[124px] bg-background p-4 font-mono text-[13px] leading-relaxed`}),(0,Q.jsx)(`p`,{className:`mt-4 text-[13px] text-muted-foreground`,children:`Paste a portable workflow definition. Imported steps appear in execution order.`}),a===``?null:(0,Q.jsx)(`p`,{"data-slot":`wb-import-error`,role:`alert`,className:`mt-2 text-xs text-danger`,children:a}),(0,Q.jsxs)(`div`,{className:`mt-3 flex items-center gap-1.5`,children:[(0,Q.jsx)(n,{type:`button`,variant:`primary`,size:`sm`,"data-slot":`wb-import-run`,disabled:o,onClick:s,children:`Import`}),(0,Q.jsx)(n,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-import-cancel`,onClick:c,children:`Cancel`})]})]})})}function Ue({paletteSkills:e,query:t,onQueryChange:n,error:r,inFlow:i,onAdd:a,yaml:o}){return(0,Q.jsxs)(`aside`,{"data-slot":`wb-aside`,className:`min-w-0 rounded-xl border border-border bg-card p-5`,children:[(0,Q.jsx)(`h2`,{className:`text-[16px] font-semibold`,children:`Available skills`}),(0,Q.jsxs)(`div`,{className:`sw-search relative mt-4`,children:[(0,Q.jsx)(g,{"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,Q.jsx)(z,{"data-slot":`wb-filter`,placeholder:`Find a skill…`,"aria-label":`Filter skills`,value:t,onChange:e=>n(e.target.value),className:`h-11 pl-9 text-xs`})]}),(0,Q.jsx)(rt,{skills:e,query:t,error:r,inFlow:i,onAdd:a}),(0,Q.jsx)(`h3`,{className:`mt-5 text-sm font-semibold`,children:`workflow.yaml`}),(0,Q.jsx)(`p`,{className:`mt-3 text-xs leading-relaxed text-muted-foreground`,children:`Export the workflow to use this chain in another project.`}),(0,Q.jsxs)(`details`,{className:`mt-4 min-w-0`,children:[(0,Q.jsxs)(`summary`,{"data-slot":`wb-yaml-toggle`,className:`inline-flex min-h-[44px] cursor-pointer items-center rounded-lg border border-border px-3 text-xs font-medium focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,Q.jsx)(h,{"aria-hidden":`true`,className:`mr-2 size-4`}),`View YAML`]}),(0,Q.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,Q.jsx)(at,{yaml:o})}),(0,Q.jsx)(`pre`,{"data-slot":`wb-yaml`,className:`mt-2 max-h-96 overflow-auto rounded-lg border border-border bg-background p-3 font-mono text-[11px] leading-relaxed whitespace-pre text-muted-foreground`,children:o})]})]})}function We({dragging:e,steps:t,skills:n}){return e?.type===`palette`?(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border border-border bg-card px-2.5 py-1.5 font-mono text-[13px] font-medium shadow-md`,children:[(0,Q.jsx)(ce,{"aria-hidden":`true`,className:`size-3.5 text-link-foreground`}),e.skill]}):e?.type===`step`?(0,Q.jsx)(nt,{step:e.step,index:t.findIndex(t=>t.id===e.step.id),skills:n,overlay:!0}):null}function Ge({open:e,onOpenChange:t,query:r,onQueryChange:i,matches:a,skillsCount:o,error:s,selectedSkill:c,onSelectSkill:l,stepsCount:u,onCloseAutoFocus:d,onCancel:f,onAdd:p}){return(0,Q.jsx)(R,{open:e,onOpenChange:t,children:(0,Q.jsxs)(I,{"data-slot":`wb-add-dialog`,onCloseAutoFocus:d,className:`max-h-[85dvh] overflow-y-auto sm:max-w-[660px] [&_button]:min-h-11`,children:[(0,Q.jsxs)(de,{children:[(0,Q.jsx)(L,{className:`text-xl font-normal`,children:`Add step`}),(0,Q.jsx)(F,{className:`sr-only`,children:`Choose a skill to append to this workflow.`})]}),(0,Q.jsx)(z,{"aria-label":`Filter skills`,placeholder:`Filter skills…`,value:r,onChange:e=>i(e.target.value)}),s===null?(0,Q.jsxs)(`div`,{role:`radiogroup`,"aria-label":`Available skills`,className:`grid max-h-80 gap-2 overflow-y-auto`,children:[a.map(e=>(0,Q.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-3 rounded-lg py-2 has-[:checked]:bg-accent-strong/10 has-[:focus-visible]:outline-2`,children:[(0,Q.jsx)(`input`,{type:`radio`,name:`workflow-add-skill`,className:`sr-only`,value:e.name,checked:c===e.name,onChange:()=>l(e.name)}),(0,Q.jsxs)(`span`,{className:`min-w-0 break-words text-sm`,children:[(0,Q.jsx)(`span`,{className:`block`,children:e.name}),(0,Q.jsx)(`span`,{className:`mt-2 block text-xs text-muted-foreground`,children:e.description})]})]},e.name)),a.length===0?(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:o===0?`No skills available in this project.`:`No matching skills.`}):null]}):(0,Q.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[`Could not load skills: `,s]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,Q.jsx)(n,{variant:`outline`,onClick:f,children:`Cancel`}),(0,Q.jsx)(n,{variant:`primary`,disabled:!c||u>=8,onClick:()=>{c&&p(c)},children:`Add selected skill`})]}),(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Append the selected skill, then reorder it in the existing canvas.`}),u>=8?(0,Q.jsxs)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:[`A workflow can contain up to `,8,` steps. Remove a step before adding another.`]}):null]})})}function Ke({trimmedName:e,savedFile:t,overwriteOpen:n,onOverwriteDismiss:r,deleteOpen:i,onDeleteDismiss:a,onOverwrite:o,onDelete:s}){return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(P,{open:n,onOpenChange:e=>!e&&r(),children:(0,Q.jsxs)(k,{"data-slot":`wb-overwrite-dialog`,className:`sw-workflow-confirm sm:max-w-[660px]`,children:[(0,Q.jsxs)(N,{children:[(0,Q.jsxs)(O,{children:[`“`,e,`” already exists`]}),(0,Q.jsx)(D,{children:`Saving overwrites the existing workflow file. There is no undo.`})]}),(0,Q.jsxs)(j,{children:[(0,Q.jsx)(M,{children:`Keep the file`}),(0,Q.jsx)(A,{"data-slot":`wb-overwrite-confirm`,className:`bg-danger text-danger-foreground`,onClick:o,children:`Overwrite`})]})]})}),(0,Q.jsx)(P,{open:i,onOpenChange:e=>!e&&a(),children:(0,Q.jsxs)(k,{"data-slot":`wb-delete-dialog`,className:`sw-workflow-confirm sm:max-w-[660px]`,children:[(0,Q.jsxs)(N,{children:[(0,Q.jsxs)(O,{children:[`Delete workflow “`,e,`”?`]}),(0,Q.jsxs)(D,{children:[`Removes `,t?.path?.split(`/`).pop()??`the saved file`,` from`,` `,(0,Q.jsx)(`span`,{className:`font-mono`,children:`.ai/cezar/workflows/`}),`. There is no undo.`]})]}),(0,Q.jsxs)(j,{children:[(0,Q.jsx)(M,{children:`Keep the file`}),(0,Q.jsx)(A,{"data-slot":`wb-delete-confirm`,className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:s,children:`Delete workflow`})]})]})})]})}function qe(e){return e.name??e.skill??e.id}function Je(e){return e.prompt?.trim()===`{{task}}`?void 0:e.prompt?.trim()}function Ye(e){let t=e.onFail?` — on fail retry from "${e.onFail.retry}" (×${e.onFail.max??2})`:``;return`$ ${e.command}${t}`}function Xe(e,t){return Je(e)||t?.description||`Not in this repo or the team skills — the step runs on its plain prompt.`}function Ze(e,t){return e.command?Ye(e):e.skill?Xe(e,t):e.prompt??``}function Qe(e,t){return e.skill&&!t?`unknown`:null}function $e(e){return e.command?`Command step${e.onFail?` · Retry ×${e.onFail.max??2}`:``}`:e.skill?`Skill step`:`Prompt step`}function et({index:e,title:t,badge:i,onRemove:a,gripProps:o}){return(0,Q.jsxs)(`div`,{"data-slot":`wb-step-heading`,className:`flex min-w-0 items-center gap-2.5`,children:[(0,Q.jsx)(`button`,{type:`button`,"data-slot":`wb-step-grip`,"aria-label":`Reorder step ${e+1}: ${t}`,className:`inline-flex size-[26px] shrink-0 cursor-grab items-center justify-center rounded-md text-muted-foreground transition-colors outline-none hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50`,...o,children:(0,Q.jsx)(`span`,{className:`rounded bg-accent-strong/10 px-2 py-1 font-mono text-[12px] text-link-foreground`,children:String(e+1).padStart(2,`0`)})}),(0,Q.jsx)(`div`,{className:`min-w-0 flex-1 break-words text-sm font-medium [overflow-wrap:anywhere]`,children:t}),i?(0,Q.jsx)(`span`,{"data-slot":`wb-step-badge`,className:r(`shrink-0 rounded-full border px-2 py-px font-mono text-[11px]`,i===`unknown`&&`border-danger/35 text-danger`),children:i}):null,a?(0,Q.jsxs)(E,{children:[(0,Q.jsx)(ue,{asChild:!0,children:(0,Q.jsx)(n,{"data-slot":`wb-step-actions`,variant:`ghost`,size:`icon`,className:`size-[26px]`,"aria-label":`Step ${e+1} actions: ${t}`,children:(0,Q.jsx)(re,{"aria-hidden":`true`,className:`size-4`})})}),(0,Q.jsx)(T,{align:`end`,children:(0,Q.jsxs)(w,{"data-slot":`wb-step-remove`,"aria-label":`Remove step ${e+1}: ${t}`,onSelect:a,children:[(0,Q.jsx)(x,{"aria-hidden":`true`}),` Remove step`]})})]}):null]})}function tt({index:e,onMoveUp:t,onMoveDown:r}){return(0,Q.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2 @min-[900px]:hidden`,children:[(0,Q.jsxs)(n,{variant:`outline`,size:`sm`,className:`min-h-11`,"aria-label":`Move step ${e+1} up`,disabled:!t,onClick:t,children:[(0,Q.jsx)(ie,{"aria-hidden":`true`,className:`size-4`}),`Move up`]}),(0,Q.jsxs)(n,{variant:`outline`,size:`sm`,className:`min-h-11`,"aria-label":`Move step ${e+1} down`,disabled:!r,onClick:r,children:[(0,Q.jsx)(b,{"aria-hidden":`true`,className:`size-4`}),`Move down`]})]})}function nt({step:e,index:t,skills:n,onRemove:i,gripProps:a,onMoveUp:o,onMoveDown:s,overlay:c=!1}){let l=n.find(t=>t.name===e.skill),u=qe(e),d=Ze(e,l),f=Qe(e,l);return(0,Q.jsxs)(`div`,{"data-slot":`wb-step`,"data-id":e.id,"data-index":t,className:r(`rounded-lg border border-border bg-background p-4`,c&&`shadow-md`),children:[(0,Q.jsx)(et,{index:t,title:u,badge:f,onRemove:i,gripProps:a}),d?(0,Q.jsx)(`div`,{"data-slot":`wb-step-summary`,className:`mt-3 break-words text-xs leading-relaxed text-muted-foreground`,children:d}):null,(0,Q.jsx)(`p`,{"data-slot":`wb-step-kind`,className:`mt-3 text-[12px] text-link-foreground`,children:$e(e)}),c?null:(0,Q.jsx)(tt,{index:t,onMoveUp:o,onMoveDown:s})]})}function rt({skills:e,query:t,error:n,inFlow:r,onAdd:i}){if(n!==null)return(0,Q.jsxs)(`p`,{"data-slot":`wb-palette`,className:`mt-2.5 text-xs text-danger`,children:[`Could not load skills: `,n]});let a=xe(e,t);return(0,Q.jsx)(`div`,{"data-slot":`wb-palette`,className:`mt-2.5 flex flex-col gap-1`,children:a.length>0?a.map(e=>(0,Q.jsx)(it,{skill:e,inFlow:r.has(e.name),onAdd:i},e.path)):(0,Q.jsx)(`p`,{className:`py-1 text-xs leading-relaxed text-soft-foreground`,children:e.length>0?`No skills match.`:(0,Q.jsx)(Te,{})})})}function it({skill:e,inFlow:t,onAdd:n}){let{attributes:i,listeners:a,setNodeRef:o,isDragging:s}=H({id:`palette:${e.name}`,data:{type:`palette`,skill:e.name}});return(0,Q.jsxs)(`div`,{ref:o,"data-slot":`wb-skill`,"data-skill":e.name,"data-in-flow":t||void 0,title:e.description??``,className:r(`flex min-h-11 cursor-grab items-center gap-2 rounded-md py-1 transition-colors hover:bg-muted`,s&&`opacity-40`),...i,...a,children:[(0,Q.jsx)(`span`,{className:r(`min-w-0 flex-1 break-words text-xs`,G(e)?`font-semibold text-foreground`:`font-medium text-muted-foreground`),children:e.name}),(0,Q.jsx)(`button`,{type:`button`,"data-slot":`wb-skill-add`,"aria-label":`Add ${e.name} to the flow`,title:`Add to the flow`,onClick:()=>n(e.name),className:`inline-flex size-11 shrink-0 items-center justify-center rounded-md text-link-foreground transition-colors outline-none hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:(0,Q.jsx)(_,{"aria-hidden":`true`,className:`size-3.5`})})]})}function at({yaml:e}){let[t,n]=(0,q.useState)(!1),r=(0,q.useRef)(null);return(0,q.useEffect)(()=>()=>{r.current!==null&&clearTimeout(r.current)},[]),(0,Q.jsx)(`button`,{type:`button`,"data-slot":`wb-copy`,title:`Copy the YAML`,onClick:()=>{navigator.clipboard?.writeText(e).catch(()=>{}),n(!0),r.current!==null&&clearTimeout(r.current),r.current=setTimeout(()=>n(!1),1600)},className:`flex items-center gap-1 text-xs font-medium text-muted-foreground transition-colors hover:text-foreground`,children:t?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(se,{"aria-hidden":`true`,className:`size-3 text-success`}),`Copied`]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(C,{"aria-hidden":`true`,className:`size-3`}),`Copy`]})})}var ot=`wb-canvas`;function $(){return{name:`my-workflow`,description:``,steps:[]}}function st(e){return{name:e.name,description:e.description??``,steps:structuredClone(e.steps??[])}}function ct(){let{name:e}=t();return(0,Q.jsx)(lt,{routeName:e},e??``)}function lt({routeName:e}){let t=ee(),r=te(),i=p(),a=s(),[h,g]=(0,q.useState)(null),[re,ie]=(0,q.useState)(``),[oe,v]=(0,q.useState)(!1),[y,b]=(0,q.useState)(``),[ce,x]=(0,q.useState)(null),[le,S]=(0,q.useState)(!1),[C,w]=(0,q.useState)(``),[ue,T]=(0,q.useState)(``),[E,D]=(0,q.useState)(!1),[O,k]=(0,q.useState)(``),[A,j]=(0,q.useState)(!1),[M,N]=(0,q.useState)(!1),[P,F]=(0,q.useState)(null),[de,I]=(0,q.useState)(null),L=(0,q.useRef)(null),R=(0,q.useRef)(null),z=t.data?.workflows??[],B=r.data??[],V=Se(B,i.data?.skillUsage),he=xe(V,y,i.data?.skillUsage);(0,q.useEffect)(()=>{if(h!==null||t.data===void 0)return;let n=t.data.workflows,r=(e?n.find(t=>t.name===e):void 0)??n.find(e=>e.source===`file`);g(r?st(r):$())},[h,t.data,e]);let H=e=>g(t=>t===null?t:{...t,steps:e}),U=f({mutationFn:e=>d(e),onSuccess:e=>{g({name:e.name,description:e.description??``,steps:e.steps}),S(!1),w(``),T(``),m(`Imported "${e.name}" — review, then Save.`)},onError:e=>T(e.message)}),W=f({mutationFn:e=>l(e),onSuccess:e=>{g(t=>{let n=t??$(),{name:r,steps:i}=Le(e,n.name);return{...n,name:r,steps:i}}),D(!1),k(``),m(e.fallback?`Planner unavailable — added a single step. Edit, then Save.`:`Built "${e.name??h?.name??`workflow`}" — review, tweak, then Save.`,e.fallback?{tone:`danger`}:void 0)},onError:e=>m(e instanceof Error?e.message:String(e),{tone:`danger`})}),G=f({mutationFn:e=>c({...Re(h?.name??``,h?.description??``,h?.steps??[]),...e?{overwrite:!0}:{}}),onSuccess:e=>{j(!1),m(`Saved — ${e.path.split(`/`).pop()??e.path}`),a.invalidateQueries({queryKey:ne.workflows})},onError:e=>{e instanceof u&&e.exists===!0?j(!0):m(e instanceof Error?e.message:String(e),{tone:`danger`})}}),K=f({mutationFn:e=>o(e),onSuccess:(e,t)=>{N(!1),m(`Deleted "${t}".`),g($()),a.invalidateQueries({queryKey:ne.workflows})},onError:e=>{N(!1),m(e instanceof Error?e.message:String(e),{tone:`danger`})}}),Te=fe(me(pe,{activationConstraint:{distance:4}}),me(ge,{coordinateGetter:ye}));if(t.isError)return(0,Q.jsx)(`div`,{"data-route":`workflows`,className:`@container mx-auto min-h-full w-full px-[18px] py-6 md:p-9`,children:(0,Q.jsx)(Ce,{icon:(0,Q.jsx)(ae,{}),tone:`danger`,title:`Could not load workflows`,subtitle:t.error.message})});if(h===null)return(0,Q.jsx)(we,{});let J=h.steps,Y=h.name.trim(),X=z.find(e=>e.name===Y&&e.source===`file`),Ae=Pe(h.name,h.description,J),Z=(e,t=J.length)=>{if(J.length>=8){m(`A workflow holds at most 8 steps.`,{tone:`danger`});return}H(De(J,Ee(e,J),t))};return(0,Q.jsxs)(`div`,{"data-route":`workflows`,className:`@container mx-auto min-h-full w-full px-[18px] py-6 md:p-9`,children:[(0,Q.jsxs)(`header`,{className:`mb-[22px] flex flex-wrap items-center justify-between gap-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h1`,{className:`text-[25px] font-semibold md:text-[30px]`,children:`Workflows`}),(0,Q.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground md:text-[13px]`,children:`Portable skill chains. Steps run from top to bottom.`})]}),(0,Q.jsxs)(n,{variant:`primary`,"data-slot":`wb-new`,className:`min-h-11`,onClick:()=>g($()),children:[(0,Q.jsx)(_,{"aria-hidden":`true`,className:`size-4`}),`New workflow`]})]}),(0,Q.jsxs)(_e,{sensors:Te,collisionDetection:ve,onDragStart:e=>{let t=e.active.data.current;F(t??null)},onDragOver:e=>{I(e.over?String(e.over.id):null)},onDragEnd:e=>{F(null),I(null);let{active:t,over:n}=e;if(n===null)return;let r=t.data.current;if(r?.type===`palette`){let e=n.id===ot?J.length:J.findIndex(e=>e.id===n.id);Z(r.skill,e===-1?J.length:e);return}if(n.id===t.id)return;let i=J.findIndex(e=>e.id===t.id),a=J.findIndex(e=>e.id===n.id);i!==-1&&a!==-1&&H(Oe(J,i,a))},onDragCancel:()=>{F(null),I(null)},children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-[22px] pb-[calc(32px+env(safe-area-inset-bottom))]`,children:[(0,Q.jsx)(ze,{workflows:z,draft:h,trimmedName:Y,nameRef:L,onDraft:g,onLoadWorkflow:e=>g(st(e))}),(0,Q.jsx)(Be,{savedFile:X,autoOpen:E,onImportToggle:()=>{T(``),D(!1),S(e=>!e)},onExport:()=>{let e=new Blob([Ae],{type:`text/yaml`}),t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=`${Fe(h.name)}.yaml`,document.body.appendChild(n),n.click(),n.remove(),setTimeout(()=>URL.revokeObjectURL(t),1e3)},onAutoToggle:()=>{S(!1),D(e=>!e)},onDeleteRequest:()=>N(!0)}),E?(0,Q.jsx)(Ve,{text:O,onTextChange:k,pending:W.isPending,onRun:()=>{let e=O.trim();e===``||W.isPending||W.mutate(e)},onCancel:()=>{D(!1),k(``)}}):null,(0,Q.jsx)(He,{open:le,onOpenChange:S,text:C,onTextChange:w,error:ue,pending:U.isPending,onRun:()=>{let e=C.trim();e!==``&&U.mutate(e)},onCancel:()=>{S(!1),w(``),T(``)}}),(0,Q.jsxs)(`div`,{className:`grid min-w-0 items-start gap-[22px] @min-[700px]:grid-cols-[minmax(0,1fr)_300px]`,children:[(0,Q.jsxs)(`section`,{"data-slot":`wb-main`,className:`min-w-0 rounded-xl border border-border bg-card p-5`,children:[(0,Q.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Steps · `,J.length,` of `,8,(0,Q.jsx)(`span`,{"data-slot":`wb-count`,className:`sr-only`,children:Ie(J)})]}),(0,Q.jsx)(ut,{steps:J,skills:B,dragging:P!==null,overId:de,activeStepId:P?.type===`step`?P.step.id:null,onRemove:e=>H(ke(J,e)),onMove:(e,t)=>H(Oe(J,e,t))}),(0,Q.jsxs)(n,{ref:R,variant:`outline`,className:`mt-4 min-h-11`,onClick:()=>{x(null),b(``),v(!0)},children:[(0,Q.jsx)(_,{"aria-hidden":`true`,className:`size-4`}),`Add step`]}),(0,Q.jsxs)(`p`,{className:`mt-4 text-xs leading-relaxed text-muted-foreground`,children:[(0,Q.jsx)(`span`,{className:`hidden @min-[900px]:inline`,children:`Drag to reorder. The agent follows this sequence from top to bottom.`}),(0,Q.jsx)(`span`,{className:`@min-[900px]:hidden`,children:`Use Move up / Move down to reorder without dragging.`})]}),(0,Q.jsxs)(`footer`,{className:`mt-4 flex flex-wrap items-center justify-between gap-4 border-t border-border pt-4`,children:[(0,Q.jsx)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:`Review the name and steps, then save to a workflow file.`}),(0,Q.jsxs)(n,{type:`button`,variant:`primary`,size:`sm`,className:`min-h-11 max-sm:w-full`,"data-slot":`wb-save`,disabled:G.isPending,onClick:()=>{if(Y===``){L.current?.focus();return}if(J.length===0){m(`Add at least one step first.`,{tone:`danger`});return}G.mutate(!1)},children:[(0,Q.jsx)(se,{"aria-hidden":`true`,className:`size-3`}),`Save`]})]})]}),(0,Q.jsx)(Ue,{paletteSkills:V,query:re,onQueryChange:ie,error:r.isError?r.error.message:null,inFlow:new Set(J.map(e=>e.skill).filter(e=>!!e)),onAdd:e=>Z(e),yaml:Ae})]})]}),(0,Q.jsx)(be,{children:(0,Q.jsx)(We,{dragging:P,steps:J,skills:B})})]}),(0,Q.jsx)(Ge,{open:oe,onOpenChange:v,query:y,onQueryChange:b,matches:he,skillsCount:B.length,error:r.isError?r.error.message:null,selectedSkill:ce,onSelectSkill:x,stepsCount:J.length,onCloseAutoFocus:e=>{e.preventDefault(),R.current?.focus()},onCancel:()=>v(!1),onAdd:e=>{Z(e),v(!1)}}),(0,Q.jsx)(Ke,{trimmedName:Y,savedFile:X,overwriteOpen:A,onOverwriteDismiss:()=>j(!1),deleteOpen:M,onDeleteDismiss:()=>N(!1),onOverwrite:()=>G.mutate(!0),onDelete:()=>K.mutate(Y)})]})}function ut({steps:e,skills:t,dragging:n,overId:i,activeStepId:a,onRemove:o,onMove:s}){let{setNodeRef:c,isOver:l}=V({id:ot}),u=n&&i===ot;return(0,Q.jsx)(`div`,{ref:c,"data-slot":`wb-steps`,"data-dragging":n||void 0,className:r(`relative mt-4 rounded-lg transition-colors`,l?`border-accent-strong/60 bg-accent-strong/5`:`border-muted-foreground/25`),children:e.length===0?(0,Q.jsx)(`p`,{className:r(`rounded-md px-3 py-10 text-center text-[13px] transition-colors`,l?`text-link-foreground`:`text-muted-foreground`),children:`Drop a skill here — or Import a workflow.yaml`}):(0,Q.jsxs)(U,{items:e.map(e=>e.id),strategy:B,children:[(0,Q.jsx)(`ol`,{className:`flex flex-col gap-4`,children:e.map((r,c)=>(0,Q.jsx)(dt,{step:r,index:c,skills:t,dragging:n,insertBefore:n&&i===r.id&&a!==r.id,onRemove:()=>o(c),onMoveUp:c>0?()=>s(c,c-1):void 0,onMoveDown:c<e.length-1?()=>s(c,c+1):void 0},r.id))}),(0,Q.jsx)(`div`,{"aria-hidden":`true`,className:r(`absolute inset-x-0 mt-1 h-[3px] rounded-full transition-colors`,u?`bg-accent-strong`:`bg-transparent`)})]})})}function dt({step:e,index:t,skills:n,insertBefore:i,onRemove:a,onMoveUp:o,onMoveDown:s}){let{attributes:c,listeners:l,setNodeRef:u,transform:d,transition:f,isDragging:p}=he({id:e.id,data:{type:`step`,step:e}});return(0,Q.jsxs)(`li`,{ref:u,style:{transform:W.Transform.toString(d),transition:f},className:r(`relative`,p&&`opacity-40`),children:[i?(0,Q.jsx)(`span`,{"aria-hidden":`true`,"data-slot":`wb-drop-line`,className:`pointer-events-none absolute -top-[7px] right-0 left-0 h-[3px] rounded-full bg-accent-strong`}):null,(0,Q.jsx)(nt,{step:e,index:t,skills:n,onRemove:a,onMoveUp:o,onMoveDown:s,gripProps:{...c,...l}})]})}export{ct as WorkflowsRoute};
|
package/web/dist/index.html
CHANGED
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
}
|
|
48
48
|
})()
|
|
49
49
|
</script>
|
|
50
|
-
<script type="module" crossorigin src="/assets/index-
|
|
50
|
+
<script type="module" crossorigin src="/assets/index-CHoW3yXD.js"></script>
|
|
51
51
|
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-QTnfLwEv.js">
|
|
52
52
|
<link rel="modulepreload" crossorigin href="/assets/react-runtime-CCIEwYL0.js">
|
|
53
53
|
<link rel="modulepreload" crossorigin href="/assets/bundle-mjs-BT31bpU6.js">
|
|
@@ -72,18 +72,18 @@
|
|
|
72
72
|
<link rel="modulepreload" crossorigin href="/assets/eye-B8okNWXU.js">
|
|
73
73
|
<link rel="modulepreload" crossorigin href="/assets/format-BNCkW110.js">
|
|
74
74
|
<link rel="modulepreload" crossorigin href="/assets/play-CmVAj_fu.js">
|
|
75
|
-
<link rel="modulepreload" crossorigin href="/assets/
|
|
75
|
+
<link rel="modulepreload" crossorigin href="/assets/reference-chip-Drpbf-MP.js">
|
|
76
76
|
<link rel="modulepreload" crossorigin href="/assets/alert-dialog-h-3h9B4l.js">
|
|
77
77
|
<link rel="modulepreload" crossorigin href="/assets/dialog-Dw7fMdDQ.js">
|
|
78
78
|
<link rel="modulepreload" crossorigin href="/assets/input-DIwJvCgi.js">
|
|
79
79
|
<link rel="modulepreload" crossorigin href="/assets/project-router-BFKfAFvq.js">
|
|
80
|
-
<link rel="modulepreload" crossorigin href="/assets/agent-accounts-
|
|
80
|
+
<link rel="modulepreload" crossorigin href="/assets/agent-accounts-BNlpWTOY.js">
|
|
81
81
|
<link rel="modulepreload" crossorigin href="/assets/skills-DFBiAuJG.js">
|
|
82
|
-
<link rel="modulepreload" crossorigin href="/assets/
|
|
82
|
+
<link rel="modulepreload" crossorigin href="/assets/prompt-template-menu-D4-inlE4.js">
|
|
83
|
+
<link rel="modulepreload" crossorigin href="/assets/sortable.esm-zp_qkYGV.js">
|
|
83
84
|
<link rel="modulepreload" crossorigin href="/assets/centered-state-BmsqxbI8.js">
|
|
84
85
|
<link rel="modulepreload" crossorigin href="/assets/lib-BxQXEXDF.js">
|
|
85
86
|
<link rel="modulepreload" crossorigin href="/assets/chunk-BO2N2NFS-DE6qKn3r.js">
|
|
86
|
-
<link rel="modulepreload" crossorigin href="/assets/sortable.esm-zp_qkYGV.js">
|
|
87
87
|
<link rel="stylesheet" crossorigin href="/assets/index-9YmaiQ1k.css">
|
|
88
88
|
</head>
|
|
89
89
|
<body>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{M as t,t as n,u as r}from"./button-CS5tOblf.js";import{i,t as a}from"./react-runtime-CCIEwYL0.js";import{t as o}from"./arrow-right-Dh_Lx3um.js";import{A as s,B as c,C as l,E as u,F as d,G as f,H as p,I as m,K as h,L as g,N as _,Q as v,T as y,U as b,V as x,W as S,X as C,Y as w,Z as T,a as E,c as D,g as O,i as k,m as A,n as j,o as M,r as N,s as P,t as F,w as I,z as L}from"./activity-motion-Dld5ms7x.js";import{s as R}from"./project-router-BFKfAFvq.js";import{Lt as z,Xt as B}from"./index-DBNT3CYH.js";var V=e(i(),1),H=a(),U=`rounded-xl border border-border bg-card px-3.5 py-3`,W=`mb-2 flex gap-2 text-[11.5px] font-semibold tracking-[0.06em] text-muted-foreground uppercase`;function G({request:e,index:t,now:n,motion:i}){let{kind:a,relation:s}=g(e,t),c=A(e,n),l=e.relationship===`peer`?`text-message-peer-accent`:`text-message-inbound-accent`;return(0,H.jsxs)(`li`,{"data-slot":i===`fold`?`activity-request-closing`:`activity-request`,"data-request":e.requestId,"aria-hidden":i===`fold`||void 0,className:r(`border-t border-border py-2.5 first:border-t-0 first:pt-0`,i===`enter`&&`activity-row-enter`,i===`fold`&&`activity-row-fold`),children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[12px] font-medium`,children:[(0,H.jsx)(`span`,{className:`min-w-0 truncate`,children:f(t,e)}),(0,H.jsx)(o,{"aria-label":`to`,className:`size-3 shrink-0 text-muted-foreground`}),(0,H.jsx)(`span`,{className:`min-w-0 truncate`,children:p(t,e)}),(0,H.jsx)(`span`,{className:r(`ml-auto shrink-0 text-[10px] font-semibold tracking-[0.05em] uppercase`,l),children:a})]}),(0,H.jsxs)(`p`,{className:`my-1 line-clamp-3 text-[12px] text-muted-foreground`,children:[`“`,e.text,`”`]}),(0,H.jsxs)(`div`,{className:`flex gap-1.5 text-[11px] text-muted-foreground tabular-nums`,children:[(0,H.jsxs)(`span`,{children:[s,` · open `,C(T(e.createdAt,n))]}),e.deadline?(0,H.jsx)(`span`,{className:`ml-auto`,children:b(e.deadline,n)}):null]}),c===void 0?null:(0,H.jsx)(`div`,{"aria-hidden":`true`,className:`mt-1.5 h-[3px] overflow-hidden rounded-sm bg-border`,children:(0,H.jsx)(`span`,{className:r(`block h-full bg-current`,l),style:{width:`${Math.round(c*100)}%`}})})]})}function K({className:e}){return(0,H.jsx)(`svg`,{"aria-hidden":`true`,viewBox:`0 0 34 10`,className:`h-2.5 w-[34px] shrink-0`,children:(0,H.jsx)(`path`,{d:`M2 5h30`,strokeWidth:2,strokeDasharray:`6 5`,className:e})})}function q(){return(0,H.jsxs)(`svg`,{"aria-hidden":`true`,viewBox:`0 0 34 10`,className:`h-2.5 w-[34px] shrink-0`,children:[(0,H.jsx)(`path`,{d:`M2 5h24`,strokeWidth:2.2,strokeLinecap:`round`,strokeDasharray:`0 6`,className:`stroke-message-peer-accent opacity-80`}),(0,H.jsx)(`circle`,{cx:`29.5`,cy:`5`,r:`3`,strokeWidth:1.6,className:`fill-card stroke-message-peer-accent`})]})}function J(){let e=`flex items-center gap-2`;return(0,H.jsxs)(`div`,{"data-slot":`activity-legend`,className:r(U,`grid gap-1.5 text-[11.5px] text-muted-foreground`),children:[(0,H.jsx)(`h2`,{className:`sr-only`,children:`Legend`}),(0,H.jsxs)(`div`,{className:e,children:[(0,H.jsx)(B,{tone:`running`,"aria-hidden":`true`}),`Filled: working now`]}),(0,H.jsxs)(`div`,{className:e,children:[(0,H.jsx)(B,{tone:`info`,shape:`ring`,"aria-hidden":`true`}),`Ring: waiting for something outside`]}),(0,H.jsxs)(`div`,{className:e,children:[(0,H.jsx)(B,{tone:`running`,shape:`workers`,"aria-hidden":`true`}),`Robot: waiting for its own workers`]}),(0,H.jsxs)(`div`,{className:e,children:[(0,H.jsx)(s,{rate:[0,2,5,1,3,0,4,2],className:`w-[34px]`}),`Heartbeat: tool calls, last 30 s`]}),(0,H.jsxs)(`div`,{className:e,children:[(0,H.jsx)(K,{className:`stroke-message-peer-accent`}),`Open request, task to task`]}),(0,H.jsxs)(`div`,{className:e,children:[(0,H.jsx)(q,{}),`Waits for a peer to write`]}),(0,H.jsxs)(`div`,{className:e,children:[(0,H.jsx)(K,{className:`stroke-message-inbound-accent`}),`Open question, worker to parent`]}),(0,H.jsxs)(`div`,{className:e,children:[(0,H.jsx)(`svg`,{"aria-hidden":`true`,viewBox:`0 0 34 10`,className:`h-2.5 w-[34px] shrink-0`,children:(0,H.jsx)(`circle`,{cx:`17`,cy:`5`,r:`4`,className:`fill-foreground`})}),`Comet: a message is travelling`]})]})}var Y={..._,peer:`bg-message-peer-accent`,family:`bg-message-inbound-accent`};function X({feed:e,now:t,watchingSince:n}){return(0,H.jsxs)(`section`,{"data-slot":`activity-just-now`,className:U,children:[(0,H.jsx)(`h2`,{className:W,children:`Just now`}),e.length>0?(0,H.jsx)(`ul`,{"data-slot":`activity-feed`,children:e.map((e,n)=>(0,H.jsxs)(`li`,{"data-slot":`activity-feed-entry`,className:r(`grid grid-cols-[10px_minmax(0,1fr)_auto] items-baseline gap-2 py-1 text-[12px] text-muted-foreground`,n===0&&`activity-feed-enter`),children:[(0,H.jsx)(`span`,{"aria-hidden":`true`,className:r(`size-[7px] -translate-y-px rounded-full`,Y[e.tone])}),(0,H.jsx)(`span`,{className:`min-w-0`,children:e.text}),(0,H.jsx)(`span`,{"data-slot":`activity-feed-age`,className:`text-[11px] tabular-nums`,children:P(t-e.at)})]},e.id))}):null,(0,H.jsxs)(`p`,{className:`py-1.5 text-[12px] text-muted-foreground`,children:[`Watching since `,w(n)]})]})}function Z({requests:e,closing:t=[],index:n,now:r,watchingSince:i,feed:a=[],motion:o=d}){return(0,H.jsxs)(`aside`,{"data-slot":`activity-rail`,"aria-label":`Activity details`,className:`grid min-w-0 grid-cols-[minmax(0,1fr)] content-start gap-4`,children:[(0,H.jsxs)(`section`,{"data-slot":`activity-open-requests`,className:U,children:[(0,H.jsxs)(`h2`,{className:W,children:[`Open requests `,(0,H.jsx)(`b`,{className:`text-foreground`,children:e.length})]}),e.length===0&&t.length===0?(0,H.jsx)(`p`,{className:`py-1.5 text-[12px] text-muted-foreground`,children:`No task waits for a reply.`}):(0,H.jsxs)(`ul`,{children:[e.map(e=>(0,H.jsx)(G,{request:e,index:n,now:r,motion:e.requestId in o.opening?`enter`:void 0},e.requestId)),t.map(e=>(0,H.jsx)(G,{request:e,index:n,now:r,motion:`fold`},e.requestId))]})]}),(0,H.jsx)(X,{feed:a,now:r,watchingSince:i}),(0,H.jsx)(J,{})]})}function Q(e){let[t,n]=V.useState(0);return V.useLayoutEffect(()=>{let t=e.current;if(!t)return;let r=()=>n(t.clientWidth);if(r(),typeof ResizeObserver>`u`)return;let i=new ResizeObserver(r);return i.observe(t),()=>i.disconnect()},[e]),t}function $(e,t,n){let[r,i]=V.useState(void 0),a=I(r,e,t,n);return y(r,a)||i(a),a}function ee(e,t,n=c(e.tasks)){let r=new Set(e.tasks.map(e=>e.runId)),i=new Set(e.requests.map(e=>e.requestId)),a=Object.values(t.closing).filter(t=>t.projectId===e.projectId&&!i.has(t.request.requestId));return{cards:Object.values(t.leaving).filter(t=>t.projectId===e.projectId&&!r.has(t.task.runId)).map(e=>e.task),requests:a.map(e=>e.request),waits:m(e.projectId,n,t),folding:a.filter(e=>e.phase===`reply`||!e.replied).map(e=>e.request)}}function te({project:e,now:t,watchingSince:n,motion:r=d,feed:i,still:a=!1,paused:o=!1}){let s=V.useRef(null),f=l(Q(s)),p=V.useMemo(()=>S(e),[e]),m=V.useMemo(()=>c(e.tasks),[e.tasks]),h=V.useMemo(()=>ee(e,r,m),[e,r,m]),g=V.useMemo(()=>[...e.requests,...h.requests],[e.requests,h.requests]),_=V.useMemo(()=>[...m,...h.waits],[m,h.waits]),v=M(m),y=new Map([...h.cards,...e.tasks].map(e=>[e.runId,e])),b=new Set(h.cards.map(e=>e.runId)),x=e=>1+.35*(y.get(e)?.workers.length??0),C=$([...y.keys()],f,x),w=f===1,T=e.tasks.length>12,E={now:t,titleOf:e=>L(p,e)},k=C.map(e=>e.join(`,`)).join(`|`),A=`${e.tasks.length}:${f}:${T}:${k}:${g.map(e=>e.requestId).join(`,`)}:${_.map(e=>e.id).join(`,`)}`;return O(s,`data-flip`,k,!a&&!o),(0,H.jsxs)(`div`,{className:`grid items-start gap-6 xl:grid-cols-[minmax(0,1fr)_300px]`,children:[(0,H.jsxs)(`div`,{className:`min-w-0 pl-5`,children:[e.tasks.length===0?(0,H.jsx)(`p`,{"data-slot":`activity-empty`,className:`py-6 text-[13px] text-muted-foreground`,children:`No active work in this project.`}):null,(0,H.jsxs)(`div`,{ref:s,"data-slot":`activity-graph`,"data-columns":f,"data-dense":T?`true`:void 0,className:`relative grid items-start`,style:{gridTemplateColumns:`repeat(${f}, minmax(0, 1fr))`,columnGap:w?0:96},children:[C.map((t,n)=>(0,H.jsx)(`div`,{"data-slot":`activity-column`,className:`grid min-w-0 grid-cols-[minmax(0,1fr)] content-start gap-[30px] max-md:gap-4`,children:t.map(t=>{let n=y.get(t);return n?(0,H.jsx)(u,{task:n,requests:e.requests,waits:m,index:p,ctx:E,dense:T,narrow:w,motion:r,ghost:b.has(t),linked:v.linked.has(t),onHover:v.onHover},t):null})},n)),(0,H.jsx)(D,{requests:g,waits:_,active:v.active,index:p,peers:!w,layoutKey:A,now:t,motion:r,paused:o||a})]})]}),(0,H.jsx)(Z,{requests:e.requests,closing:h.folding,index:p,now:t,watchingSince:n,feed:i,motion:r})]})}function ne(){let e=t(),r=v({kind:`project`,projectId:e}),i=R(),[a]=V.useState(()=>new Date().toISOString()),o=F(r.data?.generatedAt,r.dataUpdatedAt),{motion:s,feed:c,reduced:l,paused:u}=j(r.data,e),d=r.data?.projects[0];if(r.isPending)return(0,H.jsx)(z,{});let f=d?x(d):void 0;return d?(0,H.jsxs)(`div`,{"data-route":`activity`,"data-activity-paused":u?`true`:void 0,className:`flex min-h-full w-full flex-col gap-4 px-[18px] py-6 md:px-7`,children:[(0,H.jsx)(N,{name:d.name,now:o,stale:r.isError,children:(0,H.jsx)(k,{scope:`project`,projectId:i??d.projectId})}),(0,H.jsx)(E,{summary:h([d]),tasksTo:`/`,bumps:s.bumps}),f?(0,H.jsx)(`p`,{"data-slot":`activity-project-notice`,role:`status`,className:`py-6 text-[13px] text-muted-foreground`,children:f}):(0,H.jsx)(te,{project:d,now:o,watchingSince:a,motion:s,feed:c,still:l,paused:u})]}):(0,H.jsxs)(`div`,{"data-route":`activity`,className:`min-h-full w-full px-[18px] py-6 md:px-7`,children:[(0,H.jsx)(N,{name:i??`project`,children:(0,H.jsx)(k,{scope:`project`,projectId:i})}),(0,H.jsxs)(`div`,{role:`alert`,className:`mt-6 flex items-center gap-3 text-[13px] text-muted-foreground`,children:[r.error?`Could not load activity: ${r.error.message}`:`This project has no activity snapshot.`,(0,H.jsx)(n,{size:`sm`,variant:`outline`,onClick:()=>void r.refetch(),className:`max-md:min-h-11`,children:`Retry`})]})]})}export{ne as ProjectActivityRoute};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{l as t,o as n,u as r}from"./button-CS5tOblf.js";import{i,t as a}from"./react-runtime-CCIEwYL0.js";import{B as o,F as s,I as c,J as l,P as u,Y as d,Z as f,et as p,nt as m,rt as h}from"./live-protocol-DBPXI6ks.js";import{c as g,dt as _}from"./queries-D2MPDhtr.js";import{Q as v,u as y}from"./design-icons-DmYTv2r1.js";import{h as b,l as x}from"./es2015-CX0rgbM5.js";import{c as S,i as C,p as w,r as T,s as E,t as ee}from"./dropdown-menu-D7f0O7xR.js";import{d as D,l as O,m as k,p as A}from"./alert-dialog-h-3h9B4l.js";import{i as j,o as M,r as N,s as P,t as te}from"./dialog-Dw7fMdDQ.js";var ne=80,re=2e3,ie=50,ae=200,oe=50,se=[{id:`add-tests`,label:`Add tests`,text:`Also add or update tests covering this change.`},{id:`explain-change`,label:`Explain the change`,text:`Explain what changed and why before finishing.`},{id:`keep-minimal`,label:`Keep it minimal`,text:`Keep the change as small and targeted as possible — no unrelated refactors.`},{id:`update-docs`,label:`Update docs`,text:`Also update any relevant documentation or comments.`},{id:`check-edge-cases`,label:`Double-check edge cases`,text:`Double-check edge cases and error handling before finishing.`},{id:`create-automation`,label:`Create an automation`,skills:[`create-cezarion-automation`],text:`Create an automation for this repository.
|
|
2
|
-
Trigger: <a GitHub event or a schedule, e.g. every new pull request; every issue labelled \`needs-agent\`; every day at 04:00; weekdays at 07:30; every 6 hours>.
|
|
3
|
-
Task for each run: <what the launched task must do, e.g. review the diff, run the tests and post findings as a review comment>.
|
|
4
|
-
Leave it paused and, for a GitHub trigger, preview its matches so I can check the filter before enabling it.`}],ce=new Set([`create-automation`]);function le(e,t){return t.automations===!0?e:e.filter(e=>!ce.has(e.id))}function ue(e){return!!e&&typeof e==`object`}function de(e){if(e===void 0||!Array.isArray(e))return se.map(e=>({...e}));let t=new Set,n=[];for(let r of e){if(!ue(r))continue;let e=typeof r.id==`string`?r.id.trim():``,i=typeof r.label==`string`?r.label.trim():``,a=typeof r.text==`string`?r.text.trim():``;if(!e||!i||!a||t.has(e))continue;t.add(e);let o=fe(r.skills);if(n.push({id:e,label:i.slice(0,ne),text:a.slice(0,re),...o.length>0?{skills:o}:{}}),n.length>=ie)break}return n}function fe(e){if(!Array.isArray(e))return[];let t=new Set;for(let n of e){if(typeof n!=`string`)continue;let e=n.trim();if(!(!e||t.has(e))&&(t.add(e.slice(0,ae)),t.size>=oe))break}return[...t]}function pe(e,t){if(t.length===0)return[];let n=new Set(t);return e.filter(e=>e.skills?.some(e=>n.has(e)))}function me(e,t){return pe(e,t).map(e=>e.text).join(`
|
|
5
|
-
|
|
6
|
-
`)}function he(e,t,n,r=``){if(e===``||e===r||e===t){let e=r&&n?`${r}\n\n${n}`:r||n;return{text:e,applied:n?e:``}}return{text:e,applied:t}}function ge(){return`tpl-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`}function _e(e,t,n){let r=Math.max(0,Math.min(t,e.length)),i=e.slice(0,r),a=e.slice(r),o=``;i.length>0&&(o=i.endsWith(`
|
|
7
|
-
|
|
8
|
-
`)?``:i.endsWith(`
|
|
9
|
-
`)?`
|
|
10
|
-
`:`
|
|
11
|
-
|
|
12
|
-
`);let s=a.replace(/^[ \t]+/,``),c=``;return s.length>0&&(c=s.startsWith(`
|
|
13
|
-
|
|
14
|
-
`)?``:s.startsWith(`
|
|
15
|
-
`)?`
|
|
16
|
-
`:`
|
|
17
|
-
|
|
18
|
-
`),{text:i+o+n+c+s,caret:i.length+o.length+n.length}}function ve({prompt:e,base:t,selectionStart:n,focused:r,remembered:i}){return e===t?e.length:r&&n!=null||n!=null&&n>0?n:i??e.length}var F=e(i(),1),ye=1,be=.9,xe=.8,Se=.17,I=.1,L=.999,Ce=.9999,we=.99,Te=/[\\\/_+.#"@\[\(\{&]/,Ee=/[\\\/_+.#"@\[\(\{&]/g,De=/[\s-]/,Oe=/[\s-]/g;function R(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?ye:we;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var c=r.charAt(a),l=n.indexOf(c,i),u=0,d,f,p,m;l>=0;)d=R(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=ye:Te.test(e.charAt(l-1))?(d*=xe,p=e.slice(i,l-1).match(Ee),p&&i>0&&(d*=L**+p.length)):De.test(e.charAt(l-1))?(d*=be,m=e.slice(i,l-1).match(Oe),m&&i>0&&(d*=L**+m.length)):(d*=Se,i>0&&(d*=L**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=Ce)),(d<I&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=R(e,t,n,r,l+1,a+2,o),f*I>d&&(d=f*I)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function ke(e){return e.toLowerCase().replace(Oe,` `)}function Ae(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,R(e,t,ke(e),ke(t),0,0,{})}var z=`[cmdk-group=""]`,je=`[cmdk-group-items=""]`,Me=`[cmdk-group-heading=""]`,Ne=`[cmdk-item=""]`,Pe=`${Ne}:not([aria-disabled="true"])`,Fe=`cmdk-item-select`,B=`data-value`,Ie=(e,t,n)=>Ae(e,t,n),Le=F.createContext(void 0),V=()=>F.useContext(Le),Re=F.createContext(void 0),ze=()=>F.useContext(Re),Be=F.createContext(void 0),Ve=F.forwardRef((e,t)=>{let n=W(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=W(()=>new Set),i=W(()=>new Map),a=W(()=>new Map),o=W(()=>new Set),s=Qe(e),{label:c,children:l,value:u,onValueChange:d,filter:f,shouldFilter:p,loop:m,disablePointerSelection:h=!1,vimBindings:g=!0,..._}=e,v=x(),y=x(),S=x(),C=F.useRef(null),w=et();U(()=>{if(u!==void 0){let e=u.trim();n.current.value=e,T.emit()}},[u]),U(()=>{w(6,A)},[]);let T=F.useMemo(()=>({subscribe:e=>(o.current.add(e),()=>o.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,a,o;if(!Object.is(n.current[e],t)){if(n.current[e]=t,e===`search`)k(),D(),w(1,O);else if(e===`value`){if(document.activeElement.hasAttribute(`cmdk-input`)||document.activeElement.hasAttribute(`cmdk-root`)){let e=document.getElementById(S);e?e.focus():(i=document.getElementById(v))==null||i.focus()}if(w(7,()=>{n.current.selectedItemId=j()?.id,T.emit()}),r||w(5,A),s.current?.value!==void 0){let e=t??``;(o=(a=s.current).onValueChange)==null||o.call(a,e);return}}T.emit()}},emit:()=>{o.current.forEach(e=>e())}}),[]),E=F.useMemo(()=>({value:(e,t,r)=>{t!==a.current.get(e)?.value&&(a.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,ee(t,r)),w(2,()=>{D(),T.emit()}))},item:(e,t)=>(r.current.add(e),t&&(i.current.has(t)?i.current.get(t).add(e):i.current.set(t,new Set([e]))),w(3,()=>{k(),D(),n.current.value||O(),T.emit()}),()=>{a.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=j();w(4,()=>{k(),t?.getAttribute(`id`)===e&&O(),T.emit()})}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{a.current.delete(e),i.current.delete(e)}),filter:()=>s.current.shouldFilter,label:c||e[`aria-label`],getDisablePointerSelection:()=>s.current.disablePointerSelection,listId:v,inputId:S,labelId:y,listInnerRef:C}),[]);function ee(e,t){let r=s.current?.filter??Ie;return e?r(e,n.current.search,t):0}function D(){if(!n.current.search||s.current.shouldFilter===!1)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=i.current.get(n),a=0;r.forEach(t=>{let n=e.get(t);a=Math.max(n,a)}),t.push([n,a])});let r=C.current;M().sort((t,n)=>{let r=t.getAttribute(`id`),i=n.getAttribute(`id`);return(e.get(i)??0)-(e.get(r)??0)}).forEach(e=>{let t=e.closest(je);t?t.appendChild(e.parentElement===t?e:e.closest(`${je} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${je} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=C.current?.querySelector(`${z}[${B}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function O(){let e=M().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(B);T.setState(`value`,e||void 0)}function k(){if(!n.current.search||s.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let t of r.current){let r=ee(a.current.get(t)?.value??``,a.current.get(t)?.keywords??[]);n.current.filtered.items.set(t,r),r>0&&e++}for(let[e,t]of i.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=e}function A(){var e;let t=j();t&&(t.parentElement?.firstChild===t&&((e=t.closest(z)?.querySelector(Me))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function j(){return C.current?.querySelector(`${Ne}[aria-selected="true"]`)}function M(){return Array.from(C.current?.querySelectorAll(Pe)||[])}function N(e){let t=M()[e];t&&T.setState(`value`,t.getAttribute(B))}function P(e){var t;let n=j(),r=M(),i=r.findIndex(e=>e===n),a=r[i+e];(t=s.current)!=null&&t.loop&&(a=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),a&&T.setState(`value`,a.getAttribute(B))}function te(e){let t=j()?.closest(z),n;for(;t&&!n;)t=e>0?Xe(t,z):Ze(t,z),n=t?.querySelector(Pe);n?T.setState(`value`,n.getAttribute(B)):P(e)}let ne=()=>N(M().length-1),re=e=>{e.preventDefault(),e.metaKey?ne():e.altKey?te(1):P(1)},ie=e=>{e.preventDefault(),e.metaKey?N(0):e.altKey?te(-1):P(-1)};return F.createElement(b.div,{ref:t,tabIndex:-1,..._,"cmdk-root":``,onKeyDown:e=>{var t;(t=_.onKeyDown)==null||t.call(_,e);let n=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||n))switch(e.key){case`n`:case`j`:g&&e.ctrlKey&&re(e);break;case`ArrowDown`:re(e);break;case`p`:case`k`:g&&e.ctrlKey&&ie(e);break;case`ArrowUp`:ie(e);break;case`Home`:e.preventDefault(),N(0);break;case`End`:e.preventDefault(),ne();break;case`Enter`:{e.preventDefault();let t=j();if(t){let e=new Event(Fe);t.dispatchEvent(e)}}}}},F.createElement(`label`,{"cmdk-label":``,htmlFor:E.inputId,id:E.labelId,style:nt},c),K(e,e=>F.createElement(Re.Provider,{value:T},F.createElement(Le.Provider,{value:E},e))))}),He=F.forwardRef((e,t)=>{let r=x(),i=F.useRef(null),a=F.useContext(Be),o=V(),s=Qe(e),c=s.current?.forceMount??a?.forceMount;U(()=>{if(!c)return o.item(r,a?.id)},[c]);let l=$e(r,i,[e.value,e.children,i],e.keywords),u=ze(),d=G(e=>e.value&&e.value===l.current),f=G(e=>c||o.filter()===!1?!0:!e.search||e.filtered.items.get(r)>0);F.useEffect(()=>{let t=i.current;if(!(!t||e.disabled))return t.addEventListener(Fe,p),()=>t.removeEventListener(Fe,p)},[f,e.onSelect,e.disabled]);function p(){var e,t;m(),(t=(e=s.current).onSelect)==null||t.call(e,l.current)}function m(){u.setState(`value`,l.current,!0)}if(!f)return null;let{disabled:h,value:g,onSelect:_,forceMount:v,keywords:y,...S}=e;return F.createElement(b.div,{ref:n(i,t),...S,id:r,"cmdk-item":``,role:`option`,"aria-disabled":!!h,"aria-selected":!!d,"data-disabled":!!h,"data-selected":!!d,onPointerMove:h||o.getDisablePointerSelection()?void 0:m,onClick:h?void 0:p},e.children)}),Ue=F.forwardRef((e,t)=>{let{heading:r,children:i,forceMount:a,...o}=e,s=x(),c=F.useRef(null),l=F.useRef(null),u=x(),d=V(),f=G(e=>a||d.filter()===!1?!0:!e.search||e.filtered.groups.has(s));U(()=>d.group(s),[]),$e(s,c,[e.value,e.heading,l]);let p=F.useMemo(()=>({id:s,forceMount:a}),[a]);return F.createElement(b.div,{ref:n(c,t),...o,"cmdk-group":``,role:`presentation`,hidden:!f||void 0},r&&F.createElement(`div`,{ref:l,"cmdk-group-heading":``,"aria-hidden":!0,id:u},r),K(e,e=>F.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":r?u:void 0},F.createElement(Be.Provider,{value:p},e))))}),We=F.forwardRef((e,t)=>{let{alwaysRender:r,...i}=e,a=F.useRef(null),o=G(e=>!e.search);return!r&&!o?null:F.createElement(b.div,{ref:n(a,t),...i,"cmdk-separator":``,role:`separator`})}),Ge=F.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=ze(),o=G(e=>e.search),s=G(e=>e.selectedItemId),c=V();return F.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),F.createElement(b.input,{ref:t,...r,"cmdk-input":``,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":s,id:c.inputId,type:`text`,value:i?e.value:o,onChange:e=>{i||a.setState(`search`,e.target.value),n?.(e.target.value)}})}),Ke=F.forwardRef((e,t)=>{let{children:r,label:i=`Suggestions`,...a}=e,o=F.useRef(null),s=F.useRef(null),c=G(e=>e.selectedItemId),l=V();return F.useEffect(()=>{if(s.current&&o.current){let e=s.current,t=o.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty(`--cmdk-list-height`,n.toFixed(1)+`px`)})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),F.createElement(b.div,{ref:n(o,t),...a,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":c,"aria-label":i,id:l.listId},K(e,e=>F.createElement(`div`,{ref:n(s,l.listInnerRef),"cmdk-list-sizer":``},e)))}),qe=F.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return F.createElement(O,{open:n,onOpenChange:r},F.createElement(k,{container:o},F.createElement(A,{"cmdk-overlay":``,className:i}),F.createElement(D,{"aria-label":e.label,"cmdk-dialog":``,className:a},F.createElement(Ve,{ref:t,...s}))))}),Je=F.forwardRef((e,t)=>G(e=>e.filtered.count===0)?F.createElement(b.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),Ye=F.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return F.createElement(b.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},K(e,e=>F.createElement(`div`,{"aria-hidden":!0},e)))}),H=Object.assign(Ve,{List:Ke,Item:He,Input:Ge,Group:Ue,Separator:We,Dialog:qe,Empty:Je,Loading:Ye});function Xe(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function Ze(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function Qe(e){let t=F.useRef(e);return U(()=>{t.current=e}),t}var U=typeof window>`u`?F.useEffect:F.useLayoutEffect;function W(e){let t=F.useRef();return t.current===void 0&&(t.current=e()),t}function G(e){let t=ze(),n=()=>e(t.snapshot());return F.useSyncExternalStore(t.subscribe,n,n)}function $e(e,t,n,r=[]){let i=F.useRef(),a=V();return U(()=>{var o;let s=(()=>{for(let e of n){if(typeof e==`string`)return e.trim();if(typeof e==`object`&&`current`in e)return e.current?e.current.textContent?.trim():i.current}})(),c=r.map(e=>e.trim());a.value(e,s,c),(o=t.current)==null||o.setAttribute(B,s),i.current=s}),i}var et=()=>{let[e,t]=F.useState(),n=W(()=>new Map);return U(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function tt(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function K({asChild:e,children:t},n){return e&&F.isValidElement(t)?F.cloneElement(tt(t),{ref:t.ref},n(t.props.children)):n(t)}var nt={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`},q=a();function rt({className:e,...t}){return(0,q.jsx)(H,{"data-slot":`command`,className:r(`flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground`,e),...t})}function it({title:e=`Command Palette`,description:n=`Search for a command to run...`,children:i,className:a,showCloseButton:o=!0,filter:s,value:c,onValueChange:l,overlayClassName:u,contentProps:d,...f}){return(0,q.jsxs)(te,{...f,children:[(0,q.jsxs)(M,{className:`sr-only`,children:[(0,q.jsx)(P,{children:e}),(0,q.jsx)(j,{children:n})]}),(0,q.jsx)(N,{...d,className:r(`overflow-hidden p-0`,a),showCloseButton:o,overlayClassName:u,children:(0,q.jsx)(rt,{...t({filter:s,value:c,onValueChange:l}),className:`**:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5`,children:i})})]})}function at({className:e,...t}){return(0,q.jsxs)(`div`,{"data-slot":`command-input-wrapper`,className:`flex min-h-11 shrink-0 items-center gap-2 rounded-ss-[inherit] rounded-se-[inherit] border-b px-3`,children:[(0,q.jsx)(v,{className:`size-4 shrink-0 opacity-50`}),(0,q.jsx)(H.Input,{"data-slot":`command-input`,className:r(`flex h-11 min-w-0 flex-1 rounded-md bg-transparent py-3 text-base md:text-sm placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50`,e),...t})]})}function ot({className:e,onPointerMoveCapture:t,...n}){return(0,q.jsx)(H.List,{"data-slot":`command-list`,onPointerMoveCapture:e=>{t?.(e),e.pointerType===`touch`&&e.stopPropagation()},className:r(`max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto`,e),...n})}function st({...e}){return(0,q.jsx)(H.Empty,{"data-slot":`command-empty`,className:`py-6 text-center text-sm`,...e})}function ct({className:e,...t}){return(0,q.jsx)(H.Group,{"data-slot":`command-group`,className:r(`overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground`,e),...t})}function lt({className:e,...t}){return(0,q.jsx)(H.Separator,{"data-slot":`command-separator`,className:r(`-mx-1 h-px bg-border`,e),...t})}function ut({className:e,...t}){return(0,q.jsx)(H.Item,{"data-slot":`command-item`,className:r(`relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground`,e),...t})}function dt({className:e,...t}){return(0,q.jsx)(`span`,{"data-slot":`command-shortcut`,className:r(`ml-auto text-xs tracking-widest text-muted-foreground`,e),...t})}var ft=`default`,pt=p({id:h(),label:h(),path:h(),exists:d()}),mt=p({id:h(),provider:u,label:h(),configDir:h(),path:h(),exists:d(),looksValid:d(),isDefault:d(),status:s.optional(),files:l(pt)});function ht(e){return e.isDefault?`default:${e.provider}`:e.id}var J=o();p({editable:d(),profiles:l(mt),profileCapableProviders:l(u),selections:m(h(),J),defaults:J}),p({projectId:h().min(1).max(64).nullable(),provider:u,profileId:h().max(64).nullable()}),p({selections:m(h(),J),defaults:J}),p({status:s}),p({available:d(),reason:h().optional(),fields:l(p({label:h(),value:h()}))}),p({file:h().min(1).max(200),target:h().min(1).max(64).optional()}),p({opened:f(!0),path:h()}),p({provider:u,label:h().trim().max(200).optional(),configDir:h().trim().min(1).max(4096)}),p({profile:mt}),p({label:h().trim().max(200).optional(),configDir:h().trim().min(1).max(4096).optional()}),p({removed:f(!0),id:h()});var gt=`quick-task`;function _t(e,t,n=24){return[t,...(e??[]).filter(e=>!(e.source===t.source&&e.ref===t.ref))].slice(0,n)}var Y=[{id:`claude`,label:`claude`,desc:`Claude Code CLI`},{id:`codex`,label:`codex`,desc:`OpenAI Codex (app-server)`},{id:`opencode`,label:`opencode`,desc:`OpenCode (serve)`},{id:`pi`,label:`pi`,desc:`pi CLI (provider/model)`},{id:`cursor`,label:`Cursor`,desc:`Cursor CLI`},{id:`omp`,label:`OMP`,desc:`Oh My Pi CLI (provider/model)`}],X={claude:[{id:``,label:`auto`,desc:`Pick the best model per step`},{id:`opus`,label:`opus`,desc:`Deep reasoning for hard tasks`},{id:`sonnet`,label:`sonnet`,desc:`Fast and cheap`},{id:`haiku`,label:`haiku`,desc:`Fastest — simple, scoped tasks`}],codex:[{id:``,label:`auto`,desc:`Use your Codex default model`}],opencode:[{id:``,label:`auto`,desc:`Use your OpenCode default model`}],cursor:[{id:``,label:`auto`,desc:`Use your Cursor default model`}],pi:[{id:``,label:`auto`,desc:`Use your pi default model`}],omp:[{id:``,label:`auto`,desc:`Use your OMP default model`}]},Z=[{value:``,label:`auto`,desc:`Harness default`},{value:`low`,label:`low`,desc:`Less reasoning, faster replies`},{value:`medium`,label:`medium`,desc:`Balanced reasoning`},{value:`high`,label:`high`,desc:`More reasoning for hard tasks`},{value:`xhigh`,label:`xhigh`,desc:`Extra-high reasoning`},{value:`max`,label:`max`,desc:`Maximum reasoning`}];function vt(e,t,n){let r=e===`cursor`?[Z[0]]:Z,i=c(e)&&(e!==`cursor`||n?.runner===e)?n?.models.find(e=>e.id===t)?.effortLevels:void 0;if(!i?.length)return r;let a=[Z[0]],o=new Set;for(let e of i){if(o.has(e))continue;let t=Z.find(t=>t.value===e);t&&(o.add(e),a.push(t))}return a.length>1?a:r}function yt(e,t){let n=e??``;return t.some(e=>e.value===n)?n:``}var bt=[`opencode`,`pi`,`omp`];function xt(e,t){return t===`cursor`||!e||X[t].some(t=>t.id===e)?!1:t!==`claude`&&[`claude-fable-5`,`claude-opus-4-8`,`claude-sonnet-5`,`claude-haiku-4-5`].includes(e)?!0:Object.entries(X).some(([n,r])=>n!==t&&!bt.includes(n)&&r.some(t=>t.id!==``&&t.id===e))}function St(e,t,n=[]){let r=t?.runner===e?t.models:[],i=X[e]??X.claude,a=[...r.length?i.slice(0,1):i],o=new Set(a.map(e=>e.id));if(c(e))for(let e of r)!e.id||o.has(e.id)||(o.add(e.id),a.push({id:e.id,label:e.label||e.id,desc:e.description}));for(let t of n)!t||o.has(t)||xt(t,e)||(o.add(t),a.push({id:t,label:t,desc:`Custom or legacy model`}));return a}var Ct={claude:`Claude`,codex:`Codex`,opencode:`OpenCode`,pi:`Pi`,cursor:`Cursor`,omp:`OMP`};function wt(e,t,n=!1,r=!1){if(!c(e))return;let i=Ct[e];if(t?.stale)return`Using cached ${i} model list`;if(n||t?.source===`unavailable`)return`Latest ${i} models unavailable`;if(r&&!t)return`Loading ${i} models…`}function Tt(e){let t=Y.map(e=>e.id).filter(t=>e.some(e=>e.name===t&&e.available));return t.length>0?t:[`claude`]}function Et(e,t,n){return e!==null&&t.includes(e)?e:t.includes(n)?n:t[0]??`claude`}function Dt(e,t,n=!1){return!n&&e===t?void 0:e}function Ot(e,t,n,r){let i=St(t,r,[e,n?.[t]]);if(e!==null&&i.some(t=>t.id===e))return e;let a=n?.[t];return a!==void 0&&i.some(e=>e.id===a)?a:``}function kt(e,t,n){return e.source===`skill`?t.some(t=>t.name===e.ref):n.some(t=>t.name===e.ref)}function At(e,t,n){return e&&kt(e,t,n)?e:null}function jt(e){let{task:t,source:n,model:r,modelsLocked:i,effort:a,runner:o,runnerExplicit:s,defaultRunner:c,agentProfile:l,images:u,worktree:d,autonomous:f,archiveWhenDone:p,autoMergePr:m,allowWorkers:h,allowMessaging:g}=e;return{task:t,...n?.source===`skill`?{steps:[{id:`task`,name:n.ref,skill:n.ref,prompt:`{{task}}`}]}:{workflow:n?.ref??`quick-task`},model:i?void 0:r||void 0,effort:i?void 0:a||void 0,runner:Dt(o,c,s),agentProfile:l||void 0,images:u.length>0?[...u]:void 0,worktree:d!==!1&&void 0,autonomous:f===!0||void 0,...Mt({archiveWhenDone:p,autoMergePr:m,allowWorkers:h,allowMessaging:g})}}function Mt(e){return{...e.archiveWhenDone?{archiveWhenDone:!0}:{},...e.autoMergePr?{autoMergePr:!0}:{},...e.allowWorkers===!1?{allowWorkers:!1}:{},...e.allowMessaging===!1?{allowMessaging:!1}:{}}}function Nt(e,t){return t?{...e,notify:!0}:e}function Pt(e){return`/tasks/${e.id}`}var Ft=`inline-flex h-[26px] min-w-0 max-w-full items-center gap-1.5 rounded-full border border-control-border bg-card px-2.5 text-xs font-medium text-muted-foreground transition-colors focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-link-foreground hover:bg-muted hover:text-foreground disabled:pointer-events-none disabled:border-dashed disabled:bg-muted`,It=(0,q.jsx)(y,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-supporting-foreground`}),Lt=(0,F.createContext)(null),Q=e=>Number.parseFloat(e)||0;function Rt({pill:e,box:t,full:n}){let r=getComputedStyle(e),i=[...e.children].filter(e=>{if(e===t)return!1;let n=getComputedStyle(e);return n.display!==`none`&&n.position!==`absolute`});return i.reduce((e,t)=>e+t.getBoundingClientRect().width,0)+Q(r.columnGap)*i.length+n.getBoundingClientRect().width+Q(r.paddingLeft)+Q(r.paddingRight)+Q(r.borderLeftWidth)+Q(r.borderRightWidth)}function zt(e){for(let t=e.parentElement;t;t=t.parentElement){if(t.dataset.slot===`picker-pill-disabled-wrapper`)continue;let e=getComputedStyle(t).display;if(e===`grid`||e===`flex`)return t}return e.parentElement}function Bt(e){let t=new Map;for(let n of e){let e=zt(n.pill),r=t.get(e)??new Map,i=Math.round(n.pill.getBoundingClientRect().top);r.set(i,[...r.get(i)??[],n]),t.set(e,r)}for(let[e,n]of t){let t=getComputedStyle(e),r=e.clientWidth-Q(t.paddingLeft)-Q(t.paddingRight);for(let e of n.values())if(e.reduce((e,t)=>e+Rt(t),0)+Q(t.columnGap)*(e.length-1)>r+.5)return!1}return!0}function Vt({children:e}){let t=(0,F.useRef)(new Map),n=(0,F.useRef)(null),[r,i]=(0,F.useState)(!0),a=(0,F.useCallback)(()=>i(Bt([...t.current.values()])),[]),o=(0,F.useCallback)((e,r)=>{if(t.current.set(e,r),typeof ResizeObserver<`u`){n.current??=new ResizeObserver(a);for(let e of[r.box,r.full,zt(r.pill)])n.current.observe(e)}return a(),()=>{if(t.current.delete(e),typeof ResizeObserver<`u`)for(let e of[r.box,r.full])n.current?.unobserve(e);a()}},[a]);(0,F.useLayoutEffect)(()=>()=>n.current?.disconnect(),[]);let s=(0,F.useMemo)(()=>({register:o,showPrefixes:r}),[o,r]);return(0,q.jsx)(Lt.Provider,{value:s,children:e})}function Ht({field:e,children:t}){let n=(0,F.useRef)(null),i=(0,F.useRef)(null),a=(0,F.useContext)(Lt),o=a?.register,s=(0,F.useId)(),[c,l]=(0,F.useState)(!0);(0,F.useLayoutEffect)(()=>{let e=n.current,t=i.current;if(o){let n=e.closest(`[data-slot$="pill"]`);return n?o(s,{pill:n,box:e,full:t}):void 0}let r=()=>l(t.getBoundingClientRect().width<=e.getBoundingClientRect().width+.5);if(r(),typeof ResizeObserver>`u`)return;let a=new ResizeObserver(r);return a.observe(e),a.observe(t),()=>a.disconnect()},[e,t,s,o]);let u=a!==null,d=u?a.showPrefixes:c,f=u&&!d;return(0,q.jsxs)(`span`,{ref:n,className:`relative min-w-0 overflow-hidden`,"aria-hidden":`true`,children:[(0,q.jsxs)(`span`,{ref:i,className:r(`invisible w-max whitespace-nowrap`,f?`absolute left-0 top-0`:`block`),children:[e,` · `,t]}),(0,q.jsxs)(`span`,{"data-slot":`picker-label`,className:r(`block truncate`,f?`relative`:`absolute inset-0`),children:[d?(0,q.jsxs)(`span`,{className:`text-muted-foreground`,children:[e,` · `]}):null,t]})]})}function Ut({fieldLabel:e,ariaLabel:t,label:n,options:r,value:i}){return e?`${t} · ${typeof n==`string`?n:r.find(e=>e.value===i)?.label??i}`:t}function Wt({readOnly:e,disabled:t,hint:n,disabledHint:r}){return e?r??n:t?r:n}function Gt({fieldLabel:e,fullLabel:t,explanation:n}){return e?[t,n].filter(Boolean).join(` — `):n}function Kt({icon:e,fieldLabel:t,ariaLabel:n,label:r}){return(0,q.jsxs)(q.Fragment,{children:[e,t?(0,q.jsx)(Ht,{field:n,children:r}):(0,q.jsx)(`span`,{className:`min-w-0 truncate`,title:typeof r==`string`?r:void 0,children:r})]})}function qt({slot:e,ariaLabel:t,label:n,value:i,options:a,onPick:o,disabled:s=!1,readOnly:c=!1,hint:l,disabledHint:u,status:d,searchPlaceholder:f,icon:p,fieldLabel:m=!1}){let[h,g]=(0,F.useState)(!1),[_,b]=(0,F.useState)(``),x=(0,F.useRef)(null),D=(0,F.useRef)(null),O=f?a.filter(e=>e.label.toLowerCase().includes(_.trim().toLowerCase())):a;(0,F.useEffect)(()=>{if(!h||!f)return;let e=window.setTimeout(()=>x.current?.focus());return()=>window.clearTimeout(e)},[h,f]);let k=e=>{x.current&&document.activeElement===x.current&&e.preventDefault()},A=p?` h-11 gap-2 rounded-lg border-border px-3 text-foreground`:``,j=Ut({fieldLabel:m,ariaLabel:t,label:n,options:a,value:i}),M=Gt({fieldLabel:m,fullLabel:j,explanation:Wt({readOnly:c,disabled:s,hint:l,disabledHint:u})}),N=Kt({icon:p,fieldLabel:m,ariaLabel:t,label:n});if(c)return(0,q.jsxs)(`span`,{"data-slot":e,"aria-label":j,title:M,className:r(Ft,A,`cursor-default hover:bg-card hover:text-muted-foreground`),children:[N,m?(0,q.jsx)(`span`,{className:`sr-only`,children:j}):null]});let P=(0,q.jsxs)(`button`,{type:`button`,"data-slot":e,"aria-label":j,disabled:s,title:M,className:r(Ft,A),children:[N,p?(0,q.jsx)(y,{"aria-hidden":`true`,className:`size-[13px] shrink-0 text-muted-foreground`}):It]});return s?(0,q.jsx)(`span`,{"data-slot":`picker-pill-disabled-wrapper`,title:M,className:`inline-flex min-w-0 max-w-full`,children:P}):(0,q.jsxs)(ee,{open:h,onOpenChange:e=>{g(e),e||b(``)},children:[(0,q.jsx)(w,{asChild:!0,children:P}),(0,q.jsxs)(T,{ref:D,align:`start`,"data-testid":`${e}-menu`,children:[f?(0,q.jsxs)(`div`,{"data-slot":`picker-search`,className:`mbe-1 flex min-h-11 min-w-56 items-center gap-2 border-b border-border px-2`,children:[(0,q.jsx)(v,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,q.jsx)(`input`,{ref:x,type:`search`,"aria-label":f,placeholder:f,value:_,onChange:e=>b(e.target.value),onKeyDown:e=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault(),e.stopPropagation();let t=D.current?.querySelectorAll(`[role="menuitemradio"]:not([data-disabled])`);(e.key===`ArrowDown`?t?.[0]:t?.[t.length-1])?.focus()}else e.key!==`Escape`&&e.stopPropagation()},className:`h-11 w-0 min-w-0 flex-1 bg-transparent text-sm placeholder:text-muted-foreground`})]}):null,(0,q.jsx)(E,{value:i,onValueChange:o,children:O.map(e=>(0,q.jsx)(S,{value:e.value,className:r(`gap-2.5`,f&&`min-h-11`),onPointerMove:k,onPointerLeave:k,onKeyDown:t=>{x.current&&(t.key===`ArrowUp`&&e===O[0]||t.key===`Tab`&&t.shiftKey)&&(t.preventDefault(),t.stopPropagation(),x.current.focus())},children:(0,q.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,q.jsx)(`span`,{className:`text-[13px] font-medium`,children:e.label}),e.desc?(0,q.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:e.desc}):null]})},e.value))}),f&&O.length===0?(0,q.jsx)(`p`,{role:`status`,className:`px-2 py-5 text-center text-xs text-muted-foreground`,children:`No matches found.`}):null,d?(0,q.jsx)(C,{disabled:!0,onPointerMove:k,onPointerLeave:k,className:`border-t border-border text-[11px] text-muted-foreground`,children:d}):null]})]})}var $=(e,t)=>t===null?e:`${e}:${t}`;function Jt({runners:e,value:t,onPick:n,disabled:r=!1,accounts:i=[],account:a=null,repoAccount:o,icon:s,fieldLabel:c}){let l=Y.filter(t=>e.includes(t.id)).flatMap(e=>{let t=i.filter(t=>t.provider===e.id);return t.length<2?[{value:$(e.id,null),label:e.id,desc:e.desc}]:t.map(t=>({value:$(e.id,t.id),label:`${e.id} · ${t.label}`,desc:t.configDir}))}),u=a??o?.[t]??`default`,d=l.some(e=>e.value===$(t,u))?$(t,u):$(t,null);return(0,q.jsx)(qt,{icon:s,fieldLabel:c,slot:`runner-pill`,ariaLabel:`Runner`,label:l.find(e=>e.value===d)?.label??t,value:d,disabled:r,onPick:e=>{let[t,r]=e.split(`:`);n(t,r??null)},options:l})}function Yt(){let e=g(),t=_(),n=(e.data?.profiles??[]).map(e=>({provider:e.provider,id:e.id,label:e.label,configDir:e.configDir})),r=t.data?.info?.root;return{accounts:n,repoAccount:r?e.data?.selections?.[r]:void 0}}function Xt(e,t){return e.filter(e=>e.provider===t).length>1}export{at as A,he as B,Nt as C,it as D,rt as E,se as F,le as H,me as I,_e as L,ot as M,lt as N,st as O,dt as P,ge as R,Mt as S,ht as T,ve as V,Ot as _,Jt as a,Dt as b,gt as c,jt as d,vt as f,yt as g,_t as h,Vt as i,ut as j,ct as k,Y as l,St as m,Yt as n,It as o,wt as p,qt as r,Ft as s,Xt as t,Tt as u,Et as v,ft as w,Pt as x,At as y,de as z};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./button-CS5tOblf.js";import{i as n,t as r}from"./react-runtime-CCIEwYL0.js";import{i}from"./project-scope-context-DSkcNKO7.js";import{M as a,ct as o,r as s}from"./design-icons-DmYTv2r1.js";import{n as c}from"./diff-controls-BHF0Pvdc.js";import{u as l}from"./control-locations-B88tMDqg.js";import{t as u}from"./project-router-BFKfAFvq.js";import{t as d}from"./centered-state-BmsqxbI8.js";import{F as f,P as p}from"./index-DBNT3CYH.js";import{t as m}from"./diff-nIehE-T6.js";var h=e(n(),1),g=r();function _({commit:e,sha:n,backTo:r,backLabel:_,slot:v,className:y,diffClassName:b}){let x=f(),[S,C]=(0,h.useState)(`unified`),[w,T]=(0,h.useState)(!1),E=e.isError&&e.error instanceof i&&e.error.status===409,D=x?S:`unified`,O=!x||w;return(0,g.jsxs)(`section`,{"data-slot":v,"data-sha":n,className:y,children:[(0,g.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2.5 gap-y-1.5 border-b border-border px-4 py-2 md:px-6`,children:[(0,g.jsx)(t,{asChild:!0,variant:`ghost`,size:`sm`,"data-slot":`commit-back`,children:(0,g.jsxs)(u,{to:r,children:[(0,g.jsx)(s,{size:16,"aria-hidden":`true`}),_]})}),e.data?(0,g.jsx)(p,{stat:e.data.stat}):null,(0,g.jsx)(`span`,{className:`ml-auto hidden items-center gap-1 md:flex`,children:(0,g.jsx)(c,{mode:S,wrap:w,onModeChange:C,onWrapChange:T})})]}),e.isPending?(0,g.jsx)(`p`,{"data-slot":`commit-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading commit…`}):e.isError?(0,g.jsx)(d,{icon:E?(0,g.jsx)(l,{}):(0,g.jsx)(o,{size:16}),tone:E?`neutral`:`danger`,heading:`h2`,title:E?`Commit not found`:`Could not load the commit`,subtitle:e.error.message}):(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)(`div`,{"data-slot":`commit-meta`,className:`border-b border-border px-4 py-3 md:px-6`,children:[(0,g.jsx)(`h2`,{className:`text-sm font-semibold`,children:e.data.subject}),(0,g.jsxs)(`p`,{className:`mt-0.5 text-[11px] text-soft-foreground`,children:[e.data.author,` · `,e.data.when,` ·`,` `,(0,g.jsx)(`span`,{className:`font-mono select-all`,children:e.data.sha})]})]}),e.data.files.length===0?(0,g.jsx)(d,{icon:(0,g.jsx)(a,{size:16}),tone:`neutral`,heading:`h2`,title:`No file changes`,subtitle:`This commit carries no diff of its own — a merge commit's changes live on the commits it merged.`}):(0,g.jsx)(`div`,{className:b,children:(0,g.jsx)(m,{files:e.data.files,mode:D,wrap:O,className:`min-w-0`})})]})]})}export{_ as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{d as t,p as n,u as r}from"./button-CS5tOblf.js";import{i,t as a}from"./react-runtime-CCIEwYL0.js";import{Jt as o,it as s,qt as c}from"./queries-D2MPDhtr.js";import{l,n as u,r as d,t as f}from"./popover-G6KGT-qq.js";import{F as p,I as m,N as h,P as g,U as _,_ as v,ct as y,g as b,h as x,m as S,p as C}from"./design-icons-DmYTv2r1.js";import{t as w}from"./createLucideIcon-BHp8sXmF.js";var T=w(`search-x`,[[`path`,{d:`m13.5 8.5-5 5`,key:`1cs55j`}],[`path`,{d:`m8.5 8.5 5 5`,key:`a8mexj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`path`,{d:`m21 21-4.3-4.3`,key:`1qie3q`}]]),E=e(i(),1),D=a(),O=(0,E.createContext)(null);function k({children:e}){let[t,n]=(0,E.useState)(()=>new Map),r=(0,E.useCallback)((e,t)=>{n(n=>{let r=new Map(n);return r.set(e,t),r})},[]),i=(0,E.useCallback)(e=>{n(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n})},[]),a=s((0,E.useMemo)(()=>[...t.values()].flat(),[t])),o=(0,E.useMemo)(()=>({publish:r,retract:i,lookup:a}),[r,i,a]);return(0,D.jsx)(O.Provider,{value:o,children:e})}var A=(0,E.createContext)(null);function j({projectId:e,repoBase:t,requests:n,children:r}){let i=(0,E.useContext)(O),a=(0,E.useContext)(A),o=(0,E.useId)();(0,E.useEffect)(()=>{if(i)return i.publish(o,n),()=>i.retract(o)},[i,o,n.map(e=>`${e.projectId} ${e.kind}#${e.number}`).sort().join(`|`)]);let c=s(i?M:n),l=i?.lookup??c,u=t??(a&&a.projectId===e?a.repoBase:void 0),d=(0,E.useMemo)(()=>({lookup:l,projectId:e,repoBase:u}),[l,e,u]);return(0,D.jsx)(A.Provider,{value:d,children:r})}var M=[];function N(e,t,n){let r=(0,E.useContext)(A),i=n??r?.projectId;return!r||!i||t===void 0?te:r.lookup({projectId:i,kind:e,number:t})}function ee(e,t){let n=(0,E.useContext)(A),r=t??n?.projectId;return!n||!r?[]:e.filter(e=>n.lookup({projectId:r,kind:`PR`,number:e}).conflicting===!0)}function P(){let e=(0,E.useContext)(A);return{projectId:e?.projectId,repoBase:e?.repoBase}}var te=Object.freeze({state:`idle`}),F={success:`border-success/40 text-success`,danger:`border-danger/40 text-danger`,accent:`border-accent-strong/35 text-accent-text`,merged:`border-merged-strong/35 text-merged-text`,info:`border-info/40 text-info`,neutral:`border-border text-muted-foreground`,pending:`border-pending-strong/45 text-pending-strong`,conflict:`border-conflict/45 text-conflict`},I={success:`text-success`,danger:`text-danger`,accent:`text-merged-text`,merged:`text-merged-text`,info:`text-info`,neutral:`text-soft-foreground`,pending:`text-pending-strong`,conflict:`text-conflict`},ne={success:`hover:bg-success/10`,danger:`hover:bg-danger/10`,accent:`hover:bg-accent-strong/10`,merged:`hover:bg-merged-strong/10`,info:`hover:bg-info/10`,neutral:`hover:bg-muted`,pending:`hover:bg-pending-strong/10`,conflict:`hover:bg-conflict/10`},re={draft:p,"review-required":m,"changes-requested":_,"checks-pending":null,"checks-failing":v,ready:C,merged:h,closed:g,open:S,completed:C,"not-planned":b};function L(e){return e===`PR`?`pr-chip`:`issue-chip`}function R(e){return e?{"data-conflicting":`true`}:{}}function z(e,t,n,r){return!n||r!==void 0&&l({kind:e,number:t??0,url:n},r)}function B(e,t,n){return e===`PR`&&(t??n)===!0}function V({plain:e,inert:t,conflicting:n,className:i,tone:a}){return e?r(`inline-flex items-center gap-1 rounded-[2px] text-inherit`,n&&`text-conflict font-medium`,!t&&`group/reference focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-link-foreground`,i):r(`inline-flex h-[22px] items-center gap-1 rounded-md border px-1.5 font-mono text-[12px] font-normal`,F[a],i)}function H(e,t,n,r){return n&&!r?t?`${e===`PR`?`PR `:``}#${t}`:e:t?`${!r&&e===`Issue`?`Issue `:``}#${t}`:e}function U(e){return e===`PR`?`pull request`:`issue`}function W(e,t,n,r){return`Open the ${e}${t?` #${t}`:``} for ${n}${r?` — ${r.label}`:``}`}function G(e,t){return e&&t?I[t.tone]:void 0}function K(e,n){return!e&&(!n||!t(n))}function q({conflicting:e,presentation:t,status:n,plain:i,compact:a,inert:o,kind:s,label:c,glyphClass:l}){return(0,D.jsxs)(D.Fragment,{children:[e?(0,D.jsx)(y,{className:r(`size-2.5 shrink-0`,l),"aria-hidden":`true`}):(0,D.jsx)($,{status:t?n:void 0,className:i?r(`size-2.5`,l):void 0}),i&&a?s===`PR`?(0,D.jsx)(m,{"data-slot":`reference-kind`,className:`size-2.5 shrink-0`,"aria-hidden":`true`}):(0,D.jsx)(S,{"data-slot":`reference-kind`,className:`size-2.5 shrink-0`,"aria-hidden":`true`}):null,i?(0,D.jsx)(`span`,{className:o?void 0:`underline-offset-2 group-hover/reference:underline group-focus-visible/reference:underline`,children:c}):c]})}function J({kind:e,status:t,conflicting:n,chipClass:r,body:i}){return(0,D.jsx)(`span`,{"data-slot":L(e),"data-status":t,"data-inert":`true`,...R(n),className:r,children:i})}function Y({kind:e,number:n,tooltip:r,url:i}){return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`span`,{className:`block font-medium`,children:[e===`PR`?`Pull request`:`Issue`,n?` #${n}`:``,` · `,r.headline]}),(0,D.jsx)(`span`,{className:`block`,children:r.detail}),r.also?(0,D.jsx)(`span`,{className:`block opacity-70`,children:r.also}):null,i&&t(i)?(0,D.jsx)(`span`,{className:`block opacity-70`,children:i.replace(/^https?:\/\//,``)}):null]})}function ie({reference:e,taskTitle:t,status:n,conflicting:i,conflictAction:a,projectId:s,repoBase:l,to:u,className:d,compact:f=!1,plain:p=!1,inert:m=!1}){let{kind:h,number:g,url:_}=e,v=P(),y=N(h,z(h,g,_,l??v.repoBase)?g:void 0,s),b=n??y.status,x=o(b),S=B(h,i,y.conflicting),C=S?c:x,w=C?.tone??`accent`,T=V({plain:p,inert:m,conflicting:S,className:d,tone:w}),E=le(y,C,S?x:void 0),O=H(h,g,p,f),k=U(h),A=W(k,g,t,C),j=(0,D.jsx)(q,{conflicting:S,presentation:C,status:b,plain:p,compact:f,inert:m,kind:h,label:O,glyphClass:G(p,C)});if(m)return(0,D.jsx)(J,{kind:h,status:b,conflicting:S,chipClass:T,body:j});let M=K(u,_)?(0,D.jsx)(`span`,{"data-slot":L(h),"data-status":b,...R(S),"aria-label":C?`${k} ${O} — ${C.label}`:void 0,className:T,children:j}):(0,D.jsx)(ae,{to:u,url:_,"data-slot":L(h),"data-status":b,...R(S),title:E?void 0:_,"aria-label":A,className:p?T:r(T,ne[w]),children:j});return E?(0,D.jsx)(ce,{chip:M,action:S?a:void 0,state:y.state,children:(0,D.jsx)(Y,{kind:h,number:g,tooltip:E,url:_})}):M}function ae({to:e,url:t,children:r,...i}){return e?(0,D.jsx)(n,{to:e,...i,children:r}):(0,D.jsx)(`a`,{href:t,target:`_blank`,rel:`noopener noreferrer`,...i,children:r})}var X=(0,E.createContext)(()=>{});function oe(){return(0,E.useContext)(X)}var se=150,Z=120;function ce({chip:e,action:t,state:n,children:r}){let[i,a]=(0,E.useState)(!1),o=(0,E.useRef)(null),s=(0,E.useRef)(null),c=(0,E.useRef)(void 0),l=(0,E.useCallback)((e,t)=>{clearTimeout(c.current),c.current=setTimeout(()=>a(e),t)},[]),p=(0,E.useCallback)(()=>{clearTimeout(c.current),a(!1)},[]);(0,E.useEffect)(()=>()=>clearTimeout(c.current),[]);let m=e=>e instanceof Node&&(s.current?.contains(e)||o.current?.contains(e));return(0,D.jsxs)(f,{open:i,onOpenChange:e=>e?a(!0):p(),children:[(0,D.jsx)(u,{asChild:!0,ref:o,onPointerEnter:e=>{e.pointerType!==`touch`&&l(!0,se)},onPointerLeave:e=>{e.pointerType!==`touch`&&l(!1,Z)},onFocus:()=>a(!0),onBlur:e=>{m(e.relatedTarget)||p()},onKeyDown:e=>{if(e.key===`Escape`)return p();if(e.key!==`Tab`||e.shiftKey||!t)return;let n=s.current?.querySelector(`button:not([disabled]), [href], input, select, textarea, [tabindex]:not([tabindex="-1"])`);n&&(e.preventDefault(),n.focus())},...t?{"aria-haspopup":`dialog`,"aria-expanded":i}:{},children:e}),(0,D.jsxs)(d,{ref:s,side:`top`,role:t?`dialog`:`tooltip`,"data-slot":`reference-status-card`,"data-tooltip-state":n,className:`w-64 space-y-2 p-3 text-xs`,onOpenAutoFocus:e=>e.preventDefault(),onCloseAutoFocus:e=>{e.preventDefault(),m(document.activeElement)&&o.current?.focus()},onPointerEnter:()=>clearTimeout(c.current),onPointerLeave:e=>{e.pointerType!==`touch`&&l(!1,Z)},children:[(0,D.jsx)(`div`,{className:`space-y-0.5`,children:r}),t?(0,D.jsx)(X.Provider,{value:p,children:t}):null]})]})}function le(e,t,n){if(t){let{label:r,hint:i}=t,a=n?`also ${ue(n.label)} — ${n.hint}`:void 0;return e.state===`unavailable`?{headline:r,detail:`last known — GitHub is unreachable${e.reason?` (${e.reason})`:``}`,...a?{also:a}:{}}:{headline:r,detail:i,...a?{also:a}:{}}}switch(e.state){case`loading`:return{headline:`Checking GitHub…`,detail:`the status of this reference is on its way`};case`unavailable`:return{headline:`Status unavailable`,detail:e.reason??`GitHub could not be reached — the chip says nothing rather than guessing`};case`unknown`:return{headline:`Not found on this repository`,detail:`GitHub has no such number here — the reference may point at another repo`};default:return null}}function ue(e){return e.charAt(0).toLowerCase()+e.slice(1)}function Q({kind:e,number:t,className:n}){let i=N(e,t),a=o(i.status),s=e===`PR`&&i.conflicting===!0,l=s?c:a;if(!l)return null;let u=r(`size-2.5`,I[l.tone]);return(0,D.jsx)(`span`,{"data-slot":`reference-status-glyph`,"data-status":i.status,...s?{"data-conflicting":`true`}:{},"aria-hidden":`true`,className:r(`inline-flex items-center`,n),children:s?(0,D.jsx)(y,{className:r(`shrink-0`,u),"aria-hidden":`true`}):(0,D.jsx)($,{status:i.status,className:u})})}function $({status:e,className:t}){if(!e)return null;if(e===`checks-pending`)return(0,D.jsx)(x,{"data-slot":`status-dot`,"data-tone":`pending`,className:r(`size-3 animate-pulse motion-reduce:animate-none`,t),"aria-hidden":`true`});let n=re[e];return n?(0,D.jsx)(n,{className:r(`size-2.5 shrink-0`,t),"aria-hidden":`true`}):null}var de={general:[`Settings`,`General`],webhooks:[`Settings`,`General`,`Webhooks`],providers:[`Settings`,`Agents`,`Providers`],projects:[`Settings`,`Projects`],worktrees:[`Settings`,`Worktrees`],sidebar:[`Settings`,`Sidebar`]};function fe(e,t=` → `){return de[e].join(t)}export{j as a,P as c,oe as i,N as l,ie as n,k as o,Q as r,ee as s,fe as t,T as u};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/diff-view-DcvEkA3I.js","assets/rolldown-runtime-QTnfLwEv.js","assets/button-CS5tOblf.js","assets/react-runtime-CCIEwYL0.js","assets/bundle-mjs-BT31bpU6.js","assets/eye-B8okNWXU.js","assets/createLucideIcon-BHp8sXmF.js","assets/index-DBNT3CYH.js","assets/live-refetch-CZb2VOyu.js","assets/project-scope-context-DSkcNKO7.js","assets/live-protocol-DBPXI6ks.js","assets/useInfiniteQuery-BmfExLUr.js","assets/queries-D2MPDhtr.js","assets/useQuery-8pHkglP4.js","assets/ws-CEQH0TUT.js","assets/toaster-CRVRHlMR.js","assets/cez-idle-NomdGTfa.js","assets/popover-G6KGT-qq.js","assets/es2015-CX0rgbM5.js","assets/dropdown-menu-D7f0O7xR.js","assets/design-icons-DmYTv2r1.js","assets/dist-DvNdR7gM.js","assets/attention-VmnPpwJx.js","assets/nav-row-styles-CEA9c88Q.js","assets/format-BNCkW110.js","assets/play-CmVAj_fu.js","assets/control-locations-B88tMDqg.js","assets/alert-dialog-h-3h9B4l.js","assets/dialog-Dw7fMdDQ.js","assets/input-DIwJvCgi.js","assets/github-sidebar-model-DkUAF09l.js","assets/project-router-BFKfAFvq.js","assets/agent-accounts-B-Gpf8IN.js","assets/skills-DFBiAuJG.js","assets/centered-state-BmsqxbI8.js","assets/chunk-BO2N2NFS-DE6qKn3r.js","assets/lib-BxQXEXDF.js","assets/sortable.esm-zp_qkYGV.js","assets/index-9YmaiQ1k.css","assets/image-preview-Dy3o8upo.js","assets/zoomable-image-UzXCYU7Z.js","assets/markdown-BBDDg-4t.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{u as t}from"./button-CS5tOblf.js";import{i as n,t as r}from"./react-runtime-CCIEwYL0.js";import{i}from"./bundle-mjs-BT31bpU6.js";import{P as a}from"./index-DBNT3CYH.js";import{n as o,t as s}from"./image-preview-Dy3o8upo.js";var c=e(n(),1),l=r();function u(e){let[n,r]=(0,c.useState)(null);return(0,c.useEffect)(()=>{let e=!1;return i(()=>import(`./diff-view-DcvEkA3I.js`).then(t=>{e||r({View:t.DiffView})},()=>{e||r(`failed`)}),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41])),()=>{e=!0}},[]),e.files.length===0?(0,l.jsx)(`p`,{"data-slot":`diff-empty`,className:t(`px-1 text-xs text-soft-foreground`,e.className),children:`No changes.`}):n===`failed`?(0,l.jsx)(d,{...e}):n===null?(0,l.jsx)(`p`,{"data-slot":`diff-loading`,className:t(`px-1 text-xs text-soft-foreground`,e.className),children:`Loading diff…`}):(0,l.jsx)(n.View,{...e})}function d({files:e,wrap:n=!1,imageSrc:r,onOpenInApp:i,viewRef:o,className:s}){let u={adds:e.reduce((e,t)=>e+t.adds,0),dels:e.reduce((e,t)=>e+t.dels,0),files:e.length},d=(0,c.useRef)(null);return(0,c.useImperativeHandle)(o,()=>({scrollToPath:e=>{for(let t of d.current?.querySelectorAll(`[data-slot="diff-file"]`)??[])if(t.dataset.path===e){t.scrollIntoView({block:`start`,behavior:`smooth`});return}}})),(0,l.jsxs)(`div`,{ref:d,"data-slot":`diff`,"data-fallback":`true`,className:t(`flex min-w-0 flex-col gap-3`,s),children:[(0,l.jsxs)(`p`,{"data-slot":`diff-totals`,className:`flex items-center gap-2 px-1 text-xs text-muted-foreground`,children:[(0,l.jsxs)(`span`,{children:[u.files,` `,u.files===1?`file`:`files`,` changed`]}),(0,l.jsx)(a,{stat:u})]}),e.map(e=>(0,l.jsx)(f,{file:e,wrap:n,imageSrc:r,onOpenInApp:i},`${e.oldPath??``}→${e.path}`))]})}function f({file:e,wrap:n,imageSrc:r,onOpenInApp:i}){return(0,l.jsxs)(`section`,{"data-slot":`diff-file`,"data-path":e.path,className:`min-w-0 overflow-clip rounded-md border border-border bg-card`,children:[(0,l.jsxs)(`header`,{className:`flex items-center gap-2 border-b border-border/50 px-3 py-2`,children:[(0,l.jsx)(`span`,{"data-slot":`diff-file-path`,className:`min-w-0 truncate font-mono text-xs font-medium`,children:e.oldPath?`${e.oldPath} → ${e.path}`:e.path}),(0,l.jsx)(`span`,{className:`ml-auto shrink-0`,children:(0,l.jsx)(a,{stat:{adds:e.adds,dels:e.dels,files:1},className:`text-[11px]`})})]}),o(e)?(0,l.jsx)(s,{file:e,imageSrc:r,onOpenInApp:i}):e.binary?(0,l.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-soft-foreground`,children:`Binary file — no text diff.`}):e.patch===``?(0,l.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-soft-foreground`,children:`No content changes (metadata only).`}):(0,l.jsx)(`pre`,{className:t(`py-2 font-mono text-xs leading-[1.7]`,n?`break-words whitespace-pre-wrap`:`overflow-x-auto whitespace-pre`),children:e.patch.split(`
|
|
3
|
-
`).map((e,n)=>(0,l.jsxs)(`span`,{className:t(`block px-4`,e.startsWith(`+`)&&!e.startsWith(`+++`)&&`bg-diff-add`,e.startsWith(`-`)&&!e.startsWith(`---`)&&`bg-diff-del`,e.startsWith(`@@`)&&`text-soft-foreground`),children:[e,e===``?` `:``]},n))})]})}export{u as t};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{C as t,u as n,w as r}from"./button-CS5tOblf.js";import{i,t as a}from"./react-runtime-CCIEwYL0.js";import{gn as o,i as s}from"./project-scope-context-DSkcNKO7.js";import{xt as c}from"./queries-D2MPDhtr.js";import{T as l,ct as u}from"./design-icons-DmYTv2r1.js";import{t as d}from"./createLucideIcon-BHp8sXmF.js";import{t as f}from"./centered-state-BmsqxbI8.js";import{At as p,Ct as m,Dt as h,Et as g,Ot as _,St as v,Tt as y,jt as b,kt as x,vt as S,wt as C,yt as w}from"./index-DBNT3CYH.js";var T=d(`file-exclamation-point`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),E=d(`file-question-mark`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}],[`path`,{d:`M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3`,key:`mhlwft`}]]),D=d(`file-x`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m14.5 12.5-5 5`,key:`b62r18`}],[`path`,{d:`m9.5 12.5 5 5`,key:`1rk7el`}]]),O=e(i(),1),k=a(),A=[[`scripts`,`remote script`,`remote scripts`],[`remote`,`remote resource`,`remote resources`],[`relative`,`linked file next to the report`,`linked files next to the report`],[`forms`,`form`,`forms`],[`embeds`,`embedded frame or object`,`embedded frames or objects`]];function j(e){let t=A.filter(([t])=>e[t]>0).map(([t,n,r])=>`${e[t]} ${e[t]===1?n:r}`);return t.length?t.join(`, `):null}var M={};function N(e){let t=(0,O.useMemo)(()=>h(e),[e]).join(` `),[n,r]=(0,O.useState)(null);return(0,O.useEffect)(()=>{if(!t)return;let e=!0;return _(t.split(` `)).then(n=>{e&&r({key:t,libraries:n})}),()=>{e=!1}},[t]),t?n?.key===t?n.libraries:null:M}function P({html:e,title:t,fragment:r,className:i}){let a=N(e);return a?(0,k.jsx)(F,{html:e,title:t,fragment:r,className:i,libraries:a}):(0,k.jsx)(`div`,{"data-slot":`html-report`,"aria-busy":`true`,className:n(`flex min-h-0 flex-col`,i)})}function F({html:e,title:t,fragment:r,className:i,libraries:a}){let{srcdoc:o,blocked:s}=(0,O.useMemo)(()=>{let n=y(e,a);return{srcdoc:g(n.srcdoc,t),blocked:n.blocked}},[e,a,t]),c=e=>{r&&/^#\S+$/.test(r)&&e.currentTarget.contentWindow?.frames[0]?.location.replace(`about:srcdoc${r}`)},l=j(s);return(0,k.jsxs)(`div`,{"data-slot":`html-report`,className:n(`flex min-h-0 flex-col`,i),children:[l?(0,k.jsxs)(`p`,{"data-slot":`html-report-blocked`,role:`note`,className:`border-b border-border bg-muted/40 px-4 py-2 text-xs text-foreground`,children:[`Blocked for your safety: `,l,`. Reports show only what they carry inside the file.`]}):null,(0,k.jsx)(`iframe`,{"data-slot":`html-report-frame`,title:t,sandbox:m,allow:v,srcDoc:o,referrerPolicy:`no-referrer`,onLoad:c,className:`block min-h-0 w-full flex-1 border-0 bg-report-canvas`})]})}var I=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`bmp`,`ico`,`avif`]);function L(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=t.lastIndexOf(`.`);return n<=0?!1:I.has(t.slice(n+1).toLowerCase())}function R(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=t.lastIndexOf(`.`);return L(e)||n>0&&t.slice(n+1).toLowerCase()===`svg`}function z(e){return e.tooLarge?`too-large`:R(e.path)?`image`:e.binary?`binary`:`text`}function B(e){return e>=1024**2?`${(e/1024**2).toFixed(1)} MB`:e>=1024?`${(e/1024).toFixed(1)} kB`:`${e} B`}function V({runId:e,path:t,className:n}){let r=c(e,t??void 0);if(t===null)return(0,k.jsx)(K,{className:n,children:(0,k.jsx)(f,{icon:(0,k.jsx)(l,{size:16}),tone:`neutral`,heading:`h2`,title:`Select a file`,subtitle:`Pick a file from this task’s worktree to inspect its contents.`,className:`[&_[data-slot=centered-state-tile]]:size-10 [&_[data-slot=centered-state-tile]]:border-0 [&_[data-slot=centered-state-tile]]:bg-transparent [&_[data-slot=centered-state-tile]]:text-accent-text [&_[data-slot=centered-state-tile]]:shadow-none [&_h2]:text-xl`})});if(r.isPending)return(0,k.jsx)(K,{className:n,children:(0,k.jsxs)(`p`,{"data-slot":`file-preview-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground`,children:[`Loading `,t,`…`]})});if(r.isError){let e=r.error instanceof s&&r.error.status===409;return(0,k.jsx)(K,{className:n,children:(0,k.jsx)(f,{icon:e?(0,k.jsx)(D,{}):(0,k.jsx)(u,{size:16}),tone:e?`neutral`:`danger`,heading:`h2`,title:e?`Cannot preview this file`:`Could not load this file`,subtitle:r.error.message})})}return r.data.type===`file`?(0,k.jsx)(H,{runId:e,entry:r.data,className:n}):(0,k.jsx)(K,{className:n,children:(0,k.jsx)(f,{icon:(0,k.jsx)(E,{}),tone:`neutral`,heading:`h2`,title:`Choose a file inside this directory`,subtitle:`Expand the folder in the tree, or enter the full path to a file.`})})}function H({runId:e,entry:t,className:n,imageUrl:r,downloadUrl:i,snapshot:a,readerHref:o,documentPreview:s=!1}){let[c,l]=(0,O.useState)(!1),u=s&&/\.(?:md|markdown)$/i.test(t.path),d=s&&C(t.path),f=/\.(?:png|jpe?g|gif|webp|bmp|ico|avif)$/i.test(t.path),p=s&&f&&t.size<=10*1024*1024?`image`:z(t),m=(u||d)&&p===`text`;return(0,k.jsxs)(K,{className:n,children:[(0,k.jsxs)(`header`,{"data-slot":`file-preview-head`,className:`flex items-center gap-2 border-b border-border bg-muted/40 px-4 py-2 text-xs`,children:[(0,k.jsx)(`span`,{className:`min-w-0 truncate font-mono font-medium`,children:t.path}),(0,k.jsx)(`span`,{className:`ml-auto shrink-0 tabular-nums text-soft-foreground`,children:B(t.size)})]}),a||i||m?(0,k.jsx)(W,{snapshot:a,downloadUrl:i,source:m?c:null,onSource:()=>l(e=>!e),readerHref:d&&p===`text`?o:void 0}):null,(0,k.jsx)(U,{runId:e,entry:t,kind:p,showImage:p===`image`&&(!s||f),rendered:c?null:u?`markdown`:d?`html`:null,imageUrl:r})]})}function U({runId:e,entry:t,kind:n,showImage:r,rendered:i,imageUrl:a}){return r?(0,k.jsx)(`div`,{className:`flex justify-center p-4`,children:(0,k.jsx)(`img`,{"data-slot":`file-preview-image`,src:a??o(e,t.path),alt:t.path,className:`max-h-[70vh] max-w-full rounded-sm`})}):n===`too-large`?(0,k.jsx)(f,{icon:(0,k.jsx)(T,{}),tone:`neutral`,heading:`h2`,title:`Too large to preview`,subtitle:`${B(t.size)} — past the preview cap. Open it in your editor instead.`}):n===`binary`?(0,k.jsx)(f,{icon:(0,k.jsx)(E,{}),tone:`neutral`,heading:`h2`,title:`Binary file`,subtitle:`${B(t.size)} of binary data — no text preview.`}):i===`markdown`?(0,k.jsx)(`div`,{className:`p-4`,children:(0,k.jsx)(S,{document:!0,children:t.content??``})}):i===`html`?(0,k.jsx)(P,{html:t.content??``,title:`Report: ${t.path}`,className:`h-[70vh]`}):(0,k.jsx)(Y,{path:t.path,text:t.content??``})}function W({snapshot:e,downloadUrl:t,source:n,onSource:r,readerHref:i}){return(0,k.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 border-b border-border px-4 py-2 text-xs`,children:[e?(0,k.jsxs)(`span`,{children:[`Published snapshot · `,e]}):null,t?(0,k.jsx)(`a`,{className:`inline-flex min-h-11 items-center text-accent-text underline`,href:t,children:`Download`}):null,n===null?null:(0,k.jsx)(`button`,{className:`min-h-11 rounded px-2 text-accent-text underline focus-visible:ring-2`,onClick:r,children:n?`Preview`:`View source`}),i?(0,k.jsx)(G,{href:i}):null]})}function G({href:e}){let n=r(),i=t();return(0,k.jsx)(`a`,{className:`inline-flex min-h-11 items-center px-2 text-accent-text underline focus-visible:ring-2`,href:e,onClick:t=>w(t,n,e,i),children:`Open reader`})}function K({className:e,children:t}){return(0,k.jsx)(`section`,{"data-slot":`file-preview`,className:n(`flex flex-col overflow-hidden rounded-lg border border-border bg-card`,e),children:t})}var q=1500;function J(e,t){let n=(0,O.useMemo)(()=>t.split(`
|
|
2
|
-
`).map(e=>[{content:e}]),[t]),r=(0,O.useMemo)(()=>b(e),[e]),i=n.length>q,[a,o]=(0,O.useState)(null);return(0,O.useEffect)(()=>{if(r===null||i)return;let n=!1;return x(t,r).then(r=>{n||o({key:`${e}\0${t}`,tokens:r.tokens})}),()=>{n=!0}},[e,t,r,i]),r===null||i?n:a?.key===`${e}\0${t}`?a.tokens:p(t,r)?.tokens??n}function Y({path:e,text:t}){let n=J(e,t);return(0,k.jsx)(`div`,{"data-slot":`file-preview-code`,"data-lang":b(e)??`plaintext`,className:`overflow-x-auto py-2 font-mono text-xs leading-[1.7]`,children:n.map((e,t)=>(0,k.jsxs)(`div`,{className:`flex px-4`,children:[(0,k.jsx)(`span`,{className:`w-10 shrink-0 select-none pr-3 text-right tabular-nums text-soft-foreground`,children:t+1}),(0,k.jsx)(`span`,{className:`min-w-0 flex-1 whitespace-pre pr-4`,children:e.map((e,t)=>(0,k.jsx)(`span`,{style:e.color===void 0?void 0:{color:e.color},children:e.content},t))})]},t))})}export{R as a,E as c,B as i,T as l,H as n,P as o,V as r,D as s,Y as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{d as t,t as n,u as r}from"./button-CS5tOblf.js";import{i,t as a}from"./react-runtime-CCIEwYL0.js";import{Z as o}from"./popover-G6KGT-qq.js";import{E as s,I as c,M as l,d as u,lt as d}from"./design-icons-DmYTv2r1.js";import{t as f}from"./createLucideIcon-BHp8sXmF.js";import{n as p,r as m,t as h}from"./diff-controls-BHF0Pvdc.js";import{i as g,p as _,r as v,t as y}from"./dropdown-menu-D7f0O7xR.js";import{P as b,nn as x}from"./index-DBNT3CYH.js";var S=f(`ellipsis-vertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),C=f(`file`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}]]),w=e(i(),1),T=a();function E({root:e,selected:t,onSelect:n}){return(0,T.jsx)(`nav`,{"data-slot":`changes-tree`,"aria-label":`Changed files`,className:`min-w-0 text-[13px]`,children:(0,T.jsxs)(`ul`,{className:`flex flex-col gap-px`,children:[e.dirs.map(e=>(0,T.jsx)(O,{dir:e,depth:0,selected:t,onSelect:n},e.path)),e.files.map(e=>(0,T.jsx)(A,{file:e,depth:0,selected:t,onSelect:n},e.path))]})})}function D({adds:e,dels:t}){return(0,T.jsxs)(`span`,{className:`ml-auto shrink-0 pl-2 font-mono text-[11px] font-medium tabular-nums`,children:[e>0?(0,T.jsxs)(`span`,{className:`text-success`,children:[`+`,e]}):null,e>0&&t>0?` `:null,t>0?(0,T.jsxs)(`span`,{className:`text-danger`,children:[`−`,t]}):null]})}function O({dir:e,depth:t,selected:n,onSelect:i}){let[a,o]=(0,w.useState)(!0);return(0,T.jsxs)(`li`,{children:[(0,T.jsxs)(`button`,{type:`button`,"data-slot":`tree-dir`,"data-path":e.path,"data-state":a?`open`:`closed`,"aria-expanded":a,onClick:()=>o(e=>!e),className:`flex min-h-11 w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left text-muted-foreground hover:bg-muted hover:text-foreground`,style:{paddingLeft:`${6+t*14}px`},children:[(0,T.jsx)(u,{size:16,"aria-hidden":`true`,className:r(`size-3.5 shrink-0 transition-transform motion-reduce:transition-none`,a&&`rotate-90`)}),(0,T.jsx)(s,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,T.jsx)(`span`,{className:`min-w-0 truncate font-medium`,children:e.name}),(0,T.jsx)(D,{adds:e.adds,dels:e.dels})]}),a?(0,T.jsxs)(`ul`,{className:`flex flex-col gap-px`,children:[e.dirs.map(e=>(0,T.jsx)(O,{dir:e,depth:t+1,selected:n,onSelect:i},e.path)),e.files.map(e=>(0,T.jsx)(A,{file:e,depth:t+1,selected:n,onSelect:i},e.path))]}):null]})}var k={added:`text-success`,deleted:`text-danger`};function A({file:e,depth:t,selected:n,onSelect:i}){let a=n===e.path;return(0,T.jsx)(`li`,{children:(0,T.jsxs)(`button`,{type:`button`,"data-slot":`tree-file`,"data-path":e.path,"aria-current":a?`true`:void 0,onClick:()=>i(e.path),className:r(`flex min-h-11 w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left hover:bg-muted`,a?`bg-muted font-medium text-foreground`:`text-muted-foreground hover:text-foreground`),style:{paddingLeft:`${24+t*14}px`},children:[(0,T.jsx)(C,{"aria-hidden":`true`,className:r(`size-3.5 shrink-0`,k[e.status])}),(0,T.jsx)(`span`,{className:`min-w-0 truncate`,children:e.name}),(0,T.jsx)(D,{adds:e.adds,dels:e.dels})]})})}function j(e,t){return{kind:`dir`,name:e,path:t,dirs:[],files:[],adds:0,dels:0,fileCount:0}}function M(e){let t=e;for(;t.files.length===0&&t.dirs.length===1;){let e=t.dirs[0];t={...e,name:`${t.name}/${e.name}`}}return{...t,dirs:t.dirs.map(M)}}var N=(e,t)=>e.name.localeCompare(t.name);function P(e){let t=j(``,``),n=new Map([[``,t]]),r=e=>{let t=n.get(e);if(t)return t;let i=e.lastIndexOf(`/`),a=r(i===-1?``:e.slice(0,i)),o=j(i===-1?e:e.slice(i+1),e);return a.dirs.push(o),n.set(e,o),o};for(let t of e){let e=t.path.lastIndexOf(`/`);r(e===-1?``:t.path.slice(0,e)).files.push({kind:`file`,name:e===-1?t.path:t.path.slice(e+1),path:t.path,status:t.status,adds:t.adds,dels:t.dels,binary:t.binary})}let i=e=>{e.dirs.forEach(i),e.adds=e.files.reduce((e,t)=>e+t.adds,0)+e.dirs.reduce((e,t)=>e+t.adds,0),e.dels=e.files.reduce((e,t)=>e+t.dels,0)+e.dirs.reduce((e,t)=>e+t.dels,0),e.fileCount=e.files.length+e.dirs.reduce((e,t)=>e+t.fileCount,0),e.dirs.sort(N),e.files.sort(N)};return i(t),{...t,dirs:t.dirs.map(M)}}function F({bar:e,healthReady:t,branch:i,stat:a,mode:o,wrap:s,preview:c=!1,onModeChange:l,onWrapChange:u,onPreviewChange:d,onAction:f}){return(0,T.jsxs)(`div`,{"data-slot":`git-toolbar`,"data-health-ready":t,className:`flex flex-wrap items-center gap-x-2.5 gap-y-1.5 px-[18px] py-[22px] md:px-9 [&_button]:min-h-11`,children:[i?(0,T.jsx)(h,{branch:i}):null,a?(0,T.jsx)(R,{stat:a}):null,d?(0,T.jsx)(`span`,{className:`ml-auto flex items-center`,children:(0,T.jsx)(m,{preview:c,onPreviewChange:d})}):null,(0,T.jsxs)(`span`,{className:r(`flex items-center gap-1`,d?`max-md:ml-auto`:`ml-auto`),children:[(0,T.jsx)(`span`,{className:`hidden items-center gap-1 md:flex`,children:(0,T.jsx)(p,{mode:o,wrap:s,onModeChange:l,onWrapChange:u})}),e.secondary.map(e=>(0,T.jsx)(L,{action:e,variant:`outline`,onAction:f},e.id)),(0,T.jsx)(L,{action:e.primary,variant:`primary`,onAction:f}),e.menu.length>0?(0,T.jsxs)(y,{children:[(0,T.jsx)(_,{asChild:!0,children:(0,T.jsx)(n,{variant:`ghost`,size:`icon-sm`,"aria-label":`More git actions`,children:(0,T.jsx)(S,{"aria-hidden":`true`})})}),(0,T.jsx)(v,{align:`end`,"data-slot":`git-toolbar-menu`,children:e.menu.map(e=>(0,T.jsxs)(g,{disabled:!e.enabled,title:e.reason,onSelect:()=>f(e.id),children:[I[e.id],e.label]},e.id))})]}):null]})]})}var I={commit:(0,T.jsx)(l,{size:16,"aria-hidden":`true`}),push:(0,T.jsx)(d,{size:16,"aria-hidden":`true`}),"create-pr":(0,T.jsx)(c,{size:16,"aria-hidden":`true`}),"view-pr":(0,T.jsx)(o,{"aria-hidden":`true`}),"open-terminal":(0,T.jsx)(x,{"aria-hidden":`true`})};function L({action:e,variant:r,onAction:i}){return e.id===`view-pr`?t(e.href)?(0,T.jsx)(n,{asChild:!0,variant:r,size:`sm`,"data-action":e.id,children:(0,T.jsxs)(`a`,{href:e.href,target:`_blank`,rel:`noopener noreferrer`,children:[I[e.id],e.label]})}):(0,T.jsxs)(n,{variant:r,size:`sm`,"data-action":e.id,disabled:!0,title:`View PR unavailable — the recorded PR link is not an http(s) URL`,children:[I[e.id],e.label]}):(0,T.jsxs)(n,{variant:r,size:`sm`,"data-action":e.id,disabled:!e.enabled,title:e.enabled?void 0:e.reason,onClick:()=>i(e.id),children:[I[e.id],e.label]})}function R({stat:e}){return(0,T.jsx)(`span`,{"data-slot":`changes-stat`,children:(0,T.jsx)(b,{stat:{adds:z(e.adds),dels:z(e.dels),files:e.files}})})}function z(e){let[t,n]=(0,w.useState)(e),r=(0,w.useRef)(e);return(0,w.useEffect)(()=>{let t=r.current;if(t===e)return;if(typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches||typeof requestAnimationFrame!=`function`){r.current=e,n(e);return}let i=performance.now(),a=0,o=s=>{let c=Math.min(1,(s-i)/350),l=1-(1-c)**3;n(Math.round(t+(e-t)*l)),c<1?a=requestAnimationFrame(o):r.current=e};return a=requestAnimationFrame(o),()=>{cancelAnimationFrame(a),r.current=e,n(e)}},[e]),t}export{E as i,F as n,P as r,R as t};
|