@hearsay-tools/squawk 0.19.0-dev.9155 → 0.19.0-dev.9162
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/ci-wait/controller.d.ts +7 -7
- package/dist/features/reports/routes.d.ts +2 -2
- package/dist/server/activity-routes.d.ts +23 -23
- package/dist/server/project-settings-routes.d.ts +107 -107
- package/dist/server/projects-routes.d.ts +41 -41
- package/dist/server/provider-sign-in-routes.d.ts +2 -2
- package/dist/server/runner-install-routes.d.ts +10 -10
- package/dist/server/runs-routes.d.ts +311 -311
- package/dist/server/server.d.ts +1170 -1170
- package/dist/server/workspace-identity-routes.d.ts +5 -5
- package/package.json +4 -4
- package/web/dist/assets/accounts-section-m_1ntZJh.js +1 -0
- package/web/dist/assets/activity-motion-DDqgr8eF.js +1 -0
- package/web/dist/assets/activity-route-BlEZZxyI.js +1 -0
- package/web/dist/assets/agent-accounts-D_ZKAmaW.js +1 -0
- package/web/dist/assets/{agent-config-section-D8pxNy2V.js → agent-config-section-wICtFVks.js} +2 -2
- package/web/dist/assets/agent-defaults-section-BC9Ypg0g.js +1 -0
- package/web/dist/assets/{appearance-D_t3wCjY.js → appearance-fkDdWPlG.js} +1 -1
- package/web/dist/assets/{archive-on-merge-field-C63xRNFZ.js → archive-on-merge-field-B6kX09p-.js} +1 -1
- package/web/dist/assets/{ask-card-kqWOqKIc.js → ask-card-Cue5EajQ.js} +5 -5
- package/web/dist/assets/attention-BI6592lk.js +1 -0
- package/web/dist/assets/{automation-format-DB34jUyF.js → automation-format-jKMOXcHS.js} +1 -1
- package/web/dist/assets/automations-route-BfOpJjLK.js +2 -0
- package/web/dist/assets/{badge-DVxxThpb.js → badge-DAnkqD7i.js} +1 -1
- package/web/dist/assets/{button-B22ANdCY.js → button-BV_AiLj2.js} +1 -1
- package/web/dist/assets/{centered-state-BgSV4e79.js → centered-state-N8vWM_Hw.js} +1 -1
- package/web/dist/assets/{cez-idle-CdswdDRd.js → cez-idle-C0drOeLs.js} +1 -1
- package/web/dist/assets/{change-counts-wqSYI3W8.js → change-counts-BLLRvt46.js} +1 -1
- package/web/dist/assets/chunk-KS7C4IRE-BdLLx37K.js +3 -0
- package/web/dist/assets/{code-editor-GfQChdgl.js → code-editor-DZMD1guX.js} +1 -1
- package/web/dist/assets/{code-workbench-CUkiQ1pF.js → code-workbench-B0GIezrD.js} +1 -1
- package/web/dist/assets/{collapsible-Bx2vViFx.js → collapsible-D5i3hm2L.js} +1 -1
- package/web/dist/assets/{command-B2Y0By1v.js → command-4D8sPZJy.js} +1 -1
- package/web/dist/assets/{commit-list-Bjc-pQxv.js → commit-list-StLehTiQ.js} +1 -1
- package/web/dist/assets/{dialog-rpNyAWGb.js → dialog-DKr-j9S6.js} +1 -1
- package/web/dist/assets/diff-DEw-tkVq.js +3 -0
- package/web/dist/assets/{diff-controls-CaCUSyxs.js → diff-controls-CSO8HgZ0.js} +1 -1
- package/web/dist/assets/{diff-stat-Dy4uLuyP.js → diff-stat-DCO_BkZB.js} +1 -1
- package/web/dist/assets/{diff-view-4wxDvYXE.js → diff-view-BcU4Rnuo.js} +3 -3
- package/web/dist/assets/discard-changes-dialog-BEsdWdyJ.js +1 -0
- package/web/dist/assets/{dist-BSUJIXeE.js → dist-B2_vvox1.js} +1 -1
- package/web/dist/assets/dist-CCX8mhHc.js +1 -0
- package/web/dist/assets/{dist-BuF3mvCA.js → dist-ClMNSUvT.js} +1 -1
- package/web/dist/assets/{dist--f2yFdPY.js → dist-CyFJ-9Ex.js} +1 -1
- package/web/dist/assets/{dist-DudPJH39.js → dist-Du6flkGD.js} +1 -1
- package/web/dist/assets/{dropdown-menu-DjtKUK8F.js → dropdown-menu-NJZfnQCU.js} +1 -1
- package/web/dist/assets/{es2015-CUEfzDjB.js → es2015-BHonSvOU.js} +1 -1
- package/web/dist/assets/file-preview-_4nAs_Ai.js +2 -0
- package/web/dist/assets/{folder-browser-Civftk0W.js → folder-browser-CFd1U5hn.js} +1 -1
- package/web/dist/assets/{git-toolbar-CepvG0Ng.js → git-toolbar-DXnIUFi1.js} +1 -1
- package/web/dist/assets/github-g-Ykk4uE.js +1 -0
- package/web/dist/assets/{global-activity-route-DhmrWj31.js → global-activity-route-OsAvUny-.js} +2 -2
- package/web/dist/assets/highlighter-Crq-WTmN.js +3 -0
- package/web/dist/assets/host-context-DDbYAKpm.js +1 -0
- package/web/dist/assets/host-storage-B72yoDU1.js +1 -0
- package/web/dist/assets/hosts-CpDMDiQW.js +1 -0
- package/web/dist/assets/{html-report-frame-Ck76gKfA.js → html-report-frame-Bk6UkqKa.js} +1 -1
- package/web/dist/assets/{image-preview-CeEKI2T5.js → image-preview-CdL9a1Zj.js} +1 -1
- package/web/dist/assets/index-D_WkVdwL.css +1 -0
- package/web/dist/assets/index-Dp7K74Jw.js +21 -0
- package/web/dist/assets/label-CgU9vxuM.js +1 -0
- package/web/dist/assets/{live-protocol-DMhTnCmf.js → live-protocol-CNUmr-VT.js} +1 -1
- package/web/dist/assets/markdown-BB-PN03o.js +2 -0
- package/web/dist/assets/{middle-truncated-name-D41ibfXD.js → middle-truncated-name-jUQS2QzL.js} +1 -1
- package/web/dist/assets/{nav-row-styles-CgP5uNp4.js → nav-row-styles-CIedRn3A.js} +1 -1
- package/web/dist/assets/{open-in-menu-CbQWVBD0.js → open-in-menu-BI7mnPPf.js} +1 -1
- package/web/dist/assets/{option-select-BwSkbCrQ.js → option-select-Bmm4ktgQ.js} +1 -1
- package/web/dist/assets/{page-shell-BgabWJ3w.js → page-shell-BdjH5hyc.js} +1 -1
- package/web/dist/assets/{popover-CvL6hQ5c.js → popover-BQolmvDR.js} +1 -1
- package/web/dist/assets/{preferences-section-Cvh644K0.js → preferences-section-dKDCZSWD.js} +1 -1
- package/web/dist/assets/preview-EtD19mg1.js +1 -0
- package/web/dist/assets/preview-pane-connected-DBbCXW1b.js +3 -0
- package/web/dist/assets/{project-location-DR8go8oL.js → project-location-DJjcFmsE.js} +1 -1
- package/web/dist/assets/project-router-Dc6KBQsv.js +1 -0
- package/web/dist/assets/projects-section-CVFyzORg.js +1 -0
- package/web/dist/assets/{prompt-templates-section-DcxD28iA.js → prompt-templates-section-Jj1YbCwG.js} +2 -2
- package/web/dist/assets/queries-IlC9MZgh.js +1 -0
- package/web/dist/assets/{read-state-c_RNJaXO.js → read-state-BeVNfGkB.js} +1 -1
- package/web/dist/assets/{reference-chip-z7dZJVH-.js → reference-chip-BjerVjzM.js} +1 -1
- package/web/dist/assets/{remote-settings-notice-Dtaa3ovl.js → remote-settings-notice-Czl9yS5W.js} +1 -1
- package/web/dist/assets/repo-git-C9N9wa5l.js +1 -0
- package/web/dist/assets/{report-reader-mbkd2DKt.js → report-reader-Ci4sWoe1.js} +1 -1
- package/web/dist/assets/report-selection-CZ8eb9QP.js +1 -0
- package/web/dist/assets/reports-CQPRtR5G.js +1 -0
- package/web/dist/assets/{resources-section-g5XRlefz.js → resources-section-lLpdP6MD.js} +1 -1
- package/web/dist/assets/{review-notes-drafts-BdBvLP6E.js → review-notes-drafts-BjXqp0gY.js} +1 -1
- package/web/dist/assets/{review-panel-Ba8yb8Fu.js → review-panel-B4dp-Rol.js} +1 -1
- package/web/dist/assets/{review-strip-CdlMeV2i.js → review-strip-BE71YjB6.js} +1 -1
- package/web/dist/assets/{run-detail-refresh-C5qmRdgD.js → run-detail-refresh-CE0vyYYA.js} +1 -1
- package/web/dist/assets/{run-diff-BDMdnSv7.js → run-diff-ClfLRsHF.js} +3 -3
- package/web/dist/assets/run-header-DvbVw3uo.js +2 -0
- package/web/dist/assets/{select-DdH25sWT.js → select-CYo1lo6a.js} +1 -1
- package/web/dist/assets/{session-context-section-BqEdLdTv.js → session-context-section-B_NEOGby.js} +2 -2
- package/web/dist/assets/{settings-agent-picker-b4M6fQ8m.js → settings-agent-picker-DeAST7qR.js} +1 -1
- package/web/dist/assets/{settings-field-Bhh8I9fJ.js → settings-field-AyinSFR_.js} +1 -1
- package/web/dist/assets/{settings-list-detail-D3ibaYUj.js → settings-list-detail-BlEEuyae.js} +1 -1
- package/web/dist/assets/settings-save-bar-Dd3bTznK.js +1 -0
- package/web/dist/assets/{settings-shell-BUwdvhI9.js → settings-shell-Bt7NYun7.js} +1 -1
- package/web/dist/assets/sidebar-section-DdrFJBTL.js +1 -0
- package/web/dist/assets/{skills-BLkPhZO8.js → skills-DNCuhhKf.js} +1 -1
- package/web/dist/assets/status-dot-Bmn4xhch.js +1 -0
- package/web/dist/assets/{switch-CAKeV99j.js → switch-B9OfOEzC.js} +1 -1
- package/web/dist/assets/{tab-link-BKlpD9sn.js → tab-link-6TltE1jl.js} +1 -1
- package/web/dist/assets/{task-changes-Drvnew5P.js → task-changes-CdAzeh9M.js} +2 -2
- package/web/dist/assets/{task-commits-1MJHuX1i.js → task-commits-CzZJZj2x.js} +1 -1
- package/web/dist/assets/{task-file-scope-CB3L3KQl.js → task-file-scope-BuFeMG6a.js} +1 -1
- package/web/dist/assets/task-files-BFdMVAb3.js +1 -0
- package/web/dist/assets/{task-github-item-CMNk7FxR.js → task-github-item-Dv0Uflz7.js} +1 -1
- package/web/dist/assets/{task-groups-CGCnVqHE.js → task-groups-DCg4iOB9.js} +1 -1
- package/web/dist/assets/task-thread-C98mqSie.js +2 -0
- package/web/dist/assets/{textarea-vEsJAUAV.js → textarea-BGp28xFr.js} +1 -1
- package/web/dist/assets/thread-state-DqBwIoCM.js +4 -0
- package/web/dist/assets/toaster-DNnL8v10.js +4 -0
- package/web/dist/assets/{tool-display-B9NN44oU.js → tool-display-CTbToGmi.js} +1 -1
- package/web/dist/assets/use-finish-run-CFEVvqeg.js +1 -0
- package/web/dist/assets/use-hand-to-agent-state-BYN578_s.js +1 -0
- package/web/dist/assets/use-path-bases-B238cLk1.js +1 -0
- package/web/dist/assets/{use-search-params-writer-ClMScnNe.js → use-search-params-writer-DD5PEEZw.js} +1 -1
- package/web/dist/assets/use-workspace-config-save-DScW6_8J.js +1 -0
- package/web/dist/assets/{workflows-BUcx-n8J.js → workflows-IT5WTfLr.js} +3 -3
- package/web/dist/assets/{workspace-tools-dbiR1fzO.js → workspace-tools-D_opTe6D.js} +1 -1
- package/web/dist/assets/{worktrees-section-Dyb_QkSd.js → worktrees-section-B8ycJMoK.js} +4 -4
- package/web/dist/assets/zoomable-image-CULOtYYp.js +1 -0
- package/web/dist/index.html +41 -37
- package/web/dist/live-worker.js +2 -2
- package/web/dist/assets/accounts-section-BsgnDmow.js +0 -1
- package/web/dist/assets/activity-motion-Ckq9kC3I.js +0 -1
- package/web/dist/assets/activity-route-5S9WhN9U.js +0 -1
- package/web/dist/assets/agent-accounts-D_7QcFSx.js +0 -1
- package/web/dist/assets/agent-defaults-section-et5LHv9W.js +0 -1
- package/web/dist/assets/attention-DnxGjw_R.js +0 -1
- package/web/dist/assets/automations-route-B5YBpGMc.js +0 -2
- package/web/dist/assets/chunk-KS7C4IRE-Cg8l-LDN.js +0 -3
- package/web/dist/assets/diff-lwWO-At7.js +0 -3
- package/web/dist/assets/discard-changes-dialog-B3gvm7lX.js +0 -1
- package/web/dist/assets/dist-C_rn70hE.js +0 -1
- package/web/dist/assets/file-preview-98pJhZJj.js +0 -2
- package/web/dist/assets/github-4Jhl7lLG.js +0 -1
- package/web/dist/assets/highlighter-Cfo7mLVB.js +0 -3
- package/web/dist/assets/index-BK1FcZrA.css +0 -1
- package/web/dist/assets/index-DJB0lid-.js +0 -21
- package/web/dist/assets/label-feCJ3WOT.js +0 -1
- package/web/dist/assets/markdown-BAPhDASs.js +0 -2
- package/web/dist/assets/preview-pane-connected-B08ZdGux.js +0 -3
- package/web/dist/assets/project-router-j0uBi7Ep.js +0 -1
- package/web/dist/assets/projects-section-XDboHBFP.js +0 -1
- package/web/dist/assets/queries-CchoEEzj.js +0 -1
- package/web/dist/assets/repo-git-Dp9R2TuI.js +0 -1
- package/web/dist/assets/report-selection-BdGxjISG.js +0 -1
- package/web/dist/assets/reports-ya2OW-iR.js +0 -1
- package/web/dist/assets/run-header-BTRXYB4W.js +0 -2
- package/web/dist/assets/settings-save-bar-DFY_Km4X.js +0 -1
- package/web/dist/assets/sidebar-section-CcucfASN.js +0 -1
- package/web/dist/assets/status-dot-Drd4-nfa.js +0 -1
- package/web/dist/assets/task-files-B9okW1TC.js +0 -1
- package/web/dist/assets/task-thread-_2ch8BRt.js +0 -2
- package/web/dist/assets/thread-state-qNczqxZQ.js +0 -4
- package/web/dist/assets/toaster-zMN8cNZQ.js +0 -4
- package/web/dist/assets/use-finish-run-Dvm4JnAH.js +0 -1
- package/web/dist/assets/use-hand-to-agent-state-CBJvP-US.js +0 -1
- package/web/dist/assets/use-path-bases-C9yvZF5B.js +0 -1
- package/web/dist/assets/use-workspace-config-save-9jm9qV6u.js +0 -1
- package/web/dist/assets/zoomable-image-BUTgYpld.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{o as r}from"./dist-C_rn70hE.js";import{K as i,Lt as a,Ut as o,Vt as s,Yt as c,ln as l,nn as u,st as d,un as f}from"./queries-CchoEEzj.js";import{Bn as p,Cn as m,Cr as h,Fn as g,Gr as _,Hn as ee,Kr as te,Mn as v,Rn as y,ei as b,ii as x,jt as S,kn as ne,n as C,qr as re,rr as w,rt as ie,si as ae,vi as T,zn as oe}from"./toaster-zMN8cNZQ.js";import{B as E,F as D,G as se,I as O,J as ce,N as k,P as le,S as ue,T as de,W as A,Y as fe,j,z as pe}from"./live-protocol-DMhTnCmf.js";import{n as M}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{r as me}from"./run-detail-refresh-C5qmRdgD.js";import{mt as he,t as ge}from"./design-icons-QbNMZniQ.js";import{t as _e}from"./createLucideIcon-BHp8sXmF.js";import{t as ve}from"./ask-card-kqWOqKIc.js";import{t as ye}from"./arrow-right-Dh_Lx3um.js";import{t as be}from"./arrow-up-right-DKGzsMqY.js";import{t as xe}from"./bot-TkDIw4y-.js";import{t as Se}from"./external-link-BE6y205O.js";import{t as Ce}from"./info-DA1x_4bz.js";import{t as we}from"./message-square-B-MD-8rD.js";import{a as Te,o as Ee,r as De}from"./tool-display-B9NN44oU.js";import{t as N}from"./button-B22ANdCY.js";import{i as Oe,r as ke,t as Ae}from"./popover-CvL6hQ5c.js";import{t as P}from"./project-router-j0uBi7Ep.js";import"./attention-DnxGjw_R.js";import{t as F}from"./status-dot-Drd4-nfa.js";import{c as je,i as Me,l as Ne,o as Pe,r as Fe,s as Ie}from"./report-selection-BdGxjISG.js";import"./page-shell-BgabWJ3w.js";import{Nn as Le,pn as Re}from"./index-DJB0lid-.js";import{t as ze}from"./textarea-vEsJAUAV.js";import{t as Be}from"./use-finish-run-Dvm4JnAH.js";import{t as Ve}from"./review-panel-Ba8yb8Fu.js";var He=_e(`folder-kanban`,[[`path`,{d:`M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z`,key:`1fr9dc`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M12 10v2`,key:`hh53o1`}],[`path`,{d:`M16 10v6`,key:`1d6xys`}]]),I=e(t(),1),L=n(),R=fe(),z=pe().int().nonnegative(),B=A().min(1),Ue=E({title:A().max(160),toolKind:j([`read`,`edit`,`delete`,`move`,`search`,`execute`,`think`,`fetch`,`task`,`plan`,`other`]),status:j([`pending`,`running`,`completed`,`failed`,`declined`]),startedAt:R,endedAt:R.optional()}).strict(),We=j([`pass`,`fail`,`pending`,`skipping`,`cancel`]),Ge=E({checks:k(E({name:A().max(100),bucket:We}).strict()).max(100),counts:E({pass:z,fail:z,pending:z,skipping:z,cancel:z}).strict(),truncated:O(!0).optional()}).strict(),Ke=D(`kind`,[E({kind:O(`human`),since:R,detail:E({question:A().max(500).optional(),reason:j([`question`,`turn-end`,`budget`,`completion`]),queuedMessages:pe().int().positive().optional()}).strict()}).strict(),E({kind:O(`usage-limit`),detail:E({resumeAt:A()}).strict()}).strict(),E({kind:O(`workers`),since:R,deadline:R.optional(),detail:E({owed:z,total:z,settled:z,replies:O(!0).optional(),mode:ue.optional(),recipientRunIds:k(B)}).strict()}).strict(),E({kind:O(`peers`),since:R,deadline:R,detail:E({peerRunIds:k(B)}).strict()}).strict(),E({kind:O(`subagents`),since:R,deadline:R,detail:E({running:z}).strict()}).strict(),E({kind:O(`pr`),since:R,deadline:R,detail:E({number:pe().int().positive(),target:w,checks:Ge.shape.checks.optional(),counts:Ge.shape.counts.optional(),truncated:O(!0).optional()}).strict()}).strict(),E({kind:O(`process`),since:R,deadline:R,detail:E({pid:pe().int(),note:A().optional()}).strict()}).strict(),E({kind:O(`plugin`),since:R,deadline:R.optional(),detail:E({pluginKind:A().min(1).max(64),summary:A().max(256)}).strict()}).strict(),E({kind:O(`timer`),since:R,deadline:R,detail:E({wakeAt:R,note:A().optional()}).strict()}).strict()]),qe={runId:B,title:A(),status:h,rung:j(ne),runner:x.optional(),model:A().optional(),currentStepId:A().optional(),createdAt:A().optional(),startedAt:A().optional(),finishedAt:A().optional(),wait:Ke.optional(),tool:Ue.optional(),rate:k(z).length(30),error:A().max(200).optional()},Je=E({...qe,revision:z,collected:le()}).strict(),Ye=E({...qe,workers:k(Je)}).strict(),Xe=E({requestId:ce(),relationship:j([`family`,`peer`]),senderRunId:B,recipientRunId:B,text:A().max(500),senderTitle:A().optional(),recipientTitle:A().optional(),createdAt:R,deadline:R.optional()}).strict(),Ze=E({requestId:ce(),senderRunId:B,recipientRunId:B,status:de.shape.status,observedAt:R}).strict(),Qe=E({generatedAt:R,projects:k(E({projectId:A(),name:A(),loaded:le(),unavailable:E({status:se([O(404),O(409),O(503)]),error:A()}).strict().optional(),inReview:z,tasks:k(Ye),requests:k(Xe),closed:k(Ze)}).strict())}).strict();E({project:se([O(`default`),A().regex(m)]).optional()});var $e=5e3,et=e=>[`workspace`,`activity`,e.kind===`project`?e.projectId:null],tt=e=>e.kind===`project`?`activity:project:${e.projectId}`:`activity:workspace`,nt=e=>e.kind===`project`?`/api/v1/workspace/activity?project=${encodeURIComponent(e.projectId)}`:`/api/v1/workspace/activity`,rt=`the Squawk server answered /workspace/activity with an unexpected body`;function it(e){let t=Qe.safeParse(e);if(!t.success)throw new y(200,rt);return t.data}async function at(e,t){let n=e.kind===`project`?{project:e.projectId}:{};return it(await ee(await oe.api.v1.workspace.activity.$get({query:n},p(t)),`/workspace/activity`))}function ot(e,t){return e!==void 0&&Date.parse(t.generatedAt)<Date.parse(e.generatedAt)?e:t}var st=new Date(0).toISOString();function ct(e){return e!==void 0&&e!==st&&!Number.isNaN(Date.parse(e))}var lt=new Set([404,409,503]);function ut(e,t,n,r){let i=e?.projects.find(e=>e.projectId===t)?.name??t;return{generatedAt:e?.generatedAt??st,projects:[{projectId:t,name:i,loaded:!0,unavailable:{status:n,error:r},inReview:0,tasks:[],requests:[],closed:[]}]}}function dt(e,t){return new y(Number(/^HTTP (\d+)$/.exec(t)?.[1]??0),e&&typeof e==`object`&&typeof e.error==`string`?e.error:t)}var ft=(e,t)=>e.kind===`project`&<.has(t.status)?t.status:void 0;function pt(e){let t=e.kind===`project`?e.projectId:void 0,n=(0,I.useMemo)(()=>t===void 0?{kind:`workspace`}:{kind:`project`,projectId:t},[t]),r=(0,I.useMemo)(()=>et(n),[n]),i=T(),o=ae({queryKey:r,queryFn:async({signal:e})=>{let t=i.getQueryData(r);try{return ot(t,await at(n,{signal:e}))}catch(e){let r=e instanceof y?ft(n,e):void 0;if(r===void 0||n.kind!==`project`)throw e;return ut(t,n.projectId,r,e.message)}},staleTime:1/0});return(0,I.useEffect)(()=>{let e=!0,t=t=>{i.cancelQueries({queryKey:r,exact:!0}).then(()=>{if(!e)return;let a=ft(n,t);if(a!==void 0&&n.kind===`project`){i.setQueryData(r,e=>ut(e,n.projectId,a,t.message));return}let o=i.getQueryCache().find({queryKey:r,exact:!0});o?.setState({status:`error`,error:t,errorUpdatedAt:Date.now(),errorUpdateCount:o.state.errorUpdateCount+1,fetchStatus:`idle`})})},o=n=>{let a;try{a=it(n)}catch(e){t(e);return}i.cancelQueries({queryKey:r,exact:!0}).then(()=>{e&&i.setQueryData(r,e=>ot(e,a))})},c=a(tt(n),o),l=s($e),u,f=()=>{let e=_()===`finite`&&l!==!1;e&&!u?u=d({path:nt(n),intervalMs:l},(e,n)=>{n===void 0?o(e):t(dt(e,n))}):!e&&u&&(u(),u=void 0)};f();let p=re(f);return()=>{e=!1,p(),u?.(),c()}},[i,r,n]),o}var mt=e=>String(e).padStart(2,`0`);function V(e){let t=Math.max(0,Math.floor(e/1e3)),n=Math.floor(t/3600),r=Math.floor(t/60)%60,i=t%60;return n>0?`${n}:${mt(r)}:${mt(i)}`:`${r}:${mt(i)}`}function H(e){let t=Math.max(0,Math.floor(e/1e3));if(t<60)return`${t}s`;let n=Math.floor(t/60);if(n<60)return`${n}m`;let r=Math.floor(n/60);if(r>=24)return`${Math.floor(r/24)}d`;let i=n%60;return r<6&&i>0?`${r}h ${i}m`:`${r}h`}function U(e,t){let n=e===void 0?NaN:Date.parse(e);return Number.isNaN(n)?0:t-n}var ht=new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`});function W(e){let t=Date.parse(e);return Number.isNaN(t)?e:ht.format(t)}var gt=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`}),_t=new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hourCycle:`h23`});function G(e){let t=typeof e==`number`?e:Date.parse(e);return Number.isNaN(t)?String(e):`${gt.format(t)}, ${_t.format(t)} ${yt()}`}function vt(e){let t=Math.max(0,Math.floor(e/1e3));return t<60?`just now`:t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`}function yt(){return Intl.DateTimeFormat().resolvedOptions().timeZone}var bt=new Set([`queued`,`running`,`waiting`]),xt={review:`Needs review`,failed:`Failed`,done:`Done`,cancelled:`Cancelled`},St={review:`review`,failed:`failed`,done:`done`,cancelled:`cancelled`},K=e=>bt.has(e),Ct=(e,t,n=`${t}s`)=>`${e} ${e===1?t:n}`,q=e=>v(e.rung).tone,wt=(e,t=`Deadline`)=>e?`${t} ${W(e)}`:void 0;function Tt(e,t,n){return t.length===1&&t[0]!==void 0?`${e} ${n.titleOf(t[0])}`:`${e} ${Ct(t.length,`task`)}`}function Et(e,t){let n=e.tool,r={verb:`Running`,tone:q(e),icon:`tool`},i=n?.endedAt!==void 0&&U(n.endedAt,t.now)>1e4;if(n===void 0)return{...r,main:`Thinking`,...e.startedAt?{since:e.startedAt}:{}};let a=`Last tool ${H(U(n.endedAt??n.startedAt,t.now))} ago`;return i?{...r,main:`Thinking`,detail:a,since:n.endedAt??n.startedAt}:{...r,main:n.title,mono:!0,detail:a,since:n.startedAt}}function Dt(e,t){let n={verb:`Needs you`,tone:q(e),icon:`user`,...t?{since:t.since}:{}};if(t?.detail.reason===`question`)return t.detail.question?{...n,main:t.detail.question,action:`answer`}:{...n,main:`Your turn`,action:`answer`};if(t?.detail.reason===`budget`){let e=t.detail.queuedMessages;return{...n,main:e?`Automatic wakes used up · ${Ct(e,`message`)} queued`:`Automatic wakes used up`,action:`open`}}return{...n,main:`Your turn`,action:`open`}}function Ot(e){return{verb:`Needs permission`,tone:q(e),icon:`user`,main:`Approval required`,action:`open`}}function kt(e,t,n){let{owed:r,total:i,settled:a,replies:o,mode:s,recipientRunIds:c}=t.detail,l=i>0?a/i:0,u={tone:q(e),since:t.since};if(o){let e=c.length>0?Tt(`From`,c,n):`Waiting for replies`;return{...u,verb:`Waiting for reply`,icon:`reply`,main:e,...J(`detail`,wt(t.deadline,`Reply due`))}}let d=c.length>0?`${r} owed · ${a} settled`:s?`${At[s]} of ${i} · ${a} settled`:`${r} owed`;return{...u,verb:`Waiting for workers`,icon:`workers`,main:d,bar:l,...J(`detail`,wt(t.deadline))}}var At={one:`One`,any:`Any`,all:`All`};function jt(e){let t=e.detail.counts;if(t===void 0)return`PR ${e.detail.number} checks`;let n=t.pass+t.fail+t.pending;return`PR ${e.detail.number} checks · ${t.pass} of ${n} passed`}var Mt=[`fail`,`pending`,`pass`,`skipping`,`cancel`];function Nt(e){let{counts:t,checks:n=[],truncated:r}=e.detail;if(!r||t===void 0)return;let i=e=>Math.max(0,t[e]-n.filter(t=>t.bucket===e).length),a=Mt.reduce((e,t)=>e+i(t),0),o=Mt.find(e=>i(e)>0);return a>0&&o?{count:a,bucket:o}:void 0}var Pt=[[`pass`,`passed`],[`fail`,`failed`],[`pending`,`pending`],[`skipping`,`skipped`],[`cancel`,`cancelled`]];function Ft(e){let{counts:t,checks:n}=e.detail,r=e=>t?t[e]:(n??[]).filter(t=>t.bucket===e).length,i=Pt.filter(([e])=>r(e)>0).map(([e,t])=>`${r(e)} ${t}`),a=Nt(e);return a&&i.push(`+${a.count} more not listed`),i.length>0?i.join(`, `):void 0}function It(e,t){let n={tone:q(e),since:t.since,...J(`detail`,wt(t.deadline))};if(t.detail.target!==`checks`)return{...n,verb:`Waiting for merge`,icon:`merge`,main:`PR ${t.detail.number}`};let r=t.detail.checks?[...t.detail.checks].sort((e,t)=>e.name.localeCompare(t.name)):void 0;return{...n,verb:`Waiting for CI`,icon:`ci`,main:jt(t),...J(`checks`,r),...J(`overflow`,Nt(t)),...J(`checkSummary`,Ft(t))}}function J(e,t){return t===void 0?{}:{[e]:t}}function Lt(e,t,n){let r=q(e);switch(t.kind){case`workers`:return kt(e,t,n);case`peers`:return{verb:`Waiting for a peer`,tone:r,icon:`peer`,since:t.since,main:Tt(`For`,t.detail.peerRunIds,n),detail:`Deadline ${W(t.deadline)}`};case`subagents`:return{verb:`Waiting for subagents`,tone:r,icon:`subagents`,since:t.since,main:Ct(t.detail.running,`native subagent`),detail:`Deadline ${W(t.deadline)}`};case`pr`:return It(e,t);case`process`:return{verb:`Waiting for command`,tone:r,icon:`command`,since:t.since,main:t.detail.note??`Process ${t.detail.pid}`,detail:`Running ${V(U(t.since,n.now))} · deadline ${W(t.deadline)}`};case`plugin`:return{verb:`Waiting`,tone:r,icon:`timer`,since:t.since,main:t.detail.summary,...J(`detail`,wt(t.deadline))};case`timer`:return{verb:`Monitoring`,tone:r,icon:`timer`,since:t.since,main:t.detail.note??`Timer`,detail:`Wakes ${W(t.detail.wakeAt)} · in ${V(-U(t.detail.wakeAt,n.now))}`};case`usage-limit`:return Rt(e,t.detail.resumeAt,n);case`human`:return}}function Rt(e,t,n){let r=Date.parse(t),i=Number.isNaN(r)?`Resumes ${t}`:`Resumes ${W(t)} · in ${V(r-n.now)}`;return{verb:`Usage limit`,tone:q(e),icon:`pause`,main:`Paused until reset`,detail:i}}function zt(e,t){let n=e.wait&&`since`in e.wait?e.wait.since:e.startedAt;return{verb:`Queued`,tone:q(e),icon:`queued`,main:`Waiting for a free slot`,...n?{since:n,detail:`Waiting ${H(U(n,t.now))}`}:{}}}function Bt(e,t){return{verb:xt[e.status]??e.status,tone:q(e),icon:St[e.status]??`done`,main:t}}function Vt(e,t){return K(e.status)?Ht(e,t):Bt(e,Ct(e.workers.filter(e=>K(e.status)).length,`live worker`))}function Ht(e,t){let n=e.wait;switch(e.rung){case`running`:return Et(e,t);case`needs-permission`:return Ot(e);case`needs-you`:return Dt(e,n?.kind===`human`?n:void 0);case`usage-limit`:return n?.kind===`usage-limit`?Rt(e,n.detail.resumeAt,t):{verb:`Usage limit`,tone:q(e),icon:`pause`,main:`Paused until reset`};case`queued`:case`waiting-for-capacity`:return zt(e,t);default:return(n&&Lt(e,n,t))??zt(e,t)}}function Ut(e,t,n){if(n!==void 0&&K(e.status))return{verb:`Asks parent`,tone:q(e),main:`“${n}”`,asks:!0};let r=Wt(e,t);return{verb:r.verb,tone:r.tone,main:r.main,...r.mono?{mono:!0}:{}}}function Wt(e,t){switch(e.status){case`done`:return Bt(e,e.collected?`Collected`:`Ready to collect`);case`review`:return Bt(e,`Waiting for the parent’s review`);case`failed`:case`cancelled`:return Bt(e,e.error??xt[e.status]??e.status);default:return Ht({...e,workers:[]},t)}}var Gt={success:`text-semantic-green`,pending:`text-semantic-amber`,danger:`text-semantic-red`,accent:`text-accent-text`,info:`text-semantic-info`,running:`text-semantic-violet`,neutral:`text-muted-foreground`};function Kt({tone:e,className:t,children:n,...i}){return(0,L.jsx)(`span`,{...i,className:r(`bg-card-2`,{"text-semantic-green":e===`success`,"text-semantic-amber":e===`pending`,"text-semantic-red":e===`danger`,"text-accent-text":e===`accent`,"text-semantic-info":e===`info`,"text-semantic-violet":e===`running`,"text-muted-foreground":e===`neutral`},t),children:n})}var qt={success:`border-success`,pending:`border-pending-strong`,danger:`border-danger`,accent:`border-accent-strong`,info:`border-info`,running:`border-status-running`,neutral:`border-soft-foreground`},Jt={success:`bg-success`,pending:`bg-pending-strong`,danger:`bg-danger`,accent:`bg-accent-strong`,info:`bg-info`,running:`bg-status-running`,neutral:`bg-soft-foreground`};function Yt(e,t){let n=v(e.rung),r=e.rung===`waiting-on-workers`&&(t===`worker`||e.wait?.kind===`peers`);return{tone:n.tone,shape:r?`ring`:n.shape,label:Qt(e,t)??Le(e.rung,n.label)}}var Xt=(e,t,n)=>`${e} ${t} ${n}${t===1?``:`s`}`;function Zt(e){return e?.kind===`workers`&&!e.detail.replies&&e.detail.owed>0}function Qt(e,t){let n=e.wait;if(e.rung===`waiting-on-workers`){if(t===`worker`&&!Zt(n))return`Waiting for parent reply`;if(n?.kind===`peers`&&n.detail.peerRunIds.length>0)return Xt(`Waiting for`,n.detail.peerRunIds.length,`task`);if(n?.kind===`workers`&&n.detail.replies)return`Waiting for replies`;if(n?.kind===`workers`&&n.detail.owed>0)return Xt(`Waiting for`,n.detail.owed,`worker`)}if(e.rung===`waiting-on-subagents`&&n?.kind===`subagents`&&n.detail.running>0)return Xt(`Waiting for`,n.detail.running,`subagent`)}function $t(e,t){if(K(e.status))return e.rung===`running`&&t===`filled`?`activity-pulse`:t===`filled`?void 0:`activity-breathe`}function en({run:e,role:t}){let{tone:n,shape:i,label:a}=Yt(e,t);return(0,L.jsx)(`span`,{"data-activity-anchor":e.runId,className:r(`inline-flex size-[12px] shrink-0 items-center justify-center`,$t(e,i)),children:(0,L.jsx)(F,{tone:n,shape:i,role:`img`,"aria-label":a})})}var tn={pass:`bg-success`,fail:`bg-danger`,pending:`bg-pending`,skipping:`border border-soft-foreground`,cancel:`border border-soft-foreground`},nn=(e,t)=>t?`activity-check-pass`:e===`pending`?`activity-breathe-fast`:void 0;function rn({checks:e,overflow:t,passed:n,className:i}){return(0,L.jsxs)(`span`,{"data-slot":`activity-checks`,"aria-hidden":`true`,className:i??r(`col-start-2 mt-[5px] flex items-center`,e.length>40?`gap-px`:`gap-[3px]`),children:[e.map(e=>(0,L.jsx)(`i`,{"data-bucket":e.bucket,"data-passed":n.has(e.name)?`true`:void 0,title:e.name,className:r(`h-[5px] min-w-px flex-1 rounded-[2px]`,tn[e.bucket],nn(e.bucket,n.has(e.name)))},e.name)),t?(0,L.jsxs)(`span`,{"data-slot":`activity-checks-overflow`,"data-bucket":t.bucket,className:`ml-1 flex shrink-0 items-center gap-1 text-xs leading-none text-muted-foreground tabular-nums`,children:[(0,L.jsx)(`i`,{className:r(`h-[5px] w-2 rounded-[2px]`,tn[t.bucket])}),`+`,t.count]}):null]})}function an({rate:e,className:t}){let n=e.reduce((e,t)=>e+t,0),i=Math.max(4,...e);return(0,L.jsxs)(`svg`,{"data-slot":`activity-heartbeat`,role:`img`,"aria-label":`${n} tool call${n===1?``:`s`} in the last ${e.length} s`,viewBox:`0 0 62 16`,className:r(`block h-4 w-[62px] shrink-0`,t),children:[n>0?(0,L.jsx)(`path`,{d:`M0 15.5h62`,className:`stroke-border`}):null,e.map((e,t)=>{if(e<=0)return null;let n=Math.max(1.5,e/i*14);return(0,L.jsx)(`rect`,{x:t*2.07,y:15-n,width:1.4,height:n,className:`fill-status-running`},t)})]})}var on=`inline-flex min-w-0 items-center rounded-md border px-3 py-1 text-[12px] font-medium focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring max-md:min-h-11 pointer-coarse:min-h-11`;function sn({scope:e,projectId:t,projectName:n,projects:i}){let a=e=>r(on,e?`border-border bg-card text-foreground shadow-xs`:`border-transparent text-muted-foreground hover:text-foreground`);return(0,L.jsxs)(`nav`,{"aria-label":`Activity scope`,"data-slot":`activity-scope`,className:`inline-flex max-w-full flex-wrap rounded-lg border border-border bg-muted/60 p-1`,children:[(i??(t===null?[]:[{id:t,name:n??t}])).map(n=>(0,L.jsx)(M,{to:`/p/${encodeURIComponent(n.id)}/activity`,"aria-current":e===`project`&&n.id===t?`page`:void 0,className:a(e===`project`&&n.id===t),children:(0,L.jsx)(`span`,{className:`max-w-40 truncate`,title:n.name,children:n.name})},n.id)),(0,L.jsx)(M,{to:`/activity`,state:{activityProjectId:t},"aria-current":e===`all`?`page`:void 0,className:a(e===`all`),children:`All projects`})]})}function cn({grouped:e,onToggle:t}){return(0,L.jsxs)(`button`,{type:`button`,"data-slot":`activity-group-toggle`,"aria-pressed":e,onClick:t,className:r(`inline-flex h-9 items-center gap-1.5 rounded-lg border px-2.5 text-[12px] font-medium transition-colors focus-visible:outline-2 focus-visible:outline-ring max-md:min-h-11 pointer-coarse:min-h-11`,e?`border-accent-text/60 bg-accent-strong/10 text-foreground`:`border-border bg-card text-muted-foreground hover:text-foreground`),children:[(0,L.jsx)(He,{"aria-hidden":`true`,className:`size-3.5`}),(0,L.jsx)(`span`,{children:`Group by project`})]})}function ln(){let e=`flex items-center gap-2`;return(0,L.jsxs)(Ae,{children:[(0,L.jsx)(Oe,{asChild:!0,children:(0,L.jsxs)(`button`,{type:`button`,"data-slot":`activity-legend`,"aria-label":`Activity legend`,className:`inline-flex h-9 items-center gap-1.5 rounded-lg border border-border bg-card px-2.5 text-[12px] font-medium text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring max-md:min-h-11 pointer-coarse:min-h-11`,children:[(0,L.jsx)(Ce,{"aria-hidden":`true`,className:`size-3.5`}),(0,L.jsx)(`span`,{children:`Legend`})]})}),(0,L.jsx)(ke,{align:`end`,className:`w-80 text-[12px] text-muted-foreground`,children:(0,L.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,L.jsx)(`p`,{className:`text-xs font-semibold tracking-[0.05em] text-foreground uppercase`,children:`Activity legend`}),(0,L.jsxs)(`div`,{className:e,children:[(0,L.jsx)(F,{tone:`pending`,"aria-hidden":`true`}),(0,L.jsxs)(`span`,{children:[(0,L.jsx)(`strong`,{className:`text-foreground`,children:`Needs answer`}),` — waiting for your reply`]})]}),(0,L.jsxs)(`div`,{className:e,children:[(0,L.jsx)(F,{tone:`info`,"aria-hidden":`true`}),(0,L.jsxs)(`span`,{children:[(0,L.jsx)(`strong`,{className:`text-foreground`,children:`Needs review`}),` — ready for diff review or PR`]})]}),(0,L.jsxs)(`div`,{className:e,children:[(0,L.jsx)(F,{tone:`danger`,"aria-hidden":`true`}),(0,L.jsxs)(`span`,{children:[(0,L.jsx)(`strong`,{className:`text-foreground`,children:`Failed`}),` — stopped with an error`]})]}),(0,L.jsxs)(`div`,{className:e,children:[(0,L.jsx)(F,{tone:`running`,"aria-hidden":`true`}),(0,L.jsxs)(`span`,{children:[(0,L.jsx)(`strong`,{className:`text-foreground`,children:`Working`}),` — running tools right now`]})]}),(0,L.jsxs)(`div`,{className:e,children:[(0,L.jsx)(F,{tone:`info`,shape:`ring`,"aria-hidden":`true`}),(0,L.jsxs)(`span`,{children:[(0,L.jsx)(`strong`,{className:`text-foreground`,children:`Ring`}),` — waiting on CI, peer, or timer`]})]}),(0,L.jsxs)(`div`,{className:e,children:[(0,L.jsx)(F,{tone:`running`,shape:`workers`,"aria-hidden":`true`}),(0,L.jsxs)(`span`,{children:[(0,L.jsx)(`strong`,{className:`text-foreground`,children:`Robot`}),` — waiting on its own workers`]})]}),(0,L.jsxs)(`div`,{className:e,children:[(0,L.jsx)(an,{rate:[0,2,5,1,3,0,4,2],className:`w-[34px]`}),(0,L.jsx)(`span`,{children:`Heartbeat: tool calls, last 30 s`})]}),(0,L.jsxs)(`div`,{className:e,children:[(0,L.jsx)(`svg`,{"aria-hidden":`true`,viewBox:`0 0 34 10`,className:`h-2.5 w-[34px] shrink-0`,children:(0,L.jsx)(`path`,{d:`M2 5h30`,strokeWidth:2,strokeDasharray:`6 4`,className:`stroke-message-peer-accent`})}),(0,L.jsx)(`span`,{children:`Open peer request (task → task)`})]}),(0,L.jsxs)(`div`,{className:e,children:[(0,L.jsxs)(`svg`,{"aria-hidden":`true`,viewBox:`0 0 34 10`,className:`h-2.5 w-[34px] shrink-0`,children:[(0,L.jsx)(`path`,{d:`M2 5h24`,strokeWidth:2.2,strokeLinecap:`round`,strokeDasharray:`0 6`,className:`stroke-message-peer-accent opacity-80`}),(0,L.jsx)(`circle`,{cx:`29.5`,cy:`5`,r:`3`,strokeWidth:1.6,className:`fill-card stroke-message-peer-accent`})]}),(0,L.jsx)(`span`,{children:`Waiting for a peer to write`})]})]})})]})}function un({scope:e,projectId:t,projectName:n,projects:r,grouped:i,onToggleGroup:a}){return(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,L.jsx)(ln,{}),a?(0,L.jsx)(cn,{grouped:!!i,onToggle:a}):null,(0,L.jsx)(sn,{scope:e,projectId:t,projectName:n,projects:r})]})}function dn({now:e,updatedAt:t,stale:n}){let i=t!==void 0&&!Number.isNaN(Date.parse(t));return(0,L.jsxs)(`span`,{"data-slot":`activity-clock`,"data-stale":n?`true`:void 0,title:G(e),className:`inline-flex items-center gap-1.5 text-[13px] text-muted-foreground tabular-nums`,children:[(0,L.jsx)(`span`,{"data-tone":`success`,className:r(`inline-flex size-[12px] items-center justify-center`,!n&&`activity-pulse`),children:(0,L.jsx)(F,{tone:n?`neutral`:`success`,"aria-hidden":`true`})}),(0,L.jsx)(`b`,{className:r(`font-semibold`,n?`text-muted-foreground`:`text-success`),children:n?`Not updating`:`Live`}),i?(0,L.jsxs)(`span`,{children:[`· updated `,vt(U(t,e))]}):null]})}function fn({name:e,now:t,updatedAt:n,stale:r=!1,scopeSwitch:i}){return{title:`Activity`,scope:e,subtitle:t===void 0?void 0:(0,L.jsx)(dn,{now:t,updatedAt:n,stale:r}),secondaryActions:i}}function pn({primary:e=!1}){return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(N,{variant:e?`primary`:`outline`,size:`sm`,asChild:!0,className:`py-1.5`,children:(0,L.jsx)(P,{to:`/new`,children:`New task`})}),(0,L.jsx)(N,{variant:`outline`,size:`sm`,asChild:!0,className:`py-1.5`,children:(0,L.jsx)(P,{to:`/`,children:`View tasks`})})]})}function mn({value:e,bump:t}){return(0,L.jsx)(`strong`,{"data-bump":t===void 0?void 0:`true`,className:r(`font-semibold text-foreground tabular-nums`,t!==void 0&&`activity-bump`),children:e},t??`still`)}function Y({icon:e,count:t,label:n,bump:r}){return(0,L.jsxs)(`li`,{"data-slot":`activity-chip`,"data-chip":n,className:`inline-flex items-center gap-[7px] px-2 py-1 text-xs text-muted-foreground`,children:[e,(0,L.jsx)(mn,{value:t,bump:r}),` `,n]})}function hn({summary:e,tasksTo:t,bumps:n={}}){let r=e=>n[e]?.key;return(0,L.jsxs)(`ul`,{"data-slot":`activity-summary`,"aria-live":`polite`,"aria-label":`Summary`,className:`flex flex-wrap gap-2`,children:[(0,L.jsx)(Y,{icon:(0,L.jsx)(F,{tone:`pending`,"aria-hidden":`true`}),count:e.needsYou,label:`Needs you`,bump:r(`needsYou`)}),(0,L.jsx)(Y,{icon:(0,L.jsx)(F,{tone:`running`,"aria-hidden":`true`}),count:e.working,label:`Working`,bump:r(`working`)}),(0,L.jsx)(Y,{icon:(0,L.jsx)(F,{tone:`running`,shape:`ring`,"aria-hidden":`true`}),count:e.waiting,label:`Waiting`,bump:r(`waiting`)}),(0,L.jsx)(Y,{icon:(0,L.jsx)(F,{tone:`neutral`,shape:`ring`,"aria-hidden":`true`}),count:e.queued,label:`Queued`,bump:r(`queued`)}),(0,L.jsx)(Y,{icon:(0,L.jsx)(xe,{"aria-hidden":`true`,className:`size-3.5`}),count:e.activeWorkers,label:`Active workers`,bump:r(`activeWorkers`)}),(0,L.jsx)(Y,{icon:(0,L.jsx)(we,{"aria-hidden":`true`,className:`size-3.5 text-message-peer-accent`}),count:e.openRequests,label:`Open requests`,bump:r(`openRequests`)}),(0,L.jsx)(`li`,{"data-slot":`activity-chip`,"data-chip":`Needs review`,children:(0,L.jsxs)(P,{to:t,className:`inline-flex items-center gap-[7px] rounded-full border border-card-edge bg-card px-[11px] py-[5px] text-xs text-muted-foreground shadow-card transition-colors hover:border-accent-text/40 hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring max-md:min-h-11`,children:[(0,L.jsx)(F,{tone:`info`,"aria-hidden":`true`}),(0,L.jsx)(mn,{value:e.inReview,bump:r(`inReview`)}),` Needs review`,(0,L.jsx)(be,{"aria-hidden":`true`,className:`size-3 text-soft-foreground`})]})})]})}function gn(e){if(e.unavailable)return e.unavailable.error;if(!e.loaded)return`Not loaded in this cockpit`}function _n(e){let t=new Map;for(let n of e.tasks){t.set(n.runId,{title:n.title,cardId:n.runId,role:`root`});for(let e of n.workers)t.set(e.runId,{title:e.title,cardId:n.runId,role:`worker`})}return t}function X(e,t,n){return e.get(t)?.title??n??`Unreadable task`}var vn=(e,t)=>X(e,t.senderRunId,t.senderTitle),yn=(e,t)=>X(e,t.recipientRunId,t.recipientTitle),bn=(e,t)=>`wait:${e}:${t}`;function Z(e){let t=[];for(let n of e){let e=n.wait;if(!(!K(n.status)||e?.kind!==`peers`))for(let r of new Set(e.detail.peerRunIds))r!==n.runId&&t.push({id:bn(n.runId,r),waiterRunId:n.runId,peerRunId:r,since:e.since,deadline:e.deadline})}return t}function xn(e,t){let n=new Set;for(let r of t)r.waiterRunId===e&&n.add(r.peerRunId),r.peerRunId===e&&n.add(r.waiterRunId);return n}function Sn(e,t){return t.filter(t=>t.waiterRunId===e)}function Cn(e,t,n,r=[]){let i=[];for(let r of t)r.senderRunId===e&&i.push(`Waiting for a reply from ${yn(n,r)}`),r.recipientRunId===e&&i.push(`${vn(n,r)} waits for your reply`);for(let t of r)t.waiterRunId===e&&i.push(`Waiting for a message from ${X(n,t.peerRunId)}`),t.peerRunId===e&&i.push(`${X(n,t.waiterRunId)} waits for you to write`);return i}function wn(e,t,n){return n.find(n=>n.relationship===`family`&&n.senderRunId===e&&n.recipientRunId===t)}function Tn(e,t){let n=-U(e,t);return n>=1e3?`reply due in ${V(n)}`:`reply overdue`}function En(e,t){return t.filter(t=>t.relationship===`peer`&&t.senderRunId===e)}function Dn(e,t){return e.relationship===`peer`?{kind:`Request`,relation:`Peer`}:{kind:`Question`,relation:On[kn(e,t)]}}var On={worker:`Worker → parent`,parent:`Parent → worker`,unknown:`Family`};function kn(e,t){let n=t.get(e.senderRunId)?.role;if(n)return n===`worker`?`worker`:`parent`;let r=t.get(e.recipientRunId)?.role;return r?r===`root`?`worker`:`parent`:`unknown`}var An=new Set([`queued`,`waiting-for-capacity`]);function jn(e){if(K(e.status))return g(e.rung)?`needsYou`:e.rung===`running`?`working`:An.has(e.rung)?`queued`:`waiting`}function Mn(e){let t={needsYou:0,working:0,waiting:0,queued:0,activeWorkers:0,openRequests:0,inReview:0};for(let n of e){t.inReview+=n.inReview,t.openRequests+=n.requests.length;for(let e of n.tasks){let n=jn(e);n&&(t[n]+=1),t.activeWorkers+=e.workers.filter(e=>K(e.status)).length}}return t}function Nn(e,t=()=>!1){let n=0,r=0;for(let i of e.workers)t(i.runId)||((i.status===`done`||i.status===`cancelled`)&&(n+=1),i.status===`failed`&&(n+=1,r+=1));return{finished:n,failed:r}}function Pn({finished:e,failed:t}){if(e!==0)return t>0?`✓ ${e} finished · ${t} failed`:`✓ ${e} worker${e===1?``:`s`} finished`}var Q={flash:1300,cardEnter:700,cardLeave:500,workerEnter:700,workerHold:3e3,workerFold:500,comet:1100,replied:900,fade:800,bump:500,slide:450,check:800},$={flash:{},entering:{},leaving:{},workerEnter:{},workerHold:{},opening:{},closing:{},waitsClosing:{},comets:{},bumps:{},slides:{},checks:{}},Fn=(e,t)=>`${e}\n${t}`;function In(e,t){let n=Fn(t,``);return new Set(Object.keys(e.checks).filter(e=>e.startsWith(n)).map(e=>e.slice(n.length)))}var Ln=class{key;changes=[];timers=[];constructor(e){this.key=e}timed(e,t,n,r){this.changes.push({field:e,id:t,value:{...n,key:this.key}}),this.timers.push({after:r,change:{field:e,id:t,ifKey:this.key}})}later(e,t,n,r){this.timers.push({after:r,change:{field:e,id:t,value:{...n,key:this.key},ifKey:this.key}})}drop(e,t){this.changes.push({field:e,id:t})}},Rn={done:`success`,review:`success`,failed:`danger`,cancelled:`neutral`};function zn(e,t){let n=Rn[t.status]??`success`;if(t.status===`review`){e.timed(`workerHold`,t.runId,{tone:n,phase:`flash`},Q.flash);return}e.timed(`workerHold`,t.runId,{tone:n,phase:`flash`},Q.workerHold+Q.workerFold),e.later(`workerHold`,t.runId,{tone:n,phase:`fold`},Q.workerHold)}function Bn(e,t){e.drop(`closing`,t.requestId),e.timed(`opening`,t.requestId,{},Q.fade),e.timed(`comets`,`${t.requestId}:open:${e.key}`,{requestId:t.requestId,reverse:!1,tone:t.relationship},Q.comet)}function Vn(e,t,n,r){let i=n.requestId;if(e.drop(`opening`,i),!r){e.timed(`closing`,i,{projectId:t,request:n,replied:!1,phase:`fade`},Q.fade);return}let a=Q.comet+Q.replied+Q.fade;e.timed(`closing`,i,{projectId:t,request:n,replied:!0,phase:`reply`},a),e.later(`closing`,i,{projectId:t,request:n,replied:!0,phase:`replied`},Q.comet),e.later(`closing`,i,{projectId:t,request:n,replied:!0,phase:`fade`},Q.comet+Q.replied),e.timed(`comets`,`${i}:reply:${e.key}`,{requestId:i,reverse:!0,tone:`success`},Q.comet)}function Hn(e,t){switch(t.kind){case`rung-changed`:return e.timed(`flash`,t.task.runId,{tone:v(t.task.rung).tone},Q.flash);case`tool-started`:return e.timed(`slides`,t.runId,{},Q.slide);case`worker-started`:return e.timed(`workerEnter`,t.worker.runId,{},Q.workerEnter);case`worker-settled`:return zn(e,t.worker);case`card-entered`:return e.drop(`leaving`,t.task.runId),e.timed(`entering`,t.task.runId,{},Q.cardEnter);case`card-left`:return e.timed(`leaving`,t.task.runId,{projectId:t.projectId,task:t.task},Q.cardLeave);case`check-passed`:return e.timed(`checks`,Fn(t.runId,t.name),{},Q.check);case`request-opened`:return Bn(e,t.request);case`request-closed`:return Vn(e,t.projectId,t.request,t.status===`replied`);case`chip-changed`:return e.timed(`bumps`,t.chip,{},Q.bump);case`wait-opened`:return e.drop(`waitsClosing`,t.wait.id),e.timed(`opening`,t.wait.id,{},Q.fade);case`wait-closed`:return e.drop(`opening`,t.wait.id),e.timed(`waitsClosing`,t.wait.id,{projectId:t.projectId,wait:t.wait},Q.fade)}}function Un(e,t,n){let r=new Ln(t);if(!n)for(let t of e)Hn(r,t);return{changes:r.changes,timers:r.timers}}function Wn(e,t){let n=e[t.field];if(t.ifKey!==void 0&&n[t.id]?.key!==t.ifKey||t.value===void 0&&!(t.id in n))return e;let r={...n};return t.value===void 0?delete r[t.id]:r[t.id]=t.value,{...e,[t.field]:r}}function Gn(e,t){return t.reduce(Wn,e)}function Kn(e,t,n){let r=new Set(t.map(e=>e.id));return Object.values(n.waitsClosing).filter(t=>t.projectId===e&&!r.has(t.wait.id)).map(e=>e.wait)}function qn({runId:e,requests:t,waits:n,index:r,link:i,pathOf:a,className:o,linkClassName:s}){let c=En(e,t),l=Sn(e,n);return c.length===0&&l.length===0?null:(0,L.jsxs)(`ul`,{"data-slot":`activity-peer-links`,className:o,children:[c.map(e=>(0,L.jsx)(`li`,{children:(0,L.jsxs)(i,{to:a(e.recipientRunId),className:s,children:[`→ `,yn(r,e)]})},e.requestId)),l.map(e=>(0,L.jsx)(`li`,{children:(0,L.jsxs)(i,{to:a(e.peerRunId),className:s,children:[`⋯ waits on `,X(r,e.peerRunId)]})},e.id))]})}var Jn=e=>`/tasks/${encodeURIComponent(e)}`;function Yn({texts:e}){return e.length===0?null:(0,L.jsx)(`ul`,{"data-slot":`activity-line-text`,className:`sr-only`,children:e.map((e,t)=>(0,L.jsx)(`li`,{children:e},t))})}var Xn={compact:{base:`relative flex flex-wrap items-center gap-x-2 gap-y-0.5 rounded-md px-2 py-1 text-[12px] text-muted-foreground`,asks:`border-l-2 border-dashed border-message-inbound-accent bg-message-inbound-bg`,shape:void 0,title:`min-w-0 truncate text-[12px] font-medium text-foreground`,line:`truncate text-xs text-muted-foreground tabular-nums`,main:`text-foreground`},card:{base:`relative grid grid-cols-[14px_minmax(0,1fr)] items-start gap-x-2 rounded-lg py-[5px] before:absolute before:top-[13px] before:-left-3.5 before:w-2.5 before:border-t before:border-border`,asks:`-mx-1.5 bg-message-inbound-bg px-1.5`,shape:`mt-[3px]`,title:`min-w-0 truncate text-[12.5px] font-medium text-foreground`,line:`col-start-2 truncate text-xs text-muted-foreground tabular-nums`,main:void 0}};function Zn({to:e,title:t,global:n}){let r=`relative z-[1] hover:underline focus-visible:outline-2 focus-visible:outline-ring max-md:inline-flex max-md:min-h-11 max-md:items-center`;return n?(0,L.jsx)(M,{to:e,className:r,children:t}):(0,L.jsx)(P,{to:e,className:r,children:t})}function Qn({worker:e,parentId:t,requests:n,index:i,ctx:a,motion:o,href:s,global:l=!1,compact:d=!1}){let f=Ut(e,a,wn(e.runId,t,n)?.text),p=o.workerHold[e.runId],m=u().data,h=d?Xn.compact:Xn.card,g=[e.runner?c(m,e.runner):void 0,e.model].filter(Boolean).join(` · `);return(0,L.jsxs)(`li`,{"data-slot":`activity-worker`,"data-run":e.runId,"data-asks":f.asks?`true`:void 0,"data-hold":p?.phase,className:r(h.base,f.asks&&h.asks,e.runId in o.workerEnter&&`activity-row-enter`,p?.phase===`fold`&&`activity-row-fold`),children:[p?(0,L.jsx)(`span`,{"aria-hidden":`true`,className:r(`activity-row-flash`,Jt[p.tone])},p.key):null,(0,L.jsx)(`span`,{className:h.shape,children:(0,L.jsx)(en,{run:e,role:`worker`})}),(0,L.jsxs)(`span`,{className:h.title,children:[(0,L.jsx)(Zn,{to:s??Jn(e.runId),title:e.title,global:l}),g?(0,L.jsx)(`span`,{className:`ml-1.5 text-xs font-normal text-muted-foreground`,children:g}):null]}),(0,L.jsxs)(`span`,{"data-slot":`activity-worker-line`,className:h.line,children:[(0,L.jsx)(`b`,{className:r(`font-semibold`,Gt[f.tone]),children:f.verb}),` · `,(0,L.jsx)(`span`,{className:r(h.main,f.mono&&`font-mono`),children:f.main})]}),(0,L.jsx)(Yn,{texts:Cn(e.runId,n,i)})]})}function $n({workers:e}){return(0,L.jsxs)(`div`,{"data-slot":`activity-worker-dots`,className:`mt-2 ml-[18px] flex flex-wrap items-center gap-1 text-xs text-muted-foreground`,children:[e.map(e=>(0,L.jsx)(en,{run:e,role:`worker`},e.runId)),(0,L.jsxs)(`span`,{className:`ml-1`,children:[e.length,` worker`,e.length===1?``:`s`]})]})}function er({task:e,requests:t,index:n,ctx:r,dense:i=!1,motion:a,projectId:o,global:s=!1,compact:c=!1}){let l=e=>e in a.workerHold,u=e.workers.filter(e=>K(e.status)||e.status===`review`||l(e.runId)),d=Pn(Nn(e,l));if(u.length===0&&!d)return null;let f=e=>s&&o?`/p/${encodeURIComponent(o)}/tasks/${encodeURIComponent(e)}`:Jn(e);return c?(0,L.jsxs)(`div`,{className:`ml-4 border-l border-border pl-3`,children:[u.length>0?(0,L.jsx)(`ul`,{"data-slot":`activity-workers`,className:`flex flex-col gap-0.5`,children:u.map(i=>(0,L.jsx)(Qn,{worker:i,parentId:e.runId,requests:t,index:n,ctx:r,motion:a,href:f(i.runId),global:s,compact:!0},i.runId))}):null,d?(0,L.jsx)(`p`,{"data-slot":`activity-finished`,className:`mt-1 px-2 text-xs text-muted-foreground`,children:d}):null]}):(0,L.jsxs)(L.Fragment,{children:[u.length>0&&i?(0,L.jsx)($n,{workers:u}):null,u.length>0&&!i?(0,L.jsx)(`ul`,{"data-slot":`activity-workers`,className:`mt-2 ml-1 border-l border-border pl-3.5`,children:u.map(i=>(0,L.jsx)(Qn,{worker:i,parentId:e.runId,requests:t,index:n,ctx:r,motion:a},i.runId))}):null,d?(0,L.jsx)(`p`,{"data-slot":`activity-finished`,className:`mt-1.5 ml-[18px] text-xs text-muted-foreground`,children:d}):null]})}function tr(e,t){return t?{onPointerEnter:()=>t(`pointer`,e),onPointerLeave:()=>t(`pointer`,void 0),onFocus:()=>t(`focus`,e),onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||t(`focus`,void 0)}}:{}}function nr({task:e,motion:t,glow:n}){let i=t.flash[e.runId];return(0,L.jsxs)(L.Fragment,{children:[n?(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`activity-glow`}):null,i?(0,L.jsx)(`span`,{"data-slot":`activity-flash`,"data-tone":i.tone,"aria-hidden":`true`,className:r(`activity-flash`,qt[i.tone])},i.key):null]})}var rr=e=>/(auto|scroll|hidden|clip)/.test(getComputedStyle(e).overflowY);function ir(e){let t=[];for(let n=e.parentElement;n&&n!==document.body&&n!==document.documentElement;n=n.parentElement)rr(n)&&t.push(n);return t}var ar=e=>({requestId:e.id,senderRunId:e.peerRunId,recipientRunId:e.waiterRunId});function or({frame:e,cancel:t,draw:n}){let r=[],i,a=t=>{i=void 0,r=r.map(e=>({...e,start:e.start??t})).filter(e=>t<e.start+e.duration),n(r,t),r.length>0&&(i=e(a))};return{launch(t){r.some(e=>e.id===t.id)||(r.push(t),i===void 0&&(i=e(a)))},stop(){i!==void 0&&t(i),i=void 0,r=[],n([],0)},running:()=>i!==void 0}}var sr=e=>e<.5?2*e*e:1-(-2*e+2)**2/2;function cr(e,t,n=0){let r=Math.min(1,Math.max(0,(t-e.start)/e.duration)),i=Math.max(0,sr(r)-n);return e.reverse?1-i:i}var lr=`http://www.w3.org/2000/svg`,ur=[0,.03,.06,.09,.12],dr=[4.5,3.5,3,2.5,2],fr={peer:`fill-message-peer-accent`,family:`fill-message-inbound-accent`,success:`fill-success`};function pr(e,t){let n=e.querySelector(`g[data-comet="${CSS.escape(t.id)}"]`);if(n)return n;let r=document.createElementNS(lr,`g`);r.setAttribute(`data-comet`,t.id);let i=document.createElementNS(lr,`circle`);return i.setAttribute(`r`,`9`),i.setAttribute(`class`,`${fr[t.tone]} opacity-35`),r.append(i),ur.forEach((e,n)=>{let i=document.createElementNS(lr,`circle`);i.setAttribute(`r`,String(dr[n])),i.setAttribute(`class`,n===0?`fill-foreground`:fr[t.tone]),i.setAttribute(`opacity`,String(1-n*.15)),r.append(i)}),e.append(r),r}function mr(e,t,n){let r=new Set(t.map(e=>e.id));for(let t of e.querySelectorAll(`g[data-comet]`))r.has(t.getAttribute(`data-comet`)??``)||t.remove();let i=e.ownerSVGElement;for(let r of t){let t=i?.querySelector(`path[data-request="${CSS.escape(r.requestId)}"]`);if(!t||typeof t.getTotalLength!=`function`)continue;let a=t.getTotalLength();pr(e,r).querySelectorAll(`circle`).forEach((e,i)=>{let o=t.getPointAtLength(cr(r,n,ur[Math.max(0,i-1)])*a);e.setAttribute(`transform`,`translate(${o.x} ${o.y})`)})}}var hr=e=>typeof requestAnimationFrame==`function`?requestAnimationFrame(e):setTimeout(()=>e(performance.now()),16),gr=e=>typeof cancelAnimationFrame==`function`?cancelAnimationFrame(e):clearTimeout(e);function _r(e,t,n){let r=I.useRef(null),i=I.useRef(void 0),a=I.useRef(new Set);return I.useEffect(()=>{let e=r.current;if(!e)return;let t=or({frame:hr,cancel:gr,draw:(t,n)=>mr(e,t,n)});return i.current=t,()=>{t.stop(),i.current=void 0}},[]),I.useEffect(()=>{if(n){i.current?.stop();return}for(let t of a.current)t in e||a.current.delete(t);for(let[n,r]of Object.entries(e))a.current.has(n)||!t.has(r.requestId)||(a.current.add(n),i.current?.launch({id:n,requestId:r.requestId,reverse:r.reverse,tone:r.tone,duration:Q.comet}))},[e,t,n]),r}var vr=`activity-layout-settled`;function yr(e,t,n,r,i,a=!1){let[o,s]=I.useState([]);return I.useLayoutEffect(()=>{let i=e.current?.parentElement;if(!i)return;let o=()=>{let e=t(i);s(t=>n(t,e)?t:e)};o();let c=a?br(i,o):void 0;i.addEventListener(vr,o);let l=typeof ResizeObserver>`u`?void 0:new ResizeObserver(o);l?.observe(i);for(let e of i.querySelectorAll(r))l?.observe(e);return()=>{l?.disconnect(),i.removeEventListener(vr,o),c?.()}},[e,t,n,r,i,a]),o}function br(e,t){let n,r=()=>{n===void 0&&(n=requestAnimationFrame(()=>{n=void 0,t()}))},i=[...ir(e),window];for(let e of i)e.addEventListener(`scroll`,r,{passive:!0});return window.addEventListener(`resize`,r),()=>{for(let e of i)e.removeEventListener(`scroll`,r);window.removeEventListener(`resize`,r),n!==void 0&&cancelAnimationFrame(n)}}function xr(e,t){if(e.deadline!==void 0)return Sr(e.createdAt,e.deadline,t)}function Sr(e,t,n){let r=Date.parse(e),i=Date.parse(t);return Number.isNaN(r)||Number.isNaN(i)||i<=r?1:Math.min(1,Math.max(0,(n-r)/(i-r)))}function Cr(e,t){if(e===`fade`)return`activity-line-out`;if(e!==`replied`)return r(`activity-march`,t&&`activity-line-in`)}function wr(e,t){return t in e.waitsClosing?`activity-line-out`:r(`activity-drift`,t in e.opening&&`activity-line-in`)}var Tr=(e,t)=>e.closing[t]?.phase??`open`;function Er(e,t){let n=e.closing[t];return n!==void 0&&n.replied&&n.phase!==`reply`}function Dr({id:e}){return(0,L.jsx)(`marker`,{id:e,viewBox:`0 0 12 12`,refX:`10`,refY:`6`,markerWidth:`5`,markerHeight:`5`,markerUnits:`strokeWidth`,orient:`auto`,children:(0,L.jsx)(`circle`,{cx:`6`,cy:`6`,r:`4`,strokeWidth:`2.4`,className:`fill-background stroke-message-peer-accent`})})}function Or(e,t){let n=new Map;for(let r of[...e?.projects??[],...t.projects])for(let[e,t]of _n(r))n.set(e,t);return n}var kr={"timed-out":`timed out`,cancelled:`was cancelled`,destroyed:`closed: the recipient was destroyed`,failed:`closed: the recipient failed`,"completed-without-reply":`closed without a reply`,"sender-closed":`was closed by its sender`,"human-fallback":`went to a human`,deleted:`closed: the recipient was deleted`};function Ar(e,t,n){let r=n(e.senderRunId,e.senderTitle),i=n(e.recipientRunId,e.recipientTitle);return t===`replied`?`${i} replied to ${r}`:`${r}’s request to ${i} ${kr[t??``]??`closed`}`}var jr={done:{tone:`success`,word:`finished`},failed:{tone:`danger`,word:`failed`},cancelled:{tone:`neutral`,word:`was cancelled`},review:{tone:`info`,word:`waits for review`}},Mr=e=>e.relationship===`peer`?`peer`:`family`;function Nr(e,t,n){let r=(e,n)=>X(t,e,n);switch(e.kind){case`request-opened`:return{tone:Mr(e.request),text:`${r(e.request.senderRunId,e.request.senderTitle)} asked ${r(e.request.recipientRunId,e.request.recipientTitle)}`};case`request-closed`:return{tone:e.status===`replied`?`success`:`neutral`,text:Ar(e.request,e.status,r)};case`rung-changed`:return{tone:v(e.task.rung).tone,text:`${e.task.title}: ${Vt(e.task,{now:n,titleOf:e=>r(e)}).verb}`};case`worker-started`:return{tone:`running`,text:`${e.worker.title} started`};case`worker-settled`:{let t=jr[e.worker.status]??{tone:`neutral`,word:`settled`};return{tone:t.tone,text:`${e.worker.title} ${t.word}`}}case`card-entered`:return{tone:v(e.task.rung).tone,text:`${e.task.title} started`};case`card-left`:return{tone:`neutral`,text:`${e.task.title} left active work`};case`check-passed`:return{tone:`success`,text:`PR ${e.pr}: check “${e.name}” passed`};default:return}}function Pr(e,t,n,r){return[...t.map((e,t)=>({...e,id:r+t,at:n})),...e].slice(0,6)}function Fr(e){return Math.max(0,Math.floor(e/1e3))<5?`now`:H(e)}var Ir=`rounded-xl border border-card-edge bg-card px-3.5 py-3 shadow-card`,Lr=`mb-2 flex gap-2 text-xs font-semibold tracking-[0.06em] text-muted-foreground uppercase`;function Rr({request:e,index:t,now:n,motion:i}){let{kind:a,relation:o}=Dn(e,t),s=xr(e,n),c=e.relationship===`peer`?`text-message-peer-accent`:`text-message-inbound-accent`;return(0,L.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,L.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[12px] font-medium`,children:[(0,L.jsx)(`span`,{className:`min-w-0 truncate`,children:vn(t,e)}),(0,L.jsx)(ye,{"aria-label":`to`,className:`size-3 shrink-0 text-muted-foreground`}),(0,L.jsx)(`span`,{className:`min-w-0 truncate`,children:yn(t,e)}),(0,L.jsx)(`span`,{className:r(`ml-auto shrink-0 text-xs font-semibold tracking-[0.05em] uppercase`,c),children:a})]}),(0,L.jsxs)(`p`,{className:`my-1 line-clamp-3 text-[12px] text-muted-foreground`,children:[`“`,e.text,`”`]}),(0,L.jsxs)(`div`,{className:`flex gap-1.5 text-xs text-muted-foreground tabular-nums`,children:[(0,L.jsxs)(`span`,{children:[o,` · open `,V(U(e.createdAt,n))]}),e.deadline?(0,L.jsx)(`span`,{className:`ml-auto`,children:Tn(e.deadline,n)}):null]}),s===void 0?null:(0,L.jsx)(`div`,{"aria-hidden":`true`,className:`mt-1.5 h-[3px] overflow-hidden rounded-sm bg-border`,children:(0,L.jsx)(`span`,{className:r(`block h-full bg-current`,c),style:{width:`${Math.round(s*100)}%`}})})]})}var zr={...Jt,peer:`bg-message-peer-accent`,family:`bg-message-inbound-accent`};function Br({feed:e,now:t}){return(0,L.jsxs)(`section`,{"data-slot":`activity-just-now`,className:Ir,children:[(0,L.jsx)(`h2`,{className:Lr,children:`Just now`}),(0,L.jsx)(`ul`,{"data-slot":`activity-feed`,children:e.map((e,n)=>(0,L.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,L.jsx)(`span`,{"aria-hidden":`true`,className:r(`size-[7px] -translate-y-px rounded-full`,zr[e.tone])}),(0,L.jsx)(`span`,{className:`min-w-0`,children:e.text}),(0,L.jsx)(`span`,{"data-slot":`activity-feed-age`,className:`text-xs tabular-nums`,children:Fr(t-e.at)})]},e.id))})]})}function Vr({requests:e,closing:t=[],index:n,now:i,feed:a=[],motion:o=$,columnGap:s}){let c=e.length>0||t.length>0,l=a.length>0;return!c&&!l?null:(0,L.jsxs)(`aside`,{"data-slot":`activity-rail`,"aria-label":`Activity details`,style:s===void 0?void 0:{columnGap:s},className:r(`grid min-w-0 grid-cols-[minmax(0,1fr)] content-start items-start gap-4`,c&&l&&`md:grid-cols-2`),children:[c?(0,L.jsxs)(`section`,{"data-slot":`activity-open-requests`,className:Ir,children:[(0,L.jsxs)(`h2`,{className:Lr,children:[`Open requests `,(0,L.jsx)(`b`,{className:`text-foreground`,children:e.length})]}),(0,L.jsxs)(`ul`,{children:[e.map(e=>(0,L.jsx)(Rr,{request:e,index:n,now:i,motion:e.requestId in o.opening?`enter`:void 0},e.requestId)),t.map(e=>(0,L.jsx)(Rr,{request:e,index:n,now:i,motion:`fold`},e.requestId))]})]}):null,l?(0,L.jsx)(Br,{feed:a,now:i}):null]})}var Hr=new Set;function Ur(e){let[t,n]=I.useState({}),r=t.pointer??t.focus,i=I.useCallback((e,t)=>n(n=>n[e]===t?n:{...n,[e]:t}),[]);return{linked:I.useMemo(()=>r===void 0?Hr:xn(r,e),[r,e]),active:I.useMemo(()=>r===void 0?Hr:new Set(e.filter(e=>e.waiterRunId===r||e.peerRunId===r).map(e=>e.id)),[r,e]),onHover:i}}function Wr(e,t,n=Z(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:Kn(e.projectId,n,t),folding:a.filter(e=>e.phase===`reply`||!e.replied).map(e=>e.request)}}var Gr=36,Kr=22,qr=4,Jr=10;function Yr(e,t,n,r=$){let i=[],a=(e,t)=>{let r=n.get(e);return r!==void 0&&r===n.get(t)};for(let t of e){if(t.relationship!==`peer`||!a(t.senderRunId,t.recipientRunId))continue;let e=r.closing[t.requestId];i.push({kind:`request`,id:t.requestId,from:t.senderRunId,to:t.recipientRunId,createdAt:t.createdAt,...e?{closing:!0,replied:e.replied}:{}})}for(let e of t)a(e.peerRunId,e.waiterRunId)&&i.push({kind:`wait`,id:e.id,from:e.peerRunId,to:e.waiterRunId,since:e.since,...e.id in r.waitsClosing?{closing:!0}:{}});if(i.length===0)return{edges:i,gutterWidth:0};let o=Math.min(qr,i.length);return{edges:i,gutterWidth:Math.min(132,64+(o-1)*Kr)}}function Xr(e,t,n){let r=new Set;if(!e)return r;for(let n of t)n.relationship===`peer`&&(n.senderRunId===e||n.recipientRunId===e)&&(r.add(n.senderRunId),r.add(n.recipientRunId));for(let t of n)(t.peerRunId===e||t.waiterRunId===e)&&(r.add(t.peerRunId),r.add(t.waiterRunId));return r}function Zr(e,t){return e.map(e=>{let n=t.get(e.from),r=t.get(e.to);if(!(!n||!r))return{edge:e,start:n,end:r,span:Math.abs(r.y-n.y)}}).filter(e=>e!==void 0).sort((e,t)=>e.span-t.span).map(({edge:e,start:t,end:n},r)=>{let i=r%qr,a=Math.max(10,Math.min(t.x,n.x)-Gr-i*Kr),o=n.y-t.y,s=o>=0?1:-1,c=Math.min(Jr,Math.abs(o)/2,Math.max(2,t.x-a-2)),l=e.kind===`request`?n.x-2:n.x-6;return{edge:e,path:[`M ${t.x} ${t.y}`,`L ${a+c} ${t.y}`,`Q ${a} ${t.y} ${a} ${t.y+s*c}`,`L ${a} ${n.y-s*c}`,`Q ${a} ${n.y} ${a+c} ${n.y}`,`L ${l} ${n.y}`].join(` `),laneX:a,labelY:t.y+o*(.5+(r%2==0?-.06:.08)),endX:n.x-4,endY:n.y}})}function Qr(e){let t=new Map,n=e.getBoundingClientRect();for(let r of e.querySelectorAll(`[data-activity-row]`)){let e=r.getAttribute(`data-activity-row`);if(!e)continue;let i=r.getBoundingClientRect();t.set(e,{x:i.left-n.left,y:i.top-n.top+Math.min(i.height/2,24)})}return t}function $r({stage:e,edges:t,active:n,now:i,layoutKey:a,motion:o=$,paused:s=!1}){let c=I.useId(),[l,u]=I.useState([]);I.useLayoutEffect(()=>{if(!e||t.length===0){u([]);return}let n=()=>u(Zr(t,Qr(e)));if(n(),typeof ResizeObserver>`u`)return;let r=new ResizeObserver(n);return r.observe(e),()=>r.disconnect()},[e,t,a]);let d=I.useMemo(()=>new Set(l.filter(e=>e.edge.kind===`request`).map(e=>e.edge.id)),[l]),f=_r(o.comets,d,s);return(0,L.jsxs)(`div`,{"data-slot":`activity-margin-arcs`,"aria-hidden":`true`,className:r(`pointer-events-none absolute inset-0 z-[5] hidden overflow-visible`,t.length>0&&`md:block`),children:[(0,L.jsxs)(`svg`,{className:`size-full overflow-visible`,children:[(0,L.jsx)(`defs`,{children:(0,L.jsx)(`marker`,{id:c,viewBox:`0 0 8 8`,refX:`7`,refY:`4`,markerWidth:`6`,markerHeight:`6`,orient:`auto`,children:(0,L.jsx)(`path`,{d:`M0 1 L7 4 L0 7 z`,className:`fill-message-peer-accent`})})}),l.map(e=>{let{edge:t}=e,i=n!==void 0&&(t.from===n||t.to===n),a=n!==void 0&&!i,o=t.kind===`request`?r(`fill-none stroke-message-peer-accent transition-opacity`,!t.closing&&`activity-march`,t.closing&&`activity-line-out`):r(`fill-none stroke-message-peer-accent transition-opacity`,!t.closing&&`activity-drift`,t.closing&&`activity-line-out`);return(0,L.jsxs)(`g`,{opacity:a?.22:i?1:.82,children:[(0,L.jsx)(`path`,{d:e.path,"data-request":t.kind===`request`?t.id:void 0,"data-wait":t.kind===`wait`?t.id:void 0,strokeWidth:i?2.4:1.8,strokeDasharray:t.kind===`request`?t.replied?void 0:`6 4`:`0 7`,strokeLinecap:t.kind===`wait`?`round`:void 0,markerEnd:t.kind===`request`?`url(#${c})`:void 0,className:o}),t.kind===`wait`?(0,L.jsx)(`circle`,{cx:e.endX,cy:e.endY,r:`3.2`,strokeWidth:`1.7`,className:`fill-card stroke-message-peer-accent`}):null]},`${t.kind}:${t.id}`)}),(0,L.jsx)(`g`,{ref:f})]}),l.map(e=>{let{edge:t}=e,a=n!==void 0&&(t.from===n||t.to===n),o=n!==void 0&&!a,s=V(U(t.kind===`request`?t.createdAt:t.since,i));return(0,L.jsx)(`span`,{style:{left:e.laneX,top:e.labelY},className:r(`absolute -translate-x-1/2 -translate-y-1/2 rounded-full border border-message-peer-accent/60 bg-card px-1.5 py-0.5 text-xs font-semibold whitespace-nowrap text-message-peer-accent tabular-nums shadow-xs transition-opacity`,t.kind===`wait`&&`border-dashed`,o&&`opacity-25`),children:t.kind===`request`?`Req · ${s}`:`Wait · ${s}`},`label:${t.kind}:${t.id}`)})]})}var ei={permission:0,answer:1,respond:2,review:3,failed:4},ti={running:0,waiting:1,queued:2,retained:3},ni=new Set([`queued`,`waiting-for-capacity`]);function ri(e){return e.status===`review`||e.status===`failed`||e.rung===`failed`||K(e.status)&&g(e.rung)}function ii(e){let{task:t}=e,n=t.wait?.kind===`human`?t.wait:void 0;if(n?.detail.reason===`question`)return{...e,kind:`answer`,stateLabel:`Needs answer`,tone:`pending`,blockingReason:n.detail.question??`The agent asked a question and is waiting for your answer.`,ageSince:n.since,actionLabel:`Answer`};if(n?.detail.reason===`budget`){let t=n.detail.queuedMessages;return{...e,kind:`respond`,stateLabel:`Needs you`,tone:`pending`,blockingReason:t?`Automatic wakes used up · ${t} queued ${t===1?`message`:`messages`} waiting.`:`Automatic wakes used up.`,ageSince:n.since,actionLabel:`Respond`}}return{...e,kind:`respond`,stateLabel:`Needs you`,tone:`pending`,blockingReason:`Your turn to reply or finish the task.`,ageSince:n?.since??t.startedAt??t.createdAt,actionLabel:`Respond`}}function ai(e,t){let n={runId:t.runId,projectId:e.projectId,projectName:e.name,task:t},r=t.finishedAt??t.startedAt??t.createdAt;if(t.rung===`needs-permission`){let e=t.wait&&`since`in t.wait?t.wait.since:void 0;return{...n,kind:`permission`,stateLabel:`Needs permission`,tone:`pending`,blockingReason:`Waiting for permission approval before continuing.`,ageSince:e??t.startedAt??t.createdAt,actionLabel:`Open task`}}return t.status===`review`||t.rung===`needs-review`?{...n,kind:`review`,stateLabel:`Needs review`,tone:`info`,blockingReason:`Changes are ready for review before anything lands.`,ageSince:r,actionLabel:`Review`}:t.status===`failed`||t.rung===`failed`?{...n,kind:`failed`,stateLabel:`Failed`,tone:`danger`,blockingReason:t.error??`Task stopped with an error.`,ageSince:r,actionLabel:`Inspect`}:ii(n)}function oi(e){return K(e.status)?e.rung===`running`?`running`:ni.has(e.rung)?`queued`:`waiting`:`retained`}var si=e=>{if(!e)return 1/0;let t=Date.parse(e);return Number.isNaN(t)?1/0:t};function ci(e){let t=[],n=[];for(let r of e)for(let e of r.tasks)ri(e)?t.push(ai(r,e)):n.push({runId:e.runId,projectId:r.projectId,projectName:r.name,task:e,tier:oi(e)});return t.sort((e,t)=>ei[e.kind]-ei[t.kind]||si(e.ageSince)-si(t.ageSince)||e.runId.localeCompare(t.runId)),n.sort((e,t)=>ti[e.tier]-ti[t.tier]),{attention:t,working:n}}function li(e,t){let n=new Map;for(let t of e){let e=n.get(t.projectId);e?e.items.push(t):n.set(t.projectId,{projectId:t.projectId,projectName:t.projectName,items:[t]})}let r=new Map(t.map((e,t)=>[e,t]));return[...n.values()].sort((e,t)=>(r.get(e.projectId)??2**53-1)-(r.get(t.projectId)??2**53-1)||e.projectName.localeCompare(t.projectName))}function ui(e,t,n,r){let i=new Map;for(let n of t)n.relationship===`peer`&&n.recipientRunId===e&&i.set(n.senderRunId,X(r,n.senderRunId,n.senderTitle));for(let t of n)t.peerRunId===e&&i.set(t.waiterRunId,X(r,t.waiterRunId));let a=[...i.values()];if(a.length!==0)return a.length===1?`Unblocks ${a[0]}`:a.length===2?`Unblocks ${a[0]} + ${a[1]}`:`Unblocks ${a[0]} + ${a.length-1} more`}function di(e,t){if(e===void 0)return;let n=t.filter(t=>!e.has(t.runId));if(n.length!==0)return n.length===1?`New item needs your decision: ${n[0].task.title}`:`${n.length} new items need your decision`}var fi={permission:`border-l-pending`,answer:`border-l-pending`,respond:`border-l-pending`,review:`border-l-info`,failed:`border-l-danger`},pi=`relative z-[1] text-[12px] text-message-peer-accent hover:underline focus-visible:outline-2 focus-visible:outline-ring max-md:inline-flex max-md:min-h-11 max-md:items-center`,mi=[],hi=[],gi=new Map;function _i(e,t,n){return n?`/p/${encodeURIComponent(e)}/tasks/${encodeURIComponent(t)}`:`/tasks/${encodeURIComponent(t)}`}function vi({items:e,grouped:t,projectOrder:n,countSuffix:r,renderItems:i}){return t?(0,L.jsx)(`div`,{className:`flex flex-col gap-3`,children:li(e,n).map(e=>(0,L.jsxs)(`div`,{"data-slot":`activity-project-group`,"data-project":e.projectId,className:`flex flex-col gap-2`,children:[(0,L.jsxs)(`h3`,{className:`flex items-center gap-2 text-[12.5px] font-semibold text-foreground`,children:[(0,L.jsx)(`span`,{children:e.projectName}),(0,L.jsxs)(`span`,{className:`text-xs font-normal text-muted-foreground tabular-nums`,children:[e.items.length,` `,r]})]}),i(e.items)]},e.projectId))}):(0,L.jsx)(L.Fragment,{children:i(e)})}var yi={permission:`text-foreground`,answer:`text-foreground`,respond:`text-foreground`,review:`text-muted-foreground`,failed:`font-mono text-[12px] text-signal-word-red`};function bi({href:e,title:t,global:n}){let r=`hover:underline focus-visible:outline-2 focus-visible:outline-ring max-md:inline-flex max-md:min-h-11 max-md:min-w-11 max-md:items-center pointer-coarse:inline-flex pointer-coarse:min-h-11 pointer-coarse:min-w-11 pointer-coarse:items-center`;return n?(0,L.jsx)(M,{to:e,className:r,children:t}):(0,L.jsx)(P,{to:e,className:r,children:t})}function xi({record:e,href:t,global:n,selected:r,onTriage:i}){return e.kind===`permission`?(0,L.jsx)(N,{asChild:!0,size:`sm`,variant:`primary`,className:`max-md:flex-1`,children:n?(0,L.jsx)(M,{to:t,children:e.actionLabel}):(0,L.jsx)(P,{to:t,children:e.actionLabel})}):(0,L.jsx)(N,{type:`button`,size:`sm`,variant:e.kind===`answer`||e.kind===`respond`?`primary`:`outline`,"data-slot":`activity-triage-trigger`,"aria-expanded":r,className:`max-md:flex-1`,onClick:t=>i(e,t.currentTarget),children:e.actionLabel})}function Si({record:e,requests:t,waits:n,index:i,now:a,global:o,selected:s,linked:l,motion:d,onHover:f,onTriage:p}){let m=u().data,{task:h}=e,g=[h.runner?c(m,h.runner):void 0,h.model,h.currentStepId?`step ${h.currentStepId}`:void 0].filter(Boolean).join(` · `),_=ui(e.runId,t,n,i),ee=_i(e.projectId,e.runId,o),te={now:a,titleOf:e=>i.get(e)?.title??`Unreadable task`},v=h.workers.length>0;return(0,L.jsxs)(`article`,{"data-activity-row":e.runId,"data-activity-card":e.runId,"data-slot":`activity-decision`,"data-decision-kind":e.kind,"data-rung":h.rung,"data-selected":s?`true`:void 0,"data-linked":l?`true`:void 0,...tr(e.runId,f),className:r(`relative grid min-w-0 grid-cols-1 items-center gap-3 rounded-xl border border-card-edge border-l-[3px] bg-card px-4 py-3 shadow-card transition-colors md:grid-cols-[minmax(0,1fr)_auto] md:gap-x-4`,fi[e.kind],s&&`border-accent-text bg-accent-strong/[0.06]`,l&&`outline-2 outline-offset-1 outline-message-peer-accent`,e.runId in d.entering&&`activity-card-enter`),children:[(0,L.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5`,children:[(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,L.jsxs)(`span`,{className:r(`inline-flex items-center gap-1.5 text-[12px] font-semibold`,Gt[e.tone]),children:[(0,L.jsx)(en,{run:h,role:`root`}),(0,L.jsx)(`span`,{"data-slot":`activity-verb`,children:e.stateLabel})]}),(0,L.jsx)(`h3`,{className:`min-w-0 truncate text-[14px] font-semibold text-foreground`,children:(0,L.jsx)(bi,{href:ee,title:h.title,global:o})}),(0,L.jsx)(`span`,{"data-slot":`activity-project-badge`,className:`inline-flex shrink-0 items-center rounded-md border border-border bg-muted px-1.5 py-0.5 text-xs font-medium text-muted-foreground`,children:e.projectName}),e.ageSince?(0,L.jsx)(`span`,{"data-slot":`activity-age`,title:G(e.ageSince),className:`text-[12px] text-muted-foreground tabular-nums`,children:H(U(e.ageSince,a))}):null]}),(0,L.jsx)(`p`,{"data-slot":`activity-main`,className:r(`break-words text-[13px] leading-relaxed`,yi[e.kind]),children:e.blockingReason}),g||_?(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-0.5 text-xs text-muted-foreground`,children:[g?(0,L.jsx)(`span`,{children:g}):null,_?(0,L.jsxs)(`span`,{"data-slot":`activity-unblocks`,className:`font-medium text-message-peer-accent`,children:[`· `,_]}):null]}):null,(0,L.jsx)(qn,{runId:e.runId,requests:t,waits:n,index:i,link:o?M:P,pathOf:t=>o?`/p/${encodeURIComponent(e.projectId)}/tasks/${encodeURIComponent(t)}`:`/tasks/${encodeURIComponent(t)}`,className:`mt-1 flex flex-col gap-0.5 md:hidden`,linkClassName:pi})]}),(0,L.jsx)(`div`,{className:`flex items-center gap-2 max-md:w-full`,children:(0,L.jsx)(xi,{record:e,href:ee,global:o,selected:s,onTriage:p})}),v?(0,L.jsx)(`div`,{className:`min-w-0 md:col-span-2`,children:(0,L.jsx)(er,{task:h,requests:t,index:i,ctx:te,motion:d,projectId:e.projectId,global:o,compact:!0})}):null,(0,L.jsx)(Yn,{texts:Cn(e.runId,t,i,n)})]})}function Ci({items:e,requestsByProject:t,waitsByProject:n,indexByProject:r,now:i,global:a,grouped:o,projectOrder:s,selectedRunId:c,linkedIds:l,motion:u=$,onHover:d,onTriage:f}){return e.length===0?null:(0,L.jsxs)(`section`,{"data-slot":`activity-attention`,"aria-label":`Needs your decision`,className:`flex min-w-0 flex-col gap-2.5`,children:[(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,L.jsx)(`h2`,{className:`text-[12px] font-semibold tracking-[0.06em] text-muted-foreground uppercase`,children:`Needs your decision`}),(0,L.jsx)(`span`,{"data-slot":`activity-attention-count`,className:`inline-flex items-center rounded-full bg-inbox-count px-2 py-0.5 text-xs font-semibold text-inbox-count-foreground tabular-nums`,children:e.length}),(0,L.jsx)(`span`,{className:`ml-auto hidden text-[12px] text-muted-foreground sm:inline`,children:`Resolve inline without leaving the queue`})]}),(0,L.jsx)(vi,{items:e,grouped:o,projectOrder:s,countSuffix:`waiting`,renderItems:e=>(0,L.jsx)(`div`,{className:`flex flex-col gap-2.5`,children:e.map(e=>(0,L.jsx)(Si,{record:e,requests:t.get(e.projectId)??mi,waits:n.get(e.projectId)??hi,index:r.get(e.projectId)??gi,now:i,global:a,selected:c===e.runId,linked:l.has(e.runId),motion:u,onHover:d,onTriage:f},e.runId))})})]})}function wi(e){return`/p/${encodeURIComponent(e.projectId)}/tasks/${encodeURIComponent(e.runId)}`}function Ti(e){return{...e.id===void 0?{}:{id:e.id},header:e.header,question:e.question,...e.options===void 0?{}:{options:e.options.map(e=>({label:e.label,...e.description===void 0?{}:{description:e.description}}))},...e.multiSelect===void 0?{}:{multiSelect:e.multiSelect},...e.allowFreeText===void 0?{}:{allowFreeText:e.allowFreeText}}}function Ei(e,t){let n=Te(t);if(!n)return;let r=De(n);if(r)return{kind:`ask`,id:r.id,questions:r.questions.map(Ti),...r.context===void 0?{}:{context:r.context},resolved:!1,...e.delegation?.role===`worker`?{parentRunId:e.delegation.parentRunId}:{}}}function Di({run:e,projectId:t,prompt:n,onResolved:r}){let i=Re(e,t),a=Be(e.id,{projectId:t,onSuccess:r}),[o,s]=(0,I.useState)(``),c=async()=>{let e=o.trim();e&&await i.send(e)===void 0&&(s(``),r())};return(0,L.jsxs)(`div`,{"data-slot":`activity-quick-reply`,className:`flex flex-col gap-3 rounded-lg border border-border bg-card p-3.5`,children:[(0,L.jsx)(`p`,{className:`text-[13px] text-foreground`,children:n}),(0,L.jsx)(ze,{"aria-label":`Reply to task`,placeholder:`Write your reply…`,rows:3,value:o,disabled:i.isPending||i.blockedBy!==void 0,onChange:e=>s(e.target.value),className:`bg-background text-base md:text-[13px]`}),i.reason?(0,L.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:i.reason}):null,i.error?(0,L.jsx)(`p`,{role:`alert`,className:`text-xs text-semantic-red`,children:i.error}):null,(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,L.jsx)(N,{type:`button`,size:`sm`,variant:`primary`,disabled:i.isPending||i.blockedBy!==void 0||o.trim().length===0,onClick:()=>void c(),children:`Send reply`}),e.finishBlocked===null?(0,L.jsx)(N,{type:`button`,size:`sm`,variant:`outline`,disabled:a.isPending,onClick:()=>a.mutate(),children:`Finish task`}):null]})]})}function Oi({record:e,run:t,onResolved:n}){let r=ae({queryKey:[`activity-triage`,`history-context`,e.projectId,e.runId,e.ageSince??``,e.blockingReason],queryFn:({signal:t})=>S(e.runId,{projectId:e.projectId,signal:t}),staleTime:0,gcTime:0,refetchOnMount:`always`});if(r.isPending)return(0,L.jsx)(`p`,{"data-slot":`triage-loading`,className:`text-xs text-muted-foreground`,children:`Loading question…`});let i=r.data?Ei(t,r.data.contextEvents):void 0;return i?(0,L.jsx)(ve,{ask:i,run:t,projectId:e.projectId,onAnswered:n}):(0,L.jsx)(Di,{run:t,projectId:e.projectId,prompt:e.blockingReason,onResolved:n})}function ki({record:e,run:t,onResolved:n}){let r=T(),i=Re(t,e.projectId),[a,s]=(0,I.useState)(``),c=f({mutationFn:()=>ie(l(e.runId,{projectId:e.projectId}),!0),onSuccess:()=>{C(`Failed task archived.`),r.invalidateQueries({queryKey:o.runs.all}),n()},onError:e=>C(e.message,{tone:`danger`})}),u=async()=>{let e=a.trim()||`Continue and resolve the failure.`;await i.send(e)===void 0&&(C(`Task resumed.`),n())},d=t.error??e.blockingReason;return(0,L.jsxs)(`div`,{"data-slot":`activity-failed-triage`,className:`flex flex-col gap-3`,children:[(0,L.jsxs)(`div`,{className:`rounded-lg border border-danger/40 bg-card-2 p-3.5`,children:[(0,L.jsx)(`p`,{className:`text-xs font-semibold text-signal-word-red`,children:`Failure details`}),(0,L.jsx)(`pre`,{className:`mt-2 overflow-x-auto font-mono text-xs whitespace-pre-wrap text-foreground`,children:d})]}),i.mode===`unavailable`?null:(0,L.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,L.jsx)(`label`,{htmlFor:`activity-retry-note`,className:`text-xs font-medium text-foreground`,children:`Retry instruction (optional)`}),(0,L.jsx)(ze,{id:`activity-retry-note`,rows:2,placeholder:`Leave blank to continue and resolve the failure…`,value:a,disabled:i.isPending||i.blockedBy!==void 0,onChange:e=>s(e.target.value),className:`bg-card text-base md:text-[13px]`}),i.reason?(0,L.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:i.reason}):null,i.error?(0,L.jsx)(`p`,{role:`alert`,className:`text-xs text-semantic-red`,children:i.error}):null]}),(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[i.mode===`unavailable`?null:(0,L.jsxs)(N,{type:`button`,size:`sm`,variant:`primary`,disabled:i.isPending||i.blockedBy!==void 0,onClick:()=>void u(),children:[(0,L.jsx)(Ee,{"aria-hidden":`true`,className:`size-3.5`}),`Retry task`]}),(0,L.jsxs)(N,{type:`button`,size:`sm`,variant:`outline`,disabled:c.isPending,onClick:()=>c.mutate(),children:[(0,L.jsx)(ge,{"aria-hidden":`true`,className:`size-3.5`}),`Archive`]})]})]})}function Ai(e){let{task:t}=e,n=t.workers.map(e=>`${e.runId}:${e.status}`).join(`,`);return`${t.status}|${t.rung}|${t.finishedAt??``}|${t.error??``}|${e.ageSince??``}|${n}`}function ji({record:e,onResolved:t}){let n=T(),r=i(e.projectId,e.runId,!0,{staleTime:0,refetchOnMount:`always`}),a=Ai(e),o=(0,I.useRef)(a);if((0,I.useEffect)(()=>{if(o.current===a)return;o.current=a;let t=!1,r=[e.projectId,`runs`,`detail`,e.runId];return me(n,r),n.cancelQueries({queryKey:r,exact:!0}).then(()=>{t||n.refetchQueries({queryKey:r,exact:!0,type:`active`})}),e.kind===`review`&&n.invalidateQueries({queryKey:[e.projectId,`runs`,`diff`,e.runId],exact:!0}),()=>{t=!0}},[a,n,e.kind,e.projectId,e.runId]),(0,I.useEffect)(()=>{let t=[e.projectId,`runs`,`detail`,e.runId];return te(()=>(me(n,t),n.cancelQueries({queryKey:t,exact:!0}).then(()=>n.refetchQueries({queryKey:t,exact:!0,type:`active`}))))},[n,e.projectId,e.runId]),r.isPending)return(0,L.jsx)(`p`,{"data-slot":`triage-loading`,className:`text-xs text-muted-foreground`,children:`Loading task details…`});if(r.isError||!r.data)return(0,L.jsxs)(`div`,{role:`alert`,className:`flex flex-col gap-2 text-xs text-semantic-red`,children:[(0,L.jsxs)(`p`,{children:[`Could not load task details: `,r.error?.message??`task unavailable`,`.`]}),(0,L.jsx)(N,{type:`button`,size:`sm`,variant:`outline`,className:`self-start`,onClick:()=>void r.refetch(),children:`Retry`})]});let s=r.isFetching&&r.data.finishBlocked!==void 0?{...r.data,finishBlocked:void 0}:r.data;return e.kind===`answer`?(0,L.jsx)(Oi,{record:e,run:s,onResolved:t}):e.kind===`review`?(0,L.jsx)(Ve,{run:s,projectId:e.projectId,onResolved:t}):e.kind===`failed`?(0,L.jsx)(ki,{record:e,run:s,onResolved:t}):(0,L.jsx)(Di,{run:s,projectId:e.projectId,prompt:e.blockingReason,onResolved:t})}function Mi({record:e,selectionToken:t,resolved:n=!1,now:i,onClose:a,onResolved:o,onRestoreFocus:s}){let c=T();return(0,L.jsx)(Me,{open:e!==null,onOpenChange:e=>{e||a()},children:(0,L.jsx)(Pe,{side:`right`,showCloseButton:!1,"data-slot":`activity-triage-drawer`,onCloseAutoFocus:e=>{s&&(e.preventDefault(),s())},className:`flex h-full w-full flex-col gap-0 p-0 data-[state=closed]:duration-150 data-[state=open]:duration-200 sm:max-w-lg`,children:e?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(je,{className:`flex-row items-start justify-between gap-3 border-b border-border bg-card px-4 py-3.5`,children:[(0,L.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,L.jsx)(`span`,{className:r(`text-xs font-semibold`,Gt[e.tone]),children:e.stateLabel}),(0,L.jsx)(`span`,{className:`inline-flex items-center rounded-md border border-border bg-muted px-1.5 py-0.5 text-xs font-medium text-muted-foreground`,children:e.projectName}),e.ageSince?(0,L.jsx)(`span`,{title:G(e.ageSince),className:`text-xs text-muted-foreground tabular-nums`,children:H(U(e.ageSince,i))}):null]}),(0,L.jsx)(Ne,{className:`mt-1 truncate text-[16px] leading-snug`,children:e.task.title}),(0,L.jsxs)(Ie,{className:`sr-only`,children:[`Resolve `,e.stateLabel.toLowerCase(),` for `,e.task.title,` without leaving Live Activity.`]})]}),(0,L.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,L.jsx)(N,{asChild:!0,size:`sm`,variant:`ghost`,className:`px-2.5 text-xs`,children:(0,L.jsxs)(M,{to:wi(e),children:[`Open task`,(0,L.jsx)(Se,{"aria-hidden":`true`,className:`size-3.5`})]})}),(0,L.jsx)(N,{type:`button`,size:`icon`,variant:`ghost`,"aria-label":`Close triage drawer`,onClick:a,children:(0,L.jsx)(he,{"aria-hidden":`true`,className:`size-4`})})]})]}),(0,L.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-4`,children:n?(0,L.jsxs)(`div`,{"data-slot":`activity-triage-resolved`,role:`status`,className:`flex flex-col gap-3 rounded-lg border border-border bg-card p-4 text-[13px] text-muted-foreground`,children:[(0,L.jsx)(`p`,{className:`text-foreground`,children:`This task no longer needs your decision.`}),(0,L.jsx)(N,{type:`button`,size:`sm`,variant:`outline`,className:`self-start`,onClick:a,children:`Close`})]}):(0,L.jsx)(ji,{record:e,onResolved:((e,t)=>()=>{c.invalidateQueries({queryKey:[`workspace`,`activity`]}),c.invalidateQueries({queryKey:[`activity-triage`,`history-context`,e.projectId,e.runId]}),c.invalidateQueries({queryKey:[e.projectId,`runs`,`detail`,e.runId],exact:!0}),o(e.runId,t)})(e,t)},`${e.projectId}:${e.runId}:${e.kind}:${t??0}`)})]}):null})})}var Ni=12,Pi=`col-start-3 row-start-1 min-w-[3.25rem] justify-self-end text-right md:col-start-5`,Fi={fail:4,pending:3,pass:2,skipping:1,cancel:0};function Ii(e,t){let n=e.slice(Ni);if(n.length===0)return t;let r=n.length+(t?.count??0),i=t?.bucket??n[0].bucket;for(let e of n)Fi[e.bucket]>Fi[i]&&(i=e.bucket);return{count:r,bucket:i}}function Li({record:e,requests:t,waits:n,index:i,ctx:a,global:o,linked:s,motion:c,onHover:l}){let{task:u}=e,d=Vt(u,a),f=_i(e.projectId,e.runId,o),p=u.startedAt??d.since??u.createdAt,m=c.slides[u.runId]?.key,h=In(c,u.runId);return(0,L.jsxs)(`article`,{"data-activity-row":e.runId,"data-activity-card":e.runId,"data-slot":`activity-working-row`,"data-rung":u.rung,"data-linked":s?`true`:void 0,...tr(e.runId,l),className:r(`relative flex min-w-0 flex-col gap-1.5 px-3.5 py-2.5 transition-colors first:rounded-t-xl last:rounded-b-xl`,s&&`bg-message-peer-bg outline-2 outline-offset-1 outline-message-peer-accent`,e.runId in c.entering&&`activity-card-enter`),children:[(0,L.jsxs)(`div`,{className:`grid min-w-0 grid-cols-[14px_minmax(0,1fr)_auto] items-center gap-x-2.5 gap-y-1 md:grid-cols-[14px_minmax(0,1.25fr)_minmax(0,1.45fr)_auto_auto]`,children:[(0,L.jsx)(en,{run:u,role:`root`}),(0,L.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,L.jsx)(`h3`,{className:`min-w-0 truncate text-[13px] font-semibold text-foreground`,children:o?(0,L.jsx)(M,{to:f,className:`hover:underline focus-visible:outline-2 focus-visible:outline-ring max-md:inline-flex max-md:min-h-11 max-md:items-center`,children:u.title}):(0,L.jsx)(P,{to:f,className:`hover:underline focus-visible:outline-2 focus-visible:outline-ring max-md:inline-flex max-md:min-h-11 max-md:items-center`,children:u.title})}),(0,L.jsx)(`span`,{"data-slot":`activity-project-badge`,className:`inline-flex shrink-0 items-center rounded-md border border-border bg-muted px-1.5 py-0.5 text-xs font-medium text-muted-foreground`,children:e.projectName}),u.currentStepId?(0,L.jsxs)(`span`,{"data-slot":`activity-step`,className:`hidden shrink-0 text-xs text-muted-foreground sm:inline`,children:[`step `,u.currentStepId]}):null]}),(0,L.jsxs)(`div`,{className:`col-span-2 col-start-2 flex min-w-0 items-center gap-2 text-[12px] text-muted-foreground md:col-span-1 md:col-start-3`,children:[(0,L.jsx)(`span`,{"data-slot":`activity-verb`,className:r(`shrink-0 font-semibold`,Gt[d.tone]),children:d.verb}),(0,L.jsx)(`span`,{"data-slot":`activity-main`,className:r(`min-w-0 truncate text-foreground`,d.mono&&`font-mono text-xs`,m!==void 0&&`activity-slide`),children:d.main},m??`still`),d.checks&&d.checks.length>0?(0,L.jsx)(rn,{checks:d.checks.slice(0,Ni),overflow:Ii(d.checks,d.overflow),passed:h,className:`hidden w-20 shrink-0 items-center gap-[2px] sm:inline-flex`}):null,d.checkSummary?(0,L.jsx)(`span`,{"data-slot":`activity-checks-summary`,className:`sr-only`,children:d.checkSummary}):null]}),(0,L.jsx)(an,{rate:u.rate,className:`hidden h-3.5 w-[52px] md:block`}),p?(0,L.jsx)(`span`,{"data-slot":`activity-elapsed`,title:G(p),className:r(Pi,`text-[12px] text-muted-foreground tabular-nums`),children:H(U(p,a.now))}):(0,L.jsx)(`span`,{className:Pi})]}),(0,L.jsx)(Yn,{texts:Cn(e.runId,t,i,n)}),(0,L.jsx)(qn,{runId:e.runId,requests:t,waits:n,index:i,link:o?M:P,pathOf:t=>_i(e.projectId,t,o),className:`ml-6 flex flex-col gap-0.5 md:hidden`,linkClassName:pi}),(0,L.jsx)(er,{task:e.task,requests:t,index:i,ctx:a,motion:c,projectId:e.projectId,global:o,compact:!0})]})}function Ri({items:e,requestsByProject:t,waitsByProject:n,indexByProject:r,now:i,global:a,grouped:o,projectOrder:s,linkedIds:c,motion:l=$,onHover:u}){return e.length===0?null:(0,L.jsxs)(`section`,{"data-slot":`activity-working`,"aria-label":`Working and active tasks`,className:`flex min-w-0 flex-col gap-2.5`,children:[(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,L.jsx)(`h2`,{className:`text-[12px] font-semibold tracking-[0.06em] text-muted-foreground uppercase`,children:`Working & active`}),(0,L.jsx)(`span`,{"data-slot":`activity-working-count`,className:`inline-flex items-center rounded-full bg-muted px-2 py-0.5 text-xs font-semibold text-foreground tabular-nums`,children:e.length}),(0,L.jsx)(`span`,{className:`ml-auto hidden text-[12px] text-muted-foreground sm:inline`,children:`Live tool activity, waits, and worker trees`})]}),(0,L.jsx)(vi,{items:e,grouped:o,projectOrder:s,countSuffix:`active`,renderItems:e=>(0,L.jsx)(`div`,{className:`divide-y divide-border rounded-xl border border-card-edge bg-card shadow-card`,children:e.map(e=>{let o=r.get(e.projectId)??gi,s={now:i,titleOf:e=>o.get(e)?.title??`Unreadable task`};return(0,L.jsx)(Li,{record:e,requests:t.get(e.projectId)??mi,waits:n.get(e.projectId)??hi,index:o,ctx:s,global:a,linked:c.has(e.runId),motion:l,onHover:u},e.runId)})})})]})}function zi(e){let t=new Map;for(let n of e)for(let[e,r]of _n(n))t.set(e,r);return t}function Bi(e,t){let n=[],r=[],i=[];for(let a of e){let e=Wr(a,t);n.push(...e.requests),r.push(...e.folding),i.push(...Kn(a.projectId,Z(a.tasks),t))}return{requests:n,folding:r,waits:i}}function Vi(e,t){if(!e)return{activeDecision:null,resolvedExternally:!1};let n=t.find(t=>t.runId===e.runId&&t.projectId===e.projectId)??null;return{activeDecision:n??e.snapshot,resolvedExternally:n===null}}function Hi(e){return e<=0?{"data-has-arcs":void 0,style:void 0,className:`relative flex min-w-0 flex-col gap-6`}:{"data-has-arcs":`true`,style:{"--activity-arc-gutter":`${e}px`},className:`relative flex min-w-0 flex-col gap-6 md:pl-(--activity-arc-gutter)`}}function Ui(e){let[t,n]=I.useState(void 0),r=I.useRef(void 0),i=I.useRef(void 0),a=I.useRef(void 0);return I.useEffect(()=>{let t=di(r.current,e);if(r.current=new Set(e.map(e=>e.runId)),t){if(a.current!==void 0&&(window.clearTimeout(a.current),a.current=void 0),i.current!==t){i.current=t,n(t);return}n(``),a.current=window.setTimeout(()=>{a.current=void 0,i.current=t,n(t)},0)}},[e]),I.useEffect(()=>()=>{a.current!==void 0&&window.clearTimeout(a.current)},[]),t}function Wi(e,t,n){if(e&&e.isConnected){e.focus({preventScroll:!0});return}(t?.querySelector(`[data-slot="activity-triage-trigger"]`)??n)?.focus({preventScroll:!0})}function Gi({projects:e,now:t,global:n,grouped:r,projectOrder:i,motion:a=$,feed:o=[],still:s=!1,paused:c=!1,emptyMessage:l}){let u=I.useRef(null),[d,f]=I.useState(null),p=I.useRef(0),[m,h]=I.useState(null),g=I.useRef(null),[_,ee]=I.useState({}),te=I.useMemo(()=>zi(e),[e]),v=I.useMemo(()=>new Map(e.map(e=>[e.projectId,_n(e)])),[e]),y=I.useMemo(()=>new Map(e.map(e=>[e.projectId,e.requests])),[e]),b=I.useMemo(()=>new Map(e.map(e=>[e.projectId,Z(e.tasks)])),[e]),{attention:x,working:S}=I.useMemo(()=>ci(e),[e]),ne=Ui(x),C=I.useMemo(()=>e.flatMap(e=>e.requests),[e]),re=I.useMemo(()=>e.flatMap(e=>Z(e.tasks)),[e]),w=I.useMemo(()=>Bi(e,a),[e,a]),ie=I.useMemo(()=>[...C,...w.requests],[C,w.requests]),ae=I.useMemo(()=>[...re,...w.waits],[re,w.waits]),T=I.useMemo(()=>new Map([...x.map(e=>[e.runId,e.projectId]),...S.map(e=>[e.runId,e.projectId])]),[x,S]),{edges:oe,gutterWidth:E}=I.useMemo(()=>Yr(ie,ae,T,a),[ie,ae,T,a]),D=_.pointer??_.focus,se=I.useMemo(()=>{let e=D?T.get(D):void 0;return e&&D?Xr(D,y.get(e)??[],b.get(e)??[]):new Set},[D,y,T,b]),O=I.useCallback((e,t)=>{ee(n=>{if(n[e]===t)return n;let r={...n};return t===void 0?delete r[e]:r[e]=t,r})},[]),{activeDecision:ce,resolvedExternally:k}=I.useMemo(()=>Vi(m,x),[x,m]),le=I.useCallback((e,t)=>{g.current=t,h({token:++p.current,projectId:e.projectId,runId:e.runId,snapshot:e})},[]),ue=I.useCallback(()=>Wi(g.current,d,u.current),[d]),de=I.useCallback(()=>h(null),[]),A=I.useCallback((e,t)=>{h(e=>e&&(t===void 0||e.token===t)?null:e)},[]),fe=`${r}:${x.map(e=>e.runId).join(`,`)}:${S.map(e=>e.runId).join(`,`)}:${oe.map(e=>e.id).join(`,`)}`,j=x.length===0&&S.length===0;return(0,L.jsxs)(`div`,{ref:u,tabIndex:-1,className:`flex min-w-0 flex-col gap-5 outline-none`,children:[(0,L.jsx)(`p`,{"data-slot":`activity-announcement`,role:`status`,"aria-live":`polite`,className:`sr-only`,children:ne??``}),j&&l?(0,L.jsx)(`p`,{"data-slot":`activity-empty`,className:`py-6 text-[13px] text-muted-foreground`,children:l}):null,j?null:(0,L.jsxs)(`div`,{ref:f,"data-slot":`activity-stage`,...Hi(E),children:[(0,L.jsx)($r,{stage:d,edges:oe,active:D,now:t,layoutKey:fe,motion:a,paused:c||s}),(0,L.jsx)(Ci,{items:x,requestsByProject:y,waitsByProject:b,indexByProject:v,now:t,global:n,grouped:r,projectOrder:i,selectedRunId:ce?.runId,linkedIds:se,motion:a,onHover:O,onTriage:le}),(0,L.jsx)(Ri,{items:S,requestsByProject:y,waitsByProject:b,indexByProject:v,now:t,global:n,grouped:r,projectOrder:i,linkedIds:se,motion:a,onHover:O})]}),(0,L.jsx)(Vr,{requests:C,closing:w.folding,index:te,now:t,feed:o,motion:a}),(0,L.jsx)(Mi,{record:ce,selectionToken:m?.token,resolved:k,now:t,onClose:de,onResolved:A,onRestoreFocus:ue})]})}var Ki=e=>new Map(e.map(e=>[e.runId,e])),qi=e=>e!==void 0&&gn(e)===void 0;function Ji(e,t,n,r){let i=Ki(t.workers);for(let t of n.workers){let a=i.get(t.runId);!a&&K(t.status)&&r({kind:`worker-started`,projectId:e,parentId:n.runId,worker:t}),a&&K(a.status)&&!K(t.status)&&r({kind:`worker-settled`,projectId:e,parentId:n.runId,worker:t})}}function Yi(e,t,n,r){if(t.wait?.kind!==`pr`||n.wait?.kind!==`pr`||t.wait.detail.number!==n.wait.detail.number)return;let i=new Set((t.wait.detail.checks??[]).filter(e=>e.bucket===`pending`).map(e=>e.name));for(let t of n.wait.detail.checks??[])t.bucket===`pass`&&i.has(t.name)&&r({kind:`check-passed`,projectId:e,runId:n.runId,pr:n.wait.detail.number,name:t.name})}var Xi=(e,t)=>t.tool!==void 0&&(t.tool.startedAt!==e.tool?.startedAt||t.tool.title!==e.tool?.title);function Zi(e,t,n,r){t.rung!==n.rung&&r({kind:`rung-changed`,projectId:e,task:n,from:t.rung}),Xi(t,n)&&r({kind:`tool-started`,projectId:e,runId:n.runId}),Ji(e,t,n,r),Yi(e,t,n,r)}function Qi(e,t,n){let r=Ki(e.tasks),i=Ki(t.tasks);for(let e of t.tasks){let i=r.get(e.runId);i?Zi(t.projectId,i,e,n):n({kind:`card-entered`,projectId:t.projectId,task:e})}for(let r of e.tasks)i.has(r.runId)||n({kind:`card-left`,projectId:t.projectId,task:r})}function $i(e,t,n){let r=new Set(e.requests.map(e=>e.requestId)),i=new Set(t.requests.map(e=>e.requestId)),a=new Map(t.closed.map(e=>[e.requestId,e.status]));for(let e of t.requests)r.has(e.requestId)||n({kind:`request-opened`,projectId:t.projectId,request:e});for(let r of e.requests){if(i.has(r.requestId))continue;let e=a.get(r.requestId);n({kind:`request-closed`,projectId:t.projectId,request:r,...e?{status:e}:{}})}}function ea(e,t,n){let r=Z(e.tasks),i=Z(t.tasks),a=new Set(r.map(e=>e.id)),o=new Set(i.map(e=>e.id));for(let e of i)a.has(e.id)||n({kind:`wait-opened`,projectId:t.projectId,wait:e});for(let e of r)o.has(e.id)||n({kind:`wait-closed`,projectId:t.projectId,wait:e})}var ta=[`needsYou`,`working`,`waiting`,`queued`,`activeWorkers`,`openRequests`,`inReview`];function na(e,t,n){let r=Mn(e),i=Mn(t);for(let e of ta)r[e]!==i[e]&&n({kind:`chip-changed`,chip:e,from:r[e],to:i[e]})}function ra(e,t){if(e===void 0)return[];let n=[],r=e=>n.push(e),i=new Map(e.projects.map(e=>[e.projectId,e]));for(let e of t.projects){let t=i.get(e.projectId);!qi(t)||!qi(e)||(Qi(t,e,r),$i(t,e,r),ea(t,e,r))}return na(e.projects,t.projects,r),n}function ia(e){return{input:e,reconcile:!1,seq:0,motion:$,feed:[],epoch:0,...e.snapshot?{seen:e.snapshot}:{}}}function aa(e){let{plan:t,...n}=e;return{...n,motion:$,epoch:e.epoch+1}}function oa(e,t,n){let r=ra(t,n);if(r.length===0)return e;let i=Date.parse(n.generatedAt),a=Or(t,n),o=r.flatMap(e=>Nr(e,a,i)??[]),s=e.seq+o.length+1,c=Un(r,s,e.input.reduced);return{...e,seq:s,feed:o.length>0?Pr(e.feed,o,i,e.seq+1):e.feed,motion:Gn(e.motion,c.changes),...c.timers.length>0?{plan:{key:s,timers:c.timers}}:{}}}function sa(e,t){let n=e.seen;if(!t||t===n)return e;let r={...e,seen:t};return!n||!e.input.active?r:e.reconcile?{...r,reconcile:!1}:oa(r,n,t)}function ca(e,t){let n=e.input;if(t.scope!==n.scope)return{...ia(t),seq:e.seq,epoch:e.epoch+1};if(t.snapshot===n.snapshot&&t.active===n.active&&t.reduced===n.reduced)return e;let r={...e,input:t};return n.active&&!t.active&&(r={...aa(r),reconcile:!0}),!n.reduced&&t.reduced&&(r=aa(r)),sa(r,t.snapshot)}var la=`(prefers-reduced-motion: reduce)`,ua=()=>typeof window<`u`&&typeof window.matchMedia==`function`?window.matchMedia(la):void 0;function da(e){let t=ua();return t?.addEventListener?.(`change`,e),()=>t?.removeEventListener?.(`change`,e)}function fa(){return ua()?.matches??!1}function pa(){return(0,I.useSyncExternalStore)(da,fa,()=>!1)}function ma(e,t){let n=I.useRef(new Set);I.useEffect(()=>{let e=n.current;return()=>{for(let t of e)clearTimeout(t);e.clear()}},[e.epoch]),I.useEffect(()=>{for(let{after:r,change:i}of e.plan?.timers??[]){let e=setTimeout(()=>{n.current.delete(e),t(e=>({...e,motion:Gn(e.motion,[i])}))},r);n.current.add(e)}},[e.plan?.key])}function ha(e,t){let n=pa(),r=b(),i={snapshot:e,scope:t,active:r,reduced:n},[a,o]=I.useState(()=>ia(i)),s=ca(a,i);return s!==a&&o(s),ma(s,o),{motion:s.motion,feed:s.feed,reduced:n,paused:!r}}function ga(e,t){let n=Fe(1e3),[r,i]=I.useState({offset:0}),a=r.offset;return ct(e)&&e!==r.generatedAt&&t!==0&&(a=Date.parse(e)-t,i({generatedAt:e,offset:a})),n+a}export{en as A,_n as C,hn as D,pn as E,G as F,U as I,H as L,K as M,Vt as N,fn as O,V as P,pt as R,gn as S,un as T,$ as _,Dr as a,X as b,Er as c,_r as d,ar as f,qn as g,tr as h,Ur as i,Kt as j,an as k,wr as l,Yn as m,ha as n,Cr as o,nr as p,Gi as r,Tr as s,ga as t,yr as u,Kn as v,Mn as w,Z as x,Cn as y};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{p as r}from"./dist-C_rn70hE.js";import{D as i,E as a,O as o,R as s,S as c,T as l,n as u,r as d,t as f,w as p}from"./activity-motion-Ckq9kC3I.js";import{t as m}from"./button-B22ANdCY.js";import{s as h}from"./project-router-j0uBi7Ep.js";import{a as g,f as _,n as v,t as y}from"./page-shell-BgabWJ3w.js";import{_t as b}from"./index-DJB0lid-.js";var x=e(t(),1),S=n();function C(){let e=r(),t=s({kind:`project`,projectId:e}),n=h(),[C,w]=x.useState(!1),T=f(t.data?.generatedAt,t.dataUpdatedAt),{motion:E,feed:D,reduced:O,paused:k}=u(t.data,e),A=t.data?.projects[0];if(t.isPending)return(0,S.jsx)(b,{});let j=A?c(A):void 0;return A?(0,S.jsxs)(g,{route:`activity`,density:_(A.tasks.length),headerSpacing:`compact`,rootProps:{"data-activity-paused":k?`true`:void 0},bodyClassName:`gap-3.5`,header:o({name:A.name,now:T,updatedAt:t.data?.generatedAt,stale:t.isError,scopeSwitch:(0,S.jsx)(l,{scope:`project`,projectId:n??A.projectId,projectName:A.name,grouped:C,onToggleGroup:()=>w(e=>!e)})}),sparseFooter:!j&&A.tasks.length>0?(0,S.jsx)(v,{summary:`${A.tasks.length} active ${A.tasks.length===1?`task`:`tasks`} in ${A.name}. Start more work in parallel or inspect all tasks.`,actions:(0,S.jsx)(a,{})}):void 0,children:[(0,S.jsx)(i,{summary:p([A]),tasksTo:`/`,bumps:E.bumps}),j?(0,S.jsx)(`p`,{"data-slot":`activity-project-notice`,role:`status`,className:`rounded-xl border border-border bg-card p-5 text-[13px] text-muted-foreground`,children:j}):A.tasks.length===0&&A.requests.length===0&&D.length===0?(0,S.jsx)(y,{slot:`activity-empty`,title:`No active work in this project.`,description:`Tasks waiting for your decision or actively running will appear here live.`,actions:(0,S.jsx)(a,{primary:!0})}):(0,S.jsx)(d,{projects:[A],now:T,global:!1,grouped:C,projectOrder:[A.projectId],motion:E,feed:D,still:O,paused:k,emptyMessage:`No active work in this project.`})]}):(0,S.jsx)(g,{route:`activity`,density:`empty`,header:o({name:n??`project`,scopeSwitch:(0,S.jsx)(l,{scope:`project`,projectId:n})}),children:(0,S.jsxs)(`div`,{role:`alert`,className:`flex flex-wrap items-center gap-3 rounded-xl border border-border bg-card p-5 text-[13px] text-muted-foreground`,children:[t.error?`Could not load activity: ${t.error.message}`:`This project has no activity snapshot.`,(0,S.jsx)(m,{size:`sm`,variant:`outline`,onClick:()=>void t.refetch(),children:`Retry`})]})})}export{C as ProjectActivityRoute};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{S as e,St as t,Wt as n,dn as r,nn as i,ut as a}from"./queries-CchoEEzj.js";import{Ar as o,Fr as s,Ir as c,Nr as l,Pr as u,a as d,jr as f,kr as p,tn as m}from"./toaster-zMN8cNZQ.js";function h(e){let t=e.filter(e=>!e.isDefault&&e.status===void 0),i=r({queries:t.map(e=>({queryKey:n.agentAccountStatus(e.id),queryFn:({signal:t})=>m(e.id,{signal:t}),staleTime:6e4,retry:!1}))}),a=new Map;return t.forEach((e,t)=>{let n=i[t]?.data?.status?.status;n!==void 0&&a.set(e.id,n)}),a}function g(e,t,n){let r=e?.projectSelections?.[t??`default`];return r===void 0?n?e?.selections?.[n]:void 0:r}function _(){let e=a().data?.profiles??[],t=h(e);return e.map(e=>{let n=e.status?.status??t.get(e.id);return{provider:e.provider,id:e.id,label:e.label,...e.configDir===void 0?{}:{configDir:e.configDir},isDefault:e.isDefault,...n===void 0?{}:{status:n}}})}function v(t){let n=a(),r=d(),i=e(t),o=_(),s=i.data?.info?.root;return{accounts:o,repoAccount:g(n.data,t??r.projectId,s)}}function y(e,t){return e.filter(e=>e.provider===t).length>1}function b(e){let n=t(),r=i(),{accounts:a,repoAccount:d}=v(e);return{runners:c(n.data,r.data,a),uninstalled:s(n.data,r.data),signedOut:u(n.data,r.data,a),accounts:o(n.data,a),repoAccount:d,accountFor:(e,t)=>p(n.data,a,e,t,d),runnersOn:e=>l(n.data,r.data,a,e),readyOn:(e,t)=>f(n.data,a,e,t)}}export{b as a,v as i,g as n,_ as r,y as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{At as r,Qt as i,S as a,St as o,Ut as s,Wt as c,Xt as l,Yt as u,an as d,g as f,in as p,kt as m,nn as h,un as g,ut as _,wt as v,xt as y}from"./queries-CchoEEzj.js";import{I as b,Or as x,Rn as S,Zt as ee,a as C,n as w,vi as T,vn as E}from"./toaster-zMN8cNZQ.js";import{c as D}from"./design-icons-QbNMZniQ.js";import{t as O}from"./button-B22ANdCY.js";import{t as k}from"./switch-CAKeV99j.js";import{t as A}from"./status-dot-Drd4-nfa.js";import{n as j}from"./agent-accounts-D_7QcFSx.js";import{t as M}from"./centered-state-BgSV4e79.js";import{Fn as N,L as P,V as F,z as I}from"./index-DJB0lid-.js";import{t as te}from"./textarea-vEsJAUAV.js";import{t as L}from"./option-select-BwSkbCrQ.js";import{a as ne,i as R,n as z,r as B,t as V}from"./settings-agent-picker-b4M6fQ8m.js";import{n as H,t as U}from"./save-cue-CpHgT93o.js";import{n as W}from"./settings-field-Bhh8I9fJ.js";import{r as G}from"./settings-save-bar-DFY_Km4X.js";import{n as K}from"./saved-draft-BwzBc-_Y.js";var q=e(t(),1),J=n(),Y={connected:N(`connected`),disconnected:N(`disconnected`),"not-installed":N(`not-installed`),unknown:N(`unknown`)};function X(e,t,n){return{providers:e.providers.map(e=>e.provider===t?{...e,enabled:n}:e)}}function re(e,t){return e?Y[e]:t?{label:`Checking…`,tone:`neutral`}:Y.unknown}function ie(e,t){return e===`unknown`||t&&!e}function ae({provider:e,state:t,current:n,statusIsError:r}){return t===`not-installed`?(0,J.jsxs)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:[`Install `,e.displayName,`, then run `,(0,J.jsx)(`code`,{children:e.loginCommand}),`.`]}):ie(t,r)?(0,J.jsx)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:`Verification failed. Check again when the provider is available.`}):n?.hint?(0,J.jsx)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:n.hint}):null}function oe({provider:e,state:t,current:n,isConnecting:r,incidentId:i,refresh:a,connect:o,retry:s,queueToggle:c}){let l=t===`disconnected`||t===`unknown`,u=H();return(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[t===`not-installed`?null:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(U,{saved:u.saved}),(0,J.jsx)(k,{checked:n?.enabled??!0,"aria-label":`Use ${e.displayName}`,onCheckedChange:t=>c(e.id,t,u.flash)})]}),l?(0,J.jsx)(O,{type:`button`,variant:`ghost`,size:`sm`,disabled:a.isPending,onClick:()=>a.mutate(void 0,{onError:e=>w(e.message,{tone:`danger`})}),children:`Check again`}):null,t===`disconnected`&&e.browserLogin?(0,J.jsx)(z,{provider:e.id,label:e.displayName}):null,t===`disconnected`&&e.terminalLogin!==!1?(0,J.jsx)(O,{type:`button`,variant:`outline`,size:`sm`,disabled:o.isPending,onClick:()=>o.mutate(e.id),children:r?`Opening…`:`Connect`}):null,i===void 0?null:(0,J.jsx)(O,{type:`button`,variant:`outline`,size:`sm`,disabled:s.isPending,onClick:()=>s.mutate({provider:e.id,authFailureId:i},{onSuccess:()=>w(`${e.displayName} can be tried again.`),onError:e=>w(e.message,{tone:`danger`})}),children:`Try again`})]})}function se({manual:e,provider:t,connected:n,onCopy:r}){return e===null||e.provider!==t||n?null:(0,J.jsxs)(`div`,{role:`region`,"aria-label":`${e.label} manual sign-in`,className:`rounded-md border border-pending/40 bg-pending/5 px-3.5 py-3`,children:[(0,J.jsx)(`p`,{className:`text-[13px] text-foreground`,children:e.message}),(0,J.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2`,children:[(0,J.jsx)(`code`,{className:`min-w-0 flex-1 overflow-x-auto rounded-sm bg-muted px-2 py-1.5 text-xs`,children:e.command}),(0,J.jsx)(O,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void r(e.command),children:`Copy command`})]})]})}function ce(){let e=h(),t=o(),n=v(),r=m(),i=T(),[a,s]=(0,q.useState)(null),d=(0,q.useRef)(Promise.resolve()),f=(0,q.useRef)({}),_=(0,q.useRef)({}),y=(0,q.useRef)(t.data);(0,q.useEffect)(()=>{a&&x(t.data,a.provider)?.status===`connected`&&s(null)},[a,t.data]),(0,q.useEffect)(()=>{if(t.data){if(Object.values(_.current).every(e=>e===0)||!y.current){y.current=t.data;return}y.current={providers:t.data.providers.map(e=>({...e,enabled:(_.current[e.provider]??0)>0?x(y.current,e.provider)?.enabled??e.enabled:e.enabled}))}}},[t.data]);let b=(0,q.useCallback)((e,t,n)=>{let r=c.providerStatus,a=i.getQueryData(r);if(!a)return;y.current||=a;let o=X(a,e,t);_.current[e]=(_.current[e]??0)+1,i.setQueryData(r,o);let s=(f.current[e]??0)+1;f.current[e]=s,d.current=d.current.then(async()=>{try{let a=await E(e,t),o=x(a,e)?.enabled;if(o===void 0)return;if(y.current=X(y.current??a,e,o),s===f.current[e]){let t=i.getQueryData(r);i.setQueryData(r,t?X(t,e,o):a),n()}}catch(t){if(s===f.current[e]){let n=x(y.current,e)?.enabled,a=i.getQueryData(r);a&&n!==void 0?i.setQueryData(r,X(a,e,n)):y.current?i.setQueryData(r,y.current):i.removeQueries({queryKey:r,exact:!0}),w(t instanceof Error?t.message:String(t),{tone:`danger`})}}finally{_.current[e]=(_.current[e]??0)-1}})},[i]),C=g({mutationFn:e=>ee(e),onSuccess:async(e,t)=>{s(null),w(e.opened?`Finish signing in in the terminal, then check again.`:`Provider is already connected.`),await i.invalidateQueries({queryKey:c.providerStatus}),await p(i,t,`none`)},onError:(t,n)=>{if(t instanceof S&&t.command){let r=u(e.data,n);s({provider:n,label:r,message:t.message,command:t.command});return}w(t.message,{tone:`danger`})}}),D=async e=>{try{await navigator.clipboard.writeText(e),w(`Command copied`)}catch{w(`Could not copy the command`,{tone:`danger`})}};return(0,J.jsxs)(`section`,{id:`providers`,"data-slot":`provider-settings`,className:`scroll-mt-20`,children:[(0,J.jsxs)(`div`,{className:`mb-2`,children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Providers`}),(0,J.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Connect the coding agents available on this computer.`})]}),t.isError?(0,J.jsxs)(`div`,{role:`alert`,className:`mb-3 flex flex-wrap items-center justify-between gap-2 rounded-md border border-danger/30 bg-danger/5 px-3 py-2.5`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`p`,{className:`text-[13px] font-medium text-foreground`,children:`Provider status could not be loaded`}),(0,J.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t.error.message})]}),(0,J.jsx)(O,{type:`button`,variant:`outline`,size:`sm`,disabled:t.isFetching,onClick:()=>void t.refetch(),children:`Retry`})]}):null,(0,J.jsx)(`div`,{className:`flex flex-col gap-2`,children:l(e.data).map(e=>{let i=x(t.data,e.id),o=i?.status,s=re(o,t.isPending),c=C.isPending&&C.variables===e.id,l=i?.authFailureId;return(0,J.jsxs)(q.Fragment,{children:[(0,J.jsxs)(`div`,{"data-slot":`provider-card`,"data-provider":e.id,className:`rounded-md border border-border bg-card px-3.5 py-3`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`h3`,{className:`text-[13px] font-semibold text-foreground`,children:e.displayName}),(0,J.jsxs)(`div`,{className:`mt-1 flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,J.jsx)(A,{tone:s.tone,pulse:t.isPending}),(0,J.jsx)(`span`,{children:s.label}),i?.enabled===!1?(0,J.jsx)(`span`,{children:`Disabled`}):null]}),(0,J.jsx)(ae,{provider:e,state:o,current:i,statusIsError:t.isError})]}),(0,J.jsx)(oe,{provider:e,state:o,current:i,isConnecting:c,incidentId:l,refresh:n,connect:C,retry:r,queueToggle:b})]}),l===void 0?null:(0,J.jsx)(`p`,{className:`mt-2 text-xs text-soft-foreground`,children:`Use this after completing the provider sign-in flow. Squawk cannot validate the credential without a task/model request; it will verify it on the next task.`})]}),(0,J.jsx)(se,{manual:a,provider:e.id,connected:o===`connected`,onCopy:D})]},e.id)})})]})}var Z=2e4;function le(){let e=f(),t=h(),n=d(i(t.data)),r=o();return e.isPending?(0,J.jsx)(`p`,{"data-slot":`agents-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading agent settings…`}):e.isError?(0,J.jsx)(M,{icon:(0,J.jsx)(D,{}),tone:`danger`,title:`Agent settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,J.jsx)(ue,{config:e.data,catalogs:n,providerStatus:r,runners:t.data})}function ue({config:e,catalogs:t,providerStatus:n,runners:r}){let i=a(),o=T(),c=g({mutationFn:e=>b(e),onSuccess:e=>{o.setQueryData(s.config,e),o.invalidateQueries({queryKey:s.health}),o.invalidateQueries({queryKey:s.repo})},onError:e=>w(e.message,{tone:`danger`})}),[u,d]=K(e.systemPrompt??``),f=u.trim(),p=f===(e.systemPrompt??``),m=f.length>Z;G({dirty:!p,invalid:m,busy:c.isPending,save:()=>c.mutateAsync({systemPrompt:f===``?null:f}),discard:()=>d(e.systemPrompt??``)});let h=H(),_=H(),v=H(),y=H(),x=H(),S=(e,t)=>c.mutate(e,{onSuccess:t});return(0,J.jsxs)(`div`,{"data-slot":`agent-defaults-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,J.jsx)(Q,{defaultRunner:e.defaultRunner,providerStatus:n,saving:c.isPending,saved:h.saved,onSaved:h.flash,onPick:e=>S({defaultRunner:e},h.flash)}),(0,J.jsx)(W,{wide:!0,title:`Default model`,hint:e.modelsLocked?`Models are locked to the defaults configured in the native coding-agent settings.`:`The model preselected in the composer for each runner. Runner default lets the runner decide per task.`,saved:e.modelsLocked?void 0:_.saved,children:(0,J.jsx)(`div`,{"data-slot":`agents-model-rows`,className:`flex flex-col gap-2.5`,children:l(r).map(i=>{let{providerConnected:a,providerReason:o}=ne(n,i.id),s=t[i.id],l=I(i.id,r,s),u=F(i.id,r,s?.data,[e.defaultModels[i.id]]),d=e.defaultModels[i.id]??``,f=u.find(e=>e.id===d)?.label??d??`Runner default`;return(0,J.jsxs)(`label`,{className:`settings-option-row`,children:[(0,J.jsx)(`div`,{children:(0,J.jsx)(`h3`,{children:i.displayName})}),e.modelsLocked?(0,J.jsx)(`output`,{"aria-label":`Default model for ${i.pickerLabel}`,"data-slot":`agents-model`,"data-runner":i.id,title:`Model selection is locked to native coding-agent settings.`,className:`block rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs`,children:f}):(0,J.jsx)(L,{"aria-label":`Default model for ${i.pickerLabel}`,"data-slot":`agents-model`,"data-runner":i.id,value:d,title:o??i.pickerDescription,disabled:c.isPending||!a,onValueChange:e=>S({defaultModels:{[i.id]:e||null}},_.flash),className:`settings-select max-w-full bg-card`,options:[...u.map(e=>({value:e.id,label:e.label})),...l?[{value:P,label:l,disabled:!0}]:[]]})]},i.id)})})}),(0,J.jsxs)(W,{wide:!0,title:`System prompt`,hint:`Extra instructions for every run in this project.`,reportsDirty:!0,children:[(0,J.jsx)(te,{"aria-label":`System prompt`,"data-slot":`agents-system-prompt`,value:u,onChange:e=>d(e.target.value),placeholder:`Extra rules for every agent run — conventions, tone, review requirements…`,className:`min-h-48 w-full`}),(0,J.jsx)(de,{length:f.length,overLimit:m})]}),(0,J.jsxs)(`section`,{"data-slot":`agents-task-runs`,className:`settings-field flex flex-col gap-5`,children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Task runs`}),(0,J.jsx)($,{title:`Live title updates`,hint:`Refresh a task's short title through the namer model as the run progresses. A manual rename always wins and stops updates for that task.`,saved:v.saved,children:(0,J.jsxs)(`label`,{className:`flex w-fit items-center gap-3`,children:[(0,J.jsx)(k,{"aria-label":`Live title updates`,"data-slot":`agents-live-title-updates`,checked:e.liveTitleUpdates??!0,disabled:c.isPending,onCheckedChange:e=>S({liveTitleUpdates:e},v.flash)}),(0,J.jsxs)(`span`,{className:`text-[13px] text-muted-foreground`,children:[e.liveTitleUpdates??!0?`On`:`Off`,e.liveTitleUpdates===null&&` (default)`]})]})}),(0,J.jsx)($,{title:`Review changes before finishing`,hint:`When on, a task with changes pauses so you can Accept, Send back, or open a Draft PR. Autonomous tasks always skip this and finish on their own. Default: off — tasks finish without asking.`,saved:y.saved,children:(0,J.jsxs)(`label`,{className:`flex w-fit items-center gap-3`,children:[(0,J.jsx)(k,{"aria-label":`Review changes before finishing`,"data-slot":`agents-review-gate`,checked:e.reviewGate??!1,disabled:c.isPending,onCheckedChange:e=>S({reviewGate:e},y.flash)}),(0,J.jsxs)(`span`,{className:`text-[13px] text-muted-foreground`,children:[e.reviewGate??!1?`On`:`Off`,e.reviewGate===null&&` (default)`]})]})}),(0,J.jsx)($,{title:`Base branch`,hint:`New task worktrees branch from this and draft PRs target it. Also settable from the Git view.`,saved:x.saved,children:i.data?.info?(0,J.jsx)(L,{"aria-label":`Base branch`,"data-slot":`agents-base-branch`,value:e.baseBranch??``,disabled:c.isPending,onValueChange:e=>S({baseBranch:e||null},x.flash),className:`settings-select max-w-full bg-card`,options:[{value:``,label:`follow checked-out branch (default)`},...i.data.branches.map(e=>({value:e,label:e}))]}):(0,J.jsx)(`p`,{"data-slot":`agents-base-branch-unavailable`,className:`text-[13px] text-soft-foreground`,children:i.isPending?`Loading branches…`:`Not a git repository — tasks run in place, no branching.`})})]}),(0,J.jsxs)(`details`,{className:`settings-disclosure`,children:[(0,J.jsx)(`summary`,{children:`Provider connections`}),(0,J.jsx)(ce,{})]})]})}function Q({defaultRunner:e,providerStatus:t,saving:n,saved:i,onSaved:o,onPick:s}){let c=_(),l=y(),u=C(),d=a(),f=r(),p=u.projectId??`default`,m=d.data?.info?.root,g=j(c.data,u.projectId,m),v=h().data,b=B(c.data?.profiles??[],v),S=R(b,v);return(0,J.jsxs)(W,{title:`Default runner`,hint:`Project defaults. A task can override these choices.`,saved:i,children:[(0,J.jsx)(V,{rows:b,runner:e,accountFor:e=>g?.[e]??null,providerStatus:t,disabled:n,accountDisabled:f.isPending||l.data===void 0,onPick:(t,n,r)=>{t!==e&&s(t),r&&f.mutate({projectId:p,provider:t,profileId:n},{onSuccess:o,onError:e=>w(e.message,{tone:`danger`})})}}),!t.isPending&&!t.isError&&x(t.data,e)?.enabled===!1?(0,J.jsx)(`p`,{"data-slot":`agents-runner-disabled`,className:`text-[13px] text-muted-foreground`,children:`This provider is disabled. Enable it above or choose another provider.`}):null,S?(0,J.jsx)(`p`,{className:`max-w-md text-[13px] text-muted-foreground`,children:`The account is personal and never committed. Tasks already started under another account can’t be resumed here — their sessions live in that account’s folder.`}):null]})}function $({title:e,hint:t,saved:n,children:r}){return(0,J.jsxs)(`section`,{className:`settings-option-row`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h3`,{children:e}),(0,J.jsxs)(`p`,{children:[t,` `,(0,J.jsx)(U,{saved:n})]})]}),r]})}function de({length:e,overLimit:t}){return(0,J.jsx)(J.Fragment,{children:t?(0,J.jsxs)(`p`,{"data-slot":`agents-prompt-limit`,className:`text-xs text-danger`,children:[e.toLocaleString(),` characters — the limit is `,Z.toLocaleString(),`.`]}):(0,J.jsx)(`p`,{"data-slot":`agents-prompt-help`,className:`text-xs text-muted-foreground`,children:`Leave empty and save to clear. Applied to new runs only.`})})}export{le as AgentDefaultsSection};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Nn as e,On as t}from"./toaster-zMN8cNZQ.js";function n(n){return t[e(n).bucket]<=t.waiting}export{n as t};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{o as r}from"./dist-C_rn70hE.js";import{en as i,g as a,k as o,nn as s,on as c,tn as l}from"./queries-CchoEEzj.js";import{H as u,Kr as d,Rn as f,U as p,V as m,W as h,_ as g,ai as _,ar as v,c as y,cr as b,d as x,g as ee,ii as te,o as ne,s as re,sr as ie,ur as ae,v as oe}from"./toaster-zMN8cNZQ.js";import{B as S,G as se,H as C,I as w,K as ce,N as T,P as E,V as le,W as D,j as O,z as k}from"./live-protocol-DMhTnCmf.js";import{h as ue,n as de}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{r as fe,t as A}from"./label-feCJ3WOT.js";import{L as pe,X as me,Z as he,b as ge,ft as _e,ht as ve,nt as ye,ot as be,u as xe}from"./design-icons-QbNMZniQ.js";import{t as Se}from"./check-OP-CVgZG.js";import{t as j}from"./button-B22ANdCY.js";import{n as Ce,r as we,t as Te}from"./collapsible-Bx2vViFx.js";import{a as M,i as N,n as P,r as Ee,t as De}from"./select-DdH25sWT.js";import{t as Oe}from"./switch-CAKeV99j.js";import{c as ke,s as Ae,t as F}from"./project-router-j0uBi7Ep.js";import{c as I,d as L,f as je,l as Me,n as Ne,o as Pe}from"./page-shell-BgabWJ3w.js";import{a as Fe}from"./agent-accounts-D_7QcFSx.js";import{r as Ie}from"./agents-settings-path-7X6_cvUg.js";import{t as Le}from"./centered-state-BgSV4e79.js";import{$ as Re,Cr as ze,F as Be,I as Ve,Jn as He,Mn as Ue,On as We,P as Ge,V as Ke,et as qe,nt as Je,qn as Ye,r as Xe,t as Ze,ur as R}from"./index-DJB0lid-.js";import{t as Qe}from"./textarea-vEsJAUAV.js";import{_ as $e,a as et,c as tt,d as nt,f as rt,g as it,h as at,i as ot,l as st,m as ct,n as lt,o as ut,p as dt,r as ft,s as pt,t as z,u as mt,v as ht}from"./automation-format-DB34jUyF.js";var B=e(t(),1),V=O([`pull_request.opened`,`issue.opened`,`issue.labeled`,`issue.unlabeled`]),gt=S({includeExisting:E().optional(),authors:T(D()).optional(),assignees:T(D()).optional(),requireCurrentLabels:E().optional(),allLabels:T(D()).optional(),anyLabels:T(D()).optional(),excludeLabels:T(D()).optional(),changedLabels:T(D()).optional(),lookbackDays:k(),maxRecords:k()}),_t=O([`github`,`schedule`]),vt=v.omit({task:!0,images:!0,systemPrompt:!0}).extend({prompt:D(),variants:se([w(1),w(2),w(3)]).optional(),systemPrompt:D().optional()}),yt=S({at:D(),outcome:O([`launched`,`cancelled`]),runId:D().optional(),receiptId:D().optional(),trigger:O([`schedule`,`late`,`manual`,`retry`]).optional()}),H=S({id:D(),revision:k(),name:D(),description:D().optional(),enabled:E(),kind:_t,events:T(V).optional(),intervalSeconds:k().optional(),filters:gt.optional(),schedule:tt.optional(),task:vt,archived:yt.optional(),createdAt:D(),updatedAt:D()}),U=S({timestamp:D(),tieBreaker:D().optional()}),bt=S({since:D().datetime(),until:D().datetime(),source:k().int().min(0).max(2),page:k().int().min(1).max(10),item:k().int().min(0).max(100),event:k().int().min(0).max(1e3),cursor:U.optional()}),xt={lastError:D().max(1e3).optional(),lastErrorAt:D().datetime().optional()},St=S({revision:k().optional(),baselineAt:D().optional(),armedAt:D().optional(),historyScan:bt.optional(),cursor:U.optional(),frozenHighWatermark:U.extend({tieBreaker:D()}).optional(),backlogAfter:U.extend({tieBreaker:D()}).optional(),nextCheckAt:D().optional(),lastSuccessAt:D().optional(),nextRunAt:D().optional(),lastRunAt:D().optional(),etags:C(D(),D()).optional(),backoffUntil:D().optional(),consecutiveFailures:k().optional(),...xt,onceOutcome:O([`failed`,`missed`]).optional()});function Ct(e){let t=e?.consecutiveFailures??0;if(!(t<3||!e?.lastError))return{consecutiveFailures:t,lastError:e.lastError,...e.lastErrorAt?{lastErrorAt:e.lastErrorAt}:{},...e.backoffUntil?{retryAt:e.backoffUntil}:{}}}var wt=O([`launched`,`no-match`,`duplicate`,`rate-limited`,`error`,`baseline`,`preview`,`skipped`,`manual`,`catch-up`,`failed`,`missed`]),Tt=S({seq:k(),ts:D(),automationId:D(),revision:k(),event:V.optional(),result:wt,reason:D().optional(),durationMs:k().optional(),receiptId:D().optional(),runId:D().optional(),githubNumber:k().optional(),githubTitle:D().optional(),githubUrl:D().optional(),rateLimit:S({bucket:O([`core`,`search`]),remaining:k().optional(),resetAt:D().optional()}).optional()}),Et=S({matches:k(),launched:k(),duplicates:k(),errors:k()}),Dt=H.extend({state:St.optional(),latestLog:Tt.optional(),counts:Et,nextRunAt:D().optional(),onceStatus:dt.optional()});S({available:E(),reason:D().optional(),timeZone:D(),scheduler:S({state:O([`scheduled`,`idle`]),nextDue:D().optional()}),automations:T(Dt)}),S({automation:H}).extend({once:S({dueAt:D(),timeZone:D(),resolvedInstant:D(),note:D()}).optional()}),S({automation:H,state:St.optional(),latestLog:Tt.optional(),onceStatus:dt.optional()}),S({id:D(),automationId:D(),mode:O([`preview`,`execute`]),status:O([`queued`,`running`,`complete`,`error`]),createdAt:D(),completedAt:D().optional(),matches:k().optional(),truncated:E().optional(),error:D().optional()}),S({checkId:D()}),S({records:T(Tt)}),S({receiptId:D(),runId:D()}),S({runId:D()}),H.omit({id:!0,revision:!0,createdAt:!0,updatedAt:!0,enabled:!0,kind:!0,archived:!0}).extend({kind:_t.optional(),task:vt.omit({variants:!0}).strict(),enable:E().optional()}).omit({enable:!0}).extend({enabled:E().optional(),expectedRevision:k()}),S({archived:O([`include`,`only`]).optional()}),S({mode:O([`preview`,`execute`])});var W=n();function G({text:e}){return(0,W.jsx)(`div`,{role:`status`,className:`rounded-xl border border-border bg-card p-6 text-sm text-muted-foreground`,children:e})}var Ot={launched:`success`,manual:`success`,"catch-up":`success`,skipped:`neutral`,missed:`pending`,"no-match":`neutral`,preview:`neutral`,baseline:`neutral`,duplicate:`neutral`,failed:`danger`,error:`danger`,"rate-limited":`danger`},kt={launched:`Launched`,manual:`Manual`,"catch-up":`Catch up`,skipped:`Skipped`,missed:`Missed`,"no-match":`No match`,preview:`Preview`,baseline:`Baseline`,duplicate:`Duplicate`,failed:`Failed`,error:`Error`,"rate-limited":`Rate limited`};function At(e){let[t,n]=(0,B.useState)(),[r,i]=(0,B.useState)(``),a=(0,B.useCallback)(t=>g(e,{signal:t}).then(({records:e})=>{t?.aborted||(n(e),i(``))}).catch(e=>{t?.aborted||i(String(e))}),[e]);return(0,B.useEffect)(()=>{a()},[a]),(0,B.useEffect)(()=>d(a),[a]),(0,B.useEffect)(()=>fe((t,n)=>{t===`automation-change`&&n.automationId===e&&a()}),[e,a]),{records:t,error:r,refresh:a}}function jt(e,t){return e.result!==`failed`&&e.result!==`error`||!e.receiptId||e.runId?!1:!t.some(t=>t.receiptId===e.receiptId&&(t.runId||t.seq>e.seq))}function Mt({records:e,all:t,timeZone:n,onRetried:r,readOnly:i=!1}){let a=e=>!i&&jt(e,t),[o,s]=(0,B.useState)(),[c,l]=(0,B.useState)(),u=Date.now(),d=async e=>{s(e),l(void 0);try{await m(e),r()}catch(t){l({receiptId:e,message:t instanceof Error?t.message:String(t)})}finally{s(void 0)}};return(0,W.jsx)(`ol`,{className:`grid gap-3`,"aria-label":`Automation execution log`,children:e.map(e=>(0,W.jsxs)(`li`,{className:`min-w-0 rounded-xl border border-card-edge bg-card p-4 shadow-card`,children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,W.jsx)(Xe,{dot:Ot[e.result],children:kt[e.result]}),(0,W.jsx)(`time`,{className:`text-xs text-muted-foreground`,dateTime:e.ts,title:e.ts,children:lt(e.ts,n,u)})]}),e.reason?(0,W.jsx)(`p`,{className:`mt-2 text-sm break-words text-muted-foreground`,children:e.reason}):null,e.githubUrl||e.runId||a(e)?(0,W.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-4 gap-y-2 text-sm`,children:[e.githubUrl?(0,W.jsx)(`a`,{className:`inline-flex min-h-11 items-center underline underline-offset-4 break-all`,href:e.githubUrl,target:`_blank`,rel:`noreferrer`,children:e.githubTitle??`GitHub #${e.githubNumber??``}`}):null,e.runId?(0,W.jsx)(F,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:`/tasks/${e.runId}`,children:`Open task`}):null,a(e)?(0,W.jsx)(j,{variant:`outline`,disabled:o===e.receiptId,onClick:()=>void d(e.receiptId),children:`Retry task`}):null]}):null,c&&c.receiptId===e.receiptId?(0,W.jsx)(`p`,{role:`alert`,className:`mt-2 text-sm break-words text-destructive`,children:c.message}):null]},e.seq))})}var K=`all`;function Nt({label:e,value:t,onChange:n,options:r}){return(0,W.jsxs)(De,{value:t,onValueChange:n,children:[(0,W.jsx)(N,{"aria-label":e,className:`w-full sm:w-52`,children:(0,W.jsx)(M,{})}),(0,W.jsx)(P,{children:r.map(e=>(0,W.jsx)(Ee,{value:e.value,children:e.label},e.value))})]})}function Pt({automationId:e,automationName:t,timeZone:n,readOnly:r=!1}){let{records:i,error:a,refresh:o}=At(e),[s,c]=(0,B.useState)(K),[l,u]=(0,B.useState)(K),d=(0,B.useMemo)(()=>(i??[]).filter(e=>(s===K||e.result===s)&&(l===K||e.event===l)),[i,s,l]),f=(i??[]).some(e=>e.event);return(0,W.jsx)(Me,{route:`automations`,density:i?je(d.length):`full`,header:{title:`Execution log`,subtitle:t??`Automation activity`,secondaryActions:(0,W.jsx)(I,{variant:`outline`,asChild:!0,children:(0,W.jsx)(F,{to:`/automations`,children:`Back to automations`})})},children:a&&!i?(0,W.jsxs)(`div`,{className:`grid justify-items-start gap-3`,children:[(0,W.jsx)(G,{text:a}),(0,W.jsx)(j,{variant:`outline`,onClick:()=>void o(),children:`Retry`})]}):i?i.length===0?(0,W.jsx)(G,{text:`Nothing has run yet.`}):(0,W.jsxs)(`div`,{className:`grid gap-4`,children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,W.jsx)(Nt,{label:`Result`,value:s,onChange:c,options:[{value:K,label:`All results`},...wt.options.map(e=>({value:e,label:kt[e]}))]}),f?(0,W.jsx)(Nt,{label:`Event`,value:l,onChange:u,options:[{value:K,label:`All events`},...V.options.map(e=>({value:e,label:e}))]}):null]}),d.length===0?(0,W.jsx)(G,{text:`No rows match these filters.`}):(0,W.jsx)(Mt,{records:d,all:i,timeZone:n,onRetried:()=>void o(),readOnly:r})]}):(0,W.jsx)(G,{text:`Loading execution log…`})})}function Ft({automationId:e,automationName:t,timeZone:n,showName:r=!1,readOnly:i=!1}){let{records:a,error:o,refresh:s}=At(e),c=`Recent activity${r&&t?` · ${t}`:``}`;return!o&&a&&a.length===0?(0,W.jsxs)(`section`,{"data-slot":`automation-inline-log`,className:`flex flex-wrap items-center gap-x-2 border-t border-border pt-2.5 text-xs text-muted-foreground`,children:[(0,W.jsx)(`h3`,{className:`font-medium text-foreground`,children:c}),(0,W.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,W.jsx)(`p`,{children:`Nothing has run yet.`})]}):(0,W.jsxs)(`section`,{"data-slot":`automation-inline-log`,className:`min-w-0 border-t border-border pt-2.5`,children:[(0,W.jsx)(`h3`,{className:`mb-1.5 text-xs font-medium text-muted-foreground`,children:c}),o&&!a?(0,W.jsxs)(`div`,{className:`grid justify-items-start gap-2`,children:[(0,W.jsx)(G,{text:o}),(0,W.jsx)(j,{variant:`outline`,onClick:()=>void s(),children:`Retry`})]}):a?(0,W.jsx)(Mt,{records:a.slice(0,5),all:a,timeZone:n,onRetried:()=>void s(),readOnly:i}):(0,W.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Loading activity…`})]})}function It({automation:e,timeZone:t,onDeleted:n}){let r=e.archived,i=e.schedule,a=i?ft(i):null,[o,s]=(0,B.useState)(!1),[c,l]=(0,B.useState)(!1),[u,d]=(0,B.useState)(``),f=(0,B.useRef)(null),p=(0,B.useRef)(null),m=(0,B.useRef)(null);(0,B.useEffect)(()=>{let e=m.current===`keep`?p.current:m.current===`delete`?f.current:null;m.current=null,e?.focus()},[o]);let h=async()=>{l(!0);try{await x(e.id),n()}catch(e){d(e instanceof Error?e.message:String(e)),l(!1)}},g=[[`Workflow`,e.task.workflow],[`Runner`,e.task.runner],[`Model`,e.task.model],[`Effort`,e.task.effort]];return(0,W.jsx)(Me,{route:`automations`,density:`sparse`,header:{title:e.name,subtitle:`Archived one-time schedule. It cannot change; delete it when you no longer need the record.`},children:(0,W.jsxs)(`div`,{className:`grid min-w-0 gap-5`,children:[(0,W.jsxs)(`section`,{className:`min-w-0 rounded-xl border border-card-edge bg-card shadow-card p-4`,children:[(0,W.jsxs)(`p`,{className:`text-sm break-words`,children:[(0,W.jsx)(`span`,{children:r.outcome===`launched`?`Started its task.`:`Cancelled — no task was started.`}),r.runId?(0,W.jsxs)(W.Fragment,{children:[` · `,(0,W.jsx)(F,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:`/tasks/${r.runId}`,children:`Open task`})]}):null]}),(0,W.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Archived ${z(r.at,t)} (${t}).`}),a&&i?.timeZone?(0,W.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Was due ${a.date} ${a.time} (${i.timeZone}).`}):null]}),(0,W.jsxs)(`section`,{"aria-labelledby":`archived-inputs`,className:`min-w-0 rounded-xl border border-card-edge bg-card shadow-card p-4`,children:[(0,W.jsx)(`h2`,{id:`archived-inputs`,className:`mb-3 text-[15px] font-medium`,children:`What it ran with`}),(0,W.jsxs)(`dl`,{className:`grid gap-3 text-sm`,children:[(0,W.jsxs)(`div`,{className:`grid gap-1`,children:[(0,W.jsx)(`dt`,{className:`text-muted-foreground`,children:`Prompt`}),(0,W.jsx)(`dd`,{className:`break-words whitespace-pre-wrap`,children:e.task.prompt})]}),g.filter(([,e])=>e).map(([e,t])=>(0,W.jsxs)(`div`,{className:`grid gap-1`,children:[(0,W.jsx)(`dt`,{className:`text-muted-foreground`,children:e}),(0,W.jsx)(`dd`,{className:`break-words`,children:t})]},e))]})]}),(0,W.jsxs)(`section`,{className:`min-w-0`,children:[(0,W.jsx)(Ft,{automationId:e.id,automationName:e.name,timeZone:t,readOnly:!0}),(0,W.jsx)(j,{variant:`outline`,asChild:!0,className:`mt-3`,children:(0,W.jsx)(F,{to:`/automations/${e.id}/log`,children:`Execution log`})})]}),(0,W.jsxs)(`div`,{className:`grid justify-items-start gap-2`,children:[o?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`p`,{className:`text-sm break-words`,children:`Delete “${e.name}”? Its record and log are removed; the task stays.`}),(0,W.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,W.jsx)(j,{variant:`danger-ghost`,"data-action":`automation-delete-confirm`,disabled:c,onClick:()=>void h(),children:`Delete schedule`}),(0,W.jsx)(j,{ref:p,variant:`outline`,disabled:c,onClick:()=>{m.current=`delete`,s(!1)},children:`Keep`})]})]}):(0,W.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,W.jsx)(j,{ref:f,variant:`outline`,"data-action":`automation-delete`,onClick:()=>{m.current=`keep`,s(!0)},children:`Delete`}),(0,W.jsx)(j,{variant:`outline`,asChild:!0,children:(0,W.jsx)(F,{to:`/automations`,children:`Back to automations`})})]}),u?(0,W.jsx)(`p`,{role:`alert`,className:`text-sm break-words text-destructive`,children:u}):null]})]})})}var Lt=O([`pull_request.opened`,`issue.opened`,`issue.labeled`,`issue.unlabeled`]),q=T(D().trim().min(1).max(200)).max(100).optional(),Rt=S({includeExisting:E().optional(),requireCurrentLabels:E().optional(),authors:q,assignees:q,allLabels:q,anyLabels:q,excludeLabels:q,changedLabels:q,lookbackDays:k().int().min(1).max(90).default(7),maxRecords:k().int().min(1).max(100).default(25)}).passthrough(),zt=S({prompt:D().min(1).max(1e5),workflow:D().trim().min(1).max(200).optional(),steps:T(ie).min(1).max(100).optional(),runner:te.optional(),model:D().trim().min(1).max(200).optional(),effort:D().trim().min(1).max(32).optional(),variants:se([w(1),w(2),w(3)]).optional(),worktree:E().optional(),autonomous:E().optional(),...b,...ae,systemPrompt:D().max(1e5).optional()}).passthrough().refine(e=>!(e.workflow&&e.steps),{message:`task selects either a named workflow or inline steps, not both`}),Bt=new Set(Object.keys(zt.shape).filter(e=>e!==`variants`));function Vt(e){return Object.fromEntries(Object.entries(e).filter(([e])=>Bt.has(e)))}le(e=>{if(!e||typeof e!=`object`||Array.isArray(e))return e;let t=e;return t.kind===`schedule`?e:{...t,intervalSeconds:t.intervalSeconds??300,filters:t.filters??{}}},S({id:D().min(1).max(100),revision:k().int().positive(),name:D().trim().min(1).max(200),description:D().max(2e3).optional(),enabled:E().default(!1),kind:_t.default(`github`),events:T(Lt).min(1).max(4).optional(),intervalSeconds:k().int().min(60).max(86400).optional(),filters:Rt.optional(),schedule:tt.passthrough().optional(),task:zt,archived:S({at:D().datetime(),outcome:O([`launched`,`cancelled`]),runId:D().optional(),receiptId:D().optional(),trigger:O([`schedule`,`late`,`manual`,`retry`]).optional()}).passthrough().optional(),createdAt:D().datetime(),updatedAt:D().datetime()}).passthrough().superRefine((e,t)=>{if(e.kind===`schedule`){e.schedule||t.addIssue({code:_.custom,path:[`schedule`],message:`a scheduled automation needs a schedule`});return}e.events?.length||t.addIssue({code:_.custom,path:[`events`],message:`a GitHub automation needs at least one event`}),e.intervalSeconds===void 0&&t.addIssue({code:_.custom,path:[`intervalSeconds`],message:`a GitHub automation needs a poll interval`}),e.filters||t.addIssue({code:_.custom,path:[`filters`],message:`a GitHub automation needs its bounded filter`}),e.events?.some(e=>e===`issue.labeled`||e===`issue.unlabeled`)&&!e.filters?.changedLabels?.length&&t.addIssue({code:_.custom,path:[`filters`,`changedLabels`],message:`changedLabels is required for issue label events`})})),S({version:w(1).default(1),automations:T(ce()).default([]),tombstones:C(D(),D().datetime()).optional()}).passthrough();var J=S({timestamp:D().datetime(),tieBreaker:D().optional()}).passthrough(),Ht=bt.extend({cursor:J.optional()}),Ut=S({revision:k().int().positive().optional(),baselineAt:D().datetime().optional(),armedAt:D().datetime().optional(),historyScan:Ht.optional(),cursor:J.optional(),frozenHighWatermark:J.extend({tieBreaker:D()}).optional(),backlogAfter:J.extend({tieBreaker:D()}).optional(),nextCheckAt:D().datetime().optional(),lastSuccessAt:D().datetime().optional(),nextRunAt:D().datetime().optional(),lastRunAt:D().datetime().optional(),etags:C(D(),D()).optional(),backoffUntil:D().datetime().optional(),consecutiveFailures:k().int().nonnegative().optional(),...xt,onceOutcome:O([`failed`,`missed`]).optional()}).passthrough();S({version:w(1).default(1),states:C(D(),Ut).default({})}).passthrough(),S({receiptId:D().min(1),receiptKey:D().min(1),eventId:D().min(1),automationId:D().min(1),revision:k().int().positive(),status:O([`reserved`,`launched`,`launch-error`,`released`]),runId:D().optional(),observedAt:D().datetime(),updatedAt:D().datetime(),error:D().max(2e3).optional(),occurrenceAt:D().datetime().optional(),candidate:S({eventId:D(),event:Lt,timestamp:D().datetime(),tieBreaker:D(),repo:D(),nodeId:D(),number:k().int().positive(),title:D().max(500),url:D().url(),author:D().max(200),assignees:T(D().max(200)).max(100),labels:T(D().max(200)).max(100),changedLabel:D().max(200).optional()}).passthrough().optional()}).passthrough();var Wt=O([`launched`,`no-match`,`duplicate`,`rate-limited`,`error`,`baseline`,`preview`,`skipped`,`manual`,`catch-up`,`failed`,`missed`]);S({seq:k().int().positive(),ts:D().datetime(),automationId:D().min(1),revision:k().int().positive(),event:Lt.optional(),result:Wt,reason:D().max(2e3).optional(),durationMs:k().int().nonnegative().optional(),receiptId:D().optional(),runId:D().optional(),githubNumber:k().int().positive().optional(),githubTitle:D().max(500).optional(),githubUrl:D().url().optional(),rateLimit:S({bucket:O([`core`,`search`]),remaining:k().int().nonnegative().optional(),resetAt:D().datetime().optional()}).passthrough().optional()}).passthrough();var Gt=`quick-task`;function Kt(e={}){let{prompt:t,workflow:n,runner:r,model:i,autonomous:a,archiveWhenDone:o,autoMergePr:s,allowWorkers:c,allowMessaging:l,...u}=Vt(e.task??{prompt:``}),d=e.task===void 0;return{name:e.name??``,description:e.description??``,kind:e.kind??`schedule`,schedule:mt(e.schedule??{type:`daily`}),events:e.events??[V.options[0]],intervalSeconds:e.intervalSeconds??300,filters:e.filters??{lookbackDays:7,maxRecords:25},prompt:t,...n===void 0?d?{workflow:Gt}:{}:{workflow:n},...r===void 0?{}:{runner:r},...i===void 0?{}:{model:i},autonomous:a??!0,archiveWhenDone:o??!1,autoMergePr:s??!1,allowWorkers:c!==!1,allowMessaging:l!==!1,enabled:e.enabled??e.enable??!1,taskExtra:u}}function qt(e){switch(e.type){case`daily`:case`weekdays`:return{type:e.type,hour:e.hour,minute:e.minute};case`weekly`:return{type:`weekly`,hour:e.hour,minute:e.minute,day:e.day};case`hours`:return{type:`hours`,every:e.every};case`once`:return{type:`once`,at:e.at??``,timeZone:e.timeZone??``,...e.latestStartMinutes===void 0?{}:{latestStartMinutes:e.latestStartMinutes}}}}function Jt(e){return{...e.taskExtra,prompt:e.prompt,...e.workflow?{workflow:e.workflow}:{},...e.runner?{runner:e.runner}:{},...e.model?{model:e.model}:{},autonomous:e.autonomous,...e.archiveWhenDone?{archiveWhenDone:!0}:{},...e.autoMergePr?{autoMergePr:!0}:{},...e.allowWorkers?{}:{allowWorkers:!1},...e.allowMessaging?{}:{allowMessaging:!1}}}function Yt(e){return{name:e.name.trim(),...e.description.trim()?{description:e.description.trim()}:{},kind:e.kind,...e.kind===`schedule`?{schedule:qt(e.schedule)}:{events:e.events,intervalSeconds:e.intervalSeconds,filters:e.filters},task:Jt(e)}}function Xt(e){return{...Yt(e),enable:e.enabled}}function Zt(e,t){return{...Yt(e),task:{...Jt(e),archiveWhenDone:e.archiveWhenDone,autoMergePr:e.autoMergePr,allowWorkers:e.allowWorkers,allowMessaging:e.allowMessaging},enabled:e.enabled,expectedRevision:t}}function Y(e){return`'${e.replace(/'/g,`'\\''`)}'`}var Qt=new Set([`prompt`,`workflow`,`runner`,`model`,`autonomous`,`worktree`,`archiveWhenDone`,`autoMergePr`,`allowWorkers`,`allowMessaging`]),$t=new Set([`anyLabels`,`authors`,`changedLabels`]);function en(e){if(e.description!==void 0||!e.name.trim()||!e.task.prompt.trim())return!1;let t=e.task;if(Object.keys(t).some(e=>!Qt.has(e))||t.archiveWhenDone===!1||t.autoMergePr===!1||t.allowWorkers===!0||t.allowMessaging===!0||t.worktree!==!0)return!1;if(e.kind===`schedule`)return e.schedule!==void 0;let{events:n,filters:r}=e;return!n?.length||n.some(e=>e.includes(`,`))||!r||r.lookbackDays!==7||r.maxRecords!==25?!1:Object.entries(r).every(([e,t])=>e===`lookbackDays`||e===`maxRecords`||e===`includeExisting`&&t===!0||$t.has(e)&&Array.isArray(t)&&t.length>0)}function tn(e){return e%3600==0?`${e/3600}h`:e%60==0?`${e/60}m`:`${e}s`}function nn(e){return e%1440==0?`${e/1440}d`:e%60==0?`${e/60}h`:`${e}m`}function X(e,t){return t.startsWith(`-`)?`--${e}=${Y(t)}`:`--${e} ${Y(t)}`}function rn(e){let t=[`${We()} automation add`,X(`name`,e.name)];if(e.schedule?.type===`once`)t.push(X(`at`,e.schedule.at),X(`tz`,e.schedule.timeZone)),e.schedule.latestStartMinutes!==void 0&&t.push(X(`latest-start`,nn(e.schedule.latestStartMinutes)));else if(e.kind===`schedule`)t.push(X(`cron`,st(e.schedule)));else{t.push(X(`on`,e.events.join(`,`)),`--every ${tn(e.intervalSeconds??300)}`),e.filters?.includeExisting&&t.push(`--include-existing`);for(let n of e.filters?.anyLabels??[])t.push(X(`label`,n));for(let n of e.filters?.authors??[])t.push(X(`author`,n));for(let n of e.filters?.changedLabels??[])t.push(X(`changed-label`,n))}return t.push(...an(e.task)),e.enable===!0&&t.push(`--enable`),t.push(X(`prompt`,e.task.prompt)),t.join(` `)}function an(e){let t=[];return e.workflow&&t.push(X(`workflow`,e.workflow)),e.runner&&t.push(X(`runner`,e.runner)),e.model&&t.push(X(`model`,e.model)),e.autonomous===!1&&t.push(`--no-autonomous`),e.archiveWhenDone&&t.push(`--archive-when-done`),e.autoMergePr&&t.push(`--auto-merge-pr`),e.allowWorkers===!1&&t.push(`--no-workers`),e.allowMessaging===!1&&t.push(`--no-messaging`),t}function on(e,t){let n=Xt(e),r=en(n)?rn(n):`${We()} automation create --json ${Y(JSON.stringify(n))}`;return t?`CEZ_COCKPIT_URL=${Y(t.origin)} CEZ_PROJECT_ID=${Y(t.projectId)} HSQ_COCKPIT_URL=${Y(t.origin)} HSQ_PROJECT_ID=${Y(t.projectId)} ${r}`:r}function sn(e){let t=[],n=!1;for(let r of cn(e)){let e=t.length-1;!n&&/^[A-Z_][A-Z0-9_]*=/.test(r)?t.push(r):r.startsWith(`--`)||!n?(t.push(r),n=!0):t[e]=`${t[e]} ${r}`}return t.map((e,t)=>t===0?e:` ${e}`).join(` \\
|
|
2
|
-
`)}function cn(e){let t=[],n=``,r=!1;for(let i=0;i<e.length;i+=1){let a=e[i];!r&&a===`\\`&&i+1<e.length?(n+=a+e[i+1],i+=1):a===`'`?(r=!r,n+=a):a===` `&&!r?(n&&t.push(n),n=``):n+=a}return n&&t.push(n),t}function ln({draft:e,saveLabel:t,editing:n}){let i=Ae(),a=window.location.origin,o=(0,B.useMemo)(()=>{let t=on(e);return i?`HSQ_COCKPIT_URL=${Y(a)} HSQ_PROJECT_ID=${Y(i)} ${t}`:t},[e,a,i]),s=(0,B.useMemo)(()=>sn(o),[o]),[c,l]=(0,B.useState)(`idle`),[u,d]=(0,B.useState)(!1),f=(0,B.useId)(),p=(0,B.useRef)(void 0);(0,B.useEffect)(()=>()=>clearTimeout(p.current),[]),(0,B.useEffect)(()=>l(`idle`),[o]);let m=async()=>{clearTimeout(p.current);try{await navigator.clipboard.writeText(s),l(`copied`),p.current=setTimeout(()=>l(`idle`),1600)}catch{l(`failed`)}};return(0,W.jsxs)(`section`,{"aria-labelledby":`copy-as-cli-heading`,"data-slot":`copy-as-cli`,className:`min-w-0 max-w-full overflow-hidden rounded-xl border border-card-edge bg-card shadow-card px-4 py-3.5`,children:[(0,W.jsxs)(`div`,{className:`flex min-h-8 min-w-0 flex-nowrap items-center justify-between gap-x-2`,children:[(0,W.jsx)(`h2`,{id:`copy-as-cli-heading`,className:`shrink-0 text-[13px] font-medium text-muted-foreground`,children:`Copy as CLI`}),(0,W.jsxs)(j,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`copy-as-cli-toggle`,"aria-expanded":u,"aria-controls":f,"aria-label":u?`Hide command`:`Show command`,className:`min-w-0 shrink gap-1 px-1.5 text-[12px] font-medium`,onClick:()=>d(e=>!e),children:[(0,W.jsx)(`span`,{className:`truncate`,children:u?`Hide`:`Show`}),(0,W.jsx)(xe,{"aria-hidden":`true`,className:r(`size-3.5 transition-transform`,u&&`rotate-180`)})]}),(0,W.jsxs)(j,{type:`button`,variant:`outline`,size:`sm`,className:`ms-auto gap-1.5 px-2 text-[12px] font-medium`,onClick:()=>void m(),children:[c===`copied`?(0,W.jsx)(Se,{"aria-hidden":`true`,className:`size-3.5`}):(0,W.jsx)(ze,{"aria-hidden":`true`,className:`size-3.5`}),c===`copied`?`Copied`:`Copy`]})]}),(0,W.jsx)(`div`,{id:f,hidden:!u,className:`mbs-2 max-w-full rounded-lg border border-border bg-muted has-[:focus-visible]:outline-2 has-[:focus-visible]:outline-ring`,children:(0,W.jsx)(`pre`,{"data-slot":`copy-as-cli-line`,tabIndex:0,"aria-label":`Command line`,className:`m-0 max-w-full px-3 pt-2.5 pb-3 font-mono text-xs leading-5 break-all whitespace-pre-wrap text-muted-foreground outline-none`,children:s})}),(0,W.jsx)(`p`,{role:`status`,className:`mbs-2 text-xs break-words text-muted-foreground`,children:c===`failed`?`Could not copy — select the line and copy it by hand.`:(0,W.jsxs)(W.Fragment,{children:[`The definition ${t} would ${n?`save`:`create`}.`,` `,(0,W.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-px font-mono text-xs whitespace-nowrap text-foreground [word-spacing:-0.2em]`,children:`${We()} automation schema`}),` prints its shape.`]})})]})}function un({pressed:e,onClick:t,disabled:n,children:i}){return(0,W.jsx)(`button`,{type:`button`,"aria-pressed":e,disabled:n,onClick:t,className:r(`inline-flex min-h-11 items-center justify-center rounded-md border px-3.5 text-[13px] font-medium transition-colors outline-hidden focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50`,e?`border-border bg-card font-semibold text-foreground shadow-xs`:`border-transparent bg-transparent text-muted-foreground hover:text-foreground`),children:i})}var dn={"pull_request.opened":`a pull request opens`,"issue.opened":`an issue opens`,"issue.labeled":`an issue is labeled`,"issue.unlabeled":`an issue is unlabeled`},fn={"pull_request.opened":`Pull request opened`,"issue.opened":`Issue opened`,"issue.labeled":`Issue labeled`,"issue.unlabeled":`Issue unlabeled`};function pn(e){let t=e.map(e=>dn[e]);if(t.length===0)return`When GitHub changes`;let n=t.slice(0,-1),r=t[t.length-1];return`When ${n.length>0?`${n.join(`, `)} or ${r}`:r}`}var mn=V.options,hn=[{seconds:60,label:`1 minute`},{seconds:300,label:`5 minutes`},{seconds:900,label:`15 minutes`},{seconds:1800,label:`30 minutes`},{seconds:3600,label:`1 hour`}],gn=[{key:`authors`,label:`Authors`},{key:`assignees`,label:`Assignees`},{key:`allLabels`,label:`Has all labels`},{key:`anyLabels`,label:`Has any label`},{key:`excludeLabels`,label:`Excludes labels`},{key:`changedLabels`,label:`Changed labels`,hint:`Required for the two label events.`}],_n=e=>(e??[]).join(`, `),vn=e=>e.split(`,`).map(e=>e.trim()).filter(Boolean);function yn(e){return e?`Existing matches within the lookback are eligible on the next check. Previously processed matches will not run again.`:`Enabling starts from a current-time baseline. Existing matches will not launch tasks.`}function bn(e){let t=Math.max(1,Math.round(e.intervalSeconds/60));return`Polls GitHub every ${t} minute${t===1?``:`s`} for ${e.events.join(`, `)||`no events`}. ${yn(e.filters.includeExisting)}`}function xn({draft:e,onChange:t,disabledReason:n}){let r=n=>{t({events:e.events.includes(n)?e.events.filter(e=>e!==n):[...e.events,n]})},i=n=>t({filters:{...e.filters,...n}}),a=(n,r)=>{let i=vn(r),{[n]:a,...o}=e.filters;t({filters:i.length?{...o,[n]:i}:o})},o=hn.some(t=>t.seconds===e.intervalSeconds)?hn:[...hn,{seconds:e.intervalSeconds,label:`${Math.round(e.intervalSeconds/60)} minutes`}].sort((e,t)=>e.seconds-t.seconds);return(0,W.jsxs)(`div`,{className:`grid gap-4`,children:[n?(0,W.jsx)(`p`,{className:`text-xs text-pending-strong`,children:`GitHub unavailable · ${n}`}):null,(0,W.jsx)(`div`,{role:`group`,"aria-label":`GitHub events`,className:`inline-flex w-fit max-w-full flex-wrap gap-1 rounded-lg border border-border bg-muted/60 p-1`,children:mn.map(t=>(0,W.jsx)(un,{pressed:e.events.includes(t),onClick:()=>r(t),children:fn[t]},t))}),(0,W.jsxs)(`div`,{className:`grid gap-2`,children:[(0,W.jsx)(A,{htmlFor:`automation-interval`,children:`Check every`}),(0,W.jsxs)(De,{value:String(e.intervalSeconds),onValueChange:e=>t({intervalSeconds:Number(e)}),children:[(0,W.jsx)(N,{id:`automation-interval`,className:`w-full sm:w-48`,"aria-label":`Check every`,children:(0,W.jsx)(M,{})}),(0,W.jsx)(P,{children:o.map(e=>(0,W.jsx)(Ee,{value:String(e.seconds),children:e.label},e.seconds))})]})]}),(0,W.jsxs)(`div`,{className:`grid gap-2`,children:[(0,W.jsxs)(`label`,{className:`flex min-h-11 items-center gap-3 text-sm`,children:[(0,W.jsx)(Oe,{"aria-label":`Include existing items`,"aria-describedby":`automation-history-hint`,checked:e.filters.includeExisting??!1,onCheckedChange:e=>i({includeExisting:e})}),(0,W.jsx)(`span`,{children:`Include existing items`})]}),(0,W.jsx)(`p`,{id:`automation-history-hint`,className:`text-xs text-muted-foreground`,children:yn(e.filters.includeExisting)})]}),(0,W.jsxs)(Te,{children:[(0,W.jsxs)(we,{className:`group flex min-h-11 items-center gap-2 text-sm font-medium`,children:[`Filters`,(0,W.jsx)(xe,{"aria-hidden":`true`,className:`size-4 text-soft-foreground transition-transform motion-reduce:transition-none group-data-[state=open]:rotate-180`})]}),(0,W.jsx)(Ce,{children:(0,W.jsxs)(`div`,{className:`grid gap-4 pt-2 sm:grid-cols-2`,children:[gn.map(t=>(0,W.jsxs)(`div`,{className:`grid min-w-0 gap-2`,children:[(0,W.jsx)(A,{htmlFor:`automation-filter-${t.key}`,children:t.label}),(0,W.jsx)(R,{id:`automation-filter-${t.key}`,className:`border-border`,placeholder:`comma separated`,value:_n(e.filters[t.key]),onChange:e=>a(t.key,e.target.value)}),t.hint?(0,W.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t.hint}):null]},t.key)),(0,W.jsxs)(`div`,{className:`grid min-w-0 gap-2`,children:[(0,W.jsx)(A,{htmlFor:`automation-filter-lookback`,children:`Look back (days)`}),(0,W.jsx)(R,{id:`automation-filter-lookback`,className:`border-border`,type:`number`,min:1,value:e.filters.lookbackDays,onChange:e=>i({lookbackDays:Math.max(1,Number(e.target.value)||1)})})]}),(0,W.jsxs)(`div`,{className:`grid min-w-0 gap-2`,children:[(0,W.jsx)(A,{htmlFor:`automation-filter-max`,children:`Max records per check`}),(0,W.jsx)(R,{id:`automation-filter-max`,className:`border-border`,type:`number`,min:1,value:e.filters.maxRecords,onChange:e=>i({maxRecords:Math.max(1,Number(e.target.value)||1)})})]})]})})]})]})}var Sn=e=>String(e).padStart(2,`0`);function Z({label:e,value:t,max:n,onCommit:r}){let[i,a]=(0,B.useState)(Sn(t)),o=(0,B.useRef)(null),s=!(/^\d{1,2}$/.test(i)&&Number(i)===t),c=`${e} must be 00–${Sn(n)}.`,l=(0,B.useId)();return(0,B.useEffect)(()=>{o.current?.setCustomValidity(s?c:``)},[s,c]),(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(R,{ref:o,"aria-label":e,"aria-invalid":s||void 0,"aria-describedby":s?l:void 0,inputMode:`numeric`,maxLength:2,className:`w-20 border-border text-center tabular-nums`,value:i,onChange:e=>{a(e.target.value),/^\d{1,2}$/.test(e.target.value)&&Number(e.target.value)<=n&&r(Number(e.target.value))},onBlur:()=>a(Sn(t))}),s?(0,W.jsx)(`p`,{id:l,className:`order-last basis-full text-xs text-destructive`,children:c}):null]})}var Cn=[{minutes:void 0,label:`No limit`},{minutes:30,label:`30 minutes`},{minutes:120,label:`2 hours`},{minutes:360,label:`6 hours`},{minutes:1440,label:`1 day`},{minutes:10080,label:`7 days`}],wn=`none`,Tn=e=>String(e).padStart(2,`0`);function En(e,t=Date.now()){let n=ht(t,e)??ht(t,`UTC`),r=new Date(Date.UTC(n.year,n.month-1,n.day+1));return`${r.getUTCFullYear()}-${Tn(r.getUTCMonth()+1)}-${Tn(r.getUTCDate())}T09:00`}function Dn(){let e=typeof Intl.supportedValuesOf==`function`?Intl.supportedValuesOf(`timeZone`):[];return e.includes(`UTC`)?e:[`UTC`,...e]}function On({value:e,stored:t,onChange:n}){let r=t=>n({...e,...t}),i=e.at?ct(e.at):null,a=e.at?.slice(0,10)??``,o=i?.hour??9,s=i?.minute??0,c=(e,t,n)=>r({at:`${e}T${Tn(t)}:${Tn(n)}`}),l=(0,B.useRef)(null),u=(0,B.useId)(),d=rt(e),f=!(t?.type===`once`&&t.at===e.at&&t.timeZone===e.timeZone)&&d!==null&&d<=Date.now();(0,B.useEffect)(()=>{l.current?.setCustomValidity(f?et:``)},[f]);let p=ft(e);return(0,W.jsxs)(`div`,{className:`grid gap-4`,children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap items-end gap-x-4 gap-y-3`,children:[(0,W.jsxs)(`div`,{className:`grid gap-2`,children:[(0,W.jsx)(A,{htmlFor:`automation-once-date`,children:`Date`}),(0,W.jsx)(R,{ref:l,id:`automation-once-date`,type:`date`,className:`w-44 max-w-full border-border`,value:a,"aria-invalid":f||void 0,"aria-describedby":f?u:void 0,onChange:e=>{/^\d{4}-\d{2}-\d{2}$/.test(e.target.value)&&c(e.target.value,o,s)},required:!0})]}),(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,W.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`at`}),(0,W.jsx)(Z,{label:`Hour`,value:o,max:23,onCommit:e=>c(a,e,s)}),(0,W.jsx)(`span`,{"aria-hidden":`true`,children:`:`}),(0,W.jsx)(Z,{label:`Minute`,value:s,max:59,onCommit:e=>c(a,o,e)})]})]}),f?(0,W.jsx)(`p`,{id:u,className:`text-xs text-destructive`,children:et}):null,(0,W.jsx)(An,{value:e.timeZone??``,onCommit:e=>r({timeZone:e})}),(0,W.jsx)(jn,{value:e.latestStartMinutes,onChange:t=>n(kn(e,t))}),p?(0,W.jsx)(`p`,{className:`text-sm break-words`,children:`Runs once at ${p.time} on ${p.date} (${e.timeZone}). ${p.note?`${p.note} `:``}Squawk must be running then.`}):null]})}function kn(e,t){let{latestStartMinutes:n,...r}=e;return t===void 0?r:{...r,latestStartMinutes:t}}function An({value:e,onCommit:t}){let[n,r]=(0,B.useState)(e),i=(0,B.useRef)(null),a=(0,B.useId)(),o=(0,B.useId)(),[s]=(0,B.useState)(Dn),c=n!==e||!$e(n),l=it(n);return(0,B.useEffect)(()=>{i.current?.setCustomValidity(c?l:``)},[c,l]),(0,W.jsxs)(`div`,{className:`grid gap-2`,children:[(0,W.jsx)(A,{htmlFor:`automation-once-zone`,children:`Time zone`}),(0,W.jsx)(R,{ref:i,id:`automation-once-zone`,list:a,autoComplete:`off`,spellCheck:!1,className:`w-full border-border sm:w-72`,value:n,"aria-invalid":c||void 0,"aria-describedby":c?o:void 0,onChange:e=>{r(e.target.value),$e(e.target.value)&&t(e.target.value)}}),(0,W.jsx)(`datalist`,{id:a,children:s.map(e=>(0,W.jsx)(`option`,{value:e},e))}),c?(0,W.jsx)(`p`,{id:o,className:`text-xs break-words text-destructive`,children:l}):null]})}function jn({value:e,onChange:t}){let n=Cn.some(t=>t.minutes===e)||e===void 0?Cn:[...Cn,{minutes:e,label:`${e} minutes`}];return(0,W.jsxs)(`div`,{className:`grid gap-2`,children:[(0,W.jsx)(A,{htmlFor:`automation-once-latest`,children:`Latest start`}),(0,W.jsxs)(De,{value:e===void 0?wn:String(e),onValueChange:e=>t(e===wn?void 0:Number(e)),children:[(0,W.jsx)(N,{id:`automation-once-latest`,className:`w-full sm:w-48`,"aria-label":`Latest start`,children:(0,W.jsx)(M,{})}),(0,W.jsx)(P,{children:n.map(e=>(0,W.jsx)(Ee,{value:e.minutes===void 0?wn:String(e.minutes),children:e.label},e.label))})]}),(0,W.jsx)(`p`,{className:`text-xs break-words text-muted-foreground`,children:`If Squawk was not running at the time, it still starts the task this long afterwards; later, the schedule is marked missed.`})]})}var Mn=[{type:`daily`,label:`Every day`},{type:`weekdays`,label:`Weekdays`},{type:`weekly`,label:`Weekly`},{type:`hours`,label:`Every N hours`},{type:`once`,label:`Once`}];function Nn({value:e,stored:t,onChange:n,timeZone:r}){let i=t=>n({...e,...t}),a=t=>i(t===`once`?{type:t,at:e.at??En(r),timeZone:e.timeZone??r}:{type:t});return(0,W.jsxs)(`div`,{className:`grid gap-4`,children:[(0,W.jsx)(`div`,{role:`group`,"aria-label":`Repeat`,className:`inline-flex w-fit max-w-full flex-wrap gap-1 rounded-lg border border-border bg-muted/60 p-1`,children:Mn.map(t=>(0,W.jsx)(un,{pressed:e.type===t.type,onClick:()=>a(t.type),children:t.label},t.type))}),e.type===`once`?(0,W.jsx)(On,{value:e,stored:t,onChange:n}):null,e.type===`weekly`?(0,W.jsx)(`div`,{role:`group`,"aria-label":`Day of the week`,className:`inline-flex w-fit max-w-full flex-wrap gap-1 rounded-lg border border-border bg-muted/60 p-1`,children:pt.map((t,n)=>(0,W.jsx)(un,{pressed:e.day===n+1,onClick:()=>i({day:n+1}),children:t},t))}):null,e.type===`once`?null:e.type===`hours`?(0,W.jsxs)(`div`,{className:`grid gap-2`,children:[(0,W.jsx)(A,{htmlFor:`automation-every`,children:`Run every`}),(0,W.jsxs)(De,{value:String(e.every),onValueChange:e=>i({every:Number(e)}),children:[(0,W.jsx)(N,{id:`automation-every`,className:`w-full sm:w-48`,"aria-label":`Run every`,children:(0,W.jsx)(M,{})}),(0,W.jsx)(P,{children:ut.map(e=>(0,W.jsx)(Ee,{value:String(e),children:e===1?`hour`:`${e} hours`},e))})]}),(0,W.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Counted from midnight, so “every 6 hours” runs at 00:00, 06:00, 12:00 and 18:00.`})]}):(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,W.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`at`}),(0,W.jsx)(Z,{label:`Hour`,value:e.hour,max:23,onCommit:e=>i({hour:e})}),(0,W.jsx)(`span`,{"aria-hidden":`true`,children:`:`}),(0,W.jsx)(Z,{label:`Minute`,value:e.minute,max:59,onCommit:e=>i({minute:e})}),(0,W.jsx)(`span`,{className:`text-sm break-all text-muted-foreground`,children:r})]}),e.type===`once`?null:(0,W.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Cron: `,(0,W.jsx)(`code`,{className:`font-mono text-foreground`,children:st(e)})]})]})}var Pn=40*864e5,Fn=5;function In({schedule:e,timeZone:t,now:n=Date.now()}){if(e.type===`once`)return(0,W.jsx)(Ln,{schedule:e,now:n});let r=nt(e,n+1,n+Pn,t,Fn);return(0,W.jsxs)(`section`,{"aria-labelledby":`next-runs-heading`,"data-slot":`next-runs`,className:`min-w-0 rounded-xl border bg-card p-5`,children:[(0,W.jsx)(`h2`,{id:`next-runs-heading`,className:`mb-2 text-base font-semibold`,children:`Next 5 runs`}),r.length===0?(0,W.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No runs in the next 40 days.`}):(0,W.jsx)(`ol`,{"aria-label":`Next 5 runs`,className:`grid divide-y divide-border text-sm`,children:r.map((e,r)=>(0,W.jsxs)(`li`,{className:`flex min-h-10 items-center justify-between gap-3 py-1.5`,children:[(0,W.jsx)(`span`,{className:r===0?`font-semibold tabular-nums text-foreground`:`font-medium tabular-nums`,children:z(new Date(e).toISOString(),t)}),(0,W.jsx)(`span`,{className:r===0?`font-medium text-accent-text`:`text-muted-foreground`,children:ot(n,e)})]},e))}),(0,W.jsxs)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:[`Times are in `,t,`, the zone this Squawk runs in.`]})]})}function Ln({schedule:e,now:t}){let n=rt(e),r=ft(e);return(0,W.jsxs)(`section`,{"aria-labelledby":`next-runs-heading`,"data-slot":`next-runs`,className:`min-w-0 rounded-xl border bg-card p-5`,children:[(0,W.jsx)(`h2`,{id:`next-runs-heading`,className:`mb-3 text-base font-semibold`,children:`Runs once`}),n===null||!r?(0,W.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Pick a date, a time and a time zone.`}):(0,W.jsxs)(`p`,{className:`flex flex-wrap items-baseline justify-between gap-x-3 text-sm`,children:[(0,W.jsx)(`span`,{className:`font-medium tabular-nums`,children:`${r.date} ${r.time}`}),n>t?(0,W.jsx)(`span`,{className:`text-muted-foreground`,children:ot(t,n)}):null]}),r?.note?(0,W.jsx)(`p`,{className:`mt-2 text-sm break-words`,children:r.note}):null,n!==null&&n<=t?(0,W.jsx)(`p`,{className:`mt-2 text-sm text-destructive`,children:`The due time has passed.`}):null,(0,W.jsx)(`p`,{className:`mt-3 text-xs break-words text-muted-foreground`,children:`Times are in ${e.timeZone??`UTC`}. Squawk must be running then; afterwards the schedule is archived with its task.`})]})}var Rn={schedule:`On a schedule`,github:`When GitHub changes`};function zn(e){return/time zone|due time/i.test(e)?`when`:/autonomous/i.test(e)?`execution`:/placeholder|prompt|workflow|runner|model|task/i.test(e)?`run`:/\bname\b/i.test(e)?`name`:/schedule|github|event|filter|label|interval|remote|forge|lookback|records?|hour|minute|poll|kind|archived/i.test(e)?`when`:`form`}function Q({title:e,icon:t,hideLegend:n=!1,failure:r,section:i,children:a}){let o=(0,B.useId)();return(0,W.jsxs)(`section`,{role:n?void 0:`group`,"aria-labelledby":n?void 0:o,className:`grid min-w-0 gap-3.5 rounded-xl border border-card-edge bg-card shadow-card p-5`,children:[n?null:t?(0,W.jsxs)(`h2`,{id:o,className:`flex items-center gap-2 text-base font-semibold text-foreground`,children:[t,e]}):(0,W.jsx)(`h2`,{id:o,className:`text-sm font-semibold text-foreground`,children:e}),a,r?.section===i&&!r.conflict?(0,W.jsx)(`p`,{role:`alert`,className:`text-sm break-words text-destructive`,children:r.message}):null]})}function Bn({draft:e,patch:t,forge:n,automation:r}){return(0,W.jsx)(W.Fragment,{children:r?(0,W.jsxs)(`p`,{className:`text-sm`,children:[(0,W.jsx)(`span`,{className:`text-muted-foreground`,children:`Trigger · `}),Rn[e.kind]]}):(0,W.jsxs)(`div`,{className:`grid justify-items-start gap-2`,children:[(0,W.jsx)(Ze,{slot:`automation-kind`,label:`Trigger`,size:`touch`,value:e.kind,onChange:e=>t({kind:e}),options:[{value:`schedule`,label:Rn.schedule},{value:`github`,label:Rn.github,disabled:!n.available,...n.available?{}:{title:n.reason??`GitHub is unavailable`}}]}),n.available?null:(0,W.jsx)(`p`,{className:`text-xs break-words text-muted-foreground`,children:`GitHub unavailable · ${n.reason??`no GitHub access`}`})]})})}function Vn({draft:e,patch:t,forge:n,timeZone:r,automation:i}){return e.kind===`schedule`?(0,W.jsx)(Nn,{value:e.schedule,stored:i?.schedule,onChange:e=>t({schedule:e}),timeZone:r}):(0,W.jsx)(xn,{draft:e,onChange:t,...n.available?{}:{disabledReason:n.reason??`no GitHub access`}})}function Hn({draft:e,patch:t}){let n=e.kind===`schedule`?[`date`,`time`,`project`,`automation`]:[`github.kind`,`github.number`,`github.title`,`github.url`,`github.author`,`github.assignees`,`github.labels`,`github.event`],r=[...new Set([...e.prompt.matchAll(/\{\{([^{}]+)\}\}/g)].map(e=>e[1]))].filter(e=>!n.includes(e));return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,W.jsx)(A,{htmlFor:`automation-prompt`,children:`Prompt`}),(0,W.jsx)(Qe,{id:`automation-prompt`,value:e.prompt,onChange:e=>t({prompt:e.target.value}),rows:3,className:`[field-sizing:fixed] min-h-[88px] resize-none border-border bg-background`,required:!0}),(0,W.jsx)(`p`,{className:`text-xs break-words text-muted-foreground`,children:e.kind===`schedule`?(0,W.jsxs)(W.Fragment,{children:[`Available: `,`{{date}}`,` `,`{{time}}`,` `,`{{project}}`,` `,`{{automation}}`,`. A run-context block is appended automatically.`]}):(0,W.jsxs)(W.Fragment,{children:[`Available: `,`{{github.number}}`,` `,`{{github.title}}`,` `,`{{github.url}}`,` `,`{{github.labels}}`,`. GitHub content is appended as untrusted context.`]})})]}),r.length?(0,W.jsx)(`p`,{role:`alert`,className:`text-sm break-words text-destructive`,children:`Unavailable for this trigger: ${r.map(e=>`{{${e}}}`).join(`, `)}`}):null,(0,W.jsx)(Xn,{draft:e,patch:t})]})}function Un({label:e,help:t,checked:n,onChange:r}){let i=(0,B.useId)();return(0,W.jsxs)(`label`,{htmlFor:i,className:`completion-control flex min-h-11 min-w-0 items-center justify-between gap-3 rounded-md text-sm`,children:[(0,W.jsxs)(`span`,{className:`min-w-0 break-words`,children:[(0,W.jsx)(`span`,{id:`${i}-label`,children:e}),(0,W.jsx)(`span`,{id:`${i}-help`,className:`completion-control-help`,children:t})]}),(0,W.jsx)(Oe,{id:i,className:`completion-switch shrink-0`,checked:n,"aria-labelledby":`${i}-label`,"aria-describedby":`${i}-help`,onCheckedChange:r})]})}function Wn({draft:e,patch:t,saving:n,automation:r}){let i=e.kind===`schedule`,a=r?`Enabled`:`Enable after saving`,o=i&&e.schedule.type===`once`?`It runs once at the time set under When, then moves to Archived with its task.`:i?`The first run is the next occurrence in Next 5 runs.`:yn(e.filters.includeExisting);return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`p`,{className:`text-xs break-words text-muted-foreground`,children:`Each run is an ordinary task in its own worktree, queued behind the parallel cap.`}),(0,W.jsxs)(`div`,{"data-embedded":``,className:`grid min-w-0`,children:[(0,W.jsx)(Un,{label:`Autonomous`,help:`Runs without waiting for answers.`,checked:e.autonomous,onChange:e=>t({autonomous:e})}),(0,W.jsx)(Ve,{embedded:!0,archiveWhenDone:e.archiveWhenDone,autoMergePr:e.autoMergePr,onChange:t,disabled:n}),(0,W.jsx)(Be,{embedded:!0,allowWorkers:e.allowWorkers,allowMessaging:e.allowMessaging,onChange:t,disabled:n}),(0,W.jsx)(Un,{label:a,help:o,checked:e.enabled,onChange:e=>t({enabled:e})})]}),r?(0,W.jsx)(`p`,{className:`text-xs break-words text-muted-foreground`,children:`These settings apply to future tasks. Existing tasks keep their settings.`}):null]})}function Gn({automation:e,forge:t,timeZone:n,onSaved:r,onReload:i}){let[a,o]=(0,B.useState)(()=>Kt(e)),[s,c]=(0,B.useState)(e?.revision),[l,u]=(0,B.useState)(),[d,m]=(0,B.useState)(!1),g=e=>o(t=>({...t,...e})),_=async t=>{if(t.preventDefault(),d)return;let n=t.currentTarget;if(n instanceof HTMLFormElement&&!n.checkValidity()){n.reportValidity();return}m(!0),u(void 0);let i=`save`;try{if(e&&s!==void 0){let{automation:t}=await h(e.id,Zt({...a,enabled:e.enabled},s));c(t.revision),a.enabled!==e.enabled&&(i=`enable`,await p(e.id,a.enabled))}else await y(Xt(a));r()}catch(t){let n=t instanceof Error?t.message:String(t);i===`save`&&e&&t instanceof f&&t.status===409&&/revision conflict/i.test(n)?u({section:`form`,message:`Edited elsewhere — reload to see the latest version`,conflict:!0}):u({section:i===`enable`?`execution`:zn(n),message:n})}finally{m(!1)}},v=(0,B.useId)(),b=(0,B.useId)(),x=a.kind===`schedule`;return(0,W.jsx)(Pe,{route:`automations`,density:a.name.trim()===``&&a.prompt.trim()===``?`sparse`:`full`,header:Yn({automation:e,draft:a,formId:v,saveHintId:b,saving:d}),children:(0,W.jsxs)(`form`,{id:v,className:`automation-editor grid min-w-0 gap-4 md:grid-cols-[minmax(0,1fr)_320px] md:grid-rows-[auto_1fr] md:items-start`,onSubmit:_,children:[(0,W.jsxs)(`div`,{className:`grid min-w-0 gap-3.5`,children:[(0,W.jsx)(Q,{title:`Name`,hideLegend:!0,section:`name`,failure:l,children:(0,W.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,W.jsx)(A,{htmlFor:`automation-name`,className:`text-sm font-semibold text-foreground`,children:`Name`}),(0,W.jsx)(R,{id:`automation-name`,className:`border-border`,value:a.name,placeholder:`Daily dependency audit`,onChange:e=>g({name:e.target.value}),required:!0})]})}),(0,W.jsxs)(Q,{title:`When`,section:`when`,failure:l,children:[(0,W.jsx)(Bn,{draft:a,patch:g,forge:t,automation:e}),(0,W.jsx)(Vn,{draft:a,patch:g,forge:t,timeZone:n,automation:e})]}),(0,W.jsx)(Q,{title:`What to run`,section:`run`,failure:l,children:(0,W.jsx)(Hn,{draft:a,patch:g})})]}),(0,W.jsxs)(`aside`,{className:`grid min-w-0 max-w-full grid-cols-[minmax(0,1fr)] gap-4 md:sticky md:top-4 md:col-start-2 md:row-span-2 md:row-start-1`,children:[(0,W.jsx)(Q,{title:`Execution settings`,icon:(0,W.jsx)(ye,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),section:`execution`,failure:l,children:(0,W.jsx)(Wn,{draft:a,patch:g,saving:d,automation:e})}),x?(0,W.jsx)(In,{schedule:a.schedule,timeZone:n}):(0,W.jsxs)(`section`,{className:`min-w-0 rounded-xl border border-card-edge bg-card shadow-card p-5`,children:[(0,W.jsx)(`h2`,{className:`mb-2 text-base font-semibold`,children:`How it polls`}),(0,W.jsx)(`p`,{className:`text-sm break-words text-muted-foreground`,children:bn(a)})]}),(0,W.jsx)(ln,{draft:a,saveLabel:qn(e,a),editing:e!==void 0})]}),l?.section===`form`||e?(0,W.jsxs)(`div`,{className:`grid min-w-0 gap-3.5 md:col-start-1`,children:[l?.section===`form`?(0,W.jsxs)(`div`,{role:`alert`,className:`flex flex-wrap items-center gap-3 text-sm text-destructive`,children:[(0,W.jsx)(`span`,{className:`break-words`,children:l.message}),l.conflict&&i?(0,W.jsx)(j,{type:`button`,variant:`outline`,onClick:i,children:`Reload`}):null]}):null,e?(0,W.jsx)(Kn,{automation:e,onDeleted:r}):null]}):null]})})}function Kn({automation:e,onDeleted:t}){let[n,r]=(0,B.useState)(!1),[i,a]=(0,B.useState)(!1),[o,s]=(0,B.useState)(``),c=async()=>{if(!i){a(!0),s(``);try{await x(e.id),t()}catch(e){s(e instanceof Error?e.message:String(e))}finally{a(!1)}}};return(0,W.jsxs)(`div`,{className:`grid justify-items-start gap-2 border-t pt-4`,children:[n?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`p`,{className:`text-sm break-words`,children:`Delete “${e.name}”? It will stop running and cannot be restored.`}),(0,W.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,W.jsx)(j,{type:`button`,variant:`danger-ghost`,"data-action":`automation-delete-confirm`,disabled:i,onClick:()=>void c(),children:`Delete automation`}),(0,W.jsx)(j,{type:`button`,variant:`outline`,disabled:i,onClick:()=>{r(!1),s(``)},children:`Keep`})]})]}):(0,W.jsx)(j,{type:`button`,variant:`outline`,"data-action":`automation-delete`,onClick:()=>r(!0),children:`Delete`}),o?(0,W.jsx)(`p`,{role:`alert`,className:`text-sm break-words text-destructive`,children:o}):null]})}function qn(e,t){return e?`Save changes`:t.enabled?`Save and enable`:`Save paused`}function Jn(e){let t=[!e.name.trim()&&`a name`,!e.prompt.trim()&&`a prompt`].filter(Boolean);return t.length?`Add ${t.join(` and `)} to save.`:``}function Yn({automation:e,draft:t,formId:n,saveHintId:r,saving:i}){let a=t.name.trim()?t.prompt.trim()?``:`Prompt`:`Name`,o=Jn(t),s=qn(e,t);return{title:e?`Edit automation`:`New automation`,subtitle:`Define when it runs and the ordinary task it launches.`,status:(0,W.jsx)(`p`,{id:r,"data-slot":`automation-save-hint`,className:`min-h-[1lh] text-xs text-muted-foreground`,children:o}),secondaryActions:(0,W.jsx)(I,{type:`button`,variant:`outline`,asChild:!0,children:(0,W.jsx)(F,{to:`/automations`,children:`Cancel`})}),primaryAction:(0,W.jsx)(I,{type:`submit`,form:n,variant:`primary`,disabled:i||a!==``,title:a?`${a} is required`:void 0,"aria-describedby":o?r:void 0,children:i?`Saving…`:s})}}function Xn({draft:e,patch:t}){let n=o(),r=Fe(),{runners:u,signedOut:d}=r.runnersOn(e=>r.repoAccount?.[e]),f=a(),p=s(),{runner:m,ready:h}=l(e.runner??f.data?.defaultRunner??`claude`),g=c(m,h,r.repoAccount?.[m]),_=[...new Set([...(n.data?.workflows??[]).map(e=>e.name),...e.workflow?[e.workflow]:[]])],v=[...new Set([...u,...e.runner?[e.runner]:[]])],y=Ke(m,p.data,g.data,[e.model]),b=y.find(t=>t.id===(e.model??``))?.label??e.model??`Runner default`,x=e=>(0,W.jsx)(e,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`});return(0,W.jsx)(qe,{children:(0,W.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,W.jsx)(Re,{slot:`automation-workflow-pill`,icon:x(_e),fieldLabel:!0,ariaLabel:`Workflow`,label:e.workflow??`inline steps`,value:e.workflow??``,disabled:e.workflow===void 0,disabledHint:`This automation carries its own steps.`,options:_.map(e=>({value:e,label:e})),onPick:e=>t({workflow:e})}),(0,W.jsx)(Re,{slot:`automation-runner-pill`,icon:x(be),fieldLabel:!0,ariaLabel:`Runner`,label:e.runner?i(p.data,e.runner):`default`,value:e.runner??``,disabled:!p.data,options:[{value:``,label:`default`,desc:`The project’s default runner`},...v.map(e=>({value:e,label:i(p.data,e)}))],footer:(0,W.jsx)(Je,{uninstalled:r.uninstalled,signedOut:d.filter(t=>t!==e.runner)}),onPick:e=>{t({runner:e||void 0,model:void 0})}}),(0,W.jsx)(Re,{slot:`automation-model-pill`,icon:x(ge),fieldLabel:!0,ariaLabel:`Model`,label:b,value:e.model??``,options:y.map(e=>({value:e.id,label:e.label,desc:e.desc})),onPick:e=>t({model:e||void 0})})]})})}function Zn(e){return{text:/\bauth\b|sign.?in|\blogin\b|\btoken\b|credentials|HTTP 401/i.test(e)?`GitHub CLI is not signed in`:/ENOENT|not found.*gh|gh.*not found/i.test(e)?`GitHub CLI is not installed`:`GitHub filter check failed`,tone:`error`,details:e}}function Qn({data:e,error:t,refresh:n,archived:i=!1,onArchivedChange:a}){let[o,s]=(0,B.useState)({}),[c,l]=(0,B.useState)({}),d=(e,t)=>s(n=>{let{[e]:r,...i}=n;return t?{...i,[e]:t}:i}),f=async(e,t,n=!1)=>{l(t=>({...t,[e]:!0}));try{await t()}catch(t){let r=t instanceof Error?t.message:String(t);d(e,n?Zn(r):{text:r,tone:`error`})}finally{l(t=>({...t,[e]:!1}))}},m=e=>f(e.id,async()=>{d(e.id,{text:`Starting…`,tone:`info`});let{runId:t}=await u(e.id);d(e.id,{text:`Started task`,tone:`info`,runId:t}),n()}),h=e=>f(e.id,async()=>{d(e.id,void 0),await p(e.id,!e.enabled),await n()}),g=e=>f(e.id,async()=>{d(e.id,void 0),await ne(e.id),await n()}),_=e=>f(e.id,async()=>{d(e.id,{text:`Checking…`,tone:`info`});let{checkId:t}=await re(e.id,`preview`);for(let r=0;r<60;r+=1){let r=await ee(t);if(r.status===`complete`){d(e.id,{text:`${r.matches??0} filter match${r.matches===1?``:`es`} found; no tasks launched. Counts can include closed items and previously processed events.`,tone:`info`}),n();return}if(r.status===`error`){let t=r.error??`Preview failed`;d(e.id,Zn(t));return}await new Promise(e=>setTimeout(e,500))}throw Error(`Preview is still running`)},!0),v=e?.automations??[],y=v.filter(e=>!e.archived),b=v.filter(e=>!!e.archived),x=i?b:y;return(0,W.jsx)(L,{route:`automations`,density:e?je(x.length):`full`,headerSpacing:`compact`,header:{title:`Automations`,subtitle:`Schedules and GitHub checks run while Squawk is open.`,primaryAction:(0,W.jsx)(I,{variant:`primary`,asChild:!0,children:(0,W.jsxs)(F,{to:`/automations/new`,children:[(0,W.jsx)(me,{"aria-hidden":`true`,className:`size-4`}),`New automation`]})})},sparseFooter:e&&x.length>0&&!i?(0,W.jsx)(Ne,{summary:`${x.length} active ${x.length===1?`automation`:`automations`} configured. New automations start paused so you can test filters before enabling them.`,actions:(0,W.jsx)(j,{variant:`outline`,size:`sm`,asChild:!0,children:(0,W.jsx)(F,{to:`/automations/new`,children:`Add another`})})}):void 0,children:t&&!e?(0,W.jsxs)(`div`,{className:`grid justify-items-start gap-3`,children:[(0,W.jsx)(G,{text:t}),(0,W.jsx)(j,{variant:`outline`,onClick:()=>void n(),children:`Retry`})]}):e?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-end justify-between gap-3 border-b border-border`,children:[a?(0,W.jsxs)(`div`,{className:`flex gap-6`,role:`group`,"aria-label":`Filter automations`,children:[(0,W.jsxs)(`button`,{type:`button`,"data-slot":`automations-tab`,"data-view":`active`,"aria-pressed":!i,onClick:()=>a(!1),className:r(`-mb-px flex min-h-11 items-center justify-center gap-1.5 border-b-2 border-transparent text-[13px] font-medium text-muted-foreground transition-colors hover:text-foreground`,!i&&`border-accent-text text-foreground`),children:[`Current`,(0,W.jsx)($n,{count:y.length})]}),(0,W.jsxs)(`button`,{type:`button`,"data-slot":`automations-tab`,"data-view":`archived`,"aria-pressed":i,onClick:()=>a(!0),className:r(`-mb-px flex min-h-11 items-center justify-center gap-1.5 border-b-2 border-transparent text-[13px] font-medium text-muted-foreground transition-colors hover:text-foreground`,i&&`border-accent-text text-foreground`),children:[`Archived`,(0,W.jsx)($n,{count:b.length})]})]}):(0,W.jsx)(`span`,{}),(0,W.jsx)(`div`,{className:`pb-2.5`,children:(0,W.jsx)(er,{data:e})})]}),i&&x.length===0?(0,W.jsx)(G,{text:`No archived automations.`}):x.length===0?(0,W.jsx)(Le,{icon:(0,W.jsx)(ve,{}),tone:`neutral`,title:`No automations yet`,subtitle:`Create one paused, preview it, then enable it.`,heading:`h2`,actions:(0,W.jsx)(j,{variant:`primary`,asChild:!0,children:(0,W.jsxs)(F,{to:`/automations/new`,children:[(0,W.jsx)(me,{"aria-hidden":`true`,className:`size-4`}),`New automation`]})})}):(0,W.jsx)(`ul`,{className:`grid gap-3`,"aria-label":`Automations`,children:x.map(t=>(0,W.jsx)(lr,{automation:t,timeZone:e.timeZone,note:o[t.id],busy:c[t.id]===!0,onRun:()=>void m(t),onToggle:()=>void h(t),onPreview:()=>void _(t),onCancel:()=>void g(t)},t.id))})]}):(0,W.jsx)(G,{text:`Loading automations…`})})}function $n({count:e}){return e===0?null:(0,W.jsx)(`span`,{"data-slot":`automations-tab-count`,className:`tabular-nums text-muted-foreground`,children:`· ${e}`})}function er({data:e}){return(0,W.jsx)(`p`,{"data-slot":`automation-scheduler`,className:r(`text-xs break-words`,e.scheduler.state===`scheduled`?`text-success`:`text-muted-foreground`),children:`Scheduler ${e.scheduler.state===`scheduled`?`running`:`idle`} · GitHub ${e.available?`available`:`unavailable`}${e.reason?` · ${e.reason}`:``} · ${e.timeZone}`})}function tr(e){return e.kind===`schedule`&&e.schedule?at(e.schedule):`${pn(e.events??[])} · every ${Math.round((e.intervalSeconds??300)/60)} min`}function nr({automation:e,nextRun:t}){let n=e.kind===`schedule`?he:pe,r=Ue(e);return(0,W.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,W.jsxs)(`div`,{className:`min-w-0`,children:[(0,W.jsxs)(`h2`,{className:`flex items-center gap-2 font-semibold break-words`,children:[(0,W.jsx)(n,{"aria-hidden":`true`,className:`size-4 shrink-0 text-muted-foreground`}),e.name]}),(0,W.jsxs)(`p`,{"data-slot":`automation-meta`,className:`mt-1 flex flex-wrap items-baseline gap-x-1.5 ps-6 text-xs break-words text-muted-foreground`,children:[(0,W.jsx)(`span`,{children:tr(e)}),t?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),t]}):null]})]}),(0,W.jsx)(Xe,{dot:r.tone,shape:r.shape,pulse:r.pulse,children:r.label})]})}function rr({automation:e,archive:t}){return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`p`,{className:`text-sm break-words`,children:[t.outcome===`launched`?`Started its task.`:`Cancelled — no task was started.`,t.runId?(0,W.jsxs)(W.Fragment,{children:[` · `,(0,W.jsx)(F,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:`/tasks/${t.runId}`,children:`Open task`})]}):null]}),(0,W.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,W.jsx)(j,{variant:`outline`,asChild:!0,children:(0,W.jsx)(F,{to:`/automations/${e.id}`,children:`Details`})})})]})}function ir({automation:e,timeZone:t}){let n=e.kind===`schedule`,r=e.enabled&&n?e.nextRunAt:void 0;return!n&&e.enabled?(0,W.jsx)(`span`,{children:`continuous`}):r?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`span`,{className:`text-foreground`,children:`Next run: ${z(r,t)}`}),(0,W.jsx)(`span`,{children:`· ${ot(Date.now(),Date.parse(r))}`})]}):(0,W.jsx)(`span`,{children:`Next run: —`})}function ar({automation:e,timeZone:t}){let n=e.enabled?Ct(e.state):void 0;return n?(0,W.jsxs)(`p`,{role:`alert`,"data-slot":`automation-failing`,className:`text-sm break-words text-destructive`,children:[`The last ${n.consecutiveFailures} checks failed: ${n.lastError}`,n.retryAt?(0,W.jsx)(`span`,{className:`text-muted-foreground`,children:` · Next try ${z(n.retryAt,t)}`}):null]}):null}var $=`px-3`;function or({automation:e,busy:t,confirmingCancel:n,cancelRef:i,onToggle:a,onRun:o,onPreview:s,onOpenCancel:c}){let l=e.kind===`schedule`,u=e.schedule?.type===`once`;return(0,W.jsxs)(`div`,{"data-slot":`automation-actions`,className:`flex flex-wrap items-center gap-2`,children:[(0,W.jsx)(j,{variant:`outline`,size:`sm`,className:$,"data-action":`automation-toggle`,disabled:t,onClick:a,children:e.enabled?`Pause`:`Enable`}),l?(0,W.jsx)(j,{variant:`outline`,size:`sm`,className:$,"data-action":`automation-run`,disabled:t,onClick:o,children:`Run now`}):(0,W.jsx)(j,{variant:`outline`,size:`sm`,className:$,"data-action":`automation-preview`,disabled:t,onClick:s,children:`Test filter`}),(0,W.jsx)(j,{variant:`outline`,size:`sm`,className:$,asChild:!0,children:(0,W.jsx)(F,{to:`/automations/${e.id}`,children:`Edit`})}),u&&!n?(0,W.jsx)(j,{variant:`outline`,size:`sm`,className:r($,`text-destructive`),ref:i,"data-action":`automation-cancel`,disabled:t,onClick:c,children:`Cancel`}):null,(0,W.jsx)(j,{variant:`outline`,size:`sm`,className:r($,`sm:ms-auto`),asChild:!0,children:(0,W.jsx)(F,{to:`/automations/${e.id}/log`,children:`Execution log`})})]})}function sr({automation:e,busy:t,keepRef:n,onConfirm:r,onKeep:i}){return(0,W.jsxs)(`div`,{className:`grid justify-items-start gap-2`,children:[(0,W.jsx)(`p`,{className:`text-sm break-words`,children:`Cancel “${e.name}”? It will never run, and it moves to Archived.`}),(0,W.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,W.jsx)(j,{variant:`danger-ghost`,"data-action":`automation-cancel-confirm`,disabled:t,onClick:r,children:`Cancel schedule`}),(0,W.jsx)(j,{ref:n,variant:`outline`,disabled:t,onClick:i,children:`Keep`})]})]})}function cr({note:e}){return(0,W.jsxs)(`div`,{role:e.tone===`error`?`alert`:`status`,className:r(`text-sm break-words`,e.tone===`error`?`text-destructive`:`text-muted-foreground`),children:[e.text,e.details?(0,W.jsxs)(W.Fragment,{children:[` · `,(0,W.jsx)(de,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:Ie(`gh`),children:`Set up`}),(0,W.jsxs)(`details`,{children:[(0,W.jsx)(`summary`,{className:`min-h-11 cursor-pointer`,children:`Command details`}),(0,W.jsx)(`pre`,{className:`whitespace-pre-wrap break-words`,children:e.details})]})]}):null,e.runId?(0,W.jsxs)(W.Fragment,{children:[` · `,(0,W.jsx)(F,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:`/tasks/${e.runId}`,children:`Open task`})]}):null]})}function lr({automation:e,timeZone:t,note:n,busy:r,onRun:i,onToggle:a,onPreview:o,onCancel:s}){let[c,l]=(0,B.useState)(!1),u=(0,B.useRef)(null),d=(0,B.useRef)(null),f=(0,B.useRef)(null);(0,B.useEffect)(()=>{let e=f.current===`keep`?d.current:f.current===`cancel`?u.current:null;f.current=null,e?.focus()},[c]);let p=()=>{f.current=`keep`,l(!0)},m=()=>{f.current=`cancel`,l(!1)},h=e.archived;return(0,W.jsxs)(`li`,{"data-slot":`automation-card`,"data-kind":e.kind,className:`flex min-w-0 flex-col gap-2.5 rounded-xl border border-card-edge bg-card p-4 shadow-card`,children:[(0,W.jsx)(nr,{automation:e,nextRun:h?void 0:(0,W.jsx)(ir,{automation:e,timeZone:t})}),h?(0,W.jsx)(rr,{automation:e,archive:h}):null,h?null:(0,W.jsx)(ar,{automation:e,timeZone:t}),h?null:(0,W.jsx)(or,{automation:e,busy:r,confirmingCancel:c,cancelRef:u,onToggle:a,onRun:i,onPreview:o,onOpenCancel:p}),e.schedule?.type===`once`&&!h&&c?(0,W.jsx)(sr,{automation:e,busy:r,keepRef:d,onConfirm:()=>{l(!1),s()},onKeep:m}):null,n?(0,W.jsx)(cr,{note:n}):null,(0,W.jsx)(Ft,{automationId:e.id,automationName:e.name,timeZone:t})]})}function ur(e){let t=Ae(),n=He(),[r,i]=(0,B.useState)(),[a,o]=(0,B.useState)(``),s=(0,B.useCallback)(t=>oe({signal:t,...e?{archived:e}:{}}).then(e=>{t?.aborted||(i(e),o(``))}).catch(e=>{t?.aborted||o(String(e))}),[e]);return(0,B.useEffect)(()=>{n&&s()},[n,s]),(0,B.useEffect)(()=>d(async e=>{n&&await s(e)}),[n,s]),(0,B.useEffect)(()=>fe((e,n)=>{if(e!==`automation-change`)return;let r=n;typeof r.project==`string`&&(t===null||r.project===t)&&s()}),[t,s]),{data:r,error:a,refresh:s}}function dr({mode:e=`list`}){let{automationId:t}=ue(),n=ke(),[r,i]=(0,B.useState)(!1),{data:a,error:o,refresh:s}=ur(`include`),[c,l]=(0,B.useState)(0),u=Ye();if(u===`unknown`)return(0,W.jsx)(L,{route:`automations`,density:`empty`,children:(0,W.jsx)(G,{text:`Loading automations…`})});if(u===`absent`)return(0,W.jsx)(Ge,{});if(u===`disabled`)return(0,W.jsx)(L,{route:`automations`,density:`empty`,children:(0,W.jsx)(Le,{icon:(0,W.jsx)(ve,{}),tone:`neutral`,title:`Automations are off`,subtitle:`This server does not run schedules, poll GitHub or launch tasks from them. Unset CEZ_AUTOMATIONS or set it to 1 and restart Squawk to turn automations on.`,heading:`h2`})});let d=()=>{n(`/automations`),s()},f=a?.automations.find(e=>e.id===t);if(e===`list`)return(0,W.jsx)(Qn,{data:a,error:o,refresh:s,archived:r,onArchivedChange:i});if(!a)return o?(0,W.jsx)(L,{route:`automations`,density:`empty`,header:{title:`Automations`,subtitle:`Could not load automations.`},children:(0,W.jsxs)(`div`,{className:`grid justify-items-start gap-3`,children:[(0,W.jsx)(G,{text:o}),(0,W.jsx)(j,{variant:`outline`,onClick:()=>void s(),children:`Retry`})]})}):(0,W.jsx)(L,{route:`automations`,density:`empty`,children:(0,W.jsx)(G,{text:`Loading automations…`})});let p={available:a.available,...a.reason?{reason:a.reason}:{}};return e===`new`?(0,W.jsx)(Gn,{forge:p,timeZone:a.timeZone,onSaved:d}):e===`edit`?f?f.archived?(0,W.jsx)(It,{automation:f,timeZone:a.timeZone,onDeleted:d}):(0,W.jsx)(Gn,{automation:f,forge:p,timeZone:a.timeZone,onSaved:d,onReload:()=>void s().then(()=>l(e=>e+1))},`${f.id}:${c}`):(0,W.jsx)(L,{route:`automations`,density:`empty`,header:{title:`Automation not found`,subtitle:`This automation may have been removed.`},children:(0,W.jsx)(j,{asChild:!0,variant:`outline`,children:(0,W.jsx)(F,{to:`/automations`,children:`Back to automations`})})}):t?(0,W.jsx)(Pt,{automationId:t,automationName:f?.name,timeZone:a.timeZone,readOnly:!!f?.archived}):(0,W.jsx)(G,{text:`Automation not found.`})}export{dr as AutomationsRoute};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t}from"./react-runtime-CCIEwYL0.js";import{t as n}from"./preload-helper-Czpn1I53.js";var r=e(t(),1),i=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,a=/^[\\/]{2}/;function o(e,t){return t+e.replace(/\\/g,`/`)}var s=`popstate`;function c(e){return typeof e==`object`&&!!e&&`pathname`in e&&`search`in e&&`hash`in e&&`state`in e&&`key`in e}function l(e={}){function t(e,t){let n=t.state?.masked,{pathname:r,search:i,hash:a}=n||e.location;return m(``,{pathname:r,search:i,hash:a},t.state&&t.state.usr||null,t.state&&t.state.key||`default`,n?{pathname:e.location.pathname,search:e.location.search,hash:e.location.hash}:void 0)}function n(e,t){return typeof t==`string`?t:h(t)}return _(t,n,null,e)}function u(e,t){if(e===!1||e==null)throw Error(t)}function d(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function f(){return Math.random().toString(36).substring(2,10)}function p(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function m(e,t,n=null,r,i){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?g(t):t,state:n,key:t&&t.key||r||f(),mask:i}}function h({pathname:e=`/`,search:t=``,hash:n=``}){return t&&t!==`?`&&(e+=t.charAt(0)===`?`?t:`?`+t),n&&n!==`#`&&(e+=n.charAt(0)===`#`?n:`#`+n),e}function g(e){let t={};if(e){let n=e.indexOf(`#`);n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf(`?`);r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function _(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,l=`POP`,u=null,d=f();d??(d=0,o.replaceState({...o.state,idx:d},``));function f(){return(o.state||{idx:null}).idx}function h(){l=`POP`;let e=f(),t=e==null?null:e-d;d=e,u&&u({action:l,location:b.location,delta:t})}function g(e,t){l=`PUSH`;let r=c(e)?e:m(b.location,e,t);n&&n(r,e),d=f()+1;let s=p(r,d),h=b.createHref(r.mask||r);try{o.pushState(s,``,h)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(h)}a&&u&&u({action:l,location:b.location,delta:1})}function _(e,t){l=`REPLACE`;let r=c(e)?e:m(b.location,e,t);n&&n(r,e),d=f();let i=p(r,d),s=b.createHref(r.mask||r);o.replaceState(i,``,s),a&&u&&u({action:l,location:b.location,delta:0})}function y(e){return v(i,e)}let b={get action(){return l},get location(){return e(i,o)},listen(e){if(u)throw Error(`A history only accepts one active listener`);return i.addEventListener(s,h),u=e,()=>{i.removeEventListener(s,h),u=null}},createHref(e){return t(i,e)},createURL:y,encodeLocation(e){let t=y(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:g,replace:_,go(e){return o.go(e)}};return b}function v(e,t,n=!1){let r=`http://localhost`;e&&(r=e.location.origin===`null`?e.location.href:e.location.origin),u(r,`No window.location.(origin|href) available to create URL`);let i=typeof t==`string`?t:h(t);return i=i.replace(/ $/,`%20`),!n&&a.test(i)&&(i=r+i),new URL(i,r)}function y(e,t,n=`/`){return b(e,t,n,!1)}function b(e,t,n,r,i){let a=O((typeof t==`string`?g(t):t).pathname||`/`,n);if(a==null)return null;let o=i??S(e),s=null,c=de(a);for(let e=0;s==null&&e<o.length;++e)s=ce(o[e],c,r);return s}function x(e,t){let{route:n,pathname:r,params:i}=e;return{id:n.id,pathname:r,params:i,data:t[n.id],loaderData:t[n.id],handle:n.handle}}function S(e){let t=C(e);return T(t),t}function C(e,t=[],n=[],r=``,i=!1){let a=(e,a,o=i,s)=>{let c={relativePath:s===void 0?e.path||``:s,caseSensitive:e.caseSensitive===!0,childrenIndex:a,route:e};if(c.relativePath.startsWith(`/`)){if(!c.relativePath.startsWith(r)&&o)return;u(c.relativePath.startsWith(r),`Absolute route path "${c.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(r.length)}let l=A([r,c.relativePath]),d=n.concat(c);e.children&&e.children.length>0&&(u(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),C(e.children,t,d,l,o)),!(e.path==null&&!e.index)&&t.push({path:l,score:oe(l,e.index),routesMeta:d.map((e,t)=>{let[n,r]=ue(e.relativePath,e.caseSensitive,t===d.length-1);return{...e,matcher:n,compiledParams:r}})})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of w(e.path))a(e,t,!0,n)}),t}function w(e){let t=e.split(`/`);if(t.length===0)return[];let[n,...r]=t,i=n.endsWith(`?`),a=n.replace(/\?$/,``);if(r.length===0)return i?[a,``]:[a];let o=w(r.join(`/`)),s=[];return s.push(...o.map(e=>e===``?a:[a,e].join(`/`))),i&&s.push(...o),s.map(t=>e.startsWith(`/`)&&t===``?`/`:t)}function T(e){e.sort((e,t)=>e.score===t.score?se(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var ee=/^:[\w-]+$/,te=3,ne=2,re=1,ie=10,E=-2,ae=e=>e===`*`;function oe(e,t){let n=e.split(`/`),r=n.length;return n.some(ae)&&(r+=E),t&&(r+=ne),n.filter(e=>!ae(e)).reduce((e,t)=>e+(ee.test(t)?te:t===``?re:ie),r)}function se(e,t){return e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n])?e[e.length-1]-t[t.length-1]:0}function ce(e,t,n=!1){let{routesMeta:r}=e,i={},a=`/`,o=[];for(let e=0;e<r.length;++e){let s=r[e],c=e===r.length-1,l=a===`/`?t:t.slice(a.length)||`/`,u={path:s.relativePath,caseSensitive:s.caseSensitive,end:c},d=s.matcher&&s.compiledParams?le(u,l,s.matcher,s.compiledParams):D(u,l),f=s.route;if(!d&&c&&n&&!r[r.length-1].route.index&&(d=D({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!d)return null;Object.assign(i,d.params),o.push({params:i,pathname:A([a,d.pathname]),pathnameBase:ve(A([a,d.pathnameBase])),route:f}),d.pathnameBase!==`/`&&(a=A([a,d.pathnameBase]))}return o}function D(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=ue(e.path,e.caseSensitive,e.end);return le(e,t,n,r)}function le(e,t,n,r){let i=t.match(n);if(!i)return null;let a=i[0],o=a.replace(/(.)\/+$/,`$1`),s=i.slice(1);return{params:r.reduce((e,{paramName:t,isOptional:n},r)=>{if(t===`*`){let e=s[r]||``;o=a.slice(0,a.length-e.length).replace(/(.)\/+$/,`$1`)}let i=s[r];return n&&!i?e[t]=void 0:e[t]=(i||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function ue(e,t=!1,n=!0){d(e===`*`||!e.endsWith(`*`)||e.endsWith(`/*`),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,`/*`)}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,`/*`)}".`);let r=[],i=`^`+e.replace(/\/*\*?$/,``).replace(/^\/*/,`/`).replace(/[\\.*+^${}|()[\]]/g,`\\$&`).replace(/\/:([\w-]+)(\?)?/g,(e,t,n,i,a)=>{if(r.push({paramName:t,isOptional:n!=null}),n){let t=a.charAt(i+e.length);return t&&t!==`/`?`/([^\\/]*)`:`(?:/([^\\/]*))?`}return`/([^\\/]+)`}).replace(/\/([\w-]+)\?(\/|$)/g,`(/$1)?$2`);return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function de(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return d(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function O(e,t){if(t===`/`)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith(`/`)?t.length-1:t.length,r=e.charAt(n);return r&&r!==`/`?null:e.slice(n)||`/`}function fe(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?g(e):e,a;return n?(n=_e(n),a=n.startsWith(`/`)?pe(n.substring(1),`/`):pe(n,t)):a=t,{pathname:a,search:ye(r),hash:be(i)}}function pe(e,t){let n=j(t).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function me(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function he(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function ge(e){let t=he(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function k(e,t,n,r=!1){let i;typeof e==`string`?i=g(e):(i={...e},u(!i.pathname||!i.pathname.includes(`?`),me(`?`,`pathname`,`search`,i)),u(!i.pathname||!i.pathname.includes(`#`),me(`#`,`pathname`,`hash`,i)),u(!i.search||!i.search.includes(`#`),me(`#`,`search`,`hash`,i)));let a=e===``||i.pathname===``,o=a?`/`:i.pathname,s;if(o==null)s=n;else{let e=t.length-1;if(!r&&o.startsWith(`..`)){let t=o.split(`/`);for(;t[0]===`..`;)t.shift(),--e;i.pathname=t.join(`/`)}s=e>=0?t[e]:`/`}let c=fe(i,s),l=o&&o!==`/`&&o.endsWith(`/`),d=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||d)&&(c.pathname+=`/`),c}var _e=e=>e.replace(/[\\/]{2,}/g,`/`),A=e=>_e(e.join(`/`)),j=e=>e.replace(/\/+$/,``),ve=e=>j(e).replace(/^\/*/,`/`),ye=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,be=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,xe=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||``,this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function Se(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function Ce(e){return A(e.map(e=>e.route.path).filter(Boolean))||`/`}var we=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function Te(e,t){let n=e;if(typeof n!=`string`||!i.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,s=!1;if(we)try{let e=new URL(window.location.href),r=a.test(n)?new URL(o(n,e.protocol)):new URL(n),i=O(r.pathname,t);r.origin===e.origin&&i!=null?n=i+r.search+r.hash:s=!0}catch{d(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:s,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var Ee=[`POST`,`PUT`,`PATCH`,`DELETE`];new Set(Ee);var De=[`GET`,...Ee];new Set(De);var Oe=[`about:`,`blob:`,`chrome:`,`chrome-untrusted:`,`content:`,`data:`,`devtools:`,`file:`,`filesystem:`,`javascript:`];function ke(e){try{return Oe.includes(new URL(e).protocol)}catch{return!1}}var M=r.createContext(null);M.displayName=`DataRouter`;var N=r.createContext(null);N.displayName=`DataRouterState`;var Ae=r.createContext(!1);function je(){return r.useContext(Ae)}var Me=r.createContext({isTransitioning:!1});Me.displayName=`ViewTransition`;var Ne=r.createContext(new Map);Ne.displayName=`Fetchers`;var Pe=r.createContext(null);Pe.displayName=`Await`;var P=r.createContext(null);P.displayName=`Navigation`;var F=r.createContext(null);F.displayName=`Location`;var I=r.createContext({outlet:null,matches:[],isDataRoute:!1});I.displayName=`Route`;var L=r.createContext(null);L.displayName=`RouteError`;var Fe=`REACT_ROUTER_ERROR`,Ie=`REDIRECT`,Le=`ROUTE_ERROR_RESPONSE`;function Re(e){if(e.startsWith(`${Fe}:${Ie}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`&&typeof t.location==`string`&&typeof t.reloadDocument==`boolean`&&typeof t.replace==`boolean`)return t}catch{}}function ze(e){if(e.startsWith(`${Fe}:${Le}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new xe(t.status,t.statusText,t.data)}catch{}}function Be(e,{relative:t}={}){u(R(),`useHref() may be used only in the context of a <Router> component.`);let{basename:n,navigator:i}=r.useContext(P),{hash:a,pathname:o,search:s}=V(e,{relative:t}),c=o;return n!==`/`&&(c=o===`/`?n:A([n,o])),i.createHref({pathname:c,search:s,hash:a})}function R(){return r.useContext(F)!=null}function z(){return u(R(),`useLocation() may be used only in the context of a <Router> component.`),r.useContext(F).location}function Ve(){return r.useContext(F).navigationType}var He=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function Ue(e){r.useContext(P).static||r.useLayoutEffect(e)}function B(){let{isDataRoute:e}=r.useContext(I);return e?lt():We()}function We(){u(R(),`useNavigate() may be used only in the context of a <Router> component.`);let e=r.useContext(M),{basename:t,navigator:n}=r.useContext(P),{matches:i}=r.useContext(I),{pathname:a}=z(),o=JSON.stringify(ge(i)),s=r.useRef(!1);return Ue(()=>{s.current=!0}),r.useCallback((r,i={})=>{if(d(s.current,He),!s.current)return;if(typeof r==`number`){n.go(r);return}let c=k(r,JSON.parse(o),a,i.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:A([t,c.pathname])),(i.replace?n.replace:n.push)(c,i.state,i)},[t,n,o,a,e])}var Ge=r.createContext(null);function Ke(e){let t=r.useContext(I).outlet;return r.useMemo(()=>t&&r.createElement(Ge.Provider,{value:e},t),[t,e])}function qe(){let{matches:e}=r.useContext(I);return e[e.length-1]?.params??{}}function V(e,{relative:t}={}){let{matches:n}=r.useContext(I),{pathname:i}=z(),a=JSON.stringify(ge(n));return r.useMemo(()=>k(e,JSON.parse(a),i,t===`path`),[e,a,i,t])}function Je(e,t){return Ye(e,t)}function Ye(e,t,n){u(R(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:i}=r.useContext(P),{matches:a}=r.useContext(I),o=a[a.length-1],s=o?o.params:{},c=o?o.pathname:`/`,l=o?o.pathnameBase:`/`,f=o&&o.route;{let e=f&&f.path||``;dt(c,!f||e.endsWith(`*`)||e.endsWith(`*?`),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${c}" (under <Route path="${e}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
2
|
-
|
|
3
|
-
Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}/*`}">.`)}let p=z(),m;if(t){let e=typeof t==`string`?g(t):t;u(l===`/`||e.pathname?.startsWith(l),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${l}" but pathname "${e.pathname}" was given in the \`location\` prop.`),m=e}else m=p;let h=m.pathname||`/`,_=h;if(l!==`/`){let e=l.replace(/^\//,``).split(`/`);_=`/`+h.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let v=n&&n.state.matches.length?n.state.matches.map(e=>Object.assign(e,{route:n.manifest[e.route.id]||e.route})):y(e,{pathname:_});d(f||v!=null,`No routes matched location "${m.pathname}${m.search}${m.hash}" `),d(v==null||v[v.length-1].route.element!==void 0||v[v.length-1].route.Component!==void 0||v[v.length-1].route.lazy!==void 0,`Matched leaf route at location "${m.pathname}${m.search}${m.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let b=tt(v&&v.map(e=>Object.assign({},e,{params:Object.assign({},s,e.params),pathname:A([l,i.encodeLocation?i.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?l:A([l,i.encodeLocation?i.encodeLocation(e.pathnameBase.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),a,n);return t&&b?r.createElement(F.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,mask:void 0,...m},navigationType:`POP`}},b):b}function Xe(){let e=ct(),t=Se(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,i=`rgba(200,200,200, 0.5)`,a={padding:`0.5rem`,backgroundColor:i},o={padding:`2px 4px`,backgroundColor:i},s=null;return console.error(`Error handled by React Router default ErrorBoundary:`,e),s=r.createElement(r.Fragment,null,r.createElement(`p`,null,`💿 Hey developer 👋`),r.createElement(`p`,null,`You can provide a way better UX than this when your app throws errors by providing your own `,r.createElement(`code`,{style:o},`ErrorBoundary`),` or`,` `,r.createElement(`code`,{style:o},`errorElement`),` prop on your route.`)),r.createElement(r.Fragment,null,r.createElement(`h2`,null,`Unexpected Application Error!`),r.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?r.createElement(`pre`,{style:a},n):null,s)}var Ze=r.createElement(Xe,null),Qe=class extends r.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!==`idle`&&e.revalidation===`idle`?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error===void 0?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error(`React Router caught the following error during render`,e)}render(){let e=this.state.error;if(this.context&&typeof e==`object`&&e&&`digest`in e&&typeof e.digest==`string`){let t=ze(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:r.createElement(I.Provider,{value:this.props.routeContext},r.createElement(L.Provider,{value:e,children:this.props.component}));return this.context?r.createElement($e,{error:e},t):t}};Qe.contextType=Ae;var H=new WeakMap;function $e({children:e,error:t}){let{basename:n}=r.useContext(P);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=Re(t.digest);if(e){let i=H.get(t);if(i)throw i;let a=Te(e.location,n),o=a.absoluteURL||a.to;if(ke(o))throw Error(`Invalid redirect location`);if(we&&!H.get(t))if(a.isExternal||e.reloadDocument)window.location.href=o;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(a.to,{replace:e.replace}));throw H.set(t,n),n}return r.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${o}`})}}return e}function et({routeContext:e,match:t,children:n}){let i=r.useContext(M);return i&&i.static&&i.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=t.route.id),r.createElement(I.Provider,{value:e},n)}function tt(e,t=[],n){let i=n?.state;if(e==null){if(!i)return null;if(i.errors)e=i.matches;else if(t.length===0&&!i.initialized&&i.matches.length>0)e=i.matches;else return null}let a=e,o=i?.errors;if(o!=null){let e=a.findIndex(e=>e.route.id&&o?.[e.route.id]!==void 0);u(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(`,`)}`),a=a.slice(0,Math.min(a.length,e+1))}let s=!1,c=-1;if(n&&i){s=i.renderFallback;for(let e=0;e<a.length;e++){let t=a[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(c=e),t.route.id){let{loaderData:e,errors:r}=i,o=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!r||r[t.route.id]===void 0);if(t.route.lazy||o){n.isStatic&&(s=!0),a=c>=0?a.slice(0,c+1):[a[0]];break}}}}let l=n?.onError,d=i&&l?(e,t)=>{l(e,{location:i.location,params:i.matches?.[0]?.params??{},pattern:Ce(i.matches),errorInfo:t})}:void 0;return a.reduceRight((e,n,l)=>{let u,f=!1,p=null,m=null;i&&(u=o&&n.route.id?o[n.route.id]:void 0,p=n.route.errorElement||Ze,s&&(c<0&&l===0?(dt(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),f=!0,m=null):c===l&&(f=!0,m=n.route.hydrateFallbackElement||null)));let h=t.concat(a.slice(0,l+1)),g=()=>{let t;return t=u?p:f?m:n.route.Component?r.createElement(n.route.Component,null):n.route.element?n.route.element:e,r.createElement(et,{match:n,routeContext:{outlet:e,matches:h,isDataRoute:i!=null},children:t})};return i&&(n.route.ErrorBoundary||n.route.errorElement||l===0)?r.createElement(Qe,{location:i.location,revalidation:i.revalidation,component:p,error:u,children:g(),routeContext:{outlet:null,matches:h,isDataRoute:!0},onError:d}):g()},null)}function U(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function nt(e){let t=r.useContext(M);return u(t,U(e)),t}function rt(e){let t=r.useContext(N);return u(t,U(e)),t}function it(e){let t=r.useContext(I);return u(t,U(e)),t}function W(e){let t=it(e),n=t.matches[t.matches.length-1];return u(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function at(){return W(`useRouteId`)}function ot(){let e=rt(`useNavigation`);return r.useMemo(()=>{let{matches:t,historyAction:n,...r}=e.navigation;return r},[e.navigation])}function st(){let{matches:e,loaderData:t}=rt(`useMatches`);return r.useMemo(()=>e.map(e=>x(e,t)),[e,t])}function ct(){let e=r.useContext(L),t=rt(`useRouteError`),n=W(`useRouteError`);return e===void 0?t.errors?.[n]:e}function lt(){let{router:e}=nt(`useNavigate`),t=W(`useNavigate`),n=r.useRef(!1);return Ue(()=>{n.current=!0}),r.useCallback(async(r,i={})=>{d(n.current,He),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var ut={};function dt(e,t,n){!t&&!ut[e]&&(ut[e]=!0,d(!1,n))}r.memo(ft);function ft({routes:e,manifest:t,future:n,state:r,isStatic:i,onError:a}){return Ye(e,void 0,{manifest:t,state:r,isStatic:i,onError:a,future:n})}function pt({to:e,replace:t,state:n,relative:i}){u(R(),`<Navigate> may be used only in the context of a <Router> component.`);let{static:a}=r.useContext(P);d(!a,`<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.`);let{matches:o}=r.useContext(I),{pathname:s}=z(),c=B(),l=k(e,ge(o),s,i===`path`),f=JSON.stringify(l);return r.useEffect(()=>{c(JSON.parse(f),{replace:t,state:n,relative:i})},[c,f,i,t,n]),null}function mt(e){return Ke(e.context)}function ht(e){u(!1,`A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.`)}function gt({basename:e=`/`,children:t=null,location:n,navigationType:i=`POP`,navigator:a,static:o=!1,useTransitions:s}){u(!R(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let c=e.replace(/^\/*/,`/`),l=r.useMemo(()=>({basename:c,navigator:a,static:o,useTransitions:s,future:{}}),[c,a,o,s]);typeof n==`string`&&(n=g(n));let{pathname:f=`/`,search:p=``,hash:m=``,state:h=null,key:_=`default`,mask:v}=n,y=r.useMemo(()=>{let e=O(f,c);return e==null?null:{location:{pathname:e,search:p,hash:m,state:h,key:_,mask:v},navigationType:i}},[c,f,p,m,h,_,i,v]);return d(y!=null,`<Router basename="${c}"> is not able to match the URL "${f}${p}${m}" because it does not start with the basename, so the <Router> won't render anything.`),y==null?null:r.createElement(P.Provider,{value:l},r.createElement(F.Provider,{children:t,value:y}))}function _t({children:e,location:t}){return Je(G(e),t)}r.Component;function G(e,t=[]){let n=[];return r.Children.forEach(e,(e,i)=>{if(!r.isValidElement(e))return;let a=[...t,i];if(e.type===r.Fragment){n.push.apply(n,G(e.props.children,a));return}u(e.type===ht,`[${typeof e.type==`string`?e.type:e.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),u(!e.props.index||!e.props.children,`An index route cannot have child routes.`);let o={id:e.props.id||a.join(`-`),caseSensitive:e.props.caseSensitive,element:e.props.element,Component:e.props.Component,index:e.props.index,path:e.props.path,middleware:e.props.middleware,loader:e.props.loader,action:e.props.action,hydrateFallbackElement:e.props.hydrateFallbackElement,HydrateFallback:e.props.HydrateFallback,errorElement:e.props.errorElement,ErrorBoundary:e.props.ErrorBoundary,hasErrorBoundary:e.props.hasErrorBoundary===!0||e.props.ErrorBoundary!=null||e.props.errorElement!=null,shouldRevalidate:e.props.shouldRevalidate,handle:e.props.handle,lazy:e.props.lazy};e.props.children&&(o.children=G(e.props.children,a)),n.push(o)}),n}var vt=G,K=`get`,q=`application/x-www-form-urlencoded`;function J(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function yt(e){return J(e)&&e.tagName.toLowerCase()===`button`}function bt(e){return J(e)&&e.tagName.toLowerCase()===`form`}function xt(e){return J(e)&&e.tagName.toLowerCase()===`input`}function St(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Ct(e,t){return e.button===0&&(!t||t===`_self`)&&!St(e)}function wt(e=``){return new URLSearchParams(typeof e==`string`||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(e=>[n,e]):[[n,r]])},[]))}function Tt(e,t){let n=wt(e);return t&&t.forEach((e,r)=>{n.has(r)||t.getAll(r).forEach(e=>{n.append(r,e)})}),n}var Y=null;function Et(){if(Y===null)try{new FormData(document.createElement(`form`),0),Y=!1}catch{Y=!0}return Y}var Dt=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function Ot(e){return e!=null&&!Dt.has(e)?(d(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${q}"`),null):e}function kt(e,t){let n,r,i,a,o;if(bt(e)){let o=e.getAttribute(`action`);r=o?O(o,t):null,n=e.getAttribute(`method`)||K,i=Ot(e.getAttribute(`enctype`))||q,a=new FormData(e)}else if(yt(e)||xt(e)&&(e.type===`submit`||e.type===`image`)){let o=e.form;if(o==null)throw Error(`Cannot submit a <button> or <input type="submit"> without a <form>`);let s=e.getAttribute(`formaction`)||o.getAttribute(`action`);if(r=s?O(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||K,i=Ot(e.getAttribute(`formenctype`))||Ot(o.getAttribute(`enctype`))||q,a=new FormData(o,e),!Et()){let{name:t,type:n,value:r}=e;if(n===`image`){let e=t?`${t}.`:``;a.append(`${e}x`,`0`),a.append(`${e}y`,`0`)}else t&&a.append(t,r)}}else if(J(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=K,r=null,i=q,o=e;return a&&i===`text/plain`&&(o=a,a=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:a,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var At={"&":`\\u0026`,">":`\\u003e`,"<":`\\u003c`,"\u2028":`\\u2028`,"\u2029":`\\u2029`},jt=/[&><\u2028\u2029]/g;function Mt(e){return e.replace(jt,e=>At[e])}function Nt(e,t){if(e===!1||e==null)throw Error(t)}function Pt(e,t,n,r){let i=typeof e==`string`?new URL(e,typeof window>`u`?`server://singlefetch/`:window.location.origin):e;return n?i.pathname.endsWith(`/`)?i.pathname=`${i.pathname}_.${r}`:i.pathname=`${i.pathname}.${r}`:i.pathname===`/`?i.pathname=`_root.${r}`:t&&O(i.pathname,t)===`/`?i.pathname=`${j(t)}/_root.${r}`:i.pathname=`${j(i.pathname)}.${r}`,i}async function Ft(e,t){if(e.id in t)return t[e.id];try{let r=await n(()=>import(e.module),[]);return t[e.id]=r,r}catch(t){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function It(e){return e!=null&&typeof e.page==`string`}function Lt(e){return e==null?!1:e.href==null?e.rel===`preload`&&typeof e.imageSrcSet==`string`&&typeof e.imageSizes==`string`:typeof e.rel==`string`&&typeof e.href==`string`}async function Rt(e,t,n){return Ut((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await Ft(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(Lt).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function zt(e,t,n,r,i,a){let o=(e,t)=>!n[t]||e.route.id!==n[t].route.id,s=(e,t)=>n[t].pathname!==e.pathname||n[t].route.path?.endsWith(`*`)&&n[t].params[`*`]!==e.params[`*`];return a===`assets`?t.filter((e,t)=>o(e,t)||s(e,t)):a===`data`?t.filter((t,a)=>{let c=r.routes[t.route.id];if(!c||!c.hasLoader)return!1;if(o(t,a)||s(t,a))return!0;if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if(typeof r==`boolean`)return r}return!0}):[]}function Bt(e,t,{includeHydrateFallback:n}={}){return Vt(e.map(e=>{let r=t.routes[e.route.id];if(!r)return[];let i=[r.module];return r.clientActionModule&&(i=i.concat(r.clientActionModule)),r.clientLoaderModule&&(i=i.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(i=i.concat(r.hydrateFallbackModule)),r.imports&&(i=i.concat(r.imports)),i}).flat(1))}function Vt(e){return[...new Set(e)]}function Ht(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function Ut(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!It(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(Ht(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}function Wt(){let e=r.useContext(M);return Nt(e,`You must render this element inside a <DataRouterContext.Provider> element`),e}function Gt(){let e=r.useContext(N);return Nt(e,`You must render this element inside a <DataRouterStateContext.Provider> element`),e}var X=r.createContext(void 0);X.displayName=`FrameworkContext`;function Z(){let e=r.useContext(X);return Nt(e,`You must render this element inside a <HydratedRouter> element`),e}function Kt(e,t){let n=r.useContext(X),[i,a]=r.useState(!1),[o,s]=r.useState(!1),{onFocus:c,onBlur:l,onMouseEnter:u,onMouseLeave:d,onTouchStart:f}=t,p=r.useRef(null);r.useEffect(()=>{if(e===`render`&&s(!0),e===`viewport`){let e=new IntersectionObserver(e=>{e.forEach(e=>{s(e.isIntersecting)})},{threshold:.5});return p.current&&e.observe(p.current),()=>{e.disconnect()}}},[e]),r.useEffect(()=>{if(i){let e=setTimeout(()=>{s(!0)},100);return()=>{clearTimeout(e)}}},[i]);let m=()=>{a(!0)},h=()=>{a(!1),s(!1)};return n?e===`intent`?[o,p,{onFocus:Q(c,m),onBlur:Q(l,h),onMouseEnter:Q(u,m),onMouseLeave:Q(d,h),onTouchStart:Q(f,m)}]:[o,p,{}]:[!1,p,{}]}function Q(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function qt({page:e,...t}){let n=je(),{nonce:i}=Z(),{router:a}=Wt(),o=r.useMemo(()=>y(a.routes,e,a.basename),[a.routes,e,a.basename]);return o?(t.nonce==null&&i&&(t={...t,nonce:i}),n?r.createElement(Yt,{page:e,matches:o,...t}):r.createElement(Xt,{page:e,matches:o,...t})):null}function Jt(e){let{manifest:t,routeModules:n}=Z(),[i,a]=r.useState([]);return r.useEffect(()=>{let r=!1;return Rt(e,t,n).then(e=>{r||a(e)}),()=>{r=!0}},[e,t,n]),i}function Yt({page:e,matches:t,...n}){let i=z(),{future:a}=Z(),{basename:o}=Wt(),s=r.useMemo(()=>{if(e===i.pathname+i.search+i.hash)return[];let n=Pt(e,o,a.v8_trailingSlashAwareDataRequests,`rsc`),r=!1,s=[];for(let e of t)typeof e.route.shouldRevalidate==`function`?r=!0:s.push(e.route.id);return r&&s.length>0&&n.searchParams.set(`_routes`,s.join(`,`)),[n.pathname+n.search]},[o,a.v8_trailingSlashAwareDataRequests,e,i,t]);return r.createElement(r.Fragment,null,s.map(e=>r.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})))}function Xt({page:e,matches:t,...n}){let i=z(),{future:a,manifest:o,routeModules:s}=Z(),{basename:c}=Wt(),{loaderData:l,matches:u}=Gt(),d=r.useMemo(()=>zt(e,t,u,o,i,`data`),[e,t,u,o,i]),f=r.useMemo(()=>zt(e,t,u,o,i,`assets`),[e,t,u,o,i]),p=r.useMemo(()=>{if(e===i.pathname+i.search+i.hash)return[];let n=new Set,r=!1;if(t.forEach(e=>{let t=o.routes[e.route.id];!t||!t.hasLoader||(!d.some(t=>t.route.id===e.route.id)&&e.route.id in l&&s[e.route.id]?.shouldRevalidate||t.hasClientLoader?r=!0:n.add(e.route.id))}),n.size===0)return[];let u=Pt(e,c,a.v8_trailingSlashAwareDataRequests,`data`);return r&&n.size>0&&u.searchParams.set(`_routes`,t.filter(e=>n.has(e.route.id)).map(e=>e.route.id).join(`,`)),[u.pathname+u.search]},[c,a.v8_trailingSlashAwareDataRequests,l,i,o,d,t,e,s]),m=r.useMemo(()=>Bt(f,o),[f,o]),h=Jt(f);return r.createElement(r.Fragment,null,p.map(e=>r.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),m.map(e=>r.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...n})),h.map(({key:e,link:t})=>r.createElement(`link`,{key:e,nonce:n.nonce,...t,crossOrigin:t.crossOrigin??n.crossOrigin})))}function Zt(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}r.Component;var Qt=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{Qt&&(window.__reactRouterVersion=`7.18.1`)}catch{}function $t({basename:e,children:t,useTransitions:n,window:i}){let a=r.useRef();a.current??=l({window:i,v5Compat:!0});let o=a.current,[s,c]=r.useState({action:o.action,location:o.location}),u=r.useCallback(e=>{n===!1?c(e):r.startTransition(()=>c(e))},[n]);return r.useLayoutEffect(()=>o.listen(u),[o,u]),r.createElement(gt,{basename:e,children:t,location:s.location,navigationType:s.action,navigator:o,useTransitions:n})}function en({basename:e,children:t,history:n,useTransitions:i}){let[a,o]=r.useState({action:n.action,location:n.location}),s=r.useCallback(e=>{i===!1?o(e):r.startTransition(()=>o(e))},[i]);return r.useLayoutEffect(()=>n.listen(s),[n,s]),r.createElement(gt,{basename:e,children:t,location:a.location,navigationType:a.action,navigator:n,useTransitions:i})}en.displayName=`unstable_HistoryRouter`;var tn=r.forwardRef(function({onClick:e,discover:t=`render`,prefetch:n=`none`,relative:a,reloadDocument:o,replace:s,mask:c,state:l,target:u,to:d,preventScrollReset:f,viewTransition:p,defaultShouldRevalidate:m,...h},g){let{basename:_,navigator:v,useTransitions:y}=r.useContext(P),b=typeof d==`string`&&i.test(d),x=Te(d,_);d=x.to;let S=Be(d,{relative:a}),C=z(),w=null;if(c){let e=k(c,[],C.mask?C.mask.pathname:`/`,!0);_!==`/`&&(e.pathname=e.pathname===`/`?_:A([_,e.pathname])),w=v.createHref(e)}let[T,ee,te]=Kt(n,h),ne=ln(d,{replace:s,mask:c,state:l,target:u,preventScrollReset:f,relative:a,viewTransition:p,defaultShouldRevalidate:m,useTransitions:y});function re(t){e&&e(t),t.defaultPrevented||ne(t)}let ie=!(x.isExternal||o),E=r.createElement(`a`,{...h,...te,href:(ie?w:void 0)||x.absoluteURL||S,onClick:ie?re:e,ref:Zt(g,ee),target:u,"data-discover":!b&&t===`render`?`true`:void 0});return T&&!b?r.createElement(r.Fragment,null,E,r.createElement(qt,{page:S})):E});tn.displayName=`Link`;var nn=r.forwardRef(function({"aria-current":e=`page`,caseSensitive:t=!1,className:n=``,end:i=!1,style:a,to:o,viewTransition:s,children:c,...l},u){let d=V(o,{relative:l.relative}),f=z(),p=r.useContext(N),{navigator:m,basename:h}=r.useContext(P),g=p!=null&&yn(d)&&s===!0,_=m.encodeLocation?m.encodeLocation(d).pathname:d.pathname,v=f.pathname,y=p&&p.navigation&&p.navigation.location?p.navigation.location.pathname:null;t||(v=v.toLowerCase(),y=y?y.toLowerCase():null,_=_.toLowerCase()),y&&h&&(y=O(y,h)||y);let b=_!==`/`&&_.endsWith(`/`)?_.length-1:_.length,x=v===_||!i&&v.startsWith(_)&&v.charAt(b)===`/`,S=y!=null&&(y===_||!i&&y.startsWith(_)&&y.charAt(_.length)===`/`),C={isActive:x,isPending:S,isTransitioning:g},w=x?e:void 0,T;T=typeof n==`function`?n(C):[n,x?`active`:null,S?`pending`:null,g?`transitioning`:null].filter(Boolean).join(` `);let ee=typeof a==`function`?a(C):a;return r.createElement(tn,{...l,"aria-current":w,className:T,ref:u,style:ee,to:o,viewTransition:s},typeof c==`function`?c(C):c)});nn.displayName=`NavLink`;var rn=r.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:a,replace:o,state:s,method:c=K,action:l,onSubmit:u,relative:d,preventScrollReset:f,viewTransition:p,defaultShouldRevalidate:m,...h},g)=>{let{useTransitions:_}=r.useContext(P),v=pn(),y=mn(l,{relative:d}),b=c.toLowerCase()===`get`?`get`:`post`,x=typeof l==`string`&&i.test(l);return r.createElement(`form`,{ref:g,method:b,action:y,onSubmit:a?u:e=>{if(u&&u(e),e.defaultPrevented)return;e.preventDefault();let i=e.nativeEvent.submitter,a=i?.getAttribute(`formmethod`)||c,l=()=>v(i||e.currentTarget,{fetcherKey:t,method:a,navigate:n,replace:o,state:s,relative:d,preventScrollReset:f,viewTransition:p,defaultShouldRevalidate:m});_&&n!==!1?r.startTransition(()=>l()):l()},...h,"data-discover":!x&&e===`render`?`true`:void 0})});rn.displayName=`Form`;function an({getKey:e,storageKey:t,...n}){let i=r.useContext(X),{basename:a}=r.useContext(P),o=z(),s=st();_n({getKey:e,storageKey:t});let c=r.useMemo(()=>{if(!i||!e)return null;let t=gn(o,s,a,e);return t===o.key?null:t},[]);if(!i||i.isSpaMode)return null;let l=((e,t)=>{if(!window.history.state||!window.history.state.key){let e=Math.random().toString(32).slice(2);window.history.replaceState({key:e},``)}try{let n=JSON.parse(sessionStorage.getItem(e)||`{}`)[t||window.history.state.key];typeof n==`number`&&window.scrollTo(0,n)}catch(t){console.error(t),sessionStorage.removeItem(e)}}).toString();return n.nonce==null&&i?.nonce&&(n.nonce=i.nonce),r.createElement(`script`,{...n,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:`(${l})(${Mt(JSON.stringify(t||hn))}, ${Mt(JSON.stringify(c))})`}})}an.displayName=`ScrollRestoration`;function on(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function sn(e){let t=r.useContext(M);return u(t,on(e)),t}function cn(e){let t=r.useContext(N);return u(t,on(e)),t}function ln(e,{target:t,replace:n,mask:i,state:a,preventScrollReset:o,relative:s,viewTransition:c,defaultShouldRevalidate:l,useTransitions:u}={}){let d=B(),f=z(),p=V(e,{relative:s});return r.useCallback(m=>{if(Ct(m,t)){m.preventDefault();let t=n===void 0?h(f)===h(p):n,g=()=>d(e,{replace:t,mask:i,state:a,preventScrollReset:o,relative:s,viewTransition:c,defaultShouldRevalidate:l});u?r.startTransition(()=>g()):g()}},[f,d,p,n,i,a,t,e,o,s,c,l,u])}function un(e){d(typeof URLSearchParams<`u`,"You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=r.useRef(wt(e)),n=r.useRef(!1),i=z(),a=r.useMemo(()=>Tt(i.search,n.current?null:t.current),[i.search]),o=B();return[a,r.useCallback((e,t)=>{let r=wt(typeof e==`function`?e(new URLSearchParams(a)):e);n.current=!0,o(`?`+r,t)},[o,a])]}var dn=0,fn=()=>`__${String(++dn)}__`;function pn(){let{router:e}=sn(`useSubmit`),{basename:t}=r.useContext(P),n=at(),i=e.fetch,a=e.navigate;return r.useCallback(async(e,r={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=kt(e,t);if(r.navigate===!1){let e=r.fetcherKey||fn();await i(e,n,r.action||o,{defaultShouldRevalidate:r.defaultShouldRevalidate,preventScrollReset:r.preventScrollReset,formData:l,body:u,formMethod:r.method||s,formEncType:r.encType||c,flushSync:r.flushSync})}else await a(r.action||o,{defaultShouldRevalidate:r.defaultShouldRevalidate,preventScrollReset:r.preventScrollReset,formData:l,body:u,formMethod:r.method||s,formEncType:r.encType||c,replace:r.replace,state:r.state,fromRouteId:n,flushSync:r.flushSync,viewTransition:r.viewTransition})},[i,a,t,n])}function mn(e,{relative:t}={}){let{basename:n}=r.useContext(P),i=r.useContext(I);u(i,`useFormAction must be used inside a RouteContext`);let[a]=i.matches.slice(-1),o={...V(e||`.`,{relative:t})},s=z();if(e==null){o.search=s.search;let e=new URLSearchParams(o.search),t=e.getAll(`index`);if(t.some(e=>e===``)){e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();o.search=n?`?${n}`:``}}return(!e||e===`.`)&&a.route.index&&(o.search=o.search?o.search.replace(/^\?/,`?index&`):`?index`),n!==`/`&&(o.pathname=o.pathname===`/`?n:A([n,o.pathname])),h(o)}var hn=`react-router-scroll-positions`,$={};function gn(e,t,n,r){let i=null;return r&&(i=r(n===`/`?e:{...e,pathname:O(e.pathname,n)||e.pathname},t)),i??=e.key,i}function _n({getKey:e,storageKey:t}={}){let{router:n}=sn(`useScrollRestoration`),{restoreScrollPosition:i,preventScrollReset:a}=cn(`useScrollRestoration`),{basename:o}=r.useContext(P),s=z(),c=st(),l=ot();r.useEffect(()=>(window.history.scrollRestoration=`manual`,()=>{window.history.scrollRestoration=`auto`}),[]),vn(r.useCallback(()=>{if(l.state===`idle`){let t=gn(s,c,o,e);$[t]=window.scrollY}try{sessionStorage.setItem(t||hn,JSON.stringify($))}catch(e){d(!1,`Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${e}).`)}window.history.scrollRestoration=`auto`},[l.state,e,o,s,c,t])),typeof document<`u`&&(r.useLayoutEffect(()=>{try{let e=sessionStorage.getItem(t||hn);e&&($=JSON.parse(e))}catch{}},[t]),r.useLayoutEffect(()=>{let t=n?.enableScrollRestoration($,()=>window.scrollY,e?(t,n)=>gn(t,n,o,e):void 0);return()=>t&&t()},[n,o,e]),r.useLayoutEffect(()=>{if(i!==!1){if(typeof i==`number`){window.scrollTo(0,i);return}try{if(s.hash){let e=document.getElementById(decodeURIComponent(s.hash.slice(1)));if(e){e.scrollIntoView();return}}}catch{d(!1,`"${s.hash.slice(1)}" is not a decodable element ID. The view will not scroll to it.`)}a!==!0&&window.scrollTo(0,0)}},[s,i,a]))}function vn(e,t){let{capture:n}=t||{};r.useEffect(()=>{let t=n==null?void 0:{capture:n};return window.addEventListener(`pagehide`,e,t),()=>{window.removeEventListener(`pagehide`,e,t)}},[e,n])}function yn(e,{relative:t}={}){let n=r.useContext(Me);u(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:i}=sn(`useViewTransitionState`),a=V(e,{relative:t});if(!n.isTransitioning)return!1;let o=O(n.currentLocation.pathname,i)||n.currentLocation.pathname,s=O(n.nextLocation.pathname,i)||n.nextLocation.pathname;return D(a.pathname,s)!=null||D(a.pathname,o)!=null}export{mt as a,vt as c,R as d,z as f,un as g,qe as h,pt as i,D as l,Ve as m,tn as n,ht as o,B as p,nn as r,_t as s,$t as t,y as u};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/diff-view-4wxDvYXE.js","assets/rolldown-runtime-QTnfLwEv.js","assets/react-runtime-CCIEwYL0.js","assets/dist-C_rn70hE.js","assets/bundle-mjs-rHxsej31.js","assets/chevron-right-BENZ-1ZN.js","assets/createLucideIcon-BHp8sXmF.js","assets/eye-B8okNWXU.js","assets/button-B22ANdCY.js","assets/diff-stat-Dy4uLuyP.js","assets/index-DJB0lid-.js","assets/queries-CchoEEzj.js","assets/toaster-zMN8cNZQ.js","assets/live-protocol-DMhTnCmf.js","assets/preload-helper-Czpn1I53.js","assets/chunk-KS7C4IRE-Cg8l-LDN.js","assets/label-feCJ3WOT.js","assets/cez-idle-CdswdDRd.js","assets/run-detail-refresh-C5qmRdgD.js","assets/es2015-CUEfzDjB.js","assets/reference-chip-z7dZJVH-.js","assets/design-icons-QbNMZniQ.js","assets/popover-CvL6hQ5c.js","assets/dist-DudPJH39.js","assets/dist-BuF3mvCA.js","assets/attention-DnxGjw_R.js","assets/task-groups-CGCnVqHE.js","assets/open-in-menu-CbQWVBD0.js","assets/bot-TkDIw4y-.js","assets/external-link-BE6y205O.js","assets/folder-o-AvL3y3.js","assets/smartphone-Lr8Ug2z_.js","assets/square-terminal-B6RYYieR.js","assets/dropdown-menu-DjtKUK8F.js","assets/dist-BSUJIXeE.js","assets/own-lookup-DS54wXvD.js","assets/check-OP-CVgZG.js","assets/chevron-down-CHGyCDBH.js","assets/nav-row-styles-CgP5uNp4.js","assets/folder-browser-Civftk0W.js","assets/loader-circle-CPBhhDbB.js","assets/play-CmVAj_fu.js","assets/search-x-I9Q8pgUa.js","assets/dist--f2yFdPY.js","assets/switch-CAKeV99j.js","assets/dist-Czz3Y5qH.js","assets/badge-DVxxThpb.js","assets/dialog-rpNyAWGb.js","assets/project-router-j0uBi7Ep.js","assets/read-state-c_RNJaXO.js","assets/status-dot-Drd4-nfa.js","assets/report-selection-BdGxjISG.js","assets/use-search-params-writer-ClMScnNe.js","assets/page-shell-BgabWJ3w.js","assets/page-shell-CEIoW56O.css","assets/format-BU7D3IfE.js","assets/command-B2Y0By1v.js","assets/project-order-AcHI4Dcl.js","assets/skills-pM_PouEs.js","assets/agent-accounts-D_7QcFSx.js","assets/control-locations-kCPVEtOM.js","assets/agents-settings-path-7X6_cvUg.js","assets/centered-state-BgSV4e79.js","assets/html-report-BX3msvci.js","assets/index-BK1FcZrA.css","assets/highlighter-Cfo7mLVB.js","assets/image-preview-CeEKI2T5.js","assets/zoomable-image-BUTgYpld.js","assets/textarea-vEsJAUAV.js","assets/markdown-BBDDg-4t.js","assets/markdown-BAPhDASs.js","assets/chunk-BO2N2NFS-DQrpGzb-.js","assets/lib-DrPFkMXk.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{o as r}from"./dist-C_rn70hE.js";import{t as i}from"./preload-helper-Czpn1I53.js";import{t as a}from"./diff-stat-Dy4uLuyP.js";import{n as o,r as s,t as c}from"./image-preview-CeEKI2T5.js";var l=e(t(),1),u=n();function d(e){let[t,n]=(0,l.useState)(null);return(0,l.useEffect)(()=>{let e=!1;return i(()=>import(`./diff-view-4wxDvYXE.js`).then(t=>{e||n({View:t.DiffView})},()=>{e||n(`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,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72])),()=>{e=!0}},[]),e.files.length===0?(0,u.jsx)(`p`,{"data-slot":`diff-empty`,className:r(`px-1 text-xs text-muted-foreground`,e.className),children:`No changes.`}):t===`failed`?(0,u.jsx)(f,{...e}):t===null?(0,u.jsx)(`p`,{"data-slot":`diff-loading`,className:r(`px-1 text-xs text-muted-foreground`,e.className),children:`Loading diff…`}):(0,u.jsx)(t.View,{...e})}function f({files:e,wrap:t=!1,imageSrc:n,onOpenInApp:i,viewRef:a,totals:o=!0,actions:c,className:d}){let f={adds:e.reduce((e,t)=>e+t.adds,0),dels:e.reduce((e,t)=>e+t.dels,0),files:e.length},m=(0,l.useRef)(null);return(0,l.useImperativeHandle)(a,()=>({scrollToPath:e=>{for(let t of m.current?.querySelectorAll(`[data-slot="diff-file"]`)??[])if(t.dataset.path===e){t.scrollIntoView({block:`start`,behavior:`smooth`});return}}})),(0,u.jsxs)(`div`,{ref:m,"data-slot":`diff`,"data-fallback":`true`,className:r(`flex min-w-0 flex-col gap-3`,d),children:[(0,u.jsxs)(`div`,{"data-slot":`diff-header`,hidden:!o&&!c,className:`flex min-h-9 flex-wrap items-center gap-x-2 gap-y-1.5 px-1`,children:[(0,u.jsx)(s,{stat:f,hidden:!o}),c?(0,u.jsx)(`div`,{"data-slot":`diff-actions`,className:`ms-auto flex items-center gap-1.5`,children:c}):null]}),e.map(e=>(0,u.jsx)(p,{file:e,wrap:t,imageSrc:n,onOpenInApp:i},`${e.oldPath??``}→${e.path}`))]})}function p({file:e,wrap:t,imageSrc:n,onOpenInApp:i}){let s=e.oldPath?`${e.oldPath} → ${e.path}`:e.path;return(0,u.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,u.jsxs)(`header`,{className:`flex items-start gap-2 border-b border-border px-3 py-2`,children:[(0,u.jsx)(`span`,{"data-slot":`diff-file-path`,title:s,className:`min-w-0 wrap-anywhere font-mono text-xs font-medium`,children:s}),(0,u.jsx)(`span`,{className:`ml-auto shrink-0`,children:(0,u.jsx)(a,{stat:{adds:e.adds,dels:e.dels,files:1},className:`text-xs`})})]}),o(e)?(0,u.jsx)(c,{file:e,imageSrc:n,onOpenInApp:i}):e.binary?(0,u.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-muted-foreground`,children:`Binary file — no text diff.`}):e.patch===``?(0,u.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-muted-foreground`,children:`No content changes (metadata only).`}):(0,u.jsx)(`pre`,{className:r(`py-2 font-mono text-xs leading-[1.7]`,t?`break-words whitespace-pre-wrap`:`overflow-x-auto whitespace-pre`),children:e.patch.split(`
|
|
3
|
-
`).map((e,t)=>(0,u.jsxs)(`span`,{className:r(`block px-4`,e.startsWith(`+`)&&!e.startsWith(`+++`)&&`bg-diff-add`,e.startsWith(`-`)&&!e.startsWith(`---`)&&`bg-diff-del`,e.startsWith(`@@`)&&`text-muted-foreground`),children:[e,e===``?` `:``]},t))})]})}export{d as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./react-runtime-CCIEwYL0.js";import{an as t,cn as n,in as r,ln as i,nn as a,on as o,rn as s,sn as c}from"./index-DJB0lid-.js";var l=e();function u({open:e,subject:u,onKeep:d,onDiscard:f}){return(0,l.jsx)(a,{open:e,onOpenChange:e=>!e&&d(),children:(0,l.jsxs)(t,{"data-slot":`discard-changes-dialog`,className:`sm:max-w-[560px]`,children:[(0,l.jsxs)(n,{children:[(0,l.jsx)(i,{children:`Discard unsaved changes?`}),(0,l.jsxs)(o,{children:[`Your edits to `,(0,l.jsx)(`span`,{className:`font-medium text-foreground`,children:u}),` are not saved. They are lost if you continue.`]})]}),(0,l.jsxs)(c,{children:[(0,l.jsx)(r,{"data-slot":`discard-changes-keep`,children:`Keep editing`}),(0,l.jsx)(s,{"data-slot":`discard-changes-confirm`,className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:f,children:`Discard changes`})]})]})})}export{u as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t}from"./react-runtime-CCIEwYL0.js";import{r as n,t as r}from"./bundle-mjs-rHxsej31.js";var i=`/api/v1`,a=``;function o(e){a=e.replace(/\/+$/,``)}function s(){return a}var c=null;function l(e){c=e===``?null:e}function u(){return c}function d(){return c??`default`}var f=/^\/(?:health$|models(?:$|[/?])|providers(?:$|[/?])|projects(?:$|[/?])|workspace\/|fs\/)/;function p(e){return`${a}${i}${m(e)}`}function m(e){return c===null||f.test(e)?e:`/p/${encodeURIComponent(c)}${e}`}var h=/^\/api(?:\/v1)?(\/.*)$/;function g(e){let t=/^[a-z][a-z0-9+.-]*:/i.exec(e);if(t){let n=e.indexOf(`//`,t[0].length);if(n!==t[0].length)return e;let r=e.indexOf(`/`,n+2);if(r===-1)return e;let i=e.slice(0,r),a=_(e.slice(r));return a===null?e:`${i}${a}`}let n=_(a&&e.startsWith(a)?e.slice(a.length):e);return n===null?e:`${a}${n}`}function _(e){let t=h.exec(e);if(!t)return null;let n=t[1];return n.startsWith(`/p/`)?`${i}${n}`:`${i}${m(n)}`}function v(e){return Object.fromEntries(Object.entries(e).filter(([,e])=>e!==void 0))}var y=r({extend:{classGroups:{shadow:[`shadow-modal`]}}});function b(...e){return y(n(e))}function x(e){return typeof e==`string`&&/^https?:\/\//i.test(e)}var S=e(t(),1);function C(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function w(...e){return t=>{let n=!1,r=e.map(e=>{let r=C(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():C(e[t],null)}}}}function T(...e){return S.useCallback(w(...e),e)}function E(e){let t=S.forwardRef((t,n)=>{let{children:r,...i}=t,a=null,o=!1,s=[];F(r)&&typeof z==`function`&&(r=z(r._payload)),S.Children.forEach(r,e=>{if(N(e)){o=!0;let t=e,n=`child`in t.props?t.props.child:t.props.children;F(n)&&typeof z==`function`&&(n=z(n._payload)),a=A(t,n),s.push(a?.props?.children)}else s.push(e)}),a?a=S.cloneElement(a,void 0,s):!o&&S.Children.count(r)===1&&S.isValidElement(r)&&(a=r);let c=a?M(a):void 0,l=T(n,c);if(!a){if(r||r===0)throw Error(o?R(e):L(e));return r}let u=j(i,a.props??{});return a.type!==S.Fragment&&(u.ref=n?l:c),S.cloneElement(a,u)});return t.displayName=`${e}.Slot`,t}var D=E(`Slot`),O=Symbol.for(`radix.slottable`);function k(e){let t=e=>`child`in e?e.children(e.child):e.children;return t.displayName=`${e}.Slottable`,t.__radixId=O,t}var A=(e,t)=>{if(`child`in e.props){let t=e.props.child;return S.isValidElement(t)?S.cloneElement(t,void 0,e.props.children(t.props.children)):null}return S.isValidElement(t)?t:null};function j(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function M(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function N(e){return S.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===O}var P=Symbol.for(`react.lazy`);function F(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===P&&`_payload`in e&&I(e._payload)}function I(e){return typeof e==`object`&&!!e&&`then`in e}var L=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,R=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,z=S.use;export{T as a,v as c,s as d,u as f,l as g,o as h,w as i,i as l,g as m,E as n,b as o,d as p,k as r,x as s,D as t,p as u};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{o as r}from"./dist-C_rn70hE.js";import{$ as i}from"./queries-CchoEEzj.js";import{Gt as a,Rn as o}from"./toaster-zMN8cNZQ.js";import{f as s,p as c}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{T as l,ct as u}from"./design-icons-QbNMZniQ.js";import{t as d}from"./createLucideIcon-BHp8sXmF.js";import{o as f}from"./diff-controls-CaCUSyxs.js";import{t as p}from"./centered-state-BgSV4e79.js";import{r as m}from"./html-report-BX3msvci.js";import{a as h,i as g,r as _}from"./highlighter-Cfo7mLVB.js";import{n as v,t as y}from"./markdown-BAPhDASs.js";import{t as b}from"./html-report-frame-Ck76gKfA.js";var x=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`}]]),S=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`}]]),C=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`}]]),w=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`bmp`,`ico`,`avif`]);function T(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=t.lastIndexOf(`.`);return n<=0?!1:w.has(t.slice(n+1).toLowerCase())}function E(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=t.lastIndexOf(`.`);return T(e)||n>0&&t.slice(n+1).toLowerCase()===`svg`}var D=e(t(),1);function O(e){return e.tooLarge?`too-large`:E(e.path)?`image`:e.binary?`binary`:`text`}function k(e){return e>=1024**2?`${(e/1024**2).toFixed(1)} MB`:e>=1024?`${(e/1024).toFixed(1)} kB`:`${e} B`}var A=n();function j({runId:e,path:t,className:n}){let r=i(e,t??void 0);if(t===null)return(0,A.jsx)(R,{className:n,children:(0,A.jsx)(p,{icon:(0,A.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,A.jsx)(R,{className:n,children:(0,A.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 o&&r.error.status===409;return(0,A.jsx)(R,{className:n,children:(0,A.jsx)(p,{icon:e?(0,A.jsx)(C,{}):(0,A.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,A.jsx)(P,{runId:e,entry:r.data,className:n}):(0,A.jsx)(R,{className:n,children:(0,A.jsx)(p,{icon:(0,A.jsx)(S,{}),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 M(e,t,n){let r=t?.replace(/\/+$/,``);if(r&&e.startsWith(`${r}/`))return e.slice(r.length+1);let i=/^.*\/\.ai\/(?:cezar|squawk)\/worktrees\/[^/]+\/(.+)$/.exec(e);if(i?.[1])return i[1];if(e.startsWith(`/`)&&n&&!n.startsWith(`/`)){let t=n.replace(/^\.?\//,``);if(t&&(e===`/${t}`||e.endsWith(`/${t}`)))return t}return e}function N(e,t,n){let r=t&&/\.(?:md|markdown)$/i.test(e.path),i=t&&m(e.path),a=/\.(?:png|jpe?g|gif|webp|bmp|ico|avif)$/i.test(e.path),o=t&&a&&e.size<=10*1024*1024?`image`:O(e);return{html:i,kind:o,toggle:(r||i)&&o===`text`,showImage:o===`image`&&(!t||a),rendered:n?null:r?`markdown`:i?`html`:null}}function P({runId:e,entry:t,displayPath:n,className:i,imageUrl:a,downloadUrl:o,snapshot:s,readerHref:c,documentPreview:l=!1}){let[u,d]=(0,D.useState)(!1),[p,m]=(0,D.useState)(!0),h=n??M(t.path),g=N(t,l,u),_=!!(s||o||g.toggle),v=!g.showImage&&g.kind===`text`&&g.rendered===null;return(0,A.jsxs)(R,{className:i,children:[(0,A.jsxs)(`header`,{"data-slot":`file-preview-head`,className:r(`flex min-h-11 items-center gap-2 border-b border-border bg-muted/40 ps-4 text-xs`,v?`pe-2 py-1`:`pe-4 py-2.5`),children:[(0,A.jsx)(`span`,{className:`min-w-0 truncate font-mono font-medium text-foreground`,title:h,children:h}),(0,A.jsx)(`span`,{"data-slot":`file-preview-size`,className:`ml-auto shrink-0 font-mono text-xs tabular-nums text-muted-foreground`,children:k(t.size)}),v?(0,A.jsx)(f,{wrap:p,onWrapChange:m,className:`rounded-md`}):null]}),_?(0,A.jsx)(I,{snapshot:s,downloadUrl:o,source:g.toggle?u:null,onSource:()=>d(e=>!e),readerHref:g.html&&g.kind===`text`?c:void 0}):null,(0,A.jsx)(F,{runId:e,entry:t,kind:g.kind,showImage:g.showImage,rendered:g.rendered,imageUrl:a,wrap:p})]})}function F({runId:e,entry:t,kind:n,showImage:r,rendered:i,imageUrl:o,wrap:s}){return r?(0,A.jsx)(`div`,{className:`flex justify-center p-4`,children:(0,A.jsx)(`img`,{"data-slot":`file-preview-image`,src:o??a(e,t.path),alt:t.path,className:`max-h-[70vh] max-w-full rounded-sm`})}):n===`too-large`?(0,A.jsx)(p,{icon:(0,A.jsx)(x,{}),tone:`neutral`,heading:`h2`,title:`Too large to preview`,subtitle:`${k(t.size)} — past the preview cap. Open it in your editor instead.`}):n===`binary`?(0,A.jsx)(p,{icon:(0,A.jsx)(S,{}),tone:`neutral`,heading:`h2`,title:`Binary file`,subtitle:`${k(t.size)} of binary data — no text preview.`}):i===`markdown`?(0,A.jsx)(`div`,{className:`p-4`,children:(0,A.jsx)(y,{document:!0,children:t.content??``})}):i===`html`?(0,A.jsx)(b,{html:t.content??``,title:`Report: ${t.path}`,className:`h-[70vh]`}):(0,A.jsx)(V,{path:t.path,text:t.content??``,wrap:s})}function I({snapshot:e,downloadUrl:t,source:n,onSource:r,readerHref:i}){return(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 border-b border-border px-4 py-2 text-xs`,children:[e?(0,A.jsxs)(`span`,{children:[`Published snapshot · `,e]}):null,t?(0,A.jsx)(`a`,{className:`inline-flex min-h-11 items-center text-accent-text underline`,href:t,children:`Download`}):null,n===null?null:(0,A.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,A.jsx)(L,{href:i}):null]})}function L({href:e}){let t=c(),n=s();return(0,A.jsx)(`a`,{className:`inline-flex min-h-11 items-center px-2 text-accent-text underline focus-visible:ring-2`,href:e,onClick:r=>v(r,t,e,n),children:`Open reader`})}function R({className:e,children:t}){return(0,A.jsx)(`section`,{"data-slot":`file-preview`,className:r(`flex flex-col overflow-hidden rounded-lg border border-border bg-card`,e),children:t})}var z=1500;function B(e,t){let n=(0,D.useMemo)(()=>t.split(`
|
|
2
|
-
`).map(e=>[{content:e}]),[t]),r=(0,D.useMemo)(()=>h(e),[e]),i=n.length>z,[a,o]=(0,D.useState)(null);return(0,D.useEffect)(()=>{if(r===null||i)return;let n=!1;return _(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:g(t,r)?.tokens??n}function V({path:e,text:t,wrap:n=!1}){let i=B(e,t);return(0,A.jsx)(`div`,{"data-slot":`file-preview-code`,"data-lang":h(e)??`plaintext`,className:`overflow-x-auto overscroll-x-contain py-2 font-mono text-xs leading-[1.7] [scrollbar-width:thin]`,children:(0,A.jsx)(`div`,{className:n?`min-w-0`:`w-max min-w-full`,children:i.map((e,t)=>(0,A.jsxs)(`div`,{className:`flex`,children:[(0,A.jsx)(`span`,{className:`sticky left-0 w-14 shrink-0 select-none bg-card pr-3 pl-4 text-right tabular-nums text-muted-foreground`,children:t+1}),(0,A.jsx)(`span`,{className:r(`min-w-0 flex-1 pr-6`,n?`whitespace-pre-wrap wrap-anywhere`:`whitespace-pre`),children:e.map((e,t)=>(0,A.jsx)(`span`,{style:e.color===void 0?void 0:{color:e.color},children:e.content},t))})]},t))})})}export{k as a,S as c,M as i,x as l,P as n,E as o,j as r,C as s,V as t};
|