@hearsay-tools/squawk 0.19.0-pr4469.8812 → 0.19.0-pr4470.8813
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/automations/agent-tools.d.ts +2 -0
- package/dist/{features/automations → automations}/agent-tools.js +5 -5
- package/dist/automations/agent-tools.js.map +1 -0
- package/dist/{features/automations → automations}/automation-cli.d.ts +3 -3
- package/dist/{features/automations → automations}/automation-cli.js +9 -9
- package/dist/automations/automation-cli.js.map +1 -0
- package/dist/{features/automations → automations}/coordinator.js +3 -3
- package/dist/automations/coordinator.js.map +1 -0
- package/dist/{features/automations → automations}/enabled.js +1 -1
- package/dist/automations/enabled.js.map +1 -0
- package/dist/automations/github-baseline.js.map +1 -0
- package/dist/{features/automations → automations}/github-poller.d.ts +1 -1
- package/dist/{features/automations → automations}/github-poller.js +2 -2
- package/dist/automations/github-poller.js.map +1 -0
- package/dist/{features/automations → automations}/github-repository.d.ts +1 -1
- package/dist/{features/automations → automations}/github-repository.js +3 -3
- package/dist/automations/github-repository.js.map +1 -0
- package/dist/{features/automations → automations}/project-files.js +1 -1
- package/dist/automations/project-files.js.map +1 -0
- package/dist/{features/automations → automations}/prompts.js +2 -2
- package/dist/automations/prompts.js.map +1 -0
- package/dist/{features/automations → automations}/schedule-runner.js +1 -1
- package/dist/automations/schedule-runner.js.map +1 -0
- package/dist/{features/automations → automations}/scheduler.js +4 -4
- package/dist/automations/scheduler.js.map +1 -0
- package/dist/{features/automations → automations}/service.d.ts +7 -7
- package/dist/{features/automations → automations}/service.js +6 -6
- package/dist/automations/service.js.map +1 -0
- package/dist/{features/automations → automations}/store.js +5 -5
- package/dist/automations/store.js.map +1 -0
- package/dist/{features/automations → automations}/task-template.d.ts +2 -2
- package/dist/{features/automations → automations}/task-template.js +7 -7
- package/dist/automations/task-template.js.map +1 -0
- package/dist/{features/automations → automations}/tool-adapter.d.ts +4 -4
- package/dist/{features/automations → automations}/tool-adapter.js +12 -12
- package/dist/automations/tool-adapter.js.map +1 -0
- package/dist/{features/automations → automations}/tool-catalog.js +2 -2
- package/dist/automations/tool-catalog.js.map +1 -0
- package/dist/{features/automations → automations}/tool-client.d.ts +2 -2
- package/dist/{features/automations → automations}/tool-client.js +4 -4
- package/dist/automations/tool-client.js.map +1 -0
- package/dist/automations/tool-env.d.ts +1 -0
- package/dist/automations/tool-env.js +3 -0
- package/dist/automations/tool-env.js.map +1 -0
- package/dist/{features/automations → automations}/tool-errors.d.ts +1 -1
- package/dist/automations/tool-errors.js.map +1 -0
- package/dist/{features/automations → automations}/tool-github.js +1 -1
- package/dist/automations/tool-github.js.map +1 -0
- package/dist/{features/automations → automations}/tool-session.d.ts +1 -1
- package/dist/{features/automations → automations}/tool-session.js +1 -1
- package/dist/automations/tool-session.js.map +1 -0
- package/dist/{features/automations → automations}/tool-timeout.js +1 -1
- package/dist/automations/tool-timeout.js.map +1 -0
- package/dist/{features/automations → automations}/tools.d.ts +1 -1
- package/dist/automations/tools.js.map +1 -0
- package/dist/{features/automations → automations}/types.d.ts +1 -1
- package/dist/{features/automations → automations}/types.js +1 -1
- package/dist/automations/types.js.map +1 -0
- package/dist/boot.js +6 -0
- package/dist/boot.js.map +1 -1
- package/dist/built-in-capabilities.d.ts +3 -0
- package/dist/built-in-capabilities.js +14 -0
- package/dist/built-in-capabilities.js.map +1 -0
- package/dist/built-in-cli-commands.js +4 -0
- package/dist/built-in-cli-commands.js.map +1 -1
- package/dist/built-in-http-routes.d.ts +10 -0
- package/dist/built-in-http-routes.js +33 -0
- package/dist/built-in-http-routes.js.map +1 -0
- package/dist/built-in-launch-parts.d.ts +2 -0
- package/dist/built-in-launch-parts.js +9 -1
- package/dist/built-in-launch-parts.js.map +1 -1
- package/dist/built-in-server-hooks.d.ts +9 -0
- package/dist/built-in-server-hooks.js +24 -0
- package/dist/built-in-server-hooks.js.map +1 -0
- package/dist/built-in-tools.js +2 -1
- package/dist/built-in-tools.js.map +1 -1
- package/dist/delegation/transport.d.ts +65 -65
- package/dist/{features/automations → server}/automation-log-retry.d.ts +2 -2
- package/dist/{features/automations → server}/automation-log-retry.js +4 -4
- package/dist/server/automation-log-retry.js.map +1 -0
- package/dist/{features/automations → server}/automations-routes.d.ts +165 -165
- package/dist/{features/automations → server}/automations-routes.js +17 -17
- package/dist/server/automations-routes.js.map +1 -0
- package/dist/server/live-routes.d.ts +6 -6
- package/dist/server/provider-sign-in-routes.d.ts +2 -2
- package/dist/server/providers-routes.d.ts +7 -7
- package/dist/server/runner-install-routes.d.ts +10 -10
- package/dist/server/runs-routes.d.ts +337 -337
- package/dist/server/server.d.ts +359 -359
- package/dist/server/workspace-live-routes.d.ts +6 -6
- package/package.json +4 -4
- package/web/dist/assets/{accounts-section-CnQrgrlx.js → accounts-section-B6L_eCge.js} +1 -1
- package/web/dist/assets/{activity-motion-SZyZ3Vcd.js → activity-motion-uHV9WVWW.js} +1 -1
- package/web/dist/assets/{activity-route-kA927mMd.js → activity-route-ZvBSfbJa.js} +1 -1
- package/web/dist/assets/{agent-config-section-DZ9lz-oU.js → agent-config-section-Czu88iFQ.js} +1 -1
- package/web/dist/assets/{agent-defaults-section-CAyM93lD.js → agent-defaults-section-kdQ9hwMn.js} +1 -1
- package/web/dist/assets/{appearance-jU-y46Hc.js → appearance-ELzA_Y-r.js} +1 -1
- package/web/dist/assets/{automations-route-DzIrboEQ.js → automations-route-wgVmxFuL.js} +1 -1
- package/web/dist/assets/{commit-list-JK2MEtR0.js → commit-list-Cg2wU-b9.js} +1 -1
- package/web/dist/assets/{diff-CC-HnvfR.js → diff-KCTM2Wz-.js} +2 -2
- package/web/dist/assets/{diff-controls-CnrIcRRG.js → diff-controls-LZ-ro_V5.js} +1 -1
- package/web/dist/assets/{diff-view-Dzl9i4zr.js → diff-view-ClhSIhOU.js} +1 -1
- package/web/dist/assets/{file-preview-C1Nd5SH3.js → file-preview-DaPUicrL.js} +1 -1
- package/web/dist/assets/{git-toolbar-q-HOZgdL.js → git-toolbar-BxqFj5Ea.js} +1 -1
- package/web/dist/assets/{github-RqiwU49D.js → github-C-fDvzWv.js} +1 -1
- package/web/dist/assets/{global-activity-route-DTuWu-5a.js → global-activity-route-ccfZhHur.js} +1 -1
- package/web/dist/assets/index-BgwtSOOQ.css +1 -0
- package/web/dist/assets/index-_l5gcUqA.js +21 -0
- package/web/dist/assets/{markdown-NDbXgnqb.js → markdown-Ce-c_H3H.js} +1 -1
- package/web/dist/assets/{notifications-section-CQ4HSyLK.js → notifications-section-Bn2KqIj5.js} +1 -1
- package/web/dist/assets/{preview-pane-connected-Dm-Ga2KN.js → preview-pane-connected-BZv6a88f.js} +1 -1
- package/web/dist/assets/{projects-section-CKPqFZP7.js → projects-section-HvvoRCCN.js} +1 -1
- package/web/dist/assets/{prompt-templates-section-D9Tsgav9.js → prompt-templates-section-Bp1Lpuah.js} +1 -1
- package/web/dist/assets/{reference-chip-CV_vG2eP.js → reference-chip-DXFYkdLT.js} +1 -1
- package/web/dist/assets/{remote-settings-notice-40uqklAG.js → remote-settings-notice-C2WnWH7Z.js} +1 -1
- package/web/dist/assets/{repo-git-BBalirax.js → repo-git-B4-HsX3H.js} +1 -1
- package/web/dist/assets/{report-reader-D3Heszz3.js → report-reader-BDC1M3FH.js} +1 -1
- package/web/dist/assets/{reports-CEaxAigM.js → reports-ByXyb8Qq.js} +1 -1
- package/web/dist/assets/{resources-section-ohdWkreq.js → resources-section-a6pURXjH.js} +1 -1
- package/web/dist/assets/{review-panel-CthaDvZO.js → review-panel-DO8pEdxG.js} +1 -1
- package/web/dist/assets/{run-header-9NNASXmJ.js → run-header-ZKCViZcp.js} +2 -2
- package/web/dist/assets/{select-Bh7vwx79.js → select-DyUG6Pq0.js} +1 -1
- package/web/dist/assets/{session-context-section-B5Ee7GbQ.js → session-context-section-BK-gaYfD.js} +1 -1
- package/web/dist/assets/{settings-agent-picker-DeczgUDV.js → settings-agent-picker-BWIzThpj.js} +1 -1
- package/web/dist/assets/{settings-shell-BvRwl06q.js → settings-shell-Kpi86jxR.js} +1 -1
- package/web/dist/assets/{sidebar-section-Bn1Uv9AQ.js → sidebar-section-uIA0bp4R.js} +1 -1
- package/web/dist/assets/{skills-DMyaR3WX.js → skills-F_PlpaAj.js} +1 -1
- package/web/dist/assets/{task-changes-ChM901cL.js → task-changes-B0OznsI4.js} +1 -1
- package/web/dist/assets/{task-commits-DOP65FDx.js → task-commits-YLAnUoUT.js} +1 -1
- package/web/dist/assets/{task-file-scope-emNQrzps.js → task-file-scope-lYm3HhO-.js} +1 -1
- package/web/dist/assets/{task-files-BYPCvDCO.js → task-files-CBWCKg1N.js} +1 -1
- package/web/dist/assets/task-github-item-BoBW3pWI.js +1 -0
- package/web/dist/assets/{task-thread-BI2pi8dZ.js → task-thread-QCh0XSC9.js} +2 -2
- package/web/dist/assets/tasks-table-B9Hu3rBi.js +1 -0
- package/web/dist/assets/{thread-state-CdKvrn7R.js → thread-state-UskdtPpY.js} +1 -1
- package/web/dist/assets/{use-hand-to-agent-state-stc7Vzni.js → use-hand-to-agent-state-BAIAj5y3.js} +1 -1
- package/web/dist/assets/{workflows-DagjPw_m.js → workflows-Czz1Sh3f.js} +1 -1
- package/web/dist/assets/{workspace-tools-BaLORh9B.js → workspace-tools-NblPQmRw.js} +1 -1
- package/web/dist/assets/{worktrees-section-CSERluzw.js → worktrees-section-Wvpc1NIq.js} +1 -1
- package/web/dist/index.html +4 -4
- package/dist/features/automations/agent-tools.d.ts +0 -2
- package/dist/features/automations/agent-tools.js.map +0 -1
- package/dist/features/automations/automation-cli.js.map +0 -1
- package/dist/features/automations/automation-log-retry.js.map +0 -1
- package/dist/features/automations/automations-routes.js.map +0 -1
- package/dist/features/automations/capability.d.ts +0 -3
- package/dist/features/automations/capability.js +0 -7
- package/dist/features/automations/capability.js.map +0 -1
- package/dist/features/automations/cli-command.d.ts +0 -3
- package/dist/features/automations/cli-command.js +0 -10
- package/dist/features/automations/cli-command.js.map +0 -1
- package/dist/features/automations/coordinator.js.map +0 -1
- package/dist/features/automations/enabled.js.map +0 -1
- package/dist/features/automations/github-baseline.js.map +0 -1
- package/dist/features/automations/github-poller.js.map +0 -1
- package/dist/features/automations/github-repository.js.map +0 -1
- package/dist/features/automations/index.d.ts +0 -14
- package/dist/features/automations/index.js +0 -17
- package/dist/features/automations/index.js.map +0 -1
- package/dist/features/automations/launch-part.d.ts +0 -3
- package/dist/features/automations/launch-part.js +0 -9
- package/dist/features/automations/launch-part.js.map +0 -1
- package/dist/features/automations/project-files.js.map +0 -1
- package/dist/features/automations/prompts.js.map +0 -1
- package/dist/features/automations/schedule-runner.js.map +0 -1
- package/dist/features/automations/scheduler.js.map +0 -1
- package/dist/features/automations/server-plugin.d.ts +0 -7
- package/dist/features/automations/server-plugin.js +0 -31
- package/dist/features/automations/server-plugin.js.map +0 -1
- package/dist/features/automations/service.js.map +0 -1
- package/dist/features/automations/store.js.map +0 -1
- package/dist/features/automations/task-template.js.map +0 -1
- package/dist/features/automations/tool-adapter.js.map +0 -1
- package/dist/features/automations/tool-catalog.js.map +0 -1
- package/dist/features/automations/tool-client.js.map +0 -1
- package/dist/features/automations/tool-env.d.ts +0 -3
- package/dist/features/automations/tool-env.js +0 -5
- package/dist/features/automations/tool-env.js.map +0 -1
- package/dist/features/automations/tool-errors.js.map +0 -1
- package/dist/features/automations/tool-github.js.map +0 -1
- package/dist/features/automations/tool-session.js.map +0 -1
- package/dist/features/automations/tool-timeout.js.map +0 -1
- package/dist/features/automations/tools.js.map +0 -1
- package/dist/features/automations/types.js.map +0 -1
- package/web/dist/assets/index-6yHpyOyH.js +0 -21
- package/web/dist/assets/index-DNgBNd8o.css +0 -1
- package/web/dist/assets/task-github-item-CHGyiC4k.js +0 -1
- package/web/dist/assets/tasks-table-BY5niMlY.js +0 -1
- package/dist/{features/automations → automations}/coordinator.d.ts +1 -1
- package/dist/{features/automations → automations}/enabled.d.ts +0 -0
- package/dist/{features/automations → automations}/github-baseline.d.ts +0 -0
- package/dist/{features/automations → automations}/github-baseline.js +0 -0
- package/dist/{features/automations → automations}/project-files.d.ts +0 -0
- package/dist/{features/automations → automations}/prompts.d.ts +0 -0
- package/dist/{features/automations → automations}/schedule-runner.d.ts +0 -0
- package/dist/{features/automations → automations}/scheduler.d.ts +1 -1
- /package/dist/{features/automations → automations}/store.d.ts +0 -0
- /package/dist/{features/automations → automations}/tool-catalog.d.ts +0 -0
- /package/dist/{features/automations → automations}/tool-errors.js +0 -0
- /package/dist/{features/automations → automations}/tool-github.d.ts +0 -0
- /package/dist/{features/automations → automations}/tool-timeout.d.ts +0 -0
- /package/dist/{features/automations → automations}/tools.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./utils-DSMR_WLb.js";import{C as i,Wt as a,X as o,Y as s,dn as c,yt as l}from"./queries-D0v1z40Y.js";import{Bt as u,Fn as d,Ft as f,Ht as p,Lt as m,Tt as h,at as g,ct as _,hi as v,n as y,tr as b}from"./toaster-DMfiAEnw.js";import{h as x}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{C as S,j as C,l as w}from"./design-icons-CzEoMH9c.js";import{t as T}from"./run-header-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./utils-DSMR_WLb.js";import{C as i,Wt as a,X as o,Y as s,dn as c,yt as l}from"./queries-D0v1z40Y.js";import{Bt as u,Fn as d,Ft as f,Ht as p,Lt as m,Tt as h,at as g,ct as _,hi as v,n as y,tr as b}from"./toaster-DMfiAEnw.js";import{h as x}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{C as S,j as C,l as w}from"./design-icons-CzEoMH9c.js";import{t as T}from"./run-header-ZKCViZcp.js";import{i as E,n as D,r as ee}from"./git-toolbar-BxqFj5Ea.js";import{t as O}from"./button-B7MKxYjT.js";import{a as k,i as A,o as j,r as M,s as N,t as P}from"./dialog-B531GGAo.js";import{b as F,f as I}from"./task-groups-BdayPxX3.js";import{c as L,d as R}from"./page-shell-7pLJMOgh.js";import{t as z}from"./centered-state-V15AR_qo.js";import{C as B,Pn as V,S as H,X as U,Zt as W,an as te}from"./index-_l5gcUqA.js";import{t as G}from"./markdown-BBDDg-4t.js";import{t as K}from"./textarea-vJt9undk.js";import{t as q}from"./diff-KCTM2Wz-.js";var J=e(t(),1),Y=`no worktree — this task ran directly in the repo working tree`;function X(e){let t=e=>({id:`commit`,label:`Commit`,enabled:!1,reason:e});return e.hasWorktree?e.run.status===`running`?t(`Commit unavailable — the agent is still working in this worktree`):e.changedFiles===void 0?t(`Commit unavailable — changes are still loading`):e.changedFiles===0?t(`Commit unavailable — no changes to commit`):{id:`commit`,label:`Commit`,enabled:!0}:t(`Commit unavailable — ${Y}`)}function Z(e){let t=e=>({id:`push`,label:`Push`,enabled:!1,reason:e});return e.hasWorktree?e.remote===void 0?t(`Push unavailable — no remote configured`):e.branch===void 0?t(`Push unavailable — the run has no branch to push`):e.run.status===`running`?t(`Push unavailable — the agent is still working in this worktree`):{id:`push`,label:`Push`,enabled:!0}:t(`Push unavailable — ${Y}`)}function ne(e){let t=e=>({id:`create-pr`,label:`Draft PR`,enabled:!1,reason:e});return!e.hasWorktree||e.branch===void 0?t(`Draft PR unavailable — ${Y}`):e.forge===null?t(`Draft PR unavailable — no supported forge remote (GitHub) detected`):e.forge.available?b(e.run)?t(`Draft PR unavailable — the run is waiting on a usage-limit hold; choose Don’t resume first`):F(e.run)?t(`Draft PR unavailable — the run is still active; wait for the review gate`):{id:`create-pr`,label:`Draft PR`,enabled:!0}:t(`Draft PR unavailable — ${e.forge.reason??`the forge is unreachable`}`)}function re(e){let t=e.prUrl?{id:`view-pr`,label:`View PR`,enabled:!0,href:e.prUrl}:X(e),n=e.prUrl?[X(e),Z(e)]:[Z(e),ne(e)],r=[];if(e.localHandoff&&e.cliHandoff!==!1){let t=e.hasSession?F(e.run)?{id:`open-terminal`,label:`Open in terminal`,enabled:!1,reason:`Terminal unavailable — the session is still active in the engine`}:{id:`open-terminal`,label:`Open in terminal`,enabled:!0}:{id:`open-terminal`,label:`Open in terminal`,enabled:!1,reason:`Terminal unavailable — no agent session to resume`};r.push(t)}return{primary:t,secondary:n,menu:r}}var Q=n();function $({run:e,open:t,onOpenChange:n}){let r=v(),[i,o]=(0,J.useState)(``),s=I(e),l=(0,J.useRef)(s);l.current=s,(0,J.useEffect)(()=>{t&&o(l.current)},[t]);let u=c({mutationFn:t=>g(e.id,t),onSuccess:t=>{y(`Committed ${V(t.sha)}`),n(!1),r.invalidateQueries({queryKey:a.runs.changes(e.id)}),r.invalidateQueries({queryKey:a.runs.all})},onError:e=>y(e.message,{tone:`danger`})}),d=()=>{let e=i.trim();e.length===0||u.isPending||u.mutate(e)};return(0,Q.jsx)(P,{open:t,onOpenChange:n,children:(0,Q.jsxs)(M,{"data-slot":`commit-dialog`,children:[(0,Q.jsxs)(j,{children:[(0,Q.jsx)(N,{children:`Commit changes`}),(0,Q.jsxs)(A,{children:[`Stages everything in the task's worktree (git add -A) and commits to`,` `,e.branch?(0,Q.jsx)(`span`,{className:`font-mono`,children:e.branch}):`its branch`,`.`]})]}),(0,Q.jsx)(K,{"data-slot":`commit-message`,"aria-label":`Commit message`,rows:3,value:i,onChange:e=>o(e.target.value),onKeyDown:e=>{U({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(),d())}}),(0,Q.jsxs)(k,{children:[(0,Q.jsx)(O,{variant:`outline`,onClick:()=>n(!1),children:`Cancel`}),(0,Q.jsx)(O,{"data-slot":`commit-confirm`,disabled:i.trim().length===0||u.isPending,onClick:d,children:u.isPending?`Committing…`:`Commit`})]})]})})}function ie(){let{id:e}=x(),t=s(e);return t.isPending?(0,Q.jsx)(B,{tab:`changes`}):t.isError?(0,Q.jsx)(H,{tab:`changes`,error:t.error}):(0,Q.jsx)(ae,{run:t.data})}function ae({run:e}){let t=l(),n=i(),r=o(e.id,F(e)),s=W(),[p,h]=(0,J.useState)(`unified`),[g,b]=(0,J.useState)(!0),[x,S]=(0,J.useState)(!1),[C,w]=(0,J.useState)(null),[E,O]=(0,J.useState)(!1),k=(0,J.useRef)(null),A=v(),j=()=>A.invalidateQueries({queryKey:a.runs.all}),M=e=>y(e.message,{tone:`danger`}),N=c({mutationFn:()=>u(e.id),onSuccess:e=>y(e.upstreamSet?`Pushed ${e.branch} to ${e.remote} (upstream set)`:`Pushed ${e.branch} to ${e.remote}`),onError:M}),P=c({mutationFn:()=>_(e.id),onSuccess:e=>{y(`Draft PR created — ${e.url}`),j()},onError:M}),I=c({mutationFn:()=>m(e.id),onError:e=>{if(e instanceof d&&e.command){navigator.clipboard.writeText(e.command).then(()=>y(`No terminal found — command copied to clipboard.`)).catch(()=>y(`Run manually: ${e.command}`));return}M(e)}}),z=c({mutationFn:t=>f(e.id,t),onError:M}),B=r.isError&&r.error instanceof d&&r.error.status===409,V=re({run:e,cliHandoff:e.cliHandoff,hasWorktree:!!e.worktreePath&&!B,branch:e.branch,changedFiles:r.data?.stat.files,remote:n.data?.info?.remote,forge:t.data?.forge??null,localHandoff:t.data?.capabilities.localHandoff??!1,hasSession:te(e)!==void 0,prUrl:e.pullRequestUrl}),H=e=>{switch(e){case`commit`:O(!0);break;case`push`:N.mutate();break;case`create-pr`:P.mutate();break;case`open-terminal`:I.mutate();break;case`view-pr`:break}},U=r.data?.files??[],K=(0,J.useMemo)(()=>ee(U),[U]),q=(0,J.useMemo)(()=>U.some(G),[U]),Y=s?p:`unified`;return(0,Q.jsxs)(L,{route:`task-changes`,density:R(U.length),flushPadding:!0,children:[(0,Q.jsx)(T,{run:e,tab:`changes`}),(0,Q.jsx)(D,{bar:V,healthReady:t.data!==void 0,branch:e.branch,stat:r.data?.stat,mode:Y,wrap:g,preview:x,onModeChange:h,onWrapChange:b,onPreviewChange:q?S:void 0,onAction:H}),r.data?.repointedHead?(0,Q.jsxs)(`p`,{"data-slot":`repointed-head-note`,className:`border-b px-4 py-2 text-xs text-soft-foreground md:px-9`,children:[`HEAD is on `,(0,Q.jsx)(`code`,{children:r.data.repointedHead.headBranch}),`, not this task's branch`,` `,(0,Q.jsx)(`code`,{children:r.data.repointedHead.taskBranch}),` — showing only what this task changed there.`]}):null,(0,Q.jsx)(oe,{changes:r,changesRefused:B,fileCount:U.length,children:(0,Q.jsx)(se,{runId:e.id,files:U,tree:K,selected:C,selectFile:e=>{w(e),k.current?.scrollToPath(e)},diffRef:k,effectiveMode:Y,effectiveWrap:g,preview:x,localHandoff:t.data?.capabilities.localHandoff,onOpenInApp:z.mutate})}),(0,Q.jsx)($,{run:e,open:E,onOpenChange:O})]})}function oe({changes:e,changesRefused:t,fileCount:n,children:r}){return e.isPending?(0,Q.jsx)(`p`,{"data-slot":`changes-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-9`,children:`Loading changes…`}):e.isError?(0,Q.jsx)(z,{icon:t?(0,Q.jsx)(S,{size:16}):(0,Q.jsx)(C,{size:16}),tone:t?`neutral`:`danger`,heading:`h2`,title:t?`No changes to show`:`Could not load the changes`,subtitle:e.error.message}):n===0?(0,Q.jsx)(z,{icon:(0,Q.jsx)(S,{size:16}),tone:`neutral`,heading:`h2`,title:`No changes yet`,subtitle:`The worktree matches its base branch. Changes appear here as the agent works.`}):r}function se({runId:e,files:t,tree:n,selected:i,selectFile:a,diffRef:o,effectiveMode:s,effectiveWrap:c,preview:l,localHandoff:u,onOpenInApp:d}){let[f,m]=(0,J.useState)(!1);return(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col items-stretch gap-4 px-4 pb-9 pt-0 [--diff-sticky-top:0px] md:flex-row md:items-start md:gap-5 md:px-9`,children:[(0,Q.jsxs)(`aside`,{"data-slot":`changes-tree-pane`,className:`w-full shrink-0 rounded-xl border border-border bg-card md:sticky md:top-4 md:max-h-[calc(100dvh_-_64px_-_2rem)] md:w-60 md:overflow-y-auto md:overscroll-contain md:p-3.5 lg:w-[288px]`,children:[(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`changes-tree-toggle`,"aria-expanded":f,onClick:()=>m(e=>!e),className:`flex min-h-11 w-full items-center justify-between gap-2 px-3.5 py-2 text-left text-xs font-semibold text-foreground md:hidden`,children:[(0,Q.jsxs)(`span`,{children:[`Changed files`,` `,(0,Q.jsxs)(`span`,{className:`font-normal text-muted-foreground`,children:[`(`,t.length,`)`]})]}),(0,Q.jsx)(w,{size:16,"aria-hidden":`true`,className:r(`size-4 shrink-0 text-muted-foreground motion-safe:transition-transform`,f&&`rotate-180`)})]}),(0,Q.jsx)(`h2`,{className:`mb-3 hidden border-b border-border pb-3 text-xs font-semibold md:block`,children:`Changed files`}),(0,Q.jsx)(`div`,{className:r(f?`border-t border-border px-3.5 py-3 md:border-t-0 md:p-0`:`hidden md:block`),children:(0,Q.jsx)(E,{root:n,selected:i,onSelect:e=>{a(e),m(!1)}})})]}),(0,Q.jsx)(q,{files:t,viewRef:o,mode:s,wrap:c,preview:l,loadFileText:t=>ce(e,t),imageSrc:t=>p(e,t),onOpenInApp:u?e=>d(e):void 0,totals:!1,className:`min-w-0 flex-1`})]})}async function ce(e,t){try{let n=await h(e,t);return n.type!==`file`||n.binary||n.tooLarge?null:n.content??null}catch{return null}}export{ie as TaskChangesRoute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Q as r,Wt as i,Y as a,Z as o,fn as s}from"./queries-D0v1z40Y.js";import{Fn as c,St as l}from"./toaster-DMfiAEnw.js";import{h as u}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{S as d,j as f,ot as p}from"./design-icons-CzEoMH9c.js";import{t as m}from"./run-header-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Q as r,Wt as i,Y as a,Z as o,fn as s}from"./queries-D0v1z40Y.js";import{Fn as c,St as l}from"./toaster-DMfiAEnw.js";import{h as u}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{S as d,j as f,ot as p}from"./design-icons-CzEoMH9c.js";import{t as m}from"./run-header-ZKCViZcp.js";import{n as h}from"./diff-controls-LZ-ro_V5.js";import{t as g}from"./project-router-BifLGgRR.js";import{b as _}from"./task-groups-BdayPxX3.js";import{c as v,d as y}from"./page-shell-7pLJMOgh.js";import{t as b}from"./centered-state-V15AR_qo.js";import{An as x,C as S,Nn as C,S as w,Zt as T,zt as E}from"./index-_l5gcUqA.js";import{t as D}from"./diff-KCTM2Wz-.js";import{t as O}from"./change-counts-npLATh-3.js";import{r as k,t as A}from"./commit-list-Cg2wU-b9.js";var j=e(t(),1),M=n();function N(){let{id:e}=u(),t=a(e);return t.isPending?(0,M.jsx)(S,{tab:`changes`}):t.isError?(0,M.jsx)(w,{tab:`changes`,error:t.error}):(0,M.jsx)(P,{run:t.data})}function P({run:e}){let{sha:t}=u(),n=r(e.id,_(e)),i=n.data?.commits[0]?.sha;return(0,M.jsxs)(v,{route:`task-commits`,density:y(n.data?.commits.length??0),flushPadding:!0,children:[(0,M.jsx)(m,{run:e,tab:`commits`}),t?(0,M.jsx)(I,{runId:e.id,sha:t}):n.isPending?(0,M.jsx)(`p`,{"data-slot":`commits-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-9`,children:`Loading commits…`}):n.isError?(0,M.jsx)(b,{icon:(0,M.jsx)(f,{size:16}),tone:n.error instanceof c&&n.error.status===409?`neutral`:`danger`,heading:`h2`,title:n.error instanceof c&&n.error.status===409?`No commits to show`:`Could not load the commits`,subtitle:n.error.message}):n.data.commits.length===0?(0,M.jsx)(b,{icon:(0,M.jsx)(f,{size:16}),tone:`neutral`,heading:`h2`,title:`No commits yet`,subtitle:`This task hasn't committed anything on its branch. Autosave commits and any the agent makes appear here.`}):(0,M.jsx)(F,{run:e,commits:n.data.commits,selectedSha:i})]})}function F({run:e,commits:t,selectedSha:n}){let r=o(e.id,n),i=R(e.id,t),a=(0,j.useRef)(null),s=T(),[c,l]=(0,j.useState)(`unified`),[u,d]=(0,j.useState)(!0),m=s?c:`unified`;return(0,M.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-5 px-4 py-5 md:px-9 lg:flex-row lg:items-start`,children:[(0,M.jsxs)(`div`,{className:`w-full shrink-0 lg:w-[380px] xl:w-[420px]`,children:[(0,M.jsx)(A,{slot:`task-commits`,selectedSha:n,heading:(0,M.jsxs)(`h2`,{className:`text-sm font-semibold text-foreground`,children:[t.length,` `,t.length===1?`commit`:`commits`,` in this task`]}),className:`w-full`,commits:t.map(t=>({...t,href:`/tasks/${e.id}/commits/${t.sha}`,stat:i.get(t.sha)}))}),n&&r.data&&r.data.files.length>0?(0,M.jsx)(z,{runId:e.id,sha:n,files:r.data.files,onPick:e=>a.current?.scrollToPath(e)}):null]}),n?(0,M.jsx)(`section`,{"data-slot":`task-commit-preview`,"data-sha":n,className:`min-w-0 flex-1 overflow-hidden rounded-xl border border-border bg-card`,children:r.isPending?(0,M.jsx)(`p`,{className:`px-4 py-8 text-center text-xs text-muted-foreground`,children:`Loading commit diff…`}):r.isError?(0,M.jsx)(b,{icon:(0,M.jsx)(p,{size:16}),tone:`danger`,heading:`h2`,title:`Could not load commit diff`,subtitle:r.error.message}):(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-3 gap-y-2 border-b border-border px-4 py-3`,children:[(0,M.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,M.jsx)(`h3`,{className:`break-words text-sm leading-snug font-semibold text-foreground`,children:r.data.subject}),(0,M.jsxs)(`p`,{className:`mt-0.5 flex flex-wrap items-center gap-x-1.5 text-xs text-muted-foreground`,children:[(0,M.jsx)(`span`,{children:r.data.author}),(0,M.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,M.jsx)(`span`,{title:r.data.when,children:E(r.data.when)}),(0,M.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,M.jsx)(C,{sha:r.data.sha??n,variant:`inline`}),r.data.stat?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,M.jsx)(x,{stat:r.data.stat})]}):null]})]}),(0,M.jsx)(`span`,{className:`flex shrink-0 items-center gap-1.5`,children:(0,M.jsx)(h,{mode:c,wrap:u,onModeChange:l,onWrapChange:d})})]}),!r.data.files||r.data.files.length===0?(0,M.jsx)(b,{icon:(0,M.jsx)(f,{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,M.jsx)(`div`,{className:`p-4 [--diff-sticky-top:0px]`,children:(0,M.jsx)(D,{viewRef:a,files:r.data.files,mode:m,wrap:u,totals:!1,className:`min-w-0`})})]})}):null]})}function I({runId:e,sha:t}){return(0,M.jsx)(k,{commit:o(e,t),sha:t,backTo:`/tasks/${e}/commits`,backLabel:`All commits`,slot:`task-commit`,className:`mx-auto flex min-h-0 w-full max-w-[var(--measure)] flex-1 flex-col`,diffClassName:`px-4 py-4 [--diff-sticky-top:0px] md:px-9`})}var L=12;function R(e,t){let n=t.length<=L,r=s({queries:t.map(t=>({queryKey:i.runs.commit(e,t.sha),queryFn:({signal:n})=>l(e,t.sha,{signal:n}),enabled:n,retry:!1}))}),a=new Map;return r.forEach((e,n)=>{let r=t[n]?.sha;r&&e.data?.stat&&a.set(r,e.data.stat)}),a}function z({runId:e,sha:t,files:n,onPick:r}){return(0,M.jsxs)(`section`,{"data-slot":`task-commit-files`,className:`mt-4 rounded-xl border border-border bg-card p-4`,children:[(0,M.jsxs)(`div`,{className:`mb-2 flex flex-wrap items-baseline justify-between gap-x-3 gap-y-1`,children:[(0,M.jsxs)(`h2`,{className:`text-sm font-semibold text-foreground`,children:[n.length,` `,n.length===1?`file`:`files`,` in`,` `,(0,M.jsx)(C,{sha:t,variant:`inline`,className:`text-[13px] font-medium`})]}),(0,M.jsx)(g,{to:`/tasks/${e}/changes`,className:`text-xs text-muted-foreground hover:text-foreground`,children:`All task changes ›`})]}),(0,M.jsx)(`ul`,{className:`space-y-1`,children:n.map(e=>(0,M.jsx)(`li`,{children:(0,M.jsxs)(`button`,{type:`button`,"data-slot":`task-commit-file`,title:e.oldPath?`${e.oldPath} → ${e.path}`:e.path,onClick:()=>r(e.path),className:`flex min-h-11 w-full items-center gap-2 rounded-md px-2 text-left text-xs text-muted-foreground hover:bg-muted hover:text-foreground`,children:[(0,M.jsx)(d,{size:16,"aria-hidden":`true`,className:`size-[15px] shrink-0`}),(0,M.jsx)(`span`,{className:`min-w-0 flex-1 break-all`,children:e.path}),(0,M.jsx)(O,{adds:e.adds,dels:e.dels,className:`font-mono text-xs`})]})},e.path))})]})}export{N as TaskCommitsRoute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{d as r,h as i}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{r as a}from"./markdown-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{d as r,h as i}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{r as a}from"./markdown-Ce-c_H3H.js";var o=e(t(),1),s=n();function c({runId:e,children:t}){let n=r(),i=(0,o.useMemo)(()=>({runId:e}),[e]);return n?(0,s.jsx)(l,{runId:e,children:t}):(0,s.jsx)(a.Provider,{value:i,children:t})}function l({runId:e,children:t}){let{projectId:n}=i(),r=(0,o.useMemo)(()=>({runId:e,...n?{projectId:n}:{}}),[e,n]);return(0,s.jsx)(a.Provider,{value:r,children:t})}export{c as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./utils-DSMR_WLb.js";import{B as i,F as a,N as o,Y as s,et as c}from"./queries-D0v1z40Y.js";import{Fn as l,ft as u,nt as d}from"./toaster-DMfiAEnw.js";import{f,g as p,h as m,m as h}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{S as g,T as _,X as v,Y as y,ot as b,u as x}from"./design-icons-CzEoMH9c.js";import{t as S}from"./createLucideIcon-BHp8sXmF.js";import{t as C}from"./run-header-9NNASXmJ.js";import{a as w,i as T,n as E,o as D,r as O}from"./file-preview-C1Nd5SH3.js";import{t as k}from"./button-B7MKxYjT.js";import{c as A}from"./page-shell-7pLJMOgh.js";import{t as j}from"./centered-state-V15AR_qo.js";import{C as M,Mn as N,S as P,Zn as F,or as I}from"./index-6yHpyOyH.js";import{r as L}from"./markdown-NDbXgnqb.js";import{t as R}from"./task-file-scope-emNQrzps.js";var z=S(`folder-tree`,[[`path`,{d:`M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`hod4my`}],[`path`,{d:`M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`w4yl2u`}],[`path`,{d:`M3 5a2 2 0 0 0 2 2h3`,key:`f2jnh7`}],[`path`,{d:`M3 3v13a2 2 0 0 0 2 2h3`,key:`k8epm1`}]]),B=S(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),V=e(t(),1),H=n();function U({runId:e,path:t,artifactId:n,worktreePath:r}){let a=i(e,n?null:t),s=o(e,n),c=n?s:a,l=(0,V.useContext)(L),p=f(),m=p.pathname.replace(/\/files\/?$/,`/report`)+p.search,h=c.data,g=(0,V.useMemo)(()=>h?.type===`file`&&h.source!==`artifact`?{runId:e,...l,basePath:h.path}:null,[h,l,e]);if(!t&&!n)return(0,H.jsx)(O,{runId:e,path:null,className:`min-w-0 flex-1`});if(c.isPending)return(0,H.jsx)(`p`,{role:`status`,className:`p-4`,children:`Loading file…`});if(c.isError)return(0,H.jsxs)(`section`,{"data-slot":`file-preview`,className:`min-w-0 flex-1 rounded-lg border p-4`,children:[(0,H.jsx)(`h2`,{children:`Could not load this file`}),(0,H.jsx)(`p`,{className:`wrap-anywhere text-sm`,children:c.error.message}),(0,H.jsx)(k,{variant:`outline`,onClick:()=>void c.refetch(),children:`Retry`})]});if(!h)return(0,H.jsx)(`p`,{role:`alert`,className:`p-4`,children:`No file data was returned.`});let _=T(h.path,r,t);if(h.type!==`file`)return(0,H.jsxs)(`section`,{"data-slot":`file-preview`,className:`min-w-0 flex-1 rounded-lg border p-4`,children:[(0,H.jsx)(`h2`,{children:h.type===`unpublished`?`File not published`:`Cannot preview this file`}),(0,H.jsx)(`p`,{className:`wrap-anywhere py-2 font-mono text-xs`,children:_}),(0,H.jsx)(`p`,{className:`text-sm`,children:h.reason}),(0,H.jsx)(k,{variant:`outline`,onClick:()=>void c.refetch(),children:`Retry`})]});let v=h.artifact;return(0,H.jsx)(L.Provider,{value:g,children:(0,H.jsx)(E,{runId:e,entry:h,displayPath:_,documentPreview:!0,readerHref:m,className:`min-w-0 flex-1`,imageUrl:v?d(e,v.id,`image`):u(e,t),...v?{downloadUrl:d(e,v.id,`download`),snapshot:(0,H.jsx)(N,{iso:v.createdAt})}:{}},v?.id??h.path)})}var W=new Map;function G(e){let t=e?.filesRestoreKey;return typeof t==`string`&&t?t:null}var K=(0,V.createContext)(null);function q(){let{key:e}=f(),t=h()===`POP`,[n,r]=(0,V.useState)({key:e,generation:0});if(n.key===e)return n.generation;let i={key:e,generation:t?n.generation+1:n.generation};return r(i),i.generation}var J=()=>document.querySelector(`[data-slot="main"]`);function Y(e,t){let n=(0,V.useRef)(null),r=f(),i=h()===`POP`?r.key:G(r.state),[a]=(0,V.useState)(()=>{let t=i?W.get(i):void 0;return t?.runId===e?t:null}),o=(0,V.useRef)(new Set(a?.folders??[])),s=(0,V.useRef)(new Set),[c,l]=(0,V.useState)(0),u=(0,V.useRef)(a===null),d=(0,V.useCallback)(()=>{u.current&&W.set(r.key,{runId:e,folders:new Set(o.current),tree:n.current?.scrollTop??0,main:J()?.scrollTop??0})},[r.key,e]),p=(0,V.useMemo)(()=>({isOpen:e=>o.current.has(e),setOpen:(e,t)=>{t?o.current.add(e):o.current.delete(e),d()},loading:(e,t)=>{a?.folders.has(e)&&(t?s.current.add(e):s.current.delete(e),l(s.current.size))}}),[a,d]);return(0,V.useEffect)(()=>{if(u.current||!a||!t||s.current.size>0)return;n.current&&(n.current.scrollTop=a.tree);let e=J();e&&(e.scrollTop=a.main),u.current=!0,d()},[a,t,c,d]),(0,V.useEffect)(()=>{d();let e=[n.current,J()].filter(e=>e!==null);for(let t of e)t.addEventListener(`scroll`,d,{passive:!0});return()=>{for(let t of e)t.removeEventListener(`scroll`,d)}},[d]),{tree:n,folders:p}}function X({runId:e,selected:t,onSelect:n}){return(0,H.jsx)(`nav`,{"data-slot":`files-tree`,"aria-label":`Worktree files`,className:`min-w-0 text-[13px]`,children:(0,H.jsx)(`ul`,{className:`flex flex-col gap-px`,children:(0,H.jsx)(Z,{runId:e,path:``,depth:0,selected:t,onSelect:n})})})}function Z({runId:e,path:t,depth:n,selected:r,onSelect:i}){let a=c(e,t),o=(0,V.useContext)(K);return(0,V.useEffect)(()=>{if(!(!t||!o))return o.loading(t,a.isPending),()=>o.loading(t,!1)},[o,t,a.isPending]),a.isPending?(0,H.jsx)(`li`,{"data-slot":`files-tree-loading`,className:`px-1.5 py-1 text-xs text-soft-foreground`,style:{paddingLeft:`${6+n*14}px`},children:`Loading…`}):a.isError?(0,H.jsx)(`li`,{"data-slot":`files-tree-error`,className:`px-1.5 py-1 text-xs text-danger`,style:{paddingLeft:`${6+n*14}px`},children:a.error.message}):a.data.type===`dir`?a.data.entries.length===0?(0,H.jsx)(`li`,{"data-slot":`files-tree-empty`,className:`px-1.5 py-1 text-xs text-soft-foreground`,style:{paddingLeft:`${6+n*14}px`},children:`Empty directory`}):(0,H.jsx)(H.Fragment,{children:a.data.entries.map(a=>a.type===`dir`?(0,H.jsx)(Q,{runId:e,name:a.name,path:t===``?a.name:`${t}/${a.name}`,depth:n,selected:r,onSelect:i},a.name):(0,H.jsx)($,{name:a.name,path:t===``?a.name:`${t}/${a.name}`,size:a.size,depth:n,selected:r,onSelect:i},a.name))}):null}function Q({runId:e,name:t,path:n,depth:i,selected:a,onSelect:o}){let s=(0,V.useContext)(K),[c,l]=(0,V.useState)(()=>s?.isOpen(n)??!1);return(0,H.jsxs)(`li`,{children:[(0,H.jsxs)(`button`,{type:`button`,"data-slot":`files-dir`,"data-path":n,"data-state":c?`open`:`closed`,"aria-expanded":c,onClick:()=>{s?.setOpen(n,!c),l(!c)},className:`flex min-h-11 md:min-h-8 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+i*14}px`},children:[(0,H.jsx)(x,{size:16,"aria-hidden":`true`,className:r(`order-last ml-auto size-3.5 shrink-0 transition-transform motion-reduce:transition-none`,c&&`rotate-90`)}),(0,H.jsx)(_,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,H.jsx)(`span`,{className:`min-w-0 truncate font-normal`,children:t})]}),c?(0,H.jsx)(`ul`,{className:`flex flex-col gap-px`,children:(0,H.jsx)(Z,{runId:e,path:n,depth:i+1,selected:a,onSelect:o})}):null]})}function $({name:e,path:t,size:n,depth:i,selected:a,onSelect:o}){let s=a===t,c=D(t)?B:g;return(0,H.jsx)(`li`,{children:(0,H.jsxs)(`button`,{type:`button`,"data-slot":`files-file`,"data-path":t,"aria-current":s?`true`:void 0,onClick:()=>o(t),className:r(`flex min-h-11 md:min-h-8 w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left hover:bg-muted`,s?`bg-muted font-medium text-foreground`:`text-muted-foreground hover:text-foreground`),style:{paddingLeft:`${6+i*14}px`},children:[(0,H.jsx)(c,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,H.jsx)(`span`,{className:`min-w-0 truncate`,children:e}),n===void 0?null:(0,H.jsx)(`span`,{className:`ml-auto shrink-0 pl-2 font-mono text-xs tabular-nums text-soft-foreground`,children:w(n)})]})})}function ee(){let{id:e}=m(),t=s(e),n=q();return t.isPending?(0,H.jsx)(M,{tab:`files`}):t.isError?(0,H.jsx)(P,{tab:`files`,error:t.error}):(0,H.jsx)(R,{runId:t.data.id,children:(0,H.jsx)(ne,{run:t.data},`${t.data.id}:${n}`)})}function te(e,t,n,r){let a=i(e,r||n!==null?null:t),s=o(e,r?null:n);return r||t===null&&n===null?!0:!(n===null?a:s).isPending}function ne({run:e}){let t=c(e.id,``),n=a(e.id),[r,i]=p(),o=r.get(`path`),s=r.get(`artifact`),u=r.getAll(`path`).length>1||r.getAll(`artifact`).length>1||o!==null&&s!==null,[d,f]=(0,V.useState)(o??``);(0,V.useEffect)(()=>f(o??``),[o]);let m=(e,t)=>{let n=new URLSearchParams(r);n.delete(`path`),n.delete(`artifact`),n.set(e,t),i(n)},h=t.isError&&t.error instanceof l&&t.error.status===409,g=te(e.id,o,s,u),_=Y(e.id,!t.isPending&&g);return(0,H.jsxs)(A,{route:`task-files`,density:re(t.isError),flushPadding:!0,children:[(0,H.jsx)(C,{run:e,tab:`files`}),(0,H.jsxs)(`form`,{className:`flex min-w-0 gap-2 px-4 pt-[22px] md:px-9`,onSubmit:e=>{e.preventDefault(),d.trim()&&m(`path`,d.trim())},children:[(0,H.jsxs)(`label`,{className:`relative min-w-0 flex-1`,children:[(0,H.jsx)(v,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,H.jsx)(F,{"aria-label":`File path in the worktree`,placeholder:`Open a file by path…`,value:d,onChange:e=>f(e.target.value),className:`h-11 min-w-0 bg-card pl-10`})]}),(0,H.jsx)(k,{type:`submit`,variant:`outline`,className:`h-11 shrink-0`,disabled:!d.trim(),children:`Open file`})]}),(0,H.jsxs)(`div`,{className:`flex min-h-0 flex-col items-stretch gap-5 px-4 py-[22px] [--diff-sticky-top:1rem] md:flex-row md:items-start md:px-9`,children:[(0,H.jsxs)(`aside`,{ref:_.tree,"data-slot":`files-tree-pane`,className:`w-full shrink-0 rounded-xl border border-border bg-card p-3.5 md:sticky md:top-[var(--diff-sticky-top)] md:max-h-[calc(100dvh_-_64px_-_var(--diff-sticky-top)_-_1rem)] md:w-60 md:overflow-y-auto md:overscroll-contain lg:w-72`,children:[(0,H.jsx)(`h2`,{className:`sr-only`,children:`Worktree files`}),t.isPending?(0,H.jsx)(`p`,{"data-slot":`files-loading`,className:`py-4 text-xs`,children:`Loading files…`}):t.isError?(0,H.jsx)(j,{icon:h?(0,H.jsx)(z,{}):(0,H.jsx)(b,{size:16}),tone:h?`neutral`:`danger`,heading:`h2`,title:h?`No files to browse`:`Could not load the files`,subtitle:t.error.message}):(0,H.jsx)(K.Provider,{value:_.folders,children:(0,H.jsx)(X,{runId:e.id,selected:o,onSelect:e=>m(`path`,e)})}),(0,H.jsx)(ie,{artifacts:n,artifactId:s,onSelect:e=>m(`artifact`,e)})]}),u?(0,H.jsx)(`p`,{role:`alert`,className:`p-4`,children:`Invalid file link: choose either a path or a published artifact.`}):o!==null||s!==null||t.isSuccess?(0,H.jsx)(U,{runId:e.id,path:o,artifactId:s,worktreePath:e.worktreePath}):null]}),(0,H.jsx)(`p`,{className:`px-4 pb-6 text-xs text-muted-foreground md:px-9`,children:`Browsing files is read-only. Worktree contents may differ from your main checkout. Published files are snapshots.`})]})}function re(e){return e?`empty`:`full`}function ie({artifacts:e,artifactId:t,onSelect:n}){return(0,H.jsxs)(`section`,{className:`mt-4 border-t border-border pt-3`,"aria-label":`Published artifacts`,children:[(0,H.jsx)(`h2`,{className:`text-sm font-medium`,children:`Published artifacts`}),e.isPending?(0,H.jsx)(`p`,{className:`py-2 text-xs`,children:`Loading published files…`}):e.isError?(0,H.jsx)(`p`,{role:`alert`,className:`py-2 text-xs`,children:`Could not load published files.`}):e.data.artifacts.length===0?(0,H.jsx)(`p`,{className:`py-2 text-xs text-muted-foreground`,children:`No published files yet.`}):(0,H.jsx)(`ul`,{children:e.data.artifacts.map(e=>(0,H.jsx)(`li`,{children:(0,H.jsxs)(`button`,{type:`button`,"data-slot":`artifact-row`,"aria-current":e.id===t?`true`:void 0,className:`group flex min-h-11 w-full items-center gap-2 rounded px-2 py-2 text-left text-xs text-foreground hover:bg-muted focus-visible:ring-2 aria-[current=true]:bg-muted aria-[current=true]:font-medium`,onClick:()=>n(e.id),children:[(0,H.jsx)(I,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,H.jsx)(`span`,{className:`min-w-0 flex-1 wrap-anywhere underline-offset-2 group-hover:underline`,children:e.name}),(0,H.jsx)(x,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground group-hover:text-foreground`})]})},e.id))}),(0,H.jsxs)(k,{variant:`outline`,size:`sm`,"data-action":`refresh-artifacts`,className:`mt-2 max-md:h-11 no-hover:h-11`,onClick:()=>void e.refetch(),children:[(0,H.jsx)(y,{"aria-hidden":`true`}),`Refresh published files`]})]})}export{ee as TaskFilesRoute};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./utils-DSMR_WLb.js";import{B as i,F as a,N as o,Y as s,et as c}from"./queries-D0v1z40Y.js";import{Fn as l,ft as u,nt as d}from"./toaster-DMfiAEnw.js";import{f,g as p,h as m,m as h}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{S as g,T as _,X as v,Y as y,ot as b,u as x}from"./design-icons-CzEoMH9c.js";import{t as S}from"./createLucideIcon-BHp8sXmF.js";import{t as C}from"./run-header-ZKCViZcp.js";import{a as w,i as T,n as E,o as D,r as O}from"./file-preview-DaPUicrL.js";import{t as k}from"./button-B7MKxYjT.js";import{c as A}from"./page-shell-7pLJMOgh.js";import{t as j}from"./centered-state-V15AR_qo.js";import{C as M,Mn as N,S as P,Zn as F,or as I}from"./index-_l5gcUqA.js";import{r as L}from"./markdown-Ce-c_H3H.js";import{t as R}from"./task-file-scope-lYm3HhO-.js";var z=S(`folder-tree`,[[`path`,{d:`M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`hod4my`}],[`path`,{d:`M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`w4yl2u`}],[`path`,{d:`M3 5a2 2 0 0 0 2 2h3`,key:`f2jnh7`}],[`path`,{d:`M3 3v13a2 2 0 0 0 2 2h3`,key:`k8epm1`}]]),B=S(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),V=e(t(),1),H=n();function U({runId:e,path:t,artifactId:n,worktreePath:r}){let a=i(e,n?null:t),s=o(e,n),c=n?s:a,l=(0,V.useContext)(L),p=f(),m=p.pathname.replace(/\/files\/?$/,`/report`)+p.search,h=c.data,g=(0,V.useMemo)(()=>h?.type===`file`&&h.source!==`artifact`?{runId:e,...l,basePath:h.path}:null,[h,l,e]);if(!t&&!n)return(0,H.jsx)(O,{runId:e,path:null,className:`min-w-0 flex-1`});if(c.isPending)return(0,H.jsx)(`p`,{role:`status`,className:`p-4`,children:`Loading file…`});if(c.isError)return(0,H.jsxs)(`section`,{"data-slot":`file-preview`,className:`min-w-0 flex-1 rounded-lg border p-4`,children:[(0,H.jsx)(`h2`,{children:`Could not load this file`}),(0,H.jsx)(`p`,{className:`wrap-anywhere text-sm`,children:c.error.message}),(0,H.jsx)(k,{variant:`outline`,onClick:()=>void c.refetch(),children:`Retry`})]});if(!h)return(0,H.jsx)(`p`,{role:`alert`,className:`p-4`,children:`No file data was returned.`});let _=T(h.path,r,t);if(h.type!==`file`)return(0,H.jsxs)(`section`,{"data-slot":`file-preview`,className:`min-w-0 flex-1 rounded-lg border p-4`,children:[(0,H.jsx)(`h2`,{children:h.type===`unpublished`?`File not published`:`Cannot preview this file`}),(0,H.jsx)(`p`,{className:`wrap-anywhere py-2 font-mono text-xs`,children:_}),(0,H.jsx)(`p`,{className:`text-sm`,children:h.reason}),(0,H.jsx)(k,{variant:`outline`,onClick:()=>void c.refetch(),children:`Retry`})]});let v=h.artifact;return(0,H.jsx)(L.Provider,{value:g,children:(0,H.jsx)(E,{runId:e,entry:h,displayPath:_,documentPreview:!0,readerHref:m,className:`min-w-0 flex-1`,imageUrl:v?d(e,v.id,`image`):u(e,t),...v?{downloadUrl:d(e,v.id,`download`),snapshot:(0,H.jsx)(N,{iso:v.createdAt})}:{}},v?.id??h.path)})}var W=new Map;function G(e){let t=e?.filesRestoreKey;return typeof t==`string`&&t?t:null}var K=(0,V.createContext)(null);function q(){let{key:e}=f(),t=h()===`POP`,[n,r]=(0,V.useState)({key:e,generation:0});if(n.key===e)return n.generation;let i={key:e,generation:t?n.generation+1:n.generation};return r(i),i.generation}var J=()=>document.querySelector(`[data-slot="main"]`);function Y(e,t){let n=(0,V.useRef)(null),r=f(),i=h()===`POP`?r.key:G(r.state),[a]=(0,V.useState)(()=>{let t=i?W.get(i):void 0;return t?.runId===e?t:null}),o=(0,V.useRef)(new Set(a?.folders??[])),s=(0,V.useRef)(new Set),[c,l]=(0,V.useState)(0),u=(0,V.useRef)(a===null),d=(0,V.useCallback)(()=>{u.current&&W.set(r.key,{runId:e,folders:new Set(o.current),tree:n.current?.scrollTop??0,main:J()?.scrollTop??0})},[r.key,e]),p=(0,V.useMemo)(()=>({isOpen:e=>o.current.has(e),setOpen:(e,t)=>{t?o.current.add(e):o.current.delete(e),d()},loading:(e,t)=>{a?.folders.has(e)&&(t?s.current.add(e):s.current.delete(e),l(s.current.size))}}),[a,d]);return(0,V.useEffect)(()=>{if(u.current||!a||!t||s.current.size>0)return;n.current&&(n.current.scrollTop=a.tree);let e=J();e&&(e.scrollTop=a.main),u.current=!0,d()},[a,t,c,d]),(0,V.useEffect)(()=>{d();let e=[n.current,J()].filter(e=>e!==null);for(let t of e)t.addEventListener(`scroll`,d,{passive:!0});return()=>{for(let t of e)t.removeEventListener(`scroll`,d)}},[d]),{tree:n,folders:p}}function X({runId:e,selected:t,onSelect:n}){return(0,H.jsx)(`nav`,{"data-slot":`files-tree`,"aria-label":`Worktree files`,className:`min-w-0 text-[13px]`,children:(0,H.jsx)(`ul`,{className:`flex flex-col gap-px`,children:(0,H.jsx)(Z,{runId:e,path:``,depth:0,selected:t,onSelect:n})})})}function Z({runId:e,path:t,depth:n,selected:r,onSelect:i}){let a=c(e,t),o=(0,V.useContext)(K);return(0,V.useEffect)(()=>{if(!(!t||!o))return o.loading(t,a.isPending),()=>o.loading(t,!1)},[o,t,a.isPending]),a.isPending?(0,H.jsx)(`li`,{"data-slot":`files-tree-loading`,className:`px-1.5 py-1 text-xs text-soft-foreground`,style:{paddingLeft:`${6+n*14}px`},children:`Loading…`}):a.isError?(0,H.jsx)(`li`,{"data-slot":`files-tree-error`,className:`px-1.5 py-1 text-xs text-danger`,style:{paddingLeft:`${6+n*14}px`},children:a.error.message}):a.data.type===`dir`?a.data.entries.length===0?(0,H.jsx)(`li`,{"data-slot":`files-tree-empty`,className:`px-1.5 py-1 text-xs text-soft-foreground`,style:{paddingLeft:`${6+n*14}px`},children:`Empty directory`}):(0,H.jsx)(H.Fragment,{children:a.data.entries.map(a=>a.type===`dir`?(0,H.jsx)(Q,{runId:e,name:a.name,path:t===``?a.name:`${t}/${a.name}`,depth:n,selected:r,onSelect:i},a.name):(0,H.jsx)($,{name:a.name,path:t===``?a.name:`${t}/${a.name}`,size:a.size,depth:n,selected:r,onSelect:i},a.name))}):null}function Q({runId:e,name:t,path:n,depth:i,selected:a,onSelect:o}){let s=(0,V.useContext)(K),[c,l]=(0,V.useState)(()=>s?.isOpen(n)??!1);return(0,H.jsxs)(`li`,{children:[(0,H.jsxs)(`button`,{type:`button`,"data-slot":`files-dir`,"data-path":n,"data-state":c?`open`:`closed`,"aria-expanded":c,onClick:()=>{s?.setOpen(n,!c),l(!c)},className:`flex min-h-11 md:min-h-8 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+i*14}px`},children:[(0,H.jsx)(x,{size:16,"aria-hidden":`true`,className:r(`order-last ml-auto size-3.5 shrink-0 transition-transform motion-reduce:transition-none`,c&&`rotate-90`)}),(0,H.jsx)(_,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,H.jsx)(`span`,{className:`min-w-0 truncate font-normal`,children:t})]}),c?(0,H.jsx)(`ul`,{className:`flex flex-col gap-px`,children:(0,H.jsx)(Z,{runId:e,path:n,depth:i+1,selected:a,onSelect:o})}):null]})}function $({name:e,path:t,size:n,depth:i,selected:a,onSelect:o}){let s=a===t,c=D(t)?B:g;return(0,H.jsx)(`li`,{children:(0,H.jsxs)(`button`,{type:`button`,"data-slot":`files-file`,"data-path":t,"aria-current":s?`true`:void 0,onClick:()=>o(t),className:r(`flex min-h-11 md:min-h-8 w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left hover:bg-muted`,s?`bg-muted font-medium text-foreground`:`text-muted-foreground hover:text-foreground`),style:{paddingLeft:`${6+i*14}px`},children:[(0,H.jsx)(c,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,H.jsx)(`span`,{className:`min-w-0 truncate`,children:e}),n===void 0?null:(0,H.jsx)(`span`,{className:`ml-auto shrink-0 pl-2 font-mono text-xs tabular-nums text-soft-foreground`,children:w(n)})]})})}function ee(){let{id:e}=m(),t=s(e),n=q();return t.isPending?(0,H.jsx)(M,{tab:`files`}):t.isError?(0,H.jsx)(P,{tab:`files`,error:t.error}):(0,H.jsx)(R,{runId:t.data.id,children:(0,H.jsx)(ne,{run:t.data},`${t.data.id}:${n}`)})}function te(e,t,n,r){let a=i(e,r||n!==null?null:t),s=o(e,r?null:n);return r||t===null&&n===null?!0:!(n===null?a:s).isPending}function ne({run:e}){let t=c(e.id,``),n=a(e.id),[r,i]=p(),o=r.get(`path`),s=r.get(`artifact`),u=r.getAll(`path`).length>1||r.getAll(`artifact`).length>1||o!==null&&s!==null,[d,f]=(0,V.useState)(o??``);(0,V.useEffect)(()=>f(o??``),[o]);let m=(e,t)=>{let n=new URLSearchParams(r);n.delete(`path`),n.delete(`artifact`),n.set(e,t),i(n)},h=t.isError&&t.error instanceof l&&t.error.status===409,g=te(e.id,o,s,u),_=Y(e.id,!t.isPending&&g);return(0,H.jsxs)(A,{route:`task-files`,density:re(t.isError),flushPadding:!0,children:[(0,H.jsx)(C,{run:e,tab:`files`}),(0,H.jsxs)(`form`,{className:`flex min-w-0 gap-2 px-4 pt-[22px] md:px-9`,onSubmit:e=>{e.preventDefault(),d.trim()&&m(`path`,d.trim())},children:[(0,H.jsxs)(`label`,{className:`relative min-w-0 flex-1`,children:[(0,H.jsx)(v,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,H.jsx)(F,{"aria-label":`File path in the worktree`,placeholder:`Open a file by path…`,value:d,onChange:e=>f(e.target.value),className:`h-11 min-w-0 bg-card pl-10`})]}),(0,H.jsx)(k,{type:`submit`,variant:`outline`,className:`h-11 shrink-0`,disabled:!d.trim(),children:`Open file`})]}),(0,H.jsxs)(`div`,{className:`flex min-h-0 flex-col items-stretch gap-5 px-4 py-[22px] [--diff-sticky-top:1rem] md:flex-row md:items-start md:px-9`,children:[(0,H.jsxs)(`aside`,{ref:_.tree,"data-slot":`files-tree-pane`,className:`w-full shrink-0 rounded-xl border border-border bg-card p-3.5 md:sticky md:top-[var(--diff-sticky-top)] md:max-h-[calc(100dvh_-_64px_-_var(--diff-sticky-top)_-_1rem)] md:w-60 md:overflow-y-auto md:overscroll-contain lg:w-72`,children:[(0,H.jsx)(`h2`,{className:`sr-only`,children:`Worktree files`}),t.isPending?(0,H.jsx)(`p`,{"data-slot":`files-loading`,className:`py-4 text-xs`,children:`Loading files…`}):t.isError?(0,H.jsx)(j,{icon:h?(0,H.jsx)(z,{}):(0,H.jsx)(b,{size:16}),tone:h?`neutral`:`danger`,heading:`h2`,title:h?`No files to browse`:`Could not load the files`,subtitle:t.error.message}):(0,H.jsx)(K.Provider,{value:_.folders,children:(0,H.jsx)(X,{runId:e.id,selected:o,onSelect:e=>m(`path`,e)})}),(0,H.jsx)(ie,{artifacts:n,artifactId:s,onSelect:e=>m(`artifact`,e)})]}),u?(0,H.jsx)(`p`,{role:`alert`,className:`p-4`,children:`Invalid file link: choose either a path or a published artifact.`}):o!==null||s!==null||t.isSuccess?(0,H.jsx)(U,{runId:e.id,path:o,artifactId:s,worktreePath:e.worktreePath}):null]}),(0,H.jsx)(`p`,{className:`px-4 pb-6 text-xs text-muted-foreground md:px-9`,children:`Browsing files is read-only. Worktree contents may differ from your main checkout. Published files are snapshots.`})]})}function re(e){return e?`empty`:`full`}function ie({artifacts:e,artifactId:t,onSelect:n}){return(0,H.jsxs)(`section`,{className:`mt-4 border-t border-border pt-3`,"aria-label":`Published artifacts`,children:[(0,H.jsx)(`h2`,{className:`text-sm font-medium`,children:`Published artifacts`}),e.isPending?(0,H.jsx)(`p`,{className:`py-2 text-xs`,children:`Loading published files…`}):e.isError?(0,H.jsx)(`p`,{role:`alert`,className:`py-2 text-xs`,children:`Could not load published files.`}):e.data.artifacts.length===0?(0,H.jsx)(`p`,{className:`py-2 text-xs text-muted-foreground`,children:`No published files yet.`}):(0,H.jsx)(`ul`,{children:e.data.artifacts.map(e=>(0,H.jsx)(`li`,{children:(0,H.jsxs)(`button`,{type:`button`,"data-slot":`artifact-row`,"aria-current":e.id===t?`true`:void 0,className:`group flex min-h-11 w-full items-center gap-2 rounded px-2 py-2 text-left text-xs text-foreground hover:bg-muted focus-visible:ring-2 aria-[current=true]:bg-muted aria-[current=true]:font-medium`,onClick:()=>n(e.id),children:[(0,H.jsx)(I,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,H.jsx)(`span`,{className:`min-w-0 flex-1 wrap-anywhere underline-offset-2 group-hover:underline`,children:e.name}),(0,H.jsx)(x,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground group-hover:text-foreground`})]})},e.id))}),(0,H.jsxs)(k,{variant:`outline`,size:`sm`,"data-action":`refresh-artifacts`,className:`mt-2 max-md:h-11 no-hover:h-11`,onClick:()=>void e.refetch(),children:[(0,H.jsx)(y,{"aria-hidden":`true`}),`Refresh published files`]})]})}export{ee as TaskFilesRoute};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./react-runtime-CCIEwYL0.js";import{n as t}from"./utils-DSMR_WLb.js";import{St as n,Wt as r,Y as i,dn as a,o,r as s,xt as c,yt as l}from"./queries-D0v1z40Y.js";import{hi as u,q as d}from"./toaster-DMfiAEnw.js";import{h as f}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{_ as p,m}from"./tasks-table-B9Hu3rBi.js";import{F as h,ot as g,p as _}from"./design-icons-CzEoMH9c.js";import{t as v}from"./run-header-ZKCViZcp.js";import{t as y}from"./external-link-BE6y205O.js";import{l as b}from"./reference-chip-DXFYkdLT.js";import{t as x}from"./button-B7MKxYjT.js";import{t as S}from"./project-router-BifLGgRR.js";import{c as C}from"./page-shell-7pLJMOgh.js";import{t as w}from"./centered-state-V15AR_qo.js";import{S as T,rr as E,x as D}from"./index-_l5gcUqA.js";import{n as O,o as k,t as A}from"./use-hand-to-agent-state-BAIAj5y3.js";var j=e(),M={issue:`Issue`,pr:`Pull request`};function N({kind:e}){let{id:t}=f(),n=i(t);return n.isPending?(0,j.jsx)(D,{kind:e}):n.isError?(0,j.jsx)(T,{tab:`github-item`,error:n.error}):(0,j.jsx)(P,{run:n.data,kind:e})}function P({run:e,kind:t}){let{n:r}=f(),i=Number(r),a=c(),s=n(),u=l(),d=s.isPending||u.isPending,p=m(e,a).some(e=>e.kind===t&&e.number===i),h=o(t,i,p);return(0,j.jsxs)(C,{route:`task-github-item`,density:p?`full`:`empty`,flushPadding:!0,children:[(0,j.jsx)(v,{run:e,tab:{kind:t,number:i}}),p?(0,j.jsx)(H,{run:e,kind:t,number:i,repoBase:a,item:h}):d?(0,j.jsx)(D,{kind:t,number:i,heading:`h2`}):(0,j.jsx)(w,{icon:(0,j.jsx)(E,{size:16}),tone:`neutral`,heading:`h2`,title:`#${r} is not linked to this task`,subtitle:`Only the issues and pull requests this task references open here.`,actions:(0,j.jsx)(x,{asChild:!0,variant:`outline`,children:(0,j.jsx)(S,{to:`/tasks/${e.id}`,children:`Back to the session`})})})]})}function F(e,t){return e===`pr`&&t.data?.available===!0&&t.data.item!==null}function I(e,t,n,r){return e===`pr`?n?.[t]??r:r}function L({retry:e,kind:t,number:n}){return(0,j.jsx)(x,{variant:`outline`,disabled:e.isPending,onClick:()=>e.mutate(r.githubItem(t,n)),children:`Retry`})}function R({kind:e,number:t,error:n,retryButton:r}){return(0,j.jsx)(w,{icon:(0,j.jsx)(g,{size:16}),tone:`danger`,heading:`h2`,title:`Could not load ${M[e].toLowerCase()} #${t}`,subtitle:n.message,actions:r})}function z({run:e,kind:n,number:r,repoBase:i,reason:a,retryError:o,retryButton:s}){let c=n===`pr`?h:_,l=p(e,i).find(e=>e.kind===`PR`==(n===`pr`)&&e.number===r)?.url;return(0,j.jsx)(w,{icon:(0,j.jsx)(c,{size:16}),tone:`neutral`,heading:`h2`,title:`GitHub is unavailable`,subtitle:o?.message??a,actions:(0,j.jsxs)(j.Fragment,{children:[s,l&&t(l)?(0,j.jsx)(x,{asChild:!0,variant:`outline`,children:(0,j.jsxs)(`a`,{href:l,target:`_blank`,rel:`noopener noreferrer`,children:[`open on GitHub`,(0,j.jsx)(y,{"aria-hidden":`true`})]})}):null]})})}function B({label:e,repoBase:t}){return(0,j.jsx)(w,{icon:(0,j.jsx)(b,{}),tone:`neutral`,heading:`h2`,title:`${e} was not found in ${U(t)}`,subtitle:`It may have been deleted, or the number points at a different repository.`})}function V({kind:e,item:t,labelColors:n,checks:r}){return(0,j.jsx)(`div`,{className:`min-w-0 px-0.5 md:px-2`,children:(0,j.jsx)(k,{item:t,colors:n??{},checks:r,backLink:null,subNav:null,children:e===`issue`?(0,j.jsx)(W,{item:t},t.url):null})})}function H({run:e,kind:t,number:n,repoBase:r,item:i}){let o=u(),c=a({mutationFn:e=>d(t,n,{refresh:!0}),onSuccess:(e,t)=>o.setQueryData(t,e)}),l=F(t,i),f=s(l?[n]:[],l),p=f.data?.available?f.data.checks:void 0,m=`${M[t]} #${n}`,h=(0,j.jsx)(L,{retry:c,kind:t,number:n});if(i.isPending)return(0,j.jsx)(D,{kind:t,number:n,heading:`h2`});if(i.isError)return(0,j.jsx)(R,{kind:t,number:n,error:c.error??i.error,retryButton:h});let g=i.data;return g.available?g.item?(0,j.jsx)(V,{kind:t,item:g.item,labelColors:g.labelColors,checks:I(t,n,p,g.item.checks)}):(0,j.jsx)(B,{label:m,repoBase:r}):(0,j.jsx)(z,{run:e,kind:t,number:n,repoBase:r,reason:g.reason,retryError:c.error,retryButton:h})}function U(e){if(!e)return`this repository`;try{return new URL(e).pathname.split(`/`).filter(Boolean).slice(0,2).join(`/`)||`this repository`}catch{return`this repository`}}function W({item:e}){let t=A();return(0,j.jsx)(O,{item:e,workflows:t.workflows.data?.workflows??[],skills:t.skillList,workflow:t.workflow,onWorkflowChange:t.setWorkflow,selectedSkills:t.selectedSkills,onSkillsChange:t.setSelectedSkills,engine:t.engine,onEngineChange:t.setEngine,queuedRunId:t.queued.get(e.url)??null,onQueued:t.onQueued},e.url)}export{N as TaskGithubItemRoute};
|