@hearsay-tools/squawk 0.18.0-pr4358.8529.2 → 0.18.0-pr4359.8533
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/runners/claude/config-files.js +1 -1
- package/dist/runners/claude/config-files.js.map +1 -1
- package/dist/runners/pi/display.d.ts +1 -1
- package/dist/runners/pi/display.js +1 -1
- package/dist/server/server.d.ts +8 -8
- package/package.json +4 -4
- package/web/dist/assets/accounts-section-C4cUskp7.js +1 -0
- package/web/dist/assets/{activity-motion-DcKVM8fM.css → activity-motion-0wHCeUs7.css} +1 -1
- package/web/dist/assets/activity-motion-DIX3bcyB.js +2 -0
- package/web/dist/assets/activity-route-a6v44jSV.js +1 -0
- package/web/dist/assets/agent-config-section-CazTT2mr.js +1 -0
- package/web/dist/assets/agent-defaults-section-CsAvxnzW.js +1 -0
- package/web/dist/assets/appearance-Bk8WVWHF.js +1 -0
- package/web/dist/assets/archive-on-merge-field-CEyCpweg.js +1 -0
- package/web/dist/assets/automations-route--30oSCSi.js +1 -0
- package/web/dist/assets/{badge-DQ3U69Ht.js → badge-D9JrXe0o.js} +1 -1
- package/web/dist/assets/{button-B7MKxYjT.js → button-BQ2y4XRB.js} +1 -1
- package/web/dist/assets/{command-KdW7aO0N.js → command-CDt1BsZy.js} +1 -1
- package/web/dist/assets/commit-diff-panel-B5u3nzBH.js +1 -0
- package/web/dist/assets/{dialog-B531GGAo.js → dialog-BVF6dIeS.js} +1 -1
- package/web/dist/assets/diff-CVqwOFJx.js +3 -0
- package/web/dist/assets/diff-controls-BSWICnsb.js +1 -0
- package/web/dist/assets/diff-view-CfDyBNLk.js +11 -0
- package/web/dist/assets/dist-C28wFbz0.js +1 -0
- package/web/dist/assets/file-preview-BXBSy4MR.js +2 -0
- package/web/dist/assets/{folder-browser-Dg4CmonF.js → folder-browser-Bn83Rjyn.js} +1 -1
- package/web/dist/assets/format-BNCkW110.js +1 -0
- package/web/dist/assets/git-toolbar-CKOW2Bjf.js +1 -0
- package/web/dist/assets/github-A2sjbmuv.js +1 -0
- package/web/dist/assets/global-activity-route-CZY9ssbt.js +1 -0
- package/web/dist/assets/hourglass-B0lPAJvT.js +1 -0
- package/web/dist/assets/image-preview-CNBuRrK5.js +1 -0
- package/web/dist/assets/index-2DP8fWMQ.css +1 -0
- package/web/dist/assets/index-Clu9VXJs.js +21 -0
- package/web/dist/assets/{label-D1xUdJjL.js → label-tOtTf55G.js} +1 -1
- package/web/dist/assets/live-refetch-CZb2VOyu.js +1 -0
- package/web/dist/assets/{markdown-RK9z1Cn3.js → markdown-C6YMilQS.js} +1 -1
- package/web/dist/assets/{notifications-section-CPqz7gvQ.js → notifications-section-Ceh7_qob.js} +1 -1
- package/web/dist/assets/open-in-menu-xzDJ4_Tv.js +1 -0
- package/web/dist/assets/{preview-pane-connected-Cc8MoILP.js → preview-pane-connected-Ca9btxCQ.js} +3 -3
- package/web/dist/assets/{project-location-CDQm9Gul.js → project-location-C9WLgY3A.js} +1 -1
- package/web/dist/assets/projects-section-C6TNM8uI.js +1 -0
- package/web/dist/assets/prompt-templates-section-DHqBQdL-.js +1 -0
- package/web/dist/assets/queries-DRpvYgai.js +1 -0
- package/web/dist/assets/{reference-chip-Clhghu8I.js → reference-chip-zRuFkaGy.js} +1 -1
- package/web/dist/assets/{remote-settings-notice-CJcE3lxR.js → remote-settings-notice-mnASAu6Z.js} +1 -1
- package/web/dist/assets/repo-git-Dc7y1A-S.js +1 -0
- package/web/dist/assets/{report-reader-BxaTkr-v.js → report-reader-CAi5A1hx.js} +1 -1
- package/web/dist/assets/reports-B7QAzibP.css +1 -0
- package/web/dist/assets/reports-C8NVgUwM.js +1 -0
- package/web/dist/assets/resources-section-CcCHCo4b.js +1 -0
- package/web/dist/assets/{run-header-Ccnr9k0X.css → run-header-CC7VUTg9.css} +1 -1
- package/web/dist/assets/run-header-Dpr7e1J3.js +2 -0
- package/web/dist/assets/{session-context-section-DcCwhluX.js → session-context-section-Ga1E-Y_8.js} +2 -2
- package/web/dist/assets/settings-agent-picker-DTDM4RXo.js +1 -0
- package/web/dist/assets/settings-field-Bl6WuvGX.js +1 -0
- package/web/dist/assets/settings-shell-CTuW5ilp.js +1 -0
- package/web/dist/assets/settings-shell-xK8txSJo.css +1 -0
- package/web/dist/assets/{sidebar-section-C-CH38q4.js → sidebar-section-D9xKMCxo.js} +1 -1
- package/web/dist/assets/skills-QSp2j0Ei.js +1 -0
- package/web/dist/assets/{status-dot-BRzVlF2X.js → status-dot-DtAOFiIi.js} +1 -1
- package/web/dist/assets/switch-Bv2Zf1uU.js +1 -0
- package/web/dist/assets/task-changes-C_1yQ3pc.js +1 -0
- package/web/dist/assets/task-commits-B156s4Br.js +1 -0
- package/web/dist/assets/task-files-DQyZkvNF.js +1 -0
- package/web/dist/assets/{task-github-item-Bw46CXoB.js → task-github-item-trHnGX_B.js} +1 -1
- package/web/dist/assets/{task-groups-fk4Gq4hX.js → task-groups-ClNnAPRA.js} +1 -1
- package/web/dist/assets/task-thread-B4DPy4Lk.js +9 -0
- package/web/dist/assets/task-thread-DtQ6uGfQ.css +1 -0
- package/web/dist/assets/{tasks-table-JFvtNCc1.js → tasks-table-CE_VVk0w.js} +1 -1
- package/web/dist/assets/thread-state-BsUveC05.js +4 -0
- package/web/dist/assets/use-hand-to-agent-state-C7esPJ-N.css +1 -0
- package/web/dist/assets/use-hand-to-agent-state-CtDcLIHc.js +1 -0
- package/web/dist/assets/workflows-BQkr2ayW.js +7 -0
- package/web/dist/assets/workflows-C21NystW.css +1 -0
- package/web/dist/assets/workspace-tools-aucXH9WE.js +1 -0
- package/web/dist/assets/worktrees-section-A8b6TByx.js +4 -0
- package/web/dist/index.html +19 -21
- package/web/dist/assets/accounts-section-BQBCIvIe.js +0 -1
- package/web/dist/assets/activity-motion-BoUcFlcy.js +0 -2
- package/web/dist/assets/activity-route-dsZrLgOz.js +0 -1
- package/web/dist/assets/agent-config-section-8C_KG8qw.js +0 -7
- package/web/dist/assets/agent-defaults-section-Cpg6ytin.js +0 -1
- package/web/dist/assets/appearance-CujGGeIB.js +0 -1
- package/web/dist/assets/archive-on-merge-field-BKFGWhTW.js +0 -1
- package/web/dist/assets/automations-route-CcCP4L7S.js +0 -2
- package/web/dist/assets/automations-route-CutF-cGn.css +0 -1
- package/web/dist/assets/change-counts-CW7O8g5Y.js +0 -1
- package/web/dist/assets/check-OP-CVgZG.js +0 -1
- package/web/dist/assets/circle-x-7nTlobAF.js +0 -1
- package/web/dist/assets/commit-list-DaVNfLE5.js +0 -1
- package/web/dist/assets/diff-CCzM8XxZ.js +0 -3
- package/web/dist/assets/diff-controls-C0gH_nhG.js +0 -1
- package/web/dist/assets/diff-view-C8P6QDsN.js +0 -11
- package/web/dist/assets/dist-Czz3Y5qH.js +0 -1
- package/web/dist/assets/file-preview-UYewjhvt.js +0 -2
- package/web/dist/assets/format-BU7D3IfE.js +0 -1
- package/web/dist/assets/git-toolbar-Icz0Cr21.js +0 -1
- package/web/dist/assets/github-nBa7OE-M.js +0 -1
- package/web/dist/assets/global-activity-route-NYRbJrma.js +0 -1
- package/web/dist/assets/hourglass-CikYdGGQ.js +0 -1
- package/web/dist/assets/image-preview-BuZ5gCX-.js +0 -1
- package/web/dist/assets/index-B_cJa9gM.css +0 -1
- package/web/dist/assets/index-C4gjdVLi.js +0 -21
- package/web/dist/assets/live-refetch-1_o4J83F.js +0 -1
- package/web/dist/assets/loader-circle-CPBhhDbB.js +0 -1
- package/web/dist/assets/open-in-menu-D4ACqxcC.js +0 -1
- package/web/dist/assets/projects-section-ClAkyY7D.js +0 -1
- package/web/dist/assets/prompt-templates-section-U3HnlNQb.js +0 -1
- package/web/dist/assets/queries-BvWsZhaH.js +0 -1
- package/web/dist/assets/repo-git-CTIUcfsM.js +0 -1
- package/web/dist/assets/reports-Bz9ZRI-7.js +0 -1
- package/web/dist/assets/reports-DjDzVB_M.css +0 -1
- package/web/dist/assets/resources-section-Dj1Bjzmf.js +0 -1
- package/web/dist/assets/run-header-BXQ-HR4O.js +0 -2
- package/web/dist/assets/save-cue-Cd3ZAPBS.js +0 -1
- package/web/dist/assets/select-BhUI2GEt.js +0 -1
- package/web/dist/assets/settings-agent-picker-BdABOxwW.js +0 -1
- package/web/dist/assets/settings-field-DP9sYv5a.js +0 -1
- package/web/dist/assets/settings-select-CCIMGnyA.js +0 -1
- package/web/dist/assets/settings-shell-BUJWIyf6.js +0 -1
- package/web/dist/assets/settings-shell-iSd4xMWS.css +0 -1
- package/web/dist/assets/skills-Be22BJDw.js +0 -1
- package/web/dist/assets/switch-SP8pw5uU.js +0 -1
- package/web/dist/assets/task-changes-D7ezDVM5.js +0 -1
- package/web/dist/assets/task-commits-DxjVd56-.js +0 -1
- package/web/dist/assets/task-files-CVcyteyQ.js +0 -1
- package/web/dist/assets/task-thread-cVekDQbH.js +0 -9
- package/web/dist/assets/task-thread-nVvn3n6d.css +0 -1
- package/web/dist/assets/thread-state-DU6osVw_.js +0 -4
- package/web/dist/assets/use-hand-to-agent-state-B6h6kcQg.css +0 -1
- package/web/dist/assets/use-hand-to-agent-state-C0vpMYLO.js +0 -1
- package/web/dist/assets/workflows-C6suai0L.css +0 -1
- package/web/dist/assets/workflows-CsB1csR4.js +0 -7
- package/web/dist/assets/workspace-tools-BXxPB3zi.js +0 -1
- package/web/dist/assets/worktrees-section-BNnScarl.js +0 -4
package/web/dist/assets/{session-context-section-DcCwhluX.js → session-context-section-Ga1E-Y_8.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./utils-DSMR_WLb.js";import{Nn as i}from"./project-scope-context-C912rTJP.js";import{D as a,O as o,S as s}from"./queries-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./utils-DSMR_WLb.js";import{Nn as i}from"./project-scope-context-C912rTJP.js";import{D as a,O as o,S as s}from"./queries-DRpvYgai.js";import{n as c}from"./toaster-Bo5vCbz-.js";import{t as l}from"./plus-CxRU2X8C.js";import{t as u}from"./button-BQ2y4XRB.js";import{t as d}from"./badge-D9JrXe0o.js";import{t as f}from"./centered-state-V15AR_qo.js";import{Un as p,_n as m,er as h}from"./index-Clu9VXJs.js";import{t as g}from"./code-editor-B4baSOhz.js";var _=e(t(),1);function v(e,t,n){let r=e.indexOf(t),i={ArrowRight:1,ArrowDown:1,ArrowLeft:-1,ArrowUp:-1};if(n===`Home`)return e[0];if(n===`End`)return e.at(-1);if(!(i[n]===void 0||r===-1))return e[(r+i[n]+e.length)%e.length]}var y=n(),b={"built-in":`built in`,parent:`parent`,worker:`worker`,both:`both`},x={applied:`border-success/40 text-success`,skipped:`border-conflict/50 text-conflict`,"not-for-role":`text-soft-foreground`},S=e=>`${e.toLocaleString(`en-US`)} B`;function C({id:e,preview:t,role:n,onRole:i,pending:a,className:o}){return(0,y.jsxs)(`section`,{id:e,"data-slot":`session-context-preview`,"aria-labelledby":`session-context-preview-title`,"aria-busy":a,className:r(`flex flex-col overflow-hidden rounded-lg border border-border bg-card`,o),children:[(0,y.jsxs)(`div`,{className:`flex flex-col gap-3 border-b border-border p-3`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,y.jsx)(`h3`,{id:`session-context-preview-title`,className:`text-sm font-semibold`,children:`Preview`}),(0,y.jsx)(`span`,{className:`ml-auto text-[12px] text-soft-foreground`,children:`Updates as you type`})]}),(0,y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-2`,children:[(0,y.jsx)(`span`,{id:`session-context-role`,className:`text-[12px] text-soft-foreground`,children:`Preview as`}),(0,y.jsx)(w,{role:n,onRole:i}),(0,y.jsx)(`span`,{className:`text-[12px] text-soft-foreground`,children:`Files come from the project checkout. Task values are samples.`})]}),t?(0,y.jsx)(te,{used:t.usedBytes,limit:t.limitBytes,blocks:t.blocks}):(0,y.jsx)(`div`,{className:`h-[38px]`})]}),(0,y.jsx)(`ul`,{"data-slot":`session-context-blocks`,className:`divide-y divide-border`,children:t?.blocks.map((e,t)=>(0,y.jsx)(ne,{block:e,role:n},`${e.id}-${t}`))})]})}var ee=[`parent`,`worker`];function w({role:e,onRole:t}){let n=(0,_.useRef)(new Map);return(0,y.jsx)(`div`,{role:`radiogroup`,"aria-labelledby":`session-context-role`,onKeyDown:r=>{let i=v(ee,e,r.key);i!==void 0&&(r.preventDefault(),t(i),n.current.get(i)?.focus())},className:`inline-flex overflow-hidden rounded-md border border-[var(--control-border)]`,children:ee.map(i=>(0,y.jsx)(`button`,{ref:e=>{e?n.current.set(i,e):n.current.delete(i)},type:`button`,role:`radio`,"aria-checked":e===i,tabIndex:e===i?0:-1,"data-slot":`session-context-role`,onClick:()=>t(i),className:r(`min-h-11 px-4 text-[13px] capitalize text-muted-foreground focus-visible:outline-2 focus-visible:outline-ring`,e===i&&`bg-muted text-foreground`),children:i},i))})}function te({used:e,limit:t,blocks:n}){let r=n.filter(e=>e.status===`applied`).length,i=n.filter(e=>e.status===`skipped`).length,a=Math.min(100,e/t*100);return(0,y.jsxs)(`div`,{"data-slot":`session-context-meter`,children:[(0,y.jsx)(`div`,{role:`meter`,"aria-label":`Session context size`,"aria-valuemin":0,"aria-valuemax":t,"aria-valuenow":e,"aria-valuetext":`${S(e)} of ${S(t)}`,className:`h-2 overflow-hidden rounded-full bg-muted`,children:(0,y.jsx)(`div`,{className:`h-full rounded-full bg-accent-strong`,style:{width:`${a}%`}})}),(0,y.jsxs)(`div`,{className:`mt-1.5 flex flex-wrap gap-x-3 text-[12px]`,children:[(0,y.jsxs)(`span`,{className:`text-muted-foreground`,children:[S(e),` used: `,r,` `,r===1?`block`:`blocks`,` applied`,i>0?`, ${i} skipped`:``]}),(0,y.jsxs)(`span`,{className:`ml-auto text-soft-foreground`,children:[`Limit 64 KiB (`,S(t),`)`]})]})]})}function ne({block:e,role:t}){let n=e.status===`not-for-role`?`not for ${t}`:e.status;return(0,y.jsxs)(`li`,{"data-slot":`session-context-block`,"data-status":e.status,className:`flex flex-col gap-1.5 p-3`,children:[(0,y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,y.jsx)(`code`,{className:`font-mono text-[12px] text-foreground`,children:e.id}),e.target&&(0,y.jsx)(d,{variant:`outline`,className:`text-[11px]`,children:b[e.target]}),(0,y.jsx)(`span`,{className:`ml-auto font-mono text-[12px] text-soft-foreground`,children:e.bytes===null?`—`:S(e.bytes)}),(0,y.jsx)(d,{variant:`outline`,className:r(`text-[11px]`,x[e.status]),children:n})]}),e.reason&&(0,y.jsx)(`p`,{className:`text-[12px] text-conflict`,children:e.reason}),e.text!==null&&(0,y.jsxs)(`pre`,{tabIndex:0,"aria-label":`${e.id} text`,className:`max-h-28 overflow-auto rounded-md bg-background px-2.5 py-2 font-mono text-[12px] whitespace-pre-wrap text-muted-foreground focus-visible:outline-2 focus-visible:outline-ring`,children:[e.text,e.truncated?`
|
|
2
2
|
…`:``]})]})}var T=Symbol.for(`yaml.alias`),re=Symbol.for(`yaml.document`),E=Symbol.for(`yaml.map`),ie=Symbol.for(`yaml.pair`),D=Symbol.for(`yaml.scalar`),O=Symbol.for(`yaml.seq`),k=Symbol.for(`yaml.node.type`),ae=e=>!!e&&typeof e==`object`&&e[k]===T,oe=e=>!!e&&typeof e==`object`&&e[k]===re,A=e=>!!e&&typeof e==`object`&&e[k]===E,j=e=>!!e&&typeof e==`object`&&e[k]===ie,M=e=>!!e&&typeof e==`object`&&e[k]===D,se=e=>!!e&&typeof e==`object`&&e[k]===O;function N(e){if(e&&typeof e==`object`)switch(e[k]){case E:case O:return!0}return!1}function P(e){if(e&&typeof e==`object`)switch(e[k]){case T:case E:case D:case O:return!0}return!1}var ce=e=>(M(e)||N(e))&&!!e.anchor,F=Symbol(`break visit`),le=Symbol(`skip children`),I=Symbol(`remove node`);function ue(e,t){let n=me(t);oe(e)?de(null,e.contents,n,Object.freeze([e]))===I&&(e.contents=null):de(null,e,n,Object.freeze([]))}ue.BREAK=F,ue.SKIP=le,ue.REMOVE=I;function de(e,t,n,r){let i=he(e,t,n,r);if(P(i)||j(i))return ge(e,r,i),de(e,i,n,r);if(typeof i!=`symbol`){if(N(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=de(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===F)return F;else i===I&&(t.items.splice(e,1),--e)}}else if(j(t)){r=Object.freeze(r.concat(t));let e=de(`key`,t.key,n,r);if(e===F)return F;e===I&&(t.key=null);let i=de(`value`,t.value,n,r);if(i===F)return F;i===I&&(t.value=null)}}return i}async function fe(e,t){let n=me(t);oe(e)?await pe(null,e.contents,n,Object.freeze([e]))===I&&(e.contents=null):await pe(null,e,n,Object.freeze([]))}fe.BREAK=F,fe.SKIP=le,fe.REMOVE=I;async function pe(e,t,n,r){let i=await he(e,t,n,r);if(P(i)||j(i))return ge(e,r,i),pe(e,i,n,r);if(typeof i!=`symbol`){if(N(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=await pe(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===F)return F;else i===I&&(t.items.splice(e,1),--e)}}else if(j(t)){r=Object.freeze(r.concat(t));let e=await pe(`key`,t.key,n,r);if(e===F)return F;e===I&&(t.key=null);let i=await pe(`value`,t.value,n,r);if(i===F)return F;i===I&&(t.value=null)}}return i}function me(e){return typeof e==`object`&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function he(e,t,n,r){if(typeof n==`function`)return n(e,t,r);if(A(t))return n.Map?.(e,t,r);if(se(t))return n.Seq?.(e,t,r);if(j(t))return n.Pair?.(e,t,r);if(M(t))return n.Scalar?.(e,t,r);if(ae(t))return n.Alias?.(e,t,r)}function ge(e,t,n){let r=t[t.length-1];if(N(r))r.items[e]=n;else if(j(r))e===`key`?r.key=n:r.value=n;else if(oe(r))r.contents=n;else{let e=ae(r)?`alias`:`scalar`;throw Error(`Cannot replace node with ${e} parent`)}}var _e={"!":`%21`,",":`%2C`,"[":`%5B`,"]":`%5D`,"{":`%7B`,"}":`%7D`},ve=e=>e.replace(/[!,[\]{}]/g,e=>_e[e]),L=class e{constructor(t,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},e.defaultYaml,t),this.tags=Object.assign({},e.defaultTags,n)}clone(){let t=new e(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){let t=new e(this.yaml,this.tags);switch(this.yaml.version){case`1.1`:this.atNextDocument=!0;break;case`1.2`:this.atNextDocument=!1,this.yaml={explicit:e.defaultYaml.explicit,version:`1.2`},this.tags=Object.assign({},e.defaultTags);break}return t}add(t,n){this.atNextDocument&&=(this.yaml={explicit:e.defaultYaml.explicit,version:`1.1`},this.tags=Object.assign({},e.defaultTags),!1);let r=t.trim().split(/[ \t]+/),i=r.shift();switch(i){case`%TAG`:{if(r.length!==2&&(n(0,`%TAG directive should contain exactly two parts`),r.length<2))return!1;let[e,t]=r;return this.tags[e]=t,!0}case`%YAML`:{if(this.yaml.explicit=!0,r.length!==1)return n(0,`%YAML directive should contain exactly one part`),!1;let[e]=r;if(e===`1.1`||e===`1.2`)return this.yaml.version=e,!0;{let t=/^\d+\.\d+$/.test(e);return n(6,`Unsupported YAML version ${e}`,t),!1}}default:return n(0,`Unknown directive ${i}`,!0),!1}}tagName(e,t){if(e===`!`)return`!`;if(e[0]!==`!`)return t(`Not a valid tag: ${e}`),null;if(e[1]===`<`){let n=e.slice(2,-1);return n===`!`||n===`!!`?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==`>`&&t(`Verbatim tags must end with a >`),n)}let[,n,r]=e.match(/^(.*!)([^!]*)$/s);r||t(`The ${e} tag has no suffix`);let i=this.tags[n];if(i)try{return i+decodeURIComponent(r)}catch(e){return t(String(e)),null}return n===`!`?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[t,n]of Object.entries(this.tags))if(e.startsWith(n))return t+ve(e.substring(n.length));return e[0]===`!`?e:`!<${e}>`}toString(e){let t=this.yaml.explicit?[`%YAML ${this.yaml.version||`1.2`}`]:[],n=Object.entries(this.tags),r;if(e&&n.length>0&&P(e.contents)){let t={};ue(e.contents,(e,n)=>{P(n)&&n.tag&&(t[n.tag]=!0)}),r=Object.keys(t)}else r=[];for(let[i,a]of n)i===`!!`&&a===`tag:yaml.org,2002:`||(!e||r.some(e=>e.startsWith(a)))&&t.push(`%TAG ${i} ${a}`);return t.join(`
|
|
3
3
|
`)}};L.defaultYaml={explicit:!1,version:`1.2`},L.defaultTags={"!!":`tag:yaml.org,2002:`};function ye(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw Error(t)}return!0}function be(e){let t=new Set;return ue(e,{Value(e,n){n.anchor&&t.add(n.anchor)}}),t}function xe(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function Se(e,t){let n=[],r=new Map,i=null;return{onAnchor:r=>{n.push(r),i??=be(e);let a=xe(t,i);return i.add(a),a},setAnchors:()=>{for(let e of n){let t=r.get(e);if(typeof t==`object`&&t.anchor&&(M(t.node)||N(t.node)))t.node.anchor=t.anchor;else{let t=Error(`Failed to resolve repeated object (this should not happen)`);throw t.source=e,t}}},sourceObjects:r}}function R(e,t,n,r){if(r&&typeof r==`object`)if(Array.isArray(r))for(let t=0,n=r.length;t<n;++t){let n=r[t],i=R(e,r,String(t),n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}else if(r instanceof Map)for(let t of Array.from(r.keys())){let n=r.get(t),i=R(e,r,t,n);i===void 0?r.delete(t):i!==n&&r.set(t,i)}else if(r instanceof Set)for(let t of Array.from(r)){let n=R(e,r,t,t);n===void 0?r.delete(t):n!==t&&(r.delete(t),r.add(n))}else for(let[t,n]of Object.entries(r)){let i=R(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}return e.call(t,n,r)}function z(e,t,n){if(Array.isArray(e))return e.map((e,t)=>z(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!ce(e))return e.toJSON(t,n);let r={aliasCount:0,count:1,res:void 0};n.anchors.set(e,r),n.onCreate=e=>{r.res=e,delete n.onCreate};let i=e.toJSON(t,n);return n.onCreate&&n.onCreate(i),i}return typeof e==`bigint`&&!n?.keep?Number(e):e}var Ce=class{constructor(e){Object.defineProperty(this,k,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:n,onAnchor:r,reviver:i}={}){if(!oe(e))throw TypeError(`A document argument is required`);let a={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof n==`number`?n:100},o=z(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?R(i,{"":o},``,o):o}},we=class extends Ce{constructor(e){super(T),this.source=e,Object.defineProperty(this,"tag",{set(){throw Error(`Alias nodes cannot have tags`)}})}resolve(e,t){if(t?.maxAliasCount===0)throw ReferenceError(`Alias resolution is disabled`);let n;t?.aliasResolveCache?n=t.aliasResolveCache:(n=[],ue(e,{Node:(e,t)=>{(ae(t)||ce(t))&&n.push(t)}}),t&&(t.aliasResolveCache=n));let r;for(let e of n){if(e===this)break;e.anchor===this.source&&(r=e)}return r}toJSON(e,t){if(!t)return{source:this.source};let{anchors:n,doc:r,maxAliasCount:i}=t,a=this.resolve(r,t);if(!a){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(e)}let o=n.get(a);if(o||=(z(a,null,t),n.get(a)),o?.res===void 0)throw ReferenceError(`This should not happen: Alias anchor was not resolved?`);if(i>=0&&(o.count+=1,o.aliasCount===0&&(o.aliasCount=Te(r,a,n)),o.count*o.aliasCount>i))throw ReferenceError(`Excessive alias count indicates a resource exhaustion attack`);return o.res}toString(e,t,n){let r=`*${this.source}`;if(e){if(ye(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(e)}if(e.implicitKey)return`${r} `}return r}};function Te(e,t,n){if(ae(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}else if(N(t)){let r=0;for(let i of t.items){let t=Te(e,i,n);t>r&&(r=t)}return r}else if(j(t)){let r=Te(e,t.key,n),i=Te(e,t.value,n);return Math.max(r,i)}return 1}var Ee=e=>!e||typeof e!=`function`&&typeof e!=`object`,B=class extends Ce{constructor(e){super(D),this.value=e}toJSON(e,t){return t?.keep?this.value:z(this.value,e,t)}toString(){return String(this.value)}};B.BLOCK_FOLDED=`BLOCK_FOLDED`,B.BLOCK_LITERAL=`BLOCK_LITERAL`,B.PLAIN=`PLAIN`,B.QUOTE_DOUBLE=`QUOTE_DOUBLE`,B.QUOTE_SINGLE=`QUOTE_SINGLE`;var De=`tag:yaml.org,2002:`;function Oe(e,t,n){if(t){let e=n.filter(e=>e.tag===t),r=e.find(e=>!e.format)??e[0];if(!r)throw Error(`Tag ${t} not found`);return r}return n.find(t=>t.identify?.(e)&&!t.format)}function ke(e,t,n){if(oe(e)&&(e=e.contents),P(e))return e;if(j(e)){let t=n.schema[E].createNode?.(n.schema,null,n);return t.items.push(e),t}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<`u`&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:r,onAnchor:i,onTagObj:a,schema:o,sourceObjects:s}=n,c;if(r&&e&&typeof e==`object`){if(c=s.get(e),c)return c.anchor??=i(e),new we(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=De+t.slice(2));let l=Oe(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new B(e);return c&&(c.node=t),t}l=e instanceof Map?o[E]:Symbol.iterator in Object(e)?o[O]:o[E]}a&&(a(l),delete n.onTagObj);let u=l?.createNode?l.createNode(n.schema,e,n):typeof l?.nodeClass?.from==`function`?l.nodeClass.from(n.schema,e,n):new B(e);return t?u.tag=t:l.default||(u.tag=l.tag),c&&(c.node=u),u}function Ae(e,t,n){let r=n;for(let e=t.length-1;e>=0;--e){let n=t[e];if(typeof n==`number`&&Number.isInteger(n)&&n>=0){let e=[];e[n]=r,r=e}else r=new Map([[n,r]])}return ke(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error(`This should not happen, please report a bug.`)},schema:e,sourceObjects:new Map})}var je=e=>e==null||typeof e==`object`&&!!e[Symbol.iterator]().next().done,Me=class extends Ce{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(t=>P(t)||j(t)?t.clone(e):t),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(je(e))this.add(t);else{let[n,...r]=e,i=this.get(n,!0);if(N(i))i.addIn(r,t);else if(i===void 0&&this.schema)this.set(n,Ae(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}deleteIn(e){let[t,...n]=e;if(n.length===0)return this.delete(t);let r=this.get(t,!0);if(N(r))return r.deleteIn(n);throw Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}getIn(e,t){let[n,...r]=e,i=this.get(n,!0);return r.length===0?!t&&M(i)?i.value:i:N(i)?i.getIn(r,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!j(t))return!1;let n=t.value;return n==null||e&&M(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[t,...n]=e;if(n.length===0)return this.has(t);let r=this.get(t,!0);return N(r)?r.hasIn(n):!1}setIn(e,t){let[n,...r]=e;if(r.length===0)this.set(n,t);else{let e=this.get(n,!0);if(N(e))e.setIn(r,t);else if(e===void 0&&this.schema)this.set(n,Ae(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}},Ne=e=>e.replace(/^(?!$)(?: $)?/gm,`#`);function V(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var H=(e,t,n)=>e.endsWith(`
|
|
4
4
|
`)?V(n,t):n.includes(`
|
|
@@ -116,4 +116,4 @@ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\
|
|
|
116
116
|
`),$(`${n} - id: `,t,`${Or(` `)}\n`)}function Fr(e,t,n){if(!se(t)||!t.range)return;let r=t.items.at(-1);if(t.flow)return jr(e,t.range[0],r,n);let i=t.items[0]?.range?.[0];return i===void 0?void 0:Mr(e,i,t.range[1],n)}function Ir(e){let t=Tr(e);if(e.trim()===``)return Pr(`version: 1
|
|
117
117
|
`,t);let n=xr(e),r=n.errors.length===0&&A(n.contents)?n.contents:void 0,i=r?.items.find(e=>M(e.key)&&e.key.value===`rules`),a=i?.value,o=M(i?.key)?i.key.range?.[0]:void 0;return o!==void 0&&(a===null||M(a)&&a.value===null)?Ar(e,o,a,r?.flow===!0,t):Fr(e,a,t)||(!i&&r?.flow&&r.range?Nr(e,r.range[1],r.items.length>0,t):Pr(e,t))}function Lr(e,t,n,r){let i=`{{${r}}}`,a=e.slice(0,t)+i+e.slice(n);if(r.startsWith(`file:`)){let e=t+7;return{text:a,select:[e,e+r.length-5]}}let o=t+i.length;return{text:a,select:[o,o]}}function Rr(e,t){let n=0;for(let r=1;r<t;r++){let t=e.indexOf(`
|
|
118
118
|
`,n);if(t===-1)return[e.length,e.length];n=t+1}let r=e.indexOf(`
|
|
119
|
-
`,n);return[n,r===-1?e.length:r]}var zr=`https://github.com/hearsay-tools/squawk/blob/main/docs/context-injection.md`;function Br(){let e=a();return(0,y.jsxs)(`div`,{"data-slot":`session-context`,className:`flex flex-col gap-4 p-4 md:p-6`,children:[(0,y.jsx)(Vr,{}),e.data===void 0?e.isError?(0,y.jsx)(f,{icon:(0,y.jsx)(m,{}),tone:`danger`,title:`Session context did not load`,subtitle:e.error.message,heading:`h2`,actions:(0,y.jsx)(u,{variant:`outline`,onClick:()=>void e.refetch(),children:`Try again`})}):(0,y.jsx)(Hr,{}):(0,y.jsxs)(y.Fragment,{children:[e.isError&&(0,y.jsxs)(`p`,{"data-slot":`session-context-reload-error`,role:`alert`,className:`text-[13px] text-danger`,children:[`Could not read context.yaml again: `,e.error.message]}),(0,y.jsx)(Gr,{file:e.data,refetch:()=>e.refetch()},e.data.path)]})]})}function Vr(){return(0,y.jsx)(`div`,{"data-slot":`session-context-handoff`,className:`flex items-start gap-3 rounded-lg border border-border bg-card p-3`,children:(0,y.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,y.jsx)(`h3`,{className:`text-sm font-semibold`,children:`Handoff block`}),(0,y.jsx)(d,{variant:`outline`,className:`border-accent-strong/40 text-[11px] text-link-foreground`,children:`Built in · always first`})]}),(0,y.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Each task’s own handoff file: Goal, Progress log and Resume notes. It needs no setup and cannot be turned off. Your rules come after it.`})]})})}function Hr(){return(0,y.jsxs)(`div`,{"data-slot":`session-context-loading`,"aria-busy":`true`,"aria-label":`Loading session context`,className:`grid gap-4 md:grid-cols-[minmax(0,1.15fr)_minmax(0,1fr)]`,children:[(0,y.jsx)(p,{className:`h-[420px] rounded-lg`}),(0,y.jsx)(p,{className:`h-[420px] rounded-lg max-md:hidden`})]})}function Ur(e,t=250){let[n,r]=(0,_.useState)(e);return(0,_.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}function Wr(e,t){let[n,r]=(0,_.useState)(null),[a,l]=(0,_.useState)(null),u=(0,_.useRef)(n);u.current=n;let d=t=>{l(t=>t??{version:e.version}),r(t)},[f,p]=(0,_.useState)(`parent`),[m,g]=(0,_.useState)(`edit`),[v,y]=(0,_.useState)(null),[b,x]=(0,_.useState)(!1),S=(0,_.useRef)(null),[C,ee]=(0,_.useState)(null),w=n??e.content,te=w!==e.content;h(te);let ne=Ur(w),T=o(ne,f),re=T.data!==void 0&&!T.isPlaceholderData&&!T.isError&&ne===w,E=T.isError&&!T.isFetching&&ne===w?T.error.message:null,ie=(0,_.useMemo)(()=>T.data?.problems??[],[T.data]),D=s();(0,_.useLayoutEffect)(()=>{!C||!S.current||(S.current.focus(),S.current.setSelectionRange(C[0],C[1]),ee(null))},[C]);let O=e=>{d(e.text),g(`edit`),ee(e.select)};return{started:e.exists||n!==null,content:w,dirty:te,setDraft:d,role:f,setRole:p,pane:m,setPane:g,failure:v,showDisk:b,toggleDisk:()=>x(e=>!e),inputRef:S,preview:T.data,current:re,problems:ie,previewError:E,retryPreview:()=>void T.refetch(),saving:D.isPending,edit:O,insert:e=>{let t=S.current;O(Lr(w,t?.selectionStart??w.length,t?.selectionEnd??w.length,e))},goToLine:e=>{g(`edit`),ee(Rr(w,e))},discard:()=>{r(null),l(null),y(null)},save:(n=!1)=>{let o=n||a===null?e.version:a.version;y(null);let s=w;D.mutate({content:s,version:o},{onSuccess:t=>{let n=u.current!==null&&u.current!==s;r(n?u.current:null),l(n?{version:t.version}:null),x(!1),c(`Saved ${e.path}`)},onError:e=>{let n=e instanceof i&&e.status===409;y({kind:n?`conflict`:`error`,message:e.message}),n&&t()}})}}}function Gr({file:e,refetch:t}){let n=Wr(e,t),{content:i,problems:a,current:o}=n,s=e.writable,c=(0,_.useMemo)(()=>new Set(a.flatMap(e=>e.line===null?[]:[e.line])),[a]);return n.started?(0,y.jsxs)(`div`,{"data-slot":`session-context-editor`,"data-reports-dirty":``,className:`flex flex-col gap-4`,children:[!s&&(0,y.jsx)(ti,{reason:e.readOnlyReason}),n.failure&&s&&(0,y.jsx)(ei,{failure:n.failure,showDisk:n.showDisk,onShowDisk:n.toggleDisk,onOverwrite:()=>n.save(!0)}),n.showDisk&&(0,y.jsx)(Yr,{content:e.content}),n.previewError&&(0,y.jsxs)(`div`,{"data-slot":`session-context-preview-error`,role:`alert`,className:`flex flex-wrap items-center gap-3 rounded-lg border border-danger/45 bg-danger/10 p-3 text-[13px]`,children:[(0,y.jsxs)(`span`,{className:`mr-auto`,children:[`The preview failed: `,n.previewError,`. Save stays off until the draft is checked.`]}),(0,y.jsx)(u,{variant:`outline`,onClick:n.retryPreview,children:`Check again`})]}),a.length>0&&(0,y.jsx)(Qr,{problems:a,onLine:n.goToLine}),(0,y.jsx)(Jr,{pane:n.pane,onPane:n.setPane}),(0,y.jsxs)(`div`,{className:`grid items-start gap-4 md:grid-cols-[minmax(0,1.15fr)_minmax(0,1fr)]`,children:[(0,y.jsxs)(`section`,{id:qr.edit,"data-slot":`session-context-file`,"aria-label":`context.yaml`,className:r(`flex flex-col overflow-hidden rounded-lg border border-border bg-card`,n.pane!==`edit`&&`max-md:hidden`),children:[(0,y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 border-b border-border p-3`,children:[(0,y.jsx)(`code`,{className:`font-mono text-[12px] break-all`,children:e.path}),(0,y.jsx)(Zr,{problems:a.length,current:o,failed:n.previewError!==null,dirty:n.dirty}),s&&(0,y.jsxs)(u,{"data-slot":`session-context-add-rule`,variant:`outline`,className:`ml-auto`,onClick:()=>n.edit(Ir(i)),children:[(0,y.jsx)(l,{}),` Add rule`]})]}),(0,y.jsx)(g,{value:i,onChange:s?n.setDraft:void 0,readOnly:!s,language:`yaml`,markedLines:c,inputRef:n.inputRef,"aria-label":`context.yaml rules`,className:`h-[420px] rounded-none border-0`}),s&&(0,y.jsx)($r,{onInsert:n.insert})]}),(0,y.jsx)(C,{id:qr.preview,preview:n.preview,role:n.role,onRole:n.setRole,pending:!o,className:r(n.pane!==`preview`&&`max-md:hidden`)})]}),(0,y.jsx)(Xr,{writable:s,hasProblems:a.length>0,dirty:n.dirty,saving:n.saving,canSave:s&&n.dirty&&!n.saving&&o&&a.length===0,onDiscard:n.discard,onSave:()=>n.save()})]}):(0,y.jsx)(ni,{path:e.path,readOnlyReason:e.readOnlyReason,onAdd:s?()=>n.edit(Ir(``)):void 0})}var Kr=[`edit`,`preview`],qr={edit:`session-context-edit-panel`,preview:`session-context-preview-panel`};function Jr({pane:e,onPane:t}){let n=(0,_.useRef)(new Map);return(0,y.jsx)(`div`,{role:`tablist`,"aria-label":`Session context view`,onKeyDown:r=>{let i=v(Kr,e,r.key);i!==void 0&&(r.preventDefault(),t(i),n.current.get(i)?.focus())},className:`flex overflow-hidden rounded-md border border-[var(--control-border)] md:hidden`,children:Kr.map(i=>(0,y.jsx)(`button`,{ref:e=>{e?n.current.set(i,e):n.current.delete(i)},type:`button`,tabIndex:e===i?0:-1,"aria-controls":qr[i],role:`tab`,"data-slot":`session-context-pane`,"data-pane":i,"aria-selected":e===i,onClick:()=>t(i),className:r(`min-h-11 flex-1 text-[13px] capitalize text-muted-foreground`,e===i&&`bg-muted text-foreground`),children:i},i))})}function Yr({content:e}){return(0,y.jsxs)(`div`,{"data-slot":`session-context-disk`,className:`flex flex-col gap-2`,children:[(0,y.jsx)(`h3`,{className:`text-sm font-semibold`,children:`On disk now`}),(0,y.jsx)(g,{value:e,language:`yaml`,readOnly:!0,"aria-label":`context.yaml on disk`,className:`h-[200px]`})]})}function Xr(e){return(0,y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-3`,children:[(0,y.jsx)(`p`,{"data-slot":`session-context-note`,className:`mr-auto text-[12px] text-soft-foreground`,children:e.hasProblems?`Save is off while the file has problems.`:`Applies from the next session launch. Squawk does not commit this file.`}),e.writable&&(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(u,{variant:`outline`,disabled:!e.dirty||e.saving,onClick:e.onDiscard,children:`Discard changes`}),(0,y.jsx)(u,{"data-slot":`session-context-save`,disabled:!e.canSave,onClick:e.onSave,children:e.saving?`Saving…`:`Save`})]})]})}function Zr({problems:e,current:t,failed:n,dirty:r}){return(0,y.jsxs)(`span`,{className:`flex flex-wrap gap-1.5`,"aria-live":`polite`,children:[t&&e>0&&(0,y.jsxs)(d,{variant:`outline`,className:`border-danger/45 text-[11px] text-danger`,children:[e,` `,e===1?`problem`:`problems`]}),t&&e===0&&(0,y.jsx)(d,{variant:`outline`,className:`border-success/40 text-[11px] text-success`,children:`Valid`}),!t&&!n&&(0,y.jsx)(d,{variant:`outline`,className:`text-[11px]`,children:`Checking…`}),n&&(0,y.jsx)(d,{variant:`outline`,className:`border-danger/45 text-[11px] text-danger`,children:`Not checked`}),r&&(0,y.jsx)(d,{variant:`outline`,className:`border-conflict/50 text-[11px] text-conflict`,children:`Unsaved`})]})}function Qr({problems:e,onLine:t}){return(0,y.jsxs)(`div`,{"data-slot":`session-context-problems`,role:`alert`,className:`rounded-lg border border-danger/45 bg-danger/10 p-3`,children:[(0,y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,y.jsxs)(`h3`,{className:`text-sm font-semibold text-danger`,children:[e.length,` `,e.length===1?`problem`:`problems`,`: fix `,e.length===1?`it`:`them`,` to save`]}),(0,y.jsx)(`span`,{className:`ml-auto text-[12px] text-soft-foreground`,children:`Your draft is kept until you save or discard it.`})]}),(0,y.jsx)(`ul`,{className:`mt-1.5 flex flex-col`,children:e.map((e,n)=>(0,y.jsxs)(`li`,{className:`text-[13px] leading-6`,children:[e.line!==null&&(0,y.jsxs)(`button`,{type:`button`,"data-slot":`session-context-line`,onClick:()=>t(e.line),className:`inline-flex min-h-11 items-center align-middle text-link-foreground underline-offset-2 hover:underline focus-visible:outline-2 focus-visible:outline-ring md:min-h-8`,children:[`Line `,e.line]}),e.line!==null&&(0,y.jsx)(`span`,{"aria-hidden":`true`,className:`text-soft-foreground`,children:` · `}),e.rule!==null&&(0,y.jsxs)(`span`,{className:`text-muted-foreground`,children:[`rule `,e.rule,`: `]}),(0,y.jsx)(`span`,{"data-slot":`session-context-problem`,children:e.message})]},n))})]})}function $r({onInsert:e}){return(0,y.jsxs)(`div`,{"data-slot":`session-context-tokens`,className:`flex flex-col gap-2 border-t border-border p-3`,children:[(0,y.jsx)(`span`,{id:`session-context-tokens`,className:`text-[12px] text-soft-foreground`,children:`Insert a variable`}),(0,y.jsx)(`div`,{role:`group`,"aria-labelledby":`session-context-tokens`,className:`flex flex-wrap gap-1.5`,children:Sr.map(t=>(0,y.jsx)(`button`,{type:`button`,onClick:()=>e(t),className:`min-h-8 rounded-md bg-muted px-2 font-mono text-[12px] text-muted-foreground hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring pointer-coarse:min-h-11`,children:`{{${t.startsWith(`file:`)?Cr:t}}}`},t))})]})}function ei({failure:e,showDisk:t,onShowDisk:n,onOverwrite:r}){return(0,y.jsxs)(`div`,{"data-slot":`session-context-save-failure`,role:`alert`,className:`rounded-lg border border-danger/45 bg-danger/10 p-3`,children:[(0,y.jsx)(`h3`,{className:`text-sm font-semibold text-danger`,children:e.kind===`conflict`?`Not saved: the file changed on disk`:`Not saved`}),(0,y.jsxs)(`p`,{className:`mt-1 text-[13px] text-muted-foreground`,children:[e.message,` Your draft is still here.`]}),e.kind===`conflict`&&(0,y.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:[(0,y.jsx)(u,{variant:`outline`,onClick:n,children:t?`Hide the disk version`:`Show the disk version`}),(0,y.jsx)(u,{variant:`outline`,onClick:r,children:`Overwrite it`})]})]})}function ti({reason:e}){return(0,y.jsxs)(`div`,{"data-slot":`session-context-readonly`,className:`rounded-md border border-border bg-muted/40 px-3 py-2 text-[13px] text-muted-foreground`,children:[`Read only. `,e]})}function ni({path:e,readOnlyReason:t,onAdd:n}){return(0,y.jsx)(`div`,{"data-slot":`session-context-empty`,className:`rounded-lg border border-border bg-card`,children:(0,y.jsx)(f,{icon:(0,y.jsx)(m,{}),title:`No project rules yet`,heading:`h2`,subtitle:`Every session already starts with its handoff block. Add rules to put more text after it: a project brief, the contents of a doc, or instructions only workers get. Rules live in ${e}.`,actions:(0,y.jsxs)(y.Fragment,{children:[n&&(0,y.jsx)(u,{onClick:n,children:`Add the first rule`}),(0,y.jsx)(u,{variant:`outline`,asChild:!0,children:(0,y.jsx)(`a`,{href:zr,target:`_blank`,rel:`noreferrer`,children:`How rules work`})})]}),children:t&&(0,y.jsxs)(`p`,{className:`text-[13px] text-muted-foreground`,children:[`Read only. `,t]})})})}export{Br as SessionContextSection};
|
|
119
|
+
`,n);return[n,r===-1?e.length:r]}var zr=`https://github.com/hearsay-tools/squawk/blob/main/docs/context-injection.md`;function Br(){let e=a();return(0,y.jsxs)(`div`,{"data-slot":`session-context`,className:`flex flex-col gap-4 p-4 md:p-6`,children:[(0,y.jsx)(Vr,{}),e.data===void 0?e.isError?(0,y.jsx)(f,{icon:(0,y.jsx)(h,{}),tone:`danger`,title:`Session context did not load`,subtitle:e.error.message,heading:`h2`,actions:(0,y.jsx)(u,{variant:`outline`,onClick:()=>void e.refetch(),children:`Try again`})}):(0,y.jsx)(Hr,{}):(0,y.jsxs)(y.Fragment,{children:[e.isError&&(0,y.jsxs)(`p`,{"data-slot":`session-context-reload-error`,role:`alert`,className:`text-[13px] text-danger`,children:[`Could not read context.yaml again: `,e.error.message]}),(0,y.jsx)(Gr,{file:e.data,refetch:()=>e.refetch()},e.data.path)]})]})}function Vr(){return(0,y.jsx)(`div`,{"data-slot":`session-context-handoff`,className:`flex items-start gap-3 rounded-lg border border-border bg-card p-3`,children:(0,y.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,y.jsx)(`h3`,{className:`text-sm font-semibold`,children:`Handoff block`}),(0,y.jsx)(d,{variant:`outline`,className:`border-accent-strong/40 text-[11px] text-link-foreground`,children:`Built in · always first`})]}),(0,y.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Each task’s own handoff file: Goal, Progress log and Resume notes. It needs no setup and cannot be turned off. Your rules come after it.`})]})})}function Hr(){return(0,y.jsxs)(`div`,{"data-slot":`session-context-loading`,"aria-busy":`true`,"aria-label":`Loading session context`,className:`grid gap-4 md:grid-cols-[minmax(0,1.15fr)_minmax(0,1fr)]`,children:[(0,y.jsx)(p,{className:`h-[420px] rounded-lg`}),(0,y.jsx)(p,{className:`h-[420px] rounded-lg max-md:hidden`})]})}function Ur(e,t=250){let[n,r]=(0,_.useState)(e);return(0,_.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}function Wr(e,t){let[n,r]=(0,_.useState)(null),[a,l]=(0,_.useState)(null),u=(0,_.useRef)(n);u.current=n;let d=t=>{l(t=>t??{version:e.version}),r(t)},[f,p]=(0,_.useState)(`parent`),[h,g]=(0,_.useState)(`edit`),[v,y]=(0,_.useState)(null),[b,x]=(0,_.useState)(!1),S=(0,_.useRef)(null),[C,ee]=(0,_.useState)(null),w=n??e.content,te=w!==e.content;m(te);let ne=Ur(w),T=o(ne,f),re=T.data!==void 0&&!T.isPlaceholderData&&!T.isError&&ne===w,E=T.isError&&!T.isFetching&&ne===w?T.error.message:null,ie=(0,_.useMemo)(()=>T.data?.problems??[],[T.data]),D=s();(0,_.useLayoutEffect)(()=>{!C||!S.current||(S.current.focus(),S.current.setSelectionRange(C[0],C[1]),ee(null))},[C]);let O=e=>{d(e.text),g(`edit`),ee(e.select)};return{started:e.exists||n!==null,content:w,dirty:te,setDraft:d,role:f,setRole:p,pane:h,setPane:g,failure:v,showDisk:b,toggleDisk:()=>x(e=>!e),inputRef:S,preview:T.data,current:re,problems:ie,previewError:E,retryPreview:()=>void T.refetch(),saving:D.isPending,edit:O,insert:e=>{let t=S.current;O(Lr(w,t?.selectionStart??w.length,t?.selectionEnd??w.length,e))},goToLine:e=>{g(`edit`),ee(Rr(w,e))},discard:()=>{r(null),l(null),y(null)},save:(n=!1)=>{let o=n||a===null?e.version:a.version;y(null);let s=w;D.mutate({content:s,version:o},{onSuccess:t=>{let n=u.current!==null&&u.current!==s;r(n?u.current:null),l(n?{version:t.version}:null),x(!1),c(`Saved ${e.path}`)},onError:e=>{let n=e instanceof i&&e.status===409;y({kind:n?`conflict`:`error`,message:e.message}),n&&t()}})}}}function Gr({file:e,refetch:t}){let n=Wr(e,t),{content:i,problems:a,current:o}=n,s=e.writable,c=(0,_.useMemo)(()=>new Set(a.flatMap(e=>e.line===null?[]:[e.line])),[a]);return n.started?(0,y.jsxs)(`div`,{"data-slot":`session-context-editor`,"data-reports-dirty":``,className:`flex flex-col gap-4`,children:[!s&&(0,y.jsx)(ti,{reason:e.readOnlyReason}),n.failure&&s&&(0,y.jsx)(ei,{failure:n.failure,showDisk:n.showDisk,onShowDisk:n.toggleDisk,onOverwrite:()=>n.save(!0)}),n.showDisk&&(0,y.jsx)(Yr,{content:e.content}),n.previewError&&(0,y.jsxs)(`div`,{"data-slot":`session-context-preview-error`,role:`alert`,className:`flex flex-wrap items-center gap-3 rounded-lg border border-danger/45 bg-danger/10 p-3 text-[13px]`,children:[(0,y.jsxs)(`span`,{className:`mr-auto`,children:[`The preview failed: `,n.previewError,`. Save stays off until the draft is checked.`]}),(0,y.jsx)(u,{variant:`outline`,onClick:n.retryPreview,children:`Check again`})]}),a.length>0&&(0,y.jsx)(Qr,{problems:a,onLine:n.goToLine}),(0,y.jsx)(Jr,{pane:n.pane,onPane:n.setPane}),(0,y.jsxs)(`div`,{className:`grid items-start gap-4 md:grid-cols-[minmax(0,1.15fr)_minmax(0,1fr)]`,children:[(0,y.jsxs)(`section`,{id:qr.edit,"data-slot":`session-context-file`,"aria-label":`context.yaml`,className:r(`flex flex-col overflow-hidden rounded-lg border border-border bg-card`,n.pane!==`edit`&&`max-md:hidden`),children:[(0,y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 border-b border-border p-3`,children:[(0,y.jsx)(`code`,{className:`font-mono text-[12px] break-all`,children:e.path}),(0,y.jsx)(Zr,{problems:a.length,current:o,failed:n.previewError!==null,dirty:n.dirty}),s&&(0,y.jsxs)(u,{"data-slot":`session-context-add-rule`,variant:`outline`,className:`ml-auto`,onClick:()=>n.edit(Ir(i)),children:[(0,y.jsx)(l,{}),` Add rule`]})]}),(0,y.jsx)(g,{value:i,onChange:s?n.setDraft:void 0,readOnly:!s,language:`yaml`,markedLines:c,inputRef:n.inputRef,"aria-label":`context.yaml rules`,className:`h-[420px] rounded-none border-0`}),s&&(0,y.jsx)($r,{onInsert:n.insert})]}),(0,y.jsx)(C,{id:qr.preview,preview:n.preview,role:n.role,onRole:n.setRole,pending:!o,className:r(n.pane!==`preview`&&`max-md:hidden`)})]}),(0,y.jsx)(Xr,{writable:s,hasProblems:a.length>0,dirty:n.dirty,saving:n.saving,canSave:s&&n.dirty&&!n.saving&&o&&a.length===0,onDiscard:n.discard,onSave:()=>n.save()})]}):(0,y.jsx)(ni,{path:e.path,readOnlyReason:e.readOnlyReason,onAdd:s?()=>n.edit(Ir(``)):void 0})}var Kr=[`edit`,`preview`],qr={edit:`session-context-edit-panel`,preview:`session-context-preview-panel`};function Jr({pane:e,onPane:t}){let n=(0,_.useRef)(new Map);return(0,y.jsx)(`div`,{role:`tablist`,"aria-label":`Session context view`,onKeyDown:r=>{let i=v(Kr,e,r.key);i!==void 0&&(r.preventDefault(),t(i),n.current.get(i)?.focus())},className:`flex overflow-hidden rounded-md border border-[var(--control-border)] md:hidden`,children:Kr.map(i=>(0,y.jsx)(`button`,{ref:e=>{e?n.current.set(i,e):n.current.delete(i)},type:`button`,tabIndex:e===i?0:-1,"aria-controls":qr[i],role:`tab`,"data-slot":`session-context-pane`,"data-pane":i,"aria-selected":e===i,onClick:()=>t(i),className:r(`min-h-11 flex-1 text-[13px] capitalize text-muted-foreground`,e===i&&`bg-muted text-foreground`),children:i},i))})}function Yr({content:e}){return(0,y.jsxs)(`div`,{"data-slot":`session-context-disk`,className:`flex flex-col gap-2`,children:[(0,y.jsx)(`h3`,{className:`text-sm font-semibold`,children:`On disk now`}),(0,y.jsx)(g,{value:e,language:`yaml`,readOnly:!0,"aria-label":`context.yaml on disk`,className:`h-[200px]`})]})}function Xr(e){return(0,y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-3`,children:[(0,y.jsx)(`p`,{"data-slot":`session-context-note`,className:`mr-auto text-[12px] text-soft-foreground`,children:e.hasProblems?`Save is off while the file has problems.`:`Applies from the next session launch. Squawk does not commit this file.`}),e.writable&&(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(u,{variant:`outline`,disabled:!e.dirty||e.saving,onClick:e.onDiscard,children:`Discard changes`}),(0,y.jsx)(u,{"data-slot":`session-context-save`,disabled:!e.canSave,onClick:e.onSave,children:e.saving?`Saving…`:`Save`})]})]})}function Zr({problems:e,current:t,failed:n,dirty:r}){return(0,y.jsxs)(`span`,{className:`flex flex-wrap gap-1.5`,"aria-live":`polite`,children:[t&&e>0&&(0,y.jsxs)(d,{variant:`outline`,className:`border-danger/45 text-[11px] text-danger`,children:[e,` `,e===1?`problem`:`problems`]}),t&&e===0&&(0,y.jsx)(d,{variant:`outline`,className:`border-success/40 text-[11px] text-success`,children:`Valid`}),!t&&!n&&(0,y.jsx)(d,{variant:`outline`,className:`text-[11px]`,children:`Checking…`}),n&&(0,y.jsx)(d,{variant:`outline`,className:`border-danger/45 text-[11px] text-danger`,children:`Not checked`}),r&&(0,y.jsx)(d,{variant:`outline`,className:`border-conflict/50 text-[11px] text-conflict`,children:`Unsaved`})]})}function Qr({problems:e,onLine:t}){return(0,y.jsxs)(`div`,{"data-slot":`session-context-problems`,role:`alert`,className:`rounded-lg border border-danger/45 bg-danger/10 p-3`,children:[(0,y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,y.jsxs)(`h3`,{className:`text-sm font-semibold text-danger`,children:[e.length,` `,e.length===1?`problem`:`problems`,`: fix `,e.length===1?`it`:`them`,` to save`]}),(0,y.jsx)(`span`,{className:`ml-auto text-[12px] text-soft-foreground`,children:`Your draft is kept until you save or discard it.`})]}),(0,y.jsx)(`ul`,{className:`mt-1.5 flex flex-col`,children:e.map((e,n)=>(0,y.jsxs)(`li`,{className:`text-[13px] leading-6`,children:[e.line!==null&&(0,y.jsxs)(`button`,{type:`button`,"data-slot":`session-context-line`,onClick:()=>t(e.line),className:`inline-flex min-h-11 items-center align-middle text-link-foreground underline-offset-2 hover:underline focus-visible:outline-2 focus-visible:outline-ring md:min-h-8`,children:[`Line `,e.line]}),e.line!==null&&(0,y.jsx)(`span`,{"aria-hidden":`true`,className:`text-soft-foreground`,children:` · `}),e.rule!==null&&(0,y.jsxs)(`span`,{className:`text-muted-foreground`,children:[`rule `,e.rule,`: `]}),(0,y.jsx)(`span`,{"data-slot":`session-context-problem`,children:e.message})]},n))})]})}function $r({onInsert:e}){return(0,y.jsxs)(`div`,{"data-slot":`session-context-tokens`,className:`flex flex-col gap-2 border-t border-border p-3`,children:[(0,y.jsx)(`span`,{id:`session-context-tokens`,className:`text-[12px] text-soft-foreground`,children:`Insert a variable`}),(0,y.jsx)(`div`,{role:`group`,"aria-labelledby":`session-context-tokens`,className:`flex flex-wrap gap-1.5`,children:Sr.map(t=>(0,y.jsx)(`button`,{type:`button`,onClick:()=>e(t),className:`min-h-8 rounded-md bg-muted px-2 font-mono text-[12px] text-muted-foreground hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring pointer-coarse:min-h-11`,children:`{{${t.startsWith(`file:`)?Cr:t}}}`},t))})]})}function ei({failure:e,showDisk:t,onShowDisk:n,onOverwrite:r}){return(0,y.jsxs)(`div`,{"data-slot":`session-context-save-failure`,role:`alert`,className:`rounded-lg border border-danger/45 bg-danger/10 p-3`,children:[(0,y.jsx)(`h3`,{className:`text-sm font-semibold text-danger`,children:e.kind===`conflict`?`Not saved: the file changed on disk`:`Not saved`}),(0,y.jsxs)(`p`,{className:`mt-1 text-[13px] text-muted-foreground`,children:[e.message,` Your draft is still here.`]}),e.kind===`conflict`&&(0,y.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:[(0,y.jsx)(u,{variant:`outline`,onClick:n,children:t?`Hide the disk version`:`Show the disk version`}),(0,y.jsx)(u,{variant:`outline`,onClick:r,children:`Overwrite it`})]})]})}function ti({reason:e}){return(0,y.jsxs)(`div`,{"data-slot":`session-context-readonly`,className:`rounded-md border border-border bg-muted/40 px-3 py-2 text-[13px] text-muted-foreground`,children:[`Read only. `,e]})}function ni({path:e,readOnlyReason:t,onAdd:n}){return(0,y.jsx)(`div`,{"data-slot":`session-context-empty`,className:`rounded-lg border border-border bg-card`,children:(0,y.jsx)(f,{icon:(0,y.jsx)(h,{}),title:`No project rules yet`,heading:`h2`,subtitle:`Every session already starts with its handoff block. Add rules to put more text after it: a project brief, the contents of a doc, or instructions only workers get. Rules live in ${e}.`,actions:(0,y.jsxs)(y.Fragment,{children:[n&&(0,y.jsx)(u,{onClick:n,children:`Add the first rule`}),(0,y.jsx)(u,{variant:`outline`,asChild:!0,children:(0,y.jsx)(`a`,{href:zr,target:`_blank`,rel:`noreferrer`,children:`How rules work`})})]}),children:t&&(0,y.jsxs)(`p`,{className:`text-[13px] text-muted-foreground`,children:[`Read only. `,t]})})})}export{Br as SessionContextSection};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./utils-DSMR_WLb.js";import{Cr as i,Ln as a,Pn as o,di as s}from"./project-scope-context-C912rTJP.js";import{$t as c,Vt as l,Yt as u,qt as d,sn as f,vt as p}from"./queries-DRpvYgai.js";import{t as m}from"./useQuery-BOEhMTCg.js";import{it as h,l as g}from"./design-icons-CzEoMH9c.js";import{t as _}from"./button-BQ2y4XRB.js";import{a as v,i as y,o as b,r as x,s as S,t as C}from"./dialog-BVF6dIeS.js";import{Gn as w}from"./index-Clu9VXJs.js";var T=e(t(),1),E=n();function D(e,t){return d(t).flatMap(t=>{let n=e.filter(e=>e.provider===t.id);return n.length<2?[{runner:t,account:null,label:t.pickerLabel,desc:t.pickerDescription,missing:!1}]:n.map(e=>({runner:t,account:e.isDefault?null:e.id,label:`${t.pickerLabel} · ${e.label}`,desc:e.configDir?e.exists?e.configDir:`${e.configDir} — folder not created yet`:e.exists?``:`Not initialized on host yet`,missing:!e.exists,...e.isDefault||e.status===void 0?{}:{accountStatus:e.status.status}}))})}var O=(e,t)=>e.length>u(t).length;function k(e,t,n){let r=i(e.data,t),a=r!==void 0&&r.status!==`not-installed`&&(n??r.status)===`connected`,o=!e.isPending&&!e.isError&&r?.enabled===!0&&a;return{providerConnected:o,providerReason:e.isPending?`Checking provider authentication…`:e.isError?`Provider authentication could not be verified.`:r?.enabled===!1?`This provider is disabled. Enable it above or choose another provider.`:o?void 0:`Connect this provider before selecting it.`}}function A({rows:e,runner:t,accountFor:n,providerStatus:i,disabled:a=!1,accountDisabled:o=!1,onPick:s}){let l=c().data,u=l===void 0,d=O(e,l);return(0,E.jsx)(`div`,{role:`radiogroup`,"aria-label":`Default runner`,"data-slot":`agents-runner`,className:r(`gap-0.5 rounded-md border border-border bg-card p-0.5`,d?`flex max-w-md flex-col`:`inline-flex w-fit`),children:e.map(c=>{let{providerConnected:l,providerReason:f}=k(i,c.runner.id,c.accountStatus),p=e.filter(e=>e.runner.id===c.runner.id).length>1,m=c.runner.id===t&&c.account===n(c.runner.id);return(0,E.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":m,"data-value":c.runner.id,"data-account":c.account??``,title:f??c.desc,disabled:a||u||!l||p&&o,onClick:()=>s(c.runner.id,c.account,p),className:r(`rounded-sm px-3 py-1.5 text-left font-mono text-[13px] font-medium transition-colors disabled:opacity-50`,m?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground`),children:[c.label,d?(0,E.jsx)(`span`,{"data-slot":c.missing?`agents-account-missing`:`agents-account-dir`,"data-runner":c.runner.id,className:`ml-2 font-sans text-[11px] text-soft-foreground`,children:c.desc}):null]},`${c.runner.id}:${c.account??``}`)})})}async function j(e,t){return a(await o.api.v1.providers[`sign-in`].start.$post({json:{provider:e,...t?{profileId:t}:{}}}),`/providers/sign-in/start`)}async function M(e){return a(await o.api.v1.providers[`sign-in`][`:id`].$get({param:{id:e}}),`/providers/sign-in/:id`)}async function N(e,t){return a(await o.api.v1.providers[`sign-in`][`:id`].redirect.$post({param:{id:e},json:{redirectUrl:t}}),`/providers/sign-in/:id/redirect`)}async function P(e){return a(await o.api.v1.providers[`sign-in`][`:id`].$delete({param:{id:e}}),`/providers/sign-in/:id`)}function F(e,t){let n=s(),[r,i]=(0,T.useState)(!1),[a,o]=(0,T.useState)(null),[c,u]=(0,T.useState)(``),d=(0,T.useRef)(null),p=(0,T.useRef)(!0),h=(0,T.useRef)(0),g=()=>{h.current++,v.current=!1;let e=d.current;d.current=null,e?.state===`waiting`&&P(e.id).catch(()=>{}),o(null),u(``),i(!1)};(0,T.useEffect)(()=>(p.current=!0,()=>{p.current=!1,h.current++;let e=d.current;e?.state===`waiting`&&P(e.id).catch(()=>{})}),[]);let _=f({mutationFn:n=>j(e,t).then(e=>({result:e,generation:n})),retry:!1,onSuccess:({result:e,generation:t})=>{if(!p.current||!v.current||t!==h.current){P(e.id).catch(()=>{});return}d.current=e,o(e)}}),v=(0,T.useRef)(r);v.current=r;let y=m({queryKey:[`browser-sign-in`,a?.id],queryFn:()=>M(a.id),enabled:r&&a?.state===`waiting`,retry:!1,refetchInterval:e=>e.state.error||e.state.data?.state&&e.state.data.state!==`waiting`?!1:1e3,gcTime:0}),b=y.data??a,x=f({mutationFn:()=>N(a.id,c),retry:!1,onSuccess:()=>{u(``),y.refetch()}});return(0,T.useEffect)(()=>{b?.state===`connected`&&(d.current=b,o(b),Promise.all([n.invalidateQueries({queryKey:l.agentProfiles}),n.invalidateQueries({queryKey:l.providerStatus}),n.invalidateQueries({queryKey:l.models(e)})]))},[b,n,e]),{open:r,result:b,redirect:c,setRedirect:u,start:_,replay:x,status:y,error:_.error??x.error??y.error,close:g,connect:()=>{i(!0),v.current=!0,_.reset(),x.reset(),_.mutate(++h.current)}}}function I(){return`Open the sign-in link in your browser. After Google consent, the page shows a code. Copy that code, or the full address of that page, and paste it below.`}function L({provider:e,profileId:t,label:n}){let{open:r,result:i,redirect:a,setRedirect:o,start:s,replay:c,status:l,error:u,close:d,connect:f}=F(e,t);return p().data?.capabilities?.settingsAdmin===!0?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(_,{type:`button`,size:`sm`,"data-action":`account-connect`,disabled:s.isPending,onClick:f,children:`Connect`}),(0,E.jsx)(C,{open:r,onOpenChange:e=>{e||d()},children:(0,E.jsxs)(x,{children:[(0,E.jsxs)(b,{children:[(0,E.jsxs)(S,{children:[`Sign in to `,n]}),(0,E.jsx)(y,{children:`Use a personal Google account. Business and agent-platform sign-in are not supported.`})]}),s.isPending?(0,E.jsx)(`p`,{role:`status`,children:`Preparing sign-in…`}):null,i?.state===`waiting`?(0,E.jsxs)(`div`,{className:`grid min-w-0 gap-3`,children:[(0,E.jsx)(`a`,{href:i.url,target:`_blank`,rel:`noopener noreferrer`,className:`text-action underline`,children:`Open Google sign-in`}),(0,E.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,E.jsx)(I,{})}),(0,E.jsxs)(`label`,{className:`grid gap-2`,children:[`Code or page address`,(0,E.jsx)(w,{type:`text`,autoComplete:`off`,spellCheck:!1,value:a,onChange:e=>o(e.target.value)})]}),(0,E.jsx)(_,{disabled:!a.trim()||c.isPending,onClick:()=>c.mutate(),children:`Complete sign-in`})]}):null,i?.state===`connected`?(0,E.jsx)(`p`,{role:`status`,children:`Connected.`}):null,i?.state===`failed`?(0,E.jsx)(`p`,{role:`alert`,children:i.error}):null,i?.state===`cancelled`?(0,E.jsx)(`p`,{role:`status`,children:`Sign-in cancelled. Close this window and Connect again.`}):null,u?(0,E.jsx)(`p`,{role:`alert`,children:u.message}):null,l.isError&&i?.state===`waiting`?(0,E.jsx)(_,{onClick:()=>void l.refetch(),children:`Retry status`}):null,(0,E.jsx)(v,{children:(0,E.jsx)(_,{variant:`outline`,onClick:d,children:i?.state===`connected`?`Done`:`Cancel`})})]})})]}):null}function R(e){let t=(0,T.useRef)(null),n=e.rows.find(t=>t.runner.id===e.runner&&t.account===e.accountFor(t.runner.id));return(0,E.jsxs)(`details`,{ref:t,className:`settings-agent-picker`,children:[(0,E.jsxs)(`summary`,{children:[(0,E.jsx)(h,{"aria-hidden":`true`,className:`size-4 text-accent-text`}),(0,E.jsx)(`span`,{className:`min-w-0 flex-1`,children:(n?.label??e.runner).replace(/^codex/,`Codex`).replace(/^claude/,`Claude Code`)}),(0,E.jsx)(g,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`})]}),(0,E.jsx)(A,{...e,onPick:(...n)=>{e.onPick(...n),t.current&&(t.current.open=!1)}})]})}export{k as a,O as i,L as n,D as r,R as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./react-runtime-CCIEwYL0.js";var t=e();function n({title:e,hint:n,children:r}){return(0,t.jsxs)(`section`,{className:`settings-field flex flex-col gap-2`,children:[(0,t.jsxs)(`div`,{children:[(0,t.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:e}),(0,t.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:n})]}),r]})}export{n as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{En as r,Sn as i,Tn as a,bn as o,xn as s}from"./project-scope-context-C912rTJP.js";import{Ft as c,Ot as l,Pt as u,ht as d,jt as f,xt as p}from"./queries-DRpvYgai.js";import{n as m,p as h,r as g}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{n as _}from"./toaster-Bo5vCbz-.js";import{l as v,u as y}from"./design-icons-CzEoMH9c.js";import{t as b}from"./plus-CxRU2X8C.js";import{t as x}from"./button-BQ2y4XRB.js";import{n as ee,r as te,t as S}from"./collapsible-BEV4FO-1.js";import{t as C}from"./switch-Bv2Zf1uU.js";import{t as w}from"./badge-D9JrXe0o.js";import{n as T,s as E,t as D}from"./project-router-DucFIl_x.js";import"./attention-BFUaj1mU.js";import{Gn as O,Vn as ne,_n as k,dt as re,ft as A,pt as j,z as M}from"./index-Clu9VXJs.js";import{t as ie}from"./textarea-vJt9undk.js";import{n as ae,t as oe}from"./saved-draft-BwzBc-_Y.js";import{ArchiveOnMergeField as se}from"./archive-on-merge-field-CEyCpweg.js";import{a as ce,i as le,n as ue,t as de}from"./projects-section-C6TNM8uI.js";import{t as N}from"./settings-field-Bl6WuvGX.js";import{t as fe}from"./project-location-C9WLgY3A.js";var P=e(t(),1),F={"needs-you":{label:`Needs you`,hint:`Asks a question, asks for permission, or waits for review`},failed:{label:`Failed`,hint:`Failed, with no scheduled resume`},done:{label:`Done`,hint:`Finished`},cancelled:{label:`Cancelled`,hint:`Was cancelled`},running:{label:`Running`,hint:`Runs an agent turn`},"waiting-workers":{label:`Waiting for agents`,hint:`Waits on its workers or their replies`},"waiting-ci":{label:`Waiting on CI`,hint:`Waits on a pull request's checks`},"waiting-timer":{label:`Waiting`,hint:`Waits on a timer`},"waiting-other":{label:`Any other wait`,hint:`Waits on anything else, including wait types added later`}},I=(e,t)=>e.length===t.length&&e.every(e=>t.includes(e)),L={name:``,description:``,url:``,token:``,tasks:!0,triggers:a,agent:!1};function R(e){return{name:e.name,description:e.description??``,url:e.url,token:``,tasks:e.tasks,triggers:e.triggers??a,agent:e.agent}}var z=e=>r.filter(t=>e.includes(t));function B(e){let t=e.description.trim();return{name:e.name.trim(),url:e.url.trim(),...t?{description:t}:{},...e.token?{token:e.token}:{},tasks:e.tasks,...I(e.triggers,a)?{}:{triggers:z(e.triggers)},agent:e.agent}}function pe(e){return e.name.trim()!==``||e.description.trim()!==``||e.url.trim()!==``||e.token!==``||e.tasks!==L.tasks||e.agent!==L.agent||!I(e.triggers,L.triggers)}function me(e,t){let n={},r=e.name.trim(),i=e.description.trim(),o=e.url.trim();return r!==t.name&&(n.name=r),i!==(t.description??``)&&(n.description=i),o!==t.url&&(n.url=o),e.token&&(n.token=e.token),e.tasks!==t.tasks&&(n.tasks=e.tasks),I(e.triggers,t.triggers??a)||(n.triggers=z(e.triggers)),e.agent!==t.agent&&(n.agent=e.agent),n}var V=n(),H=`flex flex-col gap-1 text-[13px]`,U=`text-[11px] text-muted-foreground`;function W({draft:e,onChange:t,tokenSet:n}){let a=(0,P.useId)(),c=(0,P.useId)(),l=(0,P.useId)(),u=(0,P.useId)(),d=(0,P.useId)(),f=(0,P.useId)(),p=(0,P.useId)(),m=(0,P.useId)(),h=(0,P.useId)(),g=(0,P.useId)();return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:`grid grid-cols-[repeat(auto-fit,minmax(min(100%,14rem),1fr))] gap-3`,children:[(0,V.jsxs)(`div`,{className:H,children:[(0,V.jsx)(`label`,{htmlFor:a,className:U,children:`Name`}),(0,V.jsx)(O,{id:a,"data-slot":`webhook-name`,autoComplete:`off`,maxLength:80,placeholder:`e.g. Team bot`,value:e.name,onChange:e=>t({name:e.target.value})})]}),(0,V.jsxs)(`div`,{className:H,children:[(0,V.jsx)(`label`,{htmlFor:u,className:U,children:`URL`}),(0,V.jsx)(O,{id:u,"data-slot":`webhook-url`,type:`url`,inputMode:`url`,autoComplete:`off`,spellCheck:!1,maxLength:i,placeholder:`https://bot.example/hooks/cez`,value:e.url,onChange:e=>t({url:e.target.value})})]})]}),(0,V.jsxs)(`div`,{className:H,children:[(0,V.jsx)(`label`,{htmlFor:c,className:U,children:`Description`}),(0,V.jsx)(ie,{id:c,"data-slot":`webhook-description`,"aria-describedby":l,rows:2,maxLength:o,placeholder:`e.g. Posts to the #releases channel. Use it for release notes.`,value:e.description,onChange:e=>t({description:e.target.value})}),(0,V.jsx)(`span`,{id:l,className:`text-[11px] text-soft-foreground`,children:`Agents read the name and description to decide when to use this webhook.`})]}),(0,V.jsxs)(`div`,{className:H,children:[(0,V.jsx)(`label`,{htmlFor:d,className:U,children:`Token`}),(0,V.jsx)(O,{id:d,"data-slot":`webhook-token`,type:`password`,autoComplete:`new-password`,spellCheck:!1,maxLength:s,"aria-describedby":f,placeholder:n?`Token set — type to replace`:`Optional Bearer token`,value:e.token,onChange:e=>t({token:e.target.value})}),(0,V.jsx)(`span`,{id:f,className:`text-[11px] text-soft-foreground`,children:n?`The token is stored in ~/.cezar and never shown again. Leave it empty to keep it.`:`The token is stored in ~/.cezar, never in the repo. It is sent as a Bearer header.`})]}),(0,V.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,V.jsxs)(`div`,{className:`flex min-h-11 items-center gap-3`,children:[(0,V.jsx)(C,{id:p,"aria-describedby":m,"data-slot":`webhook-tasks`,checked:e.tasks,onCheckedChange:e=>t({tasks:e})}),(0,V.jsxs)(`span`,{className:`flex min-w-0 flex-col text-[13px]`,children:[(0,V.jsx)(`label`,{htmlFor:p,className:`font-medium`,children:`Task notifications`}),(0,V.jsx)(`span`,{id:m,className:`text-[11px] text-soft-foreground`,children:`Tasks you hand off, or start with notify on, send their status here.`})]})]}),e.tasks?(0,V.jsxs)(`fieldset`,{"data-slot":`webhook-triggers`,className:`flex flex-col gap-1 sm:ps-[3.25rem]`,children:[(0,V.jsx)(`legend`,{className:`pbe-1 text-[11px] text-muted-foreground`,children:`Send a delivery when a task enters`}),(0,V.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(min(100%,15rem),1fr))] gap-x-3`,children:r.map(n=>(0,V.jsxs)(`label`,{className:`flex min-h-11 items-start gap-2.5 pbs-2 text-[13px]`,children:[(0,V.jsx)(`input`,{type:`checkbox`,"data-trigger":n,checked:e.triggers.includes(n),onChange:r=>t({triggers:r.target.checked?[...e.triggers,n]:e.triggers.filter(e=>e!==n)}),className:`mbs-0.5 size-[18px] shrink-0`}),(0,V.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,V.jsx)(`span`,{className:`font-medium`,children:F[n].label}),(0,V.jsx)(`span`,{className:`text-[11px] text-soft-foreground`,children:F[n].hint})]})]},n))}),(0,V.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Handing a task off and Send test always deliver.`})]}):null]}),(0,V.jsxs)(`div`,{className:`flex min-h-11 items-center gap-3`,children:[(0,V.jsx)(C,{id:h,"aria-describedby":g,"data-slot":`webhook-agent`,checked:e.agent,onCheckedChange:e=>t({agent:e})}),(0,V.jsxs)(`span`,{className:`flex min-w-0 flex-col text-[13px]`,children:[(0,V.jsx)(`label`,{htmlFor:h,className:`font-medium`,children:`Let agents send reports`}),(0,V.jsx)(`span`,{id:g,className:`text-[11px] text-soft-foreground`,children:`Agents in this project may post a report here when the task calls for it.`})]})]})]})}var G=`max-sm:h-11`,K=(e,t)=>({tone:`alert`,text:`Not saved: ${e.message}. Fix the field and select ${t} again.`}),he=e=>e.dryRun?{tone:`ok`,text:`Dry run: nothing was sent.`}:e.ok?{tone:`ok`,text:`Delivered (HTTP ${e.status??200}).`}:{tone:`danger`,text:`Not delivered: ${e.error??`unknown error`}.`};function q({feedback:e}){return e?(0,V.jsx)(`p`,{"data-slot":e.tone===`alert`?`webhook-error`:`webhook-result`,role:e.tone===`alert`?`alert`:`status`,className:e.tone===`ok`?`text-[13px] text-muted-foreground`:`text-[13px] text-danger`,children:e.text}):null}var J=`rounded-md border border-border bg-background`,Y=`flex flex-col gap-3 border-bs border-border p-3`;function ge({projectId:e,webhook:t,defaultOpen:n=!1}){let r=u(),i=l(),a=f(),[o,s]=(0,P.useState)(n),[c,d]=ae(R(t),oe),[p,m]=(0,P.useState)(null),h=me(c,t),g=Object.keys(h).length>0;k(g);let y=c.name.trim()!==``&&c.url.trim()!==``,b=r.isPending||i.isPending||a.isPending,C={projectId:e,webhookId:t.id},T=e=>r.mutate({...C,...h},{onSuccess:()=>{d(e=>({...e,token:``})),e?e():_(`${c.name.trim()} saved`)},onError:e=>m(K(e,`Save`))}),E=()=>a.mutate(C,{onSuccess:e=>m(he(e)),onError:e=>m({tone:`danger`,text:e.message})});return(0,V.jsx)(`li`,{"data-slot":`webhook-card`,"data-webhook-id":t.id,className:J,children:(0,V.jsxs)(S,{open:o,onOpenChange:s,children:[(0,V.jsx)(te,{asChild:!0,children:(0,V.jsxs)(`button`,{type:`button`,"data-action":`webhook-toggle`,className:`group flex min-h-11 w-full items-center gap-3 rounded-md p-3 text-start focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-foreground pointer-hover:bg-muted/50 active:bg-muted/50`,children:[(0,V.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,V.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,V.jsx)(`span`,{"data-slot":`webhook-card-name`,className:`min-w-0 break-words text-[13px] font-medium`,children:t.name}),t.tasks?(0,V.jsx)(w,{variant:`secondary`,"data-badge":`tasks`,children:`Task notifications`}):null,t.agent?(0,V.jsx)(w,{variant:`secondary`,"data-badge":`agent`,children:`Agents`}):null]}),(0,V.jsx)(`span`,{"data-slot":`webhook-card-url`,className:`truncate text-[12px] text-muted-foreground`,children:M(t.url)})]}),(0,V.jsx)(v,{"aria-hidden":`true`,className:`size-4 shrink-0 text-muted-foreground group-data-[state=open]:rotate-180`})]})}),(0,V.jsx)(ee,{children:(0,V.jsxs)(`form`,{"data-slot":`webhook-form`,"data-reports-dirty":``,className:Y,onSubmit:e=>{e.preventDefault(),m(null),y&&g&&T()},children:[(0,V.jsx)(W,{draft:c,tokenSet:t.tokenSet,onChange:e=>d(t=>({...t,...e}))}),(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,V.jsx)(x,{type:`submit`,size:`sm`,className:G,"data-action":`webhook-save`,disabled:b||!y||!g,children:`Save`}),(0,V.jsx)(x,{type:`button`,size:`sm`,className:G,variant:`outline`,"data-action":`webhook-test`,disabled:b||!y,onClick:()=>{m(null),g?T(E):E()},children:`Send test`}),t.tokenSet?(0,V.jsx)(x,{type:`button`,size:`sm`,className:G,variant:`ghost`,"data-action":`webhook-clear-token`,disabled:b,onClick:()=>r.mutate({...C,token:``},{onSuccess:()=>_(`Webhook token cleared`),onError:e=>m({tone:`danger`,text:`Token not cleared: ${e.message}.`})}),children:`Clear token`}):null,(0,V.jsx)(x,{type:`button`,size:`sm`,className:G,variant:`danger-ghost`,"data-action":`webhook-remove`,"aria-label":`Remove ${t.name}`,disabled:b,onClick:()=>i.mutate(C,{onSuccess:()=>_(`${t.name} removed`),onError:e=>m({tone:`danger`,text:`Not removed: ${e.message}.`})}),children:`Remove`})]}),(0,V.jsx)(q,{feedback:p})]})})]})})}function _e({projectId:e,onCreated:t,onCancel:n}){let r=d(),[i,a]=(0,P.useState)(L),[o,s]=(0,P.useState)(null),c=i.name.trim()!==``&&i.url.trim()!==``;return k(pe(i)),(0,V.jsxs)(`li`,{"data-slot":`webhook-card`,"data-draft":``,className:J,children:[(0,V.jsx)(`p`,{className:`p-3 text-[13px] font-medium`,children:`New webhook`}),(0,V.jsxs)(`form`,{"data-slot":`webhook-form`,"data-reports-dirty":``,"aria-label":`New webhook`,className:Y,onSubmit:n=>{n.preventDefault(),s(null),c&&r.mutate({projectId:e,...B(i)},{onSuccess:({webhook:e})=>{_(`${e.name} created`),t(e)},onError:e=>s(K(e,`Create`))})},children:[(0,V.jsx)(W,{draft:i,tokenSet:!1,onChange:e=>a(t=>({...t,...e}))}),(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,V.jsx)(x,{type:`submit`,size:`sm`,className:G,"data-action":`webhook-create`,disabled:r.isPending||!c,children:`Create`}),(0,V.jsx)(x,{type:`button`,size:`sm`,className:G,variant:`ghost`,"data-action":`webhook-cancel`,disabled:r.isPending,onClick:n,children:`Cancel`})]}),(0,V.jsx)(q,{feedback:o})]})]})}function ve({project:e}){let t=e.webhooks??[],[n,r]=(0,P.useState)(!1),[i,a]=(0,P.useState)(null),o=t.length>=16;return(0,V.jsx)(N,{title:`Webhooks`,hint:`A webhook gets a POST from Squawk. Tasks can send their status to it, and agents can send it reports.`,children:(0,V.jsxs)(`div`,{"data-slot":`project-webhooks`,className:`flex flex-col gap-3`,children:[t.length===0&&!n?(0,V.jsx)(`p`,{"data-slot":`webhooks-empty`,className:`text-[13px] text-soft-foreground`,children:`No webhooks yet. Add one to send task updates to a bot, or to let agents post reports.`}):null,t.length>0||n?(0,V.jsxs)(`ul`,{className:`flex flex-col gap-2`,children:[t.map(t=>(0,V.jsx)(ge,{projectId:e.id,webhook:t,defaultOpen:t.id===i},t.id)),n?(0,V.jsx)(_e,{projectId:e.id,onCancel:()=>r(!1),onCreated:e=>{a(e.id),r(!1)}}):null]}):null,n?null:(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,V.jsxs)(x,{type:`button`,size:`sm`,variant:`outline`,className:`max-sm:h-11`,"data-action":`webhook-add`,disabled:o,onClick:()=>r(!0),children:[(0,V.jsx)(b,{"aria-hidden":`true`}),`Add webhook`]}),o?(0,V.jsxs)(`span`,{className:`text-[11px] text-soft-foreground`,children:[`A project holds at most `,16,` webhooks.`]}):null]})]})})}function X(e){let t=new Date(e);return Number.isNaN(t.getTime())?`—`:t.toLocaleDateString(void 0,{year:`numeric`,month:`short`,day:`numeric`})}function Z(){let e=E(),t=p(),n=c();if(t.isPending)return(0,V.jsx)(`p`,{"data-slot":`project-general-loading`,className:`text-[13px] text-soft-foreground`,children:`Loading project…`});if(t.isError)return(0,V.jsxs)(`p`,{"data-slot":`project-general-error`,className:`text-[13px] text-danger`,children:[`Could not read the project registry — `,t.error.message]});let r=t.data,i=r?.projects.find(t=>t.id===e);return!r||!i?null:(0,V.jsxs)(`div`,{"data-slot":`project-general`,className:`flex w-full flex-col gap-5`,children:[(0,V.jsxs)(`section`,{className:`flex flex-col gap-5 rounded-lg border border-border bg-card p-5 [&_select]:min-h-11 [&_select]:w-full`,children:[(0,V.jsx)(`h2`,{className:`text-lg font-semibold`,children:`General`}),(0,V.jsx)(fe,{}),(0,V.jsx)(ye,{project:i}),(0,V.jsx)(N,{title:`Max parallel tasks`,hint:n.data?`The workspace limit (${n.data.resources.maxParallel}) still applies as an overall ceiling.`:`How many of this project's tasks may run at once. The workspace limit still applies as an overall ceiling.`,children:n.data?(0,V.jsx)(de,{project:i,workspaceMax:n.data.resources.maxParallel}):(0,V.jsx)(`p`,{className:`text-[13px] text-soft-foreground`,children:`Loading the workspace limit…`})}),(0,V.jsx)(ve,{project:i},i.id)]}),(0,V.jsx)(`section`,{className:`rounded-lg border border-border bg-card p-5`,children:(0,V.jsx)(be,{project:i,bootProject:r.bootProject})})]})}function ye({project:e}){return(0,V.jsxs)(`dl`,{"data-slot":`project-facts`,className:`grid grid-cols-1 gap-4 text-[13px] sm:grid-cols-3`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{className:`text-[11px] text-muted-foreground`,children:`Project`}),(0,V.jsx)(`dd`,{className:`mt-1 font-medium`,children:e.name})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{className:`text-[11px] text-muted-foreground`,children:`Branch`}),(0,V.jsx)(`dd`,{className:`mt-1 break-all`,children:e.branch??`—`})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{className:`text-[11px] text-muted-foreground`,children:`Status`}),(0,V.jsxs)(`dd`,{"data-slot":`project-general-status`,className:e.status===`missing`?`mt-1 text-danger`:`mt-1`,children:[ue[e.status],e.status===`missing`?` — remove it below, or restore the folder`:null]})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{className:`text-[11px] text-muted-foreground`,children:`Added`}),(0,V.jsxs)(`dd`,{className:`mt-1`,children:[X(e.addedAt),(0,V.jsx)(`span`,{className:`text-soft-foreground`,children:e.source===`checkout`?` · cloned from GitHub`:` · opened locally`})]})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{className:`text-[11px] text-muted-foreground`,children:`Last opened`}),(0,V.jsx)(`dd`,{className:`mt-1`,children:X(e.lastOpenedAt)})]})]})}function be({project:e,bootProject:t}){let[n,r]=(0,P.useState)(null),i=ce(),a=h(),o=e.id===t;return(0,V.jsxs)(N,{title:`Remove from workspace`,hint:`Unregisters this project so it leaves the sidebar and the project list. Nothing on disk is deleted — the folder, its git history and its task history all stay, and opening it again re-registers it.`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,V.jsxs)(x,{type:`button`,variant:`outline`,size:`sm`,"data-action":`project-general-remove`,"aria-label":`Remove ${e.name} from the workspace — unregisters it, no files are deleted`,title:o?`Squawk is serving this project — it re-registers itself at every start`:void 0,disabled:o||i.isPending,onClick:()=>r(e),className:`text-danger`,children:[`Remove `,e.name]}),o?(0,V.jsx)(`span`,{"data-slot":`project-general-remove-boot`,className:`text-[11px] text-soft-foreground`,children:`Squawk is serving this project — it re-registers itself at every start.`}):null]}),(0,V.jsx)(le,{project:n,onOpenChange:e=>!e&&r(null),onConfirm:()=>{r(null),i.confirm(e,()=>void a(`/p/${encodeURIComponent(t)}`))}})]})}function xe(e){return e===`global`?{Link:m,NavLink:g}:{Link:D,NavLink:T}}function Q({scope:e,title:t,mobileTitle:n}){let r=ne().name;return(0,V.jsxs)(`header`,{"data-slot":`settings-main-header`,className:`settings-route-header flex shrink-0 flex-col gap-2`,children:[(0,V.jsxs)(`h1`,{className:`text-[15px] font-semibold tracking-normal max-md:text-[24px] max-md:font-normal`,children:[(0,V.jsx)(`span`,{className:`md:hidden`,children:n}),(0,V.jsxs)(`span`,{className:`max-md:hidden`,children:[t,` · `,e===`global`?`every project`:r??`this project`]})]}),e===`global`?(0,V.jsx)(`span`,{"data-slot":`settings-scope-chip`,className:`sr-only`,children:`Global settings`}):null]})}function $({scope:e,activeId:t}){let{NavLink:n}=xe(e),r=j(e);return(0,V.jsxs)(`details`,{className:`settings-section-picker md:hidden`,children:[(0,V.jsxs)(`summary`,{children:[r.find(e=>e.id===t)?.title??`General`,(0,V.jsx)(v,{"aria-hidden":`true`,className:`size-5 text-muted-foreground`})]}),(0,V.jsxs)(`nav`,{"aria-label":`Settings sections`,"data-slot":`settings-nav-mobile`,"data-scope":e,children:[e===`project`?(0,V.jsx)(n,{to:`/settings`,end:!0,"data-slot":`settings-nav-index`,children:`General`}):null,r.map(t=>(0,V.jsx)(n,{to:A(e,t.id),"data-section":t.id,children:t.title},t.id))]})]},`${e}-${t}`)}function Se({section:e,scope:t}){let n=e.component;return(0,V.jsxs)(`div`,{"data-route":t===`global`?`settings-global-${e.id}`:`settings-${e.id}`,className:`settings-route mx-auto flex min-h-full w-full flex-col`,children:[(0,V.jsx)(Q,{scope:t,title:e.title,mobileTitle:t===`global`?`Global settings`:`Project settings`}),(0,V.jsxs)(`div`,{className:`settings-route-body flex min-w-0 flex-1 flex-col md:flex-row`,children:[(0,V.jsx)($,{scope:t,activeId:e.id}),(0,V.jsxs)(`section`,{className:`settings-panel min-w-0 self-start md:flex-1`,"aria-label":e.title,children:[(0,V.jsx)(`h2`,{className:`settings-panel-title`,children:e.title}),(0,V.jsx)(n,{})]})]})]})}function Ce(){return(0,V.jsxs)(`div`,{"data-route":`settings`,className:`settings-route mx-auto flex min-h-full w-full flex-col`,children:[(0,V.jsx)(Q,{scope:`project`,title:`General`,mobileTitle:`Project settings`}),(0,V.jsxs)(`div`,{className:`settings-route-body flex min-w-0 flex-1 flex-col md:flex-row`,children:[(0,V.jsx)($,{scope:`project`,activeId:null}),(0,V.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-5`,children:[(0,V.jsx)(Z,{}),(0,V.jsx)(`section`,{className:`rounded-lg border border-border bg-card p-5`,children:(0,V.jsx)(se,{})}),(0,V.jsx)(`h2`,{className:`settings-other-title mt-6 rounded-t-lg border border-b-0 border-border bg-card px-5 pt-5 text-base font-semibold md:hidden`,children:`Other project settings`}),(0,V.jsx)(`ul`,{"data-slot":`settings-index`,className:`mt-7 flex w-full flex-col gap-5 md:hidden`,children:j(`project`).map(e=>(0,V.jsx)(`li`,{children:(0,V.jsxs)(D,{to:A(`project`,e.id),"data-section":e.id,className:`flex items-center gap-3.5 rounded-lg border border-border bg-card p-4 transition-colors hover:bg-card-2`,children:[(0,V.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center text-accent-text`,children:(0,V.jsx)(e.icon,{"aria-hidden":`true`,className:`size-4`})}),(0,V.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,V.jsx)(`span`,{className:`block text-sm font-medium text-foreground`,children:e.title}),(0,V.jsx)(`span`,{className:`block text-xs text-soft-foreground`,children:e.description})]}),(0,V.jsx)(y,{"aria-hidden":`true`,className:`size-4 shrink-0 text-soft-foreground`})]})},e.id))}),(0,V.jsxs)(`p`,{className:`mt-5 w-full text-[12px] text-soft-foreground`,children:[`Appearance, notifications, host resources and the project registry live in`,` `,(0,V.jsx)(m,{to:re,"data-slot":`settings-global-link`,className:`underline underline-offset-2 hover:text-foreground`,children:`Global settings`}),`.`]})]})]})]})}export{Ce as SettingsIndexRoute,Se as SettingsSectionRoute};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.settings-panel{border:1px solid var(--border);background:var(--card);border-radius:12px;width:100%;padding:24px}.settings-panel-title{margin-block:0 24px;margin-inline:0;font-size:20px;font-weight:400}.settings-panel>[data-slot]{width:100%;max-width:none;margin:0;padding:0}.settings-panel .settings-field{gap:12px}.settings-panel .settings-field+.settings-field{border-block-start:1px solid var(--border);padding-block-start:22px}.settings-panel .settings-field h2{font-size:14px;font-weight:400}.settings-panel .settings-field h2+p{margin-block-start:8px;line-height:1.6}.settings-panel :is(input:not([type=checkbox]):not([type=radio]),select,textarea:not([data-slot=code-editor-input])){background:var(--background);min-width:0;max-width:100%;min-height:44px;box-shadow:none;font-size:13px}.settings-panel .settings-field>:is(input,select,textarea:not([data-slot=code-editor-input])),.settings-panel [data-slot=agents-default-runner],.settings-panel [data-slot=projects-browse-root],.settings-panel [data-slot=projects-checkout-root]{width:100%;max-width:none}.settings-panel button:not([role=switch]):not([data-slot=project-tag-suggestion]){min-height:40px}.settings-panel [data-slot=resources-composer-defaults]{grid-template-columns:1fr;gap:24px}.settings-panel [data-slot=prompt-template-row],.settings-panel [data-slot=prompt-template-new]{border:0;border-block-end:1px solid var(--border);border-radius:0;gap:12px;padding-block:20px;padding-inline:0}.settings-panel [data-slot=agent-config-agents]{background:0 0;gap:8px;padding:0}.settings-panel [data-slot=agent-config-agent]{border:1px solid var(--border)}.settings-panel [data-slot=agent-config-agent][aria-selected=true]{background:var(--accent-strong);color:var(--accent-strong-foreground)}.settings-panel [data-slot=projects-section] table{display:block}.settings-panel [data-slot=projects-section] :is(tbody,tr){min-width:0;display:grid}.settings-panel [data-slot=projects-section] thead{clip-path:inset(50%);width:1px;height:1px;position:absolute;overflow:hidden}.settings-panel [data-slot=projects-section] colgroup{display:none}.settings-panel :is([data-slot=project-row],[data-slot=worktree-row]){gap:8px;padding-block:16px;padding-inline:0}.settings-panel :is([data-slot=project-row],[data-slot=worktree-row])>:is(th,td){text-align:start;width:100%;min-width:0;max-width:none;padding-block:0;padding-inline:12px;display:block}.settings-panel :is([data-slot=project-row],[data-slot=worktree-row]) .truncate{white-space:normal;overflow-wrap:anywhere}.settings-panel :is([data-slot=project-row],[data-slot=worktree-row]) td:last-child{border-block-start:1px solid var(--border);padding-block-start:12px}.settings-panel .settings-resource-controls input{flex:1;width:100%}:is(.settings-panel .settings-field:has([data-slot=resources-auto-resume]),.settings-panel .settings-field:has([data-slot=resources-monitoring-wake-mode])){position:relative}:is(.settings-panel .settings-field:has([data-slot=resources-auto-resume])>div:first-child,.settings-panel .settings-field:has([data-slot=resources-monitoring-wake-mode])>div:first-child){padding-inline-end:60px}.settings-panel [data-slot=resources-auto-resume],.settings-panel [data-slot=resources-monitoring-wake-mode]{position:absolute;inset-block-start:24px;inset-inline-end:0}.settings-panel [data-slot=agent-config-group] ul{flex-flow:wrap;gap:8px}.settings-panel [data-slot=agent-config-file]{border:1px solid var(--border);padding-block:10px;padding-inline:12px}.settings-panel [data-slot=agent-config-file][data-selected=true]{border-color:var(--accent-strong);color:var(--accent-text)}.settings-route{gap:0;padding:0}.settings-route-header{border-block-end:1px solid var(--border);padding-block:16px;padding-inline:28px}.settings-route-body{gap:24px;padding:28px}.settings-section-picker{border:1px solid var(--border);background:var(--card);border-radius:8px;width:100%;position:relative}.settings-section-picker summary{cursor:pointer;justify-content:space-between;align-items:center;min-height:48px;padding-block:12px;padding-inline:14px;font-size:14px;list-style:none;display:flex}.settings-section-picker summary::-webkit-details-marker{display:none}.settings-section-picker nav{border-block-start:1px solid var(--border);padding:4px;display:grid}.settings-section-picker nav a{border-radius:6px;padding:12px;font-size:13px}.settings-section-picker nav a[aria-current=page]{background:color-mix(in oklch, var(--accent-strong) 12%, transparent);color:var(--accent-text)}.settings-panel{border-radius:10px}.settings-panel h3,.settings-panel :is([data-slot=notifications-section],[data-slot=skills-settings-section]) h2{font-weight:400}.settings-panel :is([data-slot=notifications-section],[data-slot=skills-settings-section]) h2+p{margin-block-start:8px;line-height:1.6}.settings-panel :is([data-slot=notifications-section],[data-slot=skills-settings-section]) [role=switch]{margin-block-start:8px}.settings-panel [data-slot=appearance-section]{border:0;border-radius:0}.settings-panel [data-slot=appearance-section]>section{gap:12px}.settings-panel [data-slot=appearance-section]>section+section{border-block-start:1px solid var(--border);padding-block-start:24px}.settings-panel [data-slot=appearance-section] h2{font-size:14px;font-weight:400}.settings-panel [data-slot=appearance-section] h2+p{margin-block-start:8px}.settings-panel [data-slot=appearance-section] [role=radiogroup]{background:0 0;border:0;gap:10px;padding:0}.settings-panel [data-slot=appearance-section] [role=radio]{border:1px solid var(--border);background:var(--card);border-radius:8px;padding-block:12px;padding-inline:16px;font-weight:400}.settings-panel [data-slot=appearance-section] [aria-checked=true]{background:color-mix(in oklch, var(--accent-strong) 12%, transparent);color:var(--accent-text);border-color:color-mix(in oklch, var(--accent-strong) 30%, var(--border))}.settings-panel [data-slot=notifications-permission]{margin-block:20px;margin-inline:0}.settings-panel [data-slot=notifications-permission][data-permission=denied]{color:var(--danger)}.settings-panel .settings-readout{border:1px solid var(--border);background:var(--background);overflow-wrap:anywhere;border-radius:6px;padding:12px;font-size:13px;line-height:1.6}.settings-panel .settings-disclosure{border-block-start:1px solid var(--border);color:var(--muted-foreground);padding-block-start:16px;font-size:12px}.settings-panel .settings-disclosure summary{cursor:pointer;padding-block:4px;padding-inline:0}.settings-panel .settings-disclosure>:not(summary){margin-block-start:12px}.settings-panel [data-slot=agent-defaults-section]{gap:20px}.settings-panel [data-slot=agent-defaults-section] .settings-field+.settings-field{padding-block-start:20px}.settings-panel [data-slot=agents-system-prompt]{min-height:192px}.settings-panel [data-slot=agents-task-runs]{gap:20px}.settings-panel [data-slot=agents-task-runs]>h2{font-size:14px;font-weight:400}.settings-panel .settings-option-row{justify-content:space-between;align-items:flex-start;gap:16px;display:flex}.settings-panel .settings-option-row>div:first-child{flex:1;min-width:0}.settings-panel .settings-option-row h3{font-size:14px;font-weight:400}.settings-panel .settings-option-row p{margin-block-start:8px;line-height:1.6}.settings-panel .settings-option-row label{flex-shrink:0}.settings-panel .settings-option-row label>span{display:none}.settings-panel .settings-option-row :is(select,output){width:auto;min-width:12rem;max-width:16rem}.settings-panel .settings-form-actions{border-block-start:1px solid var(--border);flex-wrap:wrap;gap:12px;padding-block-start:20px;display:flex}@media (width<=767px){.settings-route{gap:24px;padding-block:28px 32px;padding-inline:18px}.settings-route-header{border-block-end:0;padding:0}.settings-route-header h1{letter-spacing:0;line-height:36px}.settings-route-header>p{display:none}.settings-route-body{gap:20px;padding:0}.settings-panel{padding:16px}.settings-panel-title{margin-block-end:24px;font-size:20px;line-height:30px}.settings-panel button:not([role=switch]):not([data-slot=project-tag-suggestion]):not([data-slot=prompt-template-skill-chip]){min-height:44px}.settings-panel [data-slot=agent-config-agents]{flex-wrap:wrap}.settings-panel [data-slot=agent-config-group] li{max-width:100%}.settings-panel [data-slot=appearance-section] [role=radiogroup]{width:100%;display:grid}.settings-panel [data-slot=appearance-section] [role=radio]{justify-content:flex-start}.settings-panel .settings-resource-controls{align-items:stretch}.settings-panel [data-slot=agents-system-prompt]{min-height:192px}}.settings-panel .settings-retention-controls input{width:100%}.settings-panel .settings-retention-controls>span{display:none}.settings-panel .settings-appearance-preview{padding:20px}.settings-panel [data-slot=appearance-theme] svg,.settings-panel [data-slot=prompt-templates-section]>.settings-field>div:first-child>h2{display:none}.settings-panel [data-slot=prompt-templates-section]>.settings-field>div:first-child>p{margin-block-start:0}.settings-panel [data-slot=prompt-template-row]{gap:12px;padding-block-start:12px}.settings-panel [data-slot=prompt-template-row]>label,.settings-panel [data-slot=prompt-template-row]>p,.settings-panel [data-slot=prompt-template-new]>label:not(:first-of-type){border-block-start:1px solid var(--border);margin-block-start:8px;padding-block-start:20px}.settings-panel [data-slot=prompt-template-row] textarea{min-height:44px}.settings-panel [data-slot=prompt-template-skill-chip]{background:0 0;border:0;border-radius:4px;min-height:28px;font-family:inherit;font-size:13px}.settings-panel [data-slot=prompt-template-skills-trigger]{border-radius:6px}.settings-panel [data-slot=accounts-defaults]{margin-block-start:8px}.settings-panel [data-slot=accounts-defaults] select{max-width:none}.settings-panel [data-slot=accounts-provider]>dl{background:var(--background)}.settings-panel [data-slot=accounts-provider]>ul{border:0}.settings-panel [data-slot=account-row]{padding-block:16px;padding-inline:0}.settings-panel [data-slot=account-details]{background:var(--background)}.settings-route [data-slot=project-general]{gap:20px}.settings-route [data-slot=project-general]>section{border-radius:10px;padding:20px}.settings-route [data-slot=project-general] [data-slot=project-facts]{border-block-end:1px solid var(--border);padding-block-end:16px}:is(.settings-panel [data-slot=projects-section] .settings-field:has([data-slot=projects-browse-root])>div:nth-child(2),.settings-panel [data-slot=projects-section] .settings-field:has([data-slot=projects-checkout-root])>div:nth-child(2)){flex-wrap:wrap}:is(.settings-panel [data-slot=projects-section] .settings-field:has([data-slot=projects-browse-root]) button,.settings-panel [data-slot=projects-section] .settings-field:has([data-slot=projects-checkout-root]) button){margin-block-start:8px}.settings-panel [data-slot=projects-section] .overflow-x-auto{border:0}.settings-panel :is([data-slot=project-row],[data-slot=worktree-row])>:is(th,td){padding-inline:0}.settings-panel :is([data-slot=project-row],[data-slot=worktree-row])>th{font-size:14px}.settings-panel :is([data-slot=project-row],[data-slot=worktree-row])>td:nth-child(2){border:1px solid var(--border);background:var(--background);border-radius:6px;padding:12px}.settings-panel :is([data-slot=project-row],[data-slot=worktree-row])>td:last-child{margin-block-start:8px;padding-block-start:20px}@media (width<=767px){.settings-panel [data-slot=accounts-defaults] label{flex-direction:column;align-items:stretch}.settings-panel [data-slot=accounts-defaults] label>span{width:auto}.settings-panel [data-slot=accounts-provider] dl>div{flex-wrap:wrap}.settings-route [data-slot=project-general]>section{padding:16px}}.settings-agent-picker{border:1px solid var(--border);background:var(--background);border-radius:6px;min-width:0}.settings-agent-picker summary{cursor:pointer;align-items:center;gap:10px;min-height:44px;padding-block:10px;padding-inline:12px;font-size:13px;list-style:none;display:flex}.settings-agent-picker summary::-webkit-details-marker{display:none}.settings-agent-picker [data-slot=agents-runner]{border:0;border-block-start:1px solid var(--border);flex-direction:column;width:100%;max-width:none;padding:4px;display:flex}.settings-agent-picker [role=radio]{white-space:normal;font-family:inherit}.settings-panel [data-slot=settings-config-editor]>[data-slot=code-editor]{margin-block-start:8px}.settings-route[data-route=settings] .settings-route-header>p,.settings-route[data-route=settings-global] .settings-route-header>p{display:block}.settings-route[data-route=settings] .settings-route-header h1,.settings-route[data-route=settings-global] .settings-route-header h1{font-weight:600}.settings-route[data-route=settings-global] [data-slot=settings-index] a>span:nth-child(2)>span:first-child{font-weight:400}.settings-route[data-route=settings-global] [data-slot=settings-index] a>span:nth-child(2)>span+span{margin-block-start:8px}.settings-route[data-route=settings-global] [data-slot=settings-index]+p{display:none}@media (width<=767px){.settings-route{gap:16px}.settings-route[data-route=settings] [data-slot=settings-index]{border:1px solid var(--border);background:var(--card);border-block-start:0;border-radius:0 0 10px 10px;gap:0;margin-block-start:0;padding-block:12px;padding-inline:16px}.settings-route[data-route=settings] [data-slot=settings-index] a{border:0;border-radius:0;padding-block:16px;padding-inline:0}.settings-route[data-route=settings] [data-slot=settings-index] a>span:first-child,.settings-route[data-route=settings] [data-slot=settings-index] a>span:nth-child(2)>span+span{display:none}.settings-route[data-route=settings] [data-slot=settings-index] a>span:nth-child(2)>span:first-child{color:var(--muted-foreground);font-size:13px;font-weight:400}.settings-panel .settings-resource-controls input{flex-basis:100%}.settings-panel [data-slot=resources-composer-defaults] select{width:100%}}.settings-model-control{position:relative}.settings-model-control>svg{pointer-events:none;position:absolute;inset-block-start:50%;inset-inline-start:12px;transform:translateY(-50%)}.settings-panel .settings-model-control :is(select,output){padding-inline-start:36px}.settings-route [data-slot=button]{border-radius:8px;font-weight:400}.settings-panel [data-slot=button]{padding-inline:16px}.settings-route [data-slot=button][data-variant=primary]{background:var(--accent-strong);color:var(--accent-strong-foreground)}.settings-route [data-slot=switch-thumb]{background:#fff}.settings-panel .settings-form-actions [data-variant=primary]{order:1}.settings-panel .settings-form-actions>span{order:2}.settings-panel [data-slot=settings-config-editor]{gap:12px}.settings-config-toolbar{flex-wrap:wrap;align-items:center;gap:12px;display:flex}.settings-config-file-row{flex-wrap:wrap;gap:10px;display:flex}.settings-config-file-row button{border:1px solid var(--border);background:var(--card);border-radius:8px;padding-block:10px;padding-inline:16px;font-size:12px;font-weight:400}.settings-config-file-row button[aria-pressed=true]{background:var(--accent-strong);color:var(--accent-strong-foreground)}.settings-config-agent-choice{color:var(--muted-foreground);align-items:center;gap:8px;margin-inline-start:auto;font-size:12px;display:flex}.settings-panel .settings-config-agent-choice select{border:1px solid var(--border);border-radius:6px;min-height:36px;padding-block:6px;padding-inline:10px}.settings-config-content-heading{border-block-start:1px solid var(--border);margin-block-start:8px;padding-block-start:20px}.settings-config-content-heading h3{font-size:14px}.settings-config-content-heading p{color:var(--muted-foreground);margin-block-start:8px;font-size:12px}.settings-config-save-help{color:var(--muted-foreground);gap:8px;padding-block-start:8px;font-size:12px;display:grid}.settings-config-scopes{border-block-start:1px solid var(--border);gap:12px;padding-block-start:24px;display:grid}.settings-config-scopes h3{font-size:14px}.settings-panel [data-slot=accounts-provider]{gap:12px}.settings-account-provider-title{font-size:14px}.settings-account-installation{line-height:1.6}.settings-account-count{color:var(--muted-foreground);margin-block-start:4px;font-size:11px;display:block}.settings-panel [data-slot=account-row]{border-block-start:1px solid var(--border);margin-block-start:20px;padding-block:24px 0;padding-inline:0}.settings-account-card{flex-direction:column;gap:20px;display:flex}.settings-account-card>div:first-child>div:first-child>span:first-child{font-size:14px;font-weight:400}.settings-account-readout{flex-wrap:wrap;align-items:center;gap:8px;margin-block-start:8px;display:flex}.settings-account-readout [data-slot=account-path]{white-space:normal;overflow-wrap:anywhere;order:1;margin:0;font-family:inherit;font-size:13px}.settings-account-readout>div{margin:0;font-size:13px}.settings-account-actions{border-block-start:1px solid var(--border);flex-wrap:wrap;gap:12px;padding-block-start:20px;display:flex}.settings-account-add-row{margin-block-start:12px}.settings-panel [data-slot=accounts-defaults]{background:0 0;border:0;gap:12px;margin-block-start:12px;padding:0}.settings-panel [data-slot=accounts-defaults]>div:first-child>h3{font-size:14px}.settings-panel [data-slot=accounts-defaults]>div:first-child>p{margin-block-start:8px;font-size:12px}.settings-account-models{background:var(--background);border:1px solid var(--border);border-radius:8px;padding:14px}.settings-panel .settings-account-model{background:var(--background);border:1px solid var(--border);border-radius:8px;padding-block:10px;padding-inline:12px;position:relative}.settings-panel .settings-account-model select{min-height:24px;box-shadow:none;background:0 0;border:0;padding:0;font-size:13px}@media (width<=767px){.settings-config-agent-choice{margin-inline-start:0}.settings-config-file-row{gap:8px}.settings-config-file-row button{padding-inline:12px}.settings-account-actions{flex-direction:column;align-items:flex-start}.settings-panel [data-slot=accounts-defaults] .settings-account-model{flex-flow:wrap;align-items:center}.settings-panel .settings-account-model select{flex:1;min-width:100px}}.settings-panel [data-slot=agent-config-scope]{white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.settings-account-readout{flex-wrap:nowrap}.settings-account-readout [data-slot=account-path]{white-space:nowrap;flex:1;min-width:0}.settings-account-readout>div{flex-shrink:0}.settings-account-readout:has([data-slot=account-missing],[data-slot=account-unrecognised]){flex-wrap:wrap}.settings-account-readout:has([data-slot=account-missing],[data-slot=account-unrecognised])>div{flex-shrink:1}.settings-config-scopes [data-slot=agent-config-nav]{grid-template-columns:repeat(auto-fit,minmax(min(100%,15rem),1fr));gap:20px;display:grid}.settings-config-scopes [data-slot=agent-config-file]{padding:8px;font-size:12px}.settings-panel [data-slot=accounts-provider]>ul{border-radius:0}.settings-panel [data-slot=account-row]{margin-block-start:8px}.settings-account-management{display:contents}.settings-account-management>span{flex-basis:100%;order:2;font-size:12px}.settings-account-management [data-slot=account-rename-input]{min-width:0;max-width:100%}.settings-panel [data-slot=accounts-defaults] .settings-model-agent-choice{color:var(--muted-foreground);flex-direction:row;align-items:center;gap:8px;font-size:12px;display:flex}.settings-panel .settings-model-agent-choice select{background:0 0;border:0;width:auto;min-height:28px;font-size:12px}.settings-config-scopes [data-slot=agent-config-group]>ul>li{width:100%;min-width:0}.settings-config-scopes [data-slot=agent-config-file]{min-width:0;max-width:100%}.settings-panel [data-slot=settings-config-editor]>[data-slot=code-editor]{background:var(--background)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{c as r}from"./utils-DSMR_WLb.js";import{Ir as i,Lr as a,P as o,di as s}from"./project-scope-context-C912rTJP.js";import{
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{c as r}from"./utils-DSMR_WLb.js";import{Ir as i,Lr as a,P as o,di as s}from"./project-scope-context-C912rTJP.js";import{sn as c,y as l}from"./queries-DRpvYgai.js";import{t as u}from"./button-BQ2y4XRB.js";import{_n as d}from"./index-Clu9VXJs.js";var f=e(t(),1),p=n(),m=[[`overall`,`Overall`],[`needsYou`,`Needs You`],[`finished`,`Finished`],[`working`,`Working`]];function h(){let e=r(),t=l(e);return t.isPending?(0,p.jsx)(`p`,{role:`status`,className:`p-4 text-sm text-muted-foreground`,children:`Loading sidebar settings…`}):t.isError?(0,p.jsxs)(`div`,{className:`space-y-3 p-4`,children:[(0,p.jsxs)(`p`,{role:`alert`,children:[`Sidebar settings did not load: `,t.error.message]}),(0,p.jsx)(u,{className:`min-h-[44px]`,onClick:()=>void t.refetch(),children:`Retry`})]}):(0,p.jsx)(g,{scope:e,initial:t.data.sidebarLimits??{}},e)}function g({scope:e,initial:t}){let n=s(),r=i(void 0),l=_(t),[h,g]=(0,f.useState)(()=>({values:l,saved:l,received:l})),{values:y,saved:b}=h,x=e=>g(t=>({...t,values:e})),S=a.safeParse(Object.fromEntries(m.map(([e])=>[e,y[e]===null?null:Number(y[e])]))),C=e=>y[e]!==null&&(y[e].trim()===``||!Number.isSafeInteger(Number(y[e]))||Number(y[e])<=0),w=m.some(([e])=>y[e]!==b[e]);d(w);let T=c({onMutate:()=>n.cancelQueries({queryKey:[e,`ui-state`],exact:!0}),mutationFn:t=>o({sidebarLimits:t},e),onSuccess:async t=>{await n.cancelQueries({queryKey:[e,`ui-state`],exact:!0}),n.setQueryData([e,`ui-state`],t);let r=_(t.sidebarLimits);g({values:r,saved:r,received:r})}});return!T.isPending&&!v(h.received,l)&&g({values:w?y:l,saved:l,received:l}),(0,p.jsxs)(`form`,{"data-slot":`sidebar-settings`,"data-reports-dirty":``,className:`flex w-full max-w-2xl flex-col gap-5 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6`,onSubmit:e=>{e.preventDefault(),S.success&&!m.some(([e])=>C(e))&&!T.isPending&&T.mutate(S.data)},children:[(0,p.jsx)(`p`,{id:`sidebar-limits-help`,className:`text-sm text-muted-foreground`,children:`Limits apply to this project on desktop and mobile. The overall budget is shared in section order: Needs You, Finished, then Working. Each section also respects its own limit. Unlimited removes only that constraint.`}),(0,p.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Pinned tasks and groups containing a pin bypass both limits. A task group counts as one row. Archived uses only the overall limit; archived pins are not exempt.`}),m.map(([e,t])=>(0,p.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,p.jsx)(`label`,{htmlFor:`sidebar-${e}`,className:`text-sm font-medium`,children:t}),(0,p.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,p.jsx)(`input`,{id:`sidebar-${e}`,type:`number`,inputMode:`numeric`,min:`1`,step:`1`,value:y[e]??``,disabled:y[e]===null||T.isPending,"aria-invalid":C(e),"aria-describedby":C(e)?`sidebar-${e}-error sidebar-limits-help`:`sidebar-limits-help`,onChange:t=>x({...y,[e]:t.target.value}),className:`min-h-[44px] w-28 rounded-md border border-input bg-card px-3 text-sm outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50`}),(0,p.jsxs)(`label`,{className:`flex min-h-[44px] cursor-pointer items-center gap-2 text-sm`,children:[(0,p.jsx)(`input`,{type:`checkbox`,"aria-label":`${t} Unlimited`,checked:y[e]===null,disabled:T.isPending,onChange:t=>x({...y,[e]:t.target.checked?null:String(r[e]??10)}),className:`size-4 accent-[var(--accent-strong)]`}),`Unlimited`]})]}),C(e)&&(0,p.jsx)(`p`,{id:`sidebar-${e}-error`,className:`text-sm text-danger`,children:`Enter a positive whole number or choose Unlimited.`})]},e)),(0,p.jsx)(u,{type:`submit`,className:`min-h-[44px] self-start`,variant:`primary`,disabled:!w||!S.success||m.some(([e])=>C(e))||T.isPending,children:T.isPending?`Saving…`:`Save sidebar limits`}),T.isError&&(0,p.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[`Could not save sidebar limits: `,T.error.message]}),T.isSuccess&&!w&&(0,p.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:`Sidebar limits saved.`})]})}function _(e){let t=i(e);return Object.fromEntries(m.map(([e])=>[e,t[e]===null?null:String(t[e])]))}function v(e,t){return m.every(([n])=>e[n]===t[n])}export{h as SidebarSection};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./utils-DSMR_WLb.js";import{S as i,di as a}from"./project-scope-context-C912rTJP.js";import{$t as o,Bt as s,Kt as c,Qt as l,Wt as u,_ as d}from"./queries-DRpvYgai.js";import{g as f}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{n as p}from"./toaster-Bo5vCbz-.js";import{O as m,T as h,X as g,Y as _,ct as v,ot as y,u as b}from"./design-icons-CzEoMH9c.js";import{t as x}from"./button-BQ2y4XRB.js";import{t as S}from"./project-router-DucFIl_x.js";import{f as C,l as w}from"./skills-pM_PouEs.js";import{Dn as T,Gn as E,V as D,xn as O}from"./index-Clu9VXJs.js";var k=e(t(),1),A=n(),j=e=>e.split(`@`)[0]||e,M={project:0,user:1,plugin:2,system:3,other:4},N={project:`This project`,user:`Your skills`,system:`Built in`,other:`Other`};function P(e){if(e.plugin)return{key:`plugin:${e.plugin}`,label:j(e.plugin),kind:`plugin`};let t=e.scope===`repo`?`project`:e.scope===`user`?`user`:e.scope===`system`?`system`:`other`;return{key:t,label:N[t],kind:t}}function F(e){let t=new Map;for(let n of e){let e=P(n),r=t.get(e.key)??{...e,skills:[]};r.skills.push(n),t.set(e.key,r)}return[...t.values()].sort((e,t)=>M[e.kind]-M[t.kind]||e.label.localeCompare(t.label))}function I(e){let t=e.plugin?`${j(e.plugin)}:`:``;return t&&e.name.startsWith(t)&&e.name.length>t.length?e.name.slice(t.length):e.name}var L={project:h,user:v,plugin:m,system:m,other:m};function R({groups:e,openId:t,searching:n,runner:r,account:i}){let[a,o]=(0,k.useState)(new Set),s=e=>o(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n});return(0,A.jsx)(`div`,{"data-slot":`skills-list`,className:`overflow-hidden rounded-xl border border-border bg-card`,children:e.map(e=>{let o=n||!a.has(e.key);return(0,A.jsxs)(`section`,{"data-slot":`skill-group`,"aria-label":e.label,className:`border-border not-first:border-t`,children:[(0,A.jsx)(z,{group:e,open:o,onToggle:()=>s(e.key)}),o?e.skills.map(e=>(0,A.jsx)(B,{skill:e,open:e.id===t,runner:r,account:i},C(e))):null]},e.key)})})}function z({group:e,open:t,onToggle:n}){let i=L[e.kind];return(0,A.jsx)(`h2`,{className:`m-0`,children:(0,A.jsxs)(`button`,{type:`button`,"aria-expanded":t,onClick:n,className:`flex min-h-10 w-full items-center gap-2 bg-muted/45 px-3.5 text-left text-xs font-semibold text-muted-foreground focus-visible:outline-2 focus-visible:-outline-offset-2 pointer-hover:text-foreground`,children:[(0,A.jsx)(b,{"aria-hidden":`true`,className:r(`size-3.5 transition-transform motion-reduce:transition-none`,t&&`rotate-90`)}),(0,A.jsx)(i,{"aria-hidden":`true`,className:`size-3.5`}),(0,A.jsx)(`span`,{className:`min-w-0 truncate`,children:e.label}),(0,A.jsx)(`span`,{className:`font-medium text-soft-foreground`,children:e.skills.length})]})})}function B({skill:e,open:t,runner:n,account:r}){let i=T({skill:e.id,skillPath:e.path,runner:n,...r?{account:r}:{}});return(0,A.jsxs)(`details`,{"data-slot":`skill-row`,"data-skill":e.id,"data-skill-path":e.path,name:`skill-details`,open:t||void 0,className:`group/skill border-t border-border/60 open:bg-sidebar-row-selected`,children:[(0,A.jsxs)(`summary`,{className:`grid min-h-11 cursor-pointer list-none grid-cols-1 items-baseline gap-x-4 gap-y-0.5 py-2.5 pr-3.5 pl-9 focus-visible:outline-2 focus-visible:-outline-offset-2 pointer-hover:bg-sidebar-row-hover sm:grid-cols-[minmax(10rem,15rem)_minmax(0,1fr)] [&::-webkit-details-marker]:hidden`,children:[(0,A.jsx)(`span`,{className:`truncate text-[13.5px] font-semibold`,title:e.name,children:I(e)}),e.description?(0,A.jsx)(`span`,{className:`truncate text-[13px] text-muted-foreground group-open/skill:hidden`,children:e.description}):null]}),(0,A.jsx)(`div`,{className:`pr-3.5 pb-4 pl-9`,children:(0,A.jsx)(D,{skill:e,heading:null,actions:(0,A.jsx)(x,{asChild:!0,size:`sm`,"data-action":`start-task`,children:(0,A.jsx)(S,{to:i,children:`Start task`})})})})]})}function V(){let e=d(),[t,n]=(0,k.useState)(null),[i,a]=(0,k.useState)(null),[o,s]=(0,k.useState)(``),[c]=f(),p=t??e.data?.defaultRunner,{runner:m}=l(p??`claude`),h=i?.runner===m?i.id:null,v=e=>a(e===null?null:{runner:m,id:e}),y=u(p,h),b=K(m,y.account),S=y.data??[];return(0,A.jsxs)(`div`,{"data-route":`skills`,className:`mx-auto grid min-h-full w-full max-w-[1100px] grid-cols-1 content-start gap-5 px-[18px] py-6 md:p-9 max-md:[padding-block-end:5rem]`,children:[(0,A.jsxs)(`header`,{children:[(0,A.jsx)(`h1`,{className:`text-[25px] font-semibold tracking-tight md:text-[30px]`,children:`Skills`}),(0,A.jsx)(`p`,{className:`mt-1 text-[13px] text-muted-foreground`,children:`The skills each agent loads in this project, as its runner reports them.`})]}),(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,A.jsx)(U,{runner:m,onChange:e=>{n(e),v(null)}}),(0,A.jsx)(W,{runner:m,account:h,onChange:v}),(0,A.jsx)(`span`,{className:`ml-auto text-xs text-soft-foreground`,"data-slot":`skills-count`,children:y.list?`${S.length} ${S.length===1?`skill`:`skills`}${y.list.source===`cache`?` · from cache`:``}`:null}),(0,A.jsxs)(x,{variant:`outline`,size:`sm`,onClick:()=>void b.run(),disabled:b.running||y.isPending,"data-slot":`skills-refresh`,children:[(0,A.jsx)(_,{"aria-hidden":`true`,className:r(`size-3.5`,b.running&&`motion-safe:animate-spin`)}),`Re-read`]})]}),(0,A.jsxs)(`div`,{className:`relative`,children:[(0,A.jsx)(g,{"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground`}),(0,A.jsx)(E,{"aria-label":`Search skills`,placeholder:`Filter by name or description…`,value:o,onChange:e=>s(e.target.value),className:`h-10 bg-card pl-9 text-[13px]`})]}),(0,A.jsx)(G,{query:y}),y.isPending?(0,A.jsx)(`p`,{role:`status`,className:`text-xs text-muted-foreground`,children:`Loading skills…`}):(0,A.jsx)(H,{skills:S,search:o,openId:c.get(`skill`),runner:m,account:y.account??null,unchecked:y.unchecked})]})}function H({skills:e,search:t,openId:n,runner:r,account:i,unchecked:a}){if(e.length===0)return a?null:(0,A.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`No skills reported by this runner and account.`});let o=w(e,t);return o.length===0?(0,A.jsxs)(`p`,{className:`text-[13px] text-muted-foreground`,children:[`No skills match “`,t.trim(),`”.`]}):(0,A.jsx)(R,{groups:F(o),openId:n,searching:t.trim()!==``,runner:r,account:i})}function U({runner:e,onChange:t}){let n=o().data;return n?(0,A.jsx)(`div`,{role:`group`,"aria-label":`Runner`,className:`flex max-w-full gap-0.5 overflow-x-auto rounded-[10px] border border-border bg-card p-[3px]`,children:n.runners.map(r=>(0,A.jsx)(`button`,{type:`button`,"aria-pressed":r.id===e,onClick:()=>t(r.id),className:`h-8 shrink-0 rounded-[7px] px-3 text-[13px] text-muted-foreground focus-visible:outline-2 aria-pressed:bg-muted aria-pressed:font-semibold aria-pressed:text-foreground pointer-hover:text-foreground`,children:c(n,r.id)},r.id))}):null}function W({runner:e,account:t,onChange:n}){let r=O().accounts.filter(t=>t.provider===e);return r.length===0?null:(0,A.jsxs)(`select`,{"aria-label":`Account`,value:t??``,onChange:e=>n(e.target.value||null),className:`h-[38px] rounded-md border border-border bg-card px-2.5 text-[13px] text-foreground focus-visible:outline-2`,children:[(0,A.jsx)(`option`,{value:``,children:`Account: project default`}),r.map(e=>(0,A.jsx)(`option`,{value:e.id,children:e.label},e.id))]})}function G({query:e}){let t=e.list?.problems??[];return!e.unchecked&&t.length===0?null:(0,A.jsxs)(`div`,{className:`grid gap-1.5 rounded-lg border border-pending/40 bg-pending/10 px-3.5 py-2.5 text-[13px]`,children:[e.unchecked&&!e.isPending?(0,A.jsxs)(`p`,{role:`status`,className:`flex gap-2`,children:[(0,A.jsx)(y,{"aria-hidden":`true`,className:`mt-0.5 size-4 shrink-0 text-pending-strong`}),(0,A.jsxs)(`span`,{children:[`Skill list unavailable. `,e.list?.reason??e.error?.message,` You can still type a skill id when starting a task.`]})]}):null,t.map((e,t)=>(0,A.jsxs)(`p`,{role:`alert`,className:`flex gap-2 break-words`,children:[(0,A.jsx)(y,{"aria-hidden":`true`,className:`mt-0.5 size-4 shrink-0 text-pending-strong`}),(0,A.jsxs)(`span`,{children:[e.message,e.path?` · ${e.path}`:``]})]},t))]})}function K(e,t){let n=a(),[r,o]=(0,k.useState)(!1),c=s.runnerSkills(e,t);return{running:r,run:async()=>{o(!0);try{n.setQueryData(c,await i(e,t,{refresh:!0})),await n.invalidateQueries({queryKey:c.slice(0,3)})}catch(e){p(e instanceof Error?e.message:String(e),{tone:`danger`})}finally{o(!1)}}}}export{V as SkillsRoute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime-QTnfLwEv.js";import{i as e,t}from"./react-runtime-CCIEwYL0.js";import{t as n}from"./utils-DSMR_WLb.js";import{t as r}from"./bot-TkDIw4y-.js";import{r as i}from"./button-
|
|
1
|
+
import"./rolldown-runtime-QTnfLwEv.js";import{i as e,t}from"./react-runtime-CCIEwYL0.js";import{t as n}from"./utils-DSMR_WLb.js";import{t as r}from"./bot-TkDIw4y-.js";import{r as i}from"./button-BQ2y4XRB.js";e();var a=t(),o=i(`inline-block shrink-0`,{variants:{tone:{success:``,pending:``,danger:``,accent:``,info:``,running:``,neutral:``},shape:{filled:`size-[7px] rounded-full`,ring:`size-[7px] rounded-full border-[1.5px] bg-transparent`,workers:`inline-flex size-[12px] items-center justify-center`},pulse:{true:`animate-pulse motion-reduce:animate-none`,false:``}},compoundVariants:[{shape:`filled`,tone:`success`,className:`bg-success`},{shape:`filled`,tone:`pending`,className:`bg-pending-strong`},{shape:`filled`,tone:`danger`,className:`bg-danger`},{shape:`filled`,tone:`accent`,className:`bg-accent-strong`},{shape:`filled`,tone:`info`,className:`bg-info`},{shape:`filled`,tone:`running`,className:`bg-status-running`},{shape:`filled`,tone:`neutral`,className:`bg-soft-foreground`},{shape:`ring`,tone:`success`,className:`border-success`},{shape:`ring`,tone:`pending`,className:`border-pending-strong`},{shape:`ring`,tone:`danger`,className:`border-danger`},{shape:`ring`,tone:`accent`,className:`border-accent-strong`},{shape:`ring`,tone:`info`,className:`border-info`},{shape:`ring`,tone:`running`,className:`border-status-running`},{shape:`ring`,tone:`neutral`,className:`border-soft-foreground`},{shape:`workers`,tone:`success`,className:`text-success`},{shape:`workers`,tone:`pending`,className:`text-pending-strong`},{shape:`workers`,tone:`danger`,className:`text-danger`},{shape:`workers`,tone:`accent`,className:`text-accent-icon`},{shape:`workers`,tone:`info`,className:`text-info`},{shape:`workers`,tone:`running`,className:`text-status-running`},{shape:`workers`,tone:`neutral`,className:`text-soft-foreground`}],defaultVariants:{tone:`neutral`,shape:`filled`,pulse:!1}});function s({className:e,tone:t=`neutral`,shape:i=`filled`,pulse:s=!1,...c}){return(0,a.jsx)(`span`,{"data-slot":`status-dot`,"data-tone":t,"data-shape":i,"data-pulse":s?`true`:void 0,className:n(o({tone:t,shape:i,pulse:s,className:e})),...c,children:i===`workers`?(0,a.jsx)(r,{className:`size-[12px]`,"aria-hidden":`true`}):null})}export{s as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./utils-DSMR_WLb.js";import{a as i}from"./dist-BW234Kg5.js";import{a,i as o,r as s,t as c}from"./dist-C5mlVBmd.js";import{t as l}from"./dist-DXO3xwbC.js";var u=e(t(),1);function d(e){let t=u.useRef({value:e,previous:e});return u.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var f=n(),p=`Switch`,[m,h]=o(p),[g,_]=m(p);function v(e){let{__scopeSwitch:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:l,required:d,value:m=`on`,internal_do_not_use_render:h}=e,[_,v]=c({prop:n,defaultProp:i??!1,onChange:l,caller:p}),[y,b]=u.useState(null),[x,S]=u.useState(null),C={checked:_,setChecked:v,disabled:a,control:y,setControl:b,name:s,form:o,value:m,hasConsumerStoppedPropagationRef:u.useRef(!1),required:d,defaultChecked:i,isFormControl:!y||!!o||!!y.closest(`form`),bubbleInput:x,setBubbleInput:S};return(0,f.jsx)(g,{scope:t,...C,children:E(h)?h(C):r})}var y=`SwitchTrigger`,b=u.forwardRef(({__scopeSwitch:e,onClick:t,...n},r)=>{let{control:o,form:c,value:l,disabled:d,checked:p,required:m,setControl:h,setChecked:g,hasConsumerStoppedPropagationRef:v,isFormControl:b,bubbleInput:x}=_(y,e),S=i(r,h),C=u.useRef(p);return u.useEffect(()=>{let e=c?o?.ownerDocument.getElementById(c):o?.form;if(e instanceof HTMLFormElement){let t=()=>g(C.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[o,c,g]),(0,f.jsx)(a.button,{type:`button`,role:`switch`,"aria-checked":p,"aria-required":m,"data-state":D(p),"data-disabled":d?``:void 0,disabled:d,value:l,...n,ref:S,onClick:s(t,e=>{g(e=>!e),x&&b&&(v.current=e.isPropagationStopped(),v.current||e.stopPropagation())})})});b.displayName=y;var x=u.forwardRef((e,t)=>{let{__scopeSwitch:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,f.jsx)(v,{__scopeSwitch:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(b,{...d,ref:t,__scopeSwitch:n}),e&&(0,f.jsx)(T,{__scopeSwitch:n})]})})});x.displayName=p;var S=`SwitchThumb`,C=u.forwardRef((e,t)=>{let{__scopeSwitch:n,...r}=e,i=_(S,n);return(0,f.jsx)(a.span,{"data-state":D(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})});C.displayName=S;var w=`SwitchBubbleInput`,T=u.forwardRef(({__scopeSwitch:e,...t},n)=>{let{control:r,hasConsumerStoppedPropagationRef:o,checked:s,defaultChecked:c,required:p,disabled:m,name:h,value:g,form:v,bubbleInput:y,setBubbleInput:b}=_(w,e),x=i(n,b),S=d(s),C=l(r);u.useEffect(()=>{let e=y;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=!o.current;if(S!==s&&n){let t=new Event(`click`,{bubbles:r});n.call(e,s),e.dispatchEvent(t)}},[y,S,s,o]);let T=u.useRef(s);return(0,f.jsx)(a.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:c??T.current,required:p,disabled:m,name:h,value:g,form:v,...t,tabIndex:-1,ref:x,style:{...t.style,...C,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})});T.displayName=w;function E(e){return typeof e==`function`}function D(e){return e?`checked`:`unchecked`}function O({className:e,size:t=`default`,...n}){return(0,f.jsx)(x,{"data-slot":`switch`,"data-size":t,className:r(`peer group/switch inline-flex shrink-0 items-center rounded-full border border-transparent shadow-none transition-[color,background-color,border-color,box-shadow] outline-hidden focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-6 data-[size=default]:w-10 data-[size=sm]:h-3.5 data-[size=sm]:w-6 data-[state=checked]:bg-accent-strong data-[state=unchecked]:bg-input`,e),...n,children:(0,f.jsx)(C,{"data-slot":`switch-thumb`,className:r(`pointer-events-none block rounded-full bg-background ring-0 motion-safe:transition-transform group-data-[size=default]/switch:size-[18px] group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-[state=checked]:translate-x-5 group-data-[size=default]/switch:data-[state=unchecked]:translate-x-0.5 group-data-[size=sm]/switch:data-[state=checked]:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-[state=unchecked]:translate-x-0`)})})}export{d as n,O as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Bt as r,Ct as i,Ft as a,Nn as o,Nt as s,Qn as c,Rt as l,di as u,ot as d,rt as f}from"./project-scope-context-C912rTJP.js";import{Bt as p,C as m,X as h,Y as g,sn as _,vt as v}from"./queries-DRpvYgai.js";import{h as y}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{n as b}from"./toaster-Bo5vCbz-.js";import{C as x,j as S}from"./design-icons-CzEoMH9c.js";import{t as C}from"./run-header-Dpr7e1J3.js";import{i as w,n as T,r as E}from"./git-toolbar-CKOW2Bjf.js";import{t as D}from"./button-BQ2y4XRB.js";import{a as O,i as k,o as A,r as j,s as M,t as N}from"./dialog-BVF6dIeS.js";import{b as P,f as F}from"./task-groups-ClNnAPRA.js";import{t as I}from"./centered-state-V15AR_qo.js";import{C as L,X as R,en as z,ln as B,w as V}from"./index-Clu9VXJs.js";import{t as H}from"./markdown-BBDDg-4t.js";import{t as U}from"./textarea-vJt9undk.js";import{t as W}from"./diff-CVqwOFJx.js";var G=e(t(),1),K=`no worktree — this task ran directly in the repo working tree`;function q(e){let t=e=>({id:`commit`,label:`Commit`,enabled:!1,reason:e});return e.hasWorktree?e.run.status===`running`?t(`Commit unavailable — the agent is still working in this worktree`):e.changedFiles===void 0?t(`Commit unavailable — changes are still loading`):e.changedFiles===0?t(`Commit unavailable — no changes to commit`):{id:`commit`,label:`Commit`,enabled:!0}:t(`Commit unavailable — ${K}`)}function J(e){let t=e=>({id:`push`,label:`Push`,enabled:!1,reason:e});return e.hasWorktree?e.remote===void 0?t(`Push unavailable — no remote configured`):e.branch===void 0?t(`Push unavailable — the run has no branch to push`):e.run.status===`running`?t(`Push unavailable — the agent is still working in this worktree`):{id:`push`,label:`Push`,enabled:!0}:t(`Push unavailable — ${K}`)}function Y(e){let t=e=>({id:`create-pr`,label:`Create PR`,enabled:!1,reason:e});return!e.hasWorktree||e.branch===void 0?t(`Create PR unavailable — ${K}`):e.forge===null?t(`Create PR unavailable — no supported forge remote (GitHub) detected`):e.forge.available?c(e.run)?t(`Create PR unavailable — the run is waiting on a usage-limit hold; choose Don’t resume first`):P(e.run)?t(`Create PR unavailable — the run is still active; wait for the review gate`):{id:`create-pr`,label:`Create PR`,enabled:!0}:t(`Create PR unavailable — ${e.forge.reason??`the forge is unreachable`}`)}function X(e){let t=e.prUrl?{id:`view-pr`,label:`View PR`,enabled:!0,href:e.prUrl}:q(e),n=e.prUrl?[q(e),J(e)]:[J(e),Y(e)],r=[];if(e.localHandoff&&e.cliHandoff!==!1){let t=e.hasSession?P(e.run)?{id:`open-terminal`,label:`Open in terminal`,enabled:!1,reason:`Terminal unavailable — the session is still active in the engine`}:{id:`open-terminal`,label:`Open in terminal`,enabled:!0}:{id:`open-terminal`,label:`Open in terminal`,enabled:!1,reason:`Terminal unavailable — no agent session to resume`};r.push(t)}return{primary:t,secondary:n,menu:r}}var Z=n();function Q({run:e,open:t,onOpenChange:n}){let r=u(),[i,a]=(0,G.useState)(``),o=F(e),s=(0,G.useRef)(o);s.current=o,(0,G.useEffect)(()=>{t&&a(s.current)},[t]);let c=_({mutationFn:t=>f(e.id,t),onSuccess:t=>{b(`Committed ${t.sha.slice(0,7)}`),n(!1),r.invalidateQueries({queryKey:p.runs.changes(e.id)}),r.invalidateQueries({queryKey:p.runs.all})},onError:e=>b(e.message,{tone:`danger`})}),l=()=>{let e=i.trim();e.length===0||c.isPending||c.mutate(e)};return(0,Z.jsx)(N,{open:t,onOpenChange:n,children:(0,Z.jsxs)(j,{"data-slot":`commit-dialog`,children:[(0,Z.jsxs)(A,{children:[(0,Z.jsx)(M,{children:`Commit changes`}),(0,Z.jsxs)(k,{children:[`Stages everything in the task's worktree (git add -A) and commits to`,` `,e.branch?(0,Z.jsx)(`span`,{className:`font-mono`,children:e.branch}):`its branch`,`.`]})]}),(0,Z.jsx)(U,{"data-slot":`commit-message`,"aria-label":`Commit message`,rows:3,value:i,onChange:e=>a(e.target.value),onKeyDown:e=>{R({key:e.key,shiftKey:e.shiftKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,repeat:e.repeat,isComposing:e.nativeEvent.isComposing})&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),l())}}),(0,Z.jsxs)(O,{children:[(0,Z.jsx)(D,{variant:`outline`,onClick:()=>n(!1),children:`Cancel`}),(0,Z.jsx)(D,{"data-slot":`commit-confirm`,disabled:i.trim().length===0||c.isPending,onClick:l,children:c.isPending?`Committing…`:`Commit`})]})]})})}function $(){let{id:e}=y(),t=g(e);return t.isPending?(0,Z.jsx)(V,{tab:`changes`}):t.isError?(0,Z.jsx)(L,{tab:`changes`,error:t.error}):(0,Z.jsx)(ee,{run:t.data})}function ee({run:e}){let t=v(),n=m(),r=h(e.id,P(e)),i=z(),[c,f]=(0,G.useState)(`unified`),[g,y]=(0,G.useState)(!1),[x,S]=(0,G.useState)(!1),[w,D]=(0,G.useState)(null),[O,k]=(0,G.useState)(!1),A=(0,G.useRef)(null),j=u(),M=()=>j.invalidateQueries({queryKey:p.runs.all}),N=e=>b(e.message,{tone:`danger`}),F=_({mutationFn:()=>l(e.id),onSuccess:e=>b(e.upstreamSet?`Pushed ${e.branch} to ${e.remote} (upstream set)`:`Pushed ${e.branch} to ${e.remote}`),onError:N}),I=_({mutationFn:()=>d(e.id),onSuccess:e=>{b(`Draft PR created — ${e.url}`),M()},onError:N}),L=_({mutationFn:()=>a(e.id),onError:e=>{if(e instanceof o&&e.command){navigator.clipboard.writeText(e.command).then(()=>b(`No terminal found — command copied to clipboard.`)).catch(()=>b(`Run manually: ${e.command}`));return}N(e)}}),R=_({mutationFn:t=>s(e.id,t),onError:N}),V=r.isError&&r.error instanceof o&&r.error.status===409,U=X({run:e,cliHandoff:e.cliHandoff,hasWorktree:!!e.worktreePath&&!V,branch:e.branch,changedFiles:r.data?.stat.files,remote:n.data?.info?.remote,forge:t.data?.forge??null,localHandoff:t.data?.capabilities.localHandoff??!1,hasSession:B(e)!==void 0,prUrl:e.pullRequestUrl}),W=e=>{switch(e){case`commit`:k(!0);break;case`push`:F.mutate();break;case`create-pr`:I.mutate();break;case`open-terminal`:L.mutate();break;case`view-pr`:break}},K=r.data?.files??[],q=(0,G.useMemo)(()=>E(K),[K]),J=(0,G.useMemo)(()=>K.some(H),[K]),Y=i?c:`unified`,$=!i||g;return(0,Z.jsxs)(`div`,{"data-route":`task-changes`,className:`flex min-h-full flex-col`,children:[(0,Z.jsx)(C,{run:e,tab:`changes`}),(0,Z.jsx)(T,{bar:U,healthReady:t.data!==void 0,branch:e.branch,stat:r.data?.stat,mode:Y,wrap:$,preview:x,onModeChange:f,onWrapChange:y,onPreviewChange:J?S:void 0,onAction:W}),r.data?.repointedHead?(0,Z.jsxs)(`p`,{"data-slot":`repointed-head-note`,className:`border-b px-4 py-2 text-xs text-soft-foreground md:px-9`,children:[`HEAD is on `,(0,Z.jsx)(`code`,{children:r.data.repointedHead.headBranch}),`, not this task's branch`,` `,(0,Z.jsx)(`code`,{children:r.data.repointedHead.taskBranch}),` — showing only what this task changed there.`]}):null,(0,Z.jsx)(te,{changes:r,changesRefused:V,fileCount:K.length,children:(0,Z.jsx)(ne,{runId:e.id,files:K,tree:q,selected:w,selectFile:e=>{D(e),A.current?.scrollToPath(e)},diffRef:A,effectiveMode:Y,effectiveWrap:$,preview:x,localHandoff:t.data?.capabilities.localHandoff,onOpenInApp:R.mutate})}),(0,Z.jsx)(Q,{run:e,open:O,onOpenChange:k})]})}function te({changes:e,changesRefused:t,fileCount:n,children:r}){return e.isPending?(0,Z.jsx)(`p`,{"data-slot":`changes-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-9`,children:`Loading changes…`}):e.isError?(0,Z.jsx)(I,{icon:t?(0,Z.jsx)(x,{size:16}):(0,Z.jsx)(S,{size:16}),tone:t?`neutral`:`danger`,heading:`h2`,title:t?`No changes to show`:`Could not load the changes`,subtitle:e.error.message}):n===0?(0,Z.jsx)(I,{icon:(0,Z.jsx)(x,{size:16}),tone:`neutral`,heading:`h2`,title:`No changes yet`,subtitle:`The worktree matches its base branch. Changes appear here as the agent works.`}):r}function ne({runId:e,files:t,tree:n,selected:i,selectFile:a,diffRef:o,effectiveMode:s,effectiveWrap:c,preview:l,localHandoff:u,onOpenInApp:d}){return(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col items-stretch gap-5 md:flex-row md:items-start px-[18px] pb-9 pt-0 [--diff-sticky-top:0px] md:[--diff-sticky-top:1rem] md:px-9`,children:[(0,Z.jsxs)(`aside`,{"data-slot":`changes-tree-pane`,className:`md:sticky md:top-4 max-h-[calc(100dvh_-_64px_-_var(--diff-sticky-top)_-_1rem)] w-full md:w-60 shrink-0 overflow-y-auto overscroll-contain rounded-xl border border-border bg-card p-3.5 md:block lg:w-[250px]`,children:[(0,Z.jsx)(`h2`,{className:`mb-3 border-b border-border pb-3 text-xs font-semibold`,children:`Changed files`}),(0,Z.jsx)(w,{root:n,selected:i,onSelect:a})]}),(0,Z.jsx)(W,{files:t,viewRef:o,mode:s,wrap:c,preview:l,loadFileText:t=>re(e,t),imageSrc:t=>r(e,t),onOpenInApp:u?e=>d(e):void 0,className:`min-w-0 flex-1`})]})}async function re(e,t){try{let n=await i(e,t);return n.type!==`file`||n.binary||n.tooLarge?null:n.content??null}catch{return null}}export{$ as TaskChangesRoute};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./utils-DSMR_WLb.js";import{Nn as i}from"./project-scope-context-C912rTJP.js";import{Q as a,X as o,Y as s,Z as c}from"./queries-DRpvYgai.js";import{h as l}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{C as u,S as d,X as f,j as p}from"./design-icons-CzEoMH9c.js";import{t as m}from"./run-header-Dpr7e1J3.js";import{t as h}from"./project-router-DucFIl_x.js";import{b as g}from"./task-groups-ClNnAPRA.js";import{t as _}from"./centered-state-V15AR_qo.js";import{C as v,Gn as y,s as b,w as x}from"./index-Clu9VXJs.js";import{t as S}from"./commit-diff-panel-B5u3nzBH.js";var C=e(t(),1),w=n(),T=77;function E({slot:e,commits:t,className:n,heading:i}){let[a,o]=(0,C.useState)(``),s=a.trim().toLowerCase(),c=s?t.filter(e=>e.subject.toLowerCase().includes(s)):t,l=c.length>150,u=(0,C.useRef)(null),d=(0,C.useRef)(null),[p,m]=(0,C.useState)(0);(0,C.useLayoutEffect)(()=>{if(!l)return;let e=()=>{let e=u.current,t=d.current;!e||!t||m(Math.max(0,Math.round(e.getBoundingClientRect().top-t.getBoundingClientRect().top+t.scrollTop)))};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[l]);let h=c.map(n=>(0,w.jsx)(D,{commit:n,detailed:e===`task-commits`&&t.length===1},n.sha));return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`label`,{className:`relative mb-[22px] block`,children:[(0,w.jsx)(f,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute top-3.5 left-3 size-4 text-muted-foreground`}),(0,w.jsx)(y,{"aria-label":`Search commit messages`,placeholder:`Search commit messages…`,value:a,onChange:e=>o(e.target.value),className:`h-11 bg-card pl-10`})]}),(0,w.jsxs)(`div`,{ref:e=>{u.current=e,e&&(d.current=e.closest(`[data-slot="main"]`))},"data-slot":e,"data-virtualized":l,className:r(`flex flex-col divide-y divide-border rounded-xl border border-border bg-card px-4 py-1 md:px-5`,n),children:[i?(0,w.jsx)(`div`,{className:`flex min-h-14 flex-wrap items-center gap-2 py-4`,children:i}):null,c.length===0?(0,w.jsx)(`p`,{role:`status`,className:`py-5 text-sm text-muted-foreground`,children:`No loaded commits match your search.`}):null,l?(0,w.jsx)(b,{scrollRef:d,startMargin:p,itemSize:T,children:h}):h]})]})}function D({commit:e,detailed:t}){return(0,w.jsx)(`div`,{className:`[contain-intrinsic-block-size:auto_77px] [content-visibility:auto]`,children:(0,w.jsxs)(h,{"data-slot":`commit-row`,"data-sha":e.sha,to:e.href,className:r(`flex min-h-[76px] min-w-0 flex-col items-start gap-3 rounded-sm py-4 hover:bg-muted`,!t&&`md:flex-row md:items-center md:py-3`),children:[(0,w.jsx)(p,{size:16,"aria-hidden":`true`,className:r(`shrink-0 text-accent-text`,t?`size-[22px]`:`size-4`)}),(0,w.jsxs)(`span`,{className:r(`min-w-0 w-full`,!t&&`md:w-auto md:flex-1`),children:[(0,w.jsx)(`span`,{className:r(`block font-normal`,t?`text-[22px] leading-snug`:`text-[13px] md:truncate`),children:e.subject}),(0,w.jsxs)(`span`,{className:`mt-1 block truncate text-[11px] text-soft-foreground`,children:[e.author,` · `,e.when]})]}),(0,w.jsx)(`span`,{className:`shrink-0 rounded-md bg-muted px-2 py-1 font-mono text-[11px] text-muted-foreground`,children:e.shaLabel}),t?(0,w.jsxs)(`span`,{className:`inline-flex min-h-11 items-center gap-2 rounded-lg bg-action px-3 text-xs font-medium text-action-foreground`,children:[(0,w.jsx)(u,{size:16,"aria-hidden":`true`,className:`size-4`}),`View changes`]}):null]})})}function O(){let{id:e}=l(),t=s(e);return t.isPending?(0,w.jsx)(x,{tab:`changes`}):t.isError?(0,w.jsx)(v,{tab:`changes`,error:t.error}):(0,w.jsx)(k,{run:t.data})}function k({run:e}){let{sha:t}=l(),n=a(e.id,g(e));return(0,w.jsxs)(`div`,{"data-route":`task-commits`,className:`flex min-h-full flex-col`,children:[(0,w.jsx)(m,{run:e,tab:`commits`}),t?(0,w.jsx)(A,{runId:e.id,sha:t}):n.isPending?(0,w.jsx)(`p`,{"data-slot":`commits-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading commits…`}):n.isError?(0,w.jsx)(_,{icon:(0,w.jsx)(p,{size:16}),tone:n.error instanceof i&&n.error.status===409?`neutral`:`danger`,heading:`h2`,title:n.error instanceof i&&n.error.status===409?`No commits to show`:`Could not load the commits`,subtitle:n.error.message}):n.data.commits.length===0?(0,w.jsx)(_,{icon:(0,w.jsx)(p,{size:16}),tone:`neutral`,heading:`h2`,title:`No commits yet`,subtitle:`This task hasn't committed anything on its branch. Autosave commits and any the agent makes appear here.`}):(0,w.jsxs)(`div`,{className:`px-[18px] py-[22px] md:px-9`,children:[(0,w.jsx)(E,{slot:`task-commits`,heading:(0,w.jsxs)(`h2`,{className:`text-base font-semibold`,children:[n.data.commits.length,` `,n.data.commits.length===1?`commit`:`commits`,` in this task`]}),className:`w-full`,commits:n.data.commits.map(t=>({...t,shaLabel:t.sha.slice(0,8),href:`/tasks/${e.id}/commits/${t.sha}`}))}),(0,w.jsx)(j,{run:e})]})]})}function A({runId:e,sha:t}){return(0,w.jsx)(S,{commit:c(e,t),sha:t,backTo:`/tasks/${e}/commits`,backLabel:`All commits`,slot:`task-commit`,className:`mx-auto flex min-h-0 w-full max-w-[var(--measure)] flex-1 flex-col`,diffClassName:`px-4 py-4 [--diff-sticky-top:0px] md:[--diff-sticky-top:1rem] md:px-6`})}function j({run:e}){let t=o(e.id,g(e));return t.isPending?(0,w.jsx)(`p`,{className:`mt-[22px] text-xs text-muted-foreground`,children:`Loading changed files…`}):t.isError?(0,w.jsxs)(`p`,{role:`status`,className:`mt-[22px] text-xs text-danger`,children:[`Could not load changed files: `,t.error.message]}):t.data.files.length===0?null:(0,w.jsxs)(`section`,{"data-slot":`task-commit-files`,className:`mt-[22px] rounded-[10px] border border-border bg-card p-5`,children:[(0,w.jsxs)(`h2`,{className:`mb-4 text-[16px] font-semibold`,children:[t.data.files.length,` changed files`]}),(0,w.jsx)(`ul`,{className:`space-y-4`,children:t.data.files.map(t=>(0,w.jsx)(`li`,{children:(0,w.jsxs)(h,{to:`/tasks/${e.id}/changes`,className:`flex min-h-11 items-center gap-2 text-xs text-muted-foreground hover:text-foreground`,children:[(0,w.jsx)(d,{size:16,"aria-hidden":`true`,className:`size-[15px] shrink-0`}),(0,w.jsx)(`span`,{className:`break-all`,children:t.path})]})},t.path))})]})}export{O as TaskCommitsRoute};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./utils-DSMR_WLb.js";import{Nn as i,et as a,ut as o}from"./project-scope-context-C912rTJP.js";import{B as s,F as c,N as l,Y as u,et as d}from"./queries-DRpvYgai.js";import{f,g as p,h as m,m as h}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{S as g,T as _,X as v,ot as y,u as b}from"./design-icons-CzEoMH9c.js";import{t as x}from"./createLucideIcon-BHp8sXmF.js";import{f as S,t as C}from"./run-header-Dpr7e1J3.js";import{a as w,i as T,n as E,r as D}from"./file-preview-BXBSy4MR.js";import{t as O}from"./button-BQ2y4XRB.js";import{t as k}from"./centered-state-V15AR_qo.js";import{C as A,Gn as j,w as M}from"./index-Clu9VXJs.js";import{r as N}from"./markdown-C6YMilQS.js";var P=x(`folder-tree`,[[`path`,{d:`M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`hod4my`}],[`path`,{d:`M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`w4yl2u`}],[`path`,{d:`M3 5a2 2 0 0 0 2 2h3`,key:`f2jnh7`}],[`path`,{d:`M3 3v13a2 2 0 0 0 2 2h3`,key:`k8epm1`}]]),F=x(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),I=e(t(),1),L=n();function R({runId:e,path:t,artifactId:n}){let r=s(e,n?null:t),i=l(e,n),c=n?i:r,u=(0,I.useContext)(N),d=f(),p=d.pathname.replace(/\/files\/?$/,`/report`)+d.search,m=c.data,h=(0,I.useMemo)(()=>m?.type===`file`&&m.source!==`artifact`?{runId:e,...u,basePath:m.path}:null,[m,u,e]);if(!t&&!n)return(0,L.jsx)(D,{runId:e,path:null,className:`min-w-0 flex-1`});if(c.isPending)return(0,L.jsx)(`p`,{role:`status`,className:`p-4`,children:`Loading file…`});if(c.isError)return(0,L.jsxs)(`section`,{"data-slot":`file-preview`,className:`min-w-0 flex-1 rounded-lg border p-4`,children:[(0,L.jsx)(`h2`,{children:`Could not load this file`}),(0,L.jsx)(`p`,{className:`wrap-anywhere text-sm`,children:c.error.message}),(0,L.jsx)(O,{variant:`outline`,onClick:()=>void c.refetch(),children:`Retry`})]});if(!m)return(0,L.jsx)(`p`,{role:`alert`,className:`p-4`,children:`No file data was returned.`});if(m.type!==`file`)return(0,L.jsxs)(`section`,{"data-slot":`file-preview`,className:`min-w-0 flex-1 rounded-lg border p-4`,children:[(0,L.jsx)(`h2`,{children:m.type===`unpublished`?`File not published`:`Cannot preview this file`}),(0,L.jsx)(`p`,{className:`wrap-anywhere py-2 font-mono text-xs`,children:m.path}),(0,L.jsx)(`p`,{className:`text-sm`,children:m.reason}),(0,L.jsx)(O,{variant:`outline`,onClick:()=>void c.refetch(),children:`Retry`})]});let g=m.artifact;return(0,L.jsx)(N.Provider,{value:h,children:(0,L.jsx)(E,{runId:e,entry:m,documentPreview:!0,readerHref:p,className:`min-w-0 flex-1`,imageUrl:g?a(e,g.id,`image`):o(e,t),...g?{downloadUrl:a(e,g.id,`download`),snapshot:new Date(g.createdAt).toLocaleString()}:{}},g?.id??m.path)})}var z=new Map;function B(e){let t=e?.filesRestoreKey;return typeof t==`string`&&t?t:null}var V=(0,I.createContext)(null);function H(){let{key:e}=f(),t=h()===`POP`,[n,r]=(0,I.useState)({key:e,generation:0});if(n.key===e)return n.generation;let i={key:e,generation:t?n.generation+1:n.generation};return r(i),i.generation}var U=()=>document.querySelector(`[data-slot="main"]`);function W(e,t){let n=(0,I.useRef)(null),r=f(),i=h()===`POP`?r.key:B(r.state),[a]=(0,I.useState)(()=>{let t=i?z.get(i):void 0;return t?.runId===e?t:null}),o=(0,I.useRef)(new Set(a?.folders??[])),s=(0,I.useRef)(new Set),[c,l]=(0,I.useState)(0),u=(0,I.useRef)(a===null),d=(0,I.useCallback)(()=>{u.current&&z.set(r.key,{runId:e,folders:new Set(o.current),tree:n.current?.scrollTop??0,main:U()?.scrollTop??0})},[r.key,e]),p=(0,I.useMemo)(()=>({isOpen:e=>o.current.has(e),setOpen:(e,t)=>{t?o.current.add(e):o.current.delete(e),d()},loading:(e,t)=>{a?.folders.has(e)&&(t?s.current.add(e):s.current.delete(e),l(s.current.size))}}),[a,d]);return(0,I.useEffect)(()=>{if(u.current||!a||!t||s.current.size>0)return;n.current&&(n.current.scrollTop=a.tree);let e=U();e&&(e.scrollTop=a.main),u.current=!0,d()},[a,t,c,d]),(0,I.useEffect)(()=>{d();let e=[n.current,U()].filter(e=>e!==null);for(let t of e)t.addEventListener(`scroll`,d,{passive:!0});return()=>{for(let t of e)t.removeEventListener(`scroll`,d)}},[d]),{tree:n,folders:p}}function G({runId:e,selected:t,onSelect:n}){return(0,L.jsx)(`nav`,{"data-slot":`files-tree`,"aria-label":`Worktree files`,className:`min-w-0 text-[13px]`,children:(0,L.jsx)(`ul`,{className:`flex flex-col gap-px`,children:(0,L.jsx)(K,{runId:e,path:``,depth:0,selected:t,onSelect:n})})})}function K({runId:e,path:t,depth:n,selected:r,onSelect:i}){let a=d(e,t),o=(0,I.useContext)(V);return(0,I.useEffect)(()=>{if(!(!t||!o))return o.loading(t,a.isPending),()=>o.loading(t,!1)},[o,t,a.isPending]),a.isPending?(0,L.jsx)(`li`,{"data-slot":`files-tree-loading`,className:`px-1.5 py-1 text-xs text-soft-foreground`,style:{paddingLeft:`${6+n*14}px`},children:`Loading…`}):a.isError?(0,L.jsx)(`li`,{"data-slot":`files-tree-error`,className:`px-1.5 py-1 text-xs text-danger`,style:{paddingLeft:`${6+n*14}px`},children:a.error.message}):a.data.type===`dir`?a.data.entries.length===0?(0,L.jsx)(`li`,{"data-slot":`files-tree-empty`,className:`px-1.5 py-1 text-xs text-soft-foreground`,style:{paddingLeft:`${6+n*14}px`},children:`Empty directory`}):(0,L.jsx)(L.Fragment,{children:a.data.entries.map(a=>a.type===`dir`?(0,L.jsx)(q,{runId:e,name:a.name,path:t===``?a.name:`${t}/${a.name}`,depth:n,selected:r,onSelect:i},a.name):(0,L.jsx)(J,{name:a.name,path:t===``?a.name:`${t}/${a.name}`,size:a.size,depth:n,selected:r,onSelect:i},a.name))}):null}function q({runId:e,name:t,path:n,depth:i,selected:a,onSelect:o}){let s=(0,I.useContext)(V),[c,l]=(0,I.useState)(()=>s?.isOpen(n)??!1);return(0,L.jsxs)(`li`,{children:[(0,L.jsxs)(`button`,{type:`button`,"data-slot":`files-dir`,"data-path":n,"data-state":c?`open`:`closed`,"aria-expanded":c,onClick:()=>{s?.setOpen(n,!c),l(!c)},className:`flex min-h-11 md:min-h-8 w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left text-muted-foreground hover:bg-muted hover:text-foreground`,style:{paddingLeft:`${6+i*14}px`},children:[(0,L.jsx)(b,{size:16,"aria-hidden":`true`,className:r(`order-last ml-auto size-3.5 shrink-0 transition-transform motion-reduce:transition-none`,c&&`rotate-90`)}),(0,L.jsx)(_,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,L.jsx)(`span`,{className:`min-w-0 truncate font-normal`,children:t})]}),c?(0,L.jsx)(`ul`,{className:`flex flex-col gap-px`,children:(0,L.jsx)(K,{runId:e,path:n,depth:i+1,selected:a,onSelect:o})}):null]})}function J({name:e,path:t,size:n,depth:i,selected:a,onSelect:o}){let s=a===t,c=w(t)?F:g;return(0,L.jsx)(`li`,{children:(0,L.jsxs)(`button`,{type:`button`,"data-slot":`files-file`,"data-path":t,"aria-current":s?`true`:void 0,onClick:()=>o(t),className:r(`flex min-h-11 md:min-h-8 w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left hover:bg-muted`,s?`bg-muted font-medium text-foreground`:`text-muted-foreground hover:text-foreground`),style:{paddingLeft:`${6+i*14}px`},children:[(0,L.jsx)(c,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,L.jsx)(`span`,{className:`min-w-0 truncate`,children:e}),n===void 0?null:(0,L.jsx)(`span`,{className:`ml-auto shrink-0 pl-2 font-mono text-[11px] tabular-nums text-soft-foreground`,children:T(n)})]})})}function Y(){let{id:e}=m(),t=u(e),n=H();return t.isPending?(0,L.jsx)(M,{tab:`files`}):t.isError?(0,L.jsx)(A,{tab:`files`,error:t.error}):(0,L.jsx)(S,{runId:t.data.id,children:(0,L.jsx)(Z,{run:t.data},`${t.data.id}:${n}`)})}function X(e,t,n,r){let i=s(e,r||n!==null?null:t),a=l(e,r?null:n);return r||t===null&&n===null?!0:!(n===null?i:a).isPending}function Z({run:e}){let t=d(e.id,``),n=c(e.id),[r,a]=p(),o=r.get(`path`),s=r.get(`artifact`),l=r.getAll(`path`).length>1||r.getAll(`artifact`).length>1||o!==null&&s!==null,[u,f]=(0,I.useState)(o??``);(0,I.useEffect)(()=>f(o??``),[o]);let m=(e,t)=>{let n=new URLSearchParams(r);n.delete(`path`),n.delete(`artifact`),n.set(e,t),a(n)},h=t.isError&&t.error instanceof i&&t.error.status===409,g=X(e.id,o,s,l),_=W(e.id,!t.isPending&&g);return(0,L.jsxs)(`div`,{"data-route":`task-files`,className:`flex min-h-full flex-col`,children:[(0,L.jsx)(C,{run:e,tab:`files`}),(0,L.jsxs)(`form`,{className:`flex min-w-0 gap-2 px-[18px] pt-[22px] md:px-9`,onSubmit:e=>{e.preventDefault(),u.trim()&&m(`path`,u.trim())},children:[(0,L.jsxs)(`label`,{className:`relative min-w-0 flex-1`,children:[(0,L.jsx)(v,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,L.jsx)(j,{"aria-label":`File path in the worktree`,placeholder:`Open a file by path…`,value:u,onChange:e=>f(e.target.value),className:`h-11 min-w-0 bg-card pl-10`})]}),(0,L.jsx)(O,{type:`submit`,variant:`outline`,className:`h-11 shrink-0`,disabled:!u.trim(),children:`Open file`})]}),(0,L.jsxs)(`div`,{className:`flex min-h-0 flex-col items-stretch gap-5 px-[18px] py-[22px] [--diff-sticky-top:1rem] md:flex-row md:items-start md:px-9`,children:[(0,L.jsxs)(`aside`,{ref:_.tree,"data-slot":`files-tree-pane`,className:`w-full shrink-0 rounded-xl border border-border bg-card p-3.5 md:sticky md:top-[var(--diff-sticky-top)] md:max-h-[calc(100dvh_-_64px_-_var(--diff-sticky-top)_-_1rem)] md:w-60 md:overflow-y-auto md:overscroll-contain lg:w-72`,children:[(0,L.jsx)(`h2`,{className:`sr-only`,children:`Worktree files`}),t.isPending?(0,L.jsx)(`p`,{"data-slot":`files-loading`,className:`py-4 text-xs`,children:`Loading files…`}):t.isError?(0,L.jsx)(k,{icon:h?(0,L.jsx)(P,{}):(0,L.jsx)(y,{size:16}),tone:h?`neutral`:`danger`,heading:`h2`,title:h?`No files to browse`:`Could not load the files`,subtitle:t.error.message}):(0,L.jsx)(V.Provider,{value:_.folders,children:(0,L.jsx)(G,{runId:e.id,selected:o,onSelect:e=>m(`path`,e)})}),(0,L.jsxs)(`section`,{className:`mt-4 border-t border-border pt-3`,"aria-label":`Published artifacts`,children:[(0,L.jsx)(`h2`,{className:`text-sm font-medium`,children:`Published artifacts`}),n.isPending?(0,L.jsx)(`p`,{className:`py-2 text-xs`,children:`Loading published files…`}):n.isError?(0,L.jsx)(`p`,{role:`alert`,className:`py-2 text-xs`,children:`Could not load published files.`}):n.data.artifacts.length===0?(0,L.jsx)(`p`,{className:`py-2 text-xs text-muted-foreground`,children:`No published files yet.`}):(0,L.jsx)(`ul`,{children:n.data.artifacts.map(e=>(0,L.jsx)(`li`,{children:(0,L.jsx)(`button`,{type:`button`,"aria-current":e.id===s?`true`:void 0,className:`min-h-11 w-full rounded px-2 py-2 text-left text-xs wrap-anywhere hover:bg-muted focus-visible:ring-2`,onClick:()=>m(`artifact`,e.id),children:e.name})},e.id))}),(0,L.jsx)(O,{variant:`ghost`,className:`min-h-11`,onClick:()=>void n.refetch(),children:`Refresh published files`})]})]}),l?(0,L.jsx)(`p`,{role:`alert`,className:`p-4`,children:`Invalid file link: choose either a path or a published artifact.`}):o!==null||s!==null||t.isSuccess?(0,L.jsx)(R,{runId:e.id,path:o,artifactId:s}):null]}),(0,L.jsx)(`p`,{className:`px-[18px] pb-6 text-xs text-muted-foreground md:px-9`,children:`Browsing files is read-only. Worktree contents may differ from your main checkout. Published files are snapshots.`})]})}export{Y as TaskFilesRoute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./react-runtime-CCIEwYL0.js";import{n as t}from"./utils-DSMR_WLb.js";import{G as n,di as r}from"./project-scope-context-C912rTJP.js";import{Bt as i,
|
|
1
|
+
import{t as e}from"./react-runtime-CCIEwYL0.js";import{n as t}from"./utils-DSMR_WLb.js";import{G as n,di as r}from"./project-scope-context-C912rTJP.js";import{Bt as i,Y as a,bt as o,o as s,r as c,sn as l,vt as u,xt as d}from"./queries-DRpvYgai.js";import{h as f}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{g as p,p as m}from"./tasks-table-CE_VVk0w.js";import{F as h,ot as g,p as _}from"./design-icons-CzEoMH9c.js";import{t as v}from"./run-header-Dpr7e1J3.js";import{t as y}from"./external-link-BE6y205O.js";import{u as b}from"./reference-chip-zRuFkaGy.js";import{t as x}from"./button-BQ2y4XRB.js";import{t as S}from"./project-router-DucFIl_x.js";import{t as C}from"./centered-state-V15AR_qo.js";import{C as w,S as T,Xn as E}from"./index-Clu9VXJs.js";import{n as D,o as O,t as k}from"./use-hand-to-agent-state-CtDcLIHc.js";var A=e(),j={issue:`Issue`,pr:`Pull request`};function M({kind:e}){let{id:t}=f(),n=a(t);return n.isPending?(0,A.jsx)(T,{kind:e}):n.isError?(0,A.jsx)(w,{tab:`github-item`,error:n.error}):(0,A.jsx)(N,{run:n.data,kind:e})}function N({run:e,kind:t}){let{n}=f(),r=Number(n),i=o(),a=d(),c=u(),l=a.isPending||c.isPending,p=m(e,i).some(e=>e.kind===t&&e.number===r),h=s(t,r,p);return(0,A.jsxs)(`div`,{"data-route":`task-github-item`,className:`flex min-h-full flex-col`,children:[(0,A.jsx)(v,{run:e,tab:{kind:t,number:r}}),p?(0,A.jsx)(V,{run:e,kind:t,number:r,repoBase:i,item:h}):l?(0,A.jsx)(T,{kind:t,number:r,heading:`h2`}):(0,A.jsx)(C,{icon:(0,A.jsx)(E,{size:16}),tone:`neutral`,heading:`h2`,title:`#${n} is not linked to this task`,subtitle:`Only the issues and pull requests this task references open here.`,actions:(0,A.jsx)(x,{asChild:!0,variant:`outline`,children:(0,A.jsx)(S,{to:`/tasks/${e.id}`,children:`Back to the session`})})})]})}function P(e,t){return e===`pr`&&t.data?.available===!0&&t.data.item!==null}function F(e,t,n,r){return e===`pr`?n?.[t]??r:r}function I({retry:e,kind:t,number:n}){return(0,A.jsx)(x,{variant:`outline`,disabled:e.isPending,onClick:()=>e.mutate(i.githubItem(t,n)),children:`Retry`})}function L({kind:e,number:t,error:n,retryButton:r}){return(0,A.jsx)(C,{icon:(0,A.jsx)(g,{size:16}),tone:`danger`,heading:`h2`,title:`Could not load ${j[e].toLowerCase()} #${t}`,subtitle:n.message,actions:r})}function R({run:e,kind:n,number:r,repoBase:i,reason:a,retryError:o,retryButton:s}){let c=n===`pr`?h:_,l=p(e,i).find(e=>e.kind===`PR`==(n===`pr`)&&e.number===r)?.url;return(0,A.jsx)(C,{icon:(0,A.jsx)(c,{size:16}),tone:`neutral`,heading:`h2`,title:`GitHub is unavailable`,subtitle:o?.message??a,actions:(0,A.jsxs)(A.Fragment,{children:[s,l&&t(l)?(0,A.jsx)(x,{asChild:!0,variant:`outline`,children:(0,A.jsxs)(`a`,{href:l,target:`_blank`,rel:`noopener noreferrer`,children:[`open on GitHub`,(0,A.jsx)(y,{"aria-hidden":`true`})]})}):null]})})}function z({label:e,repoBase:t}){return(0,A.jsx)(C,{icon:(0,A.jsx)(b,{}),tone:`neutral`,heading:`h2`,title:`${e} was not found in ${H(t)}`,subtitle:`It may have been deleted, or the number points at a different repository.`})}function B({kind:e,item:t,labelColors:n,checks:r}){return(0,A.jsx)(`div`,{className:`min-w-0 px-0.5 md:px-2`,children:(0,A.jsx)(O,{item:t,colors:n??{},checks:r,backLink:null,subNav:null,children:e===`issue`?(0,A.jsx)(U,{item:t},t.url):null})})}function V({run:e,kind:t,number:i,repoBase:a,item:o}){let s=r(),u=l({mutationFn:e=>n(t,i,{refresh:!0}),onSuccess:(e,t)=>s.setQueryData(t,e)}),d=P(t,o),f=c(d?[i]:[],d),p=f.data?.available?f.data.checks:void 0,m=`${j[t]} #${i}`,h=(0,A.jsx)(I,{retry:u,kind:t,number:i});if(o.isPending)return(0,A.jsx)(T,{kind:t,number:i,heading:`h2`});if(o.isError)return(0,A.jsx)(L,{kind:t,number:i,error:u.error??o.error,retryButton:h});let g=o.data;return g.available?g.item?(0,A.jsx)(B,{kind:t,item:g.item,labelColors:g.labelColors,checks:F(t,i,p,g.item.checks)}):(0,A.jsx)(z,{label:m,repoBase:a}):(0,A.jsx)(R,{run:e,kind:t,number:i,repoBase:a,reason:g.reason,retryError:u.error,retryButton:h})}function H(e){if(!e)return`this repository`;try{return new URL(e).pathname.split(`/`).filter(Boolean).slice(0,2).join(`/`)||`this repository`}catch{return`this repository`}}function U({item:e}){let t=k();return(0,A.jsx)(D,{item:e,workflows:t.workflows.data?.workflows??[],skills:t.skillList,workflow:t.workflow,onWorkflowChange:t.setWorkflow,selectedSkills:t.selectedSkills,onSkillsChange:t.setSelectedSkills,engine:t.engine,onEngineChange:t.setEngine,queuedRunId:t.queued.get(e.url)??null,onQueued:t.onQueued},e.url)}export{M as TaskGithubItemRoute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Bn as e,Cn as t,Ir as n,On as r,Qn as i,kn as a}from"./project-scope-context-C912rTJP.js";import"./queries-
|
|
1
|
+
import{Bn as e,Cn as t,Ir as n,On as r,Qn as i,kn as a}from"./project-scope-context-C912rTJP.js";import"./queries-DRpvYgai.js";import"./attention-BFUaj1mU.js";function o(e,t){let n;for(let r of e)!r.sessionId||r.id===t||(!n||!r.startedAt||!n.startedAt||r.startedAt>=n.startedAt)&&(n=r);return n}function s(e,t){return e?.backend??t?.runner??`claude`}function c(e,t){let n;for(let r of e)r.removedBackend===void 0&&(t===void 0||r.sessionId!==t)||(!n||!r.startedAt||!n.startedAt||r.startedAt>=n.startedAt)&&(n=r);return n?.removedBackend===void 0?void 0:n}function l(e){let t=o(e.steps),n=c(e.steps,t?.sessionId)?void 0:t;return{sessionId:n?.sessionId,backend:s(n,e),profileId:n?.profileId}}function u(e){return e.command===void 0&&e.kind!==`plugin`}function d(e){let t=e.workflowCursor?.mode===`resume`?e.workflowCursor.stepId:void 0;if(t&&e.steps.find(e=>e.id===t)?.status===`failed`)return t;let n=o(e.steps);if(n)return n.synthetic===`continuation`&&n.continuesStepId!==void 0?n.continuesStepId:e.steps.find(e=>e.sessionId===n.sessionId)?.id??n.id}function f(e,t=!1){if(e.delegation?.role!==`worker`)return;let n=e.workflowDef?.steps;if(!n?.length)return;if(t)return n.find(u);let r=d(e);return(r?n.find(e=>e.id===r&&u(e)):void 0)??[...n].reverse().find(u)}var p=new Set([`queued`,`running`,`waiting`]);function m(e){return p.has(e)}function h(e){return i(e)?!1:e.status===`queued`||e.status===`running`||e.status===`waiting`}function g(e){return h(e)&&e.status!==`queued`}function _(t,n,r){return t.archived||!(t.status===`done`||t.status===`failed`||t.status===`cancelled`)||t.delegation?.role===`worker`||r!==void 0&&e(t)!==r?!1:n===`unpinned`?!t.pinned:n!==`pinned`||t.pinned===!0}var v=[`done`,`failed`];function y(e){return e.archived||i(e)||!v.includes(e.status)?!1:e.finishedAt!==void 0}function b(e){let t=e.finishedAt;return t===void 0||!y(e)?!1:e.seenAt===void 0||e.seenAt<t}var x=[`Needs you`,`Finished`,`Working`,`Archived`],S={waiting:0,review:1,running:2,queued:4,done:5,failed:6,cancelled:7},C=3,w=e=>i(e)?C:S[e.status]??9;function T(e){let n=e=>t[r(e).bucket];return[...e].sort((e,t)=>n(e)-n(t)||w(e)-w(t))[0]}function E(e,t){return t===`archived`?`Archived`:a(e)?`Needs you`:e.status===`waiting`||e.status===`running`||e.status===`queued`?`Working`:`Finished`}function D(e){let t=e.titleSummary;return t===void 0||!(e.titleOrigin===`user`||e.titleOrigin===`marker`)&&/[.!?][A-Z]/.test(t)?e.title:t}function O(e){let t=/^(\d{1,9}): (.+)$/.exec(e),n=t?.[1],r=t?.[2];return n===void 0||r===void 0?{ref:null,rest:e}:{ref:Number(n),rest:r}}function k(e,t){return t!==void 0&&O(e).ref===t}function A(e){let t=e.filter(e=>!e.archived&&e.status===`queued`).sort((e,t)=>e.createdAt.localeCompare(t.createdAt));return new Map(t.map((e,t)=>[e.id,t+1]))}function j(e,t){return e.filter(e=>t===`archived`?e.archived:!e.archived).sort((e,n)=>{if(t!==`archived`){let t=Number(!!n.pinned)-Number(!!e.pinned);if(t!==0)return t}let r=w(e)-w(n);if(r!==0)return r;if(i(e)&&i(n)){let t=e.autoResumeAt.localeCompare(n.autoResumeAt);if(t!==0)return t}return e.status===`queued`&&n.status===`queued`?e.createdAt.localeCompare(n.createdAt):n.createdAt.localeCompare(e.createdAt)})}function M(e){return e.delegation?.role===`worker`}function N(e,t){if(e==null)return null;let n=t.find(t=>t.id===e);return!n||!M(n)?e:n.delegation?.parentRunId??e}function P(e,t,n=A(e)){let r=j(e,t).filter(e=>!M(e)),i=new Map,a=(e,t)=>{let n=i.get(e);n?n.push(t):i.set(e,[t])};for(let e of r)a(E(e,t),{kind:`run`,run:e,queuePosition:n.get(e.id)??null});return x.filter(e=>i.has(e)).map(e=>({label:e,rows:i.get(e)}))}function F(e,t={}){let r=typeof t==`number`?{overall:t}:n(t),i={"Needs you":`needsYou`,Finished:`finished`,Working:`working`},a=[],o=r.overall===void 0?10:r.overall??1/0;for(let t of e){let e=t.label===`Archived`?1/0:r[i[t.label]]??1/0,n=t.rows.filter(n=>{let r=n.run.pinned;return t.label!==`Archived`&&r?!0:o<=0||e<=0?!1:(--o,--e,!0)});n.length&&a.push({label:t.label,rows:n})}return a}function I(e,t){if(t.length===0)return[...e];let n=new Set(e.map(e=>e.id)),r=new Set,i=t.filter(e=>n.has(e.id)||r.has(e.id)?!1:(r.add(e.id),!0));return[...e,...i]}function L(e){let t=0,n=0,r=0;for(let i of e)if(!M(i)){if(i.archived){n+=1;continue}t+=1,a(i)&&(r+=1)}return{active:t,archived:n,waiting:r}}function R(t,n,r){return t.filter(t=>!t.archived&&(!r||e(t)===(n===`automations`)))}var z={"Needs you":`needs-you`,Finished:`finished`,Working:`working`},B=Object.keys(z),V=`section`;function H(e,t,n){let r=`${V}=${z[e]}`;return n?`/?origin=${t===`automations`?`automations`:`direct`}&${r}`:`/?${r}`}function U(e){return B.find(t=>z[t]===e)??null}function W(t,n){let r={active:0,automations:0,activeWaiting:0,automationsWaiting:0};for(let i of t){if(M(i)||i.archived)continue;let t=+!!a(i);n&&e(i)?(r.automations+=1,r.automationsWaiting+=t):(r.active+=1,r.activeWaiting+=t)}return r}export{_ as C,s as D,o as E,f as O,g as S,l as T,O as _,P as a,h as b,T as c,k as d,D as f,R as g,W as h,F as i,U as l,N as m,V as n,M as o,H as p,B as r,L as s,x as t,A as u,I as v,b as w,m as x,y};
|